1 // Copyright (c) 2014 The btcsuite developers
2 // Use of this source code is governed by an ISC
3 // license that can be found in the LICENSE file.
7 // NOTE: This file is intended to house the RPC commands that are supported by
8 // a wallet server, but are only available via websockets.
10 // CreateEncryptedWalletCmd defines the createencryptedwallet JSON-RPC command.
11 type CreateEncryptedWalletCmd struct {
15 // NewCreateEncryptedWalletCmd returns a new instance which can be used to issue
16 // a createencryptedwallet JSON-RPC command.
17 func NewCreateEncryptedWalletCmd(passphrase string) *CreateEncryptedWalletCmd {
18 return &CreateEncryptedWalletCmd{
19 Passphrase: passphrase,
23 // ExportWatchingWalletCmd defines the exportwatchingwallet JSON-RPC command.
24 type ExportWatchingWalletCmd struct {
26 Download *bool `jsonrpcdefault:"false"`
29 // NewExportWatchingWalletCmd returns a new instance which can be used to issue
30 // a exportwatchingwallet JSON-RPC command.
32 // The parameters which are pointers indicate they are optional. Passing nil
33 // for optional parameters will use the default value.
34 func NewExportWatchingWalletCmd(account *string, download *bool) *ExportWatchingWalletCmd {
35 return &ExportWatchingWalletCmd{
41 // GetUnconfirmedBalanceCmd defines the getunconfirmedbalance JSON-RPC command.
42 type GetUnconfirmedBalanceCmd struct {
46 // NewGetUnconfirmedBalanceCmd returns a new instance which can be used to issue
47 // a getunconfirmedbalance JSON-RPC command.
49 // The parameters which are pointers indicate they are optional. Passing nil
50 // for optional parameters will use the default value.
51 func NewGetUnconfirmedBalanceCmd(account *string) *GetUnconfirmedBalanceCmd {
52 return &GetUnconfirmedBalanceCmd{
57 // ListAddressTransactionsCmd defines the listaddresstransactions JSON-RPC
59 type ListAddressTransactionsCmd struct {
64 // NewListAddressTransactionsCmd returns a new instance which can be used to
65 // issue a listaddresstransactions JSON-RPC command.
67 // The parameters which are pointers indicate they are optional. Passing nil
68 // for optional parameters will use the default value.
69 func NewListAddressTransactionsCmd(addresses []string, account *string) *ListAddressTransactionsCmd {
70 return &ListAddressTransactionsCmd{
76 // ListAllTransactionsCmd defines the listalltransactions JSON-RPC command.
77 type ListAllTransactionsCmd struct {
81 // NewListAllTransactionsCmd returns a new instance which can be used to issue a
82 // listalltransactions JSON-RPC command.
84 // The parameters which are pointers indicate they are optional. Passing nil
85 // for optional parameters will use the default value.
86 func NewListAllTransactionsCmd(account *string) *ListAllTransactionsCmd {
87 return &ListAllTransactionsCmd{
92 // RecoverAddressesCmd defines the recoveraddresses JSON-RPC command.
93 type RecoverAddressesCmd struct {
98 // NewRecoverAddressesCmd returns a new instance which can be used to issue a
99 // recoveraddresses JSON-RPC command.
100 func NewRecoverAddressesCmd(account string, n int) *RecoverAddressesCmd {
101 return &RecoverAddressesCmd{
107 // WalletIsLockedCmd defines the walletislocked JSON-RPC command.
108 type WalletIsLockedCmd struct{}
110 // NewWalletIsLockedCmd returns a new instance which can be used to issue a
111 // walletislocked JSON-RPC command.
112 func NewWalletIsLockedCmd() *WalletIsLockedCmd {
113 return &WalletIsLockedCmd{}
117 // The commands in this file are only usable with a wallet server via
119 flags := UFWalletOnly | UFWebsocketOnly
121 MustRegisterCmd("createencryptedwallet", (*CreateEncryptedWalletCmd)(nil), flags)
122 MustRegisterCmd("exportwatchingwallet", (*ExportWatchingWalletCmd)(nil), flags)
123 MustRegisterCmd("getunconfirmedbalance", (*GetUnconfirmedBalanceCmd)(nil), flags)
124 MustRegisterCmd("listaddresstransactions", (*ListAddressTransactionsCmd)(nil), flags)
125 MustRegisterCmd("listalltransactions", (*ListAllTransactionsCmd)(nil), flags)
126 MustRegisterCmd("recoveraddresses", (*RecoverAddressesCmd)(nil), flags)
127 MustRegisterCmd("walletislocked", (*WalletIsLockedCmd)(nil), flags)