Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
6 changes: 5 additions & 1 deletion packages/fuels-accounts/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,12 @@ impl Provider {

/// Connects to an existing node at the given address.
pub async fn connect(url: impl AsRef<str>) -> Result<Provider> {
Self::connect_with_fallbacks(&[url]).await
}

pub async fn connect_with_fallbacks(urls: &[impl AsRef<str>]) -> Result<Provider> {
let client = CachedClient::new(
RetryableClient::connect(&url, Default::default()).await?,
RetryableClient::connect_with_fallbacks(urls, Default::default()).await?,
TtlConfig::default(),
SystemClock,
);
Expand Down
11 changes: 4 additions & 7 deletions packages/fuels-accounts/src/provider/retryable_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ impl From<RequestError> for Error {
#[derive(Debug, Clone)]
pub(crate) struct RetryableClient {
client: FuelClient,
url: String,
retry_config: RetryConfig,
prepend_warning: Option<String>,
}
Expand All @@ -60,17 +59,15 @@ impl CacheableRpcs for RetryableClient {
}

impl RetryableClient {
pub(crate) async fn connect(url: impl AsRef<str>, retry_config: RetryConfig) -> Result<Self> {
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<str>], retry_config: RetryConfig) -> Result<Self> {
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)?;

Ok(Self {
client,
retry_config,
url,
prepend_warning: warning,
})
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
Loading