Skip to content

Refactor bdk-cli structure #278

Open
tvpeter wants to merge 13 commits intobitcoindevkit:masterfrom
tvpeter:refactor/restructure-project
Open

Refactor bdk-cli structure #278
tvpeter wants to merge 13 commits intobitcoindevkit:masterfrom
tvpeter:refactor/restructure-project

Conversation

@tvpeter
Copy link
Copy Markdown
Collaborator

@tvpeter tvpeter commented Apr 21, 2026

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

This PR introduces new subdirectories under src:
src/
|---- commands/ # all command structures
|---- config/ # Wallet configuration related operations
|---- handlers/ # subdirectory for all command handlers
|---- backend/ # all blockchain backends
|----- utils/ # general helpers
|----- main.rs # entry point

Also, FormatOutput trait is added to format outputs (both JSON and tabular), which is implemented by all types presenting data response to the user. Below are the handler modules that will use the introduced types:

  • offline
  • online
  • repl
  • descriptor
  • config
  • key
  • wallets

Changelog notice

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 5.06415% with 1406 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.35%. Comparing base (7c33b33) to head (70965f0).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/handlers/types.rs 6.34% 236 Missing ⚠️
src/handlers/offline.rs 0.00% 221 Missing ⚠️
src/handlers/online.rs 0.00% 191 Missing ⚠️
src/utils/descriptors.rs 0.00% 138 Missing ⚠️
src/utils/common.rs 0.00% 134 Missing ⚠️
src/handlers/mod.rs 7.04% 132 Missing ⚠️
src/handlers/config.rs 0.00% 83 Missing ⚠️
src/backend/mod.rs 0.00% 77 Missing ⚠️
src/handlers/repl.rs 0.00% 61 Missing ⚠️
src/handlers/descriptor.rs 0.00% 54 Missing ⚠️
... and 4 more
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     
Flag Coverage Δ
rust 8.35% <5.06%> (-2.62%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tvpeter tvpeter marked this pull request as ready for review April 21, 2026 12:59
@tvpeter tvpeter self-assigned this Apr 24, 2026
@tvpeter tvpeter added the enhancement New feature or request label Apr 24, 2026
tvpeter added 12 commits April 29, 2026 13:19
- 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
@tvpeter tvpeter force-pushed the refactor/restructure-project branch from 8fc06d8 to 2ce28b2 Compare April 29, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant