corepc_client/client_sync/v18/
raw_transactions.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 `== Rawtransactions ==` section of the
6//! API docs of Bitcoin Core `v0.18`.
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 `analyzepsbt`
13#[macro_export]
14macro_rules! impl_client_v18__analyzepsbt {
15    () => {
16        impl Client {
17            pub fn analyze_psbt(&self, psbt: &bitcoin::Psbt) -> Result<AnalyzePsbt> {
18                let psbt = format!("{}", psbt);
19                self.call("analyzepsbt", &[psbt.into()])
20            }
21        }
22    };
23}
24
25/// Implements Bitcoin Core JSON-RPC API method `joinpsbts`
26#[macro_export]
27macro_rules! impl_client_v18__joinpsbts {
28    () => {
29        impl Client {
30            pub fn join_psbts(&self, psbts: &[bitcoin::Psbt]) -> Result<JoinPsbts> {
31                let psbts = psbts.iter().map(|psbt| format!("{}", psbt)).collect::<Vec<String>>();
32                self.call("joinpsbts", &[psbts.into()])
33            }
34        }
35    };
36}
37
38/// Implements Bitcoin Core JSON-RPC API method `uxtoupdatepsbt`
39#[macro_export]
40macro_rules! impl_client_v18__utxoupdatepsbt {
41    () => {
42        impl Client {
43            pub fn utxo_update_psbt(&self, psbt: &bitcoin::Psbt) -> Result<JoinPsbts> {
44                let psbt = format!("{}", psbt);
45                self.call("uxtoupdatepsbt", &[psbt.into()])
46            }
47        }
48    };
49}