Add command to delete saved wallet config - #312
Conversation
9c25d3d to
e987877
Compare
wallets --delete to remove saved wallet config
So |
tvpeter
left a comment
There was a problem hiding this comment.
I agree with the approach of the delete operation but the returned type of WalletList is unnecesary. If returning a message is not possible, then it is better to split the wallets into something like wallets list and wallets --delete <name>. So WalletsSubcommand will be the top-level.
| #[derive(Args, Debug, Clone, PartialEq)] | ||
| pub struct ListWalletsCommand; | ||
| pub struct WalletsCommand { | ||
| /// Delete the saved configuration for the given wallet instead of listing. |
There was a problem hiding this comment.
| /// Delete the saved configuration for the given wallet instead of listing. | |
| /// Delete the saved configuration for the given wallet. |
|
|
||
| /// List all saved wallet configurations. | ||
| Wallets(ListWalletsCommand), | ||
| /// List all saved wallet configurations, or delete one with `--delete`. |
There was a problem hiding this comment.
| /// List all saved wallet configurations, or delete one with `--delete`. | |
| /// Saved wallet configuration operations. |
|
@tvpeter, that makes sense. Splitting the operations would also fix the return type issue. Just to confirm, should this become |
Yes. We both said the same thing. |
e987877 to
011390e
Compare
wallets --delete to remove saved wallet config011390e to
f2a7e8f
Compare
|
Thanks for the first review! |
vadim-anfv
left a comment
There was a problem hiding this comment.
tACK f2a7e8f
Both of my earlier comments are addressed. I can't resolve the threads myself - could you close them?
Added two non-blocking notes inline.
|
|
||
| ## [Unreleased] | ||
|
|
||
| - Split saved wallet configuration operations into `wallets list` and `wallets delete <wallet_name>` |
There was a problem hiding this comment.
This entry and the "Changelog notice" in the PR description are out of sync - could you align them?
While you're here: plain bdk-cli wallets no longer works, and imo two entries would sit closer to https://keepachangelog.com/en/1.0.0/ and make that clearer. Up to you though:
| - Split saved wallet configuration operations into `wallets list` and `wallets delete <wallet_name>` | |
| - Replaced plain `wallets` with `wallets list` | |
| - Added `wallets delete <wallet_name>` to remove a saved wallet configuration |
| /// List saved wallet configurations. | ||
| List(ListWalletsCommand), | ||
|
|
||
| /// Delete a saved wallet configuration. |
There was a problem hiding this comment.
It would be great to have what you wrote in the PR description in wallets delete --help as well:
| /// Delete a saved wallet configuration. | |
| /// Delete a saved wallet configuration. | |
| /// | |
| /// Only the entry in `config.toml` is removed. Wallet data on disk is left in place. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #312 +/- ##
==========================================
+ Coverage 57.45% 57.66% +0.20%
==========================================
Files 22 22
Lines 3695 3725 +30
==========================================
+ Hits 2123 2148 +25
- Misses 1572 1577 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tvpeter
left a comment
There was a problem hiding this comment.
Thank you @yan-pi for working on this issue.
So having reconsidered the approach I suggested earlier, I think it may not be a good idea to delete saved configurations that have wallet data already persisted. So it will be better to handle it in such a way that, if the wallet data exists, return an error that wallet data exist for that configuration and do not delete the config. While it is possible to recreate the same config, the user might have lost the descriptors to do so. Also, if at all further down the line, we decide to consider deleting, it should also wipe the db file (for sqlite and much harder to even consider for redb) with a --force flag.
Aside that, kindly address the minor failing checks and review earlier by Vadim.
Thank you
Description
Adds
wallets delete <wallet_name>to remove a saved wallet configuration.Saved configurations can be listed with
wallets list.Resolves #310.
Notes to the reviewers
List and delete use separate handlers and outputs.
Delete only removes the entry from
config.toml.Wallet database files arenot removed.
Changelog notice
wallets deleteto remove a saved wallet configurationChecklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features:
CHANGELOG.md