From 7c4f0e2519ec6ea7541bcd224c8f9a76f88ddef9 Mon Sep 17 00:00:00 2001 From: Kaya Gokalp Date: Fri, 12 Jan 2024 00:28:03 +0300 Subject: [PATCH] feat: add beta-5 network to supported networks --- forc-plugins/forc-client/src/constants.rs | 3 ++- forc-plugins/forc-client/src/util/node_url.rs | 12 ++++++------ forc-plugins/forc-client/src/util/target.rs | 8 ++++++-- forc-plugins/forc-client/src/util/tx.rs | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/forc-plugins/forc-client/src/constants.rs b/forc-plugins/forc-client/src/constants.rs index 41e6dde59e7..f1ba9ee2c95 100644 --- a/forc-plugins/forc-client/src/constants.rs +++ b/forc-plugins/forc-client/src/constants.rs @@ -3,4 +3,5 @@ pub const NODE_URL: &str = sway_utils::constants::DEFAULT_NODE_URL; pub const BETA_2_ENDPOINT_URL: &str = "https://node-beta-2.fuel.network"; pub const BETA_3_ENDPOINT_URL: &str = "https://beta-3.fuel.network"; pub const BETA_4_ENDPOINT_URL: &str = "https://beta-4.fuel.network"; -pub const BETA_4_FAUCET_URL: &str = "https://faucet-beta-4.fuel.network"; +pub const BETA_5_ENDPOINT_URL: &str = "https://beta-5.fuel.network"; +pub const BETA_FAUCET_URL: &str = "https://faucet-beta-5.fuel.network"; diff --git a/forc-plugins/forc-client/src/util/node_url.rs b/forc-plugins/forc-client/src/util/node_url.rs index bfe73070caa..3a640bb5579 100644 --- a/forc-plugins/forc-client/src/util/node_url.rs +++ b/forc-plugins/forc-client/src/util/node_url.rs @@ -15,7 +15,7 @@ pub fn get_node_url( node_target.target.clone(), node_target.node_url.clone(), ) { - (true, None, None) => Target::Beta4.target_url(), + (true, None, None) => Target::Beta5.target_url(), (false, Some(target), None) => target.target_url(), (false, None, Some(node_url)) => node_url, (false, None, None) => manifest_network @@ -38,22 +38,22 @@ fn test_get_node_url_testnet() { }; let actual = get_node_url(&input, &None).unwrap(); - assert_eq!("https://beta-4.fuel.network", actual); + assert_eq!("https://beta-5.fuel.network", actual); } #[test] -fn test_get_node_url_beta4() { +fn test_get_node_url_beta5() { let input = NodeTarget { - target: Some(Target::Beta4), + target: Some(Target::Beta5), node_url: None, testnet: false, }; let actual = get_node_url(&input, &None).unwrap(); - assert_eq!("https://beta-4.fuel.network", actual); + assert_eq!("https://beta-5.fuel.network", actual); } #[test] -fn test_get_node_url_beta4_url() { +fn test_get_node_url_beta4() { let input = NodeTarget { target: None, node_url: Some("https://beta-4.fuel.network".to_string()), diff --git a/forc-plugins/forc-client/src/util/target.rs b/forc-plugins/forc-client/src/util/target.rs index bda5518a802..ec8d5eaa2ec 100644 --- a/forc-plugins/forc-client/src/util/target.rs +++ b/forc-plugins/forc-client/src/util/target.rs @@ -1,4 +1,4 @@ -use crate::constants::{BETA_2_ENDPOINT_URL, BETA_3_ENDPOINT_URL, BETA_4_ENDPOINT_URL, NODE_URL}; +use crate::constants::{BETA_2_ENDPOINT_URL, BETA_3_ENDPOINT_URL, BETA_4_ENDPOINT_URL, NODE_URL, BETA_5_ENDPOINT_URL}; use anyhow::{bail, Result}; use serde::{Deserialize, Serialize}; use std::str::FromStr; @@ -9,6 +9,7 @@ pub enum Target { Beta2, Beta3, Beta4, + Beta5, Local, } @@ -24,6 +25,7 @@ impl Target { Target::Beta2 => BETA_2_ENDPOINT_URL, Target::Beta3 => BETA_3_ENDPOINT_URL, Target::Beta4 => BETA_4_ENDPOINT_URL, + Target::Beta5 => BETA_5_ENDPOINT_URL, Target::Local => NODE_URL, }; url.to_string() @@ -41,7 +43,7 @@ impl Target { pub fn is_testnet(&self) -> bool { match self { - Target::Beta2 | Target::Beta3 | Target::Beta4 => true, + Target::Beta2 | Target::Beta3 | Target::Beta4 | Target::Beta5 => true, Target::Local => false, } } @@ -55,6 +57,7 @@ impl FromStr for Target { "beta-2" => Ok(Target::Beta2), "beta-3" => Ok(Target::Beta3), "beta-4" => Ok(Target::Beta4), + "beta-5" => Ok(Target::Beta5), "local" => Ok(Target::Local), _ => bail!( "'{s}' is not a valid target name. Possible values: '{}', '{}', '{}', '{}'", @@ -73,6 +76,7 @@ impl std::fmt::Display for Target { Target::Beta2 => "beta-2", Target::Beta3 => "beta-3", Target::Beta4 => "beta-4", + Target::Beta5 => "beta-5", Target::Local => "local", }; write!(f, "{}", s) diff --git a/forc-plugins/forc-client/src/util/tx.rs b/forc-plugins/forc-client/src/util/tx.rs index 41ea08e712c..762f09ffcc7 100644 --- a/forc-plugins/forc-client/src/util/tx.rs +++ b/forc-plugins/forc-client/src/util/tx.rs @@ -24,7 +24,7 @@ use forc_wallet::{ utils::default_wallet_path, }; -use crate::constants::BETA_4_FAUCET_URL; +use crate::constants::BETA_FAUCET_URL; /// The maximum time to wait for a transaction to be included in a block by the node pub const TX_SUBMIT_TIMEOUT_MS: u64 = 30_000u64; @@ -216,7 +216,7 @@ impl TransactionBuilderExt for Tran let first_account = accounts .get(&0) .ok_or_else(|| anyhow::anyhow!("No account derived for this wallet"))?; - let faucet_link = format!("{}/?address={first_account}", BETA_4_FAUCET_URL); + let faucet_link = format!("{}/?address={first_account}", BETA_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.\ \n-> beta-4 network faucet: {faucet_link}\