@@ -49,7 +49,7 @@ pub enum KeychainKind {
4949}
5050
5151/// Represents the observed position of some chain data.
52- #[ derive( Debug , uniffi:: Enum ) ]
52+ #[ derive( Debug , uniffi:: Enum , Clone ) ]
5353pub enum ChainPosition {
5454 /// The chain data is confirmed as it is anchored in the best chain by `A`.
5555 Confirmed {
@@ -1094,3 +1094,30 @@ impl From<bdk_wallet::ChangeSet> for ChangeSet {
10941094 }
10951095 }
10961096}
1097+
1098+ #[ derive( uniffi:: Record , Debug , Clone ) ]
1099+ pub struct TxDetails {
1100+ pub txid : Arc < Txid > ,
1101+ pub sent : Arc < Amount > ,
1102+ pub received : Arc < Amount > ,
1103+ pub fee : Option < Arc < Amount > > ,
1104+ pub fee_rate : Option < f32 > ,
1105+ pub balance_delta : i64 ,
1106+ pub chain_position : ChainPosition ,
1107+ pub tx : Arc < Transaction > ,
1108+ }
1109+
1110+ impl From < bdk_wallet:: TxDetails > for TxDetails {
1111+ fn from ( details : bdk_wallet:: TxDetails ) -> Self {
1112+ TxDetails {
1113+ txid : Arc :: new ( Txid ( details. txid ) ) ,
1114+ sent : Arc :: new ( details. sent . into ( ) ) ,
1115+ received : Arc :: new ( details. received . into ( ) ) ,
1116+ fee : details. fee . map ( |f| Arc :: new ( f. into ( ) ) ) ,
1117+ fee_rate : details. fee_rate . map ( |fr| fr. to_sat_per_vb_ceil ( ) as f32 ) ,
1118+ balance_delta : details. balance_delta . to_sat ( ) ,
1119+ chain_position : details. chain_position . into ( ) ,
1120+ tx : Arc :: new ( Transaction :: from ( details. tx . as_ref ( ) . clone ( ) ) ) ,
1121+ }
1122+ }
1123+ }
0 commit comments