Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Add temporary API docs #88

Merged
merged 8 commits into from
Oct 3, 2022

Conversation

thunderbiscuit
Copy link
Member

Description

This PR adds a directory that contains the required files to build the API docs for bdk-android and bdk-jvm. The docs need to be updated and published once a release.

Notes to the reviewers

After getting comments on how specific-language API docs are useful in dev calls, I add these (albeit in a temporary fashion). We don't know how long it will be before the ability to use inline documentation is added to uniffi-rs, and so for the foreseeable future this is a good solution that will allow us to publish Kotlin API docs that work well and look good, and keep track of them in the same repository as the libraries themselves. I fully expect to remove this directory once the new workflows are in.

All Submissions:

@thunderbiscuit thunderbiscuit added the documentation Improvements or additions to documentation label Sep 8, 2022
@thunderbiscuit thunderbiscuit self-assigned this Sep 8, 2022
@thunderbiscuit
Copy link
Member Author

I also found a way to add samples (they show up as a new tab under the given object documentation page.

sample

@thunderbiscuit
Copy link
Member Author

The current PR builds into this website.

/** 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. */
Copy link
Member

Choose a reason for hiding this comment

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

Another nit, but I'd wrap this into multiple lines.

Copy link
Member Author

Choose a reason for hiding this comment

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

I brought all the long lines back, but didn't apply any particular rule. Do you have one in mind that you know is standard (length of line I mean?). I'm happy to apply a bit more consistently if there is a commonly agreed way to do KDocs/Javadoc documentation.

@notmandatory
Copy link
Member

These docs look great, but for Java and Kotlin the docs can be a bit more expressive than in Rust. I recommend using this plugin: https://plugins.jetbrains.com/plugin/10389-kdoc-generator

It allows you do type /** and return to get a basic template to fill out for the docs. The main difference from what you have now is it lets you also document the input/output parameters. Example below.

If you want to start with the short docs and fill in more details later I think what you have is fine for now.

/**
 * A blockchain client.
 *
 * @constructor Create a new blockchain client.
 *
 * @param the config for this blockchain client.
 */
class Blockchain(
    config: BlockchainConfig
) {
    /**
     * Broadcast a transaction.
     *
     * @param psbt the PSBT to broadcast.
     * @return the corresponding transaction id.
     */
    fun broadcast(psbt: PartiallySignedBitcoinTransaction): String {}

    /**
     * Get the current height of the blockchain.
     *
     * @return the block height.
     */
    fun getHeight(): UInt {}

    /**
     * Get the block hash of a given block.
     *
     * @param height the height of the block.
     * @return block hash base64 encoded.
     */
    fun getBlockHash(height: UInt): String {}
}

@thunderbiscuit
Copy link
Member Author

Thanks for the plugin recommendation! Made my life much easier. All comments have been addressed, I think this is now ready for merging. We should consider filling them up a little bit before the next release with more samples, but otherwise the core is good IMO.

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 3f35a18

@notmandatory
Copy link
Member

Thanks for doing all this! should help new folks get started, and also gives a great framework for filling in more docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants