From d2a18365bdba792ca153029e6a35955e11664853 Mon Sep 17 00:00:00 2001 From: ggoranov <4785841+ggoranov@users.noreply.github.com> Date: Thu, 11 Oct 2018 22:15:22 +0300 Subject: [PATCH] multi: Cleanup the unsupported dcrwallet commands. This cleans up both dcrjson and rpcclient packages from methods added from btcctl fork but not implemented by dcrwallet. dcrjson methods removed: - ImportAddressCmd - ImportPubKeyCmd - SendToSSGenCmd - SendToSSRtxCmd - SendToSStxCmd - SetBalanceToMaintainCmd - SetTicketMaxPriceCmd rpcclient methods removed: - ImportAddress, ImportAddressAsync - ImportAddressRescan, ImportAddressRescanAsync - ImportPubKey, ImportPubKeyAsync - ImportPubKeyRescan, ImportPubKeyRescanAsync - SendToSStx, SendToSStxAsync - SendToSStxMinConf, SendToSStxMinConfAsync - SendToSSGen, SendToSSGenAsync - SendToSStxComment, SendToSStxCommentAsync - SendToSSGenComment, SendToSSGenCommentAsync - SendToSSRtxAsync, SendToSSRtxCommentAsync As a result dcrctl does not list anymore these commands: - importaddress - importpubkey - sendtossgen - sendtossrtx - sendtosstx - setbalancetomaintain - setticketmaxprice --- dcrjson/walletsvrcmds.go | 134 ---------- dcrjson/walletsvrcmds_test.go | 56 ----- rpcclient/wallet.go | 447 ---------------------------------- 3 files changed, 637 deletions(-) diff --git a/dcrjson/walletsvrcmds.go b/dcrjson/walletsvrcmds.go index f86aec3d..583d332a 100644 --- a/dcrjson/walletsvrcmds.go +++ b/dcrjson/walletsvrcmds.go @@ -539,21 +539,6 @@ func NewGetWalletFeeCmd() *GetWalletFeeCmd { return &GetWalletFeeCmd{} } -// ImportAddressCmd defines the importaddress JSON-RPC command. -type ImportAddressCmd struct { - Address string - Rescan *bool `jsonrpcdefault:"true"` -} - -// NewImportAddressCmd returns a new instance which can be used to issue an -// importaddress JSON-RPC command. -func NewImportAddressCmd(address string, rescan *bool) *ImportAddressCmd { - return &ImportAddressCmd{ - Address: address, - Rescan: rescan, - } -} - // ImportPrivKeyCmd defines the importprivkey JSON-RPC command. type ImportPrivKeyCmd struct { PrivKey string @@ -576,21 +561,6 @@ func NewImportPrivKeyCmd(privKey string, label *string, rescan *bool, scanFrom * } } -// ImportPubKeyCmd defines the importpubkey JSON-RPC command. -type ImportPubKeyCmd struct { - PubKey string - Rescan *bool `jsonrpcdefault:"true"` -} - -// NewImportPubKeyCmd returns a new instance which can be used to issue an -// importpubkey JSON-RPC command. -func NewImportPubKeyCmd(pubKey string, rescan *bool) *ImportPubKeyCmd { - return &ImportPubKeyCmd{ - PubKey: pubKey, - Rescan: rescan, - } -} - // ImportScriptCmd is a type for handling custom marshaling and // unmarshaling of importscript JSON wallet extension commands. type ImportScriptCmd struct { @@ -967,89 +937,6 @@ func NewSendToMultiSigCmd(fromaccount string, amount float64, pubkeys []string, } } -// SendToSStxCmd is a type handling custom marshaling and -// unmarshaling of sendtosstx JSON RPC commands. -type SendToSStxCmd struct { - FromAccount string - Amounts map[string]int64 - Inputs []SStxInput - COuts []SStxCommitOut - MinConf *int `jsonrpcdefault:"1"` - Comment *string -} - -// NewSendToSStxCmd creates a new SendToSStxCmd. Optionally a -// pointer to a TemplateRequest may be provided. -func NewSendToSStxCmd(fromaccount string, amounts map[string]int64, - inputs []SStxInput, couts []SStxCommitOut, minConf *int, - comment *string) *SendToSStxCmd { - return &SendToSStxCmd{ - FromAccount: fromaccount, - Amounts: amounts, - Inputs: inputs, - COuts: couts, - MinConf: minConf, - Comment: comment, - } -} - -// SendToSSGenCmd models the data needed for sendtossgen. -type SendToSSGenCmd struct { - FromAccount string - TicketHash string - BlockHash string - Height int64 - VoteBits uint16 - Comment *string -} - -// NewSendToSSGenCmd creates a new SendToSSGenCmd. Optionally a -// pointer to a TemplateRequest may be provided. -func NewSendToSSGenCmd(fromaccount string, tickethash string, blockhash string, - height int64, votebits uint16, comment *string) *SendToSSGenCmd { - return &SendToSSGenCmd{ - FromAccount: fromaccount, - TicketHash: tickethash, - BlockHash: blockhash, - Height: height, - VoteBits: votebits, - Comment: comment, - } -} - -// SendToSSRtxCmd is a type handling custom marshaling and -// unmarshaling of sendtossrtx JSON RPC commands. -type SendToSSRtxCmd struct { - FromAccount string - TicketHash string - Comment *string -} - -// NewSendToSSRtxCmd creates a new SendToSSRtxCmd. Optionally a -// pointer to a TemplateRequest may be provided. -func NewSendToSSRtxCmd(fromaccount string, tickethash string, - comment *string) *SendToSSRtxCmd { - return &SendToSSRtxCmd{ - FromAccount: fromaccount, - TicketHash: tickethash, - Comment: comment, - } -} - -// SetBalanceToMaintainCmd is a type handling custom marshaling and -// unmarshaling of setbalancetomaintain JSON RPC commands. -type SetBalanceToMaintainCmd struct { - Balance float64 -} - -// NewSetBalanceToMaintainCmd creates a new instance of the setticketfee -// command. -func NewSetBalanceToMaintainCmd(balance float64) *SetBalanceToMaintainCmd { - return &SetBalanceToMaintainCmd{ - Balance: balance, - } -} - // SetTxFeeCmd defines the settxfee JSON-RPC command. type SetTxFeeCmd struct { Amount float64 // In DCR @@ -1077,20 +964,6 @@ func NewSetTicketFeeCmd(fee float64) *SetTicketFeeCmd { } } -// SetTicketMaxPriceCmd is a type handling custom marshaling and -// unmarshaling of setticketmaxprice JSON RPC commands. -type SetTicketMaxPriceCmd struct { - Max float64 -} - -// NewSetTicketMaxPriceCmd creates a new instance of the setticketmaxprice -// command. -func NewSetTicketMaxPriceCmd(max float64) *SetTicketMaxPriceCmd { - return &SetTicketMaxPriceCmd{ - Max: max, - } -} - // SetVoteChoiceCmd defines the parameters to the setvotechoice method. type SetVoteChoiceCmd struct { AgendaID string @@ -1346,9 +1219,7 @@ func init() { MustRegisterCmd("gettransaction", (*GetTransactionCmd)(nil), flags) MustRegisterCmd("getvotechoices", (*GetVoteChoicesCmd)(nil), flags) MustRegisterCmd("getwalletfee", (*GetWalletFeeCmd)(nil), flags) - MustRegisterCmd("importaddress", (*ImportAddressCmd)(nil), flags) MustRegisterCmd("importprivkey", (*ImportPrivKeyCmd)(nil), flags) - MustRegisterCmd("importpubkey", (*ImportPubKeyCmd)(nil), flags) MustRegisterCmd("importscript", (*ImportScriptCmd)(nil), flags) MustRegisterCmd("keypoolrefill", (*KeyPoolRefillCmd)(nil), flags) MustRegisterCmd("listaccounts", (*ListAccountsCmd)(nil), flags) @@ -1370,13 +1241,8 @@ func init() { MustRegisterCmd("sendmany", (*SendManyCmd)(nil), flags) MustRegisterCmd("sendtoaddress", (*SendToAddressCmd)(nil), flags) MustRegisterCmd("sendtomultisig", (*SendToMultiSigCmd)(nil), flags) - MustRegisterCmd("sendtosstx", (*SendToSStxCmd)(nil), flags) - MustRegisterCmd("sendtossgen", (*SendToSSGenCmd)(nil), flags) - MustRegisterCmd("sendtossrtx", (*SendToSSRtxCmd)(nil), flags) - MustRegisterCmd("setbalancetomaintain", (*SetBalanceToMaintainCmd)(nil), flags) MustRegisterCmd("settxfee", (*SetTxFeeCmd)(nil), flags) MustRegisterCmd("setticketfee", (*SetTicketFeeCmd)(nil), flags) - MustRegisterCmd("setticketmaxprice", (*SetTicketMaxPriceCmd)(nil), flags) MustRegisterCmd("setvotechoice", (*SetVoteChoiceCmd)(nil), flags) MustRegisterCmd("signmessage", (*SignMessageCmd)(nil), flags) MustRegisterCmd("signrawtransaction", (*SignRawTransactionCmd)(nil), flags) diff --git a/dcrjson/walletsvrcmds_test.go b/dcrjson/walletsvrcmds_test.go index 634b692e..45ad3b60 100644 --- a/dcrjson/walletsvrcmds_test.go +++ b/dcrjson/walletsvrcmds_test.go @@ -346,34 +346,6 @@ func TestWalletSvrCmds(t *testing.T) { IncludeWatchOnly: Bool(true), }, }, - { - name: "importaddress", - newCmd: func() (interface{}, error) { - return NewCmd("importaddress", "1Address") - }, - staticCmd: func() interface{} { - return NewImportAddressCmd("1Address", nil) - }, - marshalled: `{"jsonrpc":"1.0","method":"importaddress","params":["1Address"],"id":1}`, - unmarshalled: &ImportAddressCmd{ - Address: "1Address", - Rescan: Bool(true), - }, - }, - { - name: "importaddress optional", - newCmd: func() (interface{}, error) { - return NewCmd("importaddress", "1Address", false) - }, - staticCmd: func() interface{} { - return NewImportAddressCmd("1Address", Bool(false)) - }, - marshalled: `{"jsonrpc":"1.0","method":"importaddress","params":["1Address",false],"id":1}`, - unmarshalled: &ImportAddressCmd{ - Address: "1Address", - Rescan: Bool(false), - }, - }, { name: "importprivkey", newCmd: func() (interface{}, error) { @@ -435,34 +407,6 @@ func TestWalletSvrCmds(t *testing.T) { ScanFrom: Int(12345), }, }, - { - name: "importpubkey", - newCmd: func() (interface{}, error) { - return NewCmd("importpubkey", "031234") - }, - staticCmd: func() interface{} { - return NewImportPubKeyCmd("031234", nil) - }, - marshalled: `{"jsonrpc":"1.0","method":"importpubkey","params":["031234"],"id":1}`, - unmarshalled: &ImportPubKeyCmd{ - PubKey: "031234", - Rescan: Bool(true), - }, - }, - { - name: "importpubkey optional", - newCmd: func() (interface{}, error) { - return NewCmd("importpubkey", "031234", false) - }, - staticCmd: func() interface{} { - return NewImportPubKeyCmd("031234", Bool(false)) - }, - marshalled: `{"jsonrpc":"1.0","method":"importpubkey","params":["031234",false],"id":1}`, - unmarshalled: &ImportPubKeyCmd{ - PubKey: "031234", - Rescan: Bool(false), - }, - }, { name: "keypoolrefill", newCmd: func() (interface{}, error) { diff --git a/rpcclient/wallet.go b/rpcclient/wallet.go index 6edca007..cbef2eb3 100644 --- a/rpcclient/wallet.go +++ b/rpcclient/wallet.go @@ -821,369 +821,6 @@ func (c *Client) PurchaseTicket(fromAccount string, numTickets, poolAddress, poolFees, expiry, ticketFee).Receive() } -// SStx generation RPC call handling - -// FutureSendToSStxResult is a future promise to deliver the result of a -// SendToSStxAsync, SendToSStxMinConfAsync, or SendToSStxCommentAsync RPC -// invocation (or an applicable error). -type FutureSendToSStxResult chan *response - -// Receive waits for the response promised by the future and returns the hash -// of the transaction sending multiple amounts to multiple addresses using the -// provided account as a source of funds. -func (r FutureSendToSStxResult) Receive() (*chainhash.Hash, error) { - res, err := receiveFuture(r) - if err != nil { - return nil, err - } - - // Unmashal result as a string. - var txHash string - err = json.Unmarshal(res, &txHash) - if err != nil { - return nil, err - } - - return chainhash.NewHashFromStr(txHash) -} - -// SendToSStxAsync returns an instance of a type that can be used to get the -// result of the RPC at some future time by invoking the Receive function on the -// returned instance. -// -// See SendToSStx for the blocking version and more details. -func (c *Client) SendToSStxAsync(fromAccount string, - inputs []dcrjson.SStxInput, - amounts map[dcrutil.Address]dcrutil.Amount, - couts []SStxCommitOut) FutureSendToSStxResult { - - convertedAmounts := make(map[string]int64, len(amounts)) - for addr, amount := range amounts { - convertedAmounts[addr.EncodeAddress()] = int64(amount) - } - convertedCouts := make([]dcrjson.SStxCommitOut, len(couts)) - for i, cout := range couts { - convertedCouts[i].Addr = cout.Addr.String() - convertedCouts[i].CommitAmt = int64(cout.CommitAmt) - convertedCouts[i].ChangeAddr = cout.ChangeAddr.String() - convertedCouts[i].ChangeAmt = int64(cout.ChangeAmt) - } - - cmd := dcrjson.NewSendToSStxCmd(fromAccount, convertedAmounts, - inputs, convertedCouts, nil, nil) - - return c.sendCmd(cmd) -} - -// SendToSStx purchases a stake ticket with the amounts specified, with -// block generation rewards going to the dests specified. Only funds with the -// default number of minimum confirmations will be used. -// -// See SendToSStxMinConf and SendToSStxComment for different options. -// -// NOTE: This function requires to the wallet to be unlocked. See the -// WalletPassphrase function for more details. -func (c *Client) SendToSStx(fromAccount string, - inputs []dcrjson.SStxInput, - amounts map[dcrutil.Address]dcrutil.Amount, - couts []SStxCommitOut) (*chainhash.Hash, error) { - - return c.SendToSStxAsync(fromAccount, inputs, amounts, couts).Receive() -} - -// SendToSStxMinConfAsync returns an instance of a type that can be used to get -// the result of the RPC at some future time by invoking the Receive function on -// the returned instance. -// -// See SendToSStxMinConf for the blocking version and more details. -func (c *Client) SendToSStxMinConfAsync(fromAccount string, - inputs []dcrjson.SStxInput, - amounts map[dcrutil.Address]dcrutil.Amount, - couts []SStxCommitOut, - minConfirms int) FutureSendToSStxResult { - - convertedAmounts := make(map[string]int64, len(amounts)) - for addr, amount := range amounts { - convertedAmounts[addr.EncodeAddress()] = int64(amount) - } - convertedCouts := make([]dcrjson.SStxCommitOut, len(couts)) - for i, cout := range couts { - convertedCouts[i].Addr = cout.Addr.String() - convertedCouts[i].CommitAmt = int64(cout.CommitAmt) - convertedCouts[i].ChangeAddr = cout.ChangeAddr.String() - convertedCouts[i].ChangeAmt = int64(cout.ChangeAmt) - } - - cmd := dcrjson.NewSendToSStxCmd(fromAccount, convertedAmounts, - inputs, convertedCouts, &minConfirms, nil) - - return c.sendCmd(cmd) -} - -// SendToSStxMinConf purchases a stake ticket with the amounts specified, with -// block generation rewards going to the dests specified. Only funds with the -// passed number of minimum confirmations will be used. -// -// See SendToSStx to use the default number of minimum confirmations and -// SendToSStxComment for additional options. -// -// NOTE: This function requires to the wallet to be unlocked. See the -// WalletPassphrase function for more details. -func (c *Client) SendToSStxMinConf(fromAccount string, - inputs []dcrjson.SStxInput, - amounts map[dcrutil.Address]dcrutil.Amount, - couts []SStxCommitOut, - minConfirms int) (*chainhash.Hash, error) { - - return c.SendToSStxMinConfAsync(fromAccount, inputs, amounts, couts, minConfirms).Receive() -} - -// SendToSStxCommentAsync returns an instance of a type that can be used to get -// the result of the RPC at some future time by invoking the Receive function on -// the returned instance. -// -// See SendToSStxComment for the blocking version and more details. -func (c *Client) SendToSStxCommentAsync(fromAccount string, - inputs []dcrjson.SStxInput, - amounts map[dcrutil.Address]dcrutil.Amount, - couts []SStxCommitOut, - minConfirms int, - comment string) FutureSendToSStxResult { - - convertedAmounts := make(map[string]int64, len(amounts)) - for addr, amount := range amounts { - convertedAmounts[addr.EncodeAddress()] = int64(amount) - } - convertedCouts := make([]dcrjson.SStxCommitOut, len(couts)) - for i, cout := range couts { - convertedCouts[i].Addr = cout.Addr.String() - convertedCouts[i].CommitAmt = int64(cout.CommitAmt) - convertedCouts[i].ChangeAddr = cout.ChangeAddr.String() - convertedCouts[i].ChangeAmt = int64(cout.ChangeAmt) - } - - cmd := dcrjson.NewSendToSStxCmd(fromAccount, convertedAmounts, - inputs, convertedCouts, &minConfirms, &comment) - - return c.sendCmd(cmd) -} - -// SendToSStxComment spurchases a stake ticket with the amounts specified, with -// block generation rewards going to the dests specified and stores an extra -// comment in the wallet. The comment parameter is intended to be used -// for the purpose of the transaction Only funds with the passed number of -// minimum confirmations will be used. -// -// See SendToSStx and SendToSStxMinConf to use defaults. -// -// NOTE: This function requires to the wallet to be unlocked. See the -// WalletPassphrase function for more details. -func (c *Client) SendToSStxComment(fromAccount string, - inputs []dcrjson.SStxInput, - amounts map[dcrutil.Address]dcrutil.Amount, - couts []SStxCommitOut, - minConfirms int, - comment string) (*chainhash.Hash, error) { - - return c.SendToSStxCommentAsync(fromAccount, inputs, amounts, couts, minConfirms, - comment).Receive() -} - -// -------------------------------------------------------------------------------- - -// SSGen generation RPC call handling - -// FutureSendToSSGenResult is a future promise to deliver the result of a -// SendToSSGenAsync, or SendToSSGenCommentAsync RPC invocation (or an applicable -// error). -type FutureSendToSSGenResult chan *response - -// Receive waits for the response promised by the future and returns the hash -// of the transaction sending multiple amounts to multiple addresses using the -// provided account as a source of funds. -func (r FutureSendToSSGenResult) Receive() (*chainhash.Hash, error) { - res, err := receiveFuture(r) - if err != nil { - return nil, err - } - - // Unmashal result as a string. - var txHash string - err = json.Unmarshal(res, &txHash) - if err != nil { - return nil, err - } - - return chainhash.NewHashFromStr(txHash) -} - -// SendToSSGenAsync returns an instance of a type that can be used to get the -// result of the RPC at some future time by invoking the Receive function on the -// returned instance. -// -// See SendToSSGen for the blocking version and more details. -func (c *Client) SendToSSGenAsync(fromAccount string, - tickethash chainhash.Hash, - blockhash chainhash.Hash, - height int64, - votebits uint16) FutureSendToSSGenResult { - - ticketHashString := hex.EncodeToString(tickethash[:]) - blockHashString := hex.EncodeToString(blockhash[:]) - - cmd := dcrjson.NewSendToSSGenCmd(fromAccount, ticketHashString, - blockHashString, height, votebits, nil) - - return c.sendCmd(cmd) -} - -// SendToSSGen spends a stake ticket to validate a block (blockhash) at a certain -// height to gain some reward; it votes on the tx of the previous block with -// votebits. -// -// See SendToSSGenComment for different options. -// -// NOTE: This function requires to the wallet to be unlocked. See the -// WalletPassphrase function for more details. -func (c *Client) SendToSSGen(fromAccount string, - tickethash chainhash.Hash, - blockhash chainhash.Hash, - height int64, - votebits uint16) (*chainhash.Hash, error) { - - return c.SendToSSGenAsync(fromAccount, tickethash, blockhash, height, votebits).Receive() -} - -// SendToSSGenCommentAsync returns an instance of a type that can be used to get -// the result of the RPC at some future time by invoking the Receive function on -// the returned instance. -// -// See SendToSSGenComment for the blocking version and more details. -func (c *Client) SendToSSGenCommentAsync(fromAccount string, - tickethash chainhash.Hash, - blockhash chainhash.Hash, - height int64, - votebits uint16, - comment string) FutureSendToSSGenResult { - - ticketHashString := hex.EncodeToString(tickethash[:]) - blockHashString := hex.EncodeToString(blockhash[:]) - - cmd := dcrjson.NewSendToSSGenCmd(fromAccount, ticketHashString, - blockHashString, height, votebits, &comment) - - return c.sendCmd(cmd) -} - -// SendToSSGenComment spends a stake ticket to validate a block (blockhash) at a -// certain height to gain some reward; it votes on the tx of the previous block -// with votebits and stores the provided comment in the wallet. The comment -// parameter is intended to be used for the purpose of the transaction. Only funds -// with the passed number of minimum confirmations will be used. -// -// See SendToSSGen and SendToSSGenMinConf to use defaults. -// -// NOTE: This function requires to the wallet to be unlocked. See the -// WalletPassphrase function for more details. -func (c *Client) SendToSSGenComment(fromAccount string, - tickethash chainhash.Hash, - blockhash chainhash.Hash, - height int64, - votebits uint16, - comment string) (*chainhash.Hash, error) { - - return c.SendToSSGenCommentAsync(fromAccount, tickethash, blockhash, height, - votebits, comment).Receive() -} - -// -------------------------------------------------------------------------------- - -// SSRtx generation RPC call handling - -// FutureSendToSSRtxResult is a future promise to deliver the result of a -// SendToSSRtxAsync, or SendToSSRtxCommentAsync RPC invocation (or an applicable -// error). -type FutureSendToSSRtxResult chan *response - -// Receive waits for the response promised by the future and returns the hash -// of the transaction sending multiple amounts to multiple addresses using the -// provided account as a source of funds. -func (r FutureSendToSSRtxResult) Receive() (*chainhash.Hash, error) { - res, err := receiveFuture(r) - if err != nil { - return nil, err - } - - // Unmashal result as a string. - var txHash string - err = json.Unmarshal(res, &txHash) - if err != nil { - return nil, err - } - - return chainhash.NewHashFromStr(txHash) -} - -// SendToSSRtxAsync returns an instance of a type that can be used to get the -// result of the RPC at some future time by invoking the Receive function on the -// returned instance. -// -// See SendToSSRtx for the blocking version and more details. -func (c *Client) SendToSSRtxAsync(fromAccount string, - tickethash chainhash.Hash) FutureSendToSSRtxResult { - - ticketHashString := hex.EncodeToString(tickethash[:]) - - cmd := dcrjson.NewSendToSSRtxCmd(fromAccount, ticketHashString, nil) - - return c.sendCmd(cmd) -} - -// SendToSSRtx spends a stake ticket that previously missed its chance to vote on -// a block. -// -// See SendToSSRtxComment for different options. -// -// NOTE: This function requires to the wallet to be unlocked. See the -// WalletPassphrase function for more details. -func (c *Client) SendToSSRtx(fromAccount string, - tickethash chainhash.Hash) (*chainhash.Hash, error) { - - return c.SendToSSRtxAsync(fromAccount, tickethash).Receive() -} - -// SendToSSRtxCommentAsync returns an instance of a type that can be used to get -// the result of the RPC at some future time by invoking the Receive function on -// the returned instance. -// -// See SendToSSRtxComment for the blocking version and more details. -func (c *Client) SendToSSRtxCommentAsync(fromAccount string, - tickethash chainhash.Hash, - comment string) FutureSendToSSRtxResult { - - ticketHashString := hex.EncodeToString(tickethash[:]) - - cmd := dcrjson.NewSendToSSRtxCmd(fromAccount, ticketHashString, &comment) - - return c.sendCmd(cmd) -} - -// SendToSSRtxComment spends a stake ticket that previously missed its chance to -// vote on a block and stores the provided comment in the wallet. The comment -// parameter is intended to be used for the purpose of the transaction. Only funds -// with the passed number of minimum confirmations will be used. -// -// See SendToSSRtx and SendToSSRtxMinConf to use defaults. -// -// NOTE: This function requires to the wallet to be unlocked. See the -// WalletPassphrase function for more details. -func (c *Client) SendToSSRtxComment(fromAccount string, - tickethash chainhash.Hash, - comment string) (*chainhash.Hash, error) { - - return c.SendToSSRtxCommentAsync(fromAccount, tickethash, comment).Receive() -} - // END DECRED FUNCTIONS ----------------------------------------------------------- // ************************* @@ -2352,48 +1989,6 @@ func (c *Client) DumpPrivKey(address dcrutil.Address) (*dcrutil.WIF, error) { return c.DumpPrivKeyAsync(address).Receive() } -// FutureImportAddressResult is a future promise to deliver the result of an -// ImportAddressAsync RPC invocation (or an applicable error). -type FutureImportAddressResult chan *response - -// Receive waits for the response promised by the future and returns the result -// of importing the passed public address. -func (r FutureImportAddressResult) Receive() error { - _, err := receiveFuture(r) - return err -} - -// ImportAddressAsync returns an instance of a type that can be used to get the -// result of the RPC at some future time by invoking the Receive function on the -// returned instance. -// -// See ImportAddress for the blocking version and more details. -func (c *Client) ImportAddressAsync(address string) FutureImportAddressResult { - cmd := dcrjson.NewImportAddressCmd(address, nil) - return c.sendCmd(cmd) -} - -// ImportAddress imports the passed public address. -func (c *Client) ImportAddress(address string) error { - return c.ImportAddressAsync(address).Receive() -} - -// ImportAddressRescanAsync returns an instance of a type that can be used to get the -// result of the RPC at some future time by invoking the Receive function on the -// returned instance. -// -// See ImportAddress for the blocking version and more details. -func (c *Client) ImportAddressRescanAsync(address string, rescan bool) FutureImportAddressResult { - cmd := dcrjson.NewImportAddressCmd(address, &rescan) - return c.sendCmd(cmd) -} - -// ImportAddressRescan imports the passed public address. When rescan is true, -// the block history is scanned for transactions addressed to provided address. -func (c *Client) ImportAddressRescan(address string, rescan bool) error { - return c.ImportAddressRescanAsync(address, rescan).Receive() -} - // FutureImportPrivKeyResult is a future promise to deliver the result of an // ImportPrivKeyAsync RPC invocation (or an applicable error). type FutureImportPrivKeyResult chan *response @@ -2494,48 +2089,6 @@ func (c *Client) ImportPrivKeyRescanFrom(privKeyWIF *dcrutil.WIF, label string, return c.ImportPrivKeyRescanFromAsync(privKeyWIF, label, rescan, scanFrom).Receive() } -// FutureImportPubKeyResult is a future promise to deliver the result of an -// ImportPubKeyAsync RPC invocation (or an applicable error). -type FutureImportPubKeyResult chan *response - -// Receive waits for the response promised by the future and returns the result -// of importing the passed public key. -func (r FutureImportPubKeyResult) Receive() error { - _, err := receiveFuture(r) - return err -} - -// ImportPubKeyAsync returns an instance of a type that can be used to get the -// result of the RPC at some future time by invoking the Receive function on the -// returned instance. -// -// See ImportPubKey for the blocking version and more details. -func (c *Client) ImportPubKeyAsync(pubKey string) FutureImportPubKeyResult { - cmd := dcrjson.NewImportPubKeyCmd(pubKey, nil) - return c.sendCmd(cmd) -} - -// ImportPubKey imports the passed public key. -func (c *Client) ImportPubKey(pubKey string) error { - return c.ImportPubKeyAsync(pubKey).Receive() -} - -// ImportPubKeyRescanAsync returns an instance of a type that can be used to get the -// result of the RPC at some future time by invoking the Receive function on the -// returned instance. -// -// See ImportPubKey for the blocking version and more details. -func (c *Client) ImportPubKeyRescanAsync(pubKey string, rescan bool) FutureImportPubKeyResult { - cmd := dcrjson.NewImportPubKeyCmd(pubKey, &rescan) - return c.sendCmd(cmd) -} - -// ImportPubKeyRescan imports the passed public key. When rescan is true, the -// block history is scanned for transactions addressed to provided pubkey. -func (c *Client) ImportPubKeyRescan(pubKey string, rescan bool) error { - return c.ImportPubKeyRescanAsync(pubKey, rescan).Receive() -} - // FutureImportScriptResult is a future promise to deliver the result // of a ImportScriptAsync RPC invocation (or an applicable error). type FutureImportScriptResult chan *response