Skip to content

Commit d60a54f

Browse files
committed
Implement walletpassphrase method and test
1 parent 6875709 commit d60a54f

File tree

15 files changed

+44
-0
lines changed

15 files changed

+44
-0
lines changed

client/src/client_sync/v17/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
155155
crate::impl_client_v17__unload_wallet!();
156156
crate::impl_client_v17__wallet_create_funded_psbt!();
157157
crate::impl_client_v17__wallet_lock!();
158+
crate::impl_client_v17__wallet_passphrase!();
158159
crate::impl_client_v17__wallet_process_psbt!();
159160

160161
/// Argument to the `Client::get_new_address_with_type` function.

client/src/client_sync/v17/wallet.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,26 @@ macro_rules! impl_client_v17__unload_wallet {
666666
};
667667
}
668668

669+
/// Implements Bitcoin Core JSON-RPC API method `walletpassphrase`
670+
#[macro_export]
671+
macro_rules! impl_client_v17__wallet_passphrase {
672+
() => {
673+
impl Client {
674+
pub fn wallet_passphrase(
675+
&self,
676+
passphrase: &str,
677+
timeout: u64,
678+
) -> Result<()> {
679+
match self.call("walletpassphrase", &[passphrase.into(), timeout.into()]) {
680+
Ok(serde_json::Value::Null) => Ok(()),
681+
Ok(res) => Err(Error::Returned(res.to_string())),
682+
Err(err) => Err(err.into()),
683+
}
684+
}
685+
}
686+
};
687+
}
688+
669689
/// Implements Bitcoin Core JSON-RPC API method `walletcreatefundedpsbt`.
670690
#[macro_export]
671691
macro_rules! impl_client_v17__wallet_create_funded_psbt {

client/src/client_sync/v18/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
172172
crate::impl_client_v17__unload_wallet!();
173173
crate::impl_client_v17__wallet_create_funded_psbt!();
174174
crate::impl_client_v17__wallet_lock!();
175+
crate::impl_client_v17__wallet_passphrase!();
175176
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v19/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
169169
crate::impl_client_v17__unload_wallet!();
170170
crate::impl_client_v17__wallet_create_funded_psbt!();
171171
crate::impl_client_v17__wallet_lock!();
172+
crate::impl_client_v17__wallet_passphrase!();
172173
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v20/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
169169
crate::impl_client_v17__unload_wallet!();
170170
crate::impl_client_v17__wallet_create_funded_psbt!();
171171
crate::impl_client_v17__wallet_lock!();
172+
crate::impl_client_v17__wallet_passphrase!();
172173
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v21/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
169169
crate::impl_client_v21__unload_wallet!();
170170
crate::impl_client_v17__wallet_create_funded_psbt!();
171171
crate::impl_client_v17__wallet_lock!();
172+
crate::impl_client_v17__wallet_passphrase!();
172173
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v22/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
169169
crate::impl_client_v21__unload_wallet!();
170170
crate::impl_client_v17__wallet_create_funded_psbt!();
171171
crate::impl_client_v17__wallet_lock!();
172+
crate::impl_client_v17__wallet_passphrase!();
172173
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v23/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
171171
crate::impl_client_v21__unload_wallet!();
172172
crate::impl_client_v17__wallet_create_funded_psbt!();
173173
crate::impl_client_v17__wallet_lock!();
174+
crate::impl_client_v17__wallet_passphrase!();
174175
crate::impl_client_v17__wallet_process_psbt!();
175176

176177
/// Argument to the `Client::get_new_address_with_type` function.

client/src/client_sync/v24/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
168168
crate::impl_client_v21__unload_wallet!();
169169
crate::impl_client_v17__wallet_create_funded_psbt!();
170170
crate::impl_client_v17__wallet_lock!();
171+
crate::impl_client_v17__wallet_passphrase!();
171172
crate::impl_client_v17__wallet_process_psbt!();

client/src/client_sync/v25/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,5 @@ crate::impl_client_v17__sign_raw_transaction_with_wallet!();
168168
crate::impl_client_v21__unload_wallet!();
169169
crate::impl_client_v17__wallet_create_funded_psbt!();
170170
crate::impl_client_v17__wallet_lock!();
171+
crate::impl_client_v17__wallet_passphrase!();
171172
crate::impl_client_v17__wallet_process_psbt!();

0 commit comments

Comments
 (0)