-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevm_node.ts
64 lines (63 loc) · 2.04 KB
/
evm_node.ts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import {
FeeData,
TransactionResponse,
Wallet,
ethers,
formatUnits,
} from "ethers";
import "dotenv/config";
let node_provider = new ethers.JsonRpcProvider(
"https://sentry.tm.injective.network:443"
);
let data =
"0x646174613a2c7b2270223a2276696d732d3230222c226f70223a226d696e74222c227469636b223a2276696d73222c22616d74223a223130303030227d";
let times = 10;
async function main() {
let keys = process.env.BSC_KEY!.split(",");
let addresses: { wallet: Wallet; nonce: number }[] = [];
for (let i of keys) {
let wallet = new ethers.Wallet(i, node_provider);
let nonce = await wallet.getNonce();
addresses.push({ wallet, nonce });
}
let feedata: FeeData = await node_provider.getFeeData();
console.log(feedata);
let counter = 0;
console.log(await node_provider.getBlockNumber());
// while (true) {
// let txs: Promise<TransactionResponse>[] = [];
// // let maxPriorityFeePerGas = (feedata.maxPriorityFeePerGas as bigint)+BigInt(times)
// for (let index = 0; index < addresses.length; index++) {
// for (let i = times; i > 0; i = i - 1) {
// let tx = addresses[index].wallet
// .sendTransaction({
// to: addresses[index].wallet.address,
// data: data,
// // gasLimit: 50000,
// // gasPrice: 10,
// value: 0,
// gasPrice: feedata.gasPrice,
// // maxFeePerGas: feedata.maxFeePerGas,
// // maxPriorityFeePerGas: feedata.maxPriorityFeePerGas,
// // maxPriorityFeePerGas: Number(i * 1e9).toFixed(0),
// nonce: addresses[index].nonce,
// })
// .catch(async (e) => {
// addresses[index].nonce = await addresses[index].wallet.getNonce();
// return e;
// });
// addresses[index].nonce++;
// txs.push(tx);
// }
// }
// await Promise.all(txs)
// .then((res) => {
// counter++;
// console.log(counter);
// })
// .catch((e) => {
// console.log(e);
// });
// }
}
main();