Skip to content

Commit

Permalink
feat: point to testnet for default query end point (#182)
Browse files Browse the repository at this point in the history
Updates the default end point for balance queries to testnet instead of
beta-5.
  • Loading branch information
kayagokalp authored Jun 1, 2024
1 parent 7db199b commit b89e83d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,14 @@ pub(crate) fn print_balance_empty(node_url: &Url) {
let beta_3_url = crate::network::BETA_3.parse::<Url>().unwrap();
let beta_4_url = crate::network::BETA_4.parse::<Url>().unwrap();
let beta_5_url = crate::network::BETA_5.parse::<Url>().unwrap();
let testnet_url = crate::network::TESTNET.parse::<Url>().unwrap();

let faucet_url = match node_url.host_str() {
host if host == beta_2_url.host_str() => crate::network::BETA_2_FAUCET,
host if host == beta_3_url.host_str() => crate::network::BETA_3_FAUCET,
host if host == beta_4_url.host_str() => crate::network::BETA_4_FAUCET,
host if host == beta_5_url.host_str() => crate::network::BETA_5_FAUCET,
host if host == testnet_url.host_str() => crate::network::TESTNET_FAUCET,
_ => return println!(" Account empty."),
};
println!(
Expand Down Expand Up @@ -524,9 +527,12 @@ pub(crate) async fn transfer_cli(
.await?;

let block_explorer_url = match transfer.node_url.host_str() {
host if host == crate::network::BETA_5.parse::<Url>().unwrap().host_str() => {
host if host == crate::network::TESTNET.parse::<Url>().unwrap().host_str() => {
crate::explorer::DEFAULT
}
host if host == crate::network::BETA_5.parse::<Url>().unwrap().host_str() => {
crate::explorer::BETA_5
}
host if host == crate::network::BETA_4.parse::<Url>().unwrap().host_str() => {
crate::explorer::BETA_4
}
Expand Down
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub const DEFAULT_CACHE_ACCOUNTS: usize = 1;

/// The default network used in the case that none is specified.
pub mod network {
pub const DEFAULT: &str = BETA_5;
pub const DEFAULT: &str = TESTNET;
pub const BETA_2: &str = "https://node-beta-2.fuel.network";
pub const BETA_2_FAUCET: &str = "https://faucet-beta-2.fuel.network";
pub const BETA_3: &str = "https://beta-3.fuel.network/";
Expand All @@ -20,13 +20,16 @@ pub mod network {
pub const BETA_4_FAUCET: &str = "https://faucet-beta-4.fuel.network/";
pub const BETA_5: &str = "https://beta-5.fuel.network/";
pub const BETA_5_FAUCET: &str = "https://faucet-beta-5.fuel.network/";
pub const TESTNET: &str = "https://testnet.fuel.network/";
pub const TESTNET_FAUCET: &str = "https://faucet-testnet.fuel.network/";
}

/// Contains definitions of URLs to the block explorer for each network.
pub mod explorer {
pub const DEFAULT: &str = BETA_5;
pub const DEFAULT: &str = TESTNET;
pub const BETA_2: &str = "https://fuellabs.github.io/block-explorer-v2/beta-2";
pub const BETA_3: &str = "https://fuellabs.github.io/block-explorer-v2/beta-3";
pub const BETA_4: &str = "https://fuellabs.github.io/block-explorer-v2/beta-4";
pub const BETA_5: &str = "https://fuellabs.github.io/block-explorer-v2/beta-5";
pub const TESTNET: &str = "https://app.fuel.network/";
}

0 comments on commit b89e83d

Please sign in to comment.