Updated to add createnewaccount, renameaccount

This commit is contained in:
Javed Khan 2014-11-10 22:06:27 +05:30
parent 869363a210
commit 45158f8b8f

View file

@ -51,6 +51,7 @@ var commandHandlers = map[string]*handlerData{
"addmultisigaddress": {2, 1, displayGeneric, []conversionHandler{toInt, nil, nil}, makeAddMultiSigAddress, "<numrequired> <[\"pubkey\",...]> [account]"}, "addmultisigaddress": {2, 1, displayGeneric, []conversionHandler{toInt, nil, nil}, makeAddMultiSigAddress, "<numrequired> <[\"pubkey\",...]> [account]"},
"addnode": {2, 0, displayJSONDump, nil, makeAddNode, "<ip> <add/remove/onetry>"}, "addnode": {2, 0, displayJSONDump, nil, makeAddNode, "<ip> <add/remove/onetry>"},
"createencryptedwallet": {1, 0, displayGeneric, nil, makeCreateEncryptedWallet, "<passphrase>"}, "createencryptedwallet": {1, 0, displayGeneric, nil, makeCreateEncryptedWallet, "<passphrase>"},
"createnewaccount": {1, 0, displayGeneric, nil, makeCreateNewAccount, "<account>"},
"createrawtransaction": {2, 0, displayGeneric, nil, makeCreateRawTransaction, outpointArrayStr + " " + "\"{\"address\":amount,...}\""}, "createrawtransaction": {2, 0, displayGeneric, nil, makeCreateRawTransaction, outpointArrayStr + " " + "\"{\"address\":amount,...}\""},
"debuglevel": {1, 0, displayGeneric, nil, makeDebugLevel, "<levelspec>"}, "debuglevel": {1, 0, displayGeneric, nil, makeDebugLevel, "<levelspec>"},
"decoderawtransaction": {1, 0, displayJSONDump, nil, makeDecodeRawTransaction, "<txhash>"}, "decoderawtransaction": {1, 0, displayJSONDump, nil, makeDecodeRawTransaction, "<txhash>"},
@ -103,6 +104,7 @@ var commandHandlers = map[string]*handlerData{
"listunspent": {0, 3, displayJSONDump, []conversionHandler{toInt, toInt, nil}, makeListUnspent, "[minconf=1] [maxconf=9999999] [jsonaddressarray]"}, "listunspent": {0, 3, displayJSONDump, []conversionHandler{toInt, toInt, nil}, makeListUnspent, "[minconf=1] [maxconf=9999999] [jsonaddressarray]"},
"lockunspent": {1, 2, displayJSONDump, []conversionHandler{toBool, nil}, makeLockUnspent, "<unlock> " + outpointArrayStr}, "lockunspent": {1, 2, displayJSONDump, []conversionHandler{toBool, nil}, makeLockUnspent, "<unlock> " + outpointArrayStr},
"ping": {0, 0, displayGeneric, nil, makePing, ""}, "ping": {0, 0, displayGeneric, nil, makePing, ""},
"renameaccount": {2, 0, displayGeneric, nil, makeRenameAccount, "<oldaccount> <newaccount>"},
"sendfrom": {3, 3, displayGeneric, []conversionHandler{nil, nil, toSatoshi, toInt, nil, nil}, "sendfrom": {3, 3, displayGeneric, []conversionHandler{nil, nil, toSatoshi, toInt, nil, nil},
makeSendFrom, "<account> <address> <amount> [minconf=1] [comment] [comment-to]"}, makeSendFrom, "<account> <address> <amount> [minconf=1] [comment] [comment-to]"},
"sendmany": {2, 2, displayGeneric, []conversionHandler{nil, nil, toInt, nil}, makeSendMany, "<account> <{\"address\":amount,...}> [minconf=1] [comment]"}, "sendmany": {2, 2, displayGeneric, []conversionHandler{nil, nil, toInt, nil}, makeSendMany, "<account> <{\"address\":amount,...}> [minconf=1] [comment]"},
@ -241,6 +243,12 @@ func makeCreateEncryptedWallet(args []interface{}) (btcjson.Cmd, error) {
return btcws.NewCreateEncryptedWalletCmd("btcctl", args[0].(string)), nil return btcws.NewCreateEncryptedWalletCmd("btcctl", args[0].(string)), nil
} }
// makeCreateNewAccount generates the cmd structure for
// createnewaccount commands.
func makeCreateNewAccount(args []interface{}) (btcjson.Cmd, error) {
return btcws.NewCreateNewAccountCmd("btcctl", args[0].(string)), nil
}
// makeCreateRawTransaction generates the cmd structure for createrawtransaction // makeCreateRawTransaction generates the cmd structure for createrawtransaction
// commands. // commands.
func makeCreateRawTransaction(args []interface{}) (btcjson.Cmd, error) { func makeCreateRawTransaction(args []interface{}) (btcjson.Cmd, error) {
@ -715,6 +723,13 @@ func makePing(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewPingCmd("btcctl") return btcjson.NewPingCmd("btcctl")
} }
// makeRenameAccount generates the cmd structure for
// renameaccount commands.
func makeRenameAccount(args []interface{}) (btcjson.Cmd, error) {
return btcws.NewRenameAccountCmd("btcctl", args[0].(string),
args[1].(string)), nil
}
// makeSendFrom generates the cmd structure for sendfrom commands. // makeSendFrom generates the cmd structure for sendfrom commands.
func makeSendFrom(args []interface{}) (btcjson.Cmd, error) { func makeSendFrom(args []interface{}) (btcjson.Cmd, error) {
var optargs = make([]interface{}, 0, 3) var optargs = make([]interface{}, 0, 3)