diff --git a/templates/sway-predicate-test-rs/template/Cargo.toml b/templates/sway-predicate-test-rs/template/Cargo.toml index 4d97760687b..2b33a5d631b 100644 --- a/templates/sway-predicate-test-rs/template/Cargo.toml +++ b/templates/sway-predicate-test-rs/template/Cargo.toml @@ -7,7 +7,7 @@ authors = ["{{authors}}"] license = "Apache-2.0" [dev-dependencies] -fuels = { version = "0.53", features = ["fuel-core-lib"] } +fuels = { version = "0.62", features = ["fuel-core-lib"] } tokio = { version = "1.12", features = ["rt", "macros"] } [[test]] diff --git a/templates/sway-predicate-test-rs/template/tests/harness.rs b/templates/sway-predicate-test-rs/template/tests/harness.rs index 6d1092c6073..c4727cce983 100644 --- a/templates/sway-predicate-test-rs/template/tests/harness.rs +++ b/templates/sway-predicate-test-rs/template/tests/harness.rs @@ -6,7 +6,7 @@ abigen!(Predicate( abi = "out/debug/{{project-name}}-abi.json" )); -async fn get_predicate_instance() -> (WalletUnlocked, Predicate) { +async fn get_predicate_instance() -> (WalletUnlocked, Predicate, AssetId) { let mut wallets = launch_custom_provider_and_get_wallets( WalletsConfig::new( Some(1), /* Single wallet */ @@ -23,11 +23,13 @@ async fn get_predicate_instance() -> (WalletUnlocked, Predicate) { let provider = wallet.provider().clone().unwrap(); + let base_asset_id = provider.base_asset_id().clone(); + let bin_path = "./out/debug/{{project-name}}.bin"; let instance: Predicate = Predicate::load_from(bin_path).unwrap().with_provider(provider.clone()); - (wallet, instance) + (wallet, instance, base_asset_id) } async fn check_balances( @@ -52,19 +54,19 @@ async fn check_balances( #[tokio::test] async fn can_get_predicate_instance() { - let (wallet, instance) = get_predicate_instance().await; + let (wallet, instance, base_asset_id) = get_predicate_instance().await; let predicate_root = instance.address(); // Check balances before funding predicate check_balances(&wallet, &instance, Some(1_000_000_000u64), None).await; // Fund predicate from wallet - let _ = wallet.transfer(predicate_root, 1234, BASE_ASSET_ID, TxPolicies::default()).await; + let _ = wallet.transfer(predicate_root, 1234, base_asset_id, TxPolicies::default()).await; // Check balances after funding predicate check_balances(&wallet, &instance, Some(999_998_766u64), Some(1234u64)).await; - let _ = instance.transfer(wallet.address(), 1234, BASE_ASSET_ID, TxPolicies::default()).await; + let _ = instance.transfer(wallet.address(), 1234, base_asset_id, TxPolicies::default()).await; // Check balances after transferring funds out of predicate check_balances(&wallet, &instance, Some(1_000_000_000u64), Some(0u64)).await; diff --git a/templates/sway-script-test-rs/template/Cargo.toml b/templates/sway-script-test-rs/template/Cargo.toml index 4d97760687b..2b33a5d631b 100644 --- a/templates/sway-script-test-rs/template/Cargo.toml +++ b/templates/sway-script-test-rs/template/Cargo.toml @@ -7,7 +7,7 @@ authors = ["{{authors}}"] license = "Apache-2.0" [dev-dependencies] -fuels = { version = "0.53", features = ["fuel-core-lib"] } +fuels = { version = "0.62", features = ["fuel-core-lib"] } tokio = { version = "1.12", features = ["rt", "macros"] } [[test]] diff --git a/templates/sway-script-test-rs/template/tests/harness.rs b/templates/sway-script-test-rs/template/tests/harness.rs index 01ff3f77df0..0ecaa1b5ffb 100644 --- a/templates/sway-script-test-rs/template/tests/harness.rs +++ b/templates/sway-script-test-rs/template/tests/harness.rs @@ -8,7 +8,7 @@ abigen!(Script( async fn get_script_instance() -> MyScript { // Launch a local network - let mut wallets = launch_custom_provider_and_get_wallets( + let wallets = launch_custom_provider_and_get_wallets( WalletsConfig::new( Some(1), /* Single wallet */ Some(1), /* Single coin (UTXO) */ @@ -18,7 +18,7 @@ async fn get_script_instance() -> MyScript { None, ) .await; - let wallet = wallets.pop().unwrap(); + let wallet = wallets.unwrap().pop().unwrap(); let bin_path = "./out/debug/{{project-name}}.bin"; @@ -30,7 +30,7 @@ async fn get_script_instance() -> MyScript { #[tokio::test] async fn can_get_script_instance() { const LUCKY_NUMBER: u64 = 777; - let configurables = MyScriptConfigurables::new().with_SECRET_NUMBER(LUCKY_NUMBER.clone()); + let configurables = MyScriptConfigurables::default().with_SECRET_NUMBER(LUCKY_NUMBER.clone()).unwrap(); let instance = get_script_instance().await; diff --git a/templates/sway-test-rs/template/Cargo.toml b/templates/sway-test-rs/template/Cargo.toml index eae5b31af84..416feb395ab 100644 --- a/templates/sway-test-rs/template/Cargo.toml +++ b/templates/sway-test-rs/template/Cargo.toml @@ -7,7 +7,7 @@ authors = ["{{authors}}"] license = "Apache-2.0" [dev-dependencies] -fuels = { version = "0.54.0", features = ["fuel-core-lib"] } +fuels = { version = "0.62.0", features = ["fuel-core-lib"] } tokio = { version = "1.12", features = ["rt", "macros"] } [[test]]