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

Merged
merged 43 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
43 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
479687c
Merge branch 'main' into feat/add-rpc-header-arg
elizabethengelman Oct 3, 2024
9ecb45f
Fixes after merging main
elizabethengelman Oct 3, 2024
6032085
More fixes after merge
elizabethengelman Oct 7, 2024
c240a54
Add an rpc_client fn to Network impl
elizabethengelman Oct 7, 2024
799027c
Remove RpcClient and use network.rpc_client() instead
elizabethengelman Oct 7, 2024
b13f732
Clean up tests
elizabethengelman Oct 7, 2024
15e6991
Merge branch 'main' into feat/add-rpc-header-arg
elizabethengelman Oct 11, 2024
fdbd9b8
Cleanup after merging in main
elizabethengelman Oct 11, 2024
7e60f2e
update rs-stellar-rpc-client ref
leighmcculloch Oct 14, 2024
2ecc362
updated docs and renamed arg
leighmcculloch Oct 14, 2024
34545d3
clippy tweaks
leighmcculloch Oct 14, 2024
79197fc
trim whitespace
leighmcculloch Oct 14, 2024
d51c6f3
tweak error
leighmcculloch Oct 14, 2024
52a1f5f
fix
leighmcculloch Oct 14, 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 @@ -1340,6 +1365,7 @@ Sign a transaction envelope appending the signature to the envelope
* `--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`
* `--sign-with-lab` — Sign with <https://lab.stellar.org>
* `--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 @@ -1356,6 +1382,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
7 changes: 5 additions & 2 deletions cmd/soroban-cli/src/commands/contract/deploy/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ use crate::{
NetworkRunnable,
},
config::{self, data, network},
rpc::{Client, Error as SorobanRpcError},
rpc::Error as SorobanRpcError,
rpc_client::{Error as RpcClientError, RpcClient},
utils::{contract_id_hash_from_asset, parsing::parse_asset},
};

Expand All @@ -44,6 +45,8 @@ pub enum Error {
Data(#[from] data::Error),
#[error(transparent)]
Network(#[from] network::Error),
#[error(transparent)]
RpcClient(#[from] RpcClientError),
}

impl From<Infallible> for Error {
Expand Down Expand Up @@ -93,7 +96,7 @@ impl NetworkRunnable for Cmd {
let asset = parse_asset(&self.asset)?;

let network = config.get_network()?;
let client = Client::new(&network.rpc_url)?;
let client = RpcClient::new(network.clone())?;
client
.verify_network_passphrase(Some(&network.network_passphrase))
.await?;
Expand Down
7 changes: 5 additions & 2 deletions cmd/soroban-cli/src/commands/contract/deploy/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ use soroban_env_host::{
use crate::{
commands::{contract::install, HEADING_RPC},
config::{self, data, locator, network},
rpc::{self, Client},
rpc,
rpc_client::{Error as RpcClientError, RpcClient},
utils, wasm,
};
use crate::{
Expand Down Expand Up @@ -115,6 +116,8 @@ pub enum Error {
InvalidAliasFormat { alias: String },
#[error(transparent)]
Locator(#[from] locator::Error),
#[error(transparent)]
RpcClient(#[from] RpcClientError),
}

impl Cmd {
Expand Down Expand Up @@ -208,7 +211,7 @@ impl NetworkRunnable for Cmd {
None => rand::thread_rng().gen::<[u8; 32]>(),
};

let client = Client::new(&network.rpc_url)?;
let client = RpcClient::new(network.clone())?;
client
.verify_network_passphrase(Some(&network.network_passphrase))
.await?;
Expand Down
8 changes: 5 additions & 3 deletions cmd/soroban-cli/src/commands/contract/extend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use crate::{
NetworkRunnable,
},
config::{self, data, locator, network},
key,
rpc::{self, Client},
key, rpc,
rpc_client::{Error as RpcClientError, RpcClient},
wasm, Pwd,
};

Expand Down Expand Up @@ -86,6 +86,8 @@ pub enum Error {
Network(#[from] network::Error),
#[error(transparent)]
Locator(#[from] locator::Error),
#[error(transparent)]
RpcClient(#[from] RpcClientError),
}

impl Cmd {
Expand Down Expand Up @@ -131,7 +133,7 @@ impl NetworkRunnable for Cmd {
let network = config.get_network()?;
tracing::trace!(?network);
let keys = self.key.parse_keys(&config.locator, &network)?;
let client = Client::new(&network.rpc_url)?;
let client = RpcClient::new(network.clone())?;
let key = config.source_account()?;
let extend_to = self.ledgers_to_extend();

Expand Down
12 changes: 7 additions & 5 deletions cmd/soroban-cli/src/commands/contract/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ use std::{fmt::Debug, fs, io};

use clap::{arg, command, Parser};

use crate::commands::{global, NetworkRunnable};
use crate::config::{
self, locator,
network::{self, Network},
use crate::{
commands::{global, NetworkRunnable},
config::{
self, locator,
network::{self, Network},
},
wasm, Pwd,
};
use crate::{wasm, Pwd};

#[derive(Parser, Debug, Default, Clone)]
#[allow(clippy::struct_excessive_bools)]
Expand Down
24 changes: 16 additions & 8 deletions cmd/soroban-cli/src/commands/contract/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ use soroban_env_host::xdr::{
};

use super::restore;
use crate::commands::txn_result::{TxnEnvelopeResult, TxnResult};
use crate::commands::{global, NetworkRunnable};
use crate::config::{self, data, network};
use crate::key;
use crate::print::Print;
use crate::rpc::{self, Client};
use crate::{utils, wasm};
use crate::{
commands::{
global,
txn_result::{TxnEnvelopeResult, TxnResult},
NetworkRunnable,
},
config::{self, data, network},
key,
print::Print,
rpc,
rpc_client::{Error as RpcClientError, RpcClient},
utils, wasm,
};

const CONTRACT_META_SDK_KEY: &str = "rssdkver";
const PUBLIC_NETWORK_PASSPHRASE: &str = "Public Global Stellar Network ; September 2015";
Expand Down Expand Up @@ -70,6 +76,8 @@ pub enum Error {
Network(#[from] network::Error),
#[error(transparent)]
Data(#[from] data::Error),
#[error(transparent)]
RpcClient(#[from] RpcClientError),
}

impl Cmd {
Expand Down Expand Up @@ -100,7 +108,7 @@ impl NetworkRunnable for Cmd {
let config = config.unwrap_or(&self.config);
let contract = self.wasm.read()?;
let network = config.get_network()?;
let client = Client::new(&network.rpc_url)?;
let client = RpcClient::new(network.clone())?;
client
.verify_network_passphrase(Some(&network.network_passphrase))
.await?;
Expand Down
Loading
Loading