@@ -48,7 +48,7 @@ pub enum KeychainKind {
4848}
4949
5050/// Represents the observed position of some chain data.
51- #[ derive( Debug , uniffi:: Enum ) ]
51+ #[ derive( Debug , uniffi:: Enum , Clone ) ]
5252pub enum ChainPosition {
5353 /// The chain data is confirmed as it is anchored in the best chain by `A`.
5454 Confirmed {
@@ -966,3 +966,30 @@ impl From<bdk_wallet::ChangeSet> for ChangeSet {
966966 }
967967 }
968968}
969+
970+ #[ derive( uniffi:: Record , Debug , Clone ) ]
971+ pub struct TxDetails {
972+ pub txid : Arc < Txid > ,
973+ pub sent : Arc < Amount > ,
974+ pub received : Arc < Amount > ,
975+ pub fee : Option < Arc < Amount > > ,
976+ pub fee_rate : Option < f32 > ,
977+ pub balance_delta : i64 ,
978+ pub chain_position : ChainPosition ,
979+ pub tx : Arc < Transaction > ,
980+ }
981+
982+ impl From < bdk_wallet:: TxDetails > for TxDetails {
983+ fn from ( details : bdk_wallet:: TxDetails ) -> Self {
984+ TxDetails {
985+ txid : Arc :: new ( Txid ( details. txid ) ) ,
986+ sent : Arc :: new ( details. sent . into ( ) ) ,
987+ received : Arc :: new ( details. received . into ( ) ) ,
988+ fee : details. fee . map ( |f| Arc :: new ( f. into ( ) ) ) ,
989+ fee_rate : details. fee_rate . map ( |fr| fr. to_sat_per_vb_ceil ( ) as f32 ) ,
990+ balance_delta : details. balance_delta . to_sat ( ) ,
991+ chain_position : details. chain_position . into ( ) ,
992+ tx : Arc :: new ( Transaction :: from ( details. tx . as_ref ( ) . clone ( ) ) ) ,
993+ }
994+ }
995+ }
0 commit comments