Add getaccount support to btcctl.

This commit is contained in:
Josh Rickmar 2013-12-30 16:31:47 -05:00
parent d17a97b485
commit 13868e76ec

View file

@ -48,6 +48,7 @@ var commandHandlers = map[string]*handlerData{
"debuglevel": &handlerData{1, 0, displayGeneric, nil, makeDebugLevel, "<levelspec>"}, "debuglevel": &handlerData{1, 0, displayGeneric, nil, makeDebugLevel, "<levelspec>"},
"decoderawtransaction": &handlerData{1, 0, displayJSONDump, nil, makeDecodeRawTransaction, "<txhash>"}, "decoderawtransaction": &handlerData{1, 0, displayJSONDump, nil, makeDecodeRawTransaction, "<txhash>"},
"dumpprivkey": &handlerData{1, 0, displayGeneric, nil, makeDumpPrivKey, "<bitcoinaddress>"}, "dumpprivkey": &handlerData{1, 0, displayGeneric, nil, makeDumpPrivKey, "<bitcoinaddress>"},
"getaccount": &handlerData{1, 0, displayGeneric, nil, makeGetAccount, "<address>"},
"getbalance": &handlerData{0, 2, displayGeneric, []conversionHandler{nil, toInt}, makeGetBalance, "[account] [minconf=1]"}, "getbalance": &handlerData{0, 2, displayGeneric, []conversionHandler{nil, toInt}, makeGetBalance, "[account] [minconf=1]"},
"getbestblockhash": &handlerData{0, 0, displayGeneric, nil, makeGetBestBlockHash, ""}, "getbestblockhash": &handlerData{0, 0, displayGeneric, nil, makeGetBestBlockHash, ""},
"getblock": &handlerData{1, 2, displayJSONDump, []conversionHandler{nil, toBool, toBool}, makeGetBlock, "<blockhash>"}, "getblock": &handlerData{1, 2, displayJSONDump, []conversionHandler{nil, toBool, toBool}, makeGetBlock, "<blockhash>"},
@ -166,6 +167,12 @@ func makeDumpPrivKey(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewDumpPrivKeyCmd("btcctl", args[0].(string)) return btcjson.NewDumpPrivKeyCmd("btcctl", args[0].(string))
} }
// makeGetAccount generates the cmd structure for
// getaddress commands.
func makeGetAccount(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewGetAccountCmd("btcctl", args[0].(string))
}
// makeGetBalance generates the cmd structure for // makeGetBalance generates the cmd structure for
// getbalance commands. // getbalance commands.
func makeGetBalance(args []interface{}) (btcjson.Cmd, error) { func makeGetBalance(args []interface{}) (btcjson.Cmd, error) {