diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index 66b5c964..2468a965 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -44,39 +44,40 @@ var ( // commandHandlers is a map of commands and associated handler data that is used // to validate correctness and perform the command. var commandHandlers = map[string]*handlerData{ - "addnode": &handlerData{2, 0, displayJSONDump, nil, makeAddNode, " "}, - "createrawtransaction": &handlerData{2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"address\":amount,...}\""}, - "debuglevel": &handlerData{1, 0, displayGeneric, nil, makeDebugLevel, ""}, - "decoderawtransaction": &handlerData{1, 0, displayJSONDump, nil, makeDecodeRawTransaction, ""}, - "decodescript": &handlerData{1, 0, displayJSONDump, nil, makeDecodeScript, ""}, - "dumpprivkey": &handlerData{1, 0, displayGeneric, nil, makeDumpPrivKey, ""}, - "getaccount": &handlerData{1, 0, displayGeneric, nil, makeGetAccount, "
"}, - "getaccountaddress": &handlerData{1, 0, displayGeneric, nil, makeGetAccountAddress, ""}, - "getaddednodeinfo": &handlerData{1, 1, displayJSONDump, []conversionHandler{toBool, nil}, makeGetAddedNodeInfo, " [node]"}, - "getbalance": &handlerData{0, 2, displayGeneric, []conversionHandler{nil, toInt}, makeGetBalance, "[account] [minconf=1]"}, - "getbestblockhash": &handlerData{0, 0, displayGeneric, nil, makeGetBestBlockHash, ""}, - "getblock": &handlerData{1, 2, displayJSONDump, []conversionHandler{nil, toBool, toBool}, makeGetBlock, ""}, - "getblockcount": &handlerData{0, 0, displayGeneric, nil, makeGetBlockCount, ""}, - "getblockhash": &handlerData{1, 0, displayGeneric, []conversionHandler{toInt64}, makeGetBlockHash, ""}, - "getblocktemplate": &handlerData{0, 1, displayJSONDump, nil, makeGetBlockTemplate, "[jsonrequestobject]"}, - "getconnectioncount": &handlerData{0, 0, displayGeneric, nil, makeGetConnectionCount, ""}, - "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]"}, - "getwork": &handlerData{0, 1, displayJSONDump, nil, makeGetWork, "[jsonrequestobject]"}, - "help": &handlerData{0, 1, displayGeneric, nil, makeHelp, "[commandName]"}, - "importprivkey": &handlerData{1, 2, displayGeneric, []conversionHandler{nil, nil, toBool}, makeImportPrivKey, " [label] [rescan=true]"}, - "listtransactions": &handlerData{0, 3, displayJSONDump, []conversionHandler{nil, toInt, toInt}, makeListTransactions, "[account] [count=10] [from=0]"}, - "ping": &handlerData{0, 0, displayGeneric, nil, makePing, ""}, - "sendrawtransaction": &handlerData{1, 0, displayGeneric, nil, makeSendRawTransaction, ""}, - "stop": &handlerData{0, 0, displayGeneric, nil, makeStop, ""}, - "submitblock": &handlerData{1, 1, displayGeneric, nil, makeSubmitBlock, " [jsonparametersobject]"}, - "verifychain": &handlerData{0, 2, displayJSONDump, []conversionHandler{toInt, toInt}, makeVerifyChain, "[level] [numblocks]"}, - "walletpassphrase": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt64}, makeWalletPassphrase, " [timeout]"}, + "addnode": &handlerData{2, 0, displayJSONDump, nil, makeAddNode, " "}, + "createrawtransaction": &handlerData{2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"address\":amount,...}\""}, + "debuglevel": &handlerData{1, 0, displayGeneric, nil, makeDebugLevel, ""}, + "decoderawtransaction": &handlerData{1, 0, displayJSONDump, nil, makeDecodeRawTransaction, ""}, + "decodescript": &handlerData{1, 0, displayJSONDump, nil, makeDecodeScript, ""}, + "dumpprivkey": &handlerData{1, 0, displayGeneric, nil, makeDumpPrivKey, ""}, + "getaccount": &handlerData{1, 0, displayGeneric, nil, makeGetAccount, "
"}, + "getaccountaddress": &handlerData{1, 0, displayGeneric, nil, makeGetAccountAddress, ""}, + "getaddednodeinfo": &handlerData{1, 1, displayJSONDump, []conversionHandler{toBool, nil}, makeGetAddedNodeInfo, " [node]"}, + "getaddressesbyaccount": &handlerData{1, 0, displayJSONDump, nil, makeGetAddressesByAccount, "[account]"}, + "getbalance": &handlerData{0, 2, displayGeneric, []conversionHandler{nil, toInt}, makeGetBalance, "[account] [minconf=1]"}, + "getbestblockhash": &handlerData{0, 0, displayGeneric, nil, makeGetBestBlockHash, ""}, + "getblock": &handlerData{1, 2, displayJSONDump, []conversionHandler{nil, toBool, toBool}, makeGetBlock, ""}, + "getblockcount": &handlerData{0, 0, displayGeneric, nil, makeGetBlockCount, ""}, + "getblockhash": &handlerData{1, 0, displayGeneric, []conversionHandler{toInt64}, makeGetBlockHash, ""}, + "getblocktemplate": &handlerData{0, 1, displayJSONDump, nil, makeGetBlockTemplate, "[jsonrequestobject]"}, + "getconnectioncount": &handlerData{0, 0, displayGeneric, nil, makeGetConnectionCount, ""}, + "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]"}, + "getwork": &handlerData{0, 1, displayJSONDump, nil, makeGetWork, "[jsonrequestobject]"}, + "help": &handlerData{0, 1, displayGeneric, nil, makeHelp, "[commandName]"}, + "importprivkey": &handlerData{1, 2, displayGeneric, []conversionHandler{nil, nil, toBool}, makeImportPrivKey, " [label] [rescan=true]"}, + "listtransactions": &handlerData{0, 3, displayJSONDump, []conversionHandler{nil, toInt, toInt}, makeListTransactions, "[account] [count=10] [from=0]"}, + "ping": &handlerData{0, 0, displayGeneric, nil, makePing, ""}, + "sendrawtransaction": &handlerData{1, 0, displayGeneric, nil, makeSendRawTransaction, ""}, + "stop": &handlerData{0, 0, displayGeneric, nil, makeStop, ""}, + "submitblock": &handlerData{1, 1, displayGeneric, nil, makeSubmitBlock, " [jsonparametersobject]"}, + "verifychain": &handlerData{0, 2, displayJSONDump, []conversionHandler{toInt, toInt}, makeVerifyChain, "[level] [numblocks]"}, + "walletpassphrase": &handlerData{1, 1, displayGeneric, []conversionHandler{nil, toInt64}, makeWalletPassphrase, " [timeout]"}, } // toInt attempts to convert the passed string to an integer. It returns the @@ -238,6 +239,12 @@ func makeGetAddedNodeInfo(args []interface{}) (btcjson.Cmd, error) { return cmd, nil } +// makeGetAddressesByAccount generates the cmd structure for +// getaddressesbyaccount commands. +func makeGetAddressesByAccount(args []interface{}) (btcjson.Cmd, error) { + return btcjson.NewGetAddressesByAccountCmd("btcctl", args[0].(string)) +} + // makeGetBalance generates the cmd structure for // getbalance commands. func makeGetBalance(args []interface{}) (btcjson.Cmd, error) {