diff --git a/Cargo.toml b/Cargo.toml index c863b419b..66167917a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -94,14 +94,14 @@ testcontainers = { version = "0.23", default-features = false } k256 = { version = "0.13", default-features = false } # Dependencies from the `fuel-core` repository: -fuel-core = { version = "0.47.1", default-features = false, features = [ +fuel-core = { git = "https://github.com/FuelLabs/fuel-core", rev = "6889ed156bef3d3ad89b6553e500c7a8500e41d3", default-features = false, features = [ "wasm-executor", ] } -fuel-core-chain-config = { version = "0.47.1", default-features = false } -fuel-core-client = { version = "0.47.1", default-features = false } -fuel-core-poa = { version = "0.47.1", default-features = false } -fuel-core-services = { version = "0.47.1", default-features = false } -fuel-core-types = { version = "0.47.1", default-features = false } +fuel-core-chain-config = { git = "https://github.com/FuelLabs/fuel-core", rev = "6889ed156bef3d3ad89b6553e500c7a8500e41d3", default-features = false } +fuel-core-client = { git = "https://github.com/FuelLabs/fuel-core", rev = "6889ed156bef3d3ad89b6553e500c7a8500e41d3", default-features = false } +fuel-core-poa = { git = "https://github.com/FuelLabs/fuel-core", rev = "6889ed156bef3d3ad89b6553e500c7a8500e41d3", default-features = false } +fuel-core-services = { git = "https://github.com/FuelLabs/fuel-core", rev = "6889ed156bef3d3ad89b6553e500c7a8500e41d3", default-features = false } +fuel-core-types = { git = "https://github.com/FuelLabs/fuel-core", rev = "6889ed156bef3d3ad89b6553e500c7a8500e41d3", default-features = false } # Dependencies from the `fuel-vm` repository: fuel-asm = { version = "0.65.0" } diff --git a/packages/fuels-accounts/src/provider.rs b/packages/fuels-accounts/src/provider.rs index 89e2d9165..2b2c316d9 100644 --- a/packages/fuels-accounts/src/provider.rs +++ b/packages/fuels-accounts/src/provider.rs @@ -151,8 +151,12 @@ impl Provider { /// Connects to an existing node at the given address. pub async fn connect(url: impl AsRef) -> Result { + Self::connect_with_fallbacks(&[url]).await + } + + pub async fn connect_with_fallbacks(urls: &[impl AsRef]) -> Result { let client = CachedClient::new( - RetryableClient::connect(&url, Default::default()).await?, + RetryableClient::connect_with_fallbacks(urls, Default::default()).await?, TtlConfig::default(), SystemClock, ); diff --git a/packages/fuels-accounts/src/provider/retryable_client.rs b/packages/fuels-accounts/src/provider/retryable_client.rs index 1401de100..c9d460330 100644 --- a/packages/fuels-accounts/src/provider/retryable_client.rs +++ b/packages/fuels-accounts/src/provider/retryable_client.rs @@ -43,7 +43,6 @@ impl From for Error { #[derive(Debug, Clone)] pub(crate) struct RetryableClient { client: FuelClient, - url: String, retry_config: RetryConfig, prepend_warning: Option, } @@ -60,9 +59,8 @@ impl CacheableRpcs for RetryableClient { } impl RetryableClient { - pub(crate) async fn connect(url: impl AsRef, retry_config: RetryConfig) -> Result { - let url = url.as_ref().to_string(); - let client = FuelClient::new(&url).map_err(|e| error!(Provider, "{e}"))?; + pub(crate) async fn connect_with_fallbacks(urls: &[ impl AsRef], retry_config: RetryConfig) -> Result { + let client = FuelClient::with_urls(&urls).map_err(|e| error!(Provider, "{e}"))?; let node_info = client.node_info().await?; let warning = Self::version_compatibility_warning(&node_info)?; @@ -70,7 +68,6 @@ impl RetryableClient { Ok(Self { client, retry_config, - url, prepend_warning: warning, }) } @@ -100,7 +97,7 @@ impl RetryableClient { } pub(crate) fn url(&self) -> &str { - &self.url + &self.client.get_default_url().as_str() } pub fn client(&self) -> &FuelClient { @@ -407,7 +404,7 @@ mod custom_queries { tx::TransactionIdFragment, }; - #[derive(cynic::QueryVariables, Debug)] + #[derive(cynic::QueryVariables, Debug, Clone)] pub struct IsUserAccountVariables { pub blob_id: BlobId, pub contract_id: ContractId,