#[macro_export]
macro_rules! impl_client_v21__create_wallet {
() => {
impl Client {
pub fn create_wallet(&self, wallet: &str) -> Result<CreateWallet> {
self.call("createwallet", &[wallet.into()])
}
pub fn create_descriptor_wallet(&self, wallet: &str) -> Result<CreateWallet> {
let disable_private_keys = false;
let blank = false;
let passphrase = String::new();
let avoid_reuse = false;
let descriptors = true;
self.call(
"createwallet",
&[
wallet.into(),
disable_private_keys.into(),
blank.into(),
passphrase.into(),
avoid_reuse.into(),
descriptors.into(),
],
)
}
}
};
}
#[macro_export]
macro_rules! impl_client_v21__import_descriptors {
() => {
impl Client {
pub fn import_descriptors(
&self,
requests: &[ImportDescriptorsRequest],
) -> Result<ImportDescriptors> {
self.call("importdescriptors", &[into_json(requests)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v21__psbt_bump_fee {
() => {
impl Client {
pub fn psbt_bump_fee(&self, txid: &bitcoin::Txid) -> Result<PsbtBumpFee> {
self.call("psbtbumpfee", &[into_json(txid)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v21__send {
() => {
impl Client {
pub fn send(&self, outputs: &BTreeMap<String, f64>) -> Result<Send> {
self.call("send", &[into_json(outputs)?])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v21__send_many_verbose {
() => {
impl Client {
pub fn send_many_verbose(
&self,
amounts: BTreeMap<Address, Amount>,
) -> Result<SendManyVerbose> {
let dummy = ""; let amount_btc: BTreeMap<String, f64> = amounts
.into_iter()
.map(|(addr, amount)| (addr.to_string(), amount.to_btc()))
.collect();
let minconf = 1u64;
let comment = "";
let subtract_fee_from: Vec<String> = Vec::new();
let replaceable = true;
let conf_target = 1u64;
let estimate_mode = "unset";
let fee_rate = serde_json::Value::Null;
let verbose = true;
self.call(
"sendmany",
&[
into_json(dummy)?,
into_json(amount_btc)?,
minconf.into(),
comment.into(),
into_json(subtract_fee_from)?,
replaceable.into(),
conf_target.into(),
estimate_mode.into(),
fee_rate,
verbose.into(),
],
)
}
}
};
}
#[macro_export]
macro_rules! impl_client_v21__unload_wallet {
() => {
impl Client {
pub fn unload_wallet(&self, wallet: &str) -> Result<UnloadWallet> {
self.call("unloadwallet", &[wallet.into()])
}
}
};
}
#[macro_export]
macro_rules! impl_client_v21__upgrade_wallet {
() => {
impl Client {
pub fn upgrade_wallet(&self) -> Result<UpgradeWallet> {
self.call("upgradewallet", &[])
}
}
};
}