import { ethers } from 'ethers'; const providerUrl = 'https://testnet-rpc.monad.xyz'; const provider = new ethers.JsonRpcProvider(providerUrl); const privateKeyList = [ '2a185eae14ca82ac934a5f952e12e0d4a64043c911c33a19afd48ef1a1d70c46', // Add more private keys here // 'your_second_private_key', // 'your_third_private_key', ]; const stakingContractAddress = '0xcBE623D259261FFa0CFAff44484bFF46c1b7D6c2'; // Function to generate random delay between 5-10 seconds const getRandomDelay = () => { return Math.floor(Math.random() * (10000 - 5000 + 1)) + 5000; }; // Function to handle staking for a single wallet async function stakeMon(wallet) { try { const balance = await provider.getBalance(wallet.address); console.log(`Wallet ${wallet.address} balance:`, ethers.formatEther(balance)); const amountToStake = ethers.parseEther('0'); if (balance < amountToStake) { throw new Error(`Insufficient balance for staking in wallet ${wallet.address}`); } const tx = await wallet.sendTransaction({ to: stakingContractAddress, value: amountToStake, data: '0x7ab71841', gasLimit: 1000000, gasPrice: ethers.parseUnits('52', 'gwei') }); console.log(`Stake transaction hash for ${wallet.address}:`, tx.hash); const receipt = await tx.wait(); console.log(`Stake transaction receipt for ${wallet.address}:`, receipt); } catch (error) { console.error(`Error staking $MON for ${wallet.address}:`, error); } } // Function to process all wallets with delay async function processAllWallets() { for (const privateKey of privateKeyList) { const wallet = new ethers.Wallet(privateKey, provider); await stakeMon(wallet); // Add random delay between 5-10 seconds, except for the last wallet if (privateKey !== privateKeyList[privateKeyList.length - 1]) { const delay = getRandomDelay(); console.log(`Waiting ${delay/1000} seconds before next wallet...`); await new Promise(resolve => setTimeout(resolve, delay)); } } } processAllWallets();