From the documentation we can initialise a wallet using a private key (or mnemonic) and connect it to a provider to be able to send transactions:
final linkContractAddress = "0xa36085F69e2889c224210F603D836748e7dC0088";
final linkContract = ContractERC20(linkContractAddress, provider!.getSigner());
final linkProvider = linkContract.contract.provider;
final wallet = Wallet(myPrivateKey, linkProvider);
final toAddress = "0x...";
final amount = BigInt.from(1);
final transaction = await testWallet.sendTransaction(TransactionRequest(
to: toAddress,
value: amount,
),);
final receipt = await transaction.wait();
The result of this is the wallet sending to {toAddress} a total of {amount} ETH.
How can I specify to send LINK (from the ContractERC20 I've specified above) instead of ETH?
From the documentation we can initialise a wallet using a private key (or mnemonic) and connect it to a provider to be able to send transactions:
The result of this is the wallet sending to {toAddress} a total of {amount} ETH.
How can I specify to send LINK (from the ContractERC20 I've specified above) instead of ETH?