We can interact with the Testnet node by using the following example.
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// yetlet provider =Provider::connect("beta-4.fuel.network").await.unwrap();// Setup a private keylet secret =SecretKey::from_str("a1447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568").unwrap();// Create the walletlet wallet =WalletUnlocked::new_from_private_key(secret, Some(provider));// Get the wallet address. Used later with the faucetdbg!(wallet.address().to_string());
Icon InfoCircle
For detailed information about various testnet networks and their optimal toolchain configurations for your project, please visit the following link:
If you want to connect to another node just change the URL or IP and port. For example, to connect to a local node that was created with fuel-core you can use:
let _provider =Provider::connect(format!("127.0.0.1:{port}")).await.unwrap();