Skip to content

Commit da6fc87

Browse files
committed
Add generatetodescriptor type, model and test
Add the RPC `generatetodescriptor` type to v20 and add reexports. Add model, into function, client macro and test. Update types table up to v29, v23 and later don't have docs for `Generating` and therefore no table entry.
1 parent e422371 commit da6fc87

File tree

25 files changed

+118
-7
lines changed

25 files changed

+118
-7
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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 `== Generating ==` section of the
6+
//! API docs of Bitcoin Core `v0.20`.
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 `generatetodescriptor`
13+
#[macro_export]
14+
macro_rules! impl_client_v20__generate_to_descriptor {
15+
() => {
16+
impl Client {
17+
pub fn generate_to_descriptor(
18+
&self,
19+
nblocks: usize,
20+
descriptor: &str,
21+
) -> Result<GenerateToDescriptor> {
22+
self.call("generatetodescriptor", &[nblocks.into(), descriptor.into()])
23+
}
24+
}
25+
};
26+
}

client/src/client_sync/v20/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
//!
55
//! We ignore option arguments unless they effect the shape of the returned JSON data.
66
7+
pub mod generating;
8+
79
use std::collections::BTreeMap;
810
use std::path::Path;
911

@@ -60,6 +62,7 @@ crate::impl_client_v17__uptime!();
6062

6163
// == Generating ==
6264
crate::impl_client_v17__generate_to_address!();
65+
crate::impl_client_v20__generate_to_descriptor!();
6366
crate::impl_client_v17__invalidate_block!();
6467

6568
// == Mining ==

client/src/client_sync/v21/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ crate::impl_client_v17__uptime!();
6262

6363
// == Generating ==
6464
crate::impl_client_v17__generate_to_address!();
65+
crate::impl_client_v20__generate_to_descriptor!();
6566
crate::impl_client_v17__invalidate_block!();
6667

6768
// == Mining ==

client/src/client_sync/v22/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ crate::impl_client_v17__uptime!();
6262

6363
// == Generating ==
6464
crate::impl_client_v17__generate_to_address!();
65+
crate::impl_client_v20__generate_to_descriptor!();
6566
crate::impl_client_v17__invalidate_block!();
6667

6768
// == Mining ==

client/src/client_sync/v23/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ crate::impl_client_v17__uptime!();
6464

6565
// == Generating ==
6666
crate::impl_client_v17__generate_to_address!();
67+
crate::impl_client_v20__generate_to_descriptor!();
6768
crate::impl_client_v17__invalidate_block!();
6869

6970
// == Mining ==

client/src/client_sync/v24/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ crate::impl_client_v17__uptime!();
6161

6262
// == Generating ==
6363
crate::impl_client_v17__generate_to_address!();
64+
crate::impl_client_v20__generate_to_descriptor!();
6465
crate::impl_client_v17__invalidate_block!();
6566

6667
// == Mining ==

client/src/client_sync/v25/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ crate::impl_client_v17__uptime!();
6161

6262
// == Generating ==
6363
crate::impl_client_v17__generate_to_address!();
64+
crate::impl_client_v20__generate_to_descriptor!();
6465
crate::impl_client_v17__invalidate_block!();
6566

6667
// == Mining ==

client/src/client_sync/v26/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ crate::impl_client_v17__uptime!();
6565

6666
// == Generating ==
6767
crate::impl_client_v17__generate_to_address!();
68+
crate::impl_client_v20__generate_to_descriptor!();
6869
crate::impl_client_v17__invalidate_block!();
6970

7071
// == Mining ==

client/src/client_sync/v27/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ crate::impl_client_v17__uptime!();
6161

6262
// == Generating ==
6363
crate::impl_client_v17__generate_to_address!();
64+
crate::impl_client_v20__generate_to_descriptor!();
6465
crate::impl_client_v17__invalidate_block!();
6566

6667
// == Mining ==

client/src/client_sync/v28/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ crate::impl_client_v17__uptime!();
6363

6464
// == Generating ==
6565
crate::impl_client_v17__generate_to_address!();
66+
crate::impl_client_v20__generate_to_descriptor!();
6667
crate::impl_client_v17__invalidate_block!();
6768

6869
// == Mining ==

0 commit comments

Comments
 (0)