File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ pub mod bip38;
2828
2929// Re-export main types for convenience
3030pub use error:: { FFIError , FFIErrorCode } ;
31- pub use types:: { FFINetwork , FFIWallet } ;
31+ pub use types:: { FFIBalance , FFINetwork , FFIWallet } ;
3232pub use utxo:: FFIUTXO ;
3333
3434// ============================================================================
Original file line number Diff line number Diff line change @@ -88,6 +88,32 @@ impl From<Network> for FFINetwork {
8888 }
8989}
9090
91+ /// FFI Balance type for representing wallet balances
92+ #[ repr( C ) ]
93+ #[ derive( Debug , Clone , Copy , Default ) ]
94+ pub struct FFIBalance {
95+ /// Confirmed balance in satoshis
96+ pub confirmed : u64 ,
97+ /// Unconfirmed balance in satoshis
98+ pub unconfirmed : u64 ,
99+ /// Immature balance in satoshis (e.g., mining rewards)
100+ pub immature : u64 ,
101+ /// Total balance (confirmed + unconfirmed) in satoshis
102+ pub total : u64 ,
103+ }
104+
105+
106+ impl From < key_wallet:: WalletBalance > for FFIBalance {
107+ fn from ( balance : key_wallet:: WalletBalance ) -> Self {
108+ FFIBalance {
109+ confirmed : balance. confirmed ,
110+ unconfirmed : balance. unconfirmed ,
111+ immature : balance. locked , // Map locked to immature for now
112+ total : balance. total ,
113+ }
114+ }
115+ }
116+
91117/// Opaque wallet handle
92118pub struct FFIWallet {
93119 pub ( crate ) wallet : Arc < Wallet > ,
You can’t perform that action at this time.
0 commit comments