forked from munris-vlad/wallet-checker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
95 lines (80 loc) · 2.88 KB
/
server.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
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import express from 'express'
import path from 'path'
import cors from 'cors'
import {zkSyncData} from "./checkers/zksync.js"
import {starknetData} from "./checkers/starknet.js"
import {zoraData} from "./checkers/zora.js"
import {aptosData} from "./checkers/aptos.js"
import {lineaData} from "./checkers/linea.js"
import {balancesData} from "./checkers/balances.js"
import {evmData} from "./checkers/evm.js"
import {readWallets} from "./utils/common.js"
import {layerzeroData} from "./checkers/layerzero.js"
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const app = express()
const port = 80
const apiRoutes = express.Router()
app.use(cors())
app.use('/api', apiRoutes)
app.use(express.static(path.join(__dirname, '/web/dist')))
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, '/web/dist/index.html'))
})
apiRoutes.get('/stats', async (req, res) => {
const starknetWallets = readWallets('./addresses/starknet.txt')
const zksyncWallets = readWallets('./addresses/zksync.txt')
const layerzeroWallets = readWallets('./addresses/layerzero.txt')
const zoraWallets = readWallets('./addresses/zora.txt')
const aptosWallets = readWallets('./addresses/aptos.txt')
const lineaWallets = readWallets('./addresses/linea.txt')
const evmWallets = readWallets('./addresses/evm.txt')
res.json({
'starknet_wallets': starknetWallets,
'zksync_wallets': zksyncWallets,
'layerzero_wallets': layerzeroWallets,
'zora_wallets': zoraWallets,
'aptos_wallets': aptosWallets,
'linea_wallets': lineaWallets,
'evm_wallets': evmWallets,
})
})
apiRoutes.get('/zksync', async (req, res) => {
const responseData = await zkSyncData()
res.json(responseData)
})
apiRoutes.get('/starknet', async (req, res) => {
const responseData = await starknetData()
res.json(responseData)
})
apiRoutes.get('/layerzero', async (req, res) => {
const responseData = await layerzeroData()
res.json(responseData)
})
apiRoutes.get('/zora', async (req, res) => {
const responseData = await zoraData()
res.json(responseData)
})
apiRoutes.get('/aptos', async (req, res) => {
const responseData = await aptosData()
res.json(responseData)
})
apiRoutes.get('/linea', async (req, res) => {
const responseData = await lineaData()
res.json(responseData)
})
apiRoutes.get('/balances', async (req, res) => {
const network = req.query.network ? req.query.network : 'eth'
const responseData = await balancesData(network)
res.json(responseData)
})
apiRoutes.get('/evm', async (req, res) => {
const network = req.query.network ? req.query.network : 'eth'
const responseData = await evmData(network)
res.json(responseData)
})
app.listen(port, () => {
console.log(`Чекер запущен: http://localhost`);
})