From ba3fe57507ba8af1c9887932a19841d7ab373bf3 Mon Sep 17 00:00:00 2001 From: Anirudha Bose Date: Tue, 8 Sep 2020 15:43:02 +0200 Subject: [PATCH] rpcclient: support listtransactions RPC with watchonly argument Co-authored-by: Gert-Jaap Glasbergen --- rpcclient/wallet.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rpcclient/wallet.go b/rpcclient/wallet.go index d4069aad..4f263f10 100644 --- a/rpcclient/wallet.go +++ b/rpcclient/wallet.go @@ -164,6 +164,25 @@ func (c *Client) ListTransactionsCountFrom(account string, count, from int) ([]b return c.ListTransactionsCountFromAsync(account, count, from).Receive() } +// ListTransactionsCountFromWatchOnlyAsync 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 ListTransactionsCountFromWatchOnly for the blocking version and more details. +func (c *Client) ListTransactionsCountFromWatchOnlyAsync(account string, count, from int, watchOnly bool) FutureListTransactionsResult { + cmd := btcjson.NewListTransactionsCmd(&account, &count, &from, &watchOnly) + return c.sendCmd(cmd) +} + +// ListTransactionsCountFromWatchOnly returns a list of the most recent transactions up +// to the passed count while skipping the first 'from' transactions. It will include or +// exclude transactions from watch-only addresses based on the passed value for the watchOnly parameter +// +// See the ListTransactions and ListTransactionsCount functions to use defaults. +func (c *Client) ListTransactionsCountFromWatchOnly(account string, count, from int, watchOnly bool) ([]btcjson.ListTransactionsResult, error) { + return c.ListTransactionsCountFromWatchOnlyAsync(account, count, from, watchOnly).Receive() +} + // FutureListUnspentResult is a future promise to deliver the result of a // ListUnspentAsync, ListUnspentMinAsync, ListUnspentMinMaxAsync, or // ListUnspentMinMaxAddressesAsync RPC invocation (or an applicable error).