From 221352586b72844c232e87da69ee33cc2ca575d4 Mon Sep 17 00:00:00 2001 From: David Hill Date: Mon, 27 Jan 2014 12:35:20 -0500 Subject: [PATCH] add getnewaddress to btcctl --- util/btcctl/btcctl.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index d64ce383..b35dd2f1 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -63,6 +63,7 @@ var commandHandlers = map[string]*handlerData{ "getdifficulty": &handlerData{0, 0, displayFloat64, nil, makeGetDifficulty, ""}, "getgenerate": &handlerData{0, 0, displayGeneric, nil, makeGetGenerate, ""}, "gethashespersec": &handlerData{0, 0, displayGeneric, nil, makeGetHashesPerSec, ""}, + "getnewaddress": &handlerData{0, 1, displayGeneric, nil, makeGetNewAddress, "[account]"}, "getpeerinfo": &handlerData{0, 0, displayJSONDump, nil, makeGetPeerInfo, ""}, "getrawmempool": &handlerData{0, 1, displayJSONDump, []conversionHandler{toBool}, makeGetRawMempool, "[verbose=false]"}, "getrawtransaction": &handlerData{1, 1, displayJSONDump, []conversionHandler{nil, toBool}, makeGetRawTransaction, " [verbose=false]"}, @@ -324,6 +325,15 @@ func makeGetHashesPerSec(args []interface{}) (btcjson.Cmd, error) { return btcjson.NewGetHashesPerSecCmd("btcctl") } +// makeGetNewAddress generates the cmd structure for getnewaddress commands. +func makeGetNewAddress(args []interface{}) (btcjson.Cmd, error) { + var account string + if len(args) > 0 { + account = args[0].(string) + } + return btcjson.NewGetNewAddressCmd("btcctl", account) +} + // makePeerInfo generates the cmd structure for // getpeerinfo commands. func makeGetPeerInfo(args []interface{}) (btcjson.Cmd, error) {