Skip to main content

corepc_client/client_sync/v21/
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 `v0.21`.
7//!
8//! All macros require `Client` to be in scope.
9//!
10//! See or use the `define_jsonrpc_bitreq_client!` macro to define a `Client`.
11
12/// Implements Bitcoin Core JSON-RPC API method `getrawmempool`.
13#[macro_export]
14macro_rules! impl_client_v21__get_raw_mempool {
15    () => {
16        impl Client {
17            pub fn get_raw_mempool(&self) -> Result<GetRawMempool> {
18                // Equivalent to self.call("getrawmempool", &[into_json(false)?])
19                self.call("getrawmempool", &[])
20            }
21
22            pub fn get_raw_mempool_verbose(&self) -> Result<GetRawMempoolVerbose> {
23                self.call("getrawmempool", &[into_json(true)?])
24            }
25
26            pub fn get_raw_mempool_sequence(&self) -> Result<GetRawMempoolSequence> {
27                self.call("getrawmempool", &[into_json(false)?, into_json(true)?])
28            }
29        }
30    };
31}