Skip to content

Commit

Permalink
Abstract default target network
Browse files Browse the repository at this point in the history
  • Loading branch information
alfiedotwtf committed Oct 8, 2024
1 parent 64a1fc0 commit a0fa2cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions forc-plugins/forc-client/src/op/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async fn deploy_chunked(

let storage_slots = resolve_storage_slots(command, compiled)?;
let chain_info = provider.chain_info().await?;
let target = Target::from_str(&chain_info.name).unwrap_or(Target::local());
let target = Target::from_str(&chain_info.name).unwrap_or_default();
let contract_url = match target.explorer_url() {
Some(explorer_url) => format!("{explorer_url}/contract/0x"),
None => "".to_string(),
Expand Down Expand Up @@ -257,7 +257,7 @@ async fn deploy_new_proxy(
.into();

let chain_info = provider.chain_info().await?;
let target = Target::from_str(&chain_info.name).unwrap_or(Target::local());
let target = Target::from_str(&chain_info.name).unwrap_or_default();
let contract_url = match target.explorer_url() {
Some(explorer_url) => format!("{explorer_url}/contract/0x"),
None => "".to_string(),
Expand Down Expand Up @@ -948,7 +948,7 @@ fn create_deployment_artifact(
let contract_id = ContractId::from_str(&deployment_artifact.contract_id).unwrap();
let pkg_name = manifest.project_name();

let target = Target::from_str(&chain_info.name).unwrap_or(Target::local());
let target = Target::from_str(&chain_info.name).unwrap_or_default();
let (contract_url, block_url) = match target.explorer_url() {
Some(explorer_url) => (
format!("{explorer_url}/contract/0x"),
Expand Down
2 changes: 1 addition & 1 deletion forc-plugins/forc-client/src/util/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub(crate) async fn select_account(
let first_account = accounts
.get(&0)
.ok_or_else(|| anyhow::anyhow!("No account derived for this wallet"))?;
let target = Target::from_str(&chain_info.name).unwrap_or(Target::local());
let target = Target::from_str(&chain_info.name).unwrap_or_default();
let faucet_link = format!("{}/?address={first_account}", target.faucet_url());
anyhow::bail!("Your wallet does not have any funds to pay for the transaction.\
\n\nIf you are interacting with a testnet consider using the faucet.\
Expand Down

0 comments on commit a0fa2cc

Please sign in to comment.