diff --git a/rpcclient/wallet.go b/rpcclient/wallet.go index e92d1aab..37bf9471 100644 --- a/rpcclient/wallet.go +++ b/rpcclient/wallet.go @@ -20,7 +20,8 @@ import ( // ***************************** // FutureGetTransactionResult is a future promise to deliver the result -// of a GetTransactionAsync RPC invocation (or an applicable error). +// of a GetTransactionAsync or GetTransactionWatchOnlyAsync RPC invocation +// (or an applicable error). type FutureGetTransactionResult chan *response // Receive waits for the response promised by the future and returns detailed @@ -63,6 +64,28 @@ func (c *Client) GetTransaction(txHash *chainhash.Hash) (*btcjson.GetTransaction return c.GetTransactionAsync(txHash).Receive() } +// GetTransactionWatchOnlyAsync 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 GetTransactionWatchOnly for the blocking version and more details. +func (c *Client) GetTransactionWatchOnlyAsync(txHash *chainhash.Hash, watchOnly bool) FutureGetTransactionResult { + hash := "" + if txHash != nil { + hash = txHash.String() + } + + cmd := btcjson.NewGetTransactionCmd(hash, &watchOnly) + return c.sendCmd(cmd) +} + +// GetTransactionWatchOnly returns detailed information about a wallet +// transaction, and allow including watch-only addresses in balance +// calculation and details. +func (c *Client) GetTransactionWatchOnly(txHash *chainhash.Hash, watchOnly bool) (*btcjson.GetTransactionResult, error) { + return c.GetTransactionWatchOnlyAsync(txHash, watchOnly).Receive() +} + // FutureListTransactionsResult is a future promise to deliver the result of a // ListTransactionsAsync, ListTransactionsCountAsync, or // ListTransactionsCountFromAsync RPC invocation (or an applicable error).