feat: expose list_unspent and list_output methods on wallet
This commit is contained in:
parent
806e29b93c
commit
54f3235254
@ -225,6 +225,10 @@ interface Wallet {
|
|||||||
|
|
||||||
[Throws=CalculateFeeError]
|
[Throws=CalculateFeeError]
|
||||||
FeeRate calculate_fee_rate([ByRef] Transaction tx);
|
FeeRate calculate_fee_rate([ByRef] Transaction tx);
|
||||||
|
|
||||||
|
sequence<LocalOutput> list_unspent();
|
||||||
|
|
||||||
|
sequence<LocalOutput> list_output();
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Update {};
|
interface Update {};
|
||||||
|
@ -3,7 +3,9 @@ use crate::descriptor::Descriptor;
|
|||||||
use crate::error::{
|
use crate::error::{
|
||||||
Alpha3Error, CalculateFeeError, PersistenceError, TxidParseError, WalletCreationError,
|
Alpha3Error, CalculateFeeError, PersistenceError, TxidParseError, WalletCreationError,
|
||||||
};
|
};
|
||||||
use crate::types::{AddressIndex, AddressInfo, Balance, CanonicalTx, FeeRate, ScriptAmount};
|
use crate::types::{
|
||||||
|
AddressIndex, AddressInfo, Balance, CanonicalTx, FeeRate, LocalOutput, ScriptAmount,
|
||||||
|
};
|
||||||
|
|
||||||
use bdk::bitcoin::blockdata::script::ScriptBuf as BdkScriptBuf;
|
use bdk::bitcoin::blockdata::script::ScriptBuf as BdkScriptBuf;
|
||||||
use bdk::bitcoin::psbt::PartiallySignedTransaction as BdkPartiallySignedTransaction;
|
use bdk::bitcoin::psbt::PartiallySignedTransaction as BdkPartiallySignedTransaction;
|
||||||
@ -128,6 +130,14 @@ impl Wallet {
|
|||||||
.map(|bdk_fee_rate| Arc::new(FeeRate(bdk_fee_rate)))
|
.map(|bdk_fee_rate| Arc::new(FeeRate(bdk_fee_rate)))
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn list_unspent(&self) -> Vec<LocalOutput> {
|
||||||
|
self.get_wallet().list_unspent().map(|o| o.into()).collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn list_output(&self) -> Vec<LocalOutput> {
|
||||||
|
self.get_wallet().list_output().map(|o| o.into()).collect()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SentAndReceivedValues {
|
pub struct SentAndReceivedValues {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user