1 // Copyright (c) 2015 The btcsuite developers
2 // Use of this source code is governed by an ISC
3 // license that can be found in the LICENSE file.
5 // NOTE: This file is intended to house the RPC commands that are supported by
6 // a wallet server with btcwallet extensions.
10 // CreateNewAccountCmd defines the createnewaccount JSON-RPC command.
11 type CreateNewAccountCmd struct {
15 // NewCreateNewAccountCmd returns a new instance which can be used to issue a
16 // createnewaccount JSON-RPC command.
17 func NewCreateNewAccountCmd(account string) *CreateNewAccountCmd {
18 return &CreateNewAccountCmd{
23 // DumpWalletCmd defines the dumpwallet JSON-RPC command.
24 type DumpWalletCmd struct {
28 // NewDumpWalletCmd returns a new instance which can be used to issue a
29 // dumpwallet JSON-RPC command.
30 func NewDumpWalletCmd(filename string) *DumpWalletCmd {
31 return &DumpWalletCmd{
36 // ImportAddressCmd defines the importaddress JSON-RPC command.
37 type ImportAddressCmd struct {
39 Rescan *bool `jsonrpcdefault:"true"`
42 // NewImportAddressCmd returns a new instance which can be used to issue an
43 // importaddress JSON-RPC command.
44 func NewImportAddressCmd(address string, rescan *bool) *ImportAddressCmd {
45 return &ImportAddressCmd{
51 // ImportPubKeyCmd defines the importpubkey JSON-RPC command.
52 type ImportPubKeyCmd struct {
54 Rescan *bool `jsonrpcdefault:"true"`
57 // NewImportPubKeyCmd returns a new instance which can be used to issue an
58 // importpubkey JSON-RPC command.
59 func NewImportPubKeyCmd(pubKey string, rescan *bool) *ImportPubKeyCmd {
60 return &ImportPubKeyCmd{
66 // ImportWalletCmd defines the importwallet JSON-RPC command.
67 type ImportWalletCmd struct {
71 // NewImportWalletCmd returns a new instance which can be used to issue a
72 // importwallet JSON-RPC command.
73 func NewImportWalletCmd(filename string) *ImportWalletCmd {
74 return &ImportWalletCmd{
79 // RenameAccountCmd defines the renameaccount JSON-RPC command.
80 type RenameAccountCmd struct {
85 // NewRenameAccountCmd returns a new instance which can be used to issue a
86 // renameaccount JSON-RPC command.
87 func NewRenameAccountCmd(oldAccount, newAccount string) *RenameAccountCmd {
88 return &RenameAccountCmd{
89 OldAccount: oldAccount,
90 NewAccount: newAccount,
95 // The commands in this file are only usable with a wallet server.
98 MustRegisterCmd("createnewaccount", (*CreateNewAccountCmd)(nil), flags)
99 MustRegisterCmd("dumpwallet", (*DumpWalletCmd)(nil), flags)
100 MustRegisterCmd("importaddress", (*ImportAddressCmd)(nil), flags)
101 MustRegisterCmd("importpubkey", (*ImportPubKeyCmd)(nil), flags)
102 MustRegisterCmd("importwallet", (*ImportWalletCmd)(nil), flags)
103 MustRegisterCmd("renameaccount", (*RenameAccountCmd)(nil), flags)