Documentation ¶
Index ¶
- type Caller
- type Client
- func (c *Client) AccountAddressIndex(ctx context.Context, account string, branch uint32) (int, error)
- func (c *Client) AccountSyncAddressIndex(ctx context.Context, account string, branch uint32, index int) error
- func (c *Client) AccountUnlocked(ctx context.Context, account string) (*types.AccountUnlockedResult, error)
- func (c *Client) AddMultisigAddress(ctx context.Context, requiredSigs int, addresses []stdaddr.Address, ...) (stdaddr.Address, error)
- func (c *Client) AddTicket(ctx context.Context, ticket *dcrutil.Tx) error
- func (c *Client) CreateMultisig(ctx context.Context, requiredSigs int, addresses []stdaddr.Address) (*types.CreateMultiSigResult, error)
- func (c *Client) CreateNewAccount(ctx context.Context, account string) error
- func (c *Client) DumpPrivKey(ctx context.Context, address stdaddr.Address) (*dcrutil.WIF, error)
- func (c *Client) FundRawTransaction(ctx context.Context, rawhex string, fundAccount string, ...) (*types.FundRawTransactionResult, error)
- func (c *Client) GetAccount(ctx context.Context, address stdaddr.Address) (string, error)
- func (c *Client) GetAccountAddress(ctx context.Context, account string) (stdaddr.Address, error)
- func (c *Client) GetAddressesByAccount(ctx context.Context, account string) ([]stdaddr.Address, error)
- func (c *Client) GetBalance(ctx context.Context, account string) (*types.GetBalanceResult, error)
- func (c *Client) GetBalanceMinConf(ctx context.Context, account string, minConfirms int) (*types.GetBalanceResult, error)
- func (c *Client) GetInfo(ctx context.Context) (*types.InfoWalletResult, error)
- func (c *Client) GetMasterPubkey(ctx context.Context, account string) (*hdkeychain.ExtendedKey, error)
- func (c *Client) GetNewAddress(ctx context.Context, account string) (stdaddr.Address, error)
- func (c *Client) GetNewAddressGapPolicy(ctx context.Context, account string, gapPolicy GapPolicy) (stdaddr.Address, error)
- func (c *Client) GetRawChangeAddress(ctx context.Context, account string, net stdaddr.AddressParams) (stdaddr.Address, error)
- func (c *Client) GetReceivedByAccount(ctx context.Context, account string) (dcrutil.Amount, error)
- func (c *Client) GetReceivedByAccountMinConf(ctx context.Context, account string, minConfirms int) (dcrutil.Amount, error)
- func (c *Client) GetReceivedByAddress(ctx context.Context, address stdaddr.Address) (dcrutil.Amount, error)
- func (c *Client) GetReceivedByAddressMinConf(ctx context.Context, address stdaddr.Address, minConfirms int) (dcrutil.Amount, error)
- func (c *Client) GetStakeInfo(ctx context.Context) (*types.GetStakeInfoResult, error)
- func (c *Client) GetTickets(ctx context.Context, includeImmature bool) ([]*chainhash.Hash, error)
- func (c *Client) GetTransaction(ctx context.Context, txHash *chainhash.Hash) (*types.GetTransactionResult, error)
- func (c *Client) GetUnconfirmedBalance(ctx context.Context, account string) (dcrutil.Amount, error)
- func (c *Client) GetVoteChoices(ctx context.Context) (*types.GetVoteChoicesResult, error)
- func (c *Client) ImportPrivKey(ctx context.Context, privKeyWIF *dcrutil.WIF) error
- func (c *Client) ImportPrivKeyLabel(ctx context.Context, privKeyWIF *dcrutil.WIF, label string) error
- func (c *Client) ImportPrivKeyRescan(ctx context.Context, privKeyWIF *dcrutil.WIF, label string, rescan bool) error
- func (c *Client) ImportPrivKeyRescanFrom(ctx context.Context, privKeyWIF *dcrutil.WIF, label string, rescan bool, ...) error
- func (c *Client) ImportScript(ctx context.Context, script []byte) error
- func (c *Client) ImportScriptRescan(ctx context.Context, script []byte, rescan bool) error
- func (c *Client) ImportScriptRescanFrom(ctx context.Context, script []byte, rescan bool, scanFrom int) error
- func (c *Client) ListAccounts(ctx context.Context) (map[string]dcrutil.Amount, error)
- func (c *Client) ListAccountsMinConf(ctx context.Context, minConfirms int) (map[string]dcrutil.Amount, error)
- func (c *Client) ListAddressTransactions(ctx context.Context, addresses []stdaddr.Address, account string) ([]types.ListTransactionsResult, error)
- func (c *Client) ListLockUnspent(ctx context.Context) ([]*wire.OutPoint, error)
- func (c *Client) ListReceivedByAccount(ctx context.Context) ([]types.ListReceivedByAccountResult, error)
- func (c *Client) ListReceivedByAccountIncludeEmpty(ctx context.Context, minConfirms int, includeEmpty bool) ([]types.ListReceivedByAccountResult, error)
- func (c *Client) ListReceivedByAccountMinConf(ctx context.Context, minConfirms int) ([]types.ListReceivedByAccountResult, error)
- func (c *Client) ListReceivedByAddress(ctx context.Context) ([]types.ListReceivedByAddressResult, error)
- func (c *Client) ListReceivedByAddressIncludeEmpty(ctx context.Context, minConfirms int, includeEmpty bool) ([]types.ListReceivedByAddressResult, error)
- func (c *Client) ListReceivedByAddressMinConf(ctx context.Context, minConfirms int) ([]types.ListReceivedByAddressResult, error)
- func (c *Client) ListSinceBlock(ctx context.Context, blockHash *chainhash.Hash) (*types.ListSinceBlockResult, error)
- func (c *Client) ListSinceBlockMinConf(ctx context.Context, blockHash *chainhash.Hash, minConfirms int) (*types.ListSinceBlockResult, error)
- func (c *Client) ListTransactions(ctx context.Context, account string) ([]types.ListTransactionsResult, error)
- func (c *Client) ListTransactionsCount(ctx context.Context, account string, count int) ([]types.ListTransactionsResult, error)
- func (c *Client) ListTransactionsCountFrom(ctx context.Context, account string, count, from int) ([]types.ListTransactionsResult, error)
- func (c *Client) ListUnspent(ctx context.Context) ([]types.ListUnspentResult, error)
- func (c *Client) ListUnspentMin(ctx context.Context, minConf int) ([]types.ListUnspentResult, error)
- func (c *Client) ListUnspentMinMax(ctx context.Context, minConf, maxConf int) ([]types.ListUnspentResult, error)
- func (c *Client) ListUnspentMinMaxAddresses(ctx context.Context, minConf, maxConf int, addrs []stdaddr.Address) ([]types.ListUnspentResult, error)
- func (c *Client) LockAccount(ctx context.Context, account string) error
- func (c *Client) LockUnspent(ctx context.Context, unlock bool, ops []*wire.OutPoint) error
- func (c *Client) PurchaseTicket(ctx context.Context, fromAccount string, spendLimit dcrutil.Amount, ...) ([]*chainhash.Hash, error)
- func (c *Client) RenameAccount(ctx context.Context, oldAccount, newAccount string) error
- func (c *Client) RevokeTickets(ctx context.Context) error
- func (c *Client) SendFrom(ctx context.Context, fromAccount string, toAddress stdaddr.Address, ...) (*chainhash.Hash, error)
- func (c *Client) SendFromMinConf(ctx context.Context, fromAccount string, toAddress stdaddr.Address, ...) (*chainhash.Hash, error)
- func (c *Client) SendMany(ctx context.Context, fromAccount string, ...) (*chainhash.Hash, error)
- func (c *Client) SendManyMinConf(ctx context.Context, fromAccount string, ...) (*chainhash.Hash, error)
- func (c *Client) SendToAddress(ctx context.Context, address stdaddr.Address, amount dcrutil.Amount) (*chainhash.Hash, error)
- func (c *Client) SetTxFee(ctx context.Context, fee dcrutil.Amount) error
- func (c *Client) SetVoteChoice(ctx context.Context, agendaID, choiceID string) error
- func (c *Client) SignMessage(ctx context.Context, address stdaddr.Address, message string) (string, error)
- func (c *Client) SignRawSSGenTx(ctx context.Context, tx *wire.MsgTx) (*wire.MsgTx, bool, error)
- func (c *Client) SignRawTransaction(ctx context.Context, tx *wire.MsgTx) (*wire.MsgTx, bool, error)
- func (c *Client) SignRawTransaction2(ctx context.Context, tx *wire.MsgTx, inputs []types.RawTxInput) (*wire.MsgTx, bool, error)
- func (c *Client) SignRawTransaction3(ctx context.Context, tx *wire.MsgTx, inputs []types.RawTxInput, ...) (*wire.MsgTx, bool, error)
- func (c *Client) SignRawTransaction4(ctx context.Context, tx *wire.MsgTx, inputs []types.RawTxInput, ...) (*wire.MsgTx, bool, error)
- func (c *Client) TicketsForAddress(ctx context.Context, addr stdaddr.Address) (*dcrdtypes.TicketsForAddressResult, error)
- func (c *Client) UnlockAccount(ctx context.Context, account, passphrase string) error
- func (c *Client) ValidateAddress(ctx context.Context, address stdaddr.Address) (*types.ValidateAddressWalletResult, error)
- func (c *Client) VerifyMessage(ctx context.Context, address stdaddr.Address, signature, message string) (bool, error)
- func (c *Client) WalletInfo(ctx context.Context) (*types.WalletInfoResult, error)
- func (c *Client) WalletLock(ctx context.Context) error
- func (c *Client) WalletPassphrase(ctx context.Context, passphrase string, timeoutSecs int64) error
- func (c *Client) WalletPassphraseChange(ctx context.Context, old, new string) error
- type GapPolicy
- type RawRequester
- type SigHashType
- type SignatureErrors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Caller ¶
type Caller interface { // Call performs the remote procedure call defined by method and // waits for a response or a broken client connection. // Args provides positional parameters for the call. // Res must be a pointer to a struct, slice, or map type to unmarshal // a result (if any), or nil if no result is needed. Call(ctx context.Context, method string, res interface{}, args ...interface{}) error }
Caller provides a client interface to perform JSON-RPC remote procedure calls.
func RawRequestCaller ¶
func RawRequestCaller(req RawRequester) Caller
RawRequestCaller wraps a RawRequester to provide a Caller implementation.
type Client ¶
type Client struct { Caller // contains filtered or unexported fields }
Client provides convenience methods for type-safe dcrwallet JSON-RPC usage.
func (*Client) AccountAddressIndex ¶
func (c *Client) AccountAddressIndex(ctx context.Context, account string, branch uint32) (int, error)
AccountAddressIndex returns the address index for a given account's branch.
func (*Client) AccountSyncAddressIndex ¶
func (c *Client) AccountSyncAddressIndex(ctx context.Context, account string, branch uint32, index int) error
AccountSyncAddressIndex synchronizes an account branch to the passed address index.
func (*Client) AccountUnlocked ¶
func (c *Client) AccountUnlocked(ctx context.Context, account string) (*types.AccountUnlockedResult, error)
AccountUnlocked indicates the encryption and locked status of an account. The Unlocked field of AccountUnlockedResult is only non-nil if Encrypted is true.
func (*Client) AddMultisigAddress ¶
func (c *Client) AddMultisigAddress(ctx context.Context, requiredSigs int, addresses []stdaddr.Address, account string) (stdaddr.Address, error)
AddMultisigAddress adds a multisignature address that requires the specified number of signatures for the provided addresses to the wallet.
func (*Client) AddTicket ¶
AddTicket manually adds a new ticket to the wallet stake manager. This is used to override normal security settings to insert tickets which would not otherwise be added to the wallet.
func (*Client) CreateMultisig ¶
func (c *Client) CreateMultisig(ctx context.Context, requiredSigs int, addresses []stdaddr.Address) (*types.CreateMultiSigResult, error)
CreateMultisig creates a multisignature address that requires the specified number of signatures for the provided addresses and returns the multisignature address and script needed to redeem it.
func (*Client) CreateNewAccount ¶
CreateNewAccount creates a new wallet account.
func (*Client) DumpPrivKey ¶
DumpPrivKey gets the private key corresponding to the passed address encoded in the wallet import format (WIF).
NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.
func (*Client) FundRawTransaction ¶
func (c *Client) FundRawTransaction(ctx context.Context, rawhex string, fundAccount string, options types.FundRawTransactionOptions) (*types.FundRawTransactionResult, error)
FundRawTransaction adds inputs to a transaction until it has enough in value to meet its out value.
func (*Client) GetAccount ¶
GetAccount returns the account associated with the passed address.
func (*Client) GetAccountAddress ¶
GetAccountAddress returns the current Decred address for receiving payments to the specified account.
func (*Client) GetAddressesByAccount ¶
func (c *Client) GetAddressesByAccount(ctx context.Context, account string) ([]stdaddr.Address, error)
GetAddressesByAccount returns the list of addresses associated with the passed account.
func (*Client) GetBalance ¶
GetBalance returns the available balance from the server for the specified account using the default number of minimum confirmations. The account may be "*" for all accounts.
See GetBalanceMinConf to override the minimum number of confirmations.
func (*Client) GetBalanceMinConf ¶
func (c *Client) GetBalanceMinConf(ctx context.Context, account string, minConfirms int) (*types.GetBalanceResult, error)
GetBalanceMinConf returns the available balance from the server for the specified account using the specified number of minimum confirmations. The account may be "*" for all accounts.
See GetBalance to use the default minimum number of confirmations.
func (*Client) GetInfo ¶
GetInfoWallet calls the getinfo method. It is named differently to avoid a naming clash for dcrd clients with a GetInfo method.
func (*Client) GetMasterPubkey ¶
func (c *Client) GetMasterPubkey(ctx context.Context, account string) (*hdkeychain.ExtendedKey, error)
GetMasterPubkey returns a pointer to the master extended public key for account.
func (*Client) GetNewAddress ¶
GetNewAddress returns a new address.
func (*Client) GetNewAddressGapPolicy ¶
func (c *Client) GetNewAddressGapPolicy(ctx context.Context, account string, gapPolicy GapPolicy) (stdaddr.Address, error)
GetNewAddressGapPolicy returns a new address while allowing callers to control the BIP0044 unused address gap limit policy.
func (*Client) GetRawChangeAddress ¶
func (c *Client) GetRawChangeAddress(ctx context.Context, account string, net stdaddr.AddressParams) (stdaddr.Address, error)
GetRawChangeAddress returns a new address for receiving change that will be associated with the provided account. Note that this is only for raw transactions and NOT for normal use.
func (*Client) GetReceivedByAccount ¶
GetReceivedByAccount returns the total amount received with the specified account with at least the default number of minimum confirmations.
See GetReceivedByAccountMinConf to override the minimum number of confirmations.
func (*Client) GetReceivedByAccountMinConf ¶
func (c *Client) GetReceivedByAccountMinConf(ctx context.Context, account string, minConfirms int) (dcrutil.Amount, error)
GetReceivedByAccountMinConf returns the total amount received with the specified account with at least the specified number of minimum confirmations.
See GetReceivedByAccount to use the default minimum number of confirmations.
func (*Client) GetReceivedByAddress ¶
func (c *Client) GetReceivedByAddress(ctx context.Context, address stdaddr.Address) (dcrutil.Amount, error)
GetReceivedByAddress returns the total amount received by the specified address with at least the default number of minimum confirmations.
See GetReceivedByAddressMinConf to override the minimum number of confirmations.
func (*Client) GetReceivedByAddressMinConf ¶
func (c *Client) GetReceivedByAddressMinConf(ctx context.Context, address stdaddr.Address, minConfirms int) (dcrutil.Amount, error)
GetReceivedByAddressMinConf returns the total amount received by the specified address with at least the specified number of minimum confirmations.
See GetReceivedByAddress to use the default minimum number of confirmations.
func (*Client) GetStakeInfo ¶
GetStakeInfo returns stake mining info from a given wallet. This includes various statistics on tickets it owns and votes it has produced.
func (*Client) GetTickets ¶
GetTickets returns a list of the tickets owned by the wallet, partially or in full. The flag includeImmature is used to indicate if non mature tickets should also be returned.
func (*Client) GetTransaction ¶
func (c *Client) GetTransaction(ctx context.Context, txHash *chainhash.Hash) (*types.GetTransactionResult, error)
GetTransaction returns detailed information about a wallet transaction.
func (*Client) GetUnconfirmedBalance ¶
GetUnconfirmedBalance returns the unconfirmed balance from the server for the specified account.
func (*Client) GetVoteChoices ¶
GetVoteChoices returns the currently-set vote choices for each agenda in the latest supported stake version.
func (*Client) ImportPrivKey ¶
ImportPrivKey imports the passed private key which must be the wallet import format (WIF).
func (*Client) ImportPrivKeyLabel ¶
func (c *Client) ImportPrivKeyLabel(ctx context.Context, privKeyWIF *dcrutil.WIF, label string) error
ImportPrivKeyLabel imports the passed private key which must be the wallet import format (WIF). It sets the account label to the one provided.
func (*Client) ImportPrivKeyRescan ¶
func (c *Client) ImportPrivKeyRescan(ctx context.Context, privKeyWIF *dcrutil.WIF, label string, rescan bool) error
ImportPrivKeyRescan imports the passed private key which must be the wallet import format (WIF). It sets the account label to the one provided. When rescan is true, the block history is scanned for transactions addressed to provided privKey.
func (*Client) ImportPrivKeyRescanFrom ¶
func (c *Client) ImportPrivKeyRescanFrom(ctx context.Context, privKeyWIF *dcrutil.WIF, label string, rescan bool, scanFrom int) error
ImportPrivKeyRescanFrom imports the passed private key which must be the wallet import format (WIF). It sets the account label to the one provided. When rescan is true, the block history from block scanFrom is scanned for transactions addressed to provided privKey.
func (*Client) ImportScript ¶
ImportScript attempts to import a byte code script into wallet.
func (*Client) ImportScriptRescan ¶
ImportScriptRescan attempts to import a byte code script into wallet. It also allows the user to choose whether or not they do a rescan.
func (*Client) ImportScriptRescanFrom ¶
func (c *Client) ImportScriptRescanFrom(ctx context.Context, script []byte, rescan bool, scanFrom int) error
ImportScriptRescanFrom attempts to import a byte code script into wallet. It also allows the user to choose whether or not they do a rescan, and which height to rescan from.
func (*Client) ListAccounts ¶
ListAccounts returns a map of account names and their associated balances using the default number of minimum confirmations.
See ListAccountsMinConf to override the minimum number of confirmations.
func (*Client) ListAccountsMinConf ¶
func (c *Client) ListAccountsMinConf(ctx context.Context, minConfirms int) (map[string]dcrutil.Amount, error)
ListAccountsMinConf returns a map of account names and their associated balances using the specified number of minimum confirmations.
See ListAccounts to use the default minimum number of confirmations.
func (*Client) ListAddressTransactions ¶
func (c *Client) ListAddressTransactions(ctx context.Context, addresses []stdaddr.Address, account string) ([]types.ListTransactionsResult, error)
ListAddressTransactions returns information about all transactions associated with the provided addresses.
func (*Client) ListLockUnspent ¶
ListLockUnspent returns a slice of outpoints for all unspent outputs marked as locked by a wallet. Unspent outputs may be marked locked using LockOutput.
func (*Client) ListReceivedByAccount ¶
func (c *Client) ListReceivedByAccount(ctx context.Context) ([]types.ListReceivedByAccountResult, error)
ListReceivedByAccount lists balances by account using the default number of minimum confirmations and including accounts that haven't received any payments.
See ListReceivedByAccountMinConf to override the minimum number of confirmations and ListReceivedByAccountIncludeEmpty to filter accounts that haven't received any payments from the results.
func (*Client) ListReceivedByAccountIncludeEmpty ¶
func (c *Client) ListReceivedByAccountIncludeEmpty(ctx context.Context, minConfirms int, includeEmpty bool) ([]types.ListReceivedByAccountResult, error)
ListReceivedByAccountIncludeEmpty lists balances by account using the specified number of minimum confirmations and including accounts that haven't received any payments depending on specified flag.
See ListReceivedByAccount and ListReceivedByAccountMinConf to use defaults.
func (*Client) ListReceivedByAccountMinConf ¶
func (c *Client) ListReceivedByAccountMinConf(ctx context.Context, minConfirms int) ([]types.ListReceivedByAccountResult, error)
ListReceivedByAccountMinConf lists balances by account using the specified number of minimum confirmations not including accounts that haven't received any payments.
See ListReceivedByAccount to use the default minimum number of confirmations and ListReceivedByAccountIncludeEmpty to also filter accounts that haven't received any payments from the results.
func (*Client) ListReceivedByAddress ¶
func (c *Client) ListReceivedByAddress(ctx context.Context) ([]types.ListReceivedByAddressResult, error)
ListReceivedByAddress lists balances by address using the default number of minimum confirmations not including addresses that haven't received any payments or watching only addresses.
See ListReceivedByAddressMinConf to override the minimum number of confirmations and ListReceivedByAddressIncludeEmpty to also include addresses that haven't received any payments in the results.
func (*Client) ListReceivedByAddressIncludeEmpty ¶
func (c *Client) ListReceivedByAddressIncludeEmpty(ctx context.Context, minConfirms int, includeEmpty bool) ([]types.ListReceivedByAddressResult, error)
ListReceivedByAddressIncludeEmpty lists balances by address using the specified number of minimum confirmations and including addresses that haven't received any payments depending on specified flag.
See ListReceivedByAddress and ListReceivedByAddressMinConf to use defaults.
func (*Client) ListReceivedByAddressMinConf ¶
func (c *Client) ListReceivedByAddressMinConf(ctx context.Context, minConfirms int) ([]types.ListReceivedByAddressResult, error)
ListReceivedByAddressMinConf lists balances by address using the specified number of minimum confirmations not including addresses that haven't received any payments.
See ListReceivedByAddress to use the default minimum number of confirmations and ListReceivedByAddressIncludeEmpty to also include addresses that haven't received any payments in the results.
func (*Client) ListSinceBlock ¶
func (c *Client) ListSinceBlock(ctx context.Context, blockHash *chainhash.Hash) (*types.ListSinceBlockResult, error)
ListSinceBlock returns all transactions added in blocks since the specified block hash, or all transactions if it is nil, using the default number of minimum confirmations as a filter.
See ListSinceBlockMinConf to override the minimum number of confirmations.
func (*Client) ListSinceBlockMinConf ¶
func (c *Client) ListSinceBlockMinConf(ctx context.Context, blockHash *chainhash.Hash, minConfirms int) (*types.ListSinceBlockResult, error)
ListSinceBlockMinConf returns all transactions added in blocks since the specified block hash, or all transactions if it is nil, using the specified number of minimum confirmations as a filter.
See ListSinceBlock to use the default minimum number of confirmations.
func (*Client) ListTransactions ¶
func (c *Client) ListTransactions(ctx context.Context, account string) ([]types.ListTransactionsResult, error)
ListTransactions returns a list of the most recent transactions.
See the ListTransactionsCount and ListTransactionsCountFrom to control the number of transactions returned and starting point, respectively.
func (*Client) ListTransactionsCount ¶
func (c *Client) ListTransactionsCount(ctx context.Context, account string, count int) ([]types.ListTransactionsResult, error)
ListTransactionsCount returns a list of the most recent transactions up to the passed count.
See the ListTransactions and ListTransactionsCountFrom functions for different options.
func (*Client) ListTransactionsCountFrom ¶
func (c *Client) ListTransactionsCountFrom(ctx context.Context, account string, count, from int) ([]types.ListTransactionsResult, error)
ListTransactionsCountFrom returns a list of the most recent transactions up to the passed count while skipping the first 'from' transactions.
See the ListTransactions and ListTransactionsCount functions to use defaults.
func (*Client) ListUnspent ¶
ListUnspent returns all unspent transaction outputs known to a wallet, using the default number of minimum and maximum number of confirmations as a filter (1 and 9999999, respectively).
func (*Client) ListUnspentMin ¶
func (c *Client) ListUnspentMin(ctx context.Context, minConf int) ([]types.ListUnspentResult, error)
ListUnspentMin returns all unspent transaction outputs known to a wallet, using the specified number of minimum conformations and default number of maximum confirmations (9999999) as a filter.
func (*Client) ListUnspentMinMax ¶
func (c *Client) ListUnspentMinMax(ctx context.Context, minConf, maxConf int) ([]types.ListUnspentResult, error)
ListUnspentMinMax returns all unspent transaction outputs known to a wallet, using the specified number of minimum and maximum number of confirmations as a filter.
func (*Client) ListUnspentMinMaxAddresses ¶
func (c *Client) ListUnspentMinMaxAddresses(ctx context.Context, minConf, maxConf int, addrs []stdaddr.Address) ([]types.ListUnspentResult, error)
ListUnspentMinMaxAddresses returns all unspent transaction outputs that pay to any of specified addresses in a wallet using the specified number of minimum and maximum number of confirmations as a filter.
func (*Client) LockAccount ¶
LockAccount locks an individually-encrypted account. It is an error if the account is not encrypted. It is also an error if the account is already locked, coded by dcrjson.ErrRPCWalletUnlockNeeded.
func (*Client) LockUnspent ¶
LockUnspent marks outputs as locked or unlocked, depending on the value of the unlock bool. When locked, the unspent output will not be selected as input for newly created, non-raw transactions, and will not be returned in future ListUnspent results, until the output is marked unlocked again.
If unlock is false, each outpoint in ops will be marked locked. If unlocked is true and specific outputs are specified in ops (len != 0), exactly those outputs will be marked unlocked. If unlocked is true and no outpoints are specified, all previous locked outputs are marked unlocked.
The locked or unlocked state of outputs are not written to disk and after restarting a wallet process, this data will be reset (every output unlocked).
NOTE: While this method would be a bit more readable if the unlock bool was reversed (that is, LockUnspent(true, ...) locked the outputs), it has been left as unlock to keep compatibility with the reference client API and to avoid confusion for those who are already familiar with the lockunspent RPC.
func (*Client) PurchaseTicket ¶
func (c *Client) PurchaseTicket(ctx context.Context, fromAccount string, spendLimit dcrutil.Amount, minConf *int, ticketAddress stdaddr.Address, numTickets *int, poolAddress stdaddr.Address, poolFees *dcrutil.Amount, expiry *int, ticketChange *bool, ticketFee *dcrutil.Amount) ([]*chainhash.Hash, error)
PurchaseTicket calls the purchaseticket method. Starting with the minConf parameter, a nil parameter indicates the default value for the optional parameter.
func (*Client) RenameAccount ¶
RenameAccount renames an existing wallet account.
func (*Client) RevokeTickets ¶
RevokeTickets triggers the wallet to issue revocations for any missed tickets that have not yet been revoked.
func (*Client) SendFrom ¶
func (c *Client) SendFrom(ctx context.Context, fromAccount string, toAddress stdaddr.Address, amount dcrutil.Amount) (*chainhash.Hash, error)
SendFrom sends the passed amount to the given address using the provided account as a source of funds. Only funds with the default number of minimum confirmations will be used.
See SendFromMinConf for different options.
NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.
func (*Client) SendFromMinConf ¶
func (c *Client) SendFromMinConf(ctx context.Context, fromAccount string, toAddress stdaddr.Address, amount dcrutil.Amount, minConfirms int) (*chainhash.Hash, error)
SendFromMinConf sends the passed amount to the given address using the provided account as a source of funds. Only funds with the passed number of minimum confirmations will be used.
See SendFrom to use the default number of minimum confirmations.
NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.
func (*Client) SendMany ¶
func (c *Client) SendMany(ctx context.Context, fromAccount string, amounts map[stdaddr.Address]dcrutil.Amount) (*chainhash.Hash, error)
SendMany sends multiple amounts to multiple addresses using the provided account as a source of funds in a single transaction. Only funds with the default number of minimum confirmations will be used.
See SendManyMinConf for different options.
NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.
func (*Client) SendManyMinConf ¶
func (c *Client) SendManyMinConf(ctx context.Context, fromAccount string, amounts map[stdaddr.Address]dcrutil.Amount, minConfirms int) (*chainhash.Hash, error)
SendManyMinConf sends multiple amounts to multiple addresses using the provided account as a source of funds in a single transaction. Only funds with the passed number of minimum confirmations will be used.
See SendMany to use the default number of minimum confirmations.
NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.
func (*Client) SendToAddress ¶
func (c *Client) SendToAddress(ctx context.Context, address stdaddr.Address, amount dcrutil.Amount) (*chainhash.Hash, error)
SendToAddress sends the passed amount to the given address.
NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.
func (*Client) SetVoteChoice ¶
SetVoteChoice sets a voting choice preference for an agenda.
func (*Client) SignMessage ¶
func (c *Client) SignMessage(ctx context.Context, address stdaddr.Address, message string) (string, error)
SignMessage signs a message with the private key of the specified address.
NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.
func (*Client) SignRawSSGenTx ¶
SignRawSSGenTx signs inputs for the passed transaction using the the specified signature hash type given the list of information about extra input transactions and a potential list of private keys needed to perform the signing process. The private keys, if specified, must be in wallet import format (WIF).
The only input transactions that need to be specified are ones the RPC server does not already know. This means the list of transaction inputs can be nil if the RPC server already knows them all.
func (*Client) SignRawTransaction ¶
SignRawTransaction signs inputs for the passed transaction and returns the signed transaction as well as whether or not all inputs are now signed.
This function assumes the RPC server already knows the input transactions and private keys for the passed transaction which needs to be signed and uses the default signature hash type. Use one of the SignRawTransaction# variants to specify that information if needed.
If the "errors" field of the response is set, the error return value will be of type SignatureErrors. This does not indicate that no signatures were added, and the partially signed transaction is still returned.
func (*Client) SignRawTransaction2 ¶
func (c *Client) SignRawTransaction2(ctx context.Context, tx *wire.MsgTx, inputs []types.RawTxInput) (*wire.MsgTx, bool, error)
SignRawTransaction2 signs inputs for the passed transaction given the list of information about the input transactions needed to perform the signing process.
This only input transactions that need to be specified are ones the RPC server does not already know. Already known input transactions will be merged with the specified transactions.
See SignRawTransaction if the RPC server already knows the input transactions.
func (*Client) SignRawTransaction3 ¶
func (c *Client) SignRawTransaction3(ctx context.Context, tx *wire.MsgTx, inputs []types.RawTxInput, privKeysWIF []string) (*wire.MsgTx, bool, error)
SignRawTransaction3 signs inputs for the passed transaction given the list of information about extra input transactions and a list of private keys needed to perform the signing process. The private keys must be in wallet import format (WIF).
This only input transactions that need to be specified are ones the RPC server does not already know. Already known input transactions will be merged with the specified transactions. This means the list of transaction inputs can be nil if the RPC server already knows them all.
NOTE: Unlike the merging functionality of the input transactions, ONLY the specified private keys will be used, so even if the server already knows some of the private keys, they will NOT be used.
See SignRawTransaction if the RPC server already knows the input transactions and private keys or SignRawTransaction2 if it already knows the private keys.
func (*Client) SignRawTransaction4 ¶
func (c *Client) SignRawTransaction4(ctx context.Context, tx *wire.MsgTx, inputs []types.RawTxInput, privKeysWIF []string, hashType SigHashType) (*wire.MsgTx, bool, error)
SignRawTransaction4 signs inputs for the passed transaction using the the specified signature hash type given the list of information about extra input transactions and a potential list of private keys needed to perform the signing process. The private keys, if specified, must be in wallet import format (WIF).
The only input transactions that need to be specified are ones the RPC server does not already know. This means the list of transaction inputs can be nil if the RPC server already knows them all.
NOTE: Unlike the merging functionality of the input transactions, ONLY the specified private keys will be used, so even if the server already knows some of the private keys, they will NOT be used. The list of private keys can be nil in which case any private keys the RPC server knows will be used.
This function should only used if a non-default signature hash type is desired. Otherwise, see SignRawTransaction if the RPC server already knows the input transactions and private keys, SignRawTransaction2 if it already knows the private keys, or SignRawTransaction3 if it does not know both.
func (*Client) TicketsForAddress ¶
func (c *Client) TicketsForAddress(ctx context.Context, addr stdaddr.Address) (*dcrdtypes.TicketsForAddressResult, error)
TicketsForAddress returns a list of tickets paying to the passed address. If the daemon server is queried, it returns a search of tickets in the live ticket pool. If the wallet server is queried, it searches all tickets owned by the wallet.
func (*Client) UnlockAccount ¶
UnlockAccount unlocks an individually-encrypted account using the passphrase. It is an error if the account is not encrypted. It is not an error if the account is already unlocked.
func (*Client) ValidateAddress ¶
func (c *Client) ValidateAddress(ctx context.Context, address stdaddr.Address) (*types.ValidateAddressWalletResult, error)
ValidateAddress returns information about the given Decred address.
func (*Client) VerifyMessage ¶
func (c *Client) VerifyMessage(ctx context.Context, address stdaddr.Address, signature, message string) (bool, error)
VerifyMessage verifies a signed message.
NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.
func (*Client) WalletInfo ¶
WalletInfo returns wallet global state info for a given wallet.
func (*Client) WalletLock ¶
WalletLock locks the wallet by removing the encryption key from memory.
After calling this function, the WalletPassphrase function must be used to unlock the wallet prior to calling any other function which requires the wallet to be unlocked.
func (*Client) WalletPassphrase ¶
WalletPassphrase unlocks the wallet by using the passphrase to derive the decryption key which is then stored in memory for the specified timeout (in seconds). A timeout of 0 unlocks the wallet without a time limit.
type GapPolicy ¶
type GapPolicy string
GapPolicy defines the policy to use when the BIP0044 unused address gap limit would be violated by creating a new address.
type RawRequester ¶
type RawRequester interface {
RawRequest(ctx context.Context, method string, params []json.RawMessage) (json.RawMessage, error)
}
RawRequester synchronously performs a JSON-RPC method with positional parameters.
type SigHashType ¶
type SigHashType string
SigHashType enumerates the available signature hashing types that the SignRawTransaction function accepts.
const ( // SigHashAll indicates ALL of the outputs should be signed. SigHashAll SigHashType = "ALL" // SigHashNone indicates NONE of the outputs should be signed. This // can be thought of as specifying the signer does not care where the // bitcoins go. SigHashNone SigHashType = "NONE" // SigHashSingle indicates that a SINGLE output should be signed. This // can be thought of specifying the signer only cares about where ONE of // the outputs goes, but not any of the others. SigHashSingle SigHashType = "SINGLE" // SigHashAllAnyoneCanPay indicates that signer does not care where the // other inputs to the transaction come from, so it allows other people // to add inputs. In addition, it uses the SigHashAll signing method // for outputs. SigHashAllAnyoneCanPay SigHashType = "ALL|ANYONECANPAY" // SigHashNoneAnyoneCanPay indicates that signer does not care where the // other inputs to the transaction come from, so it allows other people // to add inputs. In addition, it uses the SigHashNone signing method // for outputs. SigHashNoneAnyoneCanPay SigHashType = "NONE|ANYONECANPAY" // SigHashSingleAnyoneCanPay indicates that signer does not care where // the other inputs to the transaction come from, so it allows other // people to add inputs. In addition, it uses the SigHashSingle signing // method for outputs. SigHashSingleAnyoneCanPay SigHashType = "SINGLE|ANYONECANPAY" )
Constants used to indicate the signature hash type for SignRawTransaction.
func (SigHashType) String ¶
func (s SigHashType) String() string
String returns the SighHashType in human-readable form.
type SignatureErrors ¶
type SignatureErrors []types.SignRawTransactionError
SignatureErrors implements the error interface for the "errors" field of a signrawtransaction response.
func (SignatureErrors) Error ¶
func (e SignatureErrors) Error() string