Skip to content

Commit

Permalink
docs: wallet type docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
reez committed Nov 21, 2024
1 parent c432e2d commit ff247a3
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions bdk-ffi/src/bdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -316,46 +316,76 @@ interface TxidParseError {
// bdk_wallet crate - types module
// ------------------------------------------------------------------------

/// Types of keychains
enum KeychainKind {
/// External keychain, used for deriving recipient addresses.
"External",
/// Internal keychain, used for deriving change addresses.
"Internal",
};

/// A derived address and the index it was found at.
dictionary AddressInfo {
/// Child index of this address
u32 index;
/// Address
Address address;
/// Type of keychain
KeychainKind keychain;
};

/// Balance, differentiated into various categories.
dictionary Balance {
/// All coinbase outputs not yet matured
Amount immature;

/// Unconfirmed UTXOs generated by a wallet tx
Amount trusted_pending;

/// Unconfirmed UTXOs received from an external wallet
Amount untrusted_pending;

/// Confirmed and immediately spendable balance
Amount confirmed;

Amount trusted_spendable;

Amount total;
};

/// An unspent output owned by a [`Wallet`].
dictionary LocalOutput {
/// Reference to a transaction output
OutPoint outpoint;
/// Transaction output
TxOut txout;
/// Type of keychain
KeychainKind keychain;
/// Whether this UTXO is spent or not
boolean is_spent;
};

/// Bitcoin transaction output.
///
/// Defines new coins to be created as a result of the transaction,
/// along with spending conditions ("script", aka "output script"),
/// which an input spending it must satisfy.
///
/// An output that is not yet spent by an input is called Unspent Transaction Output ("UTXO").
dictionary TxOut {
/// The value of the output, in satoshis.
u64 value;
/// The script which must be satisfied for the output to be spent.
Script script_pubkey;
};

/// Represents the observed position of some chain data.
[Enum]
interface ChainPosition {
/// The chain data is seen as confirmed, and in anchored by `A`.
Confirmed(ConfirmationBlockTime confirmation_block_time);

/// The chain data is not confirmed and last seen in the mempool at this timestamp.
Unconfirmed(u64 timestamp);
};

Expand All @@ -374,6 +404,7 @@ dictionary CanonicalTx {
ChainPosition chain_position;
};

/// Builds a [`FullScanRequest`].
interface FullScanRequestBuilder {
[Throws=RequestBuilderError]
FullScanRequestBuilder inspect_spks_for_all_keychains(FullScanScriptInspector inspector);
Expand All @@ -382,6 +413,7 @@ interface FullScanRequestBuilder {
FullScanRequest build();
};

/// Builds a [`SyncRequest`].
interface SyncRequestBuilder {
[Throws=RequestBuilderError]
SyncRequestBuilder inspect_spks(SyncScriptInspector inspector);
Expand All @@ -404,6 +436,7 @@ interface FullScanScriptInspector {
void inspect(KeychainKind keychain, u32 index, Script script);
};

/// A changeset for [`Wallet`].
interface ChangeSet {};

// ------------------------------------------------------------------------
Expand Down

0 comments on commit ff247a3

Please sign in to comment.