Closed notmandatory closed 3 years ago
Thanks @notmandatory . This is a possible way to do it, but unfortunately, this also doesn't reduce our option arg namespace. So you will get the same conflicts with -b
flag, as without it. Because electrum
is on by default ( that turns on ProxyOpts
too) even if we don't need it at all.
I think the blockchain selection flag is kinda redundant because we are selecting blockchain backend at the build time itself with --features
flag.
I have tried around a few things and it seems to me that the easiest thing to do to solve all of our problems, is if we drop the default blockchain, and just specify a backend each time we build bdk-cli
.
We can have the repl
feature as default.
Without any blockchain feature bdk-cli
will just do the repl
things.
To have a full wallet we will specify a backend with --feature
flag.
This will allow us to have the same arg option names for different blockchins. Because using feature guard removes the codes from the binary, so clap won't complain because for it those options don't exist.
And I think we can reasonably explain this in the usage docs too.
I have tried this manually, and it produces nice compact --help
doc also only with the blockchain that is enabled. like this
--features rpc
OPTIONS:
-n, --rpc-node <ADDRESS:PORT>
Sets the full node address for rpc connection [default: 127.0.0.1:18443]
-c, --change_descriptor <CHANGE_DESCRIPTOR>
Sets the descriptor to use for internal addresses
-d, --descriptor <DESCRIPTOR>
Sets the descriptor to use for the external addresses
-x, --skip-blocks <SKIP_BLOCKS>
Optionally skip initial `skip_blocks` blocks
-A, --rpc-auth <USER:PASSWD>
Sets the rpc authentication username:password [default: admin:password]
-w, --wallet <WALLET_NAME>
Selects the wallet to use [default: main]
--features electrum
OPTIONS:
-c, --change_descriptor <CHANGE_DESCRIPTOR>
Sets the descriptor to use for internal addresses
-d, --descriptor <DESCRIPTOR>
Sets the descriptor to use for the external addresses
-p, --proxy <PROXY_ADDRS:PORT>
Sets the SOCKS5 proxy for Blockchain backend
-r, --retries <PROXY_RETRIES>
Sets the SOCKS5 proxy retries for the Electrum client [default: 5]
-t, --timeout <PROXY_TIMEOUT>
Sets the SOCKS5 proxy timeout for the Electrum client
-a, --proxy-auth <PROXY_USER:PASSWD>
Sets the SOCKS5 proxy credential
-s, --server <SERVER:PORT>
Sets the Electrum server to use [default: ssl://electrum.blockstream.info:60002]
-w, --wallet <WALLET_NAME>
Selects the wallet to use [default: main]
If this is something we wanna do, I can add it to my open PR. It's not a big change set.
@rajarshimaitra OK if this doesn't solve the conflicting params issue I'll close it and open a new one with your one blockchain client at a time solution. I'll add some docs and a compile error if users try building with two blockchain client features enabled. I'd rather keep this change as a separate PR to keep it simple to review.
Yes that makes sense. Better to do it via separate PR.
Description
Added the
--blockchain_client
or-b
wallet option so the user can explicitly select which blockchain client to use if multiple are available in the build. This will make adding new blockchain clients (such as #36) easier. Currentlyelectrum
is the default. I also added a default esplora server url so the user doesn't need to specify one if selecting that client, which is how the electrum and compact_filters clients work.The new wallet options looks like this (when all optional clients are enabled
--features esplora,compact_filters
):Notes to the reviewers
In the docs for the
blockchain_client
option it displays the default[electrum]
even if that feature is not enabled and all possible blockchain clients are displayed even if only some are enabled. I couldn't find a nice way to fix this, but the cli will throw an error if a blockchain client is selected that wasn't configured as a feature in the build.I also simplified the CHANGELOG to focus on what a user would see as a change while using the bin.
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
CHANGELOG.md
Bugfixes: