Skip to content

Commit fffe28a

Browse files
authored
feat: expose staged and take_staged on Wallet
1 parent e205a0f commit fffe28a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

bdk-ffi/src/wallet.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::error::{
66
};
77
use crate::store::{PersistenceType, Persister};
88
use crate::types::{
9-
AddressInfo, Balance, BlockId, CanonicalTx, EvictedTx, FullScanRequestBuilder,
9+
AddressInfo, Balance, BlockId, CanonicalTx, ChangeSet, EvictedTx, FullScanRequestBuilder,
1010
KeychainAndIndex, LocalOutput, Policy, SentAndReceivedValues, SignOptions, SyncRequestBuilder,
1111
UnconfirmedTx, Update,
1212
};
@@ -542,6 +542,20 @@ impl Wallet {
542542
})
543543
}
544544

545+
/// Get a reference of the staged [`ChangeSet`] that is yet to be committed (if any).
546+
pub fn staged(&self) -> Option<Arc<ChangeSet>> {
547+
self.get_wallet()
548+
.staged()
549+
.map(|changeset| Arc::new(changeset.clone().into()))
550+
}
551+
552+
/// Take the staged [`ChangeSet`] to be persisted now (if any).
553+
pub fn take_staged(&self) -> Option<Arc<ChangeSet>> {
554+
self.get_wallet()
555+
.take_staged()
556+
.map(|changeset| Arc::new(changeset.into()))
557+
}
558+
545559
/// Returns the latest checkpoint.
546560
pub fn latest_checkpoint(&self) -> BlockId {
547561
self.get_wallet().latest_checkpoint().block_id().into()

0 commit comments

Comments
 (0)