corepc_client/client_sync/v25/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 `v25`.
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 `scanblocks`
13#[macro_export]
14macro_rules! impl_client_v25__scan_blocks {
15 () => {
16 impl Client {
17 /// Aborts an ongoing `scanblocks` scan.
18 pub fn scan_blocks_abort(&self) -> Result<ScanBlocksAbort> {
19 self.call("scanblocks", &[into_json("abort")?])
20 }
21
22 /// Starts a scan of blocks for specified descriptors.
23 pub fn scan_blocks_start(&self, scan_objects: &[&str]) -> Result<ScanBlocksStart> {
24 self.call("scanblocks", &[into_json("start")?, into_json(scan_objects)?])
25 }
26
27 /// Checks the status of an ongoing `scanblocks` scan.
28 pub fn scan_blocks_status(&self) -> Result<Option<ScanBlocksStatus>> {
29 self.call("scanblocks", &[into_json("status")?])
30 }
31 }
32 };
33}