-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: wallet type docstrings #616
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -318,46 +318,88 @@ 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; | ||
|
||
/// Get sum of trusted_pending and confirmed coins. | ||
/// | ||
/// This is the balance you can spend right now that shouldn't get cancelled via another party | ||
/// double spending it. | ||
Amount trusted_spendable; | ||
|
||
/// Get the whole balance visible to the wallet. | ||
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); | ||
}; | ||
|
||
|
@@ -376,6 +418,7 @@ dictionary CanonicalTx { | |
ChainPosition chain_position; | ||
}; | ||
|
||
/// Builds a [`FullScanRequest`]. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These links don't work in the KDocs. I'll send you a screenshot of what they look like, but I was thinking of removing them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed on the Bindings Call to just re-visit this topic in a few months |
||
interface FullScanRequestBuilder { | ||
[Throws=RequestBuilderError] | ||
FullScanRequestBuilder inspect_spks_for_all_keychains(FullScanScriptInspector inspector); | ||
|
@@ -384,6 +427,7 @@ interface FullScanRequestBuilder { | |
FullScanRequest build(); | ||
}; | ||
|
||
/// Builds a [`SyncRequest`]. | ||
interface SyncRequestBuilder { | ||
[Throws=RequestBuilderError] | ||
SyncRequestBuilder inspect_spks(SyncScriptInspector inspector); | ||
|
@@ -406,6 +450,7 @@ interface FullScanScriptInspector { | |
void inspect(KeychainKind keychain, u32 index, Script script); | ||
}; | ||
|
||
/// A changeset for [`Wallet`]. | ||
interface ChangeSet {}; | ||
|
||
// ------------------------------------------------------------------------ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the standard for Rust and Kotlin/Java is to have a full stop at the end of the first sentence, even if there is only one. I noticed that it's not always respected in the bdk docs, but then added when people point them out. In case the Rust docs are faulty of this, I suggest we simply fix here for the ffi docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed on the Bindings Call to just re-visit this topic in a few months