add getnewaddress to btcctl

This commit is contained in:
David Hill 2014-01-27 12:35:20 -05:00
parent b9a641ab79
commit 221352586b

View File

@ -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, "<txhash> [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) {