mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-08-23 17:47:24 +00:00
rpcclient: Add GetTransactionWatchOnly method
This commit is contained in:
parent
7b2ff5d180
commit
e2d9cf4b55
1 changed files with 24 additions and 1 deletions
|
@ -20,7 +20,8 @@ import (
|
||||||
// *****************************
|
// *****************************
|
||||||
|
|
||||||
// FutureGetTransactionResult is a future promise to deliver the result
|
// 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
|
type FutureGetTransactionResult chan *response
|
||||||
|
|
||||||
// Receive waits for the response promised by the future and returns detailed
|
// 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()
|
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
|
// FutureListTransactionsResult is a future promise to deliver the result of a
|
||||||
// ListTransactionsAsync, ListTransactionsCountAsync, or
|
// ListTransactionsAsync, ListTransactionsCountAsync, or
|
||||||
// ListTransactionsCountFromAsync RPC invocation (or an applicable error).
|
// ListTransactionsCountFromAsync RPC invocation (or an applicable error).
|
||||||
|
|
Loading…
Add table
Reference in a new issue