This repository was archived by the owner on Aug 4, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathref.js
More file actions
55 lines (44 loc) · 2.15 KB
/
ref.js
File metadata and controls
55 lines (44 loc) · 2.15 KB
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
const fs = require("fs");
const config = require("./config.json");
const UserAgentManager = require("./utils/userAgentManager");
const { registerWallet } = require("./utils/walletManager");
const { colors, logWithColor } = require("./utils/logger");
const { getProxyAgent } = require("./utils/proxyManager");
const userAgentManager = new UserAgentManager();
const wallets = JSON.parse(fs.readFileSync("./wallets.json", "utf8"));
const proxies = fs
.readFileSync("./proxy.txt", "utf8")
.split("\n")
.filter((proxy) => proxy.trim() !== "");
async function main() {
logWithColor("SYSTEM", `Starting Meganet bot for ${wallets.length} wallets...`, "info");
logWithColor("SYSTEM", `Use proxy: ${config.useProxy ? "Yes" : "No"}`, "info");
const getRandomDelay = () => Math.floor(Math.random() * 5000) + 2000;
const batchSize = 100;
for (let i = 0; i < wallets.length; i += batchSize) {
const batch = wallets.slice(i, i + batchSize);
logWithColor("SYSTEM", `Processing batch ${Math.floor(i / batchSize) + 1} (${batch.length} wallets)`, "info");
for (const wallet of batch) {
setTimeout(async () => {
const proxyIndex = wallet.id - 1;
const proxy = config.useProxy && proxyIndex < proxies.length ? proxies[proxyIndex] : null;
const userAgent =
userAgentManager.getUserAgent(wallet.address) ||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36";
const options = {
getProxyAgent,
logWithColor,
userAgent,
refCode: config.refCode,
isRegistrationNeeded: true,
};
await registerWallet(wallet, proxy, options);
}, getRandomDelay());
}
await new Promise((resolve) => setTimeout(resolve, 0.5 * 60 * 1000));
logWithColor("SYSTEM", `Waiting 30 seconds before next batch...`, "info");
}
}
main().catch((error) => {
console.error(`${colors.red}FATAL ERROR:${colors.reset} ${error.message}`);
});