github.com/dashpay/godash@v0.0.0-20160726055534-e038a21e0e3d/btcjson/walletsvrcmds.go (about)

     1  // Copyright (c) 2014 The btcsuite developers
     2  // Copyright (c) 2016 The Dash developers
     3  // Use of this source code is governed by an ISC
     4  // license that can be found in the LICENSE file.
     5  
     6  // NOTE: This file is intended to house the RPC commands that are supported by
     7  // a wallet server.
     8  
     9  package btcjson
    10  
    11  // AddMultisigAddressCmd defines the addmutisigaddress JSON-RPC command.
    12  type AddMultisigAddressCmd struct {
    13  	NRequired int
    14  	Keys      []string
    15  	Account   *string
    16  }
    17  
    18  // NewAddMultisigAddressCmd returns a new instance which can be used to issue a
    19  // addmultisigaddress JSON-RPC command.
    20  //
    21  // The parameters which are pointers indicate they are optional.  Passing nil
    22  // for optional parameters will use the default value.
    23  func NewAddMultisigAddressCmd(nRequired int, keys []string, account *string) *AddMultisigAddressCmd {
    24  	return &AddMultisigAddressCmd{
    25  		NRequired: nRequired,
    26  		Keys:      keys,
    27  		Account:   account,
    28  	}
    29  }
    30  
    31  // CreateMultisigCmd defines the createmultisig JSON-RPC command.
    32  type CreateMultisigCmd struct {
    33  	NRequired int
    34  	Keys      []string
    35  }
    36  
    37  // NewCreateMultisigCmd returns a new instance which can be used to issue a
    38  // createmultisig JSON-RPC command.
    39  func NewCreateMultisigCmd(nRequired int, keys []string) *CreateMultisigCmd {
    40  	return &CreateMultisigCmd{
    41  		NRequired: nRequired,
    42  		Keys:      keys,
    43  	}
    44  }
    45  
    46  // DumpPrivKeyCmd defines the dumpprivkey JSON-RPC command.
    47  type DumpPrivKeyCmd struct {
    48  	Address string
    49  }
    50  
    51  // NewDumpPrivKeyCmd returns a new instance which can be used to issue a
    52  // dumpprivkey JSON-RPC command.
    53  func NewDumpPrivKeyCmd(address string) *DumpPrivKeyCmd {
    54  	return &DumpPrivKeyCmd{
    55  		Address: address,
    56  	}
    57  }
    58  
    59  // EncryptWalletCmd defines the encryptwallet JSON-RPC command.
    60  type EncryptWalletCmd struct {
    61  	Passphrase string
    62  }
    63  
    64  // NewEncryptWalletCmd returns a new instance which can be used to issue a
    65  // encryptwallet JSON-RPC command.
    66  func NewEncryptWalletCmd(passphrase string) *EncryptWalletCmd {
    67  	return &EncryptWalletCmd{
    68  		Passphrase: passphrase,
    69  	}
    70  }
    71  
    72  // EstimateFeeCmd defines the estimatefee JSON-RPC command.
    73  type EstimateFeeCmd struct {
    74  	NumBlocks int64
    75  }
    76  
    77  // NewEstimateFeeCmd returns a new instance which can be used to issue a
    78  // estimatefee JSON-RPC command.
    79  func NewEstimateFeeCmd(numBlocks int64) *EstimateFeeCmd {
    80  	return &EstimateFeeCmd{
    81  		NumBlocks: numBlocks,
    82  	}
    83  }
    84  
    85  // EstimatePriorityCmd defines the estimatepriority JSON-RPC command.
    86  type EstimatePriorityCmd struct {
    87  	NumBlocks int64
    88  }
    89  
    90  // NewEstimatePriorityCmd returns a new instance which can be used to issue a
    91  // estimatepriority JSON-RPC command.
    92  func NewEstimatePriorityCmd(numBlocks int64) *EstimatePriorityCmd {
    93  	return &EstimatePriorityCmd{
    94  		NumBlocks: numBlocks,
    95  	}
    96  }
    97  
    98  // GetAccountCmd defines the getaccount JSON-RPC command.
    99  type GetAccountCmd struct {
   100  	Address string
   101  }
   102  
   103  // NewGetAccountCmd returns a new instance which can be used to issue a
   104  // getaccount JSON-RPC command.
   105  func NewGetAccountCmd(address string) *GetAccountCmd {
   106  	return &GetAccountCmd{
   107  		Address: address,
   108  	}
   109  }
   110  
   111  // GetAccountAddressCmd defines the getaccountaddress JSON-RPC command.
   112  type GetAccountAddressCmd struct {
   113  	Account string
   114  }
   115  
   116  // NewGetAccountAddressCmd returns a new instance which can be used to issue a
   117  // getaccountaddress JSON-RPC command.
   118  func NewGetAccountAddressCmd(account string) *GetAccountAddressCmd {
   119  	return &GetAccountAddressCmd{
   120  		Account: account,
   121  	}
   122  }
   123  
   124  // GetAddressesByAccountCmd defines the getaddressesbyaccount JSON-RPC command.
   125  type GetAddressesByAccountCmd struct {
   126  	Account string
   127  }
   128  
   129  // NewGetAddressesByAccountCmd returns a new instance which can be used to issue
   130  // a getaddressesbyaccount JSON-RPC command.
   131  func NewGetAddressesByAccountCmd(account string) *GetAddressesByAccountCmd {
   132  	return &GetAddressesByAccountCmd{
   133  		Account: account,
   134  	}
   135  }
   136  
   137  // GetBalanceCmd defines the getbalance JSON-RPC command.
   138  type GetBalanceCmd struct {
   139  	Account *string
   140  	MinConf *int `jsonrpcdefault:"1"`
   141  }
   142  
   143  // NewGetBalanceCmd returns a new instance which can be used to issue a
   144  // getbalance JSON-RPC command.
   145  //
   146  // The parameters which are pointers indicate they are optional.  Passing nil
   147  // for optional parameters will use the default value.
   148  func NewGetBalanceCmd(account *string, minConf *int) *GetBalanceCmd {
   149  	return &GetBalanceCmd{
   150  		Account: account,
   151  		MinConf: minConf,
   152  	}
   153  }
   154  
   155  // GetNewAddressCmd defines the getnewaddress JSON-RPC command.
   156  type GetNewAddressCmd struct {
   157  	Account *string
   158  }
   159  
   160  // NewGetNewAddressCmd returns a new instance which can be used to issue a
   161  // getnewaddress JSON-RPC command.
   162  //
   163  // The parameters which are pointers indicate they are optional.  Passing nil
   164  // for optional parameters will use the default value.
   165  func NewGetNewAddressCmd(account *string) *GetNewAddressCmd {
   166  	return &GetNewAddressCmd{
   167  		Account: account,
   168  	}
   169  }
   170  
   171  // GetRawChangeAddressCmd defines the getrawchangeaddress JSON-RPC command.
   172  type GetRawChangeAddressCmd struct {
   173  	Account *string
   174  }
   175  
   176  // NewGetRawChangeAddressCmd returns a new instance which can be used to issue a
   177  // getrawchangeaddress JSON-RPC command.
   178  //
   179  // The parameters which are pointers indicate they are optional.  Passing nil
   180  // for optional parameters will use the default value.
   181  func NewGetRawChangeAddressCmd(account *string) *GetRawChangeAddressCmd {
   182  	return &GetRawChangeAddressCmd{
   183  		Account: account,
   184  	}
   185  }
   186  
   187  // GetReceivedByAccountCmd defines the getreceivedbyaccount JSON-RPC command.
   188  type GetReceivedByAccountCmd struct {
   189  	Account string
   190  	MinConf *int `jsonrpcdefault:"1"`
   191  }
   192  
   193  // NewGetReceivedByAccountCmd returns a new instance which can be used to issue
   194  // a getreceivedbyaccount JSON-RPC command.
   195  //
   196  // The parameters which are pointers indicate they are optional.  Passing nil
   197  // for optional parameters will use the default value.
   198  func NewGetReceivedByAccountCmd(account string, minConf *int) *GetReceivedByAccountCmd {
   199  	return &GetReceivedByAccountCmd{
   200  		Account: account,
   201  		MinConf: minConf,
   202  	}
   203  }
   204  
   205  // GetReceivedByAddressCmd defines the getreceivedbyaddress JSON-RPC command.
   206  type GetReceivedByAddressCmd struct {
   207  	Address string
   208  	MinConf *int `jsonrpcdefault:"1"`
   209  }
   210  
   211  // NewGetReceivedByAddressCmd returns a new instance which can be used to issue
   212  // a getreceivedbyaddress JSON-RPC command.
   213  //
   214  // The parameters which are pointers indicate they are optional.  Passing nil
   215  // for optional parameters will use the default value.
   216  func NewGetReceivedByAddressCmd(address string, minConf *int) *GetReceivedByAddressCmd {
   217  	return &GetReceivedByAddressCmd{
   218  		Address: address,
   219  		MinConf: minConf,
   220  	}
   221  }
   222  
   223  // GetTransactionCmd defines the gettransaction JSON-RPC command.
   224  type GetTransactionCmd struct {
   225  	Txid             string
   226  	IncludeWatchOnly *bool `jsonrpcdefault:"false"`
   227  }
   228  
   229  // NewGetTransactionCmd returns a new instance which can be used to issue a
   230  // gettransaction JSON-RPC command.
   231  //
   232  // The parameters which are pointers indicate they are optional.  Passing nil
   233  // for optional parameters will use the default value.
   234  func NewGetTransactionCmd(txHash string, includeWatchOnly *bool) *GetTransactionCmd {
   235  	return &GetTransactionCmd{
   236  		Txid:             txHash,
   237  		IncludeWatchOnly: includeWatchOnly,
   238  	}
   239  }
   240  
   241  // GetWalletInfoCmd defines the getwalletinfo JSON-RPC command.
   242  type GetWalletInfoCmd struct{}
   243  
   244  // NewGetWalletInfoCmd returns a new instance which can be used to issue a
   245  // getwalletinfo JSON-RPC command.
   246  func NewGetWalletInfoCmd() *GetWalletInfoCmd {
   247  	return &GetWalletInfoCmd{}
   248  }
   249  
   250  // ImportPrivKeyCmd defines the importprivkey JSON-RPC command.
   251  type ImportPrivKeyCmd struct {
   252  	PrivKey string
   253  	Label   *string
   254  	Rescan  *bool `jsonrpcdefault:"true"`
   255  }
   256  
   257  // NewImportPrivKeyCmd returns a new instance which can be used to issue a
   258  // importprivkey JSON-RPC command.
   259  //
   260  // The parameters which are pointers indicate they are optional.  Passing nil
   261  // for optional parameters will use the default value.
   262  func NewImportPrivKeyCmd(privKey string, label *string, rescan *bool) *ImportPrivKeyCmd {
   263  	return &ImportPrivKeyCmd{
   264  		PrivKey: privKey,
   265  		Label:   label,
   266  		Rescan:  rescan,
   267  	}
   268  }
   269  
   270  // KeyPoolRefillCmd defines the keypoolrefill JSON-RPC command.
   271  type KeyPoolRefillCmd struct {
   272  	NewSize *uint `jsonrpcdefault:"100"`
   273  }
   274  
   275  // NewKeyPoolRefillCmd returns a new instance which can be used to issue a
   276  // keypoolrefill JSON-RPC command.
   277  //
   278  // The parameters which are pointers indicate they are optional.  Passing nil
   279  // for optional parameters will use the default value.
   280  func NewKeyPoolRefillCmd(newSize *uint) *KeyPoolRefillCmd {
   281  	return &KeyPoolRefillCmd{
   282  		NewSize: newSize,
   283  	}
   284  }
   285  
   286  // ListAccountsCmd defines the listaccounts JSON-RPC command.
   287  type ListAccountsCmd struct {
   288  	MinConf *int `jsonrpcdefault:"1"`
   289  }
   290  
   291  // NewListAccountsCmd returns a new instance which can be used to issue a
   292  // listaccounts JSON-RPC command.
   293  //
   294  // The parameters which are pointers indicate they are optional.  Passing nil
   295  // for optional parameters will use the default value.
   296  func NewListAccountsCmd(minConf *int) *ListAccountsCmd {
   297  	return &ListAccountsCmd{
   298  		MinConf: minConf,
   299  	}
   300  }
   301  
   302  // ListAddressGroupingsCmd defines the listaddressgroupings JSON-RPC command.
   303  type ListAddressGroupingsCmd struct{}
   304  
   305  // NewListAddressGroupingsCmd returns a new instance which can be used to issue
   306  // a listaddressgroupoings JSON-RPC command.
   307  func NewListAddressGroupingsCmd() *ListAddressGroupingsCmd {
   308  	return &ListAddressGroupingsCmd{}
   309  }
   310  
   311  // ListLockUnspentCmd defines the listlockunspent JSON-RPC command.
   312  type ListLockUnspentCmd struct{}
   313  
   314  // NewListLockUnspentCmd returns a new instance which can be used to issue a
   315  // listlockunspent JSON-RPC command.
   316  func NewListLockUnspentCmd() *ListLockUnspentCmd {
   317  	return &ListLockUnspentCmd{}
   318  }
   319  
   320  // ListReceivedByAccountCmd defines the listreceivedbyaccount JSON-RPC command.
   321  type ListReceivedByAccountCmd struct {
   322  	MinConf          *int  `jsonrpcdefault:"1"`
   323  	IncludeEmpty     *bool `jsonrpcdefault:"false"`
   324  	IncludeWatchOnly *bool `jsonrpcdefault:"false"`
   325  }
   326  
   327  // NewListReceivedByAccountCmd returns a new instance which can be used to issue
   328  // a listreceivedbyaccount JSON-RPC command.
   329  //
   330  // The parameters which are pointers indicate they are optional.  Passing nil
   331  // for optional parameters will use the default value.
   332  func NewListReceivedByAccountCmd(minConf *int, includeEmpty, includeWatchOnly *bool) *ListReceivedByAccountCmd {
   333  	return &ListReceivedByAccountCmd{
   334  		MinConf:          minConf,
   335  		IncludeEmpty:     includeEmpty,
   336  		IncludeWatchOnly: includeWatchOnly,
   337  	}
   338  }
   339  
   340  // ListReceivedByAddressCmd defines the listreceivedbyaddress JSON-RPC command.
   341  type ListReceivedByAddressCmd struct {
   342  	MinConf          *int  `jsonrpcdefault:"1"`
   343  	IncludeEmpty     *bool `jsonrpcdefault:"false"`
   344  	IncludeWatchOnly *bool `jsonrpcdefault:"false"`
   345  }
   346  
   347  // NewListReceivedByAddressCmd returns a new instance which can be used to issue
   348  // a listreceivedbyaddress JSON-RPC command.
   349  //
   350  // The parameters which are pointers indicate they are optional.  Passing nil
   351  // for optional parameters will use the default value.
   352  func NewListReceivedByAddressCmd(minConf *int, includeEmpty, includeWatchOnly *bool) *ListReceivedByAddressCmd {
   353  	return &ListReceivedByAddressCmd{
   354  		MinConf:          minConf,
   355  		IncludeEmpty:     includeEmpty,
   356  		IncludeWatchOnly: includeWatchOnly,
   357  	}
   358  }
   359  
   360  // ListSinceBlockCmd defines the listsinceblock JSON-RPC command.
   361  type ListSinceBlockCmd struct {
   362  	BlockHash           *string
   363  	TargetConfirmations *int  `jsonrpcdefault:"1"`
   364  	IncludeWatchOnly    *bool `jsonrpcdefault:"false"`
   365  }
   366  
   367  // NewListSinceBlockCmd returns a new instance which can be used to issue a
   368  // listsinceblock JSON-RPC command.
   369  //
   370  // The parameters which are pointers indicate they are optional.  Passing nil
   371  // for optional parameters will use the default value.
   372  func NewListSinceBlockCmd(blockHash *string, targetConfirms *int, includeWatchOnly *bool) *ListSinceBlockCmd {
   373  	return &ListSinceBlockCmd{
   374  		BlockHash:           blockHash,
   375  		TargetConfirmations: targetConfirms,
   376  		IncludeWatchOnly:    includeWatchOnly,
   377  	}
   378  }
   379  
   380  // ListTransactionsCmd defines the listtransactions JSON-RPC command.
   381  type ListTransactionsCmd struct {
   382  	Account          *string
   383  	Count            *int  `jsonrpcdefault:"10"`
   384  	From             *int  `jsonrpcdefault:"0"`
   385  	IncludeWatchOnly *bool `jsonrpcdefault:"false"`
   386  }
   387  
   388  // NewListTransactionsCmd returns a new instance which can be used to issue a
   389  // listtransactions JSON-RPC command.
   390  //
   391  // The parameters which are pointers indicate they are optional.  Passing nil
   392  // for optional parameters will use the default value.
   393  func NewListTransactionsCmd(account *string, count, from *int, includeWatchOnly *bool) *ListTransactionsCmd {
   394  	return &ListTransactionsCmd{
   395  		Account:          account,
   396  		Count:            count,
   397  		From:             from,
   398  		IncludeWatchOnly: includeWatchOnly,
   399  	}
   400  }
   401  
   402  // ListUnspentCmd defines the listunspent JSON-RPC command.
   403  type ListUnspentCmd struct {
   404  	MinConf   *int `jsonrpcdefault:"1"`
   405  	MaxConf   *int `jsonrpcdefault:"9999999"`
   406  	Addresses *[]string
   407  }
   408  
   409  // NewListUnspentCmd returns a new instance which can be used to issue a
   410  // listunspent JSON-RPC command.
   411  //
   412  // The parameters which are pointers indicate they are optional.  Passing nil
   413  // for optional parameters will use the default value.
   414  func NewListUnspentCmd(minConf, maxConf *int, addresses *[]string) *ListUnspentCmd {
   415  	return &ListUnspentCmd{
   416  		MinConf:   minConf,
   417  		MaxConf:   maxConf,
   418  		Addresses: addresses,
   419  	}
   420  }
   421  
   422  // LockUnspentCmd defines the lockunspent JSON-RPC command.
   423  type LockUnspentCmd struct {
   424  	Unlock       bool
   425  	Transactions []TransactionInput
   426  }
   427  
   428  // NewLockUnspentCmd returns a new instance which can be used to issue a
   429  // lockunspent JSON-RPC command.
   430  func NewLockUnspentCmd(unlock bool, transactions []TransactionInput) *LockUnspentCmd {
   431  	return &LockUnspentCmd{
   432  		Unlock:       unlock,
   433  		Transactions: transactions,
   434  	}
   435  }
   436  
   437  // MoveCmd defines the move JSON-RPC command.
   438  type MoveCmd struct {
   439  	FromAccount string
   440  	ToAccount   string
   441  	Amount      float64 // In BTC
   442  	MinConf     *int    `jsonrpcdefault:"1"`
   443  	Comment     *string
   444  }
   445  
   446  // NewMoveCmd returns a new instance which can be used to issue a move JSON-RPC
   447  // command.
   448  //
   449  // The parameters which are pointers indicate they are optional.  Passing nil
   450  // for optional parameters will use the default value.
   451  func NewMoveCmd(fromAccount, toAccount string, amount float64, minConf *int, comment *string) *MoveCmd {
   452  	return &MoveCmd{
   453  		FromAccount: fromAccount,
   454  		ToAccount:   toAccount,
   455  		Amount:      amount,
   456  		MinConf:     minConf,
   457  		Comment:     comment,
   458  	}
   459  }
   460  
   461  // SendFromCmd defines the sendfrom JSON-RPC command.
   462  type SendFromCmd struct {
   463  	FromAccount string
   464  	ToAddress   string
   465  	Amount      float64 // In BTC
   466  	MinConf     *int    `jsonrpcdefault:"1"`
   467  	Comment     *string
   468  	CommentTo   *string
   469  }
   470  
   471  // NewSendFromCmd returns a new instance which can be used to issue a sendfrom
   472  // JSON-RPC command.
   473  //
   474  // The parameters which are pointers indicate they are optional.  Passing nil
   475  // for optional parameters will use the default value.
   476  func NewSendFromCmd(fromAccount, toAddress string, amount float64, minConf *int, comment, commentTo *string) *SendFromCmd {
   477  	return &SendFromCmd{
   478  		FromAccount: fromAccount,
   479  		ToAddress:   toAddress,
   480  		Amount:      amount,
   481  		MinConf:     minConf,
   482  		Comment:     comment,
   483  		CommentTo:   commentTo,
   484  	}
   485  }
   486  
   487  // SendManyCmd defines the sendmany JSON-RPC command.
   488  type SendManyCmd struct {
   489  	FromAccount string
   490  	Amounts     map[string]float64 `jsonrpcusage:"{\"address\":amount,...}"` // In BTC
   491  	MinConf     *int               `jsonrpcdefault:"1"`
   492  	Comment     *string
   493  }
   494  
   495  // NewSendManyCmd returns a new instance which can be used to issue a sendmany
   496  // JSON-RPC command.
   497  //
   498  // The parameters which are pointers indicate they are optional.  Passing nil
   499  // for optional parameters will use the default value.
   500  func NewSendManyCmd(fromAccount string, amounts map[string]float64, minConf *int, comment *string) *SendManyCmd {
   501  	return &SendManyCmd{
   502  		FromAccount: fromAccount,
   503  		Amounts:     amounts,
   504  		MinConf:     minConf,
   505  		Comment:     comment,
   506  	}
   507  }
   508  
   509  // SendToAddressCmd defines the sendtoaddress JSON-RPC command.
   510  type SendToAddressCmd struct {
   511  	Address   string
   512  	Amount    float64
   513  	Comment   *string
   514  	CommentTo *string
   515  }
   516  
   517  // NewSendToAddressCmd returns a new instance which can be used to issue a
   518  // sendtoaddress JSON-RPC command.
   519  //
   520  // The parameters which are pointers indicate they are optional.  Passing nil
   521  // for optional parameters will use the default value.
   522  func NewSendToAddressCmd(address string, amount float64, comment, commentTo *string) *SendToAddressCmd {
   523  	return &SendToAddressCmd{
   524  		Address:   address,
   525  		Amount:    amount,
   526  		Comment:   comment,
   527  		CommentTo: commentTo,
   528  	}
   529  }
   530  
   531  // SetAccountCmd defines the setaccount JSON-RPC command.
   532  type SetAccountCmd struct {
   533  	Address string
   534  	Account string
   535  }
   536  
   537  // NewSetAccountCmd returns a new instance which can be used to issue a
   538  // setaccount JSON-RPC command.
   539  func NewSetAccountCmd(address, account string) *SetAccountCmd {
   540  	return &SetAccountCmd{
   541  		Address: address,
   542  		Account: account,
   543  	}
   544  }
   545  
   546  // SetTxFeeCmd defines the settxfee JSON-RPC command.
   547  type SetTxFeeCmd struct {
   548  	Amount float64 // In BTC
   549  }
   550  
   551  // NewSetTxFeeCmd returns a new instance which can be used to issue a settxfee
   552  // JSON-RPC command.
   553  func NewSetTxFeeCmd(amount float64) *SetTxFeeCmd {
   554  	return &SetTxFeeCmd{
   555  		Amount: amount,
   556  	}
   557  }
   558  
   559  // SignMessageCmd defines the signmessage JSON-RPC command.
   560  type SignMessageCmd struct {
   561  	Address string
   562  	Message string
   563  }
   564  
   565  // NewSignMessageCmd returns a new instance which can be used to issue a
   566  // signmessage JSON-RPC command.
   567  func NewSignMessageCmd(address, message string) *SignMessageCmd {
   568  	return &SignMessageCmd{
   569  		Address: address,
   570  		Message: message,
   571  	}
   572  }
   573  
   574  // RawTxInput models the data needed for raw transaction input that is used in
   575  // the SignRawTransactionCmd struct.
   576  type RawTxInput struct {
   577  	Txid         string `json:"txid"`
   578  	Vout         uint32 `json:"vout"`
   579  	ScriptPubKey string `json:"scriptPubKey"`
   580  	RedeemScript string `json:"redeemScript"`
   581  }
   582  
   583  // SignRawTransactionCmd defines the signrawtransaction JSON-RPC command.
   584  type SignRawTransactionCmd struct {
   585  	RawTx    string
   586  	Inputs   *[]RawTxInput
   587  	PrivKeys *[]string
   588  	Flags    *string `jsonrpcdefault:"\"ALL\""`
   589  }
   590  
   591  // NewSignRawTransactionCmd returns a new instance which can be used to issue a
   592  // signrawtransaction JSON-RPC command.
   593  //
   594  // The parameters which are pointers indicate they are optional.  Passing nil
   595  // for optional parameters will use the default value.
   596  func NewSignRawTransactionCmd(hexEncodedTx string, inputs *[]RawTxInput, privKeys *[]string, flags *string) *SignRawTransactionCmd {
   597  	return &SignRawTransactionCmd{
   598  		RawTx:    hexEncodedTx,
   599  		Inputs:   inputs,
   600  		PrivKeys: privKeys,
   601  		Flags:    flags,
   602  	}
   603  }
   604  
   605  // WalletLockCmd defines the walletlock JSON-RPC command.
   606  type WalletLockCmd struct{}
   607  
   608  // NewWalletLockCmd returns a new instance which can be used to issue a
   609  // walletlock JSON-RPC command.
   610  func NewWalletLockCmd() *WalletLockCmd {
   611  	return &WalletLockCmd{}
   612  }
   613  
   614  // WalletPassphraseCmd defines the walletpassphrase JSON-RPC command.
   615  type WalletPassphraseCmd struct {
   616  	Passphrase string
   617  	Timeout    int64
   618  }
   619  
   620  // NewWalletPassphraseCmd returns a new instance which can be used to issue a
   621  // walletpassphrase JSON-RPC command.
   622  func NewWalletPassphraseCmd(passphrase string, timeout int64) *WalletPassphraseCmd {
   623  	return &WalletPassphraseCmd{
   624  		Passphrase: passphrase,
   625  		Timeout:    timeout,
   626  	}
   627  }
   628  
   629  // WalletPassphraseChangeCmd defines the walletpassphrase JSON-RPC command.
   630  type WalletPassphraseChangeCmd struct {
   631  	OldPassphrase string
   632  	NewPassphrase string
   633  }
   634  
   635  // NewWalletPassphraseChangeCmd returns a new instance which can be used to
   636  // issue a walletpassphrasechange JSON-RPC command.
   637  func NewWalletPassphraseChangeCmd(oldPassphrase, newPassphrase string) *WalletPassphraseChangeCmd {
   638  	return &WalletPassphraseChangeCmd{
   639  		OldPassphrase: oldPassphrase,
   640  		NewPassphrase: newPassphrase,
   641  	}
   642  }
   643  
   644  func init() {
   645  	// The commands in this file are only usable with a wallet server.
   646  	flags := UFWalletOnly
   647  
   648  	MustRegisterCmd("addmultisigaddress", (*AddMultisigAddressCmd)(nil), flags)
   649  	MustRegisterCmd("createmultisig", (*CreateMultisigCmd)(nil), flags)
   650  	MustRegisterCmd("dumpprivkey", (*DumpPrivKeyCmd)(nil), flags)
   651  	MustRegisterCmd("encryptwallet", (*EncryptWalletCmd)(nil), flags)
   652  	MustRegisterCmd("estimatefee", (*EstimateFeeCmd)(nil), flags)
   653  	MustRegisterCmd("estimatepriority", (*EstimatePriorityCmd)(nil), flags)
   654  	MustRegisterCmd("getaccount", (*GetAccountCmd)(nil), flags)
   655  	MustRegisterCmd("getaccountaddress", (*GetAccountAddressCmd)(nil), flags)
   656  	MustRegisterCmd("getaddressesbyaccount", (*GetAddressesByAccountCmd)(nil), flags)
   657  	MustRegisterCmd("getbalance", (*GetBalanceCmd)(nil), flags)
   658  	MustRegisterCmd("getnewaddress", (*GetNewAddressCmd)(nil), flags)
   659  	MustRegisterCmd("getrawchangeaddress", (*GetRawChangeAddressCmd)(nil), flags)
   660  	MustRegisterCmd("getreceivedbyaccount", (*GetReceivedByAccountCmd)(nil), flags)
   661  	MustRegisterCmd("getreceivedbyaddress", (*GetReceivedByAddressCmd)(nil), flags)
   662  	MustRegisterCmd("gettransaction", (*GetTransactionCmd)(nil), flags)
   663  	MustRegisterCmd("getwalletinfo", (*GetWalletInfoCmd)(nil), flags)
   664  	MustRegisterCmd("importprivkey", (*ImportPrivKeyCmd)(nil), flags)
   665  	MustRegisterCmd("keypoolrefill", (*KeyPoolRefillCmd)(nil), flags)
   666  	MustRegisterCmd("listaccounts", (*ListAccountsCmd)(nil), flags)
   667  	MustRegisterCmd("listaddressgroupings", (*ListAddressGroupingsCmd)(nil), flags)
   668  	MustRegisterCmd("listlockunspent", (*ListLockUnspentCmd)(nil), flags)
   669  	MustRegisterCmd("listreceivedbyaccount", (*ListReceivedByAccountCmd)(nil), flags)
   670  	MustRegisterCmd("listreceivedbyaddress", (*ListReceivedByAddressCmd)(nil), flags)
   671  	MustRegisterCmd("listsinceblock", (*ListSinceBlockCmd)(nil), flags)
   672  	MustRegisterCmd("listtransactions", (*ListTransactionsCmd)(nil), flags)
   673  	MustRegisterCmd("listunspent", (*ListUnspentCmd)(nil), flags)
   674  	MustRegisterCmd("lockunspent", (*LockUnspentCmd)(nil), flags)
   675  	MustRegisterCmd("move", (*MoveCmd)(nil), flags)
   676  	MustRegisterCmd("sendfrom", (*SendFromCmd)(nil), flags)
   677  	MustRegisterCmd("sendmany", (*SendManyCmd)(nil), flags)
   678  	MustRegisterCmd("sendtoaddress", (*SendToAddressCmd)(nil), flags)
   679  	MustRegisterCmd("setaccount", (*SetAccountCmd)(nil), flags)
   680  	MustRegisterCmd("settxfee", (*SetTxFeeCmd)(nil), flags)
   681  	MustRegisterCmd("signmessage", (*SignMessageCmd)(nil), flags)
   682  	MustRegisterCmd("signrawtransaction", (*SignRawTransactionCmd)(nil), flags)
   683  	MustRegisterCmd("walletlock", (*WalletLockCmd)(nil), flags)
   684  	MustRegisterCmd("walletpassphrase", (*WalletPassphraseCmd)(nil), flags)
   685  	MustRegisterCmd("walletpassphrasechange", (*WalletPassphraseChangeCmd)(nil), flags)
   686  }