Refactor bdk-cli structure #278
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #278 +/- ##
=========================================
- Coverage 10.96% 8.35% -2.62%
=========================================
Files 8 20 +12
Lines 2526 2383 -143
=========================================
- Hits 277 199 -78
+ Misses 2249 2184 -65
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- move all blockchain clients code into the backend subdirectory - move commands.rs content into commands subdirectory
- split util fns into `descriptors` and `common`
- move persister into wallet subdirectory - update imports in payjoin module
- split handlers into top level commands config, key and descriptors
- move handler fns into offline, online, wallets modules
- split handler fns into repl - add entry point to the handlers subdir - add wallet subdir entry point
- add trait for formatting outputs - add types for presenting data to the output - refactor offline mod to use types
- add types for descriptor, key and wallets mods
- add simple table helper fn for creating tables - refactor types to use simple table helper - add type defs for key, wallets and descriptors
- rebase master for bip322 feature - update types to use simple table helper
8fc06d8 to
2ce28b2
Compare
|
concept ACK, this is a big change might be a good idea to do a live walk through some time on discord to help with the review process. |
Alright, anytime we are chanced. Also, I would want most of the PRs to get in before this one because it will be challenging for others to rebase and fix conflicts. |
- move wallet subdir into the persister module to simplify the structure as wallet was confusing
- remove --pretty flag - move types to utils - update commands
- add run fn in main to handle routing
- move execution logic into config, desc and key modules
- fix execution logic for subcommands under offline and online wallet subcommands
04dd213 to
de1fc98
Compare
Description
This PR restructures the bdk-cli codebase to move away from a monolithic handling model towards a modular architecture. The primary goal is to improve code readability, simplify the addition of new features, and decouple core logic into smaller modules.
Notes to the reviewers
To achieve the above-stated goal, maximum effort was made to prevent introducing new bugs. As a result, the existing execution logic was preserved as much as possible.
This PR introduces two new subdirectories under
src:config,descriptor,key,offline,onlineandreplmodules. They each contain structures for the subcommand, execution logic, and implementation of the top-level enum.typesmodule that defines response structures.Other notable changes:
clientmodule, and it defines the enum that holds all the available clients, as well asimplthe functionalities such as broadcasting transactions and syncing operations.AppCommandtrait that defines how each subcommand should be structured and theexecutemethod they should implement.AppContextstruct that holds the universal parameters that subcommands may need. Each subcommand's execute method accept this struct and use the params for its execution.FormatOutputtrait, which is implemented by alltypespresenting data response to the user.walletsubdirectory into thepersistermodule that defines all structures and functionalities related to persistence.Changelog notice
key derivesubcommand, when printing help message, the clap arg for env=“PATH” often pull all system and displays all system paths. This has been changed to derivation_path I.e. env=“DERIVATION_PATH” to prevent clap from picking the system paths and rendering itChecklists
All Submissions:
cargo fmtandcargo clippybefore committing