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 @@ -107,6 +107,8 @@ interface Wallet {
107107
108108  [Throws=BdkError]
109109  boolean sign(PartiallySignedTransaction psbt);
110+ 
111+   SentAndReceivedValues sent_and_received([ByRef] Transaction tx);
110112};
111113
112114interface Update {};
@@ -247,6 +249,11 @@ dictionary ScriptAmount {
247249  u64 amount;
248250};
249251
252+ dictionary SentAndReceivedValues {
253+     u64 sent;
254+     u64 received;
255+ };
256+ 
250257// ------------------------------------------------------------------------
251258// bdk crate - bitcoin re-exports
252259// ------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ use crate::types::AddressInfo;
2323use  crate :: types:: Balance ; 
2424use  crate :: types:: LocalUtxo ; 
2525use  crate :: types:: ScriptAmount ; 
26+ use  crate :: wallet:: SentAndReceivedValues ; 
2627use  crate :: wallet:: TxBuilder ; 
2728use  crate :: wallet:: Update ; 
2829use  crate :: wallet:: Wallet ; 
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 :: types:: Balance ; 
44use  crate :: types:: ScriptAmount ; 
@@ -93,6 +93,16 @@ impl Wallet {
9393            . sign ( & mut  psbt,  SignOptions :: default ( ) ) 
9494            . map_err ( |e| BdkError :: Generic ( e. to_string ( ) ) ) 
9595    } 
96+ 
97+     pub  fn  sent_and_received ( & self ,  tx :  & Transaction )  -> SentAndReceivedValues  { 
98+         let  ( sent,  received) :  ( u64 ,  u64 )  = self . get_wallet ( ) . sent_and_received ( & tx. clone ( ) . into ( ) ) ; 
99+         SentAndReceivedValues  {  sent,  received } 
100+     } 
101+ } 
102+ 
103+ pub  struct  SentAndReceivedValues  { 
104+     pub  sent :  u64 , 
105+     pub  received :  u64 , 
96106} 
97107
98108pub  struct  Update ( pub ( crate )  BdkUpdate ) ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments