Skip to content

Commit

Permalink
chore: use beta-5 endpoint (#1245)
Browse files Browse the repository at this point in the history
Co-authored-by: MujkicA <32431923+MujkicA@users.noreply.github.com>
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Co-authored-by: hal3e <git@hal3e.io>
  • Loading branch information
4 people committed May 7, 2024
1 parent b5f563e commit fef8e2e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 68 deletions.
2 changes: 1 addition & 1 deletion docs/src/connecting/external-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ In the code example, we connected a new provider to the Testnet node and created

> **Note:** New wallets on the Testnet will not have any assets! They can be obtained by providing the wallet address to the faucet at
>
>[faucet-beta-4.fuel.network](https://faucet-beta-4.fuel.network)
>[faucet-beta-5.fuel.network](https://faucet-beta-5.fuel.network)
>
> Once the assets have been transferred to the wallet, you can reuse it in other tests by providing the private key!
>
Expand Down
8 changes: 4 additions & 4 deletions examples/providers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ mod tests {

use fuels::prelude::Result;

// Kept only for the anchors. The latest SDK is not compatible with `beta-5.fuel.network`
// (fuel-core changed the gql endpoint versioning it.).
#[tokio::test]
#[ignore] //TODO: Enable this test once beta supports the new `fuel-core` >= `0.21.0`
#[ignore]
async fn connect_to_fuel_node() -> Result<()> {
// ANCHOR: connect_to_testnet
use std::str::FromStr;

use fuels::{crypto::SecretKey, prelude::*};

// Create a provider pointing to the testnet.
// This example will not work as the testnet does not support the new version of fuel-core
// yet
let provider = Provider::connect("beta-4.fuel.network").await.unwrap();
let provider = Provider::connect("beta-5.fuel.network").await.unwrap();

// Setup a private key
let secret = SecretKey::from_str(
Expand Down
64 changes: 1 addition & 63 deletions packages/fuels/tests/providers.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use std::{ops::Add, str::FromStr};
use std::ops::Add;

use chrono::{DateTime, Duration, TimeZone, Utc};
use fuel_core::chain_config::StateConfig;
use fuels::{
accounts::Account,
client::{PageDirection, PaginationRequest},
crypto::SecretKey,
prelude::*,
tx::Receipt,
types::{
Expand Down Expand Up @@ -583,67 +582,6 @@ async fn test_get_gas_used() -> Result<()> {
Ok(())
}

#[tokio::test]
#[ignore]
async fn testnet_hello_world() -> Result<()> {
use rand::Rng;

// Note that this test might become flaky.
// This test depends on:
// 1. The testnet being up and running;
// 2. The testnet address being the same as the one in the test;
// 3. The hardcoded wallet having enough funds to pay for the transaction.
// This is a nice test to showcase the SDK interaction with
// the testnet. But, if it becomes too problematic, we should remove it.
abigen!(Contract(
name = "MyContract",
abi = "packages/fuels/tests/contracts/contract_test/out/release/contract_test-abi.json"
));

// Create a provider pointing to the testnet.
let provider = Provider::connect("beta-4.fuel.network").await.unwrap();

// Setup the private key.
let secret =
SecretKey::from_str("a0447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568")
.unwrap();

// Create the wallet.
let wallet = WalletUnlocked::new_from_private_key(secret, Some(provider));

let mut rng = rand::thread_rng();
let salt: [u8; 32] = rng.gen();
let configuration = LoadConfiguration::default().with_salt(salt);

let tx_policies = TxPolicies::default().with_script_gas_limit(2000);

let contract_id = Contract::load_from(
"tests/contracts/contract_test/out/release/contract_test.bin",
configuration,
)?
.deploy(&wallet, tx_policies)
.await?;

let contract_methods = MyContract::new(contract_id, wallet.clone()).methods();

let response = contract_methods
.initialize_counter(42)
.with_tx_policies(tx_policies)
.call()
.await?;

assert_eq!(42, response.value);

let response = contract_methods
.increment_counter(10)
.with_tx_policies(tx_policies)
.call()
.await?;

assert_eq!(52, response.value);
Ok(())
}

#[tokio::test]
async fn test_parse_block_time() -> Result<()> {
let mut wallet = WalletUnlocked::new_random(None);
Expand Down

0 comments on commit fef8e2e

Please sign in to comment.