Skip to main content

bitcoind_client/
rpc.rs

1//! [`Rpc`] methods
2
3macro_rules! impl_rpc_methods {
4    ( $($name:ident,)+ ) => {
5        /// RPCs
6        #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7        #[allow(missing_docs)]
8        pub enum Rpc {
9            $(
10                $name,
11            )+
12        }
13
14        impl core::fmt::Display for Rpc {
15            fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
16                let s = match self {
17                    $(
18                        Self::$name => stringify!($name).to_lowercase(),
19                    )+
20                };
21
22                f.write_str(&s)
23            }
24        }
25    }
26}
27
28// RPC methods go here. These names MUST match the name of the RPC method (when converted to lowercase).
29// See <https://bitcoincore.org/en/doc/> for details.
30impl_rpc_methods!(
31    GetBestBlockHash,
32    GetBlockchainInfo,
33    GetBlockHash,
34    GetBlockCount,
35    GetBlock,
36    GetBlockHeader,
37    GetBlockFilter,
38    GetDescriptorInfo,
39    GetRawMempool,
40    SendToAddress,
41    GetRawTransaction,
42    ImportDescriptors,
43    EstimateSmartFee,
44);