Skip to content

Conversation

kwsantiago
Copy link

Closes #1973

Changes

  • Removed /examples folder containing CLI-heavy examples
  • Added focused rustdoc examples to key functions:
    • IndexedTxGraph::new() - graph initialization
    • BdkElectrumClient::new() - client creation
    • BdkElectrumClient::sync() - blockchain sync
    • BdkElectrumClient::full_scan() - wallet restoration
    • TxGraph::insert_tx() - transaction insertion
    • TxGraph::balance() - balance calculation
    • TxGraph::filter_chain_unspents() - UTXO retrieval
    • KeychainTxOutIndex::reveal_next_spk() - address generation
    • KeychainTxOutIndex::insert_descriptor() - descriptor setup
    • IndexedTxGraph::apply_block_relevant() - block processing
    • EsploraExt::full_scan() - Esplora wallet scanning
  • Updated Cargo.toml workspace members

Rationale

The previous examples contained 300+ lines of CLI boilerplate that obscured the core BDK functionality. The new rustdoc examples are 10-15 lines each and focus purely on API usage, making them much easier for developers to understand and follow.

The maintained bdk-cli tool serves as the comprehensive CLI example.

@kwsantiago kwsantiago mentioned this pull request Aug 1, 2025
@oleonardolima oleonardolima added the documentation Improvements or additions to documentation label Aug 4, 2025
@oleonardolima oleonardolima moved this to In Progress in BDK Chain Aug 4, 2025
@oleonardolima
Copy link
Contributor

Thanks for working on this one.
It's failing on CI. Make sure to use the 'just' commands and try building the docs locally if that helps with debugging the failures.

@kwsantiago kwsantiago force-pushed the kwsantiago/1973-simplify-examples branch from bcf49f0 to 7448a99 Compare August 5, 2025 00:35
@kwsantiago
Copy link
Author

@oleonardolima thank you. CI "should" be fixed now, at least it is locally. Can we try again?

@kwsantiago kwsantiago force-pushed the kwsantiago/1973-simplify-examples branch 2 times, most recently from 0e68ca5 to 9a9f9af Compare August 5, 2025 01:27
@oleonardolima
Copy link
Contributor

Thanks, there are some unrelated already merged commits, you probably need to do a rebase on top of master. Also, please note that we follow the conventional commits for commit messages, which would also need an update.

@kwsantiago kwsantiago force-pushed the kwsantiago/1973-simplify-examples branch from 9a9f9af to dc4e009 Compare August 6, 2025 18:28
@kwsantiago
Copy link
Author

@oleonardolima ok should be ready to test CI now. Thanks!

@kwsantiago kwsantiago force-pushed the kwsantiago/1973-simplify-examples branch 2 times, most recently from 1f81e2c to fa85989 Compare August 13, 2025 18:17
@oleonardolima oleonardolima added this to the Wallet 2.2.0 milestone Aug 22, 2025
@oleonardolima
Copy link
Contributor

You'll need to perform another rebase to incorporate the CI updates/fixes, and remove the unrelated merge commit.

@kwsantiago kwsantiago force-pushed the kwsantiago/1973-simplify-examples branch from fa85989 to 6fb8acd Compare August 22, 2025 19:45
@kwsantiago
Copy link
Author

@oleonardolima should be good now, let me know if there is anything else here.

Copy link
Contributor

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

You should also remove the example exclusion in build and test CI step.

I'm also wondering if the cfgs are strictly required, but haven't tested anything different yet.

Remove standalone examples in favor of focused, contextual rustdoc
examples that are easier to maintain and provide better documentation.
This makes the codebase more maintainable while improving the developer
experience with examples that are tested alongside the code they
document.
@kwsantiago kwsantiago force-pushed the kwsantiago/1973-simplify-examples branch from 86defb3 to 92ba283 Compare August 29, 2025 14:10
@kwsantiago kwsantiago changed the title Remove examples folder, add rustdoc examples refactor: replace examples with focused rustdoc examples Aug 29, 2025
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
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Simplify /examples
2 participants