require("dotenv").config();
const {ethers, Wallet} = require("ethers");
const network = {
name:"Eleanor Testnet",
endpoint:"https://eleanor.metachain-i.co/rpc",
};
const provider = new ethers.providers.JsonRpcProvider(network.endpoint);
const wallet = new Wallet(process.env.PRIVATE_KEY);
const getTxnInstance = async () => {
const nonce = await wallet.getTransactionCount();
const gasPrice = await provider.getGasPrice();
const gasLimit = 21_000;
const chainID = await provider.getChainID();
const tx = {
from: wallet.address,
to: ethers.constants.AddressZero,
value: ethers.utils.parseEther(1),
gasLimit,
gasPrice,
nonce,
chainId,
data: "0x",
type: null,
};
return tx;
};
(async() => {
const txInstance = await.getTxnInstance();
await wallet.sendTransaction(txnInstance);
})();