Skip to content

Commit cae7f37

Browse files
committed
refactor: use macros for ChainPosition
1 parent 5e220eb commit cae7f37

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

bdk-ffi/src/bdk.udl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -307,17 +307,7 @@ dictionary LocalOutput {
307307

308308
typedef dictionary TxOut;
309309

310-
/// Represents the observed position of some chain data.
311-
[Enum]
312-
interface ChainPosition {
313-
/// The chain data is confirmed as it is anchored in the best chain by `A`.
314-
Confirmed(ConfirmationBlockTime confirmation_block_time, string? transitively);
315-
316-
/// The chain data is not confirmed and last seen in the mempool at this timestamp.
317-
Unconfirmed(u64? timestamp);
318-
};
319-
320-
typedef dictionary ConfirmationBlockTime;
310+
typedef enum ChainPosition;
321311

322312
dictionary CanonicalTx {
323313
Transaction transaction;

bdk-ffi/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ use crate::types::AddressInfo;
4747
use crate::types::CanonicalTx;
4848
use crate::types::ChainPosition;
4949
use crate::types::Condition;
50-
use crate::types::ConfirmationBlockTime;
5150
use crate::types::FullScanRequest;
5251
use crate::types::FullScanRequestBuilder;
5352
use crate::types::FullScanScriptInspector;

bdk-ffi/src/types.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,19 @@ pub enum KeychainKind {
4242
Internal = 1,
4343
}
4444

45-
#[derive(Debug)]
45+
/// Represents the observed position of some chain data.
46+
#[derive(Debug, uniffi::Enum)]
4647
pub enum ChainPosition {
48+
/// The chain data is confirmed as it is anchored in the best chain by `A`.
4749
Confirmed {
4850
confirmation_block_time: ConfirmationBlockTime,
51+
/// A child transaction that has been confirmed. Due to incomplete information,
52+
/// it is only known that this transaction is confirmed at a chain height less than
53+
/// or equal to this child TXID.
4954
transitively: Option<String>,
5055
},
51-
Unconfirmed {
52-
timestamp: Option<u64>,
53-
},
56+
/// The transaction was last seen in the mempool at this timestamp.
57+
Unconfirmed { timestamp: Option<u64> },
5458
}
5559

5660
impl From<BdkChainPosition<BdkConfirmationBlockTime>> for ChainPosition {

0 commit comments

Comments
 (0)