Skip to content

Commit 1a524eb

Browse files
committed
Merge #237: Add missing v18 wallet methods
ef5dda8 Run the formatter (Jamil Lambert, PhD) 46760cd Add missing v18 wallet methods (Jamil Lambert, PhD) Pull request description: Add `getreceivedbylabel`, `listreceivedbylabel` and `getdescriptorinfo` methods, models and tests. ACKs for top commit: tcharding: ACK ef5dda8 Tree-SHA512: aa2869bc1d3d88fda60a18aa34a60ade068ba8199143de97963b58deb029de72b0e5406f652d4c70ca8e2806fda78ef613a07c2d9a5857cde503c17dfb321ab8
2 parents adc694b + ef5dda8 commit 1a524eb

File tree

31 files changed

+368
-68
lines changed

31 files changed

+368
-68
lines changed

client/src/client_sync/v18/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub mod mining;
99
pub mod network;
1010
pub mod raw_transactions;
1111
pub mod util;
12+
pub mod wallet;
1213

1314
use std::collections::BTreeMap;
1415
use std::path::Path;
@@ -133,6 +134,7 @@ crate::impl_client_v17__get_balance!();
133134
crate::impl_client_v17__get_new_address!();
134135
crate::impl_client_v17__get_raw_change_address!();
135136
crate::impl_client_v17__get_received_by_address!();
137+
crate::impl_client_v18__get_received_by_label!();
136138
crate::impl_client_v17__get_transaction!();
137139
crate::impl_client_v17__get_unconfirmed_balance!();
138140
crate::impl_client_v17__get_wallet_info!();
@@ -141,10 +143,12 @@ crate::impl_client_v17__list_address_groupings!();
141143
crate::impl_client_v17__list_labels!();
142144
crate::impl_client_v17__list_lock_unspent!();
143145
crate::impl_client_v17__list_received_by_address!();
146+
crate::impl_client_v18__list_received_by_label!();
144147
crate::impl_client_v17__list_since_block!();
145148
crate::impl_client_v17__list_transactions!();
146149
crate::impl_client_v17__list_unspent!();
147150
crate::impl_client_v17__list_wallets!();
151+
crate::impl_client_v18__list_wallet_dir!();
148152
crate::impl_client_v17__load_wallet!();
149153
crate::impl_client_v17__rescan_blockchain!();
150154
crate::impl_client_v17__send_many!();

client/src/client_sync/v18/wallet.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// SPDX-License-Identifier: CC0-1.0
2+
3+
//! Macros for implementing JSON-RPC methods on a client.
4+
//!
5+
//! Specifically this is methods found under the `== Wallet ==` section of the
6+
//! API docs of Bitcoin Core `v0.18`.
7+
//!
8+
//! All macros require `Client` to be in scope.
9+
//!
10+
//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`.
11+
/// Implements Bitcoin Core JSON-RPC API method `getreceivedbylabel`.
12+
#[macro_export]
13+
macro_rules! impl_client_v18__get_received_by_label {
14+
() => {
15+
impl Client {
16+
pub fn get_received_by_label(&self, label: &str) -> Result<GetReceivedByLabel> {
17+
self.call("getreceivedbylabel", &[label.into()])
18+
}
19+
}
20+
};
21+
}
22+
23+
/// Implements Bitcoin Core JSON-RPC API method `listreceivedbylabel`.
24+
#[macro_export]
25+
macro_rules! impl_client_v18__list_received_by_label {
26+
() => {
27+
impl Client {
28+
pub fn list_received_by_label(&self) -> Result<ListReceivedByLabel> {
29+
self.call("listreceivedbylabel", &[])
30+
}
31+
}
32+
};
33+
}
34+
35+
/// Implements Bitcoin Core JSON-RPC API method `listwalletdir`.
36+
#[macro_export]
37+
macro_rules! impl_client_v18__list_wallet_dir {
38+
() => {
39+
impl Client {
40+
pub fn list_wallet_dir(&self) -> Result<ListWalletDir> {
41+
self.call("listwalletdir", &[])
42+
}
43+
}
44+
};
45+
}

client/src/client_sync/v19/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ crate::impl_client_v17__get_addresses_by_label!();
127127
crate::impl_client_v17__get_address_info!();
128128
crate::impl_client_v17__get_balance!();
129129
crate::impl_client_v19__get_balances!();
130+
crate::impl_client_v18__get_received_by_label!();
130131
crate::impl_client_v17__get_new_address!();
131132
crate::impl_client_v17__get_raw_change_address!();
132133
crate::impl_client_v17__get_received_by_address!();
@@ -135,12 +136,14 @@ crate::impl_client_v17__get_unconfirmed_balance!();
135136
crate::impl_client_v17__get_wallet_info!();
136137
crate::impl_client_v17__import_privkey!();
137138
crate::impl_client_v17__list_address_groupings!();
139+
crate::impl_client_v18__list_received_by_label!();
138140
crate::impl_client_v17__list_labels!();
139141
crate::impl_client_v17__list_lock_unspent!();
140142
crate::impl_client_v17__list_received_by_address!();
141143
crate::impl_client_v17__list_since_block!();
142144
crate::impl_client_v17__list_transactions!();
143145
crate::impl_client_v17__list_unspent!();
146+
crate::impl_client_v18__list_wallet_dir!();
144147
crate::impl_client_v17__list_wallets!();
145148
crate::impl_client_v17__load_wallet!();
146149
crate::impl_client_v17__rescan_blockchain!();

client/src/client_sync/v20/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ crate::impl_client_v17__dump_wallet!();
123123
crate::impl_client_v17__get_addresses_by_label!();
124124
crate::impl_client_v17__get_address_info!();
125125
crate::impl_client_v17__get_balance!();
126+
crate::impl_client_v18__get_received_by_label!();
126127
crate::impl_client_v19__get_balances!();
127128
crate::impl_client_v17__get_new_address!();
128129
crate::impl_client_v17__get_raw_change_address!();
@@ -133,11 +134,13 @@ crate::impl_client_v17__get_wallet_info!();
133134
crate::impl_client_v17__import_privkey!();
134135
crate::impl_client_v17__list_address_groupings!();
135136
crate::impl_client_v17__list_labels!();
137+
crate::impl_client_v18__list_received_by_label!();
136138
crate::impl_client_v17__list_lock_unspent!();
137139
crate::impl_client_v17__list_received_by_address!();
138140
crate::impl_client_v17__list_since_block!();
139141
crate::impl_client_v17__list_transactions!();
140142
crate::impl_client_v17__list_unspent!();
143+
crate::impl_client_v18__list_wallet_dir!();
141144
crate::impl_client_v17__list_wallets!();
142145
crate::impl_client_v17__load_wallet!();
143146
crate::impl_client_v17__rescan_blockchain!();

client/src/client_sync/v21/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ crate::impl_client_v17__bump_fee!();
122122
crate::impl_client_v17__create_wallet!();
123123
crate::impl_client_v17__dump_priv_key!();
124124
crate::impl_client_v17__dump_wallet!();
125+
crate::impl_client_v18__get_received_by_label!();
125126
crate::impl_client_v17__get_addresses_by_label!();
126127
crate::impl_client_v17__get_address_info!();
127128
crate::impl_client_v17__get_balance!();
@@ -135,11 +136,13 @@ crate::impl_client_v17__get_wallet_info!();
135136
crate::impl_client_v17__import_privkey!();
136137
crate::impl_client_v17__list_address_groupings!();
137138
crate::impl_client_v17__list_labels!();
139+
crate::impl_client_v18__list_received_by_label!();
138140
crate::impl_client_v17__list_lock_unspent!();
139141
crate::impl_client_v17__list_received_by_address!();
140142
crate::impl_client_v17__list_since_block!();
141143
crate::impl_client_v17__list_transactions!();
142144
crate::impl_client_v17__list_unspent!();
145+
crate::impl_client_v18__list_wallet_dir!();
143146
crate::impl_client_v17__list_wallets!();
144147
crate::impl_client_v17__load_wallet!();
145148
crate::impl_client_v17__rescan_blockchain!();

client/src/client_sync/v22/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ crate::impl_client_v17__bump_fee!();
122122
crate::impl_client_v17__create_wallet!();
123123
crate::impl_client_v17__dump_priv_key!();
124124
crate::impl_client_v17__dump_wallet!();
125+
crate::impl_client_v18__get_received_by_label!();
125126
crate::impl_client_v17__get_addresses_by_label!();
126127
crate::impl_client_v17__get_address_info!();
127128
crate::impl_client_v17__get_balance!();
@@ -134,12 +135,14 @@ crate::impl_client_v17__get_unconfirmed_balance!();
134135
crate::impl_client_v17__get_wallet_info!();
135136
crate::impl_client_v17__import_privkey!();
136137
crate::impl_client_v17__list_address_groupings!();
138+
crate::impl_client_v18__list_received_by_label!();
137139
crate::impl_client_v17__list_labels!();
138140
crate::impl_client_v17__list_lock_unspent!();
139141
crate::impl_client_v17__list_received_by_address!();
140142
crate::impl_client_v17__list_since_block!();
141143
crate::impl_client_v17__list_transactions!();
142144
crate::impl_client_v17__list_unspent!();
145+
crate::impl_client_v18__list_wallet_dir!();
143146
crate::impl_client_v17__list_wallets!();
144147
crate::impl_client_v17__load_wallet!();
145148
crate::impl_client_v17__rescan_blockchain!();

client/src/client_sync/v23/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ crate::impl_client_v17__get_addresses_by_label!();
128128
crate::impl_client_v17__get_address_info!();
129129
crate::impl_client_v17__get_balance!();
130130
crate::impl_client_v19__get_balances!();
131+
crate::impl_client_v18__get_received_by_label!();
131132
crate::impl_client_v17__get_new_address!();
132133
crate::impl_client_v17__get_raw_change_address!();
133134
crate::impl_client_v17__get_received_by_address!();
@@ -136,12 +137,14 @@ crate::impl_client_v17__get_unconfirmed_balance!();
136137
crate::impl_client_v17__get_wallet_info!();
137138
crate::impl_client_v17__import_privkey!();
138139
crate::impl_client_v17__list_address_groupings!();
140+
crate::impl_client_v18__list_received_by_label!();
139141
crate::impl_client_v17__list_labels!();
140142
crate::impl_client_v17__list_lock_unspent!();
141143
crate::impl_client_v17__list_received_by_address!();
142144
crate::impl_client_v17__list_since_block!();
143145
crate::impl_client_v17__list_transactions!();
144146
crate::impl_client_v17__list_unspent!();
147+
crate::impl_client_v18__list_wallet_dir!();
145148
crate::impl_client_v17__list_wallets!();
146149
crate::impl_client_v22__load_wallet!();
147150
crate::impl_client_v17__rescan_blockchain!();

client/src/client_sync/v24/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ crate::impl_client_v17__get_addresses_by_label!();
125125
crate::impl_client_v17__get_address_info!();
126126
crate::impl_client_v17__get_balance!();
127127
crate::impl_client_v19__get_balances!();
128+
crate::impl_client_v18__get_received_by_label!();
128129
crate::impl_client_v17__get_new_address!();
129130
crate::impl_client_v17__get_raw_change_address!();
130131
crate::impl_client_v17__get_received_by_address!();
@@ -133,12 +134,14 @@ crate::impl_client_v17__get_unconfirmed_balance!();
133134
crate::impl_client_v17__get_wallet_info!();
134135
crate::impl_client_v17__import_privkey!();
135136
crate::impl_client_v17__list_address_groupings!();
137+
crate::impl_client_v18__list_received_by_label!();
136138
crate::impl_client_v17__list_labels!();
137139
crate::impl_client_v17__list_lock_unspent!();
138140
crate::impl_client_v17__list_received_by_address!();
139141
crate::impl_client_v17__list_since_block!();
140142
crate::impl_client_v17__list_transactions!();
141143
crate::impl_client_v17__list_unspent!();
144+
crate::impl_client_v18__list_wallet_dir!();
142145
crate::impl_client_v17__list_wallets!();
143146
crate::impl_client_v22__load_wallet!();
144147
crate::impl_client_v17__rescan_blockchain!();

client/src/client_sync/v25/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ crate::impl_client_v17__get_addresses_by_label!();
125125
crate::impl_client_v17__get_address_info!();
126126
crate::impl_client_v17__get_balance!();
127127
crate::impl_client_v19__get_balances!();
128+
crate::impl_client_v18__get_received_by_label!();
128129
crate::impl_client_v17__get_new_address!();
129130
crate::impl_client_v17__get_raw_change_address!();
130131
crate::impl_client_v17__get_received_by_address!();
@@ -133,12 +134,14 @@ crate::impl_client_v17__get_unconfirmed_balance!();
133134
crate::impl_client_v17__get_wallet_info!();
134135
crate::impl_client_v17__import_privkey!();
135136
crate::impl_client_v17__list_address_groupings!();
137+
crate::impl_client_v18__list_received_by_label!();
136138
crate::impl_client_v17__list_labels!();
137139
crate::impl_client_v17__list_lock_unspent!();
138140
crate::impl_client_v17__list_received_by_address!();
139141
crate::impl_client_v17__list_since_block!();
140142
crate::impl_client_v17__list_transactions!();
141143
crate::impl_client_v17__list_unspent!();
144+
crate::impl_client_v18__list_wallet_dir!();
142145
crate::impl_client_v17__list_wallets!();
143146
crate::impl_client_v22__load_wallet!();
144147
crate::impl_client_v17__rescan_blockchain!();

client/src/client_sync/v26/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ crate::impl_client_v17__get_addresses_by_label!();
131131
crate::impl_client_v17__get_address_info!();
132132
crate::impl_client_v17__get_balance!();
133133
crate::impl_client_v19__get_balances!();
134+
crate::impl_client_v18__get_received_by_label!();
134135
crate::impl_client_v17__get_new_address!();
135136
crate::impl_client_v17__get_raw_change_address!();
136137
crate::impl_client_v17__get_received_by_address!();
@@ -140,11 +141,13 @@ crate::impl_client_v17__get_wallet_info!();
140141
crate::impl_client_v17__import_privkey!();
141142
crate::impl_client_v17__list_address_groupings!();
142143
crate::impl_client_v17__list_labels!();
144+
crate::impl_client_v18__list_received_by_label!();
143145
crate::impl_client_v17__list_lock_unspent!();
144146
crate::impl_client_v17__list_received_by_address!();
145147
crate::impl_client_v17__list_since_block!();
146148
crate::impl_client_v17__list_transactions!();
147149
crate::impl_client_v17__list_unspent!();
150+
crate::impl_client_v18__list_wallet_dir!();
148151
crate::impl_client_v17__list_wallets!();
149152
crate::impl_client_v22__load_wallet!();
150153
crate::impl_client_v17__rescan_blockchain!();

0 commit comments

Comments
 (0)