fix: wallet examples
Description
Fix wallet examples.
Closes #1434
Notes to the reviewers
- Print balances only in BTC
- Uses Signet instead of Testnet
- Fix
wallet_esplora_asyncprinting theKeychainKindtwice, and forgets to printspk0 - Change wallet examples to use mempool.space (Electrum) or BDK's signet (Esplora) to fix rate limiting issues, along with more conservative
PARALLEL_REQUESTS - Standardize code for
wallet_esplora_* - Uses the new BDK sqlite crate instead of BDK's file store.
Changelog notice
- fix BDK wallet example crates
Checklists
All Submissions:
- [x] I've signed all my commits
- [x] I followed the contribution guidelines
- [x] I ran
cargo fmtandcargo clippybefore committing
New Features:
- [ ] I've added tests for the new feature
- [ ] I've added docs for the new feature
Bugfixes:
- [ ] This pull request breaks the existing API
- [ ] I've added tests to reproduce the issue which are now passing
- [x] I'm linking the issue being fixed by this PR
ACK 214fa09d368851b352b827b31608a986600702ec
I'm just wondering if we should add a new dependency, but I don't see much problem as it's only on the example-crates
But then it adds extra compile time and further surface for conflicts and other errors in all CI tests and Clippy checks...
That's the overhead that I referred to.
I'm just wondering if we should add a new dependency, but I don't see much problem as it's only on the example-crates
But then it adds extra compile time and further surface for conflicts and other errors in all CI tests and Clippy checks...
That's the overhead that I referred to.
We could use Wallet::new_no_persist and forget about bringing in tempfile, but that would make the examples somewhat less illustrative. I recommended tempfile because otherwise the db file is left lingering in your system's tempdir which is kind of a nuisance #1045
We might need to revisit this after #1128 was merged. I only changed the async esplora wallet example, so we might need to change the explora blocking and elecrum wallet examples.
Since we are using the bdk_sqlite crate now, we don't need tempdir.
We might need to revisit this after #1128 was merged. I only changed the async esplora wallet example, so we might need to change the explora blocking and elecrum wallet examples.
Since we are using the
bdk_sqlitecrate now, we don't needtempdir.
Done! We are using bdk_sqlite now instead of tempdir in all wallet_* examples.
Ready for a new quick round of reviews @ValuedMammal and @oleonardolima
This is beautiful. I'm wondering if we should change the faucet address to one that we know will be able to recycle the sats, probably doesn't need to be done now though, and to be honest I usually don't broadcast when running the example code anyway.
That's a good point, maybe we could use one that's been used by @thunderbiscuit for the tests on the CI ? 🤔
rebased
FYI I'm in the process of securing signet satoshis for the foundation. Once I have them I'll let everyone know in the chat and I can send the to whatever wallets we need.
Thanks @ValuedMammal. I've incorporated all of your suggestions, rebased and squashed everything into a single fix: wallet examples commit.
Just to recap I think there's a few things missing. Not sure if maybe something went wrong during a rebase. If we can fix these then I'd like to merge it soon to avoid more review churn.
- Bring back the calls to
wallet.take_staged()anddb.write() - For electrum remember to use the new
populate_tx_cachemethod - Fix typo in README, https://github.com/bitcoindevkit/bdk/pull/1442#discussion_r1663126729
- For wallet_rpc I don't mind hardcoding the descriptors, just make sure the wallet_rpc/README matches the output of the help command
cargo run --bin wallet_rpc -- --help
Just to recap I think there's a few things missing. Not sure if maybe something went wrong during a rebase. If we can fix these then I'd like to merge it soon to avoid more review churn.
* Bring back the calls to `wallet.take_staged()` and `db.write()` * For electrum remember to use the new `populate_tx_cache` method * Fix typo in README, [fix: wallet examples #1442 (comment)](https://github.com/bitcoindevkit/bdk/pull/1442#discussion_r1663126729) * For wallet_rpc I don't mind hardcoding the descriptors, just make sure the wallet_rpc/README matches the output of the help command `cargo run --bin wallet_rpc -- --help`
@ValuedMammal Thank you so much for going through this. I made a mess in a rebase and all of these things were reverted back somehow. They are properly fixed now.
self-ACK 31f8b9531cf28797bfbc882f73d8660b43cebcbe
@notmandatory This looks good to me
rebased
Remember to include the "rusqlite" feature in Cargo.toml for any example crates that use it
Concept ACK, although changes in #1478 are going to somewhat conflict with this (expect a rebase). I would appreciate it if we merge #1478 before this one (since that one is a larger PR).
@storopoli we can close this one now right?