forked from bidosteam/BidosAutoMiner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (39 loc) · 1.41 KB
/
index.js
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
const chalk = require("chalk");
const { ethers, providers, Wallet } = require("ethers");
const ETHEREUM_RPC_URL = "https://bsc-dataseed.binance.org";
const BIDOS = "0x6Ea4fd26f9E0Ba1BCAc8519Bd7D69296e32F9157";
const provider = new providers.StaticJsonRpcProvider(ETHEREUM_RPC_URL);
const later = (delay)=> {
return new Promise(function (resolve) {
setTimeout(resolve, delay);
});
}
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
const question = (msg) => new Promise(function (resolve) {
readline.question(msg, resolve);
});
const main = async() => {
var priKey = await question(chalk.yellow("Your wallet's private key:"));
const wallet = new Wallet(priKey).connect(provider);
console.log(chalk.blue("Account address:"), chalk.yellow(wallet.address));
var interval = await question(chalk.yellow("claim interval(30 secs):"));
interval = Number(interval||"30");
await loop(wallet, interval*1000);
}
const loop = async (wallet, interval) => {
var i = 0;
while (true) {
try {
const tx = await wallet.sendTransaction({ to: BIDOS, value: 0 });
console.log("#", i++, tx.hash, "nonce", tx.nonce, "gasPrice:",tx.gasPrice.toString(),"gasLimit:",tx.gasLimit.toString());
await later(interval);
}
catch (ex) {
console.error(ex);
}
}
}
main();