From 23ec5ad6e201a05f060b94c939148348ec495111 Mon Sep 17 00:00:00 2001 From: Calvin Kim Date: Thu, 1 Feb 2024 14:58:17 +0900 Subject: [PATCH] btcjson: add support for listbdkutxos --- btcjson/chainsvrcmds.go | 10 ++++++++++ btcjson/chainsvrresults.go | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/btcjson/chainsvrcmds.go b/btcjson/chainsvrcmds.go index 7a78c54d..7cc1888b 100644 --- a/btcjson/chainsvrcmds.go +++ b/btcjson/chainsvrcmds.go @@ -865,6 +865,15 @@ func NewListBDKTransactionsCmd() *ListBDKTransactionsCmd { return &ListBDKTransactionsCmd{} } +// ListBDKUTXOsCmd defines the listbdkutxos JSON-RPC command. +type ListBDKUTXOsCmd struct{} + +// NewListBDKUTXOsCmd returns a new instance which can be used to issue a +// listbdkutxos JSON-RPC command. +func NewListBDKUTXOsCmd() *ListBDKUTXOsCmd { + return &ListBDKUTXOsCmd{} +} + // InvalidateBlockCmd defines the invalidateblock JSON-RPC command. type InvalidateBlockCmd struct { BlockHash string @@ -1304,6 +1313,7 @@ func init() { MustRegisterCmd("getwatchonlybalance", (*GetWatchOnlyBalanceCmd)(nil), flags) MustRegisterCmd("help", (*HelpCmd)(nil), flags) MustRegisterCmd("listbdktransactions", (*ListBDKTransactionsCmd)(nil), flags) + MustRegisterCmd("listbdkutxos", (*ListBDKUTXOsCmd)(nil), flags) MustRegisterCmd("invalidateblock", (*InvalidateBlockCmd)(nil), flags) MustRegisterCmd("peekaddress", (*PeekAddressCmd)(nil), flags) MustRegisterCmd("ping", (*PingCmd)(nil), flags) diff --git a/btcjson/chainsvrresults.go b/btcjson/chainsvrresults.go index 81f2cc2b..dc30867f 100644 --- a/btcjson/chainsvrresults.go +++ b/btcjson/chainsvrresults.go @@ -36,6 +36,17 @@ type ListBDKTransactionsResult struct { Confirmations uint `json:"confirmations"` // number of confirmations for this tx } +// ListBDKUTXOsResult models the data from the listbdkutxos command. +type ListBDKUTXOsResult struct { + Txid string `json:"txid"` + Vout uint `json:"vout"` + Amount int64 `json:"amount"` + ScriptPubKey string `json:"scriptpubkey"` + IsChange bool `json:"ischange"` + DerivationIndex uint `json:"derivationindex"` + Confirmations uint `json:"confirmations"` +} + // GetBlockHeaderVerboseResult models the data from the getblockheader command when // the verbose flag is set. When the verbose flag is not set, getblockheader // returns a hex-encoded string.