With the lastest fuel 0.94.0 when trying to deploy a contract with this:
// Create a wallet instance from the address
const wallet = Wallet.fromPrivateKey(process.env.WALLET_PRIVATE_KEY as string);
// Connect to the testnet provider
const provider = await Provider.create('https://testnet.fuel.network/v1/graphql');
// Set the provider for the wallet
wallet.connect(provider);
const myContract = new MyContract(
process.env.CONTRACT_ID as string,
wallet
);
Errors with TS error:
Argument of type ‘WalletUnlocked’ is not assignable to parameter of type ‘Account | Provider’.
According to docs WalletUnlocked is a child of BaseUnlocked is a child of Account
This is copying from the latest docs.
Help appreciated.
hey @xpluscal, I think to use the wallet with a contract, you need to connect it to a provider. Can you please try this code?
import { Wallet, Provider } from 'fuels';
// Create a provider, with the Latest Testnet URL.
const provider = await Provider.create('https://testnet.fuel.network/v1/graphql');
// Create a wallet instance from the private key and connect it to the provider
const wallet = Wallet.fromPrivateKey(process.env.WALLET_PRIVATE_KEY as string, provider);
// Instantiate the contract with the wallet
const myContract = new MyContract(
process.env.CONTRACT_ID as string,
wallet
);