From 0fe8f1b0f2f8b9facb9b8ac69179748f777440fd Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Tue, 26 Aug 2025 13:49:19 +0100 Subject: [PATCH 1/4] Test getzmqnotifications The RPC struct exists but there is no client macro or test. The return changes in v18 and then stays the same up to v29. Add an updated struct for v18. Add the client macro, test and update the types table. --- client/src/client_sync/v17/mod.rs | 4 ++++ client/src/client_sync/v17/zmq.rs | 15 +++++++++++++++ client/src/client_sync/v18/mod.rs | 3 +++ client/src/client_sync/v19/mod.rs | 3 +++ client/src/client_sync/v20/mod.rs | 3 +++ client/src/client_sync/v21/mod.rs | 3 +++ client/src/client_sync/v22/mod.rs | 3 +++ client/src/client_sync/v23/mod.rs | 3 +++ client/src/client_sync/v24/mod.rs | 3 +++ client/src/client_sync/v25/mod.rs | 3 +++ client/src/client_sync/v26/mod.rs | 3 +++ client/src/client_sync/v27/mod.rs | 3 +++ client/src/client_sync/v28/mod.rs | 3 +++ client/src/client_sync/v29/mod.rs | 3 +++ integration_test/tests/zmq.rs | 22 ++++++++++++++++++++++ types/src/v17/mod.rs | 2 +- types/src/v18/mod.rs | 6 ++++-- types/src/v18/zmq.rs | 24 ++++++++++++++++++++++++ types/src/v19/mod.rs | 6 +++--- types/src/v20/mod.rs | 6 +++--- types/src/v21/mod.rs | 6 +++--- types/src/v22/mod.rs | 6 +++--- types/src/v23/mod.rs | 6 +++--- types/src/v24/mod.rs | 6 +++--- types/src/v25/mod.rs | 6 +++--- types/src/v26/mod.rs | 6 +++--- types/src/v27/mod.rs | 6 +++--- types/src/v28/mod.rs | 6 +++--- types/src/v29/mod.rs | 6 +++--- 29 files changed, 139 insertions(+), 36 deletions(-) create mode 100644 client/src/client_sync/v17/zmq.rs create mode 100644 integration_test/tests/zmq.rs create mode 100644 types/src/v18/zmq.rs diff --git a/client/src/client_sync/v17/mod.rs b/client/src/client_sync/v17/mod.rs index 240f14f0..58215d5c 100644 --- a/client/src/client_sync/v17/mod.rs +++ b/client/src/client_sync/v17/mod.rs @@ -12,6 +12,7 @@ pub mod network; pub mod raw_transactions; pub mod util; pub mod wallet; +pub mod zmq; use std::collections::{BTreeMap, HashMap}; use std::path::Path; @@ -159,6 +160,9 @@ crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); + /// Argument to the `Client::get_new_address_with_type` function. /// /// For Core versions 0.17 through to v22. For Core v23 and onwards use `v23::AddressType`. diff --git a/client/src/client_sync/v17/zmq.rs b/client/src/client_sync/v17/zmq.rs new file mode 100644 index 00000000..60125dfd --- /dev/null +++ b/client/src/client_sync/v17/zmq.rs @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: CC0-1.0 + +//! Macros for implementing JSON-RPC methods for the `== Zmq ==` section (v0.17). + +/// Implements Bitcoin Core JSON-RPC API method `getzmqnotifications`. +#[macro_export] +macro_rules! impl_client_v17__get_zmq_notifications { + () => { + impl Client { + pub fn get_zmq_notifications(&self) -> Result> { + self.call("getzmqnotifications", &[]) + } + } + }; +} diff --git a/client/src/client_sync/v18/mod.rs b/client/src/client_sync/v18/mod.rs index b5ad837f..7a806ccd 100644 --- a/client/src/client_sync/v18/mod.rs +++ b/client/src/client_sync/v18/mod.rs @@ -175,3 +175,6 @@ crate::impl_client_v17__wallet_lock!(); crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); + +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); diff --git a/client/src/client_sync/v19/mod.rs b/client/src/client_sync/v19/mod.rs index 153ea3f8..7cf1d16e 100644 --- a/client/src/client_sync/v19/mod.rs +++ b/client/src/client_sync/v19/mod.rs @@ -172,3 +172,6 @@ crate::impl_client_v17__wallet_lock!(); crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); + +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); diff --git a/client/src/client_sync/v20/mod.rs b/client/src/client_sync/v20/mod.rs index 1e2bd38e..21424320 100644 --- a/client/src/client_sync/v20/mod.rs +++ b/client/src/client_sync/v20/mod.rs @@ -172,3 +172,6 @@ crate::impl_client_v17__wallet_lock!(); crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); + +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); diff --git a/client/src/client_sync/v21/mod.rs b/client/src/client_sync/v21/mod.rs index 9f54068b..c6ddf9f2 100644 --- a/client/src/client_sync/v21/mod.rs +++ b/client/src/client_sync/v21/mod.rs @@ -186,6 +186,9 @@ crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); + /// Request object for the `importdescriptors` method. #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] #[serde(deny_unknown_fields)] diff --git a/client/src/client_sync/v22/mod.rs b/client/src/client_sync/v22/mod.rs index bfa0c1e0..d65eeeb1 100644 --- a/client/src/client_sync/v22/mod.rs +++ b/client/src/client_sync/v22/mod.rs @@ -188,3 +188,6 @@ crate::impl_client_v17__wallet_lock!(); crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); + +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); diff --git a/client/src/client_sync/v23/mod.rs b/client/src/client_sync/v23/mod.rs index 96272f7f..c0230fb4 100644 --- a/client/src/client_sync/v23/mod.rs +++ b/client/src/client_sync/v23/mod.rs @@ -194,6 +194,9 @@ crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); + /// Argument to the `Client::get_new_address_with_type` function. /// /// For Core v23 and onwards. For earlier versions use `v17::AddressType`. diff --git a/client/src/client_sync/v24/mod.rs b/client/src/client_sync/v24/mod.rs index ed063ec8..b629c6f9 100644 --- a/client/src/client_sync/v24/mod.rs +++ b/client/src/client_sync/v24/mod.rs @@ -197,3 +197,6 @@ crate::impl_client_v17__wallet_lock!(); crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); + +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); diff --git a/client/src/client_sync/v25/mod.rs b/client/src/client_sync/v25/mod.rs index 0eb9c5b6..f25658b4 100644 --- a/client/src/client_sync/v25/mod.rs +++ b/client/src/client_sync/v25/mod.rs @@ -198,3 +198,6 @@ crate::impl_client_v17__wallet_lock!(); crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); + +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); diff --git a/client/src/client_sync/v26/mod.rs b/client/src/client_sync/v26/mod.rs index bae0cb3c..da68a44d 100644 --- a/client/src/client_sync/v26/mod.rs +++ b/client/src/client_sync/v26/mod.rs @@ -207,3 +207,6 @@ crate::impl_client_v17__wallet_lock!(); crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); + +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); diff --git a/client/src/client_sync/v27/mod.rs b/client/src/client_sync/v27/mod.rs index 0a75a1c8..5f383785 100644 --- a/client/src/client_sync/v27/mod.rs +++ b/client/src/client_sync/v27/mod.rs @@ -201,3 +201,6 @@ crate::impl_client_v17__wallet_lock!(); crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); + +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); diff --git a/client/src/client_sync/v28/mod.rs b/client/src/client_sync/v28/mod.rs index 45011ec5..bad5dfa3 100644 --- a/client/src/client_sync/v28/mod.rs +++ b/client/src/client_sync/v28/mod.rs @@ -206,3 +206,6 @@ crate::impl_client_v17__wallet_lock!(); crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); + +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); diff --git a/client/src/client_sync/v29/mod.rs b/client/src/client_sync/v29/mod.rs index 696beece..3ff9ddda 100644 --- a/client/src/client_sync/v29/mod.rs +++ b/client/src/client_sync/v29/mod.rs @@ -207,6 +207,9 @@ crate::impl_client_v17__wallet_passphrase!(); crate::impl_client_v17__wallet_passphrase_change!(); crate::impl_client_v17__wallet_process_psbt!(); +// == Zmq == +crate::impl_client_v17__get_zmq_notifications!(); + /// Arg for the `getblocktemplate` method. (v29+). #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)] pub struct TemplateRequest { diff --git a/integration_test/tests/zmq.rs b/integration_test/tests/zmq.rs new file mode 100644 index 00000000..fc1e1c30 --- /dev/null +++ b/integration_test/tests/zmq.rs @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: CC0-1.0 + +//! Tests for methods found under the `== Zmq ==` section of the API docs. + +#![allow(non_snake_case)] // Test names intentionally use double underscore. +#![allow(unused_imports)] // Because of feature gated tests. + +use integration_test::{Node, Wallet, NodeExt as _}; +use node::vtype::*; // All the version specific types. + +#[test] +#[cfg(not(feature = "v17"))] +fn zmq__get_zmq_notifications__modelled() { + // Start node with a ZMQ notification enabled so we have at least one entry. + // Using hashblock as it is lightweight. + let node = Node::with_wallet(Wallet::Default, &["-zmqpubhashblock=tcp://127.0.0.1:29000"]); + + let list: Vec = node.client.get_zmq_notifications().expect("getzmqnotifications"); + let zmq_notification = &list[0]; + assert_eq!(zmq_notification.type_, "pubhashblock"); + assert_eq!(zmq_notification.address, "tcp://127.0.0.1:29000"); +} diff --git a/types/src/v17/mod.rs b/types/src/v17/mod.rs index a60a275d..c7f64972 100644 --- a/types/src/v17/mod.rs +++ b/types/src/v17/mod.rs @@ -216,7 +216,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! diff --git a/types/src/v18/mod.rs b/types/src/v18/mod.rs index 62dda715..dcc7c080 100644 --- a/types/src/v18/mod.rs +++ b/types/src/v18/mod.rs @@ -218,7 +218,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -229,6 +229,7 @@ mod network; mod raw_transactions; mod util; mod wallet; +mod zmq; #[doc(inline)] pub use self::{ @@ -249,6 +250,7 @@ pub use self::{ ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, ListWalletDirWallet, }, + zmq::GetZmqNotifications, }; #[doc(inline)] pub use crate::v17::{ @@ -271,7 +273,7 @@ pub use crate::v17::{ GetRawTransactionVerboseError, GetReceivedByAddress, GetTransaction, GetTransactionDetail, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListBanned, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, diff --git a/types/src/v18/zmq.rs b/types/src/v18/zmq.rs new file mode 100644 index 00000000..85492fe0 --- /dev/null +++ b/types/src/v18/zmq.rs @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: CC0-1.0 + +//! The JSON-RPC API for Bitcoin Core `v0.18` - zmq. +//! +//! Types for methods found under the `== Zmq ==` section of the API docs. + +use serde::{Deserialize, Serialize}; + +/// Result of JSON-RPC method `getzmqnotifications`. +/// +///> getzmqnotifications +///> +///> Returns information about the active ZeroMQ notifications. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetZmqNotifications { + /// Type of notification. + #[serde(rename = "type")] + pub type_: String, + /// Address of the publisher. + pub address: String, + /// Outbound message high water mark. + pub hwm: u64, +} diff --git a/types/src/v19/mod.rs b/types/src/v19/mod.rs index b23e23c8..25fa8ddf 100644 --- a/types/src/v19/mod.rs +++ b/types/src/v19/mod.rs @@ -220,7 +220,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -269,7 +269,7 @@ pub use crate::v17::{ GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetail, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListBanned, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, @@ -288,5 +288,5 @@ pub use crate::v18::{ GetAddressInfoError, GetNodeAddresses, GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, ListWalletDirWallet, - NodeAddress, UtxoUpdatePsbt, + NodeAddress, UtxoUpdatePsbt, GetZmqNotifications, }; diff --git a/types/src/v20/mod.rs b/types/src/v20/mod.rs index db662c99..de8bc09c 100644 --- a/types/src/v20/mod.rs +++ b/types/src/v20/mod.rs @@ -221,7 +221,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -263,7 +263,7 @@ pub use crate::{ GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, @@ -282,7 +282,7 @@ pub use crate::{ GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, ListWalletDirWallet, - NodeAddress, UtxoUpdatePsbt, + NodeAddress, UtxoUpdatePsbt, GetZmqNotifications, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, diff --git a/types/src/v21/mod.rs b/types/src/v21/mod.rs index 9b404038..b7baffc0 100644 --- a/types/src/v21/mod.rs +++ b/types/src/v21/mod.rs @@ -227,7 +227,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -279,7 +279,7 @@ pub use crate::{ GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, @@ -298,7 +298,7 @@ pub use crate::{ GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, ListWalletDirWallet, - NodeAddress, UtxoUpdatePsbt, + NodeAddress, UtxoUpdatePsbt, GetZmqNotifications, }, v19::{ Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, GetBalancesError, GetBalancesMine, diff --git a/types/src/v22/mod.rs b/types/src/v22/mod.rs index 95f6225e..4579bea3 100644 --- a/types/src/v22/mod.rs +++ b/types/src/v22/mod.rs @@ -238,7 +238,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -281,7 +281,7 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, - GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, GetZmqNotifications, + GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, @@ -299,7 +299,7 @@ pub use crate::{ AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, - ListUnspentItem, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, + ListUnspentItem, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, }, v19::{ Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, GetBalancesError, GetBalancesMine, diff --git a/types/src/v23/mod.rs b/types/src/v23/mod.rs index 2d7b6e48..c51e3872 100644 --- a/types/src/v23/mod.rs +++ b/types/src/v23/mod.rs @@ -231,7 +231,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -279,7 +279,7 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, - GetWalletInfoError, GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, + GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, @@ -297,7 +297,7 @@ pub use crate::{ AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, - ListUnspentItem, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, + ListUnspentItem, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, diff --git a/types/src/v24/mod.rs b/types/src/v24/mod.rs index 2a9fbd3f..60aee9b8 100644 --- a/types/src/v24/mod.rs +++ b/types/src/v24/mod.rs @@ -235,7 +235,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -281,7 +281,7 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, - GetWalletInfoError, GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, + GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, @@ -299,7 +299,7 @@ pub use crate::{ AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, + ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, diff --git a/types/src/v25/mod.rs b/types/src/v25/mod.rs index a49d4743..e6af2d5c 100644 --- a/types/src/v25/mod.rs +++ b/types/src/v25/mod.rs @@ -236,7 +236,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -277,7 +277,7 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, - GetWalletInfoError, GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, + GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, @@ -295,7 +295,7 @@ pub use crate::{ AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, + ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, diff --git a/types/src/v26/mod.rs b/types/src/v26/mod.rs index 31af8770..dc0b83f9 100644 --- a/types/src/v26/mod.rs +++ b/types/src/v26/mod.rs @@ -244,7 +244,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -293,7 +293,7 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, @@ -310,7 +310,7 @@ pub use crate::{ AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, + ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalancesMine, diff --git a/types/src/v27/mod.rs b/types/src/v27/mod.rs index 9fbebc08..3e0ceeaa 100644 --- a/types/src/v27/mod.rs +++ b/types/src/v27/mod.rs @@ -244,7 +244,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -271,7 +271,7 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, @@ -288,7 +288,7 @@ pub use crate::{ AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, + ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalancesMine, diff --git a/types/src/v28/mod.rs b/types/src/v28/mod.rs index 3e300966..b9c301cb 100644 --- a/types/src/v28/mod.rs +++ b/types/src/v28/mod.rs @@ -246,7 +246,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -291,7 +291,7 @@ pub use crate::{ GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, @@ -308,7 +308,7 @@ pub use crate::{ AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, + ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalancesMine, diff --git a/types/src/v29/mod.rs b/types/src/v29/mod.rs index 295bff69..b46d2dbf 100644 --- a/types/src/v29/mod.rs +++ b/types/src/v29/mod.rs @@ -247,7 +247,7 @@ //! //! | JSON-RPC Method Name | Returns | Notes | //! |:-----------------------------------|:---------------:|:--------------------------------------:| -//! | getzmqnotifications | version | UNTESTED | +//! | getzmqnotifications | version | | //! //! @@ -288,7 +288,7 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - GetZmqNotifications, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, @@ -305,7 +305,7 @@ pub use crate::{ AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, + ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalancesMine, From c7ea6e4c57585e60c4d70ff14bcc0f47f20f4435 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Tue, 26 Aug 2025 16:13:32 +0100 Subject: [PATCH 2/4] Run the formatter Reordering of the reexports only. --- types/src/v18/mod.rs | 4 ++-- types/src/v19/mod.rs | 12 ++++++------ types/src/v20/mod.rs | 30 +++++++++++++++--------------- types/src/v21/mod.rs | 29 ++++++++++++++--------------- types/src/v22/mod.rs | 31 ++++++++++++++++--------------- types/src/v23/mod.rs | 7 ++++--- types/src/v24/mod.rs | 6 +++--- types/src/v25/mod.rs | 6 +++--- types/src/v26/mod.rs | 28 ++++++++++++++-------------- types/src/v27/mod.rs | 28 ++++++++++++++-------------- types/src/v28/mod.rs | 28 ++++++++++++++-------------- types/src/v29/mod.rs | 28 ++++++++++++++-------------- 12 files changed, 119 insertions(+), 118 deletions(-) diff --git a/types/src/v18/mod.rs b/types/src/v18/mod.rs index dcc7c080..cec767dc 100644 --- a/types/src/v18/mod.rs +++ b/types/src/v18/mod.rs @@ -273,8 +273,8 @@ pub use crate::v17::{ GetRawTransactionVerboseError, GetReceivedByAddress, GetTransaction, GetTransactionDetail, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, - ListBanned, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListBanned, + ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, diff --git a/types/src/v19/mod.rs b/types/src/v19/mod.rs index 25fa8ddf..9d84c4bf 100644 --- a/types/src/v19/mod.rs +++ b/types/src/v19/mod.rs @@ -269,8 +269,8 @@ pub use crate::v17::{ GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetail, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, - ListBanned, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListBanned, + ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, @@ -285,8 +285,8 @@ pub use crate::v17::{ pub use crate::v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfo, GetAddressInfoEmbedded, - GetAddressInfoError, GetNodeAddresses, GetReceivedByLabel, ImportMulti, ImportMultiEntry, - JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, - ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, ListWalletDirWallet, - NodeAddress, UtxoUpdatePsbt, GetZmqNotifications, + GetAddressInfoError, GetNodeAddresses, GetReceivedByLabel, GetZmqNotifications, ImportMulti, + ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, + ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, + ListWalletDirWallet, NodeAddress, UtxoUpdatePsbt, }; diff --git a/types/src/v20/mod.rs b/types/src/v20/mod.rs index de8bc09c..8cb7813d 100644 --- a/types/src/v20/mod.rs +++ b/types/src/v20/mod.rs @@ -263,26 +263,26 @@ pub use crate::{ GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, - ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, - ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, - ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, - ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, - LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TestMempoolAccept, - TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, - VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, + ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, + ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, + ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, + ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, + Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, + RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, + UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, + VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, + WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetNodeAddresses, - GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, - ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, + GetReceivedByLabel, GetZmqNotifications, ImportMulti, ImportMultiEntry, JoinPsbts, + JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, ListWalletDirWallet, - NodeAddress, UtxoUpdatePsbt, GetZmqNotifications, + NodeAddress, UtxoUpdatePsbt, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, diff --git a/types/src/v21/mod.rs b/types/src/v21/mod.rs index b7baffc0..59afc41c 100644 --- a/types/src/v21/mod.rs +++ b/types/src/v21/mod.rs @@ -279,26 +279,25 @@ pub use crate::{ GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, - ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, - ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, - ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, - ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, - LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, + ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, + ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, + ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, + ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, + Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, + RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetNodeAddresses, - GetReceivedByLabel, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, - ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, + GetReceivedByLabel, GetZmqNotifications, ImportMulti, ImportMultiEntry, JoinPsbts, + JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, ListWalletDirWallet, - NodeAddress, UtxoUpdatePsbt, GetZmqNotifications, + NodeAddress, UtxoUpdatePsbt, }, v19::{ Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, GetBalancesError, GetBalancesMine, diff --git a/types/src/v22/mod.rs b/types/src/v22/mod.rs index 4579bea3..a92cc1a0 100644 --- a/types/src/v22/mod.rs +++ b/types/src/v22/mod.rs @@ -281,25 +281,26 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, - GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, - ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, - ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, - ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, - ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, - Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, ListAddressGroupings, + ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, + ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, + ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, + ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, + ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, - ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, - ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, - ListUnspentItem, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, + GetZmqNotifications, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, + ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, + ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, ListWalletDirWallet, + UtxoUpdatePsbt, }, v19::{ Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, GetBalancesError, GetBalancesMine, diff --git a/types/src/v23/mod.rs b/types/src/v23/mod.rs index c51e3872..06a4077e 100644 --- a/types/src/v23/mod.rs +++ b/types/src/v23/mod.rs @@ -295,9 +295,10 @@ pub use crate::{ v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, - ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, - ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, - ListUnspentItem, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, + GetZmqNotifications, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, + ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, + ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, ListWalletDirWallet, + UtxoUpdatePsbt, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, diff --git a/types/src/v24/mod.rs b/types/src/v24/mod.rs index 60aee9b8..9f2d87c6 100644 --- a/types/src/v24/mod.rs +++ b/types/src/v24/mod.rs @@ -297,9 +297,9 @@ pub use crate::{ v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, - ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, - ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, + GetZmqNotifications, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, + ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, + ListReceivedByLabelError, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, diff --git a/types/src/v25/mod.rs b/types/src/v25/mod.rs index e6af2d5c..ccb755a7 100644 --- a/types/src/v25/mod.rs +++ b/types/src/v25/mod.rs @@ -293,9 +293,9 @@ pub use crate::{ v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, - ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, - ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, + GetZmqNotifications, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, + ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, + ListReceivedByLabelError, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalances, diff --git a/types/src/v26/mod.rs b/types/src/v26/mod.rs index dc0b83f9..19ebbbad 100644 --- a/types/src/v26/mod.rs +++ b/types/src/v26/mod.rs @@ -293,24 +293,24 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, - ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, - ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, - ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, - ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, - LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, + ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, + ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, + ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, + ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, + PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, + RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, - ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, - ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, + GetZmqNotifications, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, + ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, + ListReceivedByLabelError, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalancesMine, diff --git a/types/src/v27/mod.rs b/types/src/v27/mod.rs index 3e0ceeaa..c39824a9 100644 --- a/types/src/v27/mod.rs +++ b/types/src/v27/mod.rs @@ -271,24 +271,24 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, - ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, - ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, - ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, - ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, - LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, + ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, + ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, + ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, + ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, + PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, + RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, - ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, - ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, + GetZmqNotifications, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, + ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, + ListReceivedByLabelError, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalancesMine, diff --git a/types/src/v28/mod.rs b/types/src/v28/mod.rs index b9c301cb..53e80181 100644 --- a/types/src/v28/mod.rs +++ b/types/src/v28/mod.rs @@ -291,24 +291,24 @@ pub use crate::{ GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, - ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, - ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, - ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, - ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, - LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, + ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, + ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, + ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, + ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, + PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, + RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, - ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, - ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, + GetZmqNotifications, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, + ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, + ListReceivedByLabelError, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalancesMine, diff --git a/types/src/v29/mod.rs b/types/src/v29/mod.rs index b46d2dbf..6fa994fa 100644 --- a/types/src/v29/mod.rs +++ b/types/src/v29/mod.rs @@ -288,24 +288,24 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, - ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, - ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, - ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, - ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, - LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, + ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, + ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, + ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, + ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, + ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, + PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, + RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, AnalyzePsbtInputMissingError, DeriveAddresses, GetAddressInfoError, GetReceivedByLabel, - ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, ListReceivedByAddress, - ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListWalletDir, - ListWalletDirWallet, UtxoUpdatePsbt, GetZmqNotifications, + GetZmqNotifications, ImportMulti, ImportMultiEntry, JoinPsbts, JsonRpcError, + ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, + ListReceivedByLabelError, ListWalletDir, ListWalletDirWallet, UtxoUpdatePsbt, }, v19::{ Bip9SoftforkInfo, Bip9SoftforkStatistics, Bip9SoftforkStatus, GetBalancesMine, From 5e09bbd901186977bd2d01a0fe941b5591eefb5d Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Tue, 26 Aug 2025 16:21:12 +0100 Subject: [PATCH 3/4] Test sendmany `sendmany` has a new verbose return type in v18. The client macro sends the amount of sats but the RPC takes BTC. Add the verbose struct to v18 and model. Update the client macro. Add a verbose client macro, test and update the types table. --- client/src/client_sync/v17/wallet.rs | 6 +++- client/src/client_sync/v21/mod.rs | 1 + client/src/client_sync/v21/wallet.rs | 42 ++++++++++++++++++++++++++++ client/src/client_sync/v22/mod.rs | 1 + client/src/client_sync/v23/mod.rs | 1 + client/src/client_sync/v24/mod.rs | 1 + client/src/client_sync/v25/mod.rs | 1 + client/src/client_sync/v26/mod.rs | 1 + client/src/client_sync/v27/mod.rs | 1 + client/src/client_sync/v28/mod.rs | 1 + client/src/client_sync/v29/mod.rs | 1 + integration_test/tests/wallet.rs | 31 ++++++++++++++++++++ types/src/model/mod.rs | 6 ++-- types/src/model/wallet.rs | 10 +++++++ types/src/v17/mod.rs | 2 +- types/src/v18/mod.rs | 2 +- types/src/v19/mod.rs | 2 +- types/src/v20/mod.rs | 2 +- types/src/v21/mod.rs | 14 +++++----- types/src/v21/wallet/into.rs | 22 ++++++++++++++- types/src/v21/wallet/mod.rs | 30 ++++++++++++++++++++ types/src/v22/mod.rs | 6 ++-- types/src/v23/mod.rs | 15 +++++----- types/src/v24/mod.rs | 15 +++++----- types/src/v25/mod.rs | 16 +++++------ types/src/v26/mod.rs | 15 +++++----- types/src/v27/mod.rs | 15 +++++----- types/src/v28/mod.rs | 14 +++++----- types/src/v29/mod.rs | 14 +++++----- 29 files changed, 217 insertions(+), 71 deletions(-) diff --git a/client/src/client_sync/v17/wallet.rs b/client/src/client_sync/v17/wallet.rs index a9332c98..75f39712 100644 --- a/client/src/client_sync/v17/wallet.rs +++ b/client/src/client_sync/v17/wallet.rs @@ -560,7 +560,11 @@ macro_rules! impl_client_v17__send_many { impl Client { pub fn send_many(&self, amounts: BTreeMap) -> Result { let dummy = ""; // Must be set to "" for backwards compatibility. - self.call("sendmany", &[into_json(dummy)?, into_json(amounts)?]) + let amount_btc: BTreeMap = amounts + .into_iter() + .map(|(addr, amount)| (addr.to_string(), amount.to_btc())) + .collect(); + self.call("sendmany", &[into_json(dummy)?, into_json(amount_btc)?]) } } }; diff --git a/client/src/client_sync/v21/mod.rs b/client/src/client_sync/v21/mod.rs index c6ddf9f2..c2ada750 100644 --- a/client/src/client_sync/v21/mod.rs +++ b/client/src/client_sync/v21/mod.rs @@ -172,6 +172,7 @@ crate::impl_client_v17__remove_pruned_funds!(); crate::impl_client_v17__rescan_blockchain!(); crate::impl_client_v21__send!(); crate::impl_client_v17__send_many!(); +crate::impl_client_v21__send_many_verbose!(); crate::impl_client_v17__send_to_address!(); crate::impl_client_v17__set_hd_seed!(); crate::impl_client_v17__set_tx_fee!(); diff --git a/client/src/client_sync/v21/wallet.rs b/client/src/client_sync/v21/wallet.rs index 7a832e6a..43f344b5 100644 --- a/client/src/client_sync/v21/wallet.rs +++ b/client/src/client_sync/v21/wallet.rs @@ -98,6 +98,48 @@ macro_rules! impl_client_v21__send { }; } +/// Implements Bitcoin Core JSON-RPC API method `sendmany` with `verbose=true` (v21+). +#[macro_export] +macro_rules! impl_client_v21__send_many_verbose { + () => { + impl Client { + pub fn send_many_verbose( + &self, + amounts: BTreeMap, + ) -> Result { + let dummy = ""; // Backwards compatibility dummy. + let amount_btc: BTreeMap = amounts + .into_iter() + .map(|(addr, amount)| (addr.to_string(), amount.to_btc())) + .collect(); + let minconf = 1u64; + let comment = ""; + let subtract_fee_from: Vec = Vec::new(); + let replaceable = true; + let conf_target = 1u64; + let estimate_mode = "unset"; + let fee_rate = serde_json::Value::Null; + let verbose = true; + self.call( + "sendmany", + &[ + into_json(dummy)?, + into_json(amount_btc)?, + minconf.into(), + comment.into(), + into_json(subtract_fee_from)?, + replaceable.into(), + conf_target.into(), + estimate_mode.into(), + fee_rate, + verbose.into(), + ], + ) + } + } + }; +} + /// Implements Bitcoin Core JSON-RPC API method `unloadwallet`. #[macro_export] macro_rules! impl_client_v21__unload_wallet { diff --git a/client/src/client_sync/v22/mod.rs b/client/src/client_sync/v22/mod.rs index d65eeeb1..6d32b66f 100644 --- a/client/src/client_sync/v22/mod.rs +++ b/client/src/client_sync/v22/mod.rs @@ -174,6 +174,7 @@ crate::impl_client_v17__remove_pruned_funds!(); crate::impl_client_v17__rescan_blockchain!(); crate::impl_client_v21__send!(); crate::impl_client_v17__send_many!(); +crate::impl_client_v21__send_many_verbose!(); crate::impl_client_v17__send_to_address!(); crate::impl_client_v17__set_hd_seed!(); crate::impl_client_v17__set_tx_fee!(); diff --git a/client/src/client_sync/v23/mod.rs b/client/src/client_sync/v23/mod.rs index c0230fb4..8cc0102e 100644 --- a/client/src/client_sync/v23/mod.rs +++ b/client/src/client_sync/v23/mod.rs @@ -179,6 +179,7 @@ crate::impl_client_v17__rescan_blockchain!(); crate::impl_client_v23__restore_wallet!(); crate::impl_client_v21__send!(); crate::impl_client_v17__send_many!(); +crate::impl_client_v21__send_many_verbose!(); crate::impl_client_v17__send_to_address!(); crate::impl_client_v17__set_hd_seed!(); crate::impl_client_v17__set_tx_fee!(); diff --git a/client/src/client_sync/v24/mod.rs b/client/src/client_sync/v24/mod.rs index b629c6f9..49f4a804 100644 --- a/client/src/client_sync/v24/mod.rs +++ b/client/src/client_sync/v24/mod.rs @@ -182,6 +182,7 @@ crate::impl_client_v23__restore_wallet!(); crate::impl_client_v21__send!(); crate::impl_client_v24__send_all!(); crate::impl_client_v17__send_many!(); +crate::impl_client_v21__send_many_verbose!(); crate::impl_client_v17__send_to_address!(); crate::impl_client_v17__set_hd_seed!(); crate::impl_client_v17__set_tx_fee!(); diff --git a/client/src/client_sync/v25/mod.rs b/client/src/client_sync/v25/mod.rs index f25658b4..36ecc2cc 100644 --- a/client/src/client_sync/v25/mod.rs +++ b/client/src/client_sync/v25/mod.rs @@ -183,6 +183,7 @@ crate::impl_client_v23__restore_wallet!(); crate::impl_client_v21__send!(); crate::impl_client_v24__send_all!(); crate::impl_client_v17__send_many!(); +crate::impl_client_v21__send_many_verbose!(); crate::impl_client_v17__send_to_address!(); crate::impl_client_v17__set_hd_seed!(); crate::impl_client_v17__set_tx_fee!(); diff --git a/client/src/client_sync/v26/mod.rs b/client/src/client_sync/v26/mod.rs index da68a44d..f7fd02f2 100644 --- a/client/src/client_sync/v26/mod.rs +++ b/client/src/client_sync/v26/mod.rs @@ -192,6 +192,7 @@ crate::impl_client_v23__restore_wallet!(); crate::impl_client_v21__send!(); crate::impl_client_v24__send_all!(); crate::impl_client_v17__send_many!(); +crate::impl_client_v21__send_many_verbose!(); crate::impl_client_v17__send_to_address!(); crate::impl_client_v17__set_hd_seed!(); crate::impl_client_v17__set_tx_fee!(); diff --git a/client/src/client_sync/v27/mod.rs b/client/src/client_sync/v27/mod.rs index 5f383785..a4c9f449 100644 --- a/client/src/client_sync/v27/mod.rs +++ b/client/src/client_sync/v27/mod.rs @@ -186,6 +186,7 @@ crate::impl_client_v23__restore_wallet!(); crate::impl_client_v21__send!(); crate::impl_client_v24__send_all!(); crate::impl_client_v17__send_many!(); +crate::impl_client_v21__send_many_verbose!(); crate::impl_client_v17__send_to_address!(); crate::impl_client_v17__set_hd_seed!(); crate::impl_client_v17__set_tx_fee!(); diff --git a/client/src/client_sync/v28/mod.rs b/client/src/client_sync/v28/mod.rs index bad5dfa3..5c2c24bf 100644 --- a/client/src/client_sync/v28/mod.rs +++ b/client/src/client_sync/v28/mod.rs @@ -191,6 +191,7 @@ crate::impl_client_v23__restore_wallet!(); crate::impl_client_v21__send!(); crate::impl_client_v24__send_all!(); crate::impl_client_v17__send_many!(); +crate::impl_client_v21__send_many_verbose!(); crate::impl_client_v17__send_to_address!(); crate::impl_client_v17__set_hd_seed!(); crate::impl_client_v17__set_tx_fee!(); diff --git a/client/src/client_sync/v29/mod.rs b/client/src/client_sync/v29/mod.rs index 3ff9ddda..d8754589 100644 --- a/client/src/client_sync/v29/mod.rs +++ b/client/src/client_sync/v29/mod.rs @@ -191,6 +191,7 @@ crate::impl_client_v23__restore_wallet!(); crate::impl_client_v21__send!(); crate::impl_client_v24__send_all!(); crate::impl_client_v17__send_many!(); +crate::impl_client_v21__send_many_verbose!(); crate::impl_client_v17__send_to_address!(); crate::impl_client_v17__set_hd_seed!(); crate::impl_client_v17__set_tx_fee!(); diff --git a/integration_test/tests/wallet.rs b/integration_test/tests/wallet.rs index e2cdcb87..e1572691 100644 --- a/integration_test/tests/wallet.rs +++ b/integration_test/tests/wallet.rs @@ -857,6 +857,37 @@ fn wallet__unload_wallet() { create_load_unload_wallet(); } +#[test] +fn wallet__send_many__modelled() { + let node = Node::with_wallet(Wallet::Default, &[]); + node.fund_wallet(); + + let addr1 = node.client.new_address().expect("newaddress"); + let addr2 = node.client.new_address().expect("newaddress"); + + let mut amounts = BTreeMap::new(); + amounts.insert(addr1, Amount::from_sat(100_000)); + amounts.insert(addr2, Amount::from_sat(100_000)); + + let json: SendMany = node.client.send_many(amounts.clone()).expect("sendmany"); + let model: Result = json.into_model(); + let txid = model.unwrap().0; + + assert_eq!(txid.to_string().len(), 64); + + #[cfg(not(feature = "v20_and_below"))] + { + let json_verbose: SendManyVerbose = node + .client + .send_many_verbose(amounts) + .expect("sendmany verbose"); + let model_verbose: Result = json_verbose.into_model(); + let verbose = model_verbose.unwrap(); + assert_eq!(verbose.txid.to_string().len(), 64); + assert_eq!(verbose.fee_reason, "Fallback fee"); + } +} + #[cfg(not(feature = "v20_and_below"))] #[test] fn wallet__send__modelled() { diff --git a/types/src/model/mod.rs b/types/src/model/mod.rs index 5b2bb536..7936c509 100644 --- a/types/src/model/mod.rs +++ b/types/src/model/mod.rs @@ -60,8 +60,8 @@ pub use self::{ ListLockUnspentItem, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelItem, ListSinceBlock, ListSinceBlockTransaction, ListTransactions, ListTransactionsItem, ListUnspent, ListUnspentItem, ListWallets, LoadWallet, PsbtBumpFee, - RescanBlockchain, ScriptType, Send, SendAll, SendMany, SendToAddress, SignMessage, - SimulateRawTransaction, TransactionCategory, UnloadWallet, WalletCreateFundedPsbt, - WalletDisplayAddress, WalletProcessPsbt, + RescanBlockchain, ScriptType, Send, SendAll, SendMany, SendManyVerbose, SendToAddress, + SignMessage, SimulateRawTransaction, TransactionCategory, UnloadWallet, + WalletCreateFundedPsbt, WalletDisplayAddress, WalletProcessPsbt, }, }; diff --git a/types/src/model/wallet.rs b/types/src/model/wallet.rs index 0b59a125..004bf97d 100644 --- a/types/src/model/wallet.rs +++ b/types/src/model/wallet.rs @@ -808,6 +808,16 @@ pub struct SendAll { #[serde(deny_unknown_fields)] pub struct SendMany(pub Txid); +/// Models the verbose result of JSON-RPC method `sendmany` when `verbose=true`. +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct SendManyVerbose { + /// The transaction id for the send. Only 1 transaction is created regardless of the number of addresses. + pub txid: Txid, + /// The transaction fee reason. + pub fee_reason: String, +} + /// Models the result of JSON-RPC method `sendtoaddress`. #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[serde(deny_unknown_fields)] diff --git a/types/src/v17/mod.rs b/types/src/v17/mod.rs index c7f64972..9b000e33 100644 --- a/types/src/v17/mod.rs +++ b/types/src/v17/mod.rs @@ -195,7 +195,7 @@ //! | removeprunedfunds | returns nothing | | //! | rescanblockchain | version + model | | //! | sendfrom | returns nothing | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | setaccount | returns nothing | | //! | sethdseed | returns nothing | | diff --git a/types/src/v18/mod.rs b/types/src/v18/mod.rs index cec767dc..444b3f0e 100644 --- a/types/src/v18/mod.rs +++ b/types/src/v18/mod.rs @@ -197,7 +197,7 @@ //! | lockunspent | version | | //! | removeprunedfunds | returns nothing | | //! | rescanblockchain | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | diff --git a/types/src/v19/mod.rs b/types/src/v19/mod.rs index 9d84c4bf..b33fde9b 100644 --- a/types/src/v19/mod.rs +++ b/types/src/v19/mod.rs @@ -198,7 +198,7 @@ //! | lockunspent | version | | //! | removeprunedfunds | returns nothing | | //! | rescanblockchain | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | diff --git a/types/src/v20/mod.rs b/types/src/v20/mod.rs index 8cb7813d..aaf45e22 100644 --- a/types/src/v20/mod.rs +++ b/types/src/v20/mod.rs @@ -199,7 +199,7 @@ //! | lockunspent | version | | //! | removeprunedfunds | returns nothing | | //! | rescanblockchain | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | diff --git a/types/src/v21/mod.rs b/types/src/v21/mod.rs index 59afc41c..60e9a3d8 100644 --- a/types/src/v21/mod.rs +++ b/types/src/v21/mod.rs @@ -204,7 +204,7 @@ //! | removeprunedfunds | returns nothing | | //! | rescanblockchain | version + model | | //! | send | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | @@ -256,7 +256,7 @@ pub use self::{ util::{GetIndexInfo, GetIndexInfoName}, wallet::{ ImportDescriptors, ImportDescriptorsResult, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, - UnloadWallet, UpgradeWallet, + SendMany, SendManyVerbose, UnloadWallet, UpgradeWallet, }, }; #[doc(inline)] @@ -285,11 +285,11 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v21/wallet/into.rs b/types/src/v21/wallet/into.rs index fcd5a7cf..b2c502fc 100644 --- a/types/src/v21/wallet/into.rs +++ b/types/src/v21/wallet/into.rs @@ -1,6 +1,10 @@ // SPDX-License-Identifier: CC0-1.0 -use super::{PsbtBumpFee, PsbtBumpFeeError, Send, SendError, UnloadWallet}; +use bitcoin::{hex, Txid}; + +use super::{ + PsbtBumpFee, PsbtBumpFeeError, Send, SendError, SendMany, SendManyVerbose, UnloadWallet, +}; use crate::model; impl UnloadWallet { @@ -42,3 +46,19 @@ impl Send { Ok(model::Send { complete: self.complete, txid, hex, psbt }) } } + +impl SendMany { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + let txid = self.0.parse::()?; + Ok(model::SendMany(txid)) + } +} + +impl SendManyVerbose { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + let txid = self.txid.parse::()?; + Ok(model::SendManyVerbose { txid, fee_reason: self.fee_reason }) + } +} diff --git a/types/src/v21/wallet/mod.rs b/types/src/v21/wallet/mod.rs index 6004e25f..f56e619b 100644 --- a/types/src/v21/wallet/mod.rs +++ b/types/src/v21/wallet/mod.rs @@ -109,6 +109,36 @@ pub struct Send { pub psbt: Option, } +/// Result of JSON-RPC method `sendmany` when `verbose=false`. +/// +/// > sendmany "" {"address":amount} +/// > +/// > Send multiple times. Amounts are double-precision floating point numbers. +/// > Requires wallet passphrase to be set with walletpassphrase call if wallet is encrypted. +/// > +/// > Arguments: +/// > 1. dummy (string, required) Must be set to "" for backwards compatibility. +/// > 2. amounts (json object, required) The addresses and amounts +/// > { "address": amount, (numeric or string, required) The bitcoin address is the key, the numeric amount (can be string) in BTC is the value } +/// > ... +/// > 10. verbose (boolean, optional, default=false) If true, return extra infomration about the transaction. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct SendMany( + /// The transaction id for the send. + pub String, +); + +/// Result of JSON-RPC method `sendmany` when `verbose=true`. +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct SendManyVerbose { + /// The transaction id for the send. Only 1 transaction is created regardless of the number of addresses. + pub txid: String, + /// The transaction fee reason. + pub fee_reason: String, +} + /// Result of the JSON-RPC method `unloadwallet`. /// /// > unloadwallet ( "wallet_name" load_on_startup ) diff --git a/types/src/v22/mod.rs b/types/src/v22/mod.rs index a92cc1a0..817437ad 100644 --- a/types/src/v22/mod.rs +++ b/types/src/v22/mod.rs @@ -214,7 +214,7 @@ //! | removeprunedfunds | returns nothing | | //! | rescanblockchain | version + model | | //! | send | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | @@ -287,7 +287,7 @@ pub use crate::{ ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, - RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, @@ -317,7 +317,7 @@ pub use crate::{ GetIndexInfoName, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetNetworkInfo, ImportDescriptors, ImportDescriptorsResult, MempoolEntry, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, - Softfork, SoftforkType, UnloadWallet, UpgradeWallet, + SendMany, SendManyVerbose, Softfork, SoftforkType, UnloadWallet, UpgradeWallet, }, ScriptPubkey, }; diff --git a/types/src/v23/mod.rs b/types/src/v23/mod.rs index 06a4077e..5c4f9826 100644 --- a/types/src/v23/mod.rs +++ b/types/src/v23/mod.rs @@ -207,7 +207,7 @@ //! | rescanblockchain | version + model | | //! | restorewallet | version | | //! | send | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | @@ -285,12 +285,11 @@ pub use crate::{ ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, + RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -311,7 +310,7 @@ pub use crate::{ v21::{ AddPeerAddress, GenerateBlock, GetIndexInfo, GetIndexInfoName, GetNetworkInfo, ImportDescriptors, ImportDescriptorsResult, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, - UnloadWallet, UpgradeWallet, + SendMany, SendManyVerbose, UnloadWallet, UpgradeWallet, }, v22::{ Banned, EnumerateSigners, GetAddressInfo, GetAddressInfoEmbedded, GetMempoolInfo, diff --git a/types/src/v24/mod.rs b/types/src/v24/mod.rs index 9f2d87c6..65107af2 100644 --- a/types/src/v24/mod.rs +++ b/types/src/v24/mod.rs @@ -210,7 +210,7 @@ //! | restorewallet | version | | //! | send | version + model | | //! | sendall | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | @@ -287,12 +287,11 @@ pub use crate::{ ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, + RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -312,7 +311,7 @@ pub use crate::{ v21::{ AddPeerAddress, GenerateBlock, GetIndexInfo, GetIndexInfoName, GetNetworkInfo, ImportDescriptors, ImportDescriptorsResult, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, - UnloadWallet, UpgradeWallet, + SendMany, SendManyVerbose, UnloadWallet, UpgradeWallet, }, v22::{ Banned, EnumerateSigners, GetAddressInfo, GetAddressInfoEmbedded, GetNodeAddresses, diff --git a/types/src/v25/mod.rs b/types/src/v25/mod.rs index ccb755a7..6544f89b 100644 --- a/types/src/v25/mod.rs +++ b/types/src/v25/mod.rs @@ -211,7 +211,7 @@ //! | restorewallet | version | | //! | send | version + model | | //! | sendall | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | @@ -283,12 +283,11 @@ pub use crate::{ ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, - RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, - SendToAddress, SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, - SignRawTransaction, SignRawTransactionError, SoftforkReject, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, + RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -307,7 +306,8 @@ pub use crate::{ v20::GenerateToDescriptor, v21::{ AddPeerAddress, GetIndexInfo, GetIndexInfoName, GetNetworkInfo, ImportDescriptors, - ImportDescriptorsResult, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, UpgradeWallet, + ImportDescriptorsResult, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, SendMany, + SendManyVerbose, UpgradeWallet, }, v22::{ Banned, EnumerateSigners, GetAddressInfo, GetAddressInfoEmbedded, GetNodeAddresses, diff --git a/types/src/v26/mod.rs b/types/src/v26/mod.rs index 19ebbbad..4b7f9171 100644 --- a/types/src/v26/mod.rs +++ b/types/src/v26/mod.rs @@ -219,7 +219,7 @@ //! | restorewallet | version | | //! | send | version + model | | //! | sendall | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | @@ -299,11 +299,11 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, + RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -321,7 +321,8 @@ pub use crate::{ v20::GenerateToDescriptor, v21::{ AddPeerAddress, GetIndexInfo, GetIndexInfoName, GetNetworkInfo, ImportDescriptors, - ImportDescriptorsResult, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, UpgradeWallet, + ImportDescriptorsResult, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, SendMany, + SendManyVerbose, UpgradeWallet, }, v22::{ Banned, EnumerateSigners, GetAddressInfo, GetAddressInfoEmbedded, GetNodeAddresses, diff --git a/types/src/v27/mod.rs b/types/src/v27/mod.rs index c39824a9..dba753f1 100644 --- a/types/src/v27/mod.rs +++ b/types/src/v27/mod.rs @@ -219,7 +219,7 @@ //! | restorewallet | version | | //! | send | version + model | | //! | sendall | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | @@ -277,11 +277,11 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, + RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -299,7 +299,8 @@ pub use crate::{ v20::GenerateToDescriptor, v21::{ AddPeerAddress, GetIndexInfo, GetIndexInfoName, GetNetworkInfo, ImportDescriptors, - ImportDescriptorsResult, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, UpgradeWallet, + ImportDescriptorsResult, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, SendMany, + SendManyVerbose, UpgradeWallet, }, v22::{ Banned, EnumerateSigners, GetAddressInfo, GetAddressInfoEmbedded, GetNodeAddresses, diff --git a/types/src/v28/mod.rs b/types/src/v28/mod.rs index 53e80181..45488be8 100644 --- a/types/src/v28/mod.rs +++ b/types/src/v28/mod.rs @@ -221,7 +221,7 @@ //! | restorewallet | version | | //! | send | version + model | | //! | sendall | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | @@ -297,11 +297,11 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, - ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, - WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, + RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -319,7 +319,7 @@ pub use crate::{ v20::GenerateToDescriptor, v21::{ AddPeerAddress, GetIndexInfo, GetIndexInfoName, ImportDescriptors, ImportDescriptorsResult, - PsbtBumpFee, PsbtBumpFeeError, Send, SendError, UpgradeWallet, + PsbtBumpFee, PsbtBumpFeeError, Send, SendError, SendMany, SendManyVerbose, UpgradeWallet, }, v22::{ Banned, EnumerateSigners, GetNodeAddresses, ListBanned, NodeAddress, ScriptPubkey, diff --git a/types/src/v29/mod.rs b/types/src/v29/mod.rs index 6fa994fa..3039daea 100644 --- a/types/src/v29/mod.rs +++ b/types/src/v29/mod.rs @@ -222,7 +222,7 @@ //! | restorewallet | version | | //! | send | version + model | | //! | sendall | version + model | | -//! | sendmany | version + model | UNTESTED | +//! | sendmany | version + model | | //! | sendtoaddress | version + model | | //! | sethdseed | returns nothing | | //! | setlabel | returns nothing | | @@ -294,11 +294,11 @@ pub use crate::{ ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WitnessUtxo, + RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, + SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -316,7 +316,7 @@ pub use crate::{ v20::GenerateToDescriptor, v21::{ AddPeerAddress, GetIndexInfo, GetIndexInfoName, ImportDescriptors, ImportDescriptorsResult, - PsbtBumpFee, PsbtBumpFeeError, Send, SendError, UpgradeWallet, + PsbtBumpFee, PsbtBumpFeeError, Send, SendError, SendMany, SendManyVerbose, UpgradeWallet, }, v22::{ Banned, EnumerateSigners, GetNodeAddresses, ListBanned, NodeAddress, ScriptPubkey, From 453fc487a78f4809f1a09510c583e2527272c006 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 27 Aug 2025 09:54:34 +0100 Subject: [PATCH 4/4] Test and update getwalletinfo `getwalletinfo` was implemented for v17 only and untested. There are return changes in v18, v19, v21, v23 and v26. Add the updated structs in all versions, update the model and add new `into_model()`. Add a test with version specific sections to test the new sub-structs. Update the types tables and reexports. --- integration_test/tests/wallet.rs | 25 +++++++++++ types/src/model/mod.rs | 16 +++---- types/src/model/wallet.rs | 31 ++++++++++++- types/src/v17/mod.rs | 2 +- types/src/v17/wallet/into.rs | 8 ++++ types/src/v17/wallet/mod.rs | 2 +- types/src/v18/mod.rs | 33 +++++++------- types/src/v18/wallet/into.rs | 53 +++++++++++++++++++++-- types/src/v18/wallet/mod.rs | 49 ++++++++++++++++++++- types/src/v19/mod.rs | 26 +++++------ types/src/v19/wallet/into.rs | 58 ++++++++++++++++++++++++- types/src/v19/wallet/mod.rs | 61 +++++++++++++++++++++++++- types/src/v20/mod.rs | 32 +++++++------- types/src/v21/mod.rs | 31 ++++++------- types/src/v21/wallet/into.rs | 55 +++++++++++++++++++++++- types/src/v21/wallet/mod.rs | 64 +++++++++++++++++++++++++++ types/src/v22/mod.rs | 32 +++++++------- types/src/v23/mod.rs | 9 ++-- types/src/v23/wallet/into.rs | 60 +++++++++++++++++++++++++- types/src/v23/wallet/mod.rs | 65 ++++++++++++++++++++++++++++ types/src/v24/mod.rs | 7 +-- types/src/v25/mod.rs | 6 +-- types/src/v26/mod.rs | 28 ++++++------ types/src/v26/wallet/error.rs | 57 ++++++++++++++++++++++++ types/src/v26/wallet/into.rs | 64 ++++++++++++++++++++++++++- types/src/v26/wallet/mod.rs | 74 +++++++++++++++++++++++++++++++- types/src/v27/mod.rs | 32 +++++++------- types/src/v28/mod.rs | 30 ++++++------- types/src/v29/mod.rs | 31 +++++++------ 29 files changed, 871 insertions(+), 170 deletions(-) diff --git a/integration_test/tests/wallet.rs b/integration_test/tests/wallet.rs index e1572691..821524d2 100644 --- a/integration_test/tests/wallet.rs +++ b/integration_test/tests/wallet.rs @@ -390,6 +390,31 @@ fn wallet__get_unconfirmed_balance__modelled() { model.unwrap(); } +#[test] +fn wallet__get_wallet_info__modelled() { + let node = Node::with_wallet(Wallet::Default, &[]); + node.mine_a_block(); + + let json: GetWalletInfo = node.client.get_wallet_info().expect("getwalletinfo"); + let model: Result = json.into_model(); + let wallet_info = model.unwrap(); + + assert!(!wallet_info.wallet_name.is_empty()); + + #[cfg(not(feature = "v18_and_below"))] + { + assert!(wallet_info.avoid_reuse.is_some()); + assert!(wallet_info.scanning.is_some()); + } + + #[cfg(not(feature = "v25_and_below"))] + { + let last_processed = wallet_info.last_processed_block.as_ref().expect("last_processed_block"); + let best_hash = node.client.best_block_hash().expect("best_block_hash"); + assert_eq!(last_processed.hash, best_hash); + } +} + #[test] fn wallet__import_address() { let node = match () { diff --git a/types/src/model/mod.rs b/types/src/model/mod.rs index 7936c509..59200227 100644 --- a/types/src/model/mod.rs +++ b/types/src/model/mod.rs @@ -55,13 +55,13 @@ pub use self::{ CreateWallet, DumpPrivKey, GetAddressInfo, GetAddressInfoEmbedded, GetAddressesByLabel, GetBalance, GetBalances, GetBalancesMine, GetBalancesWatchOnly, GetHdKeys, GetNewAddress, GetRawChangeAddress, GetReceivedByAddress, GetReceivedByLabel, GetTransaction, - GetTransactionDetail, GetUnconfirmedBalance, GetWalletInfo, HdKey, HdKeyDescriptor, - LastProcessedBlock, ListAddressGroupings, ListAddressGroupingsItem, ListLockUnspent, - ListLockUnspentItem, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, - ListReceivedByLabelItem, ListSinceBlock, ListSinceBlockTransaction, ListTransactions, - ListTransactionsItem, ListUnspent, ListUnspentItem, ListWallets, LoadWallet, PsbtBumpFee, - RescanBlockchain, ScriptType, Send, SendAll, SendMany, SendManyVerbose, SendToAddress, - SignMessage, SimulateRawTransaction, TransactionCategory, UnloadWallet, - WalletCreateFundedPsbt, WalletDisplayAddress, WalletProcessPsbt, + GetTransactionDetail, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoScanning, HdKey, + HdKeyDescriptor, LastProcessedBlock, ListAddressGroupings, ListAddressGroupingsItem, + ListLockUnspent, ListLockUnspentItem, ListReceivedByAddress, ListReceivedByAddressItem, + ListReceivedByLabel, ListReceivedByLabelItem, ListSinceBlock, ListSinceBlockTransaction, + ListTransactions, ListTransactionsItem, ListUnspent, ListUnspentItem, ListWallets, + LoadWallet, PsbtBumpFee, RescanBlockchain, ScriptType, Send, SendAll, SendMany, + SendManyVerbose, SendToAddress, SignMessage, SimulateRawTransaction, TransactionCategory, + UnloadWallet, WalletCreateFundedPsbt, WalletDisplayAddress, WalletProcessPsbt, }, }; diff --git a/types/src/model/wallet.rs b/types/src/model/wallet.rs index 004bf97d..889d4895 100644 --- a/types/src/model/wallet.rs +++ b/types/src/model/wallet.rs @@ -455,6 +455,8 @@ pub struct GetWalletInfo { pub wallet_name: String, /// The wallet version. pub wallet_version: u32, + /// Database format. v21 and later only. + pub format: Option, /// The total confirmed balance of the wallet in BTC. pub balance: Amount, /// The total unconfirmed balance of the wallet in BTC. @@ -472,13 +474,40 @@ pub struct GetWalletInfo { pub keypool_size_hd_internal: u32, /// The timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked /// for transfers, or 0 if the wallet is locked. - pub unlocked_until: u32, + pub unlocked_until: Option, /// The transaction fee configuration. pub pay_tx_fee: Option, /// The Hash160 of the HD seed (only present when HD is enabled). pub hd_seed_id: Option, /// If privatekeys are disabled for this wallet (enforced watch-only wallet). pub private_keys_enabled: bool, + /// Whether this wallet tracks clean/dirty coins in terms of reuse. v19 and later only. + pub avoid_reuse: Option, + /// Current scanning details, or false if no scan is in progress. v19 and later only. + pub scanning: Option, + /// Whether wallet uses descriptors. v21 and later only. + pub descriptors: Option, + /// Whether this wallet is configured to use an external signer such as a hardware wallet. v23 and later only. + pub external_signer: Option, + /// Whether this wallet intentionally does not contain any keys, scripts, or descriptors. v26 and later only. + pub blank: Option, + /// The start time for blocks scanning. v26 and later only. + pub birthtime: Option, + /// Hash and height of the block this information was generated on. v26 and later only. + pub last_processed_block: Option, +} + +/// Models the `scanning` field of `getwalletinfo` (v19+). When not scanning Core returns `false`. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(untagged)] +pub enum GetWalletInfoScanning { + Details { + /// Elapsed seconds since scan start. + duration: u64, + /// Scanning progress percentage [0.0, 1.0]. + progress: f64, + }, + NotScanning(bool), } /// Models the result of JSON-RPC method `listaddressgroupings`. diff --git a/types/src/v17/mod.rs b/types/src/v17/mod.rs index 9b000e33..b8eae11b 100644 --- a/types/src/v17/mod.rs +++ b/types/src/v17/mod.rs @@ -171,7 +171,7 @@ //! | getreceivedbyaddress | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importmulti | version | | //! | importprivkey | returns nothing | | diff --git a/types/src/v17/wallet/into.rs b/types/src/v17/wallet/into.rs index d6bb0ee9..87fe6615 100644 --- a/types/src/v17/wallet/into.rs +++ b/types/src/v17/wallet/into.rs @@ -437,6 +437,7 @@ impl GetWalletInfo { Ok(model::GetWalletInfo { wallet_name: self.wallet_name, wallet_version, + format: None, balance, unconfirmed_balance, immature_balance, @@ -448,6 +449,13 @@ impl GetWalletInfo { pay_tx_fee, hd_seed_id, private_keys_enabled: self.private_keys_enabled, + avoid_reuse: None, + scanning: None, + descriptors: None, + external_signer: None, + blank: None, + birthtime: None, + last_processed_block: None, }) } } diff --git a/types/src/v17/wallet/mod.rs b/types/src/v17/wallet/mod.rs index e47cea70..a06200e7 100644 --- a/types/src/v17/wallet/mod.rs +++ b/types/src/v17/wallet/mod.rs @@ -549,7 +549,7 @@ pub struct GetWalletInfo { pub keypool_size_hd_internal: i64, /// The timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked /// for transfers, or 0 if the wallet is locked. - pub unlocked_until: u32, + pub unlocked_until: Option, /// The transaction fee configuration, set in BTC/kB. #[serde(rename = "paytxfee")] pub pay_tx_fee: f64, diff --git a/types/src/v18/mod.rs b/types/src/v18/mod.rs index 444b3f0e..91762f42 100644 --- a/types/src/v18/mod.rs +++ b/types/src/v18/mod.rs @@ -175,7 +175,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importmulti | version | | //! | importprivkey | returns nothing | | @@ -246,7 +246,7 @@ pub use self::{ util::{DeriveAddresses, GetDescriptorInfo}, wallet::{ GetAddressInfo, GetAddressInfoEmbedded, GetAddressInfoError, GetReceivedByLabel, - ImportMulti, ImportMultiEntry, JsonRpcError, ListReceivedByAddress, + GetWalletInfo, ImportMulti, ImportMultiEntry, JsonRpcError, ListReceivedByAddress, ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, ListUnspent, ListUnspentItem, ListWalletDir, ListWalletDirWallet, }, @@ -272,19 +272,18 @@ pub use crate::v17::{ GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransaction, GetTransactionDetail, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, - GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListBanned, - ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, - ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, - ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, - ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, - Logging, MapMempoolEntryError, MempoolAcceptance, MempoolEntryError, MempoolEntryFees, - MempoolEntryFeesError, PruneBlockchain, PsbtInput, PsbtOutput, PsbtScript, RawTransaction, - RawTransactionError, RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, - SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignFail, - SignFailError, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, Softfork, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, + GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, + ListAddressGroupingsError, ListAddressGroupingsItem, ListBanned, ListLabels, ListLockUnspent, + ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, + ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, + ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, + ListWallets, LoadWallet, LockUnspent, Locked, Logging, MapMempoolEntryError, MempoolAcceptance, + MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PruneBlockchain, PsbtInput, + PsbtOutput, PsbtScript, RawTransaction, RawTransactionError, RawTransactionInput, + RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, SendRawTransaction, + SendToAddress, SetNetworkActive, SetTxFee, SignFail, SignFailError, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, Softfork, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }; diff --git a/types/src/v18/wallet/into.rs b/types/src/v18/wallet/into.rs index 1cb2c06e..41cb98cf 100644 --- a/types/src/v18/wallet/into.rs +++ b/types/src/v18/wallet/into.rs @@ -10,9 +10,10 @@ use bitcoin::{ use super::{ GetAddressInfo, GetAddressInfoEmbedded, GetAddressInfoEmbeddedError, GetAddressInfoError, - GetReceivedByLabel, ListReceivedByAddress, ListReceivedByAddressError, - ListReceivedByAddressItem, ListReceivedByLabel, ListReceivedByLabelError, - ListReceivedByLabelItem, ListUnspent, ListUnspentItem, ListUnspentItemError, + GetReceivedByLabel, GetWalletInfo, GetWalletInfoError, ListReceivedByAddress, + ListReceivedByAddressError, ListReceivedByAddressItem, ListReceivedByLabel, + ListReceivedByLabelError, ListReceivedByLabelItem, ListUnspent, ListUnspentItem, + ListUnspentItemError, }; use crate::model; @@ -166,6 +167,52 @@ impl GetReceivedByLabel { } } +impl GetWalletInfo { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use GetWalletInfoError as E; + + let wallet_version = crate::to_u32(self.wallet_version, "wallet_version")?; + let balance = Amount::from_btc(self.balance).map_err(E::Balance)?; + let unconfirmed_balance = + Amount::from_btc(self.unconfirmed_balance).map_err(E::UnconfirmedBalance)?; + let immature_balance = + Amount::from_btc(self.immature_balance).map_err(E::ImmatureBalance)?; + let tx_count = crate::to_u32(self.tx_count, "tx_count")?; + let keypool_oldest = crate::to_u32(self.keypool_oldest, "keypoo_oldest")?; + let keypool_size = crate::to_u32(self.keypool_size, "keypoo_size")?; + let keypool_size_hd_internal = + crate::to_u32(self.keypool_size_hd_internal, "keypoo_size_hd_internal")?; + let pay_tx_fee = crate::btc_per_kb(self.pay_tx_fee).map_err(E::PayTxFee)?; + let hd_seed_id = + self.hd_seed_id.map(|s| s.parse::()).transpose().map_err(E::HdSeedId)?; + + Ok(model::GetWalletInfo { + wallet_name: self.wallet_name, + wallet_version, + format: None, + balance, + unconfirmed_balance, + immature_balance, + tx_count, + keypool_oldest, + keypool_size, + keypool_size_hd_internal, + unlocked_until: self.unlocked_until, + pay_tx_fee, + hd_seed_id, + private_keys_enabled: self.private_keys_enabled, + avoid_reuse: None, + scanning: None, + descriptors: None, + external_signer: None, + blank: None, + birthtime: None, + last_processed_block: None, + }) + } +} + impl ListReceivedByAddress { /// Converts version specific type to a version nonspecific, more strongly typed type. pub fn into_model(self) -> Result { diff --git a/types/src/v18/wallet/mod.rs b/types/src/v18/wallet/mod.rs index 3c7f6859..b975a7f5 100644 --- a/types/src/v18/wallet/mod.rs +++ b/types/src/v18/wallet/mod.rs @@ -11,8 +11,8 @@ use serde::{Deserialize, Serialize}; pub use self::error::{GetAddressInfoError, ListReceivedByLabelError}; pub use super::{ - GetAddressInfoEmbeddedError, GetAddressInfoLabel, ListReceivedByAddressError, - ListUnspentItemError, ScriptType, + GetAddressInfoEmbeddedError, GetAddressInfoLabel, GetWalletInfoError, + ListReceivedByAddressError, ListUnspentItemError, ScriptType, }; /// Result of the JSON-RPC method `getaddressinfo`. @@ -152,6 +152,51 @@ pub struct GetAddressInfoEmbedded { #[serde(deny_unknown_fields)] pub struct GetReceivedByLabel(pub f64); +/// Result of the JSON-RPC method `getwalletinfo`. +/// +/// > getwalletinfo +/// > Returns an object containing various wallet state info. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetWalletInfo { + /// The wallet name. + #[serde(rename = "walletname")] + pub wallet_name: String, + /// The wallet version. + #[serde(rename = "walletversion")] + pub wallet_version: i64, + /// The total confirmed balance of the wallet in BTC. + pub balance: f64, + /// The total unconfirmed balance of the wallet in BTC. + pub unconfirmed_balance: f64, + /// The total immature balance of the wallet in BTC. + pub immature_balance: f64, + /// The total number of transactions in the wallet + #[serde(rename = "txcount")] + pub tx_count: i64, + /// The timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool. + #[serde(rename = "keypoololdest")] + pub keypool_oldest: i64, + /// How many new keys are pre-generated (only counts external keys). + #[serde(rename = "keypoolsize")] + pub keypool_size: i64, + /// How many new keys are pre-generated for internal use (used for change outputs, only appears + /// if the wallet is using this feature, otherwise external keys are used). + #[serde(rename = "keypoolsize_hd_internal")] + pub keypool_size_hd_internal: i64, + /// The timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked + /// for transfers, or 0 if the wallet is locked. + pub unlocked_until: Option, + /// The transaction fee configuration, set in BTC/kB. + #[serde(rename = "paytxfee")] + pub pay_tx_fee: f64, + /// The Hash160 of the HD seed (only present when HD is enabled). + #[serde(rename = "hdseedid")] + pub hd_seed_id: Option, + /// If privatekeys are disabled for this wallet (enforced watch-only wallet). + pub private_keys_enabled: bool, +} + /// Result of JSON-RPC method `importmulti`. /// /// > importmulti requests ( options ) diff --git a/types/src/v19/mod.rs b/types/src/v19/mod.rs index b33fde9b..5eb1b322 100644 --- a/types/src/v19/mod.rs +++ b/types/src/v19/mod.rs @@ -176,7 +176,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importmulti | version | | //! | importprivkey | returns nothing | | @@ -246,7 +246,7 @@ pub use self::{ util::GetDescriptorInfo, wallet::{ GetBalances, GetBalancesError, GetBalancesMine, GetBalancesWatchOnly, GetTransaction, - SetWalletFlag, + GetWalletInfo, GetWalletInfoScanning, SetWalletFlag, }, }; #[doc(inline)] @@ -268,17 +268,17 @@ pub use crate::v17::{ GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetail, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, - GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListBanned, - ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, - ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, - ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, - ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, Locked, - Logging, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, SetNetworkActive, - SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, - ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, + ListAddressGroupingsError, ListAddressGroupingsItem, ListBanned, ListLabels, ListLockUnspent, + ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, + ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, + ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, + ListWallets, LoadWallet, LockUnspent, Locked, Logging, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, + VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }; #[doc(inline)] diff --git a/types/src/v19/wallet/into.rs b/types/src/v19/wallet/into.rs index 905e218a..bb873068 100644 --- a/types/src/v19/wallet/into.rs +++ b/types/src/v19/wallet/into.rs @@ -6,7 +6,7 @@ use bitcoin::{Amount, BlockHash, SignedAmount, Transaction, Txid}; use super::{ GetBalances, GetBalancesError, GetBalancesMine, GetBalancesWatchOnly, GetTransaction, - GetTransactionError, + GetTransactionError, GetWalletInfo, GetWalletInfoError, GetWalletInfoScanning, }; use crate::model; @@ -103,3 +103,59 @@ impl GetTransaction { }) } } + +impl GetWalletInfo { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use GetWalletInfoError as E; + + let wallet_version = crate::to_u32(self.wallet_version, "wallet_version")?; + let balance = Amount::from_btc(self.balance).map_err(E::Balance)?; + let unconfirmed_balance = + Amount::from_btc(self.unconfirmed_balance).map_err(E::UnconfirmedBalance)?; + let immature_balance = + Amount::from_btc(self.immature_balance).map_err(E::ImmatureBalance)?; + let tx_count = crate::to_u32(self.tx_count, "tx_count")?; + let keypool_oldest = crate::to_u32(self.keypool_oldest, "keypoo_oldest")?; + let keypool_size = crate::to_u32(self.keypool_size, "keypoo_size")?; + let keypool_size_hd_internal = + crate::to_u32(self.keypool_size_hd_internal, "keypoo_size_hd_internal")?; + let pay_tx_fee = crate::btc_per_kb(self.pay_tx_fee).map_err(E::PayTxFee)?; + let hd_seed_id = self + .hd_seed_id + .map(|s| s.parse::()) + .transpose() + .map_err(E::HdSeedId)?; + + let scanning = match self.scanning { + GetWalletInfoScanning::Details { duration, progress } => + Some(model::GetWalletInfoScanning::Details { duration, progress }), + GetWalletInfoScanning::NotScanning(b) => + Some(model::GetWalletInfoScanning::NotScanning(b)), + }; + + Ok(model::GetWalletInfo { + wallet_name: self.wallet_name, + wallet_version, + format: None, + balance, + unconfirmed_balance, + immature_balance, + tx_count, + keypool_oldest, + keypool_size, + keypool_size_hd_internal, + unlocked_until: self.unlocked_until, + pay_tx_fee, + hd_seed_id, + private_keys_enabled: self.private_keys_enabled, + avoid_reuse: Some(self.avoid_reuse), + scanning, + descriptors: None, + external_signer: None, + blank: None, + birthtime: None, + last_processed_block: None, + }) + } +} diff --git a/types/src/v19/wallet/mod.rs b/types/src/v19/wallet/mod.rs index 1baaab23..9a48bec3 100644 --- a/types/src/v19/wallet/mod.rs +++ b/types/src/v19/wallet/mod.rs @@ -11,7 +11,7 @@ use bitcoin::Transaction; use serde::{Deserialize, Serialize}; pub use self::error::GetBalancesError; -use super::{Bip125Replaceable, GetTransactionDetail, GetTransactionError}; +use super::{Bip125Replaceable, GetTransactionDetail, GetTransactionError, GetWalletInfoError}; /// Result of the JSON-RPC method `getbalances`. /// @@ -107,6 +107,65 @@ pub struct GetTransaction { pub decoded: Option, } +/// Result of the JSON-RPC method `getwalletinfo`. +/// +/// > getwalletinfo +/// > Returns an object containing various wallet state info. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetWalletInfo { + /// The wallet name. + #[serde(rename = "walletname")] + pub wallet_name: String, + /// The wallet version. + #[serde(rename = "walletversion")] + pub wallet_version: i64, + /// The total confirmed balance of the wallet in BTC. (DEPRECATED) + pub balance: f64, + /// The total unconfirmed balance of the wallet in BTC. (DEPRECATED) + pub unconfirmed_balance: f64, + /// The total immature balance of the wallet in BTC. (DEPRECATED) + pub immature_balance: f64, + /// The total number of transactions in the wallet + #[serde(rename = "txcount")] + pub tx_count: i64, + /// The timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool. + #[serde(rename = "keypoololdest")] + pub keypool_oldest: i64, + /// How many new keys are pre-generated (only counts external keys). + #[serde(rename = "keypoolsize")] + pub keypool_size: i64, + /// How many new keys are pre-generated for internal use (used for change outputs, only appears + /// if the wallet is using this feature, otherwise external keys are used). + #[serde(rename = "keypoolsize_hd_internal")] + pub keypool_size_hd_internal: i64, + /// The timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked + /// for transfers, or 0 if the wallet is locked. + pub unlocked_until: Option, + /// The transaction fee configuration, set in BTC/kB. + #[serde(rename = "paytxfee")] + pub pay_tx_fee: f64, + /// The Hash160 of the HD seed (only present when HD is enabled). + #[serde(rename = "hdseedid")] + pub hd_seed_id: Option, + /// If privatekeys are disabled for this wallet (enforced watch-only wallet). + pub private_keys_enabled: bool, + /// Whether this wallet tracks clean/dirty coins in terms of reuse. + pub avoid_reuse: bool, + /// Current scanning details, or false if no scan is in progress. + pub scanning: GetWalletInfoScanning, +} + +/// The `scanning` field of `GetWalletInfo` in v19. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(untagged)] +pub enum GetWalletInfoScanning { + /// Scanning details. + Details { duration: u64, progress: f64 }, + /// Not scanning (false). + NotScanning(bool), +} + /// Result of the JSON-RPC method `setwalletflag`. /// /// > setwalletflag "flag" ( value ) diff --git a/types/src/v20/mod.rs b/types/src/v20/mod.rs index aaf45e22..954baf13 100644 --- a/types/src/v20/mod.rs +++ b/types/src/v20/mod.rs @@ -177,7 +177,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importmulti | version | | //! | importprivkey | returns nothing | | @@ -262,19 +262,18 @@ pub use crate::{ GetNewAddress, GetRawChangeAddress, GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, - GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, - ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, - ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, - ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, - ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, - Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendMany, SendRawTransaction, SendToAddress, - SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, - SignRawTransactionError, SoftforkReject, TestMempoolAccept, TransactionCategory, - UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, - VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, - WitnessUtxo, + GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, + ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, + ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, + ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, + ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, + ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, SendMany, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TestMempoolAccept, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -290,7 +289,8 @@ pub use crate::{ GetBlockFilterError, GetBlockchainInfo, GetBlockchainInfoError, GetChainTxStats, GetDescriptorInfo, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, GetMempoolDescendantsVerbose, GetMempoolEntry, GetMempoolInfo, GetNetworkInfo, GetPeerInfo, - GetRpcInfo, MapMempoolEntryError, MempoolEntry, MempoolEntryError, MempoolEntryFees, - MempoolEntryFeesError, PeerInfo, SetWalletFlag, Softfork, SoftforkType, + GetRpcInfo, GetWalletInfo, GetWalletInfoScanning, MapMempoolEntryError, MempoolEntry, + MempoolEntryError, MempoolEntryFees, MempoolEntryFeesError, PeerInfo, SetWalletFlag, + Softfork, SoftforkType, }, }; diff --git a/types/src/v21/mod.rs b/types/src/v21/mod.rs index 60e9a3d8..cb47427a 100644 --- a/types/src/v21/mod.rs +++ b/types/src/v21/mod.rs @@ -179,7 +179,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importdescriptors | version | | //! | importmulti | version | | @@ -255,8 +255,9 @@ pub use self::{ }, util::{GetIndexInfo, GetIndexInfoName}, wallet::{ - ImportDescriptors, ImportDescriptorsResult, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, - SendMany, SendManyVerbose, UnloadWallet, UpgradeWallet, + GetWalletInfo, GetWalletInfoScanning, ImportDescriptors, ImportDescriptorsResult, + PsbtBumpFee, PsbtBumpFeeError, Send, SendError, SendMany, SendManyVerbose, UnloadWallet, + UpgradeWallet, }, }; #[doc(inline)] @@ -278,18 +279,18 @@ pub use crate::{ GetNewAddress, GetRawChangeAddress, GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, - GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, - ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, - ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, - ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, - ListTransactionsItemError, ListUnspentItemError, ListWallets, LoadWallet, LockUnspent, - Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, - SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, - VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, + GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, + ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, + ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, + ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, + ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, + ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, + RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, + SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, + SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, + TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, + VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, + WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v21/wallet/into.rs b/types/src/v21/wallet/into.rs index b2c502fc..75c1a1d5 100644 --- a/types/src/v21/wallet/into.rs +++ b/types/src/v21/wallet/into.rs @@ -3,7 +3,8 @@ use bitcoin::{hex, Txid}; use super::{ - PsbtBumpFee, PsbtBumpFeeError, Send, SendError, SendMany, SendManyVerbose, UnloadWallet, + GetWalletInfo, GetWalletInfoError, GetWalletInfoScanning, PsbtBumpFee, PsbtBumpFeeError, Send, + SendError, SendMany, SendManyVerbose, UnloadWallet, }; use crate::model; @@ -62,3 +63,55 @@ impl SendManyVerbose { Ok(model::SendManyVerbose { txid, fee_reason: self.fee_reason }) } } + +impl GetWalletInfo { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use GetWalletInfoError as E; + + let wallet_version = crate::to_u32(self.wallet_version, "wallet_version")?; + let balance = bitcoin::Amount::from_btc(self.balance).map_err(E::Balance)?; + let unconfirmed_balance = + bitcoin::Amount::from_btc(self.unconfirmed_balance).map_err(E::UnconfirmedBalance)?; + let immature_balance = + bitcoin::Amount::from_btc(self.immature_balance).map_err(E::ImmatureBalance)?; + let tx_count = crate::to_u32(self.tx_count, "tx_count")?; + let keypool_oldest = crate::to_u32(self.keypool_oldest, "keypool_oldest")?; + let keypool_size = crate::to_u32(self.keypool_size, "keypool_size")?; + let keypool_size_hd_internal = + crate::to_u32(self.keypool_size_hd_internal, "keypool_size_hd_internal")?; + let pay_tx_fee = crate::btc_per_kb(self.pay_tx_fee).map_err(E::PayTxFee)?; + let hd_seed_id = self.hd_seed_id.map(|s| s.parse()).transpose().map_err(E::HdSeedId)?; + + let scanning = match self.scanning { + GetWalletInfoScanning::Details { duration, progress } => + Some(model::GetWalletInfoScanning::Details { duration, progress }), + GetWalletInfoScanning::NotScanning(b) => + Some(model::GetWalletInfoScanning::NotScanning(b)), + }; + + Ok(model::GetWalletInfo { + wallet_name: self.wallet_name, + wallet_version, + balance, + unconfirmed_balance, + immature_balance, + tx_count, + keypool_oldest, + keypool_size, + keypool_size_hd_internal, + unlocked_until: self.unlocked_until, + pay_tx_fee, + hd_seed_id, + private_keys_enabled: self.private_keys_enabled, + avoid_reuse: Some(self.avoid_reuse), + scanning, + format: Some(self.format), + descriptors: Some(self.descriptors), + external_signer: None, + blank: None, + birthtime: None, + last_processed_block: None, + }) + } +} diff --git a/types/src/v21/wallet/mod.rs b/types/src/v21/wallet/mod.rs index f56e619b..55cfbce8 100644 --- a/types/src/v21/wallet/mod.rs +++ b/types/src/v21/wallet/mod.rs @@ -10,6 +10,7 @@ mod into; use serde::{Deserialize, Serialize}; pub use self::error::{PsbtBumpFeeError, SendError}; +pub use super::GetWalletInfoError; /// Result of JSON-RPC method `importdescriptors`. /// @@ -170,3 +171,66 @@ pub struct UpgradeWallet { /// Error message (if there is one) pub error: Option, } + +/// Result of the JSON-RPC method `getwalletinfo`. +/// +/// > getwalletinfo +/// > Returns an object containing various wallet state info. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetWalletInfo { + /// The wallet name. + #[serde(rename = "walletname")] + pub wallet_name: String, + /// The wallet version. + #[serde(rename = "walletversion")] + pub wallet_version: i64, + /// The database format (bdb or sqlite). + pub format: String, + /// The total confirmed balance of the wallet in BTC. (DEPRECATED) + pub balance: f64, + /// The total unconfirmed balance of the wallet in BTC. (DEPRECATED) + pub unconfirmed_balance: f64, + /// The total immature balance of the wallet in BTC. (DEPRECATED) + pub immature_balance: f64, + /// The total number of transactions in the wallet + #[serde(rename = "txcount")] + pub tx_count: i64, + /// The UNIX epoch time of the oldest pre-generated key in the key pool. Legacy wallets only. + #[serde(rename = "keypoololdest")] + pub keypool_oldest: i64, + /// How many new keys are pre-generated (only counts external keys). + #[serde(rename = "keypoolsize")] + pub keypool_size: i64, + /// How many new keys are pre-generated for internal use (used for change outputs, only appears + /// if the wallet is using this feature, otherwise external keys are used). + #[serde(rename = "keypoolsize_hd_internal")] + pub keypool_size_hd_internal: i64, + /// The UNIX epoch time until which the wallet is unlocked for transfers, or 0 if the wallet is locked. + /// Only present for passphrase-encrypted wallets. + pub unlocked_until: Option, + /// The transaction fee configuration, set in BTC/kvB. + #[serde(rename = "paytxfee")] + pub pay_tx_fee: f64, + /// The Hash160 of the HD seed (only present when HD is enabled). + #[serde(rename = "hdseedid")] + pub hd_seed_id: Option, + /// If privatekeys are disabled for this wallet (enforced watch-only wallet). + pub private_keys_enabled: bool, + /// Whether this wallet tracks clean/dirty coins in terms of reuse. + pub avoid_reuse: bool, + /// Current scanning details, or false if no scan is in progress. + pub scanning: GetWalletInfoScanning, + /// Whether this wallet uses descriptors for scriptPubKey management. + pub descriptors: bool, +} + +/// The `scanning` field of the `getwalletinfo` RPC in v21. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(untagged)] +pub enum GetWalletInfoScanning { + /// Scanning details. + Details { duration: u64, progress: f64 }, + /// Not scanning (false). + NotScanning(bool), +} diff --git a/types/src/v22/mod.rs b/types/src/v22/mod.rs index 817437ad..c1a34376 100644 --- a/types/src/v22/mod.rs +++ b/types/src/v22/mod.rs @@ -188,7 +188,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importdescriptors | version | | //! | importmulti | version | | @@ -281,18 +281,17 @@ pub use crate::{ GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTransactionError, GetTxOut, GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, - GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, ListAddressGroupings, - ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, - ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, - ListSinceBlockError, ListSinceBlockTransaction, ListSinceBlockTransactionError, - ListTransactions, ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, - ListWallets, LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, - RawTransactionInput, RawTransactionOutput, RescanBlockchain, ScriptType, - SendRawTransaction, SendToAddress, SetNetworkActive, SetTxFee, SignMessage, - SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, SoftforkReject, - TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, - VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WalletProcessPsbt, WitnessUtxo, + GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, + ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, + ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, + ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, + LoadWallet, LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, + RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WalletProcessPsbt, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -315,9 +314,10 @@ pub use crate::{ v21::{ AddPeerAddress, Bip9SoftforkInfo, GenerateBlock, GetBlockchainInfo, GetIndexInfo, GetIndexInfoName, GetMempoolAncestors, GetMempoolAncestorsVerbose, GetMempoolDescendants, - GetMempoolDescendantsVerbose, GetMempoolEntry, GetNetworkInfo, ImportDescriptors, - ImportDescriptorsResult, MempoolEntry, PsbtBumpFee, PsbtBumpFeeError, Send, SendError, - SendMany, SendManyVerbose, Softfork, SoftforkType, UnloadWallet, UpgradeWallet, + GetMempoolDescendantsVerbose, GetMempoolEntry, GetNetworkInfo, GetWalletInfo, + GetWalletInfoScanning, ImportDescriptors, ImportDescriptorsResult, MempoolEntry, + PsbtBumpFee, PsbtBumpFeeError, Send, SendError, SendMany, SendManyVerbose, Softfork, + SoftforkType, UnloadWallet, UpgradeWallet, }, ScriptPubkey, }; diff --git a/types/src/v23/mod.rs b/types/src/v23/mod.rs index 5c4f9826..6745dad1 100644 --- a/types/src/v23/mod.rs +++ b/types/src/v23/mod.rs @@ -179,7 +179,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importdescriptors | version | | //! | importmulti | version | | @@ -258,7 +258,10 @@ pub use self::{ PsbtInput, PsbtOutput, }, util::CreateMultisig, - wallet::{AddMultisigAddress, GetTransaction, GetTransactionError, RestoreWallet}, + wallet::{ + AddMultisigAddress, GetTransaction, GetTransactionError, GetWalletInfo, + GetWalletInfoScanning, RestoreWallet, + }, }; #[doc(inline)] pub use crate::{ @@ -278,7 +281,7 @@ pub use crate::{ GetNetworkInfoError, GetNetworkInfoNetwork, GetNewAddress, GetRawChangeAddress, GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, - GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, + GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, diff --git a/types/src/v23/wallet/into.rs b/types/src/v23/wallet/into.rs index eca06854..899f9365 100644 --- a/types/src/v23/wallet/into.rs +++ b/types/src/v23/wallet/into.rs @@ -3,7 +3,10 @@ use bitcoin::consensus::encode; use bitcoin::{Address, BlockHash, ScriptBuf, SignedAmount, Transaction, Txid}; -use super::{AddMultisigAddress, AddMultisigAddressError, GetTransaction, GetTransactionError}; +use super::{ + AddMultisigAddress, AddMultisigAddressError, GetTransaction, GetTransactionError, + GetWalletInfo, GetWalletInfoError, GetWalletInfoScanning, +}; use crate::model; impl AddMultisigAddress { @@ -84,3 +87,58 @@ impl GetTransaction { }) } } + +impl GetWalletInfo { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use GetWalletInfoError as E; + + let wallet_version = crate::to_u32(self.wallet_version, "wallet_version")?; + let balance = bitcoin::Amount::from_btc(self.balance).map_err(E::Balance)?; + let unconfirmed_balance = + bitcoin::Amount::from_btc(self.unconfirmed_balance).map_err(E::UnconfirmedBalance)?; + let immature_balance = + bitcoin::Amount::from_btc(self.immature_balance).map_err(E::ImmatureBalance)?; + let tx_count = crate::to_u32(self.tx_count, "tx_count")?; + let keypool_oldest = + self.keypool_oldest.map(|v| crate::to_u32(v, "keypool_oldest")).transpose()?; + let keypool_size = crate::to_u32(self.keypool_size, "keypool_size")?; + let keypool_size_hd_internal = self + .keypool_size_hd_internal + .map(|v| crate::to_u32(v, "keypool_size_hd_internal")) + .transpose()?; + let pay_tx_fee = crate::btc_per_kb(self.pay_tx_fee).map_err(E::PayTxFee)?; + let hd_seed_id = self.hd_seed_id.map(|s| s.parse()).transpose().map_err(E::HdSeedId)?; + + let scanning = match self.scanning { + GetWalletInfoScanning::Details { duration, progress } => + Some(model::GetWalletInfoScanning::Details { duration, progress }), + GetWalletInfoScanning::NotScanning(b) => + Some(model::GetWalletInfoScanning::NotScanning(b)), + }; + + Ok(model::GetWalletInfo { + wallet_name: self.wallet_name, + wallet_version, + balance, + unconfirmed_balance, + immature_balance, + tx_count, + keypool_oldest: keypool_oldest.unwrap_or(0), + keypool_size, + keypool_size_hd_internal: keypool_size_hd_internal.unwrap_or(0), + unlocked_until: self.unlocked_until, + pay_tx_fee, + hd_seed_id, + private_keys_enabled: self.private_keys_enabled, + avoid_reuse: Some(self.avoid_reuse), + scanning, + format: Some(self.format), + descriptors: Some(self.descriptors), + external_signer: Some(self.external_signer), + blank: None, + birthtime: None, + last_processed_block: None, + }) + } +} diff --git a/types/src/v23/wallet/mod.rs b/types/src/v23/wallet/mod.rs index e6145c9d..f25d6fcc 100644 --- a/types/src/v23/wallet/mod.rs +++ b/types/src/v23/wallet/mod.rs @@ -13,6 +13,7 @@ use serde::{Deserialize, Serialize}; pub use self::error::GetTransactionError; pub use super::{ AddMultisigAddressError, Bip125Replaceable, GetTransactionDetail, GetTransactionDetailError, + GetWalletInfoError, }; /// Result of the JSON-RPC method `addmultisigaddress`. @@ -124,3 +125,67 @@ pub struct RestoreWallet { /// Warning message if wallet was not loaded cleanly. pub warning: Option, } + +/// Result of the JSON-RPC method `getwalletinfo`. +/// +/// > getwalletinfo +/// > +/// > Returns an object containing various wallet state info. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetWalletInfo { + /// the wallet name + #[serde(rename = "walletname")] + pub wallet_name: String, + /// the wallet version + #[serde(rename = "walletversion")] + pub wallet_version: i64, + /// the database format (bdb or sqlite) + pub format: String, + /// DEPRECATED. Identical to getbalances().mine.trusted + pub balance: f64, + /// DEPRECATED. Identical to getbalances().mine.untrusted_pending + pub unconfirmed_balance: f64, + /// DEPRECATED. Identical to getbalances().mine.immature + pub immature_balance: f64, + /// the total number of transactions in the wallet + #[serde(rename = "txcount")] + pub tx_count: i64, + /// the UNIX epoch time of the oldest pre-generated key in the key pool. Legacy wallets only. + #[serde(rename = "keypoololdest")] + pub keypool_oldest: Option, + /// how many new keys are pre-generated (only counts external keys) + #[serde(rename = "keypoolsize")] + pub keypool_size: i64, + /// how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used) + #[serde(rename = "keypoolsize_hd_internal")] + pub keypool_size_hd_internal: Option, + /// the UNIX epoch time until which the wallet is unlocked for transfers, or 0 if the wallet is locked (only present for passphrase-encrypted wallets) + pub unlocked_until: Option, + /// the transaction fee configuration, set in BTC/kvB + #[serde(rename = "paytxfee")] + pub pay_tx_fee: f64, + /// the Hash160 of the HD seed (only present when HD is enabled) + #[serde(rename = "hdseedid")] + pub hd_seed_id: Option, + /// false if privatekeys are disabled for this wallet (enforced watch-only wallet) + pub private_keys_enabled: bool, + /// whether this wallet tracks clean/dirty coins in terms of reuse + pub avoid_reuse: bool, + /// current scanning details, or false if no scan is in progress + pub scanning: GetWalletInfoScanning, + /// whether this wallet uses descriptors for scriptPubKey management + pub descriptors: bool, + /// whether this wallet is configured to use an external signer such as a hardware wallet + pub external_signer: bool, +} + +/// The `scanning` field of the `getwalletinfo` RPC in v23. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(untagged)] +pub enum GetWalletInfoScanning { + /// Scanning details. + Details { duration: u64, progress: f64 }, + /// Not scanning (false). + NotScanning(bool), +} diff --git a/types/src/v24/mod.rs b/types/src/v24/mod.rs index 65107af2..bf630f9b 100644 --- a/types/src/v24/mod.rs +++ b/types/src/v24/mod.rs @@ -180,7 +180,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importdescriptors | version | | //! | importmulti | version | | @@ -280,7 +280,7 @@ pub use crate::{ GetNetworkInfoError, GetNetworkInfoNetwork, GetNewAddress, GetRawChangeAddress, GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, - GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, + GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, @@ -321,6 +321,7 @@ pub use crate::{ v23::{ AddMultisigAddress, Bip9Info, Bip9Statistics, CreateMultisig, DecodeScript, DecodeScriptError, DeploymentInfo, GetBlockchainInfo, GetDeploymentInfo, - GetDeploymentInfoError, Logging, RestoreWallet, SaveMempool, + GetDeploymentInfoError, GetWalletInfo, GetWalletInfoScanning, Logging, RestoreWallet, + SaveMempool, }, }; diff --git a/types/src/v25/mod.rs b/types/src/v25/mod.rs index 6544f89b..87ff2b85 100644 --- a/types/src/v25/mod.rs +++ b/types/src/v25/mod.rs @@ -181,7 +181,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importdescriptors | version | | //! | importmulti | version | | @@ -276,7 +276,7 @@ pub use crate::{ GetNetworkInfoError, GetNetworkInfoNetwork, GetNewAddress, GetRawChangeAddress, GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, - GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfo, + GetTxOutError, GetTxOutSetInfo, GetTxOutSetInfoError, GetUnconfirmedBalance, GetWalletInfoError, ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, @@ -316,7 +316,7 @@ pub use crate::{ v23::{ AddMultisigAddress, Bip9Info, Bip9Statistics, CreateMultisig, DecodeScript, DecodeScriptError, DeploymentInfo, GetBlockchainInfo, GetDeploymentInfo, - GetDeploymentInfoError, RestoreWallet, SaveMempool, + GetDeploymentInfoError, GetWalletInfo, GetWalletInfoScanning, RestoreWallet, SaveMempool, }, v24::{ DecodePsbt, DecodePsbtError, GetMempoolAncestors, GetMempoolAncestorsVerbose, diff --git a/types/src/v26/mod.rs b/types/src/v26/mod.rs index 4b7f9171..6f3fbbc6 100644 --- a/types/src/v26/mod.rs +++ b/types/src/v26/mod.rs @@ -189,7 +189,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importdescriptors | version | | //! | importmulti | version | | @@ -271,7 +271,8 @@ pub use self::{ }, wallet::{ CreateWallet, GetBalances, GetBalancesError, GetTransaction, GetTransactionError, - LastProcessedBlock, LastProcessedBlockError, LoadWallet, UnloadWallet, WalletProcessPsbt, + GetWalletInfo, GetWalletInfoError, GetWalletInfoScanning, LastProcessedBlock, + LastProcessedBlockError, LoadWallet, UnloadWallet, WalletProcessPsbt, }, }; #[doc(inline)] @@ -292,18 +293,17 @@ pub use crate::{ GetNetworkInfoError, GetNetworkInfoNetwork, GetNewAddress, GetRawChangeAddress, GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, - GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, - ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, - ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, - ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, - ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, - PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, - SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, - VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WitnessUtxo, + GetTxOutError, GetUnconfirmedBalance, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, + ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, + ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, + ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, + LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, + RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, diff --git a/types/src/v26/wallet/error.rs b/types/src/v26/wallet/error.rs index 75dbe8d0..ef22b2a7 100644 --- a/types/src/v26/wallet/error.rs +++ b/types/src/v26/wallet/error.rs @@ -132,6 +132,63 @@ impl From for GetTransactionError { fn from(e: NumericError) -> Self { Self::Numeric(e) } } +/// Error when converting a `GetWalletInfo` type into the model type. +#[derive(Debug)] +pub enum GetWalletInfoError { + /// Conversion of numeric type to expected type failed. + Numeric(NumericError), + /// Conversion of the `balance` field failed. + Balance(ParseAmountError), + /// Conversion of the `unconfirmed_balance` field failed. + UnconfirmedBalance(ParseAmountError), + /// Conversion of the `immature_balance` field failed. + ImmatureBalance(ParseAmountError), + /// Conversion of the `pay_tx_fee` field failed. + PayTxFee(ParseAmountError), + /// Conversion of the `hd_seed_id` field failed. + HdSeedId(hex::HexToArrayError), + /// Conversion of the `last_processed_block` field failed. + LastProcessedBlock(LastProcessedBlockError), +} + +impl fmt::Display for GetWalletInfoError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use GetWalletInfoError::*; + match *self { + Numeric(ref e) => write_err!(f, "numeric"; e), + Balance(ref e) => write_err!(f, "conversion of the `balance` field failed"; e), + UnconfirmedBalance(ref e) => + write_err!(f, "conversion of the `unconfirmed_balance` field failed"; e), + ImmatureBalance(ref e) => + write_err!(f, "conversion of the `immature_balance` field failed"; e), + PayTxFee(ref e) => write_err!(f, "conversion of the `pay_tx_fee` field failed"; e), + HdSeedId(ref e) => write_err!(f, "conversion of the `hd_seed_id` field failed"; e), + LastProcessedBlock(ref e) => + write_err!(f, "conversion of the `last_processed_block` field failed"; e), + } + } +} + +#[cfg(feature = "std")] +impl std::error::Error for GetWalletInfoError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + use GetWalletInfoError::*; + match *self { + Numeric(ref e) => Some(e), + Balance(ref e) => Some(e), + UnconfirmedBalance(ref e) => Some(e), + ImmatureBalance(ref e) => Some(e), + PayTxFee(ref e) => Some(e), + HdSeedId(ref e) => Some(e), + LastProcessedBlock(ref e) => Some(e), + } + } +} + +impl From for GetWalletInfoError { + fn from(e: NumericError) -> Self { Self::Numeric(e) } +} + /// Error when converting a `LastProcessedBlock` type into the model type. #[derive(Debug)] pub enum LastProcessedBlockError { diff --git a/types/src/v26/wallet/into.rs b/types/src/v26/wallet/into.rs index 706d71e0..a7b449b6 100644 --- a/types/src/v26/wallet/into.rs +++ b/types/src/v26/wallet/into.rs @@ -5,8 +5,8 @@ use bitcoin::{BlockHash, Psbt, SignedAmount, Transaction, Txid}; use super::{ CreateWallet, GetBalances, GetBalancesError, GetTransaction, GetTransactionError, - LastProcessedBlock, LastProcessedBlockError, LoadWallet, UnloadWallet, WalletProcessPsbt, - WalletProcessPsbtError, + GetWalletInfo, GetWalletInfoError, GetWalletInfoScanning, LastProcessedBlock, + LastProcessedBlockError, LoadWallet, UnloadWallet, WalletProcessPsbt, WalletProcessPsbtError, }; use crate::model; @@ -109,6 +109,66 @@ impl GetTransaction { } } +impl GetWalletInfo { + /// Converts version specific type to a version nonspecific, more strongly typed type. + pub fn into_model(self) -> Result { + use GetWalletInfoError as E; + + let wallet_version = crate::to_u32(self.wallet_version, "wallet_version")?; + let balance = bitcoin::Amount::from_btc(self.balance).map_err(E::Balance)?; + let unconfirmed_balance = + bitcoin::Amount::from_btc(self.unconfirmed_balance).map_err(E::UnconfirmedBalance)?; + let immature_balance = + bitcoin::Amount::from_btc(self.immature_balance).map_err(E::ImmatureBalance)?; + let tx_count = crate::to_u32(self.tx_count, "tx_count")?; + let keypool_oldest = + self.keypool_oldest.map(|v| crate::to_u32(v, "keypool_oldest")).transpose()?; + let keypool_size = crate::to_u32(self.keypool_size, "keypool_size")?; + let keypool_size_hd_internal = self + .keypool_size_hd_internal + .map(|v| crate::to_u32(v, "keypool_size_hd_internal")) + .transpose()?; + let pay_tx_fee = crate::btc_per_kb(self.pay_tx_fee).map_err(E::PayTxFee)?; + let hd_seed_id = self.hd_seed_id.map(|s| s.parse()).transpose().map_err(E::HdSeedId)?; + let last_processed_block = self + .last_processed_block + .map(|l| l.into_model()) + .transpose() + .map_err(E::LastProcessedBlock)?; + + let scanning = match self.scanning { + GetWalletInfoScanning::Details { duration, progress } => + Some(model::GetWalletInfoScanning::Details { duration, progress }), + GetWalletInfoScanning::NotScanning(b) => + Some(model::GetWalletInfoScanning::NotScanning(b)), + }; + + Ok(model::GetWalletInfo { + wallet_name: self.wallet_name, + wallet_version, + format: Some(self.format), + balance, + unconfirmed_balance, + immature_balance, + tx_count, + keypool_oldest: keypool_oldest.unwrap_or(0), + keypool_size, + keypool_size_hd_internal: keypool_size_hd_internal.unwrap_or(0), + unlocked_until: self.unlocked_until, + pay_tx_fee, + hd_seed_id, + private_keys_enabled: self.private_keys_enabled, + avoid_reuse: Some(self.avoid_reuse), + scanning, + descriptors: Some(self.descriptors), + external_signer: Some(self.external_signer), + blank: Some(self.blank), + birthtime: self.birthtime, + last_processed_block, + }) + } +} + impl LastProcessedBlock { /// Converts version specific type to a version nonspecific, more strongly typed type. pub fn into_model(self) -> Result { diff --git a/types/src/v26/wallet/mod.rs b/types/src/v26/wallet/mod.rs index 92ea8c2b..1ee68e22 100644 --- a/types/src/v26/wallet/mod.rs +++ b/types/src/v26/wallet/mod.rs @@ -11,7 +11,8 @@ use bitcoin::Transaction; use serde::{Deserialize, Serialize}; pub use self::error::{ - GetBalancesError, GetTransactionError, LastProcessedBlockError, WalletProcessPsbtError, + GetBalancesError, GetTransactionError, GetWalletInfoError, LastProcessedBlockError, + WalletProcessPsbtError, }; pub use super::{ Bip125Replaceable, GetBalancesMine, GetBalancesWatchOnly, GetTransactionDetail, @@ -145,6 +146,77 @@ pub struct LastProcessedBlock { pub height: i64, } +/// Result of the JSON-RPC method `getwalletinfo`. +/// +/// > getwalletinfo +/// > +/// > Returns an object containing various wallet state info. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] +pub struct GetWalletInfo { + /// the wallet name + #[serde(rename = "walletname")] + pub wallet_name: String, + /// the wallet version + #[serde(rename = "walletversion")] + pub wallet_version: i64, + /// the database format (bdb or sqlite) + pub format: String, + /// DEPRECATED. Identical to getbalances().mine.trusted + pub balance: f64, + /// DEPRECATED. Identical to getbalances().mine.untrusted_pending + pub unconfirmed_balance: f64, + /// DEPRECATED. Identical to getbalances().mine.immature + pub immature_balance: f64, + /// the total number of transactions in the wallet + #[serde(rename = "txcount")] + pub tx_count: i64, + /// the UNIX epoch time of the oldest pre-generated key in the key pool. Legacy wallets only. + #[serde(rename = "keypoololdest")] + pub keypool_oldest: Option, + /// how many new keys are pre-generated (only counts external keys) + #[serde(rename = "keypoolsize")] + pub keypool_size: i64, + /// how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used) + #[serde(rename = "keypoolsize_hd_internal")] + pub keypool_size_hd_internal: Option, + /// the UNIX epoch time until which the wallet is unlocked for transfers, or 0 if the wallet is locked (only present for passphrase-encrypted wallets) + pub unlocked_until: Option, + /// the transaction fee configuration, set in BTC/kvB + #[serde(rename = "paytxfee")] + pub pay_tx_fee: f64, + /// the Hash160 of the HD seed (only present when HD is enabled) + #[serde(rename = "hdseedid")] + pub hd_seed_id: Option, + /// false if privatekeys are disabled for this wallet (enforced watch-only wallet) + pub private_keys_enabled: bool, + /// whether this wallet tracks clean/dirty coins in terms of reuse + pub avoid_reuse: bool, + /// current scanning details, or false if no scan is in progress + pub scanning: GetWalletInfoScanning, + /// whether this wallet uses descriptors for scriptPubKey management + pub descriptors: bool, + /// whether this wallet is configured to use an external signer such as a hardware wallet + pub external_signer: bool, + /// Whether this wallet intentionally does not contain any keys, scripts, or descriptors + pub blank: bool, + /// The start time for blocks scanning. It could be modified by (re)importing any descriptor with an earlier timestamp. + pub birthtime: Option, + /// hash and height of the block this information was generated on + #[serde(rename = "lastprocessedblock")] + pub last_processed_block: Option, +} + +/// The `scanning` field of the `getwalletinfo` RPC in v26. +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[serde(untagged)] +pub enum GetWalletInfoScanning { + /// Scanning details. + Details { duration: u64, progress: f64 }, + /// Not scanning (false). + NotScanning(bool), +} + /// Result of the JSON-RPC method `loadwallet`. /// /// > loadwallet "filename" ( load_on_startup ) diff --git a/types/src/v27/mod.rs b/types/src/v27/mod.rs index dba753f1..a9975dea 100644 --- a/types/src/v27/mod.rs +++ b/types/src/v27/mod.rs @@ -189,7 +189,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importdescriptors | version | | //! | importmulti | version | | @@ -270,18 +270,17 @@ pub use crate::{ GetNetworkInfoError, GetNetworkInfoNetwork, GetNewAddress, GetRawChangeAddress, GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, - GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, - ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, - ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, - ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, - ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, - PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, - SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, - VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WitnessUtxo, + GetTxOutError, GetUnconfirmedBalance, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, + ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, + ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, + ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, + LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, + RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -328,9 +327,10 @@ pub use crate::{ AddrManInfoNetwork, ChainState, CreateWallet, DescriptorProcessPsbt, DescriptorProcessPsbtError, DumpTxOutSet, DumpTxOutSetError, GetAddrManInfo, GetBalances, GetBalancesError, GetChainStates, GetChainStatesError, GetPeerInfo, GetTransaction, - GetTransactionError, GetTxOutSetInfo, GetTxOutSetInfoError, LastProcessedBlock, - LastProcessedBlockError, LoadTxOutSet, LoadTxOutSetError, LoadWallet, Logging, PeerInfo, - SubmitPackage, SubmitPackageError, SubmitPackageTxResult, SubmitPackageTxResultError, + GetTransactionError, GetTxOutSetInfo, GetTxOutSetInfoError, GetWalletInfo, + GetWalletInfoError, GetWalletInfoScanning, LastProcessedBlock, LastProcessedBlockError, + LoadTxOutSet, LoadTxOutSetError, LoadWallet, Logging, PeerInfo, SubmitPackage, + SubmitPackageError, SubmitPackageTxResult, SubmitPackageTxResultError, SubmitPackageTxResultFees, SubmitPackageTxResultFeesError, UnloadWallet, WalletProcessPsbt, }, }; diff --git a/types/src/v28/mod.rs b/types/src/v28/mod.rs index 45488be8..9f748051 100644 --- a/types/src/v28/mod.rs +++ b/types/src/v28/mod.rs @@ -191,7 +191,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importdescriptors | version | | //! | importmulti | version | | @@ -290,18 +290,17 @@ pub use crate::{ GetNetworkInfoNetwork, GetNewAddress, GetRawChangeAddress, GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, - GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, - ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, - ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, - ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, - ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, - PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, - SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - SoftforkReject, TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, - VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, - WalletCreateFundedPsbtError, WitnessUtxo, + GetTxOutError, GetUnconfirmedBalance, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, + ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, + ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, + ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, + LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, + RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, SoftforkReject, TransactionCategory, UploadTarget, + ValidateAddress, ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, + WalletCreateFundedPsbt, WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -347,8 +346,9 @@ pub use crate::{ AddrManInfoNetwork, ChainState, CreateWallet, DescriptorProcessPsbt, DescriptorProcessPsbtError, DumpTxOutSet, DumpTxOutSetError, GetAddrManInfo, GetBalances, GetBalancesError, GetChainStates, GetChainStatesError, GetPeerInfo, GetTransactionError, - GetTxOutSetInfo, GetTxOutSetInfoError, LastProcessedBlock, LastProcessedBlockError, - LoadTxOutSet, LoadTxOutSetError, LoadWallet, PeerInfo, UnloadWallet, WalletProcessPsbt, + GetTxOutSetInfo, GetTxOutSetInfoError, GetWalletInfo, GetWalletInfoError, + GetWalletInfoScanning, LastProcessedBlock, LastProcessedBlockError, LoadTxOutSet, + LoadTxOutSetError, LoadWallet, PeerInfo, UnloadWallet, WalletProcessPsbt, }, v27::{GetPrioritisedTransactions, PrioritisedTransaction}, }; diff --git a/types/src/v29/mod.rs b/types/src/v29/mod.rs index 3039daea..56fc8a63 100644 --- a/types/src/v29/mod.rs +++ b/types/src/v29/mod.rs @@ -192,7 +192,7 @@ //! | getreceivedbylabel | version + model | | //! | gettransaction | version + model | | //! | getunconfirmedbalance | version + model | | -//! | getwalletinfo | version + model | UNTESTED | +//! | getwalletinfo | version + model | | //! | importaddress | returns nothing | | //! | importdescriptors | version | | //! | importmulti | version | | @@ -287,18 +287,17 @@ pub use crate::{ GetNetworkInfoError, GetNetworkInfoNetwork, GetNewAddress, GetRawChangeAddress, GetRawMempool, GetRawMempoolVerbose, GetRawTransaction, GetRawTransactionVerbose, GetRawTransactionVerboseError, GetReceivedByAddress, GetTransactionDetailError, GetTxOut, - GetTxOutError, GetUnconfirmedBalance, GetWalletInfo, GetWalletInfoError, - ListAddressGroupings, ListAddressGroupingsError, ListAddressGroupingsItem, ListLabels, - ListLockUnspent, ListLockUnspentItem, ListLockUnspentItemError, ListReceivedByAddressError, - ListSinceBlock, ListSinceBlockError, ListSinceBlockTransaction, - ListSinceBlockTransactionError, ListTransactions, ListTransactionsItem, - ListTransactionsItemError, ListUnspentItemError, ListWallets, LockUnspent, Locked, - PruneBlockchain, RawTransactionError, RawTransactionInput, RawTransactionOutput, - RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, SetNetworkActive, - SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, SignRawTransactionError, - TransactionCategory, UploadTarget, ValidateAddress, ValidateAddressError, VerifyChain, - VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, WalletCreateFundedPsbtError, - WitnessUtxo, + GetTxOutError, GetUnconfirmedBalance, ListAddressGroupings, ListAddressGroupingsError, + ListAddressGroupingsItem, ListLabels, ListLockUnspent, ListLockUnspentItem, + ListLockUnspentItemError, ListReceivedByAddressError, ListSinceBlock, ListSinceBlockError, + ListSinceBlockTransaction, ListSinceBlockTransactionError, ListTransactions, + ListTransactionsItem, ListTransactionsItemError, ListUnspentItemError, ListWallets, + LockUnspent, Locked, PruneBlockchain, RawTransactionError, RawTransactionInput, + RawTransactionOutput, RescanBlockchain, ScriptType, SendRawTransaction, SendToAddress, + SetNetworkActive, SetTxFee, SignMessage, SignMessageWithPrivKey, SignRawTransaction, + SignRawTransactionError, TransactionCategory, UploadTarget, ValidateAddress, + ValidateAddressError, VerifyChain, VerifyMessage, VerifyTxOutProof, WalletCreateFundedPsbt, + WalletCreateFundedPsbtError, WitnessUtxo, }, v18::{ ActiveCommand, AnalyzePsbt, AnalyzePsbtError, AnalyzePsbtInput, AnalyzePsbtInputMissing, @@ -343,9 +342,9 @@ pub use crate::{ v26::{ AddrManInfoNetwork, CreateWallet, DescriptorProcessPsbt, DescriptorProcessPsbtError, DumpTxOutSet, DumpTxOutSetError, GetAddrManInfo, GetBalances, GetBalancesError, - GetPeerInfo, GetTransactionError, GetTxOutSetInfo, GetTxOutSetInfoError, - LastProcessedBlock, LastProcessedBlockError, LoadTxOutSet, LoadTxOutSetError, LoadWallet, - PeerInfo, UnloadWallet, WalletProcessPsbt, + GetPeerInfo, GetTransactionError, GetTxOutSetInfo, GetTxOutSetInfoError, GetWalletInfo, + GetWalletInfoError, GetWalletInfoScanning, LastProcessedBlock, LastProcessedBlockError, + LoadTxOutSet, LoadTxOutSetError, LoadWallet, PeerInfo, UnloadWallet, WalletProcessPsbt, }, v27::{GetPrioritisedTransactions, PrioritisedTransaction}, v28::{