Skip to content
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

Add documentation #171

Merged
merged 8 commits into from
Aug 29, 2022
Merged

Add documentation #171

merged 8 commits into from
Aug 29, 2022

Conversation

thunderbiscuit
Copy link
Member

@thunderbiscuit thunderbiscuit commented Jul 15, 2022

I think it's high time we document the Rust code.

Because we don't have official API docs at the moment (and we don't really know how long it will be before we can have them), I expect users will be referring to source code for documentation. Because we can't build those in the bindings files themselves at the moment, documenting the Rust code in bdk-ffi is a low hanging fruit that is probably worthy of our time.

This is currently in draft mode, but more or less I propose to try and pull from the official BDK Rust docs whenever the types are the same or the documentation applies, and write our own when needed. Here are examples for AddressInfo and AddressIndex:

/// A derived address and the index it was found at.
pub struct AddressInfo {
    /// Child index of this address
    pub index: u32,
    /// Address
    pub address: String,
}

/// The address index selection strategy to use to derived an address from the wallet's external
/// descriptor.
pub enum AddressIndex {
    /// Return a new address after incrementing the current descriptor index.
    New,
    /// Return the address for the current descriptor index if it has not been used in a received
    /// transaction. Otherwise return a new address as with AddressIndex::New.
    ///
    /// Use with caution, if the wallet has not yet detected an address has been used it could
    /// return an already used address. This function is primarily meant for situations where the
    /// caller is untrusted; for example when deriving donation addresses on-demand for a public
    /// web page.
    LastUnused,
}

@thunderbiscuit thunderbiscuit marked this pull request as ready for review August 29, 2022 14:55
@notmandatory
Copy link
Member

Looks good ! I think you need to rebase to pickup recently merged #178 .

@thunderbiscuit
Copy link
Member Author

Yeah I rebased earlier today. I think it's ready to go.

Copy link
Member

@notmandatory notmandatory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK cd38001

@thunderbiscuit thunderbiscuit merged commit bfe03b9 into bitcoindevkit:master Aug 29, 2022
@thunderbiscuit thunderbiscuit deleted the docs branch November 14, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants