@@ -155,23 +155,9 @@ pub struct TransactionDetails {
155
155
/// Server backend, but it could be None with a Bitcoin RPC node without txindex that receive
156
156
/// funds while offline.
157
157
pub fee : Option < u64 > ,
158
- }
159
-
160
- /// A transaction, either of type Confirmed or Unconfirmed
161
- #[ derive( Debug , Clone , PartialEq , Eq ) ]
162
- pub enum Transaction {
163
- /// A transaction that has yet to be included in a block
164
- Unconfirmed {
165
- /// The details of wallet transaction.
166
- details : TransactionDetails ,
167
- } ,
168
- /// A transaction that has been mined and is part of a block
169
- Confirmed {
170
- /// The details of wallet transaction
171
- details : TransactionDetails ,
172
- /// Timestamp and block height of the block in which this transaction was mined
173
- confirmation : BlockTime ,
174
- } ,
158
+ /// If the transaction is confirmed, contains height and timestamp of the block containing the
159
+ /// transaction, unconfirmed transaction contains `None`.
160
+ pub confirmation_time : Option < BlockTime > ,
175
161
}
176
162
177
163
impl From < & bdk:: TransactionDetails > for TransactionDetails {
@@ -181,20 +167,7 @@ impl From<&bdk::TransactionDetails> for TransactionDetails {
181
167
txid : x. txid . to_string ( ) ,
182
168
received : x. received ,
183
169
sent : x. sent ,
184
- }
185
- }
186
- }
187
-
188
- impl From < & bdk:: TransactionDetails > for Transaction {
189
- fn from ( x : & bdk:: TransactionDetails ) -> Transaction {
190
- match x. confirmation_time . clone ( ) {
191
- Some ( block_time) => Transaction :: Confirmed {
192
- details : TransactionDetails :: from ( x) ,
193
- confirmation : block_time,
194
- } ,
195
- None => Transaction :: Unconfirmed {
196
- details : TransactionDetails :: from ( x) ,
197
- } ,
170
+ confirmation_time : x. confirmation_time . clone ( ) ,
198
171
}
199
172
}
200
173
}
@@ -440,9 +413,12 @@ impl Wallet {
440
413
}
441
414
442
415
/// Return the list of transactions made and received by the wallet. Note that this method only operate on the internal database, which first needs to be [Wallet.sync] manually.
443
- fn list_transactions ( & self ) -> Result < Vec < Transaction > , Error > {
444
- let transactions = self . get_wallet ( ) . list_transactions ( true ) ?;
445
- Ok ( transactions. iter ( ) . map ( Transaction :: from) . collect ( ) )
416
+ fn list_transactions ( & self ) -> Result < Vec < TransactionDetails > , Error > {
417
+ let transaction_details = self . get_wallet ( ) . list_transactions ( true ) ?;
418
+ Ok ( transaction_details
419
+ . iter ( )
420
+ . map ( TransactionDetails :: from)
421
+ . collect ( ) )
446
422
}
447
423
448
424
/// Return the list of unspent outputs of this wallet. Note that this method only operates on the internal database,
0 commit comments