use std::str::FromStr;
use fuels::prelude::{FuelService, Provider};
use fuels::{crypto::SecretKey, prelude::*};
#[tokio::main]
async fn main() -> Result<()> {
println!("Hello, world!");
// Create a provider pointing to the testnet.
let provider = Provider::connect("beta-5.fuel.network").await.unwrap();
// Setup a private key
let secret =
SecretKey::from_str("a1447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568")?;
// Create the wallet
let wallet = WalletUnlocked::new_from_private_key(secret, Some(provider));
println!("{}", wallet.address().to_string());
Ok(())
}
Output;
╰─$ cargo run 130 ↵
Compiling FuleRustScripts v0.1.0
warning: unused import: FuelService
→ src/main.rs:3:22
|
3 | use fuels::prelude::{FuelService, Provider};
| ^^^^^^^^^^^
|
= note: #[warn(unused_imports)]
on by default
warning: crate FuleRustScripts
should have a snake case name
|
= help: convert the identifier to snake case: fule_rust_scripts
= note: #[warn(non_snake_case)]
on by default
warning: FuleRustScripts
(bin “FuleRustScripts”) generated 2 warnings (run cargo fix --bin "FuleRustScripts"
to apply 1 suggestion)
Finished dev [unoptimized + debuginfo] target(s) in 1.48s
Running target/debug/FuleRustScripts
Hello, world!
thread ‘main’ panicked at src/main.rs:11:67:
called Result::unwrap()
on an Err
value: IO("Server returned 404 Not Found: ")
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
Version:
[dependencies]
fuels = “0.64.0”
tokio = { version = “1”, features = [“full”] }