-
Couldn't load subscription status.
- Fork 83
Add saving wallet config with bdk-cli wallet config
#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
base: master
Are you sure you want to change the base?
Conversation
9e56084 to
b3966e3
Compare
Pull Request Test Coverage Report for Build 18853801376Details
💛 - Coveralls |
b3966e3 to
bf14df8
Compare
|
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 Creating the config file in rust should be easier to maintain/keep in sync than your |
Alright, I will update. |
bf14df8 to
36ee973
Compare
bdk-cli wallet init
5125cf8 to
fcf7ce8
Compare
@notmandatory I have updated the PR |
f77b1da to
70a5390
Compare
9461e85 to
5d9feb0
Compare
|
I need to start keeping track of all these awesome new features I honestly see the PRs come in and can't keep up. This is super cool. |
Thank you @thunderbiscuit |
9549e09 to
0f6b320
Compare
|
I spent some time today reviewing and even though this looks like a workable way to do it and is based on my suggestion I'm afraid it's going to be a hassle to maintain. I've been experimenting with somehow using the different clap parsing functions (https://docs.rs/clap/latest/clap/trait.Parser.html) but so far haven't figured out a better way. I'd like to keep thinking about it. We might have to simplify the problem somehow such as by not trying to merge loaded and CLI args. |
Thank you @notmandatory. Also, for the Parser trait, I read that it does not allow interacting with an external resource such as reading a file as I would want it. I will also be trying out other approaches in case there is a cleaner way to handle it. |
|
How about something like:
|
0f6b320 to
30fa3a0
Compare
Hi @notmandatory, there is an issues that we did not envisage and discuss on this PR that came up during implementation: |
512b4b5 to
ea0315c
Compare
|
Good point. Yes I agree a new top level command makes sense to list the wallets. Either "wallets" as you suggest or "list" makes sense to me. |
bdk-cli wallet initbdk-cli wallet config
bdk-cli wallet configbdk-cli wallet config
7cd062b to
28796ca
Compare
- 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]
- rename init to config and move walletopts as config options
77864b4 to
c5c4fdb
Compare
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.
I found an error when testing with testnet4, and a couple small nits should be fixed too. Otherwise this looks good.
In the future if everyone prefers the config approach it should probably become the only way to use the wallet features.
README.md
Outdated
|
|
||
|
|
||
| ```shell | ||
| cargo run --features electrum wallet -w my_wallet new_address |
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.
⛏️ nit, has extra space:
| cargo run --features electrum wallet -w my_wallet new_address | |
| cargo run --features electrum wallet -w my_wallet new_address |
src/commands.rs
Outdated
| #[arg(env = "WALLET_NAME", short = 'w', long = "wallet")] | ||
| #[arg(skip)] | ||
| pub wallet: Option<String>, | ||
| // #[arg(env = "WALLET_NAME", short = 'w', long = "wallet", required = true)] |
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.
Commented out line should be removed.
| // #[arg(env = "WALLET_NAME", short = 'w', long = "wallet", required = true)] |
| "bitcoin" => Ok(Network::Bitcoin), | ||
| "testnet" => Ok(Network::Testnet), | ||
| "regtest" => Ok(Network::Regtest), | ||
| "signet" => Ok(Network::Signet), |
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.
🔨 need to add Testnet4:
| "signet" => Ok(Network::Signet), | |
| "signet" => Ok(Network::Signet), | |
| "testnet4" => Ok(Network::Testnet4), |
- add wallets command - add warning for using priv descriptors - update readme - add loading network from config - fix review comments
c5c4fdb to
7be9a30
Compare
Thank you for catching all these.
Yes, I agree. |
Description
This PR adds
bdk-cli wallet configcommand to save wallet configuration information toconfig.tomlfile in the data directory.Fixes #192
Notes to the reviewers
serdecrate frombdk_walletdid not offer thederivefeatureChangelog notice
configto save wallet configswalletscommand to show all saved wallet configsChecklists
Features
wallet [-f] [-w <name>] config <wallet opts>wallet [-w <name>] sync | balance | new_address |etc...repl [-w <name>]walletsAll Submissions:
cargo fmtandcargo clippybefore committingNew Features:
CHANGELOG.md