From 979357c5f1264d309d4a3294e0a6b2522b84ea9d Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 4 Feb 2014 13:18:58 -0500 Subject: [PATCH] Add sendtoaddress support to btcctl. --- util/btcctl/btcctl.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index 057380d8..2bc8630b 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -92,6 +92,7 @@ var commandHandlers = map[string]*handlerData{ makeSendFrom, "
[minconf=1] [comment] [comment-to]"}, "sendmany": &handlerData{2, 2, displayGeneric, []conversionHandler{nil, nil, toInt, nil}, makeSendMany, " <{\"address\":amount,...}> [minconf=1] [comment]"}, "sendrawtransaction": &handlerData{1, 0, displayGeneric, nil, makeSendRawTransaction, ""}, + "sendtoaddress": &handlerData{2, 2, displayGeneric, []conversionHandler{nil, toSatoshi, nil, nil}, makeSendToAddress, "
[comment] [comment-to]"}, "settxfee": &handlerData{1, 0, displayGeneric, []conversionHandler{toSatoshi}, makeSetTxFee, ""}, "stop": &handlerData{0, 0, displayGeneric, nil, makeStop, ""}, "submitblock": &handlerData{1, 1, displayGeneric, nil, makeSubmitBlock, " [jsonparametersobject]"}, @@ -633,6 +634,11 @@ func makeSendRawTransaction(args []interface{}) (btcjson.Cmd, error) { return btcjson.NewSendRawTransactionCmd("btcctl", args[0].(string)) } +// makeSendToAddress generates the cmd struture for sendtoaddress commands. +func makeSendToAddress(args []interface{}) (btcjson.Cmd, error) { + return btcjson.NewSendToAddressCmd("btcctl", args[0].(string), args[1].(int64), args[2:]...) +} + // makeSetTxFee generates the cmd structure for settxfee commands. func makeSetTxFee(args []interface{}) (btcjson.Cmd, error) { return btcjson.NewSetTxFeeCmd("btcctl", args[0].(int64))