File size: 843 Bytes
d0f4cb4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
npx hardhat compile ; npx hardhat run scripts/deploy.js --network localhost
async function main() {
const { ethers } = require("hardhat");
const recipientAddress = "0xRecipientAddress"; // Replace with the recipient's Ethereum address
const amountToSend = ethers.utils.parseEther("0.1"); // 0.1 ETH
const provider = ethers.provider;
const signer = await ethers.getSigner();
const transaction = {
to: recipientAddress,
value: amountToSend,
gasLimit: 21000,
gasPrice: ethers.utils.parseUnits("10", "gwei"),
};
const tx = await signer.sendTransaction(transaction);
console.log("Transaction hash:", tx.hash);
const receipt = await tx.wait();
console.log("Transaction receipt:", receipt);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
}); |