github.com/palcoin-project/palcd@v1.0.0/btcjson/walletsvrwscmds.go (about) 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. 4 5 package btcjson 6 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. 9 10 // CreateEncryptedWalletCmd defines the createencryptedwallet JSON-RPC command. 11 type CreateEncryptedWalletCmd struct { 12 Passphrase string 13 } 14 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, 20 } 21 } 22 23 // ExportWatchingWalletCmd defines the exportwatchingwallet JSON-RPC command. 24 type ExportWatchingWalletCmd struct { 25 Account *string 26 Download *bool `jsonrpcdefault:"false"` 27 } 28 29 // NewExportWatchingWalletCmd returns a new instance which can be used to issue 30 // a exportwatchingwallet JSON-RPC command. 31 // 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{ 36 Account: account, 37 Download: download, 38 } 39 } 40 41 // GetUnconfirmedBalanceCmd defines the getunconfirmedbalance JSON-RPC command. 42 type GetUnconfirmedBalanceCmd struct { 43 Account *string 44 } 45 46 // NewGetUnconfirmedBalanceCmd returns a new instance which can be used to issue 47 // a getunconfirmedbalance JSON-RPC command. 48 // 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{ 53 Account: account, 54 } 55 } 56 57 // ListAddressTransactionsCmd defines the listaddresstransactions JSON-RPC 58 // command. 59 type ListAddressTransactionsCmd struct { 60 Addresses []string 61 Account *string 62 } 63 64 // NewListAddressTransactionsCmd returns a new instance which can be used to 65 // issue a listaddresstransactions JSON-RPC command. 66 // 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{ 71 Addresses: addresses, 72 Account: account, 73 } 74 } 75 76 // ListAllTransactionsCmd defines the listalltransactions JSON-RPC command. 77 type ListAllTransactionsCmd struct { 78 Account *string 79 } 80 81 // NewListAllTransactionsCmd returns a new instance which can be used to issue a 82 // listalltransactions JSON-RPC command. 83 // 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{ 88 Account: account, 89 } 90 } 91 92 // RecoverAddressesCmd defines the recoveraddresses JSON-RPC command. 93 type RecoverAddressesCmd struct { 94 Account string 95 N int 96 } 97 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{ 102 Account: account, 103 N: n, 104 } 105 } 106 107 // WalletIsLockedCmd defines the walletislocked JSON-RPC command. 108 type WalletIsLockedCmd struct{} 109 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{} 114 } 115 116 func init() { 117 // The commands in this file are only usable with a wallet server via 118 // websockets. 119 flags := UFWalletOnly | UFWebsocketOnly 120 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) 128 }