corepc_client/client_sync/v24/wallet.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 `== Wallet ==` section of the
6//! API docs of Bitcoin Core `v24`.
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 `migratewallet`.
13#[macro_export]
14macro_rules! impl_client_v24__migrate_wallet {
15 () => {
16 impl Client {
17 pub fn migrate_wallet(&self, wallet_name: &str) -> Result<MigrateWallet> {
18 self.call("migratewallet", &[wallet_name.into()])
19 }
20 }
21 };
22}
23
24/// Implements Bitcoin Core JSON-RPC API method `sendall`.
25#[macro_export]
26macro_rules! impl_client_v24__send_all {
27 () => {
28 impl Client {
29 pub fn send_all(&self, recipients: &[Address]) -> Result<SendAll> {
30 self.call("sendall", &[into_json(recipients)?])
31 }
32 }
33 };
34}
35
36/// Implements Bitcoin Core JSON-RPC API method `simulaterawtransaction`.
37#[macro_export]
38macro_rules! impl_client_v24__simulate_raw_transaction {
39 () => {
40 impl Client {
41 pub fn simulate_raw_transaction(
42 &self,
43 rawtxs: &[String],
44 ) -> Result<SimulateRawTransaction> {
45 self.call("simulaterawtransaction", &[into_json(rawtxs)?])
46 }
47 }
48 };
49}