Add sendrawtransaction support to btcctl.

This commit is contained in:
Josh Rickmar 2014-01-06 11:50:02 -05:00
parent ae347a6f67
commit 8b5277e73a

View file

@ -67,6 +67,7 @@ var commandHandlers = map[string]*handlerData{
"importprivkey": &handlerData{1, 2, displayGeneric, []conversionHandler{nil, nil, toBool}, makeImportPrivKey, "<wifprivkey> [label] [rescan=true]"},
"listtransactions": &handlerData{0, 3, displayJSONDump, []conversionHandler{nil, toInt, toInt}, makeListTransactions, "[account] [count=10] [from=0]"},
"verifychain": &handlerData{0, 2, displayJSONDump, []conversionHandler{toInt, toInt}, makeVerifyChain, "[level] [numblocks]"},
"sendrawtransaction": &handlerData{1, 0, displayGeneric, nil, makeSendRawTransaction, "<hextx>"},
"stop": &handlerData{0, 0, displayGeneric, nil, makeStop, ""},
}
@ -342,6 +343,12 @@ func makeListTransactions(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewListTransactionsCmd("btcctl", optargs...)
}
// makeSendRawTransaction generates the cmd structure for sendrawtransaction
// commands.
func makeSendRawTransaction(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewSendRawTransactionCmd("btcctl", args[0].(string))
}
// makeStop generates the cmd structure for stop comands.
func makeStop(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewStopCmd("btcctl")