jeduardogruiz commited on
Commit
d0f4cb4
1 Parent(s): 01fc750

Create async_function.py

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