Documentation ¶
Index ¶
- Variables
- func DisableLog()
- func NewFutureError(err error) chan *Response
- func ReceiveFuture(f chan *Response) ([]byte, error)
- func UseLogger(logger btclog.Logger)
- type BitcoindVersion
- type BtcdVersion
- type BulkResult
- type Client
- func (c *Client) Disconnect()
- func (c *Client) Disconnected() bool
- func (c *Client) LoadTxFilter(reload bool, addresses []btcutil.Address, outPoints []wire.OutPoint) error
- func (c *Client) LoadTxFilterAsync(reload bool, addresses []btcutil.Address, outPoints []wire.OutPoint) FutureLoadTxFilterResult
- func (c *Client) NextID() uint64
- func (c *Client) NotifyBlocks() error
- func (c *Client) NotifyBlocksAsync() FutureNotifyBlocksResult
- func (c *Client) NotifyNewTransactions(verbose bool) error
- func (c *Client) NotifyNewTransactionsAsync(verbose bool) FutureNotifyNewTransactionsResult
- func (c *Client) NotifyReceived(addresses []btcutil.Address) errordeprecated
- func (c *Client) NotifyReceivedAsync(addresses []btcutil.Address) FutureNotifyReceivedResultdeprecated
- func (c *Client) NotifySpent(outpoints []*wire.OutPoint) errordeprecated
- func (c *Client) NotifySpentAsync(outpoints []*wire.OutPoint) FutureNotifySpentResultdeprecated
- func (c *Client) Rescan(startBlock *chainhash.Hash, addresses []btcutil.Address, ...) errordeprecated
- func (c *Client) RescanAsync(startBlock *chainhash.Hash, addresses []btcutil.Address, ...) FutureRescanResultdeprecated
- func (c *Client) RescanEndBlockAsync(startBlock *chainhash.Hash, addresses []btcutil.Address, ...) FutureRescanResultdeprecated
- func (c *Client) RescanEndHeight(startBlock *chainhash.Hash, addresses []btcutil.Address, ...) errordeprecated
- func (c *Client) SendCmd(cmd interface{}) chan *Response
- type FutureGetBulkResult
- type FutureLoadTxFilterResult
- type FutureNotifyBlocksResult
- type FutureNotifyNewTransactionsResult
- type FutureNotifyReceivedResultdeprecated
- type FutureNotifySpentResultdeprecated
- type FutureRescanResultdeprecated
- type IndividualBulkResult
- type NodeVersion
- type NotificationHandlers
- type RemoteWallet
- type Response
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidAuth is an error to describe the condition where the client // is either unable to authenticate or the specified endpoint is // incorrect. ErrInvalidAuth = errors.New("authentication failure") // ErrInvalidEndpoint is an error to describe the condition where the // websocket handshake failed with the specified endpoint. ErrInvalidEndpoint = errors.New("the endpoint either does not support " + "websockets or does not exist") // ErrClientNotConnected is an error to describe the condition where a // websocket client has been created, but the connection was never // established. This condition differs from ErrClientDisconnect, which // represents an established connection that was lost. ErrClientNotConnected = errors.New("the client was never connected") // ErrClientDisconnect is an error to describe the condition where the // client has been disconnected from the RPC server. When the // DisableAutoReconnect option is not set, any outstanding futures // when a client disconnect occurs will return this error as will // any new requests. ErrClientDisconnect = errors.New("the client has been disconnected") // ErrClientShutdown is an error to describe the condition where the // client is either already shutdown, or in the process of shutting // down. Any outstanding futures when a client shutdown occurs will // return this error as will any new requests. ErrClientShutdown = errors.New("the client has been shutdown") // ErrNotWebsocketClient is an error to describe the condition of // calling a Client method intended for a websocket client when the // client has been configured to run in HTTP POST mode instead. ErrNotWebsocketClient = errors.New("client is not configured for " + "websockets") // ErrClientAlreadyConnected is an error to describe the condition where // a new client connection cannot be established due to a websocket // client having already connected to the RPC server. ErrClientAlreadyConnected = errors.New("websocket client has already " + "connected") )
var ( // ErrWebsocketsRequired is an error to describe the condition where the // caller is trying to use a websocket-only feature, such as requesting // notifications or other websocket requests when the client is // configured to run in HTTP POST mode. ErrWebsocketsRequired = errors.New("a websocket connection is required " + "to use this feature") )
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.
func NewFutureError ¶
Expose newFutureError for developer usage when creating custom commands.
func ReceiveFuture ¶
ReceiveFuture receives from the passed futureResult channel to extract a reply or any errors. The examined errors include an error in the futureResult and the error in the reply from the server. This will block until the result is available on the passed channel.
Types ¶
type BitcoindVersion ¶
type BitcoindVersion uint8
BitcoindVersion represents the version of the bitcoind the client is currently connected to.
const ( // BitcoindPre19 represents a bitcoind version before 0.19.0. BitcoindPre19 BitcoindVersion = iota // BitcoindPre22 represents a bitcoind version equal to or greater than // 0.19.0 and smaller than 22.0.0. BitcoindPre22 // BitcoindPre24 represents a bitcoind version equal to or greater than // 22.0.0 and smaller than 24.0.0. BitcoindPre24 // BitcoindPre25 represents a bitcoind version equal to or greater than // 24.0.0 and smaller than 25.0.0. BitcoindPre25 // BitcoindPre25 represents a bitcoind version equal to or greater than // 25.0.0. BitcoindPost25 )
func (BitcoindVersion) String ¶
func (b BitcoindVersion) String() string
String returns a human-readable backend version.
func (BitcoindVersion) SupportGetTxSpendingPrevOut ¶
func (b BitcoindVersion) SupportGetTxSpendingPrevOut() bool
SupportGetTxSpendingPrevOut returns true if bitcoind version is 24.0.0 or above.
func (BitcoindVersion) SupportTestMempoolAccept ¶
func (b BitcoindVersion) SupportTestMempoolAccept() bool
SupportTestMempoolAccept returns true if bitcoind version is 22.0.0 or above.
func (BitcoindVersion) SupportUnifiedSoftForks ¶
func (b BitcoindVersion) SupportUnifiedSoftForks() bool
SupportUnifiedSoftForks returns true if the backend supports the unified softforks format.
type BtcdVersion ¶
type BtcdVersion int32
BtcdVersion represents the version of the btcd the client is currently connected to.
const ( // BtcdPre2401 describes a btcd version before 0.24.1, which doesn't // include the `testmempoolaccept` and `gettxspendingprevout` RPCs. BtcdPre2401 BtcdVersion = iota // BtcdPost2401 describes a btcd version equal to or greater than // 0.24.1. BtcdPost2401 )
func (BtcdVersion) String ¶
func (b BtcdVersion) String() string
String returns a human-readable backend version.
func (BtcdVersion) SupportGetTxSpendingPrevOut ¶
func (b BtcdVersion) SupportGetTxSpendingPrevOut() bool
SupportGetTxSpendingPrevOut returns true if btcd version is 24.1.0 or above.
func (BtcdVersion) SupportTestMempoolAccept ¶
func (b BtcdVersion) SupportTestMempoolAccept() bool
SupportTestMempoolAccept returns true if btcd version is 24.1.0 or above.
func (BtcdVersion) SupportUnifiedSoftForks ¶
func (b BtcdVersion) SupportUnifiedSoftForks() bool
SupportUnifiedSoftForks returns true if the backend supports the unified softforks format.
NOTE: always true for btcd as we didn't track it before.
type BulkResult ¶
type BulkResult = map[uint64]IndividualBulkResult
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
handles the conversion of request/response types to the underlying JSON types expected by the wallet server.
func New ¶
func New(config *wallet.Config, ntfnHandlers *NotificationHandlers) (*Client, error)
New creates RPC client based on the config nofification handlers param can be nil if you don't want to handle notifications or, running in HTTP POST mode (only?)
func (*Client) Disconnect ¶
func (c *Client) Disconnect()
NOTE this function has no effect when the client is running in HTTP POST mode.
func (*Client) Disconnected ¶
Disconnected returns whether or not the client is currently disconnected. If a websocket client was created but never connected, this also returns false.
func (*Client) LoadTxFilter ¶
func (c *Client) LoadTxFilter(reload bool, addresses []btcutil.Address, outPoints []wire.OutPoint) error
LoadTxFilter loads, reloads, or adds data to a websocket client's transaction filter. The filter is consistently updated based on inspected transactions during mempool acceptance, block acceptance, and for all rescanned blocks.
NOTE: This is a btcd extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.
func (*Client) LoadTxFilterAsync ¶
func (c *Client) LoadTxFilterAsync(reload bool, addresses []btcutil.Address, outPoints []wire.OutPoint) FutureLoadTxFilterResult
LoadTxFilterAsync 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 LoadTxFilter for the blocking version and more details.
NOTE: This is a btcd extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.
func (*Client) NextID ¶
NOTE allow this is normally not needed by a consumer of this client application, if a custom request is being created and used this function should be used to ensure the ID is unique.
func (*Client) NotifyBlocks ¶
NotifyBlocks registers the client to receive notifications when blocks are connected and disconnected from the main chain. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.
The notifications delivered as a result of this call will be via one of OnBlockConnected or OnBlockDisconnected.
NOTE: This is a btcd extension and requires a websocket connection.
func (*Client) NotifyBlocksAsync ¶
func (c *Client) NotifyBlocksAsync() FutureNotifyBlocksResult
NotifyBlocksAsync 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 NotifyBlocks for the blocking version and more details.
NOTE: This is a btcd extension and requires a websocket connection.
func (*Client) NotifyNewTransactions ¶
NotifyNewTransactions registers the client to receive notifications every time a new transaction is accepted to the memory pool. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.
The notifications delivered as a result of this call will be via one of OnTxAccepted (when verbose is false) or OnTxAcceptedVerbose (when verbose is true).
NOTE: This is a btcd extension and requires a websocket connection.
func (*Client) NotifyNewTransactionsAsync ¶
func (c *Client) NotifyNewTransactionsAsync(verbose bool) FutureNotifyNewTransactionsResult
NotifyNewTransactionsAsync 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 NotifyNewTransactionsAsync for the blocking version and more details.
NOTE: This is a btcd extension and requires a websocket connection.
func (*Client) NotifyReceived
deprecated
NotifyReceived registers the client to receive notifications every time a new transaction which pays to one of the passed addresses is accepted to memory pool or in a block connected to the block chain. In addition, when one of these transactions is detected, the client is also automatically registered for notifications when the new transaction outpoints the address now has available are spent (See NotifySpent). The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.
The notifications delivered as a result of this call will be via one of *OnRecvTx (for transactions that receive funds to one of the passed addresses) or OnRedeemingTx (for transactions which spend from one of the outpoints which are automatically registered upon receipt of funds to the address).
NOTE: This is a btcd extension and requires a websocket connection.
Deprecated: Use LoadTxFilter instead.
func (*Client) NotifyReceivedAsync
deprecated
func (c *Client) NotifyReceivedAsync(addresses []btcutil.Address) FutureNotifyReceivedResult
NotifyReceivedAsync 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 NotifyReceived for the blocking version and more details.
NOTE: This is a btcd extension and requires a websocket connection.
Deprecated: Use LoadTxFilterAsync instead.
func (*Client) NotifySpent
deprecated
NotifySpent registers the client to receive notifications when the passed transaction outputs are spent. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.
The notifications delivered as a result of this call will be via OnRedeemingTx.
NOTE: This is a btcd extension and requires a websocket connection.
Deprecated: Use LoadTxFilter instead.
func (*Client) NotifySpentAsync
deprecated
func (c *Client) NotifySpentAsync(outpoints []*wire.OutPoint) FutureNotifySpentResult
NotifySpentAsync 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 NotifySpent for the blocking version and more details.
NOTE: This is a btcd extension and requires a websocket connection.
Deprecated: Use LoadTxFilterAsync instead.
func (*Client) Rescan
deprecated
func (c *Client) Rescan(startBlock *chainhash.Hash, addresses []btcutil.Address, outpoints []*wire.OutPoint) error
Rescan rescans the block chain starting from the provided starting block to the end of the longest chain for transactions that pay to the passed addresses and transactions which spend the passed outpoints.
The notifications of found transactions are delivered to the notification handlers associated with client and this call will not return until the rescan has completed. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.
The notifications delivered as a result of this call will be via one of OnRedeemingTx (for transactions which spend from the one of the passed outpoints), OnRecvTx (for transactions that receive funds to one of the passed addresses), and OnRescanProgress (for rescan progress updates).
See RescanEndBlock to also specify an ending block to finish the rescan without continuing through the best block on the main chain.
NOTE: Rescan requests are not issued on client reconnect and must be performed manually (ideally with a new start height based on the last rescan progress notification). See the OnClientConnected notification callback for a good callsite to reissue rescan requests on connect and reconnect.
NOTE: This is a btcd extension and requires a websocket connection.
Deprecated: Use RescanBlocks instead.
func (*Client) RescanAsync
deprecated
func (c *Client) RescanAsync(startBlock *chainhash.Hash, addresses []btcutil.Address, outpoints []*wire.OutPoint) FutureRescanResult
RescanAsync 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 Rescan for the blocking version and more details.
NOTE: Rescan requests are not issued on client reconnect and must be performed manually (ideally with a new start height based on the last rescan progress notification). See the OnClientConnected notification callback for a good callsite to reissue rescan requests on connect and reconnect.
NOTE: This is a btcd extension and requires a websocket connection.
Deprecated: Use RescanBlocksAsync instead.
func (*Client) RescanEndBlockAsync
deprecated
func (c *Client) RescanEndBlockAsync(startBlock *chainhash.Hash, addresses []btcutil.Address, outpoints []*wire.OutPoint, endBlock *chainhash.Hash) FutureRescanResult
RescanEndBlockAsync 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 RescanEndBlock for the blocking version and more details.
NOTE: This is a btcd extension and requires a websocket connection.
Deprecated: Use RescanBlocksAsync instead.
func (*Client) RescanEndHeight
deprecated
func (c *Client) RescanEndHeight(startBlock *chainhash.Hash, addresses []btcutil.Address, outpoints []*wire.OutPoint, endBlock *chainhash.Hash) error
RescanEndHeight rescans the block chain starting from the provided starting block up to the provided ending block for transactions that pay to the passed addresses and transactions which spend the passed outpoints.
The notifications of found transactions are delivered to the notification handlers associated with client and this call will not return until the rescan has completed. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.
The notifications delivered as a result of this call will be via one of OnRedeemingTx (for transactions which spend from the one of the passed outpoints), OnRecvTx (for transactions that receive funds to one of the passed addresses), and OnRescanProgress (for rescan progress updates).
See Rescan to also perform a rescan through current end of the longest chain.
NOTE: This is a btcd extension and requires a websocket connection.
Deprecated: Use RescanBlocks instead.
type FutureGetBulkResult ¶
type FutureGetBulkResult chan *Response
FutureGetBulkResult waits for the responses promised by the future and returns them in a channel
func (FutureGetBulkResult) Receive ¶
func (r FutureGetBulkResult) Receive() (BulkResult, error)
Receive waits for the response promised by the future and returns an map of results by request id
type FutureLoadTxFilterResult ¶
type FutureLoadTxFilterResult chan *Response
FutureLoadTxFilterResult is a future promise to deliver the result of a LoadTxFilterAsync RPC invocation (or an applicable error).
NOTE: This is a btcd extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.
func (FutureLoadTxFilterResult) Receive ¶
func (r FutureLoadTxFilterResult) Receive() error
Receive waits for the Response promised by the future and returns an error if the registration was not successful.
NOTE: This is a btcd extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.
type FutureNotifyBlocksResult ¶
type FutureNotifyBlocksResult chan *Response
FutureNotifyBlocksResult is a future promise to deliver the result of a NotifyBlocksAsync RPC invocation (or an applicable error).
func (FutureNotifyBlocksResult) Receive ¶
func (r FutureNotifyBlocksResult) Receive() error
Receive waits for the Response promised by the future and returns an error if the registration was not successful.
type FutureNotifyNewTransactionsResult ¶
type FutureNotifyNewTransactionsResult chan *Response
FutureNotifyNewTransactionsResult is a future promise to deliver the result of a NotifyNewTransactionsAsync RPC invocation (or an applicable error).
func (FutureNotifyNewTransactionsResult) Receive ¶
func (r FutureNotifyNewTransactionsResult) Receive() error
Receive waits for the Response promised by the future and returns an error if the registration was not successful.
type FutureNotifyReceivedResult
deprecated
type FutureNotifyReceivedResult chan *Response
FutureNotifyReceivedResult is a future promise to deliver the result of a NotifyReceivedAsync RPC invocation (or an applicable error).
Deprecated: Use FutureLoadTxFilterResult instead.
func (FutureNotifyReceivedResult) Receive ¶
func (r FutureNotifyReceivedResult) Receive() error
Receive waits for the Response promised by the future and returns an error if the registration was not successful.
type FutureNotifySpentResult
deprecated
type FutureNotifySpentResult chan *Response
FutureNotifySpentResult is a future promise to deliver the result of a NotifySpentAsync RPC invocation (or an applicable error).
Deprecated: Use FutureLoadTxFilterResult instead.
func (FutureNotifySpentResult) Receive ¶
func (r FutureNotifySpentResult) Receive() error
Receive waits for the Response promised by the future and returns an error if the registration was not successful.
type FutureRescanResult
deprecated
type FutureRescanResult chan *Response
FutureRescanResult is a future promise to deliver the result of a RescanAsync or RescanEndHeightAsync RPC invocation (or an applicable error).
Deprecated: Use FutureRescanBlocksResult instead.
func (FutureRescanResult) Receive ¶
func (r FutureRescanResult) Receive() error
Receive waits for the Response promised by the future and returns an error if the rescan was not successful.
type IndividualBulkResult ¶
type IndividualBulkResult struct { Result interface{} `json:"result"` Error *btcjson.RPCError `json:"error"` Id uint64 `json:"id"` }
IndividualBulkResult represents one result from a bulk json rpc api
type NodeVersion ¶
type NodeVersion interface { // String returns a human-readable backend version. String() string // SupportUnifiedSoftForks returns true if the backend supports the // unified softforks format. SupportUnifiedSoftForks() bool // SupportTestMempoolAccept returns true if the backend supports the // testmempoolaccept RPC. SupportTestMempoolAccept() bool // SupportGetTxSpendingPrevOut returns true if the backend supports the // gettxspendingprevout RPC. SupportGetTxSpendingPrevOut() bool }
type NotificationHandlers ¶
type NotificationHandlers struct { // OnClientConnected is invoked when the client connects or reconnects // to the RPC server. This callback is run async with the rest of the // notification handlers, and is safe for blocking client requests. OnClientConnected func() // OnBlockConnected is invoked when a block is connected to the longest // (best) chain. It will only be invoked if a preceding call to // NotifyBlocks has been made to register for the notification and the // function is non-nil. // // Deprecated: Use OnFilteredBlockConnected instead. OnBlockConnected func(hash *chainhash.Hash, height int32, t time.Time) // OnFilteredBlockConnected is invoked when a block is connected to the // longest (best) chain. It will only be invoked if a preceding call to // NotifyBlocks has been made to register for the notification and the // function is non-nil. Its parameters differ from OnBlockConnected: it // receives the block's height, header, and relevant transactions. OnFilteredBlockConnected func(height int32, header *wire.BlockHeader, txs []*btcutil.Tx) // OnBlockDisconnected is invoked when a block is disconnected from the // longest (best) chain. It will only be invoked if a preceding call to // NotifyBlocks has been made to register for the notification and the // function is non-nil. // // Deprecated: Use OnFilteredBlockDisconnected instead. OnBlockDisconnected func(hash *chainhash.Hash, height int32, t time.Time) // OnFilteredBlockDisconnected is invoked when a block is disconnected // from the longest (best) chain. It will only be invoked if a // preceding NotifyBlocks has been made to register for the notification // and the call to function is non-nil. Its parameters differ from // OnBlockDisconnected: it receives the block's height and header. OnFilteredBlockDisconnected func(height int32, header *wire.BlockHeader) // OnRecvTx is invoked when a transaction that receives funds to a // registered address is received into the memory pool and also // connected to the longest (best) chain. It will only be invoked if a // preceding call to NotifyReceived, Rescan, or RescanEndHeight has been // made to register for the notification and the function is non-nil. // // Deprecated: Use OnRelevantTxAccepted instead. OnRecvTx func(transaction *btcutil.Tx, details *btcjson.BlockDetails) // OnRedeemingTx is invoked when a transaction that spends a registered // outpoint is received into the memory pool and also connected to the // longest (best) chain. It will only be invoked if a preceding call to // NotifySpent, Rescan, or RescanEndHeight has been made to register for // the notification and the function is non-nil. // // NOTE: The NotifyReceived will automatically register notifications // for the outpoints that are now "owned" as a result of receiving // funds to the registered addresses. This means it is possible for // this to invoked indirectly as the result of a NotifyReceived call. // // Deprecated: Use OnRelevantTxAccepted instead. OnRedeemingTx func(transaction *btcutil.Tx, details *btcjson.BlockDetails) // OnRelevantTxAccepted is invoked when an unmined transaction passes // the client's transaction filter. // // NOTE: This is a btcsuite extension ported from // github.com/decred/dcrrpcclient. OnRelevantTxAccepted func(transaction []byte) // OnRescanFinished is invoked after a rescan finishes due to a previous // call to Rescan or RescanEndHeight. Finished rescans should be // signaled on this notification, rather than relying on the return // result of a rescan request, due to how btcd may send various rescan // notifications after the rescan request has already returned. // // Deprecated: Not used with RescanBlocks. OnRescanFinished func(hash *chainhash.Hash, height int32, blkTime time.Time) // OnRescanProgress is invoked periodically when a rescan is underway. // It will only be invoked if a preceding call to Rescan or // RescanEndHeight has been made and the function is non-nil. // // Deprecated: Not used with RescanBlocks. OnRescanProgress func(hash *chainhash.Hash, height int32, blkTime time.Time) // OnTxAccepted is invoked when a transaction is accepted into the // memory pool. It will only be invoked if a preceding call to // NotifyNewTransactions with the verbose flag set to false has been // made to register for the notification and the function is non-nil. OnTxAccepted func(hash *chainhash.Hash, amount btcutil.Amount) // OnTxAccepted is invoked when a transaction is accepted into the // memory pool. It will only be invoked if a preceding call to // NotifyNewTransactions with the verbose flag set to true has been // made to register for the notification and the function is non-nil. OnTxAcceptedVerbose func(txDetails *btcjson.TxRawResult) // OnBtcdConnected is invoked when a wallet connects or disconnects from // btcd. // // This will only be available when client is connected to a wallet // server such as btcwallet. OnBtcdConnected func(connected bool) // OnAccountBalance is invoked with account balance updates. // // This will only be available when speaking to a wallet server // such as btcwallet. OnAccountBalance func(account string, balance btcutil.Amount, confirmed bool) // OnWalletLockState is invoked when a wallet is locked or unlocked. // // This will only be available when client is connected to a wallet // server such as btcwallet. OnWalletLockState func(locked bool) // OnUnknownNotification is invoked when an unrecognized notification // is received. This typically means the notification handling code // for this package needs to be updated for a new notification type or // the caller is using a custom notification this package does not know // about. OnUnknownNotification func(method string, params []json.RawMessage) }
NotificationHandlers defines callback function pointers to invoke with notifications. Since all of the functions are nil by default, all notifications are effectively ignored until their handlers are set to a concrete callback.
NOTE: Unless otherwise documented, these handlers must NOT directly call any blocking calls on the client instance since the input reader goroutine blocks until the callback has completed. Doing so will result in a deadlock situation.
type RemoteWallet ¶
type RemoteWallet struct { Config *walletclient.Config // the BtcWallet RPC Client RpcClient *Client }
WalletClient struct client for the JSON-RPC BtcWallet API
func NewRemoteWallet ¶
func NewRemoteWallet(config *walletclient.Config) *RemoteWallet
Create new WalletClient instance