1
- use crate :: bitcoin:: { Address , Amount , OutPoint , Script , Transaction , TxOut } ;
1
+ use crate :: bitcoin:: { Address , Amount , BlockHash , OutPoint , Script , Transaction , TxOut , Txid } ;
2
2
use crate :: error:: { CreateTxError , RequestBuilderError } ;
3
3
4
4
use bdk_core:: bitcoin:: absolute:: LockTime as BdkLockTime ;
@@ -51,7 +51,7 @@ pub enum ChainPosition {
51
51
/// A child transaction that has been confirmed. Due to incomplete information,
52
52
/// it is only known that this transaction is confirmed at a chain height less than
53
53
/// or equal to this child TXID.
54
- transitively : Option < String > ,
54
+ transitively : Option < Arc < Txid > > ,
55
55
} ,
56
56
/// The transaction was last seen in the mempool at this timestamp.
57
57
Unconfirmed { timestamp : Option < u64 > } ,
@@ -73,7 +73,7 @@ impl From<BdkChainPosition<BdkConfirmationBlockTime>> for ChainPosition {
73
73
block_id,
74
74
confirmation_time : anchor. confirmation_time ,
75
75
} ,
76
- transitively : transitively. map ( |t| t . to_string ( ) ) ,
76
+ transitively : transitively. map ( |t| Arc :: new ( Txid ( t ) ) ) ,
77
77
}
78
78
}
79
79
BdkChainPosition :: Unconfirmed { last_seen } => ChainPosition :: Unconfirmed {
@@ -203,7 +203,7 @@ impl From<BdkLocalOutput> for LocalOutput {
203
203
fn from ( local_utxo : BdkLocalOutput ) -> Self {
204
204
LocalOutput {
205
205
outpoint : OutPoint {
206
- txid : local_utxo. outpoint . txid . to_string ( ) ,
206
+ txid : Arc :: new ( Txid ( local_utxo. outpoint . txid ) ) ,
207
207
vout : local_utxo. outpoint . vout ,
208
208
} ,
209
209
txout : TxOut {
@@ -658,7 +658,7 @@ pub struct TxStatus {
658
658
/// Height of the block this transaction was included.
659
659
pub block_height : Option < u32 > ,
660
660
/// Hash of the block.
661
- pub block_hash : Option < String > ,
661
+ pub block_hash : Option < Arc < BlockHash > > ,
662
662
/// The time shown in the block, not necessarily the same time as when the block was found.
663
663
pub block_time : Option < u64 > ,
664
664
}
@@ -668,7 +668,7 @@ impl From<BdkTxStatus> for TxStatus {
668
668
TxStatus {
669
669
confirmed : status. confirmed ,
670
670
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 ) ) ) ,
672
672
block_time : status. block_time ,
673
673
}
674
674
}
@@ -678,7 +678,7 @@ impl From<BdkTxStatus> for TxStatus {
678
678
#[ derive( Debug , uniffi:: Record ) ]
679
679
pub struct Tx {
680
680
/// The transaction identifier.
681
- pub txid : String ,
681
+ pub txid : Arc < Txid > ,
682
682
/// The transaction version, of which 0, 1, 2 are standard.
683
683
pub version : i32 ,
684
684
/// The block height or time restriction on the transaction.
@@ -696,7 +696,7 @@ pub struct Tx {
696
696
impl From < BdkTx > for Tx {
697
697
fn from ( tx : BdkTx ) -> Self {
698
698
Self {
699
- txid : tx. txid . to_string ( ) ,
699
+ txid : Arc :: new ( Txid ( tx. txid ) ) ,
700
700
version : tx. version ,
701
701
locktime : tx. locktime ,
702
702
size : tx. size as u64 ,
0 commit comments