Add a way to convert TransactionDetails to Transaction
This commit is contained in:
parent
620d65e217
commit
f4e9af18b5
16
src/lib.rs
16
src/lib.rs
@ -82,6 +82,22 @@ pub enum Transaction {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn to_transaction(x: &bdk::TransactionDetails) -> Transaction {
|
||||||
|
let details = TransactionDetails {
|
||||||
|
fees: x.fee,
|
||||||
|
id: x.txid.to_string(),
|
||||||
|
received: x.received,
|
||||||
|
sent: x.sent,
|
||||||
|
};
|
||||||
|
match x.confirmation_time.clone() {
|
||||||
|
Some(confirmation) => Transaction::Confirmed {
|
||||||
|
details,
|
||||||
|
confirmation,
|
||||||
|
},
|
||||||
|
None => Transaction::Unconfirmed { details },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
trait OfflineWalletOperations<B>: WalletHolder<B> {
|
trait OfflineWalletOperations<B>: WalletHolder<B> {
|
||||||
fn get_new_address(&self) -> String {
|
fn get_new_address(&self) -> String {
|
||||||
self.get_wallet()
|
self.get_wallet()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user