Skip to content

Commit 10033b9

Browse files
committed
refactor: use macros for TxIn, OutPoint
1 parent 0ea6895 commit 10033b9

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

bdk-ffi/src/bdk.udl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,7 @@ typedef dictionary Header;
577577

578578
typedef interface Psbt;
579579

580-
dictionary TxIn {
581-
OutPoint previous_output;
582-
Script script_sig;
583-
u32 sequence;
584-
sequence<sequence<u8>> witness;
585-
};
580+
typedef dictionary TxIn;
586581

587582
typedef interface Script;
588583

@@ -597,7 +592,4 @@ enum Network {
597592

598593
typedef interface FeeRate;
599594

600-
dictionary OutPoint {
601-
string txid;
602-
u32 vout;
603-
};
595+
typedef dictionary OutPoint;

bdk-ffi/src/bitcoin.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ use std::ops::Deref;
3030
use std::str::FromStr;
3131
use std::sync::{Arc, Mutex};
3232

33-
#[derive(Debug, Clone, Eq, PartialEq)]
33+
/// A reference to an unspent output by TXID and output index.
34+
#[derive(Debug, Clone, Eq, PartialEq, uniffi:: Record)]
3435
pub struct OutPoint {
36+
/// The transaction.
3537
pub txid: String,
38+
/// The index of the output in the transaction.
3639
pub vout: u32,
3740
}
3841

@@ -521,11 +524,16 @@ pub struct FinalizedPsbtResult {
521524
pub errors: Option<Vec<PsbtFinalizeError>>,
522525
}
523526

524-
#[derive(Debug, Clone)]
527+
/// A transcation input.
528+
#[derive(Debug, Clone, uniffi::Record)]
525529
pub struct TxIn {
530+
/// A pointer to the previous output this input spends from.
526531
pub previous_output: OutPoint,
532+
/// The script corresponding to the `scriptPubKey`, empty in SegWit transactions.
527533
pub script_sig: Arc<Script>,
534+
/// https://bitcoin.stackexchange.com/questions/87372/what-does-the-sequence-in-a-transaction-input-mean
528535
pub sequence: u32,
536+
/// A proof for the script that authorizes the spend of the output.
529537
pub witness: Vec<Vec<u8>>,
530538
}
531539

bdk-ffi/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ mod wallet;
1414
use crate::bitcoin::FeeRate;
1515
use crate::bitcoin::OutPoint;
1616
use crate::bitcoin::Script;
17-
use crate::bitcoin::TxIn;
1817
use crate::bitcoin::TxOut;
1918
use crate::descriptor::Descriptor;
2019
use crate::error::AddressParseError;

0 commit comments

Comments
 (0)