Add createencryptedwallet support to btcctl.

This is a btcwallet extension and will not work when talking to btcd
or bitcoind.
This commit is contained in:
Josh Rickmar 2014-03-18 10:49:43 -05:00
parent ebf5a3e850
commit 675f967d4a

View file

@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"github.com/conformal/btcjson" "github.com/conformal/btcjson"
"github.com/conformal/btcutil" "github.com/conformal/btcutil"
"github.com/conformal/btcws"
"github.com/conformal/go-flags" "github.com/conformal/go-flags"
"github.com/davecgh/go-spew/spew" "github.com/davecgh/go-spew/spew"
"io/ioutil" "io/ioutil"
@ -46,6 +47,7 @@ var (
// to validate correctness and perform the command. // to validate correctness and perform the command.
var commandHandlers = map[string]*handlerData{ var commandHandlers = map[string]*handlerData{
"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>"},
"createrawtransaction": {2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"address\":amount,...}\""}, "createrawtransaction": {2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"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>"},
@ -202,6 +204,12 @@ func makeAddNode(args []interface{}) (btcjson.Cmd, error) {
args[1].(string)) args[1].(string))
} }
// makeCreateEncryptedWallet generates the cmd structure for
// createencryptedwallet commands.
func makeCreateEncryptedWallet(args []interface{}) (btcjson.Cmd, error) {
return btcws.NewCreateEncryptedWalletCmd("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) {