Added interface DerivationPath
This commit is contained in:
parent
930a1f1eb4
commit
4977cb6d68
@ -245,3 +245,8 @@ interface BumpFeeTxBuilder {
|
|||||||
[Throws=BdkError]
|
[Throws=BdkError]
|
||||||
PartiallySignedBitcoinTransaction finish([ByRef] Wallet wallet);
|
PartiallySignedBitcoinTransaction finish([ByRef] Wallet wallet);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface DerivationPath {
|
||||||
|
[Throws=BdkError]
|
||||||
|
constructor(string path);
|
||||||
|
};
|
15
src/lib.rs
15
src/lib.rs
@ -1,6 +1,7 @@
|
|||||||
use bdk::bitcoin::hashes::hex::ToHex;
|
use bdk::bitcoin::hashes::hex::ToHex;
|
||||||
use bdk::bitcoin::secp256k1::Secp256k1;
|
use bdk::bitcoin::secp256k1::Secp256k1;
|
||||||
use bdk::bitcoin::util::psbt::PartiallySignedTransaction;
|
use bdk::bitcoin::util::psbt::PartiallySignedTransaction;
|
||||||
|
use bdk::bitcoin::util::bip32::DerivationPath as BdkDerivationPath;
|
||||||
use bdk::bitcoin::{Address, Network, OutPoint as BdkOutPoint, Script, Txid};
|
use bdk::bitcoin::{Address, Network, OutPoint as BdkOutPoint, Script, Txid};
|
||||||
use bdk::blockchain::any::{AnyBlockchain, AnyBlockchainConfig};
|
use bdk::blockchain::any::{AnyBlockchain, AnyBlockchainConfig};
|
||||||
use bdk::blockchain::{
|
use bdk::blockchain::{
|
||||||
@ -633,6 +634,20 @@ fn generate_mnemonic(word_count: WordCount) -> Result<String, BdkError> {
|
|||||||
Ok(mnemonic.to_string())
|
Ok(mnemonic.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct DerivationPath {
|
||||||
|
derivation_path_mutex: Mutex<BdkDerivationPath>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DerivationPath {
|
||||||
|
fn new(path: String) -> Result<Self, BdkError> {
|
||||||
|
BdkDerivationPath::from_str(&path)
|
||||||
|
.map(|x| DerivationPath {
|
||||||
|
derivation_path_mutex: Mutex::new(x),
|
||||||
|
})
|
||||||
|
.map_err(|e| BdkError::Generic(e.to_string()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uniffi::deps::static_assertions::assert_impl_all!(Wallet: Sync, Send);
|
uniffi::deps::static_assertions::assert_impl_all!(Wallet: Sync, Send);
|
||||||
|
|
||||||
// The goal of these tests to to ensure `bdk-ffi` intermediate code correctly calls `bdk` APIs.
|
// The goal of these tests to to ensure `bdk-ffi` intermediate code correctly calls `bdk` APIs.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user