Skip to content

Commit ea491a8

Browse files
docs: add API docs for TxDetails type
1 parent 0ef0c63 commit ea491a8

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

bdk-ffi/src/types.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::bitcoin::{
2-
Address, Amount, BlockHash, DescriptorId, HashableOutPoint, OutPoint, Script, Transaction,
3-
TxOut, Txid, FeeRate
2+
Address, Amount, BlockHash, DescriptorId, FeeRate, HashableOutPoint, OutPoint, Script,
3+
Transaction, TxOut, Txid,
44
};
55
use crate::descriptor::Descriptor;
66
use crate::error::{CreateTxError, RequestBuilderError};
@@ -1305,15 +1305,30 @@ impl From<bdk_wallet::ChangeSet> for ChangeSet {
13051305
}
13061306
}
13071307

1308+
/// Details about a transaction affecting the wallet (relevant and canonical).
13081309
#[derive(uniffi::Record, Debug, Clone)]
13091310
pub struct TxDetails {
1311+
/// The transaction id.
13101312
pub txid: Arc<Txid>,
1313+
/// The sum of the transaction input amounts that spend from previous outputs tracked by this
1314+
/// wallet.
13111315
pub sent: Arc<Amount>,
1316+
/// The sum of the transaction outputs that send to script pubkeys tracked by this wallet.
13121317
pub received: Arc<Amount>,
1318+
/// The fee paid for the transaction. Note that to calculate the fee for a transaction with
1319+
/// inputs not owned by this wallet you must manually insert the TxOut(s) into the tx graph
1320+
/// using the insert_txout function. If those are not available, the field will be `None`.
13131321
pub fee: Option<Arc<Amount>>,
1322+
/// The fee rate paid for the transaction. Note that to calculate the fee rate for a
1323+
/// transaction with inputs not owned by this wallet you must manually insert the TxOut(s) into
1324+
/// the tx graph using the insert_txout function. If those are not available, the field will be
1325+
/// `None`.
13141326
pub fee_rate: Option<Arc<FeeRate>>,
1327+
/// The net effect of the transaction on the balance of the wallet.
13151328
pub balance_delta: i64,
1329+
/// The position of the transaction in the chain.
13161330
pub chain_position: ChainPosition,
1331+
/// The complete `Transaction`.
13171332
pub tx: Arc<Transaction>,
13181333
}
13191334

0 commit comments

Comments
 (0)