1- use crate :: bitcoin:: { Address , Amount , 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 ;
@@ -51,7 +51,7 @@ pub enum ChainPosition {
5151 /// A child transaction that has been confirmed. Due to incomplete information,
5252 /// it is only known that this transaction is confirmed at a chain height less than
5353 /// or equal to this child TXID.
54- transitively : Option < String > ,
54+ transitively : Option < Arc < Txid > > ,
5555 } ,
5656 /// The transaction was last seen in the mempool at this timestamp.
5757 Unconfirmed { timestamp : Option < u64 > } ,
@@ -73,7 +73,7 @@ impl From<BdkChainPosition<BdkConfirmationBlockTime>> for ChainPosition {
7373 block_id,
7474 confirmation_time : anchor. confirmation_time ,
7575 } ,
76- transitively : transitively. map ( |t| t . to_string ( ) ) ,
76+ transitively : transitively. map ( |t| Arc :: new ( Txid ( t ) ) ) ,
7777 }
7878 }
7979 BdkChainPosition :: Unconfirmed { last_seen } => ChainPosition :: Unconfirmed {
@@ -203,7 +203,7 @@ impl From<BdkLocalOutput> for LocalOutput {
203203 fn from ( local_utxo : BdkLocalOutput ) -> Self {
204204 LocalOutput {
205205 outpoint : OutPoint {
206- txid : local_utxo. outpoint . txid . to_string ( ) ,
206+ txid : Arc :: new ( Txid ( local_utxo. outpoint . txid ) ) ,
207207 vout : local_utxo. outpoint . vout ,
208208 } ,
209209 txout : TxOut {
@@ -658,7 +658,7 @@ pub struct TxStatus {
658658 /// Height of the block this transaction was included.
659659 pub block_height : Option < u32 > ,
660660 /// Hash of the block.
661- pub block_hash : Option < String > ,
661+ pub block_hash : Option < Arc < BlockHash > > ,
662662 /// The time shown in the block, not necessarily the same time as when the block was found.
663663 pub block_time : Option < u64 > ,
664664}
@@ -668,7 +668,7 @@ impl From<BdkTxStatus> for TxStatus {
668668 TxStatus {
669669 confirmed : status. confirmed ,
670670 block_height : status. block_height ,
671- block_hash : status. block_hash . map ( |h| h . to_string ( ) ) ,
671+ block_hash : status. block_hash . map ( |h| Arc :: new ( BlockHash ( h ) ) ) ,
672672 block_time : status. block_time ,
673673 }
674674 }
@@ -678,7 +678,7 @@ impl From<BdkTxStatus> for TxStatus {
678678#[ derive( Debug , uniffi:: Record ) ]
679679pub struct Tx {
680680 /// The transaction identifier.
681- pub txid : String ,
681+ pub txid : Arc < Txid > ,
682682 /// The transaction version, of which 0, 1, 2 are standard.
683683 pub version : i32 ,
684684 /// The block height or time restriction on the transaction.
@@ -696,7 +696,7 @@ pub struct Tx {
696696impl From < BdkTx > for Tx {
697697 fn from ( tx : BdkTx ) -> Self {
698698 Self {
699- txid : tx. txid . to_string ( ) ,
699+ txid : Arc :: new ( Txid ( tx. txid ) ) ,
700700 version : tx. version ,
701701 locktime : tx. locktime ,
702702 size : tx. size as u64 ,
0 commit comments