File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ interface Wallet {
9595
9696 [Throws=BdkError]
9797 boolean sign(PartiallySignedTransaction psbt);
98+
99+ SentAndReceivedValues sent_and_received([ByRef] Transaction tx);
98100};
99101
100102interface Update {};
@@ -235,6 +237,11 @@ dictionary ScriptAmount {
235237 u64 amount;
236238};
237239
240+ dictionary SentAndReceivedValues {
241+ u64 sent;
242+ u64 received;
243+ };
244+
238245// ------------------------------------------------------------------------
239246// bdk crate - bitcoin re-exports
240247// ------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ use crate::keys::Mnemonic;
2020use crate :: wallet:: TxBuilder ;
2121use crate :: wallet:: Update ;
2222use crate :: wallet:: Wallet ;
23+ use crate :: wallet:: SentAndReceivedValues ;
2324
2425use bdk:: keys:: bip39:: WordCount ;
2526use bdk:: wallet:: tx_builder:: ChangeSpendPolicy ;
Original file line number Diff line number Diff line change 1- use crate :: bitcoin:: { OutPoint , PartiallySignedTransaction } ;
1+ use crate :: bitcoin:: { OutPoint , PartiallySignedTransaction , Transaction } ;
22use crate :: descriptor:: Descriptor ;
33use crate :: { AddressIndex , AddressInfo , Network , ScriptAmount } ;
44use crate :: { Balance , Script } ;
@@ -92,6 +92,16 @@ impl Wallet {
9292 . sign ( & mut psbt, SignOptions :: default ( ) )
9393 . map_err ( |e| BdkError :: Generic ( e. to_string ( ) ) )
9494 }
95+
96+ pub fn sent_and_received ( & self , tx : & Transaction ) -> SentAndReceivedValues {
97+ let ( sent, received) : ( u64 , u64 ) = self . get_wallet ( ) . sent_and_received ( & tx. clone ( ) . into ( ) ) ;
98+ SentAndReceivedValues { sent, received }
99+ }
100+ }
101+
102+ pub struct SentAndReceivedValues {
103+ pub sent : u64 ,
104+ pub received : u64 ,
95105}
96106
97107pub struct Update ( pub ( crate ) BdkUpdate ) ;
You can’t perform that action at this time.
0 commit comments