corepc_client/client_sync/v26/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 `v26`.
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 `submitpackage`
13#[macro_export]
14macro_rules! impl_client_v26__submitpackage {
15 () => {
16 impl Client {
17 pub fn submit_package(
18 &self,
19 package: &[bitcoin::Transaction],
20 ) -> Result<SubmitPackage> {
21 let package_txs = package
22 .into_iter()
23 .map(|tx| bitcoin::consensus::encode::serialize_hex(tx))
24 .collect::<Vec<_>>();
25 self.call("submitpackage", &[package_txs.into()])
26 }
27 }
28 };
29}