forked from SYBIL-MAFIA/starknet-soft-retrodrops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
75 lines (59 loc) · 2.22 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import fs from 'fs'
import Workers from './utils/workers.js';
import { General } from './setting/config.js';
export const loadWallets = async () => {
try {
const mm_mnemonics = fs.readFileSync('./data/mmData.txt', "utf8")
.split("\n")
.map(row => row.trim())
.filter(row => row !== "");
const stark_mnemonics = fs.readFileSync('./data/starkData.txt', "utf-8")
.split("\n")
.map(row => row.trim())
.filter(row => row !== "");
const okecx = fs.readFileSync('./data/okx_addresses.txt', "utf-8")
.split("\n")
.map(row => row.trim())
.filter(row => row !== "");
const withdrawalAddressOkx = fs.readFileSync('./data/okxStarknetWithdrawal.txt', "utf-8")
.split("\n")
.map(row => row.trim())
.filter(row => row !== "");
return { mm_mnemonics, stark_mnemonics, okecx, withdrawalAddressOkx };
} catch (err) {
console.error(`Error while loading wallet data: ${err.message}`);
throw err;
}
};
const main = async () => {
let addressIndex = 0;
const values = await loadWallets()
const mmMnemonics = values.mm_mnemonics;
const starkMnemonics = values.stark_mnemonics
const okecx = values.okecx
const withdrawalAddressOkx = values.withdrawalAddressOkx
const groups = [];
for (let i = 0; i < starkMnemonics.length; i += General.threads_counter) {
groups.push(starkMnemonics.slice(i, i + General.threads_counter));
}
for (const group of groups) {
const promises = [];
for (const starkMnemonic of group) {
const mmMnemonic = mmMnemonics.shift();
const okecxKey = okecx.shift();
const StarlnetOkx = withdrawalAddressOkx.shift()
const workerInstance = new Workers(mmMnemonic, starkMnemonic, okecxKey, addressIndex,StarlnetOkx);
promises.push(workerInstance.execute());
addressIndex++;
}
try {
await Promise.all(promises);
} catch (error) {
console.error("Ошибка в главной функции:", error);
}
process.on('unhandledRejection', (reason, promise) => {
console.log('Unhandled Rejection at:', promise, 'reason:', reason);
});
}
};
main().catch(console.error);