Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Salka1988 committed Oct 8, 2023
1 parent d7fd598 commit 5ab803e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
10 changes: 0 additions & 10 deletions packages/fuels-accounts/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ mod retry_util;
mod retryable_client;

use chrono::{DateTime, Utc};
#[cfg(feature = "fuel-core-lib")]
use fuel_core::service::{Config, FuelService};
use fuel_core_client::client::{
pagination::{PageDirection, PaginatedResult, PaginationRequest},
types::{balance::Balance, contract::ContractBalance, TransactionStatus},
Expand Down Expand Up @@ -36,7 +34,6 @@ use tai64::Tai64;
use thiserror::Error;

use crate::provider::retryable_client::RetryableClient;

type ProviderResult<T> = std::result::Result<T, ProviderError>;

#[derive(Debug)]
Expand Down Expand Up @@ -260,13 +257,6 @@ impl Provider {
Ok(status)
}

#[cfg(feature = "fuel-core-lib")]
/// Launches a local `fuel-core` network based on provided config.
pub async fn launch(config: Config) -> Result<FuelClient> {
let srv = FuelService::new_node(config).await.unwrap();
Ok(FuelClient::from(srv.bound_address))
}

pub async fn chain_info(&self) -> ProviderResult<ChainInfo> {
Ok(self.client.chain_info().await?.into())
}
Expand Down
3 changes: 3 additions & 0 deletions packages/fuels/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ repository = { workspace = true }
rust-version = { workspace = true }
description = "Fuel Rust SDK."

#[package.metadata.cargo-machete]
#ignored = ["fuel-core"]

[dependencies]
fuel-core = { workspace = true, default-features = false, optional = true }
fuel-core-client = { workspace = true, optional = true }
Expand Down
10 changes: 7 additions & 3 deletions packages/fuels/tests/types_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,9 @@ async fn strings_must_have_correct_length() {
"#,
));

let wallet = launch_provider_and_get_wallet().await.unwrap();
let wallet = launch_provider_and_get_wallet()
.await
.expect("Should have wallet");
let contract_instance = SimpleContract::new(null_contract_id(), wallet);
let _ = contract_instance
.methods()
Expand Down Expand Up @@ -1063,7 +1065,9 @@ async fn strings_must_have_all_ascii_chars_custom_types() {
foo: inner_struct,
};

let wallet = launch_provider_and_get_wallet().await.unwrap();
let wallet = launch_provider_and_get_wallet()
.await
.expect("Should have wallet");
let contract_instance = SimpleContract::new(null_contract_id(), wallet);
let _ = contract_instance.methods().takes_nested_struct(input);
}
Expand Down Expand Up @@ -1998,7 +2002,7 @@ async fn test_contract_std_lib_string() -> Result<()> {

#[tokio::test]
async fn test_heap_type_in_enums() -> Result<()> {
let wallet = launch_provider_and_get_wallet().await;
let wallet = launch_provider_and_get_wallet().await?;
setup_program_test!(
Abigen(Contract(
name = "HeapTypeInEnum",
Expand Down

0 comments on commit 5ab803e

Please sign in to comment.