use fuels::prelude::*;
let dir = std::env::temp_dir();
let mut rng = rand::thread_rng();
// Use the test helper to setup a test provider.
let provider = setup_test_provider(vec![], vec![], None, None).await?;
let password = "my_master_password";
// Create a wallet to be stored in the keystore.
let (_wallet, uuid) =
WalletUnlocked::new_from_keystore(&dir, &mut rng, password, Some(provider.clone()))?;
let path = dir.join(uuid);
let _recovered_wallet = WalletUnlocked::load_keystore(path, password, Some(provider))?;
use fuels::prelude::*;
let dir = std::env::temp_dir();
let phrase =
"oblige salon price punch saddle immune slogan rare snap desert retire surprise";
// Use the test helper to setup a test provider.
let provider = setup_test_provider(vec![], vec![], None, None).await?;
// Create first account from mnemonic phrase.
let wallet = WalletUnlocked::new_from_mnemonic_phrase(phrase, Some(provider))?;
let password = "my_master_password";
// Encrypts and stores it on disk. Can be recovered using `Wallet::load_keystore`.
let _uuid = wallet.encrypt(&dir, password)?;