[WIP] Add get new address API to Wallet
This commit is contained in:
parent
8faba58cd4
commit
784f754cd9
@ -4,4 +4,5 @@ namespace bdk {
|
||||
|
||||
interface OfflineWallet {
|
||||
constructor(string descriptor);
|
||||
string get_new_address();
|
||||
};
|
14
src/lib.rs
14
src/lib.rs
@ -1,14 +1,13 @@
|
||||
use bdk::Wallet;
|
||||
use bdk::wallet::AddressIndex;
|
||||
use bdk::database::MemoryDatabase;
|
||||
use bdk::bitcoin::Network;
|
||||
// use crate::error::FfiError;
|
||||
use std::sync::{RwLock, Mutex};
|
||||
use std::vec::Vec;
|
||||
|
||||
use bdk::database::BatchDatabase;
|
||||
use bdk::sled;
|
||||
use bdk::sled::Tree;
|
||||
|
||||
//mod error;
|
||||
//mod types;
|
||||
//mod wallet;
|
||||
@ -40,6 +39,17 @@ impl OfflineWallet {
|
||||
// wallet: RwLock::new(Vec::new())
|
||||
// }
|
||||
}
|
||||
|
||||
fn get_new_address(&self) -> String {
|
||||
self
|
||||
.wallet
|
||||
.lock()
|
||||
.unwrap()
|
||||
.get_address(AddressIndex::New)
|
||||
.unwrap()
|
||||
.address
|
||||
.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
uniffi::deps::static_assertions::assert_impl_all!(OfflineWallet: Sync, Send);
|
||||
|
Loading…
x
Reference in New Issue
Block a user