forked from munris-vlad/wallet-checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
109 lines (102 loc) · 4.53 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import {chooiceNetwork, entryPoint, evmNetwork} from "./utils/common.js"
import {zkSyncFetchDataAndPrintTable} from "./checkers/zksync.js"
import {aptosFetchDataAndPrintTable} from "./checkers/aptos.js"
import {zoraFetchDataAndPrintTable} from "./checkers/zora.js"
import {lineaFetchDataAndPrintTable} from "./checkers/linea.js"
import {scrollFetchDataAndPrintTable} from "./checkers/scroll.js"
import {balancesFetchDataAndPrintTable} from "./checkers/balances.js"
import {evmFetchDataAndPrintTable} from "./checkers/evm.js"
import {filterFetchDataAndPrintTable} from "./checkers/filter.js"
import {nftFetchDataAndPrintTable} from "./checkers/nft.js"
import {exec} from "child_process"
import {layerzeroFetchDataAndPrintTable} from "./checkers/layerzero.js"
import { baseFetchDataAndPrintTable } from "./checkers/base.js"
import { wormholeFetchDataAndPrintTable } from "./checkers/wormhole.js"
function startExpressServer() {
const expressServer = exec('node server.js', (error, stdout, stderr) => {
if (error) {
console.error(`[Express Server Error]: ${error}`)
}
console.log(`[Express Server]: ${stdout}`)
})
expressServer.stdout.on('data', (data) => {
console.log(`[Express Server]: ${data}`)
})
expressServer.stderr.on('data', (data) => {
console.error(`[Express Server Error]: ${data}`)
})
}
async function startMenu(menu) {
let startOver = true
if (menu === undefined) {
mode = await entryPoint()
} else {
startOver = false
}
switch (mode) {
case "web":
startExpressServer()
break
case "zksync":
await zkSyncFetchDataAndPrintTable().catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "wormhole":
await wormholeFetchDataAndPrintTable().catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "layerzero":
await layerzeroFetchDataAndPrintTable().catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "layerzero_extended":
await layerzeroFetchDataAndPrintTable(true).catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "zora":
await zoraFetchDataAndPrintTable().catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "base":
await baseFetchDataAndPrintTable().catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "aptos":
await aptosFetchDataAndPrintTable().catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "linea":
await lineaFetchDataAndPrintTable().catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "scroll":
await scrollFetchDataAndPrintTable().catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "evm":
let chain = await evmNetwork()
await evmFetchDataAndPrintTable(chain).catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "balances":
let network = await chooiceNetwork()
await balancesFetchDataAndPrintTable(network).catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "filter":
await filterFetchDataAndPrintTable().catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
case "nft":
await nftFetchDataAndPrintTable().catch(error => { console.error('Произошла ошибка:', error)})
if (startOver) await startMenu()
break
}
}
const args = process.argv.slice(2)
let mode = args[0]
if (mode === 'web') {
startExpressServer()
} else {
await startMenu(mode)
}