Skip to content

Add initializing wallet configuration with bdk-cli wallet init #203

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tvpeter
Copy link
Collaborator

@tvpeter tvpeter commented Jun 18, 2025

Description

This PR adds bdk-cli wallet init command to save wallet configuration information to config.toml file in the data directory.

Fixes #192

Notes to the reviewers

  • Reusing the exported serde crate from bdk_wallet did not offer the derive feature
  • CLI parameters have higher precedence over saved config values

Checklists

All Submissions:

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

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature
  • I've updated CHANGELOG.md

@tvpeter tvpeter force-pushed the feat/init-wallet-support branch from 9e56084 to b3966e3 Compare June 18, 2025 20:41
@coveralls
Copy link

coveralls commented Jun 18, 2025

Pull Request Test Coverage Report for Build 15923676961

Details

  • 0 of 237 (0.0%) changed or added relevant lines in 5 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.3%) to 2.372%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/main.rs 0 3 0.0%
src/utils.rs 0 26 0.0%
src/commands.rs 0 34 0.0%
src/config.rs 0 84 0.0%
src/handlers.rs 0 90 0.0%
Files with Coverage Reduction New Missed Lines %
src/utils.rs 2 0.0%
Totals Coverage Status
Change from base Build 15731603419: -0.3%
Covered Lines: 25
Relevant Lines: 1054

💛 - Coveralls

@tvpeter tvpeter force-pushed the feat/init-wallet-support branch from b3966e3 to bf14df8 Compare June 19, 2025 04:32
@tvpeter tvpeter requested a review from notmandatory June 19, 2025 04:33
@notmandatory notmandatory moved this to Ready to Review in BDK-CLI Jun 24, 2025
@notmandatory notmandatory added this to the CLI 1.1.0 milestone Jun 24, 2025
@notmandatory
Copy link
Member

notmandatory commented Jun 24, 2025

I like the approach for loading the config file parameters if the file exists, but is there a reason you didn't add a CLI bdk-cli wallet init ... command in rust to create the config file rather than using just ?

Creating the config file in rust should be easier to maintain/keep in sync than your just approach and shouldn't take too much more than adding the Serialize trait to WalletConfigInner. You should be able to reuse the WalletOpts to capture the values with clap that you need to put in the config file too.

@notmandatory notmandatory added the enhancement New feature or request label Jun 24, 2025
@tvpeter
Copy link
Collaborator Author

tvpeter commented Jun 24, 2025

I like the approach for loading the config file parameters if the file exists, but is there a reason you didn't add a CLI bdk-cli wallet init ... command in rust to create the config file rather than using just ?

Creating the config file in rust should be easier to maintain/keep in sync than your just approach and shouldn't take too much more than adding the Serialize trait to WalletConfigInner. You should be able to reuse the WalletOpts to capture the values with clap that you need to put in the config file too.

Alright, I will update.

- add config.rs to store and retrieve
values
- add toml and serde crates for desearilizing and
reading values
- update utils, commands and handlers files
to use values from config.toml
-refactor prepare_wallet_db fn
- fix clippy issues

[Issue: bitcoindevkit#192]
@tvpeter tvpeter force-pushed the feat/init-wallet-support branch from bf14df8 to 36ee973 Compare June 27, 2025 04:04
@tvpeter tvpeter changed the title Add initializing wallet configuration with Justfile Add initializing wallet configuration with bdk-cli wallet init Jun 27, 2025
@tvpeter tvpeter force-pushed the feat/init-wallet-support branch 3 times, most recently from a99ff5d to 5125cf8 Compare June 27, 2025 09:59
- update wallet initialization to use `bdk-cli
wallet init` command directly and read walletopts
- update README for how to use the bdk-cli wallet
init command
- fix clippy warnings

[Issue: bitcoindevkit#192]
@tvpeter tvpeter force-pushed the feat/init-wallet-support branch from 5125cf8 to fcf7ce8 Compare June 27, 2025 10:03
@tvpeter
Copy link
Collaborator Author

tvpeter commented Jun 27, 2025

Alright, I will update.

@notmandatory I have updated the PR

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: Ready to Review
Development

Successfully merging this pull request may close these issues.

Add "init" wallet support
3 participants