-
Notifications
You must be signed in to change notification settings - Fork 412
Add ElectrumSync builder for one-liner wallet synchronization #2059
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
base: master
Are you sure you want to change the base?
Conversation
|
Heyy @oleonardolima, I think there is an issue with the CI - the |
evanlinjin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's always good to have a simplier API. However, this approach has too many sacrifices.
-
bdk_electrumshould only depend onbdk_core(and notbdk_chain). This way, we can make breaking changes tobdk_chainandbdk_electrumwill still be compatible with bothbdk_walletandbdk_chain(sincebdk_walletis on a different release cycle). -
We loose the cache once we drop
BdkElectrumClient. Subsequent syncs/scans cannot make use of the cache - affecting performance.
I'm not sure if these problems can be easily solved - maybe you have some ideas?
|
@Her-Code any updates on this? |
Hey, I’m still working on it. I’ve been a bit busy but will update you soon. |
I should be solved by now, you can do a rebase on top of master to get the latest fixed CI. |
I should be solved by now, you can do a rebase on top of master to get the latest fixed CI. -- Also, I agree with @evanlinjin comments, please mind those when continuing your working on this one. |
dfde574 to
5f4c4aa
Compare
- Added new `example_electrum_sync` crate module (lib.rs) implementing: - `ElectrumSyncManager` for long-lived Electrum connections - `SyncOptions` with builder-style convenience methods - One-liner sync API supporting fast sync and full scan - Internal helpers for building SyncRequest and FullScanRequest - Clean, documented, cache-preserving sync flow aligned with BDK rules - Updated `main.rs` to use the new manager: - Demonstrates fast sync, full scan, custom stop_gap, custom batch_size - Removed outdated `bdk-builder.rs` from the Electrum folder: - Functionality fully replaced by the new sync manager - Simplifies API surface and avoids conflicting builders
5f4c4aa to
1ff148a
Compare
|
Hey @evanlinjin , I removed bdk_builder.rs and introduced |
|
@Her-Code which module only depends on |
Summary
This PR addresses issue #1974.
It introduces a new fluent builder API for synchronizing wallets with Electrum servers, making wallet synchronization as simple as a one-liner call. The
ElectrumSyncbuilder provides an intuitive, chainable interface for configuring and executing wallet sync operations, significantly improving developer experience and reducing boilerplate code for common synchronization tasks.Features
Fluent Builder API: Implement fluent API forElectrumSyncconfigurationDual Sync Modes: Fast sync (revealed addresses only) and full scan (until stop gap)Configurable Parameters: Server URL, stop gap, batch size, and transaction output fetchingType Safety: AddElectrumSyncResult<K>type alias.bdk_buildermodule with sync functionality