@icgio/clients-config 1.0.300 → 1.0.301

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -133,12 +133,12 @@ Contains functions to read sensitive data:
133
133
 
134
134
  ## Dependencies
135
135
 
136
- | Package | Purpose |
137
- |---------|---------|
138
- | `lodash` | Utility functions |
136
+ | Package | Purpose |
137
+ | ---------- | --------------------------- |
138
+ | `lodash` | Utility functions |
139
139
  | `fs-extra` | File system utilities (dev) |
140
- | `node-cmd` | Command execution (dev) |
141
- | `prompt` | Interactive prompts (dev) |
140
+ | `node-cmd` | Command execution (dev) |
141
+ | `prompt` | Interactive prompts (dev) |
142
142
 
143
143
  ## Security Notes
144
144
 
package/config.js CHANGED
@@ -1,280 +1,280 @@
1
- const _ = require('lodash')
2
- const config_data = require('./config.json')
3
-
4
- /*
5
- {
6
- "JYAI": {
7
- "Mexc": ["JYAIUSDT"],
8
- "Bitmart": ["JYAIUSDC", "JYAIUSDT"]
9
- }
10
- }
11
- */
12
- const client_exchange_pairs = config_data.client_exchange_pairs
13
- module.exports.client_exchange_pairs = client_exchange_pairs
14
-
15
- /*
16
- {
17
- "ARMY": [],
18
- "JYAI": []
19
- }
20
- */
21
- const client_not_include_exchanges = config_data.client_not_include_exchanges
22
- module.exports.client_not_include_exchanges = client_not_include_exchanges
23
-
24
- /*
25
- {
26
- "JYAI": {
27
- "JYAIUSDT": ["Mexc"],
28
- "JYAIUSDC": ["Bitmart", "Xt"]
29
- }
30
- }
31
- */
32
- const client_pair_main_exchanges = config_data.client_pair_main_exchanges
33
- module.exports.client_pair_main_exchanges = client_pair_main_exchanges
34
-
35
- /*
36
- {
37
- "JYAIUSDT": Set(["Mexc"]),
38
- "OPULUSDT": Set(["Gate", "Kucoin"])
39
- }
40
- */
41
- const pair_main_exchanges_map = {}
42
- for (const client in client_pair_main_exchanges) {
43
- for (const pair in client_pair_main_exchanges[client]) {
44
- if (!pair_main_exchanges_map[pair]) pair_main_exchanges_map[pair] = new Set()
45
- client_pair_main_exchanges[client][pair].forEach((ex) => pair_main_exchanges_map[pair].add(ex))
46
- }
47
- }
48
- module.exports.pair_main_exchanges_map = pair_main_exchanges_map
49
-
50
- /*
51
- Set(["Mexc", "Gate", "Kucoin", "Bitmart", ...])
52
- */
53
- const all_main_exchanges = new Set()
54
- for (const pair in pair_main_exchanges_map) {
55
- pair_main_exchanges_map[pair].forEach((ex) => all_main_exchanges.add(ex))
56
- }
57
- module.exports.all_main_exchanges = all_main_exchanges
58
-
59
- /*
60
- ["BTC", "ETH", "BNB", "USD", "USDC", "USDT", "HKD", "KRW", "THB"]
61
- */
62
- const forex_rate_currencies = ['BTC', 'ETH', 'BNB', 'USD', 'USDC', 'USDT', 'HKD', 'KRW', 'THB']
63
- module.exports.forex_rate_currencies = forex_rate_currencies
64
-
65
- // Build regex pattern from forex_rate_currencies (sorted by length desc to match longer first)
66
- const quotePattern = [...forex_rate_currencies].sort((a, b) => b.length - a.length).join('|')
67
- const pairRegex = new RegExp(`^([A-Z0-9]+?)(${quotePattern})$`)
68
-
69
- /*
70
- {
71
- "JYAI": {
72
- "Mexc": ["JYAI", "USDT"],
73
- "Bitmart": ["JYAI", "USDC", "USDT"]
74
- }
75
- }
76
- */
77
- let client_exchange_currencies = {}
78
- for (let client in client_exchange_pairs) {
79
- for (let exchange in client_exchange_pairs[client]) {
80
- const pairs = client_exchange_pairs[client][exchange]
81
- const currencies = new Set()
82
- pairs.forEach((pair) => {
83
- let match = pair.match(pairRegex)
84
- if (match) {
85
- currencies.add(match[1])
86
- currencies.add(match[2])
87
- } else {
88
- currencies.add(pair.replace(client, ''))
89
- }
90
- })
91
- currencies.add(client)
92
- _.set(client_exchange_currencies, [client, exchange], Array.from(currencies))
93
- }
94
- }
95
- module.exports.client_exchange_currencies = client_exchange_currencies
96
-
97
- /*
98
- {
99
- "JYAI": {
100
- "JYAIUSDT": ["Biconomy", "Bingx", "Bitmart", "Lbank", "Mexc", "Xt"]
101
- }
102
- }
103
- */
104
- let client_pair_exchanges = {}
105
- _.keys(client_exchange_pairs).map((cur) =>
106
- _.keys(client_exchange_pairs[cur]).map((exchange) => {
107
- client_exchange_pairs[cur][exchange].map((pair) => {
108
- if (!client_pair_exchanges[cur] || !client_pair_exchanges[cur][pair]) {
109
- _.set(client_pair_exchanges, [cur, pair], [])
110
- }
111
- client_pair_exchanges[cur][pair].push(exchange)
112
- })
113
- })
114
- )
115
- module.exports.client_pair_exchanges = client_pair_exchanges
116
-
117
- /*
118
- {
119
- "Mexc": ["ARMYUSDT", "B3TRUSDT", "JYAIUSDT"],
120
- "Gate": ["OPULUSDT", "SWFTCUSDT"]
121
- }
122
- */
123
- let exchange_pairs = {}
124
- _.values(client_exchange_pairs).map((exchange_pair_dict) => _.forEach(exchange_pair_dict, (v, k) => (exchange_pairs[k] = _.concat(exchange_pairs[k] ? exchange_pairs[k] : [], v))))
125
- module.exports.exchange_pairs = exchange_pairs
126
-
127
- /*
128
- {
129
- "JYAI": ["JYAIBTC", "JYAIUSDC", "JYAIUSDT"],
130
- "OPUL": ["OPULUSDT"]
131
- }
132
- */
133
- module.exports.client_pairs = _.fromPairs(Object.keys(client_exchange_pairs).map((cur) => [cur, _.union(..._.values(client_exchange_pairs[cur]))]))
134
-
135
- /*
136
- {
137
- "JYAI": ["Biconomy", "Bingx", "Bitmart", "Lbank", "Mexc", "Xt"],
138
- "OPUL": ["Ascendex", "Gate", "Kucoin"]
139
- }
140
- */
141
- module.exports.client_exchanges = _.fromPairs(Object.keys(client_exchange_pairs).map((cur) => [cur, _.keys(client_exchange_pairs[cur])]))
142
-
143
- /*
144
- {
145
- "JYAI": ["JYAI", "BTC", "ETH", "BNB", "USD", "USDC", "USDT", "HKD", "KRW", "THB"],
146
- "HKBITEX-BTC": ["HKBITEX", "BTC", "ETH", "BNB", "USD", "USDC", "USDT", "HKD", "KRW", "THB"]
147
- }
148
- */
149
- module.exports.client_currencies_with_stables = _.fromPairs(_.keys(client_exchange_pairs).map((cur) => [cur, _.uniq([..._.split(cur, '-'), ...forex_rate_currencies])]))
150
-
151
- /*
152
- {
153
- "JYAI": {
154
- "balance": 1,
155
- "trades": 1,
156
- "orderbook": 1,
157
- "deposits_withdrawals": 1
158
- }
159
- }
160
- */
161
- const clients_reporter_interval = config_data.clients_reporter_interval
162
- module.exports.clients_reporter_interval = clients_reporter_interval
163
-
164
- /*
165
- {
166
- "SWFTC": {
167
- "coinbase_1": {
168
- "SWFTC": 5000000,
169
- "USDC": 15000
170
- }
171
- }
172
- }
173
- */
174
- const balance_premium = config_data.balance_premium
175
- module.exports.balance_premium = balance_premium
176
-
177
- /*
178
- {
179
- "balance": { "JYAI": true, "OPUL": true },
180
- "trades": { "JYAI": true, "OPUL": true },
181
- "deposits_withdrawals": { "JYAI": true }
182
- }
183
- */
184
- const client_enabled = config_data.client_enabled
185
- module.exports.client_enabled = client_enabled
186
-
187
- /*
188
- {
189
- "JYAI": [1, 2, 5, 10, 20, 50, 100],
190
- "OPUL": [1, 2, 5, 10, 20, 50, 100]
191
- }
192
- */
193
- const client_levels = config_data.client_levels
194
- module.exports.client_levels = client_levels
195
-
196
- /*
197
- {
198
- "JYAI": ["BTC", "ETH"],
199
- "OPUL": ["BTC", "ETH"]
200
- }
201
- */
202
- const client_price_index_curs = config_data.client_price_index_curs
203
- module.exports.client_price_index_curs = client_price_index_curs
204
-
205
- /*
206
- {
207
- "JYAI": "-4787448589",
208
- "OPUL": "-4581926908"
209
- }
210
- */
211
- const client_telegram_ids = config_data.client_telegram_ids
212
- module.exports.client_telegram_ids = client_telegram_ids
213
-
214
- /*
215
- {
216
- "-4787448589": ["JYAI"],
217
- "-4581926908": ["OPUL"]
218
- }
219
- */
220
- module.exports.telegram_id_clients = _.invertBy(client_telegram_ids)
221
-
222
- /*
223
- {
224
- "JYAI": ["987654321", "111222333"]
225
- }
226
- */
227
- const client_additional_telegram_ids = config_data.client_additional_telegram_ids
228
- module.exports.client_additional_telegram_ids = client_additional_telegram_ids
229
-
230
- /*
231
- {
232
- "JYAI": "icg",
233
- "OPUL": "icg"
234
- }
235
- */
236
- const client_telegram_sender = config_data.client_telegram_sender
237
- module.exports.client_telegram_sender = client_telegram_sender
238
-
239
- /*
240
- {
241
- "JYAI": { "username": "jyai@icg.io" },
242
- "ADMIN": { "username": "admin@icg.io" }
243
- }
244
- */
245
- const dashboard_users = config_data.dashboard_users
246
- module.exports.dashboard_users = dashboard_users
247
-
248
- /*
249
- {
250
- "JYAI": "https://api.geckoterminal.com/api/v2/networks/eth/pools/0x2623edc6008d057786a6bf9dd34185dcddebbf2f"
251
- }
252
- */
253
- const dex_pool_links = config_data.dex_pool_links
254
- module.exports.dex_pool_links = dex_pool_links
255
-
256
- /*
257
- {
258
- "FREEZONE": true,
259
- "HKBITEX-BTC": true
260
- }
261
- */
262
- const server_config_enabled = config_data.server_config_enabled
263
- module.exports.server_config_enabled = server_config_enabled
264
-
265
- /*
266
- {
267
- "JYAI": ["192.168.1.1", "10.0.0.1"]
268
- }
269
- */
270
- const server_config_whitelist_ips = config_data.server_config_whitelist_ips
271
- module.exports.server_config_whitelist_ips = server_config_whitelist_ips
272
-
273
- /*
274
- {
275
- "JYAI": ["172.105.237.102", "139.162.123.194"],
276
- "OPUL": ["172.105.237.102", "172.104.127.200"]
277
- }
278
- */
279
- const server_config_admin_whitelist_ips = config_data.server_config_admin_whitelist_ips
280
- module.exports.server_config_admin_whitelist_ips = server_config_admin_whitelist_ips
1
+ const _ = require('lodash')
2
+ const config_data = require('./config.json')
3
+
4
+ /*
5
+ {
6
+ "JYAI": {
7
+ "Mexc": ["JYAIUSDT"],
8
+ "Bitmart": ["JYAIUSDC", "JYAIUSDT"]
9
+ }
10
+ }
11
+ */
12
+ const client_exchange_pairs = config_data.client_exchange_pairs
13
+ module.exports.client_exchange_pairs = client_exchange_pairs
14
+
15
+ /*
16
+ {
17
+ "ARMY": [],
18
+ "JYAI": []
19
+ }
20
+ */
21
+ const client_not_include_exchanges = config_data.client_not_include_exchanges
22
+ module.exports.client_not_include_exchanges = client_not_include_exchanges
23
+
24
+ /*
25
+ {
26
+ "JYAI": {
27
+ "JYAIUSDT": ["Mexc"],
28
+ "JYAIUSDC": ["Bitmart", "Xt"]
29
+ }
30
+ }
31
+ */
32
+ const client_pair_main_exchanges = config_data.client_pair_main_exchanges
33
+ module.exports.client_pair_main_exchanges = client_pair_main_exchanges
34
+
35
+ /*
36
+ {
37
+ "JYAIUSDT": Set(["Mexc"]),
38
+ "OPULUSDT": Set(["Gate", "Kucoin"])
39
+ }
40
+ */
41
+ const pair_main_exchanges_map = {}
42
+ for (const client in client_pair_main_exchanges) {
43
+ for (const pair in client_pair_main_exchanges[client]) {
44
+ if (!pair_main_exchanges_map[pair]) pair_main_exchanges_map[pair] = new Set()
45
+ client_pair_main_exchanges[client][pair].forEach((ex) => pair_main_exchanges_map[pair].add(ex))
46
+ }
47
+ }
48
+ module.exports.pair_main_exchanges_map = pair_main_exchanges_map
49
+
50
+ /*
51
+ Set(["Mexc", "Gate", "Kucoin", "Bitmart", ...])
52
+ */
53
+ const all_main_exchanges = new Set()
54
+ for (const pair in pair_main_exchanges_map) {
55
+ pair_main_exchanges_map[pair].forEach((ex) => all_main_exchanges.add(ex))
56
+ }
57
+ module.exports.all_main_exchanges = all_main_exchanges
58
+
59
+ /*
60
+ ["BTC", "ETH", "BNB", "USD", "USDC", "USDT", "HKD", "KRW", "THB"]
61
+ */
62
+ const forex_rate_currencies = ['BTC', 'ETH', 'BNB', 'USD', 'USDC', 'USDT', 'HKD', 'KRW', 'THB']
63
+ module.exports.forex_rate_currencies = forex_rate_currencies
64
+
65
+ // Build regex pattern from forex_rate_currencies (sorted by length desc to match longer first)
66
+ const quotePattern = [...forex_rate_currencies].sort((a, b) => b.length - a.length).join('|')
67
+ const pairRegex = new RegExp(`^([A-Z0-9]+?)(${quotePattern})$`)
68
+
69
+ /*
70
+ {
71
+ "JYAI": {
72
+ "Mexc": ["JYAI", "USDT"],
73
+ "Bitmart": ["JYAI", "USDC", "USDT"]
74
+ }
75
+ }
76
+ */
77
+ let client_exchange_currencies = {}
78
+ for (let client in client_exchange_pairs) {
79
+ for (let exchange in client_exchange_pairs[client]) {
80
+ const pairs = client_exchange_pairs[client][exchange]
81
+ const currencies = new Set()
82
+ pairs.forEach((pair) => {
83
+ let match = pair.match(pairRegex)
84
+ if (match) {
85
+ currencies.add(match[1])
86
+ currencies.add(match[2])
87
+ } else {
88
+ currencies.add(pair.replace(client, ''))
89
+ }
90
+ })
91
+ currencies.add(client)
92
+ _.set(client_exchange_currencies, [client, exchange], Array.from(currencies))
93
+ }
94
+ }
95
+ module.exports.client_exchange_currencies = client_exchange_currencies
96
+
97
+ /*
98
+ {
99
+ "JYAI": {
100
+ "JYAIUSDT": ["Biconomy", "Bingx", "Bitmart", "Lbank", "Mexc", "Xt"]
101
+ }
102
+ }
103
+ */
104
+ let client_pair_exchanges = {}
105
+ _.keys(client_exchange_pairs).map((cur) =>
106
+ _.keys(client_exchange_pairs[cur]).map((exchange) => {
107
+ client_exchange_pairs[cur][exchange].map((pair) => {
108
+ if (!client_pair_exchanges[cur] || !client_pair_exchanges[cur][pair]) {
109
+ _.set(client_pair_exchanges, [cur, pair], [])
110
+ }
111
+ client_pair_exchanges[cur][pair].push(exchange)
112
+ })
113
+ }),
114
+ )
115
+ module.exports.client_pair_exchanges = client_pair_exchanges
116
+
117
+ /*
118
+ {
119
+ "Mexc": ["ARMYUSDT", "B3TRUSDT", "JYAIUSDT"],
120
+ "Gate": ["OPULUSDT", "SWFTCUSDT"]
121
+ }
122
+ */
123
+ let exchange_pairs = {}
124
+ _.values(client_exchange_pairs).map((exchange_pair_dict) => _.forEach(exchange_pair_dict, (v, k) => (exchange_pairs[k] = _.concat(exchange_pairs[k] ? exchange_pairs[k] : [], v))))
125
+ module.exports.exchange_pairs = exchange_pairs
126
+
127
+ /*
128
+ {
129
+ "JYAI": ["JYAIBTC", "JYAIUSDC", "JYAIUSDT"],
130
+ "OPUL": ["OPULUSDT"]
131
+ }
132
+ */
133
+ module.exports.client_pairs = _.fromPairs(Object.keys(client_exchange_pairs).map((cur) => [cur, _.union(..._.values(client_exchange_pairs[cur]))]))
134
+
135
+ /*
136
+ {
137
+ "JYAI": ["Biconomy", "Bingx", "Bitmart", "Lbank", "Mexc", "Xt"],
138
+ "OPUL": ["Ascendex", "Gate", "Kucoin"]
139
+ }
140
+ */
141
+ module.exports.client_exchanges = _.fromPairs(Object.keys(client_exchange_pairs).map((cur) => [cur, _.keys(client_exchange_pairs[cur])]))
142
+
143
+ /*
144
+ {
145
+ "JYAI": ["JYAI", "BTC", "ETH", "BNB", "USD", "USDC", "USDT", "HKD", "KRW", "THB"],
146
+ "HKBITEX-BTC": ["HKBITEX", "BTC", "ETH", "BNB", "USD", "USDC", "USDT", "HKD", "KRW", "THB"]
147
+ }
148
+ */
149
+ module.exports.client_currencies_with_stables = _.fromPairs(_.keys(client_exchange_pairs).map((cur) => [cur, _.uniq([..._.split(cur, '-'), ...forex_rate_currencies])]))
150
+
151
+ /*
152
+ {
153
+ "JYAI": {
154
+ "balance": 1,
155
+ "trades": 1,
156
+ "orderbook": 1,
157
+ "deposits_withdrawals": 1
158
+ }
159
+ }
160
+ */
161
+ const clients_reporter_interval = config_data.clients_reporter_interval
162
+ module.exports.clients_reporter_interval = clients_reporter_interval
163
+
164
+ /*
165
+ {
166
+ "SWFTC": {
167
+ "coinbase_1": {
168
+ "SWFTC": 5000000,
169
+ "USDC": 15000
170
+ }
171
+ }
172
+ }
173
+ */
174
+ const balance_premium = config_data.balance_premium
175
+ module.exports.balance_premium = balance_premium
176
+
177
+ /*
178
+ {
179
+ "balance": { "JYAI": true, "OPUL": true },
180
+ "trades": { "JYAI": true, "OPUL": true },
181
+ "deposits_withdrawals": { "JYAI": true }
182
+ }
183
+ */
184
+ const client_enabled = config_data.client_enabled
185
+ module.exports.client_enabled = client_enabled
186
+
187
+ /*
188
+ {
189
+ "JYAI": [1, 2, 5, 10, 20, 50, 100],
190
+ "OPUL": [1, 2, 5, 10, 20, 50, 100]
191
+ }
192
+ */
193
+ const client_levels = config_data.client_levels
194
+ module.exports.client_levels = client_levels
195
+
196
+ /*
197
+ {
198
+ "JYAI": ["BTC", "ETH"],
199
+ "OPUL": ["BTC", "ETH"]
200
+ }
201
+ */
202
+ const client_price_index_curs = config_data.client_price_index_curs
203
+ module.exports.client_price_index_curs = client_price_index_curs
204
+
205
+ /*
206
+ {
207
+ "JYAI": "-4787448589",
208
+ "OPUL": "-4581926908"
209
+ }
210
+ */
211
+ const client_telegram_ids = config_data.client_telegram_ids
212
+ module.exports.client_telegram_ids = client_telegram_ids
213
+
214
+ /*
215
+ {
216
+ "-4787448589": ["JYAI"],
217
+ "-4581926908": ["OPUL"]
218
+ }
219
+ */
220
+ module.exports.telegram_id_clients = _.invertBy(client_telegram_ids)
221
+
222
+ /*
223
+ {
224
+ "JYAI": ["987654321", "111222333"]
225
+ }
226
+ */
227
+ const client_additional_telegram_ids = config_data.client_additional_telegram_ids
228
+ module.exports.client_additional_telegram_ids = client_additional_telegram_ids
229
+
230
+ /*
231
+ {
232
+ "JYAI": "icg",
233
+ "OPUL": "icg"
234
+ }
235
+ */
236
+ const client_telegram_sender = config_data.client_telegram_sender
237
+ module.exports.client_telegram_sender = client_telegram_sender
238
+
239
+ /*
240
+ {
241
+ "JYAI": { "username": "jyai@icg.io" },
242
+ "ADMIN": { "username": "admin@icg.io" }
243
+ }
244
+ */
245
+ const dashboard_users = config_data.dashboard_users
246
+ module.exports.dashboard_users = dashboard_users
247
+
248
+ /*
249
+ {
250
+ "JYAI": "https://api.geckoterminal.com/api/v2/networks/eth/pools/0x2623edc6008d057786a6bf9dd34185dcddebbf2f"
251
+ }
252
+ */
253
+ const dex_pool_links = config_data.dex_pool_links
254
+ module.exports.dex_pool_links = dex_pool_links
255
+
256
+ /*
257
+ {
258
+ "FREEZONE": true,
259
+ "HKBITEX-BTC": true
260
+ }
261
+ */
262
+ const server_config_enabled = config_data.server_config_enabled
263
+ module.exports.server_config_enabled = server_config_enabled
264
+
265
+ /*
266
+ {
267
+ "JYAI": ["192.168.1.1", "10.0.0.1"]
268
+ }
269
+ */
270
+ const server_config_whitelist_ips = config_data.server_config_whitelist_ips
271
+ module.exports.server_config_whitelist_ips = server_config_whitelist_ips
272
+
273
+ /*
274
+ {
275
+ "JYAI": ["172.105.237.102", "139.162.123.194"],
276
+ "OPUL": ["172.105.237.102", "172.104.127.200"]
277
+ }
278
+ */
279
+ const server_config_admin_whitelist_ips = config_data.server_config_admin_whitelist_ips
280
+ module.exports.server_config_admin_whitelist_ips = server_config_admin_whitelist_ips