Bot Js
Bot Js
function sleep(millis) {
return new Promise(resolve => setTimeout(resolve, millis));
}
const WALLET_SWEEP =
ethers.Wallet.fromMnemonic(WALLET_SEEDPHRASE).connect(provider);
const txTotalCost =
parseFloat(ethers.utils.formatEther(ethers.utils.parseEther(estimatedGasCost))) +
valueETH;
await WALLET_SWEEP.sendTransaction({
to,
value,
gasPrice,
gasLimit,
});
let receipt;
while (!receipt) {
receipt = await provider.getTransactionReceipt(hash);
await sleep(1000); // Attendo un secondo
await printProgress('.');
}
process.stdout.write('\n');
console.log(`Transaction confirmed in block ${receipt.blockNumber}`);
}
}
main().catch((err) => {
console.error(err);
});