corepc_client/client_sync/v29/blockchain.rs
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 `== Blockchain ==` section of the
6//! API docs of Bitcoin Core `v29`.
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 `dumptxoutset`.
13#[macro_export]
14macro_rules! impl_client_v29__dump_tx_out_set {
15 () => {
16 impl Client {
17 pub fn dump_tx_out_set(&self, path: &str, snapshot_type: &str) -> Result<DumpTxOutSet> {
18 self.call("dumptxoutset", &[path.into(), snapshot_type.into()])
19 }
20 }
21 };
22}
23
24/// Implements Bitcoin Core JSON-RPC API method `getdescriptoractivity`.
25#[macro_export]
26macro_rules! impl_client_v29__get_descriptor_activity {
27 () => {
28 impl Client {
29 pub fn get_descriptor_activity(&self) -> Result<GetDescriptorActivity> {
30 let block_hashes: &[BlockHash] = &[];
31 let scan_objects: &[&str] = &[];
32 // FIXME: Core errors if we don't pass empty arrays?
33 let params = vec![json!(block_hashes), json!(scan_objects)];
34 self.call("getdescriptoractivity", ¶ms)
35 }
36 }
37 };
38}