Add include_raw boolean parameter on wallet list_transactions method
This commit is contained in:
parent
2342265c26
commit
3dc6596aa2
@ -491,7 +491,7 @@ class Wallet(
|
|||||||
fun sign(psbt: PartiallySignedTransaction): Boolean {}
|
fun sign(psbt: PartiallySignedTransaction): Boolean {}
|
||||||
|
|
||||||
/** Return the list of transactions made and received by the wallet. Note that this method only operate on the internal database, which first needs to be [Wallet.sync] manually. */
|
/** Return the list of transactions made and received by the wallet. Note that this method only operate on the internal database, which first needs to be [Wallet.sync] manually. */
|
||||||
fun listTransactions(): List<TransactionDetails> {}
|
fun listTransactions(includeRaw: Boolean): List<TransactionDetails> {}
|
||||||
|
|
||||||
/** Get the Bitcoin network the wallet is using. */
|
/** Get the Bitcoin network the wallet is using. */
|
||||||
fun network(): Network {}
|
fun network(): Network {}
|
||||||
|
@ -233,7 +233,7 @@ interface Wallet {
|
|||||||
boolean sign([ByRef] PartiallySignedTransaction psbt);
|
boolean sign([ByRef] PartiallySignedTransaction psbt);
|
||||||
|
|
||||||
[Throws=BdkError]
|
[Throws=BdkError]
|
||||||
sequence<TransactionDetails> list_transactions();
|
sequence<TransactionDetails> list_transactions(boolean include_raw);
|
||||||
|
|
||||||
Network network();
|
Network network();
|
||||||
|
|
||||||
|
@ -120,8 +120,11 @@ impl Wallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Return the list of transactions made and received by the wallet. Note that this method only operate on the internal database, which first needs to be [Wallet.sync] manually.
|
/// Return the list of transactions made and received by the wallet. Note that this method only operate on the internal database, which first needs to be [Wallet.sync] manually.
|
||||||
pub(crate) fn list_transactions(&self) -> Result<Vec<TransactionDetails>, BdkError> {
|
pub(crate) fn list_transactions(
|
||||||
let transaction_details = self.get_wallet().list_transactions(true)?;
|
&self,
|
||||||
|
include_raw: bool,
|
||||||
|
) -> Result<Vec<TransactionDetails>, BdkError> {
|
||||||
|
let transaction_details = self.get_wallet().list_transactions(include_raw)?;
|
||||||
Ok(transaction_details
|
Ok(transaction_details
|
||||||
.iter()
|
.iter()
|
||||||
.map(TransactionDetails::from)
|
.map(TransactionDetails::from)
|
||||||
@ -577,28 +580,19 @@ mod test {
|
|||||||
|
|
||||||
// new index still 0
|
// new index still 0
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
wallet
|
wallet.get_address(AddressIndex::New).unwrap().address,
|
||||||
.get_address(AddressIndex::New)
|
|
||||||
.unwrap()
|
|
||||||
.address,
|
|
||||||
"bcrt1qqjn9gky9mkrm3c28e5e87t5akd3twg6xezp0tv"
|
"bcrt1qqjn9gky9mkrm3c28e5e87t5akd3twg6xezp0tv"
|
||||||
);
|
);
|
||||||
|
|
||||||
// new index now 1
|
// new index now 1
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
wallet
|
wallet.get_address(AddressIndex::New).unwrap().address,
|
||||||
.get_address(AddressIndex::New)
|
|
||||||
.unwrap()
|
|
||||||
.address,
|
|
||||||
"bcrt1q0xs7dau8af22rspp4klya4f7lhggcnqfun2y3a"
|
"bcrt1q0xs7dau8af22rspp4klya4f7lhggcnqfun2y3a"
|
||||||
);
|
);
|
||||||
|
|
||||||
// new index now 2
|
// new index now 2
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
wallet
|
wallet.get_address(AddressIndex::New).unwrap().address,
|
||||||
.get_address(AddressIndex::New)
|
|
||||||
.unwrap()
|
|
||||||
.address,
|
|
||||||
"bcrt1q5g0mq6dkmwzvxscqwgc932jhgcxuqqkjv09tkj"
|
"bcrt1q5g0mq6dkmwzvxscqwgc932jhgcxuqqkjv09tkj"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -646,18 +640,12 @@ mod test {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
wallet
|
wallet.get_address(AddressIndex::New).unwrap().address,
|
||||||
.get_address(AddressIndex::New)
|
|
||||||
.unwrap()
|
|
||||||
.address,
|
|
||||||
"bcrt1qqjn9gky9mkrm3c28e5e87t5akd3twg6xezp0tv"
|
"bcrt1qqjn9gky9mkrm3c28e5e87t5akd3twg6xezp0tv"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
wallet
|
wallet.get_address(AddressIndex::New).unwrap().address,
|
||||||
.get_address(AddressIndex::New)
|
|
||||||
.unwrap()
|
|
||||||
.address,
|
|
||||||
"bcrt1q0xs7dau8af22rspp4klya4f7lhggcnqfun2y3a"
|
"bcrt1q0xs7dau8af22rspp4klya4f7lhggcnqfun2y3a"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user