Repository navigation
docs(readme): document env vars accepted by wallet config #387
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -334,10 +334,12 @@ The `wallet config` sub-command allows you to save wallet settings to a `config. | |||||
| To save a wallet settings: | ||||||
|
|
||||||
| ```shell | ||||||
| cargo run --features <list-of-features> -- -n <network> wallet --wallet <wallet_name> config [ -f ] --ext-descriptor <ext_descriptor> --int-descriptor <int_descriptor> --client-type <client_type> --url <server_url> [--database-type <database_type>] [--rpc-user <rpc_user>] | ||||||
| [--rpc-password <rpc_password>] | ||||||
| cargo run --features <list-of-features> -- -n <network> wallet --wallet <wallet_name> config [ -f ] --ext-descriptor <ext_descriptor> --int-descriptor <int_descriptor> --client-type <client_type> --url <server_url> --database-type <database_type> [--basic-auth <user:password>] | ||||||
| [<cookie>] | ||||||
| ``` | ||||||
|
|
||||||
| The `--basic-auth` option and the `<cookie>` file path apply to the `rpc` backend. If a cookie is given, it is used instead of the user and password. | ||||||
|
|
||||||
| For example, to initialize a wallet named `my_wallet` with `electrum` as the backend on `signet` network: | ||||||
|
|
||||||
| ```shell | ||||||
|
|
@@ -346,6 +348,29 @@ cargo run --features electrum -- -n signet wallet -w my_wallet config -e "tr(tpr | |||||
|
|
||||||
| To overwrite an existing wallet configuration, use the `--force` flag after the `config` sub-command. | ||||||
|
|
||||||
| #### Setting options with environment variables | ||||||
|
|
||||||
| Most `wallet config` options can also be set through an environment variable. A flag given on the command line takes precedence over its variable. The values are saved to `config.toml`, and the other wallet commands read that file, so changing a variable later does not change a wallet that is already saved. | ||||||
|
|
||||||
| | Variable | Option | Used by | | ||||||
| | --- | --- | --- | | ||||||
| | `NETWORK` | `-n`, `--network` | all commands | | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: $ bdk-cli wallets list | jq .test.network
"regtest"
$ NETWORK=signet bdk-cli wallet -w test new_address
{
"address": "bcrt1qlffd4csc5uh3zwnk65tlu2f90mchkmf579n8ra",
"index": 0
}
$ bdk-cli --network=signet wallet -w test new_address
{
"address": "bcrt1qaws6qt0jhl7n3u8zxwsueg2yhcf8j4p3wyecly",
"index": 1
}
Suggested change
|
||||||
| | `EXT_DESCRIPTOR` | `-e`, `--ext-descriptor` | `wallet config` | | ||||||
| | `INT_DESCRIPTOR` | `-i`, `--int-descriptor` | `wallet config` | | ||||||
| | `CLIENT_TYPE` | `-c`, `--client-type` | `wallet config` | | ||||||
| | `DATABASE_TYPE` | `-d`, `--database-type` | `wallet config` | | ||||||
| | `SERVER_URL` | `-u`, `--url` | `wallet config`, backends `electrum`, `esplora` and `rpc` | | ||||||
| | `ELECTRUM_BATCH_SIZE` | `-b`, `--batch-size` | `wallet config`, backend `electrum` | | ||||||
| | `ESPLORA_PARALLEL_REQUESTS` | `-p`, `--parallel-requests` | `wallet config`, backend `esplora` | | ||||||
| | `RPC_BASIC_AUTH` | `-a`, `--basic-auth` (as `user:password`) | `wallet config`, backend `rpc` | | ||||||
| | `COOKIE` | the `<cookie>` argument | `wallet config`, backend `rpc` | | ||||||
| | `PROXY_ADDRS_PORT` | `--proxy` | `wallet config`, backends `electrum`, `esplora` and `cbf` | | ||||||
| | `PROXY_USER_PASSWD` | `--proxy_auth` (as `user:password`) | `wallet config`, backends `electrum` and `esplora` | | ||||||
| | `PROXY_RETRIES` | `-r`, `--retries` | `wallet config`, backends `electrum` and `esplora` | | ||||||
| | `PROXY_TIMEOUT` | `-t`, `--timeout` | `wallet config`, backends `electrum` and `esplora` | | ||||||
|
|
||||||
| `DATADIR` (`-d`, `--datadir`) and `WALLET_NAME` (`-w`, `--wallet`) can also be set via the environment. `DATADIR` is not stored; it only indicates the directory where wallet data and `config.toml` are stored. `WALLET_NAME` is stored as the key of the wallet entry in the `wallets` HashMap in `config.toml`. | ||||||
|
|
||||||
| #### Using a Configured Wallet | ||||||
|
|
||||||
| Once configured, use any wallet command with just the wallet name: | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.