[WIP] Add get new address API to Wallet
This commit is contained in:
1 parent
cdb90aa35c
commit
84d28a0476
3 files changed
+38
-13
No files matched your search
@@ -4,4 +4,5 @@ namespace bdk {
|
||||
|
||||
interface OfflineWallet {
|
||||
constructor(string descriptor);
|
||||
string get_new_address();
|
||||
};
|
||||
+12
-2
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user