Skip to content

Commit

Permalink
Create rpc default in shared
Browse files Browse the repository at this point in the history
  • Loading branch information
kkawula committed Nov 21, 2024
1 parent aa5d9a1 commit 0391ecf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
20 changes: 11 additions & 9 deletions crates/forge/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use include_dir::{include_dir, Dir};
use indoc::formatdoc;
use scarb_api::ScarbCommand;
use semver::Version;
use shared::consts::FREE_RPC_PROVIDER_URL;
use std::env;
use std::fs::{self, OpenOptions};
use std::io::Write;
Expand All @@ -23,15 +24,16 @@ fn create_snfoundry_manifest(path: &PathBuf) -> Result<()> {
# Visit https://foundry-rs.github.io/starknet-foundry/appendix/snfoundry-toml.html
# and https://foundry-rs.github.io/starknet-foundry/projects/configuration.html for more information
# [sncast.default] # Define a profile name
# url = "https://starknet-sepolia.public.blastapi.io" # Url of the RPC provider
# accounts-file = "../account-file" # Path to the file with the account data
# account = "mainuser" # Account from `accounts_file` or default account file that will be used for the transactions
# keystore = "~/keystore" # Path to the keystore file
# wait-params = {{ timeout = 300, retry-interval = 10 }} # Wait for submitted transaction parameters
# block-explorer = "StarkScan" # Block explorer service used to display links to transaction details
# show-explorer-links = true # Print links pointing to pages with transaction details in the chosen block explorer
"#
# [sncast.default] # Define a profile name
# url = "{default_rpc_url}" # Url of the RPC provider
# accounts-file = "../account-file" # Path to the file with the account data
# account = "mainuser" # Account from `accounts_file` or default account file that will be used for the transactions
# keystore = "~/keystore" # Path to the keystore file
# wait-params = {{ timeout = 300, retry-interval = 10 }} # Wait for submitted transaction parameters
# block-explorer = "StarkScan" # Block explorer service used to display links to transaction details
# show-explorer-links = true # Print links pointing to pages with transaction details in the chosen block explorer
"#,
default_rpc_url = FREE_RPC_PROVIDER_URL,
},
)?;

Expand Down
1 change: 1 addition & 0 deletions crates/shared/src/consts.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub const EXPECTED_RPC_VERSION: &str = "0.7.0";
pub const RPC_URL_VERSION: &str = "v0_7";
pub const SNFORGE_TEST_FILTER: &str = "SNFORGE_TEST_FILTER";
pub const FREE_RPC_PROVIDER_URL: &str = "https://free-rpc.nethermind.io/sepolia-juno/v0_7";
19 changes: 10 additions & 9 deletions crates/sncast/src/helpers/global_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::ValidatedWaitParams;
use anyhow::Result;
use camino::Utf8PathBuf;
use indoc::formatdoc;
use shared::consts::FREE_RPC_PROVIDER_URL;
use std::fs;
use std::fs::File;
use std::io::Write;
Expand Down Expand Up @@ -37,15 +38,7 @@ pub fn get_global_config_path() -> Result<Utf8PathBuf> {
}

fn build_default_manifest() -> String {
let default_url = "https://starknet-sepolia.public.blastapi.io";
let default_accounts_file = "~/.starknet_accounts/starknet_open_zeppelin_accounts.json";
let default_wait_params = ValidatedWaitParams::default();
let default_wait_timeout = default_wait_params.timeout;
let default_wait_retry_interval = default_wait_params.retry_interval;
let default_block_explorer = "StarkScan";
let default_show_explorer_links = show_explorer_links_default();
let default_account = "default";
let default_keystore = "";

formatdoc! {r#"
# Visit https://foundry-rs.github.io/starknet-foundry/appendix/snfoundry-toml.html
Expand All @@ -59,7 +52,15 @@ fn build_default_manifest() -> String {
show-explorer-links = {default_show_explorer_links}
account = "{default_account}"
keystore = "{default_keystore}"
"#
"#,
default_url = FREE_RPC_PROVIDER_URL,
default_accounts_file = "~/.starknet_accounts/starknet_open_zeppelin_accounts.json",
default_wait_timeout = default_wait_params.timeout,
default_wait_retry_interval = default_wait_params.retry_interval,
default_block_explorer = "StarkScan",
default_show_explorer_links = show_explorer_links_default(),
default_account = "default",
default_keystore = ""
}
}

Expand Down

0 comments on commit 0391ecf

Please sign in to comment.