corepc_client/client_sync/v28/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 `v28`.
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 `gethdkeys`.
13#[macro_export]
14macro_rules! impl_client_v28__get_hd_keys {
15 () => {
16 impl Client {
17 pub fn get_hd_keys(&self) -> Result<GetHdKeys> { self.call("gethdkeys", &[]) }
18 }
19 };
20}
21
22/// Implements Bitcoin Core JSON-RPC API method `createwalletdescriptor`.
23#[macro_export]
24macro_rules! impl_client_v28__create_wallet_descriptor {
25 () => {
26 impl Client {
27 pub fn create_wallet_descriptor(&self, address_type: &str, hdkey: &str) -> Result<CreateWalletDescriptor> {
28 let hdkey = serde_json::json!({ "hdkey": hdkey });
29 self.call("createwalletdescriptor", &[address_type.into(), hdkey.into()])
30 }
31 }
32 };
33}