Introduce `bdk::Wallet` builder API
Description
This changes the wallet-construction API to use the builder pattern. This is a simpler API and allows us to avoid multiple constructor methods.
I.e. previously, we had Wallet::new and Wallet::new_with_genesis_hash. If in the future, we added more parameters, it will turn into an absolute mess.
Notes to the reviewers
This PR is based on #1229. Consider reviewing/merging that first!
I think it makes sense to have the lookahead configurable in bdk::Wallet and persisted. However, @LLFourn is against this idea of persisting the lookahead. This can be of discussion for a future change.
Changelog notice
- Changed wallet-construction API to use the builder pattern.
- Changed
NewErrortoInitErrorandNewOrLoadErrortoInitOrLoadError.
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
- [x] I've added docs for the new feature
Concept ACK, this pattern should also be easier to extend to support future features like custom coin selection. But I'd like to push it to the alpha.4 release, alpha.3 is already long overdue.
@notmandatory if we wish to make the lookahead configurable in bdk::Wallet for alpha.3, I think it will be a good idea to include this in the release. Otherwise, I am okay with pushing this back.
Concept ACK
It makes sense to complete this AFTER #1203 is merged (as that PR also touches wallet constructors).
This one needs a rebase after alpha.5 release.
Builder pattern already introduced.