Skip to content
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

Feat/add rpc header arg #1618

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1c4af14
Add rpc-header as an optional arg for network add
elizabethengelman Sep 20, 2024
c6e5ba2
Use --rpc-header in the rest of the commands
elizabethengelman Sep 20, 2024
b2e1722
Update generated docs
elizabethengelman Sep 24, 2024
79e12b3
Update doc strings for rpc-header
elizabethengelman Sep 25, 2024
cd598db
Merge branch 'main' into feat/add-rpc-header-arg
elizabethengelman Sep 25, 2024
fc56739
Wip: use rpc::Client::new_with_headers in events command
elizabethengelman Sep 26, 2024
c10f903
Start to create an RpcClient wrapper
elizabethengelman Sep 26, 2024
45b5504
use RpcClient wrapper in contract extend
elizabethengelman Sep 26, 2024
946bb62
User RpcClient wrapper in contract install
elizabethengelman Sep 26, 2024
12cc842
User RpcClient wrapper in contract invoke
elizabethengelman Sep 26, 2024
4e2804d
User RpcClient wrapper in contract read
elizabethengelman Sep 26, 2024
18c2b60
User RpcClient wrapper in cotract restore
elizabethengelman Sep 26, 2024
d59d982
User RpcClient wrapper in deploy asset
elizabethengelman Sep 26, 2024
d67a607
User RpcClient wrapper in deploy wasm
elizabethengelman Sep 26, 2024
12275bc
User RpcClient wrapper in tx send
elizabethengelman Sep 26, 2024
e8f32ea
User RpcClient wrapper in tx simulate
elizabethengelman Sep 26, 2024
59a96f2
Make crate imports consistent
elizabethengelman Sep 26, 2024
1534839
Merge branch 'main' into feat/add-rpc-header-arg
elizabethengelman Sep 27, 2024
d90bc5d
Use RpcClient wrapper in wasm
elizabethengelman Sep 27, 2024
4fb8679
Use RpcClient wrapper in info shared
elizabethengelman Sep 27, 2024
0ce2ed8
Use RpcClient wrapper in config mod
elizabethengelman Sep 27, 2024
88cd056
Validate passed in headers
elizabethengelman Sep 27, 2024
781901f
Allow for multiple rpc_headers
elizabethengelman Sep 27, 2024
ddd05cf
Merge branch 'main' into feat/add-rpc-header-arg
elizabethengelman Sep 30, 2024
baaa7ba
Change value_delimiter to newline
elizabethengelman Sep 30, 2024
8808af6
Cleanup
elizabethengelman Sep 30, 2024
b44da09
Check in generate docs
elizabethengelman Sep 30, 2024
5febc73
Fix: make sure to use rpc-headers / STELLAR_RPC_HEADERS
elizabethengelman Sep 30, 2024
ec4b7d4
Clippy
elizabethengelman Sep 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Get Id of builtin Soroban Asset Contract. Deprecated, use `stellar contract id a

* `--asset <ASSET>` — ID of the Stellar classic asset to wrap, e.g. "USDC:G...5"
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand All @@ -136,6 +137,7 @@ Deploy builtin Soroban Asset Contract

* `--asset <ASSET>` — ID of the Stellar classic asset to wrap, e.g. "USDC:G...5"
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand Down Expand Up @@ -182,6 +184,7 @@ Remove contract alias
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config

Expand All @@ -202,6 +205,7 @@ Add contract alias
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--overwrite` — Overwrite the contract alias if it already exists
Expand All @@ -224,6 +228,7 @@ Show the contract id associated with a given alias
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config

Expand Down Expand Up @@ -295,6 +300,7 @@ Generate a TypeScript / JavaScript package
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config

Expand Down Expand Up @@ -361,6 +367,7 @@ If no keys are specified the contract itself is extended.
Temporary

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand Down Expand Up @@ -389,6 +396,7 @@ Deploy a wasm contract
* `--wasm-hash <WASM_HASH>` — Hash of the already installed/deployed WASM file
* `--salt <SALT>` — Custom salt 32-byte salt for the token id
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand Down Expand Up @@ -422,6 +430,7 @@ Fetch a contract's Wasm binary
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config

Expand Down Expand Up @@ -450,6 +459,7 @@ Deploy builtin Soroban Asset Contract

* `--asset <ASSET>` — ID of the Stellar classic asset to wrap, e.g. "USDC:G...5"
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand All @@ -469,6 +479,7 @@ Deploy normal Wasm Contract

* `--salt <SALT>` — ID of the Soroban contract
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand Down Expand Up @@ -510,6 +521,7 @@ Outputs no data when no data is present in the contract.
* `--wasm-hash <WASM_HASH>` — Wasm hash to get the data for
* `--id <CONTRACT_ID>` — Contract id to get the data for
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--global` — Use global config
Expand Down Expand Up @@ -549,6 +561,7 @@ Outputs no data when no data is present in the contract.
* `--wasm-hash <WASM_HASH>` — Wasm hash to get the data for
* `--id <CONTRACT_ID>` — Contract id to get the data for
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--global` — Use global config
Expand Down Expand Up @@ -588,6 +601,7 @@ Outputs no data when no data is present in the contract.
* `--wasm-hash <WASM_HASH>` — Wasm hash to get the data for
* `--id <CONTRACT_ID>` — Contract id to get the data for
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--global` — Use global config
Expand Down Expand Up @@ -667,6 +681,7 @@ Install a WASM file to the ledger without creating a contract instance
###### **Options:**

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand Down Expand Up @@ -706,6 +721,7 @@ stellar contract invoke ... -- --help
* `--id <CONTRACT_ID>` — Contract ID to invoke
* `--is-view` — View the result simulating and do not sign and submit transaction. Deprecated use `--send=no`
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand Down Expand Up @@ -783,6 +799,7 @@ Print the current value of a contract-data ledger entry
Temporary

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand Down Expand Up @@ -820,6 +837,7 @@ If no keys are specificed the contract itself is restored.
* `--ledgers-to-extend <LEDGERS_TO_EXTEND>` — Number of ledgers to extend the entry
* `--ttl-ledger-only` — Only print the new Time To Live ledger
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand Down Expand Up @@ -880,6 +898,7 @@ Watch the network for contract events
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config

Expand Down Expand Up @@ -953,6 +972,7 @@ Fund an identity on a test network
###### **Options:**

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--hd-path <HD_PATH>` — If identity is a seed phrase use this hd path, default is 0
Expand Down Expand Up @@ -981,6 +1001,7 @@ Generate a new identity with a seed phrase, currently 12 words
* `--hd-path <HD_PATH>` — When generating a secret key, which `hd_path` should be used from the original `seed_phrase`
* `-d`, `--default-seed` — Generate the default seed phrase. Useful for testing. Equivalent to --seed 0000000000000000
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config

Expand Down Expand Up @@ -1065,6 +1086,7 @@ Add a new network
###### **Options:**

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key header
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
Expand Down Expand Up @@ -1275,6 +1297,7 @@ If a contract is a Stellar asset contract, it includes the asset issuer's accoun
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--archive-url <ARCHIVE_URL>` — Archive URL
Expand Down Expand Up @@ -1305,6 +1328,7 @@ Simulate a transaction envelope from stdin
###### **Options:**

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…")
Expand All @@ -1323,6 +1347,7 @@ Calculate the hash of a transaction envelope from stdin
###### **Options:**

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config

Expand All @@ -1339,6 +1364,7 @@ Sign a transaction envelope appending the signature to the envelope
* `--sign-with-key <SIGN_WITH_KEY>` — Sign with a local key. Can be an identity (--sign-with-key alice), a secret key (--sign-with-key SC36…), or a seed phrase (--sign-with-key "kite urban…"). If using seed phrase, `--hd-path` defaults to the `0` path
* `--hd-path <HD_PATH>` — If using a seed phrase to sign, sets which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0`
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--global` — Use global config
Expand All @@ -1355,6 +1381,7 @@ Send a transaction envelope to the network
###### **Options:**

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADER>` — Optional RPC provider api key headers
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--global` — Use global config
Expand Down
1 change: 1 addition & 0 deletions cmd/crates/soroban-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ impl TestEnv {
config::Args {
network: network::Args {
rpc_url: Some(self.rpc_url.clone()),
rpc_header: None,
network_passphrase: Some(LOCAL_NETWORK_PASSPHRASE.to_string()),
network: None,
},
Expand Down
17 changes: 17 additions & 0 deletions cmd/soroban-cli/src/config/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ pub struct Args {
help_heading = HEADING_RPC,
)]
pub rpc_url: Option<String>,
/// Optional RPC provider api key headers
elizabethengelman marked this conversation as resolved.
Show resolved Hide resolved
#[arg(
long = "rpc-header",
requires = "rpc_url",
env = "STELLAR_RPC_HEADER",
help_heading = HEADING_RPC,
)]
pub rpc_header: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should probably be a multi-value key, therefore be a Vec<String>, but as far as I know the clap-rs env feature doesn't work well with it. We'd have to try it out.

Given all use cases we have only need a single header at this time, then as it is looks good, but if you wanted to do a mini timeboxed exploration on whether Vec<String> is supported with env in some way, and it turned out it worked, then I'd change it to:

Suggested change
/// Optional RPC provider api key headers
#[arg(
long = "rpc-header",
requires = "rpc_url",
env = "STELLAR_RPC_HEADER",
help_heading = HEADING_RPC,
)]
pub rpc_header: Option<String>,
/// Optional RPC provider api key headers
#[arg(
long = "rpc-header",
num_args(0..),
requires = "rpc_url",
env = "STELLAR_RPC_HEADERS",
help_heading = HEADING_RPC,
)]
pub rpc_header: Vec<String>,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of making this a vec of strings - it seems like there's a possibility that users may want to pass multiple headers to their rpc requests.

I think that we are doing something similar to this with the --with-example flag in stellar contract init, that allows for passing multiple values like this: stellar contract init --with-example alloc --with-example auth

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just re-reading your comment, and I missed the env part the first time. I'll timebox looking into this today 👌

Copy link
Contributor

@overcat overcat Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to define it as Vec<(String, String)>. This would help allow users to more clearly pass in multiple headers, and it would also be simpler when handling STELLAR_RPC_HEADER env.

The code may be helpful: https://github.com/lightsail-network/stellar-cli/blob/5d93640d2d2f629c91cabd0340ec7f59bac6ebd9/cmd/soroban-cli/src/config/network.rs#L122-L152

(This is the code I wrote a few days ago, and at that time I didn't realize there was already an existing PR here.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @overcat! I agree that rpc_header should be a vec, and I like that you made it a vec of tuples instead! 👌 That definitely makes it easier to handle STELLAR_RPC_HEADER. 🎉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that work with env vars though? I don't think the clap env feature knows what to do with multiple values inside the env. Or can you share an example of what hte cli and env UX becomes with this?

Copy link
Contributor

@overcat overcat Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @leighmcculloch, I think it is supported, please check the screenshot.

image

Because we used value_delimiter = '\n', it will need to be line-separated, but you can use a different delimiter based on your needs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding to this, I've put screenshots in the pr description showing that multiple headers work for adding a network and using the configured rpc provider.

/// Network passphrase to sign the transaction sent to the rpc server
#[arg(
long = "network-passphrase",
Expand Down Expand Up @@ -79,6 +87,7 @@ impl Args {
{
Ok(Network {
rpc_url,
rpc_header: self.rpc_header.clone(),
network_passphrase,
})
} else {
Expand All @@ -97,6 +106,13 @@ pub struct Network {
help_heading = HEADING_RPC,
)]
pub rpc_url: String,
/// Optional RPC provider api key header
elizabethengelman marked this conversation as resolved.
Show resolved Hide resolved
#[arg(
long = "rpc-header",
env = "STELLAR_RPC_HEADER",
help_heading = HEADING_RPC,
)]
pub rpc_header: Option<String>,
/// Network passphrase to sign the transaction sent to the rpc server
#[arg(
long,
Expand Down Expand Up @@ -202,6 +218,7 @@ impl From<&(&str, &str)> for Network {
fn from(n: &(&str, &str)) -> Self {
Self {
rpc_url: n.0.to_string(),
rpc_header: None,
network_passphrase: n.1.to_string(),
}
}
Expand Down
Loading