1- use crate :: bitcoin:: { Address , Amount , BlockHash , OutPoint , Script , Transaction , TxOut } ;
1+ use crate :: bitcoin:: { Address , Amount , BlockHash , OutPoint , Script , Transaction , TxOut , Txid } ;
22use crate :: error:: { CreateTxError , RequestBuilderError } ;
33
44use bdk_core:: bitcoin:: absolute:: LockTime as BdkLockTime ;
@@ -52,7 +52,7 @@ pub enum ChainPosition {
5252 /// A child transaction that has been confirmed. Due to incomplete information,
5353 /// it is only known that this transaction is confirmed at a chain height less than
5454 /// or equal to this child TXID.
55- transitively : Option < String > ,
55+ transitively : Option < Arc < Txid > > ,
5656 } ,
5757 /// The transaction was last seen in the mempool at this timestamp.
5858 Unconfirmed { timestamp : Option < u64 > } ,
@@ -74,7 +74,7 @@ impl From<BdkChainPosition<BdkConfirmationBlockTime>> for ChainPosition {
7474 block_id,
7575 confirmation_time : anchor. confirmation_time ,
7676 } ,
77- transitively : transitively. map ( |t| t . to_string ( ) ) ,
77+ transitively : transitively. map ( |t| Arc :: new ( Txid ( t ) ) ) ,
7878 }
7979 }
8080 BdkChainPosition :: Unconfirmed { last_seen } => ChainPosition :: Unconfirmed {
@@ -213,7 +213,7 @@ impl From<BdkLocalOutput> for LocalOutput {
213213 fn from ( local_utxo : BdkLocalOutput ) -> Self {
214214 LocalOutput {
215215 outpoint : OutPoint {
216- txid : local_utxo. outpoint . txid . to_string ( ) ,
216+ txid : Arc :: new ( Txid ( local_utxo. outpoint . txid ) ) ,
217217 vout : local_utxo. outpoint . vout ,
218218 } ,
219219 txout : TxOut {
@@ -668,7 +668,7 @@ pub struct TxStatus {
668668 /// Height of the block this transaction was included.
669669 pub block_height : Option < u32 > ,
670670 /// Hash of the block.
671- pub block_hash : Option < String > ,
671+ pub block_hash : Option < Arc < BlockHash > > ,
672672 /// The time shown in the block, not necessarily the same time as when the block was found.
673673 pub block_time : Option < u64 > ,
674674}
@@ -678,7 +678,7 @@ impl From<BdkTxStatus> for TxStatus {
678678 TxStatus {
679679 confirmed : status. confirmed ,
680680 block_height : status. block_height ,
681- block_hash : status. block_hash . map ( |h| h . to_string ( ) ) ,
681+ block_hash : status. block_hash . map ( |h| Arc :: new ( BlockHash ( h ) ) ) ,
682682 block_time : status. block_time ,
683683 }
684684 }
@@ -688,7 +688,7 @@ impl From<BdkTxStatus> for TxStatus {
688688#[ derive( Debug , uniffi:: Record ) ]
689689pub struct Tx {
690690 /// The transaction identifier.
691- pub txid : String ,
691+ pub txid : Arc < Txid > ,
692692 /// The transaction version, of which 0, 1, 2 are standard.
693693 pub version : i32 ,
694694 /// The block height or time restriction on the transaction.
@@ -706,7 +706,7 @@ pub struct Tx {
706706impl From < BdkTx > for Tx {
707707 fn from ( tx : BdkTx ) -> Self {
708708 Self {
709- txid : tx. txid . to_string ( ) ,
709+ txid : Arc :: new ( Txid ( tx. txid ) ) ,
710710 version : tx. version ,
711711 locktime : tx. locktime ,
712712 size : tx. size as u64 ,
0 commit comments