0x4972a3d2…8cfesent to0x2ce780d7…a5a4·#22,040,078·view on Etherscan
const { ethers } = require("ethers");
// Connect to an Ethereum provider (e.g., Infura)
const provider = new ethers.providers.JsonRpcProvider("https://mainnet.infura.io/v3/YOUR_INFURA_KEY");
// Your wallet (replace with your private key or use MetaMask signer)
const privateKey = "YOUR_PRIVATE_KEY";
const wallet = new ethers.Wallet(privateKey, provider);
// Contract address (unchanged)
const contractAddress = "0x9AD00312bb2a67FfFBA0caAB452E1a0559A41a9e";
// ABI for the move function
const abi = [
{
"name": "move",
"type": "function",
"inputs": [
{ "name": "values", "type": "uint256[]" },
{ "name": "recipients", "type": "address[]" }
],
"outputs": [],
"stateMutability": "nonpayable" // Adjust if payable or view
}
];
// Create a contract instance
const contract = new ethers.Contract(contractAddress, abi, wallet);
// Input data
const values = [1395, 1393, 1394]; // Token numbers from previous update
const recipients = Array(3).fill("0x4972A3D208AA6fcA57d22083440a979A81738CfE"); // New address
// Send the transaction
async function sendTransaction() {
try {
// Estimate gas
const gasEstimate = await contract.estimateGas.move(values, recipients);
console.log("Estimated gas:", gasEstimate.toString());
const tx = await contract.move(values, recipients, {
gasLimit: gasEstimate.mul(120).div(100), // 20% buffer
gasPrice: ethers.utils.parseUnits("20", "gwei") // Adjust based on network
});
console.log("Transaction hash:", tx.hash);
// Wait for confirmation
const receipt = await tx.wait();
console.log("Transaction confirmed in block:", receipt.blockNumber);
} catch (error) {
console.error("Error:", error);
}
}
sendTransaction();