Skip to content

Commit 24607b7

Browse files
committed
Merge #295: Address all TODO in v22
805c757 Add walletdisplayaddress struct and model (Jamil Lambert, PhD) 9daa9b4 Add listdescriptors struct and test (Jamil Lambert, PhD) 4fa58a2 Add enumeratesigners struct (Jamil Lambert, PhD) d726f28 Add missing raw_transaction label (Jamil Lambert, PhD) Pull request description: Go through all the TODO in the v22 types table. Add all the missing RPCs. Redefine `listdescriptors` in v25 due to added return field. `enumeratesigners` and `walletdisplayaddress` RPCs require an external signer and have been left untested because of this. Opened #294. ACKs for top commit: tcharding: ACK 805c757 Tree-SHA512: ae0e746f09a16f770fc0488e43efc47db1c4497ba3af3ab4bf14c00d45a701fb93cc30e38e31e0a6aced918d7ff32c08d37e0a4351864e2c345726dcd49cbd03
2 parents 874b36a + 805c757 commit 24607b7

File tree

33 files changed

+305
-46
lines changed

33 files changed

+305
-46
lines changed

client/src/client_sync/v22/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//!
55
//! We ignore option arguments unless they effect the shape of the returned JSON data.
66
7+
mod signer;
78
mod wallet;
89

910
use std::collections::BTreeMap;
@@ -110,6 +111,9 @@ crate::impl_client_v17__sign_raw_transaction_with_key!();
110111
crate::impl_client_v17__test_mempool_accept!();
111112
crate::impl_client_v18__utxo_update_psbt!();
112113

114+
// == Signer ==
115+
crate::impl_client_v22__enumerate_signers!();
116+
113117
// == Util ==
114118
crate::impl_client_v17__create_multisig!();
115119
crate::impl_client_v18__derive_addresses!();
@@ -151,6 +155,7 @@ crate::impl_client_v17__import_pubkey!();
151155
crate::impl_client_v17__import_wallet!();
152156
crate::impl_client_v17__key_pool_refill!();
153157
crate::impl_client_v17__list_address_groupings!();
158+
crate::impl_client_v22__list_descriptors!();
154159
crate::impl_client_v18__list_received_by_label!();
155160
crate::impl_client_v17__list_labels!();
156161
crate::impl_client_v17__list_lock_unspent!();
@@ -176,6 +181,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
176181
crate::impl_client_v21__unload_wallet!();
177182
crate::impl_client_v21__upgrade_wallet!();
178183
crate::impl_client_v17__wallet_create_funded_psbt!();
184+
crate::impl_client_v22__wallet_display_address!();
179185
crate::impl_client_v17__wallet_lock!();
180186
crate::impl_client_v17__wallet_passphrase!();
181187
crate::impl_client_v17__wallet_passphrase_change!();

client/src/client_sync/v22/signer.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 `== Signer ==` section of the
6+
//! API docs of Bitcoin Core `v22`.
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+
12+
/// Implements Bitcoin Core JSON-RPC API method `enumeratesigners`
13+
#[macro_export]
14+
macro_rules! impl_client_v22__enumerate_signers {
15+
() => {
16+
impl Client {
17+
pub fn enumerate_signers(&self) -> Result<EnumerateSigners> {
18+
self.call("enumeratesigners", &[])
19+
}
20+
}
21+
};
22+
}

client/src/client_sync/v22/wallet.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@
99
//!
1010
//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`.
1111
12+
/// Implements Bitcoin Core JSON-RPC API method `listdescriptors`
13+
#[macro_export]
14+
macro_rules! impl_client_v22__list_descriptors {
15+
() => {
16+
impl Client {
17+
pub fn list_descriptors(&self) -> Result<ListDescriptors> {
18+
self.call("listdescriptors", &[])
19+
}
20+
}
21+
};
22+
}
23+
1224
/// Implements Bitcoin Core JSON-RPC API method `loadwallet`
1325
#[macro_export]
1426
macro_rules! impl_client_v22__load_wallet {
@@ -20,3 +32,15 @@ macro_rules! impl_client_v22__load_wallet {
2032
}
2133
};
2234
}
35+
36+
/// Implements Bitcoin Core JSON-RPC API method `walletdisplayaddress`
37+
#[macro_export]
38+
macro_rules! impl_client_v22__wallet_display_address {
39+
() => {
40+
impl Client {
41+
pub fn wallet_display_address(&self, address: &str) -> Result<WalletDisplayAddress> {
42+
self.call("walletdisplayaddress", &[address.into()])
43+
}
44+
}
45+
};
46+
}

client/src/client_sync/v23/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ crate::impl_client_v17__sign_raw_transaction_with_key!();
112112
crate::impl_client_v17__test_mempool_accept!();
113113
crate::impl_client_v18__utxo_update_psbt!();
114114

115+
// == Signer ==
116+
crate::impl_client_v22__enumerate_signers!();
117+
115118
// == Util ==
116119
crate::impl_client_v17__create_multisig!();
117120
crate::impl_client_v18__derive_addresses!();
@@ -153,6 +156,7 @@ crate::impl_client_v17__import_pubkey!();
153156
crate::impl_client_v17__import_wallet!();
154157
crate::impl_client_v17__key_pool_refill!();
155158
crate::impl_client_v17__list_address_groupings!();
159+
crate::impl_client_v22__list_descriptors!();
156160
crate::impl_client_v18__list_received_by_label!();
157161
crate::impl_client_v17__list_labels!();
158162
crate::impl_client_v17__list_lock_unspent!();
@@ -178,6 +182,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
178182
crate::impl_client_v21__unload_wallet!();
179183
crate::impl_client_v21__upgrade_wallet!();
180184
crate::impl_client_v17__wallet_create_funded_psbt!();
185+
crate::impl_client_v22__wallet_display_address!();
181186
crate::impl_client_v17__wallet_lock!();
182187
crate::impl_client_v17__wallet_passphrase!();
183188
crate::impl_client_v17__wallet_passphrase_change!();

client/src/client_sync/v24/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ crate::impl_client_v17__sign_raw_transaction_with_key!();
109109
crate::impl_client_v17__test_mempool_accept!();
110110
crate::impl_client_v18__utxo_update_psbt!();
111111

112+
// == Signer ==
113+
crate::impl_client_v22__enumerate_signers!();
114+
112115
// == Util ==
113116
crate::impl_client_v17__create_multisig!();
114117
crate::impl_client_v18__derive_addresses!();
@@ -150,6 +153,7 @@ crate::impl_client_v17__import_pubkey!();
150153
crate::impl_client_v17__import_wallet!();
151154
crate::impl_client_v17__key_pool_refill!();
152155
crate::impl_client_v17__list_address_groupings!();
156+
crate::impl_client_v22__list_descriptors!();
153157
crate::impl_client_v18__list_received_by_label!();
154158
crate::impl_client_v17__list_labels!();
155159
crate::impl_client_v17__list_lock_unspent!();
@@ -175,6 +179,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
175179
crate::impl_client_v21__unload_wallet!();
176180
crate::impl_client_v21__upgrade_wallet!();
177181
crate::impl_client_v17__wallet_create_funded_psbt!();
182+
crate::impl_client_v22__wallet_display_address!();
178183
crate::impl_client_v17__wallet_lock!();
179184
crate::impl_client_v17__wallet_passphrase!();
180185
crate::impl_client_v17__wallet_passphrase_change!();

client/src/client_sync/v25/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ crate::impl_client_v17__sign_raw_transaction_with_key!();
111111
crate::impl_client_v17__test_mempool_accept!();
112112
crate::impl_client_v18__utxo_update_psbt!();
113113

114+
// == Signer ==
115+
crate::impl_client_v22__enumerate_signers!();
116+
114117
// == Util ==
115118
crate::impl_client_v17__create_multisig!();
116119
crate::impl_client_v18__derive_addresses!();
@@ -152,6 +155,7 @@ crate::impl_client_v17__import_pubkey!();
152155
crate::impl_client_v17__import_wallet!();
153156
crate::impl_client_v17__key_pool_refill!();
154157
crate::impl_client_v17__list_address_groupings!();
158+
crate::impl_client_v22__list_descriptors!();
155159
crate::impl_client_v18__list_received_by_label!();
156160
crate::impl_client_v17__list_labels!();
157161
crate::impl_client_v17__list_lock_unspent!();
@@ -177,6 +181,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
177181
crate::impl_client_v21__unload_wallet!();
178182
crate::impl_client_v21__upgrade_wallet!();
179183
crate::impl_client_v17__wallet_create_funded_psbt!();
184+
crate::impl_client_v22__wallet_display_address!();
180185
crate::impl_client_v17__wallet_lock!();
181186
crate::impl_client_v17__wallet_passphrase!();
182187
crate::impl_client_v17__wallet_passphrase_change!();

client/src/client_sync/v26/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ crate::impl_client_v26__submit_package!();
115115
crate::impl_client_v17__test_mempool_accept!();
116116
crate::impl_client_v18__utxo_update_psbt!();
117117

118+
// == Signer ==
119+
crate::impl_client_v22__enumerate_signers!();
120+
118121
// == Util ==
119122
crate::impl_client_v17__create_multisig!();
120123
crate::impl_client_v18__derive_addresses!();
@@ -156,6 +159,7 @@ crate::impl_client_v17__import_pubkey!();
156159
crate::impl_client_v17__import_wallet!();
157160
crate::impl_client_v17__key_pool_refill!();
158161
crate::impl_client_v17__list_address_groupings!();
162+
crate::impl_client_v22__list_descriptors!();
159163
crate::impl_client_v17__list_labels!();
160164
crate::impl_client_v18__list_received_by_label!();
161165
crate::impl_client_v17__list_lock_unspent!();
@@ -181,6 +185,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
181185
crate::impl_client_v21__unload_wallet!();
182186
crate::impl_client_v21__upgrade_wallet!();
183187
crate::impl_client_v17__wallet_create_funded_psbt!();
188+
crate::impl_client_v22__wallet_display_address!();
184189
crate::impl_client_v17__wallet_lock!();
185190
crate::impl_client_v17__wallet_passphrase!();
186191
crate::impl_client_v17__wallet_passphrase_change!();

client/src/client_sync/v27/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ crate::impl_client_v26__submit_package!();
111111
crate::impl_client_v17__test_mempool_accept!();
112112
crate::impl_client_v18__utxo_update_psbt!();
113113

114+
// == Signer ==
115+
crate::impl_client_v22__enumerate_signers!();
116+
114117
// == Util ==
115118
crate::impl_client_v17__create_multisig!();
116119
crate::impl_client_v18__derive_addresses!();
@@ -152,6 +155,7 @@ crate::impl_client_v17__import_pubkey!();
152155
crate::impl_client_v17__import_wallet!();
153156
crate::impl_client_v17__key_pool_refill!();
154157
crate::impl_client_v17__list_address_groupings!();
158+
crate::impl_client_v22__list_descriptors!();
155159
crate::impl_client_v18__list_received_by_label!();
156160
crate::impl_client_v17__list_labels!();
157161
crate::impl_client_v17__list_lock_unspent!();
@@ -177,6 +181,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
177181
crate::impl_client_v21__unload_wallet!();
178182
crate::impl_client_v21__upgrade_wallet!();
179183
crate::impl_client_v17__wallet_create_funded_psbt!();
184+
crate::impl_client_v22__wallet_display_address!();
180185
crate::impl_client_v17__wallet_lock!();
181186
crate::impl_client_v17__wallet_passphrase!();
182187
crate::impl_client_v17__wallet_passphrase_change!();

client/src/client_sync/v28/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ crate::impl_client_v28__submit_package!();
113113
crate::impl_client_v17__test_mempool_accept!();
114114
crate::impl_client_v18__utxo_update_psbt!();
115115

116+
// == Signer ==
117+
crate::impl_client_v22__enumerate_signers!();
118+
116119
// == Util ==
117120
crate::impl_client_v17__create_multisig!();
118121
crate::impl_client_v18__derive_addresses!();
@@ -154,6 +157,7 @@ crate::impl_client_v17__import_pubkey!();
154157
crate::impl_client_v17__import_wallet!();
155158
crate::impl_client_v17__key_pool_refill!();
156159
crate::impl_client_v17__list_address_groupings!();
160+
crate::impl_client_v22__list_descriptors!();
157161
crate::impl_client_v18__list_received_by_label!();
158162
crate::impl_client_v17__list_labels!();
159163
crate::impl_client_v17__list_lock_unspent!();
@@ -179,6 +183,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
179183
crate::impl_client_v21__unload_wallet!();
180184
crate::impl_client_v21__upgrade_wallet!();
181185
crate::impl_client_v17__wallet_create_funded_psbt!();
186+
crate::impl_client_v22__wallet_display_address!();
182187
crate::impl_client_v17__wallet_lock!();
183188
crate::impl_client_v17__wallet_passphrase!();
184189
crate::impl_client_v17__wallet_passphrase_change!();

client/src/client_sync/v29/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ crate::impl_client_v28__submit_package!();
113113
crate::impl_client_v17__test_mempool_accept!();
114114
crate::impl_client_v18__utxo_update_psbt!();
115115

116+
// == Signer ==
117+
crate::impl_client_v22__enumerate_signers!();
118+
116119
// == Util ==
117120
crate::impl_client_v17__create_multisig!();
118121
crate::impl_client_v18__derive_addresses!();
@@ -154,6 +157,7 @@ crate::impl_client_v17__import_pubkey!();
154157
crate::impl_client_v17__import_wallet!();
155158
crate::impl_client_v17__key_pool_refill!();
156159
crate::impl_client_v17__list_address_groupings!();
160+
crate::impl_client_v22__list_descriptors!();
157161
crate::impl_client_v18__list_received_by_label!();
158162
crate::impl_client_v17__list_labels!();
159163
crate::impl_client_v17__list_lock_unspent!();
@@ -179,6 +183,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
179183
crate::impl_client_v21__unload_wallet!();
180184
crate::impl_client_v21__upgrade_wallet!();
181185
crate::impl_client_v17__wallet_create_funded_psbt!();
186+
crate::impl_client_v22__wallet_display_address!();
182187
crate::impl_client_v17__wallet_lock!();
183188
crate::impl_client_v17__wallet_passphrase!();
184189
crate::impl_client_v17__wallet_passphrase_change!();

0 commit comments

Comments
 (0)