@proton/wrap-constants 0.2.192 → 0.3.0
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/dist/index.cjs +2421 -0
- package/dist/index.d.cts +2604 -0
- package/dist/index.d.mts +2076 -12743
- package/dist/index.mjs +2232 -2758
- package/package.json +29 -15
- package/src/coins.ts +3 -3
- package/src/parsers/actions.ts +88 -65
- package/src/parsers/address.ts +22 -22
- package/src/parsers/auth.ts +2 -2
- package/src/parsers/deposit.ts +4 -10
- package/src/parsers/dex.ts +49 -33
- package/src/parsers/login.ts +7 -8
- package/src/parsers/pool.ts +1 -1
- package/src/parsers/withdraw.ts +31 -31
- package/src/parsers/wrap.ts +31 -31
- package/dist/index.d.ts +0 -13271
- package/dist/index.js +0 -2957
package/dist/index.mjs
CHANGED
|
@@ -1,2801 +1,2275 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import cloneDeep from "lodash.clonedeep";
|
|
3
|
+
import BN from "bignumber.js";
|
|
1
4
|
// src/coins.ts
|
|
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
|
-
|
|
5
|
+
let Chains = /* @__PURE__ */ function(Chains) {
|
|
6
|
+
Chains["BitcoinMainnet"] = "Bitcoin";
|
|
7
|
+
Chains["BitcoinTestnet"] = "Bitcoin (Testnet)";
|
|
8
|
+
Chains["EthereumMainnet"] = "Ethereum";
|
|
9
|
+
Chains["EthereumSepolia"] = "Ethereum (Sepolia)";
|
|
10
|
+
Chains["LitecoinMainnet"] = "Litecoin";
|
|
11
|
+
Chains["LitecoinTestnet"] = "Litecoin (Testnet)";
|
|
12
|
+
Chains["BitcoinCashMainnet"] = "Bitcoin Cash";
|
|
13
|
+
Chains["BitcoinCashTestnet"] = "Bitcoin Cash (Testnet)";
|
|
14
|
+
Chains["StellarMainnet"] = "Stellar";
|
|
15
|
+
Chains["StellarTestnet"] = "Stellar (Testnet)";
|
|
16
|
+
Chains["ProtonMainnet"] = "Proton";
|
|
17
|
+
Chains["ProtonTestnet"] = "Proton (Testnet)";
|
|
18
|
+
Chains["PolkadotMainnet"] = "Polkadot";
|
|
19
|
+
Chains["BinanceBEP2"] = "Binance (BEP2)";
|
|
20
|
+
Chains["BinanceBEP20"] = "Binance (BEP20)";
|
|
21
|
+
Chains["EosMainnet"] = "EOS";
|
|
22
|
+
Chains["EosTestnet"] = "EOS (Jungle Testnet)";
|
|
23
|
+
Chains["HederaMainnet"] = "Hedera (Mainnet)";
|
|
24
|
+
Chains["HederaTestnet"] = "Hedera (Testnet)";
|
|
25
|
+
Chains["DogeMainnet"] = "Dogecoin";
|
|
26
|
+
Chains["CardanoMainnet"] = "Cardano";
|
|
27
|
+
Chains["AvalancheXChain"] = "Avalanche X-Chain";
|
|
28
|
+
Chains["AvalancheCChain"] = "Avalanche C-Chain";
|
|
29
|
+
Chains["PolygonMainnet"] = "Polygon";
|
|
30
|
+
Chains["TerraMainnet"] = "Terra";
|
|
31
|
+
Chains["RippleMainnet"] = "Ripple";
|
|
32
|
+
Chains["SolanaMainnet"] = "Solana";
|
|
33
|
+
Chains["XDCMainnet"] = "XDC Network";
|
|
34
|
+
Chains["MetalXTestnet"] = "Metal X-Chain (Testnet)";
|
|
35
|
+
Chains["MetalCTestnet"] = "Metal C-Chain (Testnet)";
|
|
36
|
+
Chains["MetalCMainnet"] = "Metal C-Chain";
|
|
37
|
+
Chains["MetalL2Mainnet"] = "Metal L2";
|
|
38
|
+
Chains["MetalL2Testnet"] = "Metal L2 (Testnet)";
|
|
39
|
+
return Chains;
|
|
40
|
+
}({});
|
|
41
|
+
let Networks = /* @__PURE__ */ function(Networks) {
|
|
42
|
+
Networks["Mainnet"] = "mainnet";
|
|
43
|
+
Networks["Testnet"] = "testnet";
|
|
44
|
+
Networks["ERC20"] = "erc20";
|
|
45
|
+
Networks["BEP20"] = "bep20";
|
|
46
|
+
Networks["XLM"] = "xlm";
|
|
47
|
+
Networks["AVM"] = "avm";
|
|
48
|
+
Networks["EVM"] = "evm";
|
|
49
|
+
Networks["METALL2"] = "metall2";
|
|
50
|
+
Networks["Sepolia"] = "sepolia";
|
|
51
|
+
return Networks;
|
|
52
|
+
}({});
|
|
53
|
+
const similarChains = {
|
|
54
|
+
["Ethereum"]: ["Binance (BEP20)"],
|
|
55
|
+
["Binance (BEP20)"]: ["Ethereum"]
|
|
53
56
|
};
|
|
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
|
-
|
|
57
|
+
let Providers = /* @__PURE__ */ function(Providers) {
|
|
58
|
+
Providers["FIREBLOCKS"] = "fireblocks";
|
|
59
|
+
Providers["METAL"] = "metal";
|
|
60
|
+
Providers["METALL2"] = "metall2";
|
|
61
|
+
return Providers;
|
|
62
|
+
}({});
|
|
63
|
+
const explorerLinkByChain = {
|
|
64
|
+
["Bitcoin"]: (txid) => `https://blockchain.com/btc/tx/${txid}`,
|
|
65
|
+
["Bitcoin (Testnet)"]: (txid) => `https://blockstream.info/testnet/tx/${txid}`,
|
|
66
|
+
["Ethereum"]: (txid) => `https://etherscan.io/tx/${txid}`,
|
|
67
|
+
["Ethereum (Sepolia)"]: (txid) => `https://sepolia.etherscan.io/tx/${txid}`,
|
|
68
|
+
["Litecoin"]: (txid) => `https://blockchair.com/litecoin/transaction/${txid}`,
|
|
69
|
+
["Litecoin (Testnet)"]: (txid) => `https://blockexplorer.one/litecoin/testnet/blockHash/${txid}`,
|
|
70
|
+
["Bitcoin Cash"]: (txid) => `https://blockchair.com/bitcoin-cash/transaction/${txid}`,
|
|
71
|
+
["Bitcoin Cash (Testnet)"]: (txid) => `https://blockexplorer.one/bitcoin-cash/testnet/blockHash/${txid}`,
|
|
72
|
+
["Stellar"]: (txid) => `https://blockchair.com/stellar/transaction/${txid}`,
|
|
73
|
+
["Stellar (Testnet)"]: (txid) => `https://testnet.steexp.com/tx/${txid}`,
|
|
74
|
+
["Proton"]: (txid, traces) => `https://explorer.xprnetwork.org/transaction/${txid}${traces ? "?tab=traces" : ""}`,
|
|
75
|
+
["Proton (Testnet)"]: (txid, traces) => `https://testnet.explorer.xprnetwork.org/transaction/${txid}${traces ? "?tab=traces" : ""}`,
|
|
76
|
+
["Polkadot"]: (txid) => `https://polkadot.subscan.io/extrinsic/${txid}`,
|
|
77
|
+
["Binance (BEP2)"]: (txid) => `https://binance.mintscan.io/txs/${txid}`,
|
|
78
|
+
["Binance (BEP20)"]: (txid) => `https://bscscan.com/tx/${txid}`,
|
|
79
|
+
["EOS"]: (txid) => `https://bloks.io/transaction/${txid}`,
|
|
80
|
+
["EOS (Jungle Testnet)"]: (txid) => `https://jungle.bloks.io/transaction/${txid}`,
|
|
81
|
+
["Hedera (Mainnet)"]: (txid) => `https://app.dragonglass.me/transactions/${txid}`,
|
|
82
|
+
["Hedera (Testnet)"]: (txid) => `https://testnet.dragonglass.me/transactions/${txid}`,
|
|
83
|
+
["Dogecoin"]: (txid) => `https://blockchair.com/dogecoin/transaction/${txid}`,
|
|
84
|
+
["Cardano"]: (txid) => `https://explorer.cardano.org/en/transaction?id=${txid}`,
|
|
85
|
+
["Avalanche X-Chain"]: (txid) => `https://avascan.info/blockchain/x/tx/${txid}`,
|
|
86
|
+
["Avalanche C-Chain"]: (txid) => `https://snowtrace.io/tx/${txid}`,
|
|
87
|
+
["Polygon"]: (txid) => `https://polygonscan.com/tx/${txid}`,
|
|
88
|
+
["Terra"]: (txid) => `https://terra.stake.id/?#/tx/${txid}`,
|
|
89
|
+
["Ripple"]: (txid) => `https://xrpscan.com/tx/${txid}`,
|
|
90
|
+
["Solana"]: (txid) => `https://explorer.solana.com/tx/${txid}`,
|
|
91
|
+
["Metal X-Chain (Testnet)"]: (txid) => `https://metalscan.io/tx/${txid}`,
|
|
92
|
+
["Metal C-Chain (Testnet)"]: (txid) => `https://tahoe.metaltrace.io/tx/${txid}`,
|
|
93
|
+
["Metal C-Chain"]: (txid) => `https://metalscan.io/tx/${txid}`,
|
|
94
|
+
["XDC Network"]: (txid) => `https://xdc.blocksscan.io/txs/${txid}`,
|
|
95
|
+
["Metal L2 (Testnet)"]: (txid) => `https://testnet.explorer.metall2.com/tx/${txid}`,
|
|
96
|
+
["Metal L2"]: (txid) => `https://explorer.metall2.com/tx/${txid}`
|
|
94
97
|
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
network: "mainnet" /* Mainnet */,
|
|
1157
|
-
precision: 6,
|
|
1158
|
-
contract: void 0,
|
|
1159
|
-
provider: "fireblocks" /* FIREBLOCKS */,
|
|
1160
|
-
hasWithdrawMemo: true
|
|
1161
|
-
}
|
|
1162
|
-
] : []
|
|
1163
|
-
],
|
|
1164
|
-
image: "https://app.metalx.com/img/tokens/ust.png",
|
|
1165
|
-
coingeckoId: "terrausd",
|
|
1166
|
-
unifiedCryptoassetId: "7129"
|
|
1167
|
-
},
|
|
1168
|
-
{
|
|
1169
|
-
allowSwap: false,
|
|
1170
|
-
allowBridge: IS_MAINNET,
|
|
1171
|
-
allowLend: false,
|
|
1172
|
-
allowBorrow: false,
|
|
1173
|
-
name: "Solana",
|
|
1174
|
-
coin: "SOL",
|
|
1175
|
-
xtokenSymbol: "XSOL",
|
|
1176
|
-
xtokenPrecision: 6,
|
|
1177
|
-
xtokenContract: "xtokens",
|
|
1178
|
-
wallets: [
|
|
1179
|
-
...IS_MAINNET ? [
|
|
1180
|
-
{
|
|
1181
|
-
wallet: "SOL",
|
|
1182
|
-
symbol: "SOL",
|
|
1183
|
-
chain: "Solana" /* SolanaMainnet */,
|
|
1184
|
-
network: "mainnet" /* Mainnet */,
|
|
1185
|
-
precision: 9,
|
|
1186
|
-
contract: void 0,
|
|
1187
|
-
provider: "fireblocks" /* FIREBLOCKS */,
|
|
1188
|
-
hasWithdrawMemo: false
|
|
1189
|
-
}
|
|
1190
|
-
] : []
|
|
1191
|
-
],
|
|
1192
|
-
image: "https://app.metalx.com/img/tokens/sol.png",
|
|
1193
|
-
coingeckoId: "solana",
|
|
1194
|
-
unifiedCryptoassetId: "5426"
|
|
1195
|
-
},
|
|
1196
|
-
{
|
|
1197
|
-
allowSwap: false,
|
|
1198
|
-
allowBridge: IS_MAINNET,
|
|
1199
|
-
allowLend: false,
|
|
1200
|
-
allowBorrow: false,
|
|
1201
|
-
name: "Ripple",
|
|
1202
|
-
coin: "XRP",
|
|
1203
|
-
xtokenSymbol: "XXRP",
|
|
1204
|
-
xtokenPrecision: 6,
|
|
1205
|
-
xtokenContract: "xtokens",
|
|
1206
|
-
wallets: [
|
|
1207
|
-
...IS_MAINNET ? [
|
|
1208
|
-
{
|
|
1209
|
-
wallet: "XRP",
|
|
1210
|
-
symbol: "XRP",
|
|
1211
|
-
chain: "Ripple" /* RippleMainnet */,
|
|
1212
|
-
network: "mainnet" /* Mainnet */,
|
|
1213
|
-
precision: 6,
|
|
1214
|
-
contract: void 0,
|
|
1215
|
-
provider: "fireblocks" /* FIREBLOCKS */,
|
|
1216
|
-
hasWithdrawMemo: true
|
|
1217
|
-
}
|
|
1218
|
-
] : []
|
|
1219
|
-
],
|
|
1220
|
-
image: "https://app.metalx.com/img/tokens/xrp.png",
|
|
1221
|
-
coingeckoId: "ripple",
|
|
1222
|
-
unifiedCryptoassetId: "52"
|
|
1223
|
-
},
|
|
1224
|
-
// Future
|
|
1225
|
-
{
|
|
1226
|
-
allowSwap: false,
|
|
1227
|
-
allowBridge: false,
|
|
1228
|
-
allowLend: false,
|
|
1229
|
-
allowBorrow: false,
|
|
1230
|
-
name: "Avalanche",
|
|
1231
|
-
coin: "AVAX",
|
|
1232
|
-
xtokenSymbol: "XAVAX",
|
|
1233
|
-
xtokenPrecision: 9,
|
|
1234
|
-
xtokenContract: "xtokens",
|
|
1235
|
-
wallets: [
|
|
1236
|
-
...IS_MAINNET ? [
|
|
1237
|
-
{
|
|
1238
|
-
wallet: "AVAX",
|
|
1239
|
-
symbol: "AVAX",
|
|
1240
|
-
chain: "Avalanche C-Chain" /* AvalancheCChain */,
|
|
1241
|
-
network: "mainnet" /* Mainnet */,
|
|
1242
|
-
precision: 9,
|
|
1243
|
-
contract: void 0,
|
|
1244
|
-
provider: "fireblocks" /* FIREBLOCKS */,
|
|
1245
|
-
hasWithdrawMemo: false
|
|
1246
|
-
}
|
|
1247
|
-
] : []
|
|
1248
|
-
],
|
|
1249
|
-
image: "https://app.metalx.com/img/tokens/avax.png",
|
|
1250
|
-
coingeckoId: "avalanche-2",
|
|
1251
|
-
unifiedCryptoassetId: "5805"
|
|
1252
|
-
},
|
|
1253
|
-
{
|
|
1254
|
-
allowSwap: false,
|
|
1255
|
-
allowBridge: false,
|
|
1256
|
-
allowLend: false,
|
|
1257
|
-
allowBorrow: false,
|
|
1258
|
-
name: "Polygon",
|
|
1259
|
-
coin: "MATIC",
|
|
1260
|
-
xtokenSymbol: "XMATIC",
|
|
1261
|
-
xtokenPrecision: 8,
|
|
1262
|
-
xtokenContract: "xtokens",
|
|
1263
|
-
wallets: [
|
|
1264
|
-
...IS_MAINNET ? [
|
|
1265
|
-
{
|
|
1266
|
-
wallet: "MATIC",
|
|
1267
|
-
symbol: "MATIC",
|
|
1268
|
-
chain: "Polygon" /* PolygonMainnet */,
|
|
1269
|
-
network: "mainnet" /* Mainnet */,
|
|
1270
|
-
precision: 18,
|
|
1271
|
-
contract: "0x0000000000000000000000000000000000000000",
|
|
1272
|
-
provider: "fireblocks" /* FIREBLOCKS */,
|
|
1273
|
-
hasWithdrawMemo: false
|
|
1274
|
-
}
|
|
1275
|
-
] : []
|
|
1276
|
-
],
|
|
1277
|
-
image: "https://app.metalx.com/img/tokens/matic.png",
|
|
1278
|
-
coingeckoId: "matic-network",
|
|
1279
|
-
unifiedCryptoassetId: "3890"
|
|
1280
|
-
},
|
|
1281
|
-
{
|
|
1282
|
-
allowSwap: true,
|
|
1283
|
-
allowBridge: false,
|
|
1284
|
-
allowLend: false,
|
|
1285
|
-
allowBorrow: false,
|
|
1286
|
-
name: "Metal Dollar",
|
|
1287
|
-
coin: "XMD",
|
|
1288
|
-
xtokenSymbol: "XMD",
|
|
1289
|
-
xtokenPrecision: 6,
|
|
1290
|
-
xtokenContract: "xmd.token",
|
|
1291
|
-
wallets: [],
|
|
1292
|
-
image: "https://app.metalx.com/img/tokens/xmd.png",
|
|
1293
|
-
coingeckoId: "",
|
|
1294
|
-
unifiedCryptoassetId: ""
|
|
1295
|
-
},
|
|
1296
|
-
{
|
|
1297
|
-
allowSwap: false,
|
|
1298
|
-
allowBridge: false,
|
|
1299
|
-
allowLend: false,
|
|
1300
|
-
allowBorrow: false,
|
|
1301
|
-
name: "Metal Dollar",
|
|
1302
|
-
coin: "MPD",
|
|
1303
|
-
xtokenSymbol: "MPD",
|
|
1304
|
-
xtokenPrecision: 6,
|
|
1305
|
-
xtokenContract: "mpd.token",
|
|
1306
|
-
wallets: [],
|
|
1307
|
-
image: "https://app.metalx.com/img/tokens/mpd.png",
|
|
1308
|
-
coingeckoId: "",
|
|
1309
|
-
unifiedCryptoassetId: ""
|
|
1310
|
-
},
|
|
1311
|
-
{
|
|
1312
|
-
allowSwap: false,
|
|
1313
|
-
allowBridge: true,
|
|
1314
|
-
allowLend: false,
|
|
1315
|
-
allowBorrow: false,
|
|
1316
|
-
name: "Hedera",
|
|
1317
|
-
coin: "HBAR",
|
|
1318
|
-
xtokenSymbol: "XHBAR",
|
|
1319
|
-
xtokenPrecision: 6,
|
|
1320
|
-
xtokenContract: "xtokens",
|
|
1321
|
-
wallets: [
|
|
1322
|
-
...IS_TESTNET ? [
|
|
1323
|
-
{
|
|
1324
|
-
wallet: "HBAR",
|
|
1325
|
-
symbol: "HBAR",
|
|
1326
|
-
chain: "Hedera (Testnet)" /* HederaTestnet */,
|
|
1327
|
-
network: "testnet" /* Testnet */,
|
|
1328
|
-
precision: 8,
|
|
1329
|
-
contract: void 0,
|
|
1330
|
-
provider: "fireblocks" /* FIREBLOCKS */,
|
|
1331
|
-
hasWithdrawMemo: true
|
|
1332
|
-
}
|
|
1333
|
-
] : [
|
|
1334
|
-
{
|
|
1335
|
-
wallet: "HBAR",
|
|
1336
|
-
symbol: "HBAR",
|
|
1337
|
-
chain: "Hedera (Mainnet)" /* HederaMainnet */,
|
|
1338
|
-
network: "mainnet" /* Mainnet */,
|
|
1339
|
-
precision: 8,
|
|
1340
|
-
contract: void 0,
|
|
1341
|
-
provider: "fireblocks" /* FIREBLOCKS */,
|
|
1342
|
-
hasWithdrawMemo: true
|
|
1343
|
-
}
|
|
1344
|
-
]
|
|
1345
|
-
],
|
|
1346
|
-
image: "https://app.metalx.com/img/tokens/hbar.png",
|
|
1347
|
-
coingeckoId: "hedera-hashgraph",
|
|
1348
|
-
unifiedCryptoassetId: "4642"
|
|
1349
|
-
},
|
|
1350
|
-
{
|
|
1351
|
-
allowSwap: false,
|
|
1352
|
-
allowBridge: IS_TESTNET,
|
|
1353
|
-
allowLend: false,
|
|
1354
|
-
allowBorrow: false,
|
|
1355
|
-
name: "Ripple USD",
|
|
1356
|
-
coin: "RLUSD",
|
|
1357
|
-
xtokenSymbol: "XRLUSD",
|
|
1358
|
-
xtokenPrecision: 6,
|
|
1359
|
-
xtokenContract: "xtokens",
|
|
1360
|
-
wallets: [
|
|
1361
|
-
...IS_MAINNET ? [
|
|
1362
|
-
{
|
|
1363
|
-
wallet: "RLUSD",
|
|
1364
|
-
symbol: "RLUSD",
|
|
1365
|
-
chain: "Ethereum" /* EthereumMainnet */,
|
|
1366
|
-
network: "erc20" /* ERC20 */,
|
|
1367
|
-
precision: 18,
|
|
1368
|
-
contract: "0x8292bb45bf1ee4d140127049757c2e0ff06317ed",
|
|
1369
|
-
provider: "fireblocks" /* FIREBLOCKS */,
|
|
1370
|
-
hasWithdrawMemo: false
|
|
1371
|
-
}
|
|
1372
|
-
] : [
|
|
1373
|
-
{
|
|
1374
|
-
wallet: "RLUSD",
|
|
1375
|
-
symbol: "RLUSD",
|
|
1376
|
-
chain: "Ethereum (Sepolia)" /* EthereumSepolia */,
|
|
1377
|
-
network: "erc20" /* ERC20 */,
|
|
1378
|
-
precision: 18,
|
|
1379
|
-
contract: "0xe101FB315a64cDa9944E570a7bFfaFE60b994b1D",
|
|
1380
|
-
provider: "fireblocks" /* FIREBLOCKS */,
|
|
1381
|
-
hasWithdrawMemo: false
|
|
1382
|
-
}
|
|
1383
|
-
]
|
|
1384
|
-
],
|
|
1385
|
-
image: "https://app.metalx.com/img/tokens/rlusd.png",
|
|
1386
|
-
coingeckoId: "ripple-usd",
|
|
1387
|
-
unifiedCryptoassetId: "34387"
|
|
1388
|
-
},
|
|
1389
|
-
{
|
|
1390
|
-
allowSwap: false,
|
|
1391
|
-
allowBridge: false,
|
|
1392
|
-
allowLend: false,
|
|
1393
|
-
allowBorrow: false,
|
|
1394
|
-
name: "Fidelity Digital Dollar",
|
|
1395
|
-
coin: "FIDD",
|
|
1396
|
-
xtokenSymbol: "XFIDD",
|
|
1397
|
-
xtokenPrecision: 6,
|
|
1398
|
-
xtokenContract: "xtokens",
|
|
1399
|
-
wallets: [
|
|
1400
|
-
...IS_MAINNET ? [
|
|
1401
|
-
{
|
|
1402
|
-
wallet: "FIDD",
|
|
1403
|
-
symbol: "FIDD",
|
|
1404
|
-
chain: "Ethereum" /* EthereumMainnet */,
|
|
1405
|
-
network: "erc20" /* ERC20 */,
|
|
1406
|
-
precision: 18,
|
|
1407
|
-
contract: "0x7C135549504245B5EAE64FC0E99FA5EBABB8E35D",
|
|
1408
|
-
provider: "fireblocks" /* FIREBLOCKS */,
|
|
1409
|
-
hasWithdrawMemo: false
|
|
1410
|
-
}
|
|
1411
|
-
] : []
|
|
1412
|
-
],
|
|
1413
|
-
image: "https://app.metalx.com/img/tokens/fidd.png",
|
|
1414
|
-
coingeckoId: "fidelity-digital-dollar",
|
|
1415
|
-
unifiedCryptoassetId: "39549"
|
|
1416
|
-
},
|
|
1417
|
-
// Important! This coin is not being used on MetalX. It is intended only for XMD-ETH purposes.
|
|
1418
|
-
{
|
|
1419
|
-
allowSwap: false,
|
|
1420
|
-
allowBridge: false,
|
|
1421
|
-
allowLend: false,
|
|
1422
|
-
allowBorrow: false,
|
|
1423
|
-
name: "Pax Dollar",
|
|
1424
|
-
coin: "USDP",
|
|
1425
|
-
xtokenSymbol: "XUSDP",
|
|
1426
|
-
xtokenPrecision: 6,
|
|
1427
|
-
xtokenContract: "xtokens",
|
|
1428
|
-
wallets: [],
|
|
1429
|
-
image: "https://app.metalx.com/img/tokens/usdp.png",
|
|
1430
|
-
coingeckoId: "pax-dollar",
|
|
1431
|
-
unifiedCryptoassetId: "3330"
|
|
1432
|
-
}
|
|
1433
|
-
];
|
|
1434
|
-
const walletWithDuplicateChains = coins.find((coin) => {
|
|
1435
|
-
const chains = coin.wallets.map((wallet) => wallet.chain);
|
|
1436
|
-
return new Set(chains).size !== chains.length;
|
|
1437
|
-
});
|
|
1438
|
-
if (walletWithDuplicateChains) {
|
|
1439
|
-
throw new Error(
|
|
1440
|
-
`Coin ${walletWithDuplicateChains.coin} has duplicate chains in wallet`
|
|
1441
|
-
);
|
|
1442
|
-
}
|
|
1443
|
-
return {
|
|
1444
|
-
allCoins: coins,
|
|
1445
|
-
swapCoins: coins.filter((coin) => coin.allowSwap),
|
|
1446
|
-
bridgeCoins: coins.filter((coin) => coin.allowBridge),
|
|
1447
|
-
lendCoins: coins.filter((coin) => coin.allowLend),
|
|
1448
|
-
borrowCoins: coins.filter((coin) => coin.allowBorrow),
|
|
1449
|
-
loanCoins: coins.filter((coin) => coin.allowLend || coin.allowBorrow),
|
|
1450
|
-
allEnabledCoins: coins.filter(
|
|
1451
|
-
(coin) => coin.allowSwap || coin.allowBridge || coin.xtokenSymbol === "XMD"
|
|
1452
|
-
)
|
|
1453
|
-
};
|
|
98
|
+
const protonExplorerTxUrl = (chain, txId, traces) => chain === "proton" ? explorerLinkByChain["Proton"](txId, traces) : explorerLinkByChain["Proton (Testnet)"](txId, traces);
|
|
99
|
+
const initializeCoins = (protonChain) => {
|
|
100
|
+
const IS_MAINNET = protonChain === "proton";
|
|
101
|
+
const IS_TESTNET = protonChain === "proton-test";
|
|
102
|
+
const coins = [
|
|
103
|
+
{
|
|
104
|
+
allowSwap: true,
|
|
105
|
+
allowBridge: IS_MAINNET,
|
|
106
|
+
allowLend: true,
|
|
107
|
+
allowBorrow: true,
|
|
108
|
+
name: "XPR Network",
|
|
109
|
+
coin: "XPR",
|
|
110
|
+
xtokenSymbol: "XPR",
|
|
111
|
+
xtokenPrecision: 4,
|
|
112
|
+
xtokenContract: "eosio.token",
|
|
113
|
+
wallets: [...IS_MAINNET ? [{
|
|
114
|
+
wallet: "XPR-ERC20",
|
|
115
|
+
symbol: "XPR",
|
|
116
|
+
chain: "Ethereum",
|
|
117
|
+
network: "erc20",
|
|
118
|
+
precision: 4,
|
|
119
|
+
contract: "0xD7EFB00D12C2C13131FD319336FDF952525DA2AF",
|
|
120
|
+
provider: "fireblocks",
|
|
121
|
+
hasWithdrawMemo: false
|
|
122
|
+
}, {
|
|
123
|
+
wallet: "XPR-BEP20",
|
|
124
|
+
symbol: "XPR",
|
|
125
|
+
chain: "Binance (BEP20)",
|
|
126
|
+
network: "bep20",
|
|
127
|
+
precision: 4,
|
|
128
|
+
contract: "0x5DE3939B2F811A61D830E6F52D13B066881412AB",
|
|
129
|
+
provider: "fireblocks",
|
|
130
|
+
hasWithdrawMemo: false
|
|
131
|
+
}] : []],
|
|
132
|
+
image: "https://app.metalx.com/img/tokens/XPR.png",
|
|
133
|
+
coingeckoId: "proton",
|
|
134
|
+
unifiedCryptoassetId: "5350"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
allowSwap: true,
|
|
138
|
+
allowBridge: true,
|
|
139
|
+
allowLend: true,
|
|
140
|
+
allowBorrow: true,
|
|
141
|
+
name: "USD Coin",
|
|
142
|
+
coin: "USDC",
|
|
143
|
+
xtokenSymbol: "XUSDC",
|
|
144
|
+
xtokenPrecision: 6,
|
|
145
|
+
xtokenContract: "xtokens",
|
|
146
|
+
wallets: [...IS_MAINNET ? [{
|
|
147
|
+
wallet: "USDC",
|
|
148
|
+
symbol: "USDC",
|
|
149
|
+
chain: "Ethereum",
|
|
150
|
+
network: "erc20",
|
|
151
|
+
precision: 6,
|
|
152
|
+
contract: "0xA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48",
|
|
153
|
+
provider: "fireblocks",
|
|
154
|
+
hasWithdrawMemo: false
|
|
155
|
+
}, {
|
|
156
|
+
wallet: "USDC-XLM",
|
|
157
|
+
symbol: "USDC",
|
|
158
|
+
chain: "Stellar",
|
|
159
|
+
network: "xlm",
|
|
160
|
+
precision: 7,
|
|
161
|
+
contract: void 0,
|
|
162
|
+
provider: "fireblocks",
|
|
163
|
+
hasWithdrawMemo: true
|
|
164
|
+
}] : [], ...IS_TESTNET ? [{
|
|
165
|
+
wallet: "USDC",
|
|
166
|
+
symbol: "USDC",
|
|
167
|
+
chain: "Ethereum (Sepolia)",
|
|
168
|
+
network: "sepolia",
|
|
169
|
+
precision: 6,
|
|
170
|
+
contract: "0xA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48",
|
|
171
|
+
provider: "fireblocks",
|
|
172
|
+
hasWithdrawMemo: false
|
|
173
|
+
}, {
|
|
174
|
+
wallet: "USDC-XLM",
|
|
175
|
+
symbol: "USDC",
|
|
176
|
+
chain: "Stellar (Testnet)",
|
|
177
|
+
network: "xlm",
|
|
178
|
+
precision: 7,
|
|
179
|
+
contract: void 0,
|
|
180
|
+
provider: "fireblocks",
|
|
181
|
+
hasWithdrawMemo: true
|
|
182
|
+
}] : []],
|
|
183
|
+
image: "https://app.metalx.com/img/tokens/usdc.png",
|
|
184
|
+
coingeckoId: "usd-coin",
|
|
185
|
+
unifiedCryptoassetId: "3408"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
allowSwap: true,
|
|
189
|
+
allowBridge: true,
|
|
190
|
+
allowLend: true,
|
|
191
|
+
allowBorrow: true,
|
|
192
|
+
name: "Metal DAO",
|
|
193
|
+
coin: "MTL",
|
|
194
|
+
xtokenSymbol: "XMT",
|
|
195
|
+
xtokenPrecision: 8,
|
|
196
|
+
xtokenContract: "xtokens",
|
|
197
|
+
wallets: [...IS_MAINNET ? [{
|
|
198
|
+
wallet: "MTL-METALL2",
|
|
199
|
+
symbol: "MTL",
|
|
200
|
+
chain: "Metal L2",
|
|
201
|
+
network: "metall2",
|
|
202
|
+
precision: 8,
|
|
203
|
+
contract: "0xBCFc435d8F276585f6431Fc1b9EE9A850B5C00A9",
|
|
204
|
+
provider: "metall2",
|
|
205
|
+
hasWithdrawMemo: false
|
|
206
|
+
}] : []],
|
|
207
|
+
image: "https://app.metalx.com/img/tokens/mtl.png",
|
|
208
|
+
coingeckoId: "metal",
|
|
209
|
+
unifiedCryptoassetId: "1788"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
allowSwap: true,
|
|
213
|
+
allowBridge: true,
|
|
214
|
+
allowLend: false,
|
|
215
|
+
allowBorrow: false,
|
|
216
|
+
name: "Metal Blockchain",
|
|
217
|
+
coin: "METAL",
|
|
218
|
+
xtokenSymbol: "METAL",
|
|
219
|
+
xtokenPrecision: 8,
|
|
220
|
+
xtokenContract: "xtokens",
|
|
221
|
+
wallets: [...IS_TESTNET ? [{
|
|
222
|
+
wallet: "METAL",
|
|
223
|
+
symbol: "METAL",
|
|
224
|
+
chain: "Metal C-Chain (Testnet)",
|
|
225
|
+
network: "evm",
|
|
226
|
+
precision: 18,
|
|
227
|
+
contract: "",
|
|
228
|
+
provider: "metal",
|
|
229
|
+
hasWithdrawMemo: false
|
|
230
|
+
}] : [], ...IS_MAINNET ? [{
|
|
231
|
+
wallet: "METAL",
|
|
232
|
+
symbol: "METAL",
|
|
233
|
+
chain: "Metal C-Chain",
|
|
234
|
+
network: "evm",
|
|
235
|
+
precision: 18,
|
|
236
|
+
contract: "",
|
|
237
|
+
provider: "metal",
|
|
238
|
+
hasWithdrawMemo: false
|
|
239
|
+
}, {
|
|
240
|
+
wallet: "METAL-ERC20",
|
|
241
|
+
symbol: "METAL",
|
|
242
|
+
chain: "Ethereum",
|
|
243
|
+
network: "erc20",
|
|
244
|
+
precision: 18,
|
|
245
|
+
contract: "",
|
|
246
|
+
provider: "fireblocks",
|
|
247
|
+
hasWithdrawMemo: false
|
|
248
|
+
}] : []],
|
|
249
|
+
image: "https://app.metalx.com/img/tokens/metal.png",
|
|
250
|
+
coingeckoId: "metal-blockchain",
|
|
251
|
+
unifiedCryptoassetId: "21769"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
allowSwap: true,
|
|
255
|
+
allowBridge: true,
|
|
256
|
+
allowLend: true,
|
|
257
|
+
allowBorrow: true,
|
|
258
|
+
name: "Bitcoin",
|
|
259
|
+
coin: "BTC",
|
|
260
|
+
xtokenSymbol: "XBTC",
|
|
261
|
+
xtokenPrecision: 8,
|
|
262
|
+
xtokenContract: "xtokens",
|
|
263
|
+
wallets: [...IS_MAINNET ? [{
|
|
264
|
+
wallet: "BTC",
|
|
265
|
+
symbol: "BTC",
|
|
266
|
+
chain: "Bitcoin",
|
|
267
|
+
network: "mainnet",
|
|
268
|
+
precision: 8,
|
|
269
|
+
contract: void 0,
|
|
270
|
+
provider: "fireblocks",
|
|
271
|
+
hasWithdrawMemo: false
|
|
272
|
+
}] : [], ...IS_TESTNET ? [{
|
|
273
|
+
wallet: "BTC",
|
|
274
|
+
symbol: "BTC",
|
|
275
|
+
chain: "Bitcoin (Testnet)",
|
|
276
|
+
network: "testnet",
|
|
277
|
+
precision: 8,
|
|
278
|
+
contract: void 0,
|
|
279
|
+
provider: "fireblocks",
|
|
280
|
+
hasWithdrawMemo: false
|
|
281
|
+
}] : []],
|
|
282
|
+
image: "https://app.metalx.com/img/tokens/btc.png",
|
|
283
|
+
coingeckoId: "bitcoin",
|
|
284
|
+
unifiedCryptoassetId: "1"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
allowSwap: true,
|
|
288
|
+
allowBridge: true,
|
|
289
|
+
allowLend: true,
|
|
290
|
+
allowBorrow: true,
|
|
291
|
+
name: "Ethereum",
|
|
292
|
+
coin: "ETH",
|
|
293
|
+
xtokenSymbol: "XETH",
|
|
294
|
+
xtokenPrecision: 8,
|
|
295
|
+
xtokenContract: "xtokens",
|
|
296
|
+
wallets: [...IS_MAINNET ? [{
|
|
297
|
+
wallet: "ETH",
|
|
298
|
+
symbol: "ETH",
|
|
299
|
+
chain: "Ethereum",
|
|
300
|
+
network: "mainnet",
|
|
301
|
+
precision: 18,
|
|
302
|
+
contract: "0x0000000000000000000000000000000000000000",
|
|
303
|
+
provider: "fireblocks",
|
|
304
|
+
hasWithdrawMemo: false
|
|
305
|
+
}] : [], ...IS_TESTNET ? [{
|
|
306
|
+
wallet: "ETH",
|
|
307
|
+
symbol: "ETH",
|
|
308
|
+
chain: "Ethereum (Sepolia)",
|
|
309
|
+
network: "sepolia",
|
|
310
|
+
precision: 18,
|
|
311
|
+
contract: "0x0000000000000000000000000000000000000000",
|
|
312
|
+
provider: "fireblocks",
|
|
313
|
+
hasWithdrawMemo: false
|
|
314
|
+
}] : []],
|
|
315
|
+
image: "https://app.metalx.com/img/tokens/eth.png",
|
|
316
|
+
coingeckoId: "ethereum",
|
|
317
|
+
unifiedCryptoassetId: "1027"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
allowSwap: true,
|
|
321
|
+
allowBridge: false,
|
|
322
|
+
allowLend: false,
|
|
323
|
+
allowBorrow: false,
|
|
324
|
+
name: "LOAN Protocol",
|
|
325
|
+
coin: "LOAN",
|
|
326
|
+
xtokenSymbol: "LOAN",
|
|
327
|
+
xtokenPrecision: 4,
|
|
328
|
+
xtokenContract: "loan.token",
|
|
329
|
+
wallets: [],
|
|
330
|
+
image: "https://app.metalx.com/img/tokens/loan.png",
|
|
331
|
+
coingeckoId: "proton-loan",
|
|
332
|
+
unifiedCryptoassetId: "22071"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
allowSwap: true,
|
|
336
|
+
allowBridge: true,
|
|
337
|
+
allowLend: false,
|
|
338
|
+
allowBorrow: false,
|
|
339
|
+
name: "Tether",
|
|
340
|
+
coin: "USDT",
|
|
341
|
+
xtokenSymbol: "XUSDT",
|
|
342
|
+
xtokenPrecision: 6,
|
|
343
|
+
xtokenContract: "xtokens",
|
|
344
|
+
wallets: [...IS_MAINNET ? [{
|
|
345
|
+
wallet: "USDT",
|
|
346
|
+
symbol: "USDT",
|
|
347
|
+
chain: "Ethereum",
|
|
348
|
+
network: "erc20",
|
|
349
|
+
precision: 6,
|
|
350
|
+
contract: "0xDAC17F958D2EE523A2206206994597C13D831EC7",
|
|
351
|
+
provider: "fireblocks",
|
|
352
|
+
hasWithdrawMemo: false
|
|
353
|
+
}] : [{
|
|
354
|
+
wallet: "USDT",
|
|
355
|
+
symbol: "USDT",
|
|
356
|
+
chain: "Ethereum (Sepolia)",
|
|
357
|
+
network: "sepolia",
|
|
358
|
+
precision: 6,
|
|
359
|
+
contract: "0xDAC17F958D2EE523A2206206994597C13D831EC7",
|
|
360
|
+
provider: "fireblocks",
|
|
361
|
+
hasWithdrawMemo: false
|
|
362
|
+
}]],
|
|
363
|
+
image: "https://app.metalx.com/img/tokens/usdt.png",
|
|
364
|
+
coingeckoId: "tether",
|
|
365
|
+
unifiedCryptoassetId: "825"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
allowSwap: false,
|
|
369
|
+
allowBridge: false,
|
|
370
|
+
allowLend: false,
|
|
371
|
+
allowBorrow: false,
|
|
372
|
+
name: "TrueUSD",
|
|
373
|
+
coin: "TUSD",
|
|
374
|
+
xtokenSymbol: "XTUSD",
|
|
375
|
+
xtokenPrecision: 6,
|
|
376
|
+
xtokenContract: "xtokens",
|
|
377
|
+
wallets: [...IS_MAINNET ? [] : []],
|
|
378
|
+
image: "https://app.metalx.com/img/tokens/tusd.png",
|
|
379
|
+
coingeckoId: "true-usd",
|
|
380
|
+
unifiedCryptoassetId: "2563"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
allowSwap: false,
|
|
384
|
+
allowBridge: IS_MAINNET,
|
|
385
|
+
allowLend: false,
|
|
386
|
+
allowBorrow: false,
|
|
387
|
+
name: "Euro Coin",
|
|
388
|
+
coin: "EUROC",
|
|
389
|
+
xtokenSymbol: "XEUROC",
|
|
390
|
+
xtokenPrecision: 6,
|
|
391
|
+
xtokenContract: "xtokens",
|
|
392
|
+
wallets: [...IS_MAINNET ? [{
|
|
393
|
+
wallet: "EUROC-ERC20",
|
|
394
|
+
symbol: "EUROC",
|
|
395
|
+
chain: "Ethereum",
|
|
396
|
+
network: "erc20",
|
|
397
|
+
precision: 6,
|
|
398
|
+
contract: "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",
|
|
399
|
+
provider: "fireblocks",
|
|
400
|
+
hasWithdrawMemo: false
|
|
401
|
+
}] : []],
|
|
402
|
+
image: "https://assets.coingecko.com/coins/images/26045/small/euro-coin.png?1655394420",
|
|
403
|
+
coingeckoId: "euro-coin",
|
|
404
|
+
unifiedCryptoassetId: "20641"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
allowSwap: false,
|
|
408
|
+
allowBridge: IS_MAINNET,
|
|
409
|
+
allowLend: false,
|
|
410
|
+
allowBorrow: false,
|
|
411
|
+
name: "XDC Network",
|
|
412
|
+
coin: "XDC",
|
|
413
|
+
xtokenSymbol: "XDC",
|
|
414
|
+
xtokenPrecision: 4,
|
|
415
|
+
xtokenContract: "xtokens",
|
|
416
|
+
wallets: [...IS_MAINNET ? [{
|
|
417
|
+
wallet: "XDC",
|
|
418
|
+
symbol: "XDC",
|
|
419
|
+
chain: "XDC Network",
|
|
420
|
+
network: "mainnet",
|
|
421
|
+
precision: 18,
|
|
422
|
+
contract: "",
|
|
423
|
+
provider: "fireblocks",
|
|
424
|
+
hasWithdrawMemo: false
|
|
425
|
+
}] : []],
|
|
426
|
+
image: "https://app.metalx.com/img/tokens/xdc.png",
|
|
427
|
+
coingeckoId: "xdce-crowd-sale",
|
|
428
|
+
unifiedCryptoassetId: "2634"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
allowSwap: false,
|
|
432
|
+
allowBridge: IS_MAINNET,
|
|
433
|
+
allowLend: false,
|
|
434
|
+
allowBorrow: false,
|
|
435
|
+
name: "Paxos Dollar",
|
|
436
|
+
coin: "PAX",
|
|
437
|
+
xtokenSymbol: "XPAX",
|
|
438
|
+
xtokenPrecision: 6,
|
|
439
|
+
xtokenContract: "xtokens",
|
|
440
|
+
wallets: [...IS_MAINNET ? [{
|
|
441
|
+
wallet: "PAX",
|
|
442
|
+
symbol: "PAX",
|
|
443
|
+
chain: "Ethereum",
|
|
444
|
+
network: "erc20",
|
|
445
|
+
precision: 18,
|
|
446
|
+
contract: "0x8E870D67F660D95D5BE530380D0EC0BD388289E1",
|
|
447
|
+
provider: "fireblocks",
|
|
448
|
+
hasWithdrawMemo: false
|
|
449
|
+
}] : []],
|
|
450
|
+
image: "https://app.metalx.com/img/tokens/pax.png",
|
|
451
|
+
coingeckoId: "paxos-standard",
|
|
452
|
+
unifiedCryptoassetId: "3330"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
allowSwap: false,
|
|
456
|
+
allowBridge: true,
|
|
457
|
+
allowLend: false,
|
|
458
|
+
allowBorrow: false,
|
|
459
|
+
name: "Paxos Gold",
|
|
460
|
+
coin: "PAXG",
|
|
461
|
+
xtokenSymbol: "XPAXG",
|
|
462
|
+
xtokenPrecision: 8,
|
|
463
|
+
xtokenContract: "xtokens",
|
|
464
|
+
wallets: [...IS_MAINNET ? [{
|
|
465
|
+
wallet: "PAXG",
|
|
466
|
+
symbol: "PAXG",
|
|
467
|
+
chain: "Ethereum",
|
|
468
|
+
network: "erc20",
|
|
469
|
+
precision: 18,
|
|
470
|
+
contract: "0x45804880DE22913DAFE09F4980848ECE6ECBAF78",
|
|
471
|
+
provider: "fireblocks",
|
|
472
|
+
hasWithdrawMemo: false
|
|
473
|
+
}] : [], ...IS_TESTNET ? [{
|
|
474
|
+
wallet: "PAXG",
|
|
475
|
+
symbol: "PAXG",
|
|
476
|
+
chain: "Ethereum (Sepolia)",
|
|
477
|
+
network: "sepolia",
|
|
478
|
+
precision: 18,
|
|
479
|
+
contract: "0x45804880DE22913DAFE09F4980848ECE6ECBAF78",
|
|
480
|
+
provider: "fireblocks",
|
|
481
|
+
hasWithdrawMemo: false
|
|
482
|
+
}] : []],
|
|
483
|
+
image: "https://app.metalx.com/img/tokens/paxg.png",
|
|
484
|
+
coingeckoId: "pax-gold",
|
|
485
|
+
unifiedCryptoassetId: "4705"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
allowSwap: false,
|
|
489
|
+
allowBridge: false,
|
|
490
|
+
allowLend: false,
|
|
491
|
+
allowBorrow: false,
|
|
492
|
+
name: "Storex",
|
|
493
|
+
coin: "STRX",
|
|
494
|
+
xtokenSymbol: "STRX",
|
|
495
|
+
xtokenPrecision: 4,
|
|
496
|
+
xtokenContract: "storex",
|
|
497
|
+
wallets: [],
|
|
498
|
+
image: "https://app.metalx.com/img/tokens/strx.png",
|
|
499
|
+
coingeckoId: "storex",
|
|
500
|
+
unifiedCryptoassetId: ""
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
allowSwap: false,
|
|
504
|
+
allowBridge: false,
|
|
505
|
+
allowLend: false,
|
|
506
|
+
allowBorrow: false,
|
|
507
|
+
name: "Mint",
|
|
508
|
+
coin: "MINT",
|
|
509
|
+
xtokenSymbol: "MINT",
|
|
510
|
+
xtokenPrecision: 4,
|
|
511
|
+
xtokenContract: "protonmint",
|
|
512
|
+
wallets: [],
|
|
513
|
+
image: "https://app.metalx.com/img/tokens/mint.png",
|
|
514
|
+
coingeckoId: "",
|
|
515
|
+
unifiedCryptoassetId: ""
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
allowSwap: IS_MAINNET,
|
|
519
|
+
allowBridge: false,
|
|
520
|
+
allowLend: false,
|
|
521
|
+
allowBorrow: false,
|
|
522
|
+
name: "Snipcoins",
|
|
523
|
+
coin: "SNIPS",
|
|
524
|
+
xtokenSymbol: "SNIPS",
|
|
525
|
+
xtokenPrecision: 4,
|
|
526
|
+
xtokenContract: "snipcoins",
|
|
527
|
+
wallets: [],
|
|
528
|
+
image: "https://app.metalx.com/img/tokens/snips.png",
|
|
529
|
+
coingeckoId: "",
|
|
530
|
+
unifiedCryptoassetId: ""
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
allowSwap: false,
|
|
534
|
+
allowBridge: false,
|
|
535
|
+
allowLend: false,
|
|
536
|
+
allowBorrow: false,
|
|
537
|
+
name: "Uniswap",
|
|
538
|
+
coin: "UNI",
|
|
539
|
+
xtokenSymbol: "XUNI",
|
|
540
|
+
xtokenPrecision: 6,
|
|
541
|
+
xtokenContract: "xtokens",
|
|
542
|
+
wallets: [...IS_MAINNET ? [] : [], ...IS_TESTNET ? [] : []],
|
|
543
|
+
image: "https://app.metalx.com/img/tokens/uni.png",
|
|
544
|
+
coingeckoId: "uniswap",
|
|
545
|
+
unifiedCryptoassetId: "7083"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
allowSwap: false,
|
|
549
|
+
allowBridge: false,
|
|
550
|
+
allowLend: false,
|
|
551
|
+
allowBorrow: false,
|
|
552
|
+
name: "1INCH",
|
|
553
|
+
coin: "1INCH",
|
|
554
|
+
xtokenSymbol: "XINCH",
|
|
555
|
+
xtokenPrecision: 6,
|
|
556
|
+
xtokenContract: "xtokens",
|
|
557
|
+
wallets: [...IS_MAINNET ? [{
|
|
558
|
+
wallet: "1INCH",
|
|
559
|
+
symbol: "1INCH",
|
|
560
|
+
chain: "Ethereum",
|
|
561
|
+
network: "erc20",
|
|
562
|
+
precision: 18,
|
|
563
|
+
contract: "0x111111111117DC0AA78B770FA6A738034120C302",
|
|
564
|
+
provider: "fireblocks",
|
|
565
|
+
hasWithdrawMemo: false
|
|
566
|
+
}] : []],
|
|
567
|
+
image: "https://www.proton.org/images/tokens/xtokensXINCH.png",
|
|
568
|
+
coingeckoId: "1inch",
|
|
569
|
+
unifiedCryptoassetId: "8104"
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
allowSwap: false,
|
|
573
|
+
allowBridge: false,
|
|
574
|
+
allowLend: false,
|
|
575
|
+
allowBorrow: false,
|
|
576
|
+
name: "Chainlink",
|
|
577
|
+
coin: "LINK",
|
|
578
|
+
xtokenSymbol: "XLINK",
|
|
579
|
+
xtokenPrecision: 6,
|
|
580
|
+
xtokenContract: "xtokens",
|
|
581
|
+
wallets: [...IS_MAINNET ? [{
|
|
582
|
+
wallet: "LINK",
|
|
583
|
+
symbol: "LINK",
|
|
584
|
+
chain: "Ethereum",
|
|
585
|
+
network: "erc20",
|
|
586
|
+
precision: 18,
|
|
587
|
+
contract: "0x514910771AF9CA656AF840DFF83E8264ECF986CA",
|
|
588
|
+
provider: "fireblocks",
|
|
589
|
+
hasWithdrawMemo: false
|
|
590
|
+
}] : []],
|
|
591
|
+
image: "https://app.metalx.com/img/tokens/link.png",
|
|
592
|
+
coingeckoId: "chainlink",
|
|
593
|
+
unifiedCryptoassetId: "1975"
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
allowSwap: IS_MAINNET,
|
|
597
|
+
allowBridge: true,
|
|
598
|
+
allowLend: false,
|
|
599
|
+
allowBorrow: false,
|
|
600
|
+
name: "Litecoin",
|
|
601
|
+
coin: "LTC",
|
|
602
|
+
xtokenSymbol: "XLTC",
|
|
603
|
+
xtokenPrecision: 8,
|
|
604
|
+
xtokenContract: "xtokens",
|
|
605
|
+
wallets: [...IS_MAINNET ? [{
|
|
606
|
+
wallet: "LTC",
|
|
607
|
+
symbol: "LTC",
|
|
608
|
+
chain: "Litecoin",
|
|
609
|
+
network: "mainnet",
|
|
610
|
+
precision: 8,
|
|
611
|
+
contract: void 0,
|
|
612
|
+
provider: "fireblocks",
|
|
613
|
+
hasWithdrawMemo: false
|
|
614
|
+
}] : [], ...IS_TESTNET ? [{
|
|
615
|
+
wallet: "LTC",
|
|
616
|
+
symbol: "LTC",
|
|
617
|
+
chain: "Litecoin (Testnet)",
|
|
618
|
+
network: "testnet",
|
|
619
|
+
precision: 8,
|
|
620
|
+
contract: void 0,
|
|
621
|
+
provider: "fireblocks",
|
|
622
|
+
hasWithdrawMemo: false
|
|
623
|
+
}] : []],
|
|
624
|
+
image: "https://app.metalx.com/img/tokens/ltc.png",
|
|
625
|
+
coingeckoId: "litecoin",
|
|
626
|
+
unifiedCryptoassetId: "2"
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
allowSwap: false,
|
|
630
|
+
allowBridge: IS_MAINNET,
|
|
631
|
+
allowLend: false,
|
|
632
|
+
allowBorrow: false,
|
|
633
|
+
name: "PayPal USD",
|
|
634
|
+
coin: "PYUSD",
|
|
635
|
+
xtokenSymbol: "XPYUSD",
|
|
636
|
+
xtokenPrecision: 6,
|
|
637
|
+
xtokenContract: "xtokens",
|
|
638
|
+
wallets: [...IS_MAINNET ? [{
|
|
639
|
+
wallet: "PYUSD",
|
|
640
|
+
symbol: "PYUSD",
|
|
641
|
+
chain: "Ethereum",
|
|
642
|
+
network: "erc20",
|
|
643
|
+
precision: 6,
|
|
644
|
+
contract: void 0,
|
|
645
|
+
provider: "fireblocks",
|
|
646
|
+
hasWithdrawMemo: false
|
|
647
|
+
}] : []],
|
|
648
|
+
image: "https://app.metalx.com/img/tokens/pyusd.png",
|
|
649
|
+
coingeckoId: "paypal-usd",
|
|
650
|
+
unifiedCryptoassetId: "27772"
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
allowSwap: false,
|
|
654
|
+
allowBridge: false,
|
|
655
|
+
allowLend: false,
|
|
656
|
+
allowBorrow: false,
|
|
657
|
+
name: "Bitcoin Cash",
|
|
658
|
+
coin: "BCH",
|
|
659
|
+
xtokenSymbol: "XBCH",
|
|
660
|
+
xtokenPrecision: 8,
|
|
661
|
+
xtokenContract: "xtokens",
|
|
662
|
+
wallets: [...IS_MAINNET ? [] : [], ...IS_TESTNET ? [] : []],
|
|
663
|
+
image: "https://app.metalx.com/img/tokens/bch.png",
|
|
664
|
+
coingeckoId: "bitcoin-cash",
|
|
665
|
+
unifiedCryptoassetId: "1831"
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
allowSwap: true,
|
|
669
|
+
allowBridge: true,
|
|
670
|
+
allowLend: false,
|
|
671
|
+
allowBorrow: false,
|
|
672
|
+
name: "LunarCrush",
|
|
673
|
+
coin: "LUNR",
|
|
674
|
+
xtokenSymbol: "XLUNR",
|
|
675
|
+
xtokenPrecision: 4,
|
|
676
|
+
xtokenContract: "xtokens",
|
|
677
|
+
wallets: [...IS_MAINNET ? [{
|
|
678
|
+
wallet: "LUNR",
|
|
679
|
+
symbol: "LUNR",
|
|
680
|
+
chain: "Ethereum",
|
|
681
|
+
network: "erc20",
|
|
682
|
+
precision: 4,
|
|
683
|
+
contract: void 0,
|
|
684
|
+
provider: "fireblocks",
|
|
685
|
+
hasWithdrawMemo: false
|
|
686
|
+
}] : []],
|
|
687
|
+
image: "https://app.metalx.com/img/tokens/lunr.png",
|
|
688
|
+
coingeckoId: "lunr-token",
|
|
689
|
+
unifiedCryptoassetId: "12971"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
allowSwap: false,
|
|
693
|
+
allowBridge: true,
|
|
694
|
+
allowLend: false,
|
|
695
|
+
allowBorrow: false,
|
|
696
|
+
name: "Stellar",
|
|
697
|
+
coin: "XLM",
|
|
698
|
+
xtokenSymbol: "XXLM",
|
|
699
|
+
xtokenPrecision: 6,
|
|
700
|
+
xtokenContract: "xtokens",
|
|
701
|
+
wallets: [...IS_MAINNET ? [{
|
|
702
|
+
wallet: "XLM",
|
|
703
|
+
symbol: "XLM",
|
|
704
|
+
chain: "Stellar",
|
|
705
|
+
network: "mainnet",
|
|
706
|
+
precision: 7,
|
|
707
|
+
contract: void 0,
|
|
708
|
+
provider: "fireblocks",
|
|
709
|
+
hasWithdrawMemo: true
|
|
710
|
+
}] : [], ...IS_TESTNET ? [{
|
|
711
|
+
wallet: "XLM",
|
|
712
|
+
symbol: "XLM",
|
|
713
|
+
chain: "Stellar (Testnet)",
|
|
714
|
+
network: "testnet",
|
|
715
|
+
precision: 7,
|
|
716
|
+
contract: void 0,
|
|
717
|
+
provider: "fireblocks",
|
|
718
|
+
hasWithdrawMemo: true
|
|
719
|
+
}] : []],
|
|
720
|
+
image: "https://app.metalx.com/img/tokens/xlm.png",
|
|
721
|
+
coingeckoId: "stellar",
|
|
722
|
+
unifiedCryptoassetId: "512"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
allowSwap: false,
|
|
726
|
+
allowBridge: false,
|
|
727
|
+
allowLend: false,
|
|
728
|
+
allowBorrow: false,
|
|
729
|
+
name: "Sense",
|
|
730
|
+
coin: "SENSE",
|
|
731
|
+
xtokenSymbol: "XSENSE",
|
|
732
|
+
xtokenPrecision: 4,
|
|
733
|
+
xtokenContract: "sense",
|
|
734
|
+
wallets: [],
|
|
735
|
+
image: "https://app.metalx.com/img/tokens/sense.png",
|
|
736
|
+
coingeckoId: "sense",
|
|
737
|
+
unifiedCryptoassetId: ""
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
allowSwap: false,
|
|
741
|
+
allowBridge: false,
|
|
742
|
+
allowLend: false,
|
|
743
|
+
allowBorrow: false,
|
|
744
|
+
name: "Polkadot",
|
|
745
|
+
coin: "DOT",
|
|
746
|
+
xtokenSymbol: "XDOT",
|
|
747
|
+
xtokenPrecision: 8,
|
|
748
|
+
xtokenContract: "xtokens",
|
|
749
|
+
wallets: [...IS_MAINNET ? [{
|
|
750
|
+
wallet: "DOT",
|
|
751
|
+
symbol: "DOT",
|
|
752
|
+
chain: "Polkadot",
|
|
753
|
+
network: "mainnet",
|
|
754
|
+
precision: 10,
|
|
755
|
+
contract: void 0,
|
|
756
|
+
provider: "fireblocks",
|
|
757
|
+
hasWithdrawMemo: false
|
|
758
|
+
}] : []],
|
|
759
|
+
image: "https://app.metalx.com/img/tokens/dot.png",
|
|
760
|
+
coingeckoId: "polkadot",
|
|
761
|
+
unifiedCryptoassetId: "6636"
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
allowSwap: true,
|
|
765
|
+
allowBridge: false,
|
|
766
|
+
allowLend: false,
|
|
767
|
+
allowBorrow: false,
|
|
768
|
+
name: "Binance Coin",
|
|
769
|
+
coin: "BNB",
|
|
770
|
+
xtokenSymbol: "XBNB",
|
|
771
|
+
xtokenPrecision: 8,
|
|
772
|
+
xtokenContract: "xtokens",
|
|
773
|
+
wallets: [...IS_MAINNET ? [] : []],
|
|
774
|
+
image: "https://app.metalx.com/img/tokens/bnb.png",
|
|
775
|
+
coingeckoId: "binancecoin",
|
|
776
|
+
unifiedCryptoassetId: "1839"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
allowSwap: false,
|
|
780
|
+
allowBridge: false,
|
|
781
|
+
allowLend: false,
|
|
782
|
+
allowBorrow: false,
|
|
783
|
+
name: "Binance USD",
|
|
784
|
+
coin: "BUSD",
|
|
785
|
+
xtokenSymbol: "XBUSD",
|
|
786
|
+
xtokenPrecision: 6,
|
|
787
|
+
xtokenContract: "xtokens",
|
|
788
|
+
wallets: [],
|
|
789
|
+
image: "https://app.metalx.com/img/tokens/busd.png",
|
|
790
|
+
coingeckoId: "binance-usd",
|
|
791
|
+
unifiedCryptoassetId: "4687"
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
allowSwap: true,
|
|
795
|
+
allowBridge: true,
|
|
796
|
+
allowLend: false,
|
|
797
|
+
allowBorrow: false,
|
|
798
|
+
name: "EOS",
|
|
799
|
+
coin: "EOS",
|
|
800
|
+
xtokenSymbol: "XEOS",
|
|
801
|
+
xtokenPrecision: 4,
|
|
802
|
+
xtokenContract: "xtokens",
|
|
803
|
+
wallets: [...IS_MAINNET ? [{
|
|
804
|
+
wallet: "EOS",
|
|
805
|
+
symbol: "EOS",
|
|
806
|
+
chain: "EOS",
|
|
807
|
+
network: "mainnet",
|
|
808
|
+
precision: 4,
|
|
809
|
+
contract: void 0,
|
|
810
|
+
provider: "fireblocks",
|
|
811
|
+
hasWithdrawMemo: true
|
|
812
|
+
}] : [], ...IS_TESTNET ? [{
|
|
813
|
+
wallet: "EOS",
|
|
814
|
+
symbol: "EOS",
|
|
815
|
+
chain: "EOS (Jungle Testnet)",
|
|
816
|
+
network: "testnet",
|
|
817
|
+
precision: 4,
|
|
818
|
+
contract: void 0,
|
|
819
|
+
provider: "fireblocks",
|
|
820
|
+
hasWithdrawMemo: true
|
|
821
|
+
}] : []],
|
|
822
|
+
image: "https://app.metalx.com/img/tokens/eos.png",
|
|
823
|
+
coingeckoId: "eos",
|
|
824
|
+
unifiedCryptoassetId: "1765"
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
allowSwap: IS_MAINNET,
|
|
828
|
+
allowBridge: IS_MAINNET,
|
|
829
|
+
allowLend: true,
|
|
830
|
+
allowBorrow: true,
|
|
831
|
+
name: "Dogecoin",
|
|
832
|
+
coin: "DOGE",
|
|
833
|
+
xtokenSymbol: "XDOGE",
|
|
834
|
+
xtokenPrecision: 6,
|
|
835
|
+
xtokenContract: "xtokens",
|
|
836
|
+
wallets: [...IS_MAINNET ? [{
|
|
837
|
+
wallet: "DOGE",
|
|
838
|
+
symbol: "DOGE",
|
|
839
|
+
chain: "Dogecoin",
|
|
840
|
+
network: "mainnet",
|
|
841
|
+
precision: 8,
|
|
842
|
+
contract: void 0,
|
|
843
|
+
provider: "fireblocks",
|
|
844
|
+
hasWithdrawMemo: false
|
|
845
|
+
}] : []],
|
|
846
|
+
image: "https://app.metalx.com/img/tokens/doge.png",
|
|
847
|
+
coingeckoId: "dogecoin",
|
|
848
|
+
unifiedCryptoassetId: "74"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
allowSwap: IS_MAINNET,
|
|
852
|
+
allowBridge: IS_MAINNET,
|
|
853
|
+
allowLend: false,
|
|
854
|
+
allowBorrow: false,
|
|
855
|
+
name: "Cardano",
|
|
856
|
+
coin: "ADA",
|
|
857
|
+
xtokenSymbol: "XADA",
|
|
858
|
+
xtokenPrecision: 6,
|
|
859
|
+
xtokenContract: "xtokens",
|
|
860
|
+
wallets: [...IS_MAINNET ? [{
|
|
861
|
+
wallet: "ADA",
|
|
862
|
+
symbol: "ADA",
|
|
863
|
+
chain: "Cardano",
|
|
864
|
+
network: "mainnet",
|
|
865
|
+
precision: 6,
|
|
866
|
+
contract: void 0,
|
|
867
|
+
provider: "fireblocks",
|
|
868
|
+
hasWithdrawMemo: false
|
|
869
|
+
}] : []],
|
|
870
|
+
image: "https://app.metalx.com/img/tokens/ada.png",
|
|
871
|
+
coingeckoId: "cardano",
|
|
872
|
+
unifiedCryptoassetId: "2010"
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
allowSwap: false,
|
|
876
|
+
allowBridge: false,
|
|
877
|
+
allowLend: false,
|
|
878
|
+
allowBorrow: false,
|
|
879
|
+
name: "Terra",
|
|
880
|
+
coin: "LUNA",
|
|
881
|
+
xtokenSymbol: "XLUNA",
|
|
882
|
+
xtokenPrecision: 6,
|
|
883
|
+
xtokenContract: "xtokens",
|
|
884
|
+
wallets: [],
|
|
885
|
+
image: "https://app.metalx.com/img/tokens/luna.png",
|
|
886
|
+
coingeckoId: "terra-luna",
|
|
887
|
+
unifiedCryptoassetId: "4172"
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
allowSwap: false,
|
|
891
|
+
allowBridge: false,
|
|
892
|
+
allowLend: false,
|
|
893
|
+
allowBorrow: false,
|
|
894
|
+
name: "TerraUSD",
|
|
895
|
+
coin: "UST",
|
|
896
|
+
xtokenSymbol: "XUST",
|
|
897
|
+
xtokenPrecision: 6,
|
|
898
|
+
xtokenContract: "xtokens",
|
|
899
|
+
wallets: [...IS_MAINNET ? [{
|
|
900
|
+
wallet: "UST",
|
|
901
|
+
symbol: "UST",
|
|
902
|
+
chain: "Terra",
|
|
903
|
+
network: "mainnet",
|
|
904
|
+
precision: 6,
|
|
905
|
+
contract: void 0,
|
|
906
|
+
provider: "fireblocks",
|
|
907
|
+
hasWithdrawMemo: true
|
|
908
|
+
}] : []],
|
|
909
|
+
image: "https://app.metalx.com/img/tokens/ust.png",
|
|
910
|
+
coingeckoId: "terrausd",
|
|
911
|
+
unifiedCryptoassetId: "7129"
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
allowSwap: false,
|
|
915
|
+
allowBridge: IS_MAINNET,
|
|
916
|
+
allowLend: false,
|
|
917
|
+
allowBorrow: false,
|
|
918
|
+
name: "Solana",
|
|
919
|
+
coin: "SOL",
|
|
920
|
+
xtokenSymbol: "XSOL",
|
|
921
|
+
xtokenPrecision: 6,
|
|
922
|
+
xtokenContract: "xtokens",
|
|
923
|
+
wallets: [...IS_MAINNET ? [{
|
|
924
|
+
wallet: "SOL",
|
|
925
|
+
symbol: "SOL",
|
|
926
|
+
chain: "Solana",
|
|
927
|
+
network: "mainnet",
|
|
928
|
+
precision: 9,
|
|
929
|
+
contract: void 0,
|
|
930
|
+
provider: "fireblocks",
|
|
931
|
+
hasWithdrawMemo: false
|
|
932
|
+
}] : []],
|
|
933
|
+
image: "https://app.metalx.com/img/tokens/sol.png",
|
|
934
|
+
coingeckoId: "solana",
|
|
935
|
+
unifiedCryptoassetId: "5426"
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
allowSwap: false,
|
|
939
|
+
allowBridge: IS_MAINNET,
|
|
940
|
+
allowLend: false,
|
|
941
|
+
allowBorrow: false,
|
|
942
|
+
name: "Ripple",
|
|
943
|
+
coin: "XRP",
|
|
944
|
+
xtokenSymbol: "XXRP",
|
|
945
|
+
xtokenPrecision: 6,
|
|
946
|
+
xtokenContract: "xtokens",
|
|
947
|
+
wallets: [...IS_MAINNET ? [{
|
|
948
|
+
wallet: "XRP",
|
|
949
|
+
symbol: "XRP",
|
|
950
|
+
chain: "Ripple",
|
|
951
|
+
network: "mainnet",
|
|
952
|
+
precision: 6,
|
|
953
|
+
contract: void 0,
|
|
954
|
+
provider: "fireblocks",
|
|
955
|
+
hasWithdrawMemo: true
|
|
956
|
+
}] : []],
|
|
957
|
+
image: "https://app.metalx.com/img/tokens/xrp.png",
|
|
958
|
+
coingeckoId: "ripple",
|
|
959
|
+
unifiedCryptoassetId: "52"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
allowSwap: false,
|
|
963
|
+
allowBridge: false,
|
|
964
|
+
allowLend: false,
|
|
965
|
+
allowBorrow: false,
|
|
966
|
+
name: "Avalanche",
|
|
967
|
+
coin: "AVAX",
|
|
968
|
+
xtokenSymbol: "XAVAX",
|
|
969
|
+
xtokenPrecision: 9,
|
|
970
|
+
xtokenContract: "xtokens",
|
|
971
|
+
wallets: [...IS_MAINNET ? [{
|
|
972
|
+
wallet: "AVAX",
|
|
973
|
+
symbol: "AVAX",
|
|
974
|
+
chain: "Avalanche C-Chain",
|
|
975
|
+
network: "mainnet",
|
|
976
|
+
precision: 9,
|
|
977
|
+
contract: void 0,
|
|
978
|
+
provider: "fireblocks",
|
|
979
|
+
hasWithdrawMemo: false
|
|
980
|
+
}] : []],
|
|
981
|
+
image: "https://app.metalx.com/img/tokens/avax.png",
|
|
982
|
+
coingeckoId: "avalanche-2",
|
|
983
|
+
unifiedCryptoassetId: "5805"
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
allowSwap: false,
|
|
987
|
+
allowBridge: false,
|
|
988
|
+
allowLend: false,
|
|
989
|
+
allowBorrow: false,
|
|
990
|
+
name: "Polygon",
|
|
991
|
+
coin: "MATIC",
|
|
992
|
+
xtokenSymbol: "XMATIC",
|
|
993
|
+
xtokenPrecision: 8,
|
|
994
|
+
xtokenContract: "xtokens",
|
|
995
|
+
wallets: [...IS_MAINNET ? [{
|
|
996
|
+
wallet: "MATIC",
|
|
997
|
+
symbol: "MATIC",
|
|
998
|
+
chain: "Polygon",
|
|
999
|
+
network: "mainnet",
|
|
1000
|
+
precision: 18,
|
|
1001
|
+
contract: "0x0000000000000000000000000000000000000000",
|
|
1002
|
+
provider: "fireblocks",
|
|
1003
|
+
hasWithdrawMemo: false
|
|
1004
|
+
}] : []],
|
|
1005
|
+
image: "https://app.metalx.com/img/tokens/matic.png",
|
|
1006
|
+
coingeckoId: "matic-network",
|
|
1007
|
+
unifiedCryptoassetId: "3890"
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
allowSwap: true,
|
|
1011
|
+
allowBridge: false,
|
|
1012
|
+
allowLend: false,
|
|
1013
|
+
allowBorrow: false,
|
|
1014
|
+
name: "Metal Dollar",
|
|
1015
|
+
coin: "XMD",
|
|
1016
|
+
xtokenSymbol: "XMD",
|
|
1017
|
+
xtokenPrecision: 6,
|
|
1018
|
+
xtokenContract: "xmd.token",
|
|
1019
|
+
wallets: [],
|
|
1020
|
+
image: "https://app.metalx.com/img/tokens/xmd.png",
|
|
1021
|
+
coingeckoId: "",
|
|
1022
|
+
unifiedCryptoassetId: ""
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
allowSwap: false,
|
|
1026
|
+
allowBridge: false,
|
|
1027
|
+
allowLend: false,
|
|
1028
|
+
allowBorrow: false,
|
|
1029
|
+
name: "Metal Dollar",
|
|
1030
|
+
coin: "MPD",
|
|
1031
|
+
xtokenSymbol: "MPD",
|
|
1032
|
+
xtokenPrecision: 6,
|
|
1033
|
+
xtokenContract: "mpd.token",
|
|
1034
|
+
wallets: [],
|
|
1035
|
+
image: "https://app.metalx.com/img/tokens/mpd.png",
|
|
1036
|
+
coingeckoId: "",
|
|
1037
|
+
unifiedCryptoassetId: ""
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
allowSwap: false,
|
|
1041
|
+
allowBridge: true,
|
|
1042
|
+
allowLend: false,
|
|
1043
|
+
allowBorrow: false,
|
|
1044
|
+
name: "Hedera",
|
|
1045
|
+
coin: "HBAR",
|
|
1046
|
+
xtokenSymbol: "XHBAR",
|
|
1047
|
+
xtokenPrecision: 6,
|
|
1048
|
+
xtokenContract: "xtokens",
|
|
1049
|
+
wallets: [...IS_TESTNET ? [{
|
|
1050
|
+
wallet: "HBAR",
|
|
1051
|
+
symbol: "HBAR",
|
|
1052
|
+
chain: "Hedera (Testnet)",
|
|
1053
|
+
network: "testnet",
|
|
1054
|
+
precision: 8,
|
|
1055
|
+
contract: void 0,
|
|
1056
|
+
provider: "fireblocks",
|
|
1057
|
+
hasWithdrawMemo: true
|
|
1058
|
+
}] : [{
|
|
1059
|
+
wallet: "HBAR",
|
|
1060
|
+
symbol: "HBAR",
|
|
1061
|
+
chain: "Hedera (Mainnet)",
|
|
1062
|
+
network: "mainnet",
|
|
1063
|
+
precision: 8,
|
|
1064
|
+
contract: void 0,
|
|
1065
|
+
provider: "fireblocks",
|
|
1066
|
+
hasWithdrawMemo: true
|
|
1067
|
+
}]],
|
|
1068
|
+
image: "https://app.metalx.com/img/tokens/hbar.png",
|
|
1069
|
+
coingeckoId: "hedera-hashgraph",
|
|
1070
|
+
unifiedCryptoassetId: "4642"
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
allowSwap: false,
|
|
1074
|
+
allowBridge: IS_TESTNET,
|
|
1075
|
+
allowLend: false,
|
|
1076
|
+
allowBorrow: false,
|
|
1077
|
+
name: "Ripple USD",
|
|
1078
|
+
coin: "RLUSD",
|
|
1079
|
+
xtokenSymbol: "XRLUSD",
|
|
1080
|
+
xtokenPrecision: 6,
|
|
1081
|
+
xtokenContract: "xtokens",
|
|
1082
|
+
wallets: [...IS_MAINNET ? [{
|
|
1083
|
+
wallet: "RLUSD",
|
|
1084
|
+
symbol: "RLUSD",
|
|
1085
|
+
chain: "Ethereum",
|
|
1086
|
+
network: "erc20",
|
|
1087
|
+
precision: 18,
|
|
1088
|
+
contract: "0x8292bb45bf1ee4d140127049757c2e0ff06317ed",
|
|
1089
|
+
provider: "fireblocks",
|
|
1090
|
+
hasWithdrawMemo: false
|
|
1091
|
+
}] : [{
|
|
1092
|
+
wallet: "RLUSD",
|
|
1093
|
+
symbol: "RLUSD",
|
|
1094
|
+
chain: "Ethereum (Sepolia)",
|
|
1095
|
+
network: "erc20",
|
|
1096
|
+
precision: 18,
|
|
1097
|
+
contract: "0xe101FB315a64cDa9944E570a7bFfaFE60b994b1D",
|
|
1098
|
+
provider: "fireblocks",
|
|
1099
|
+
hasWithdrawMemo: false
|
|
1100
|
+
}]],
|
|
1101
|
+
image: "https://app.metalx.com/img/tokens/rlusd.png",
|
|
1102
|
+
coingeckoId: "ripple-usd",
|
|
1103
|
+
unifiedCryptoassetId: "34387"
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
allowSwap: false,
|
|
1107
|
+
allowBridge: false,
|
|
1108
|
+
allowLend: false,
|
|
1109
|
+
allowBorrow: false,
|
|
1110
|
+
name: "Fidelity Digital Dollar",
|
|
1111
|
+
coin: "FIDD",
|
|
1112
|
+
xtokenSymbol: "XFIDD",
|
|
1113
|
+
xtokenPrecision: 6,
|
|
1114
|
+
xtokenContract: "xtokens",
|
|
1115
|
+
wallets: [...IS_MAINNET ? [{
|
|
1116
|
+
wallet: "FIDD",
|
|
1117
|
+
symbol: "FIDD",
|
|
1118
|
+
chain: "Ethereum",
|
|
1119
|
+
network: "erc20",
|
|
1120
|
+
precision: 18,
|
|
1121
|
+
contract: "0x7C135549504245B5EAE64FC0E99FA5EBABB8E35D",
|
|
1122
|
+
provider: "fireblocks",
|
|
1123
|
+
hasWithdrawMemo: false
|
|
1124
|
+
}] : []],
|
|
1125
|
+
image: "https://app.metalx.com/img/tokens/fidd.png",
|
|
1126
|
+
coingeckoId: "fidelity-digital-dollar",
|
|
1127
|
+
unifiedCryptoassetId: "39549"
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
allowSwap: false,
|
|
1131
|
+
allowBridge: false,
|
|
1132
|
+
allowLend: false,
|
|
1133
|
+
allowBorrow: false,
|
|
1134
|
+
name: "Pax Dollar",
|
|
1135
|
+
coin: "USDP",
|
|
1136
|
+
xtokenSymbol: "XUSDP",
|
|
1137
|
+
xtokenPrecision: 6,
|
|
1138
|
+
xtokenContract: "xtokens",
|
|
1139
|
+
wallets: [],
|
|
1140
|
+
image: "https://app.metalx.com/img/tokens/usdp.png",
|
|
1141
|
+
coingeckoId: "pax-dollar",
|
|
1142
|
+
unifiedCryptoassetId: "3330"
|
|
1143
|
+
}
|
|
1144
|
+
];
|
|
1145
|
+
const walletWithDuplicateChains = coins.find((coin) => {
|
|
1146
|
+
const chains = coin.wallets.map((wallet) => wallet.chain);
|
|
1147
|
+
return new Set(chains).size !== chains.length;
|
|
1148
|
+
});
|
|
1149
|
+
if (walletWithDuplicateChains) throw new Error(`Coin ${walletWithDuplicateChains.coin} has duplicate chains in wallet`);
|
|
1150
|
+
return {
|
|
1151
|
+
allCoins: coins,
|
|
1152
|
+
swapCoins: coins.filter((coin) => coin.allowSwap),
|
|
1153
|
+
bridgeCoins: coins.filter((coin) => coin.allowBridge),
|
|
1154
|
+
lendCoins: coins.filter((coin) => coin.allowLend),
|
|
1155
|
+
borrowCoins: coins.filter((coin) => coin.allowBorrow),
|
|
1156
|
+
loanCoins: coins.filter((coin) => coin.allowLend || coin.allowBorrow),
|
|
1157
|
+
allEnabledCoins: coins.filter((coin) => coin.allowSwap || coin.allowBridge || coin.xtokenSymbol === "XMD")
|
|
1158
|
+
};
|
|
1454
1159
|
};
|
|
1455
|
-
|
|
1456
|
-
// src/parsers/actions.ts
|
|
1457
|
-
import * as z2 from "zod";
|
|
1458
|
-
|
|
1459
1160
|
// src/parsers/base.ts
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
permission: z.string()
|
|
1161
|
+
const accountParser = z.string().regex(/^[.1-5a-z]{0,12}[.1-5a-j]?$/);
|
|
1162
|
+
const authorizationParser = z.object({
|
|
1163
|
+
actor: accountParser,
|
|
1164
|
+
permission: z.string()
|
|
1465
1165
|
});
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1166
|
+
const authorizationsParser = z.array(authorizationParser).min(1);
|
|
1167
|
+
const ExtendedAssetParser = z.object({
|
|
1168
|
+
quantity: z.string(),
|
|
1169
|
+
contract: accountParser
|
|
1470
1170
|
});
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1171
|
+
const accountRamDeltaParser = z.object({
|
|
1172
|
+
account: z.string(),
|
|
1173
|
+
delta: z.string()
|
|
1474
1174
|
});
|
|
1475
|
-
|
|
1476
1175
|
// src/parsers/actions.ts
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
)
|
|
1539
|
-
}),
|
|
1540
|
-
authorization: authorizationsParser
|
|
1541
|
-
});
|
|
1542
|
-
var singleActionTransactionParser = (contract, action, data) => {
|
|
1543
|
-
const baseAction = baseActionParser(contract, action, data);
|
|
1544
|
-
const webauthAction = webauthActionParser(contract, action, data);
|
|
1545
|
-
return rawTransactionParser.merge(z2.object({
|
|
1546
|
-
actions: z2.array(baseAction.or(webauthAction)).length(1)
|
|
1547
|
-
}));
|
|
1176
|
+
const actionParser = z.object({
|
|
1177
|
+
account: z.string(),
|
|
1178
|
+
name: z.string(),
|
|
1179
|
+
authorization: z.array(z.object({
|
|
1180
|
+
actor: z.string(),
|
|
1181
|
+
permission: z.string()
|
|
1182
|
+
})),
|
|
1183
|
+
data: z.any(),
|
|
1184
|
+
hex_data: z.string().optional()
|
|
1185
|
+
});
|
|
1186
|
+
const transactionExtensionsParser = z.array(z.number().or(z.string())).optional();
|
|
1187
|
+
const rawTransactionParser = z.object({
|
|
1188
|
+
expiration: z.string(),
|
|
1189
|
+
ref_block_num: z.number(),
|
|
1190
|
+
ref_block_prefix: z.number(),
|
|
1191
|
+
max_net_usage_words: z.number(),
|
|
1192
|
+
max_cpu_usage_ms: z.number(),
|
|
1193
|
+
delay_sec: z.number(),
|
|
1194
|
+
context_free_actions: z.array(actionParser),
|
|
1195
|
+
transaction_extensions: z.array(transactionExtensionsParser)
|
|
1196
|
+
});
|
|
1197
|
+
const baseActionParser = (contract, action, data) => z.object({
|
|
1198
|
+
account: contract === "*" ? accountParser : z.literal(contract),
|
|
1199
|
+
name: z.literal(action),
|
|
1200
|
+
data: z.object(data),
|
|
1201
|
+
authorization: authorizationsParser
|
|
1202
|
+
});
|
|
1203
|
+
const baseActionSerializedParser = (contract, action, data) => z.object({
|
|
1204
|
+
account: contract === "*" ? accountParser : z.literal(contract),
|
|
1205
|
+
name: z.literal(action),
|
|
1206
|
+
data: z.string().or(z.object(data)),
|
|
1207
|
+
authorization: authorizationsParser
|
|
1208
|
+
});
|
|
1209
|
+
const webauthActionParser = (contract, action, data) => z.object({
|
|
1210
|
+
account: z.literal("webauthn"),
|
|
1211
|
+
name: z.literal("exec"),
|
|
1212
|
+
data: z.object({
|
|
1213
|
+
account: accountParser,
|
|
1214
|
+
key: z.object({
|
|
1215
|
+
key: z.array(z.string().or(z.object({
|
|
1216
|
+
modulus: z.string(),
|
|
1217
|
+
exponent: z.string()
|
|
1218
|
+
}))),
|
|
1219
|
+
user_presence: z.number(),
|
|
1220
|
+
rpid: z.string()
|
|
1221
|
+
}),
|
|
1222
|
+
nonce: z.number(),
|
|
1223
|
+
permissions: authorizationsParser,
|
|
1224
|
+
signature: z.object({
|
|
1225
|
+
auth_data: z.string(),
|
|
1226
|
+
client_json: z.string(),
|
|
1227
|
+
signature: z.string()
|
|
1228
|
+
}),
|
|
1229
|
+
trx: rawTransactionParser.extend({ actions: z.array(baseActionSerializedParser(contract, action, data)).length(1) })
|
|
1230
|
+
}),
|
|
1231
|
+
authorization: authorizationsParser
|
|
1232
|
+
});
|
|
1233
|
+
const singleActionTransactionParser = (contract, action, data) => {
|
|
1234
|
+
const baseAction = baseActionParser(contract, action, data);
|
|
1235
|
+
const webauthAction = webauthActionParser(contract, action, data);
|
|
1236
|
+
return rawTransactionParser.extend({ actions: z.array(baseAction.or(webauthAction)).length(1) });
|
|
1548
1237
|
};
|
|
1549
|
-
|
|
1550
|
-
// src/parsers/address.ts
|
|
1551
|
-
import * as z4 from "zod";
|
|
1552
|
-
|
|
1553
|
-
// src/parsers/auth.ts
|
|
1554
|
-
import * as z3 from "zod";
|
|
1555
|
-
|
|
1556
1238
|
// src/constants.ts
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
matches.push({
|
|
1673
|
-
...bridgeCoin,
|
|
1674
|
-
...bridgeWallet
|
|
1675
|
-
});
|
|
1676
|
-
}
|
|
1677
|
-
});
|
|
1678
|
-
});
|
|
1679
|
-
return matches.length === 1 ? matches[0] : void 0;
|
|
1680
|
-
},
|
|
1681
|
-
findBridgeCoinNetwork(coin, network) {
|
|
1682
|
-
const bridgeCoin = constants.BRIDGE_COINS.find(
|
|
1683
|
-
(bridgeCoin2) => bridgeCoin2.coin === coin
|
|
1684
|
-
);
|
|
1685
|
-
if (!bridgeCoin) return void 0;
|
|
1686
|
-
const bridgeWallet = bridgeCoin.wallets.find(
|
|
1687
|
-
(bridgeWallet2) => bridgeWallet2.network === network
|
|
1688
|
-
);
|
|
1689
|
-
if (!bridgeWallet) return void 0;
|
|
1690
|
-
return {
|
|
1691
|
-
...bridgeCoin,
|
|
1692
|
-
...bridgeWallet
|
|
1693
|
-
};
|
|
1694
|
-
}
|
|
1695
|
-
};
|
|
1696
|
-
return constants;
|
|
1239
|
+
const WRAP_CONTRACT = "proton.wrap";
|
|
1240
|
+
const WRAP_AUTH_ACTION = "generateauth";
|
|
1241
|
+
const FEE_FACTOR = 1e4;
|
|
1242
|
+
const initializeConstants = (chain) => {
|
|
1243
|
+
const { swapCoins, bridgeCoins, allEnabledCoins, allCoins, lendCoins, borrowCoins, loanCoins } = initializeCoins(chain);
|
|
1244
|
+
const constants = {
|
|
1245
|
+
SWAP_CONTRACT: "proton.swaps",
|
|
1246
|
+
VEST_CONTRACT: "vest",
|
|
1247
|
+
DEX_CONTRACT: "dex",
|
|
1248
|
+
FEE_FACTOR,
|
|
1249
|
+
SWAP_URL: chain === "proton" ? "https://otc.protonswap.com" : "https://otc-test.protonswap.com",
|
|
1250
|
+
WRAP_SERVER_URL: chain === "proton" ? "https://www.api.bloks.io/proton-wrap-public2" : "https://www.api.bloks.io/proton-wrap-testnet-public2",
|
|
1251
|
+
WRAP_CONTRACT,
|
|
1252
|
+
WRAP_ACTIONS: {
|
|
1253
|
+
SAVE_ADDRESS: "saveaddress2",
|
|
1254
|
+
DELETE_ADDRESS: "deladdress2",
|
|
1255
|
+
WRAP_START: "wrapstart2",
|
|
1256
|
+
WRAP_FINISH: "wrapfinish2",
|
|
1257
|
+
WRAP_PROCESS: "wrapprocess2",
|
|
1258
|
+
WRAP_SET_CONF: "wrapsetconf2"
|
|
1259
|
+
},
|
|
1260
|
+
WRAP_TABLES: {
|
|
1261
|
+
ADDRESSES: "addresses2",
|
|
1262
|
+
WRAPS: "wraps2"
|
|
1263
|
+
},
|
|
1264
|
+
ADDRESSES_INDEXES: {
|
|
1265
|
+
BY_ACCOUNT: 2,
|
|
1266
|
+
BY_ADDR_HASH: 3
|
|
1267
|
+
},
|
|
1268
|
+
WRAPS_INDEXES: {
|
|
1269
|
+
BY_ACCOUNT: 2,
|
|
1270
|
+
BY_STATUS: 3,
|
|
1271
|
+
BY_WRAP_HASH: 4
|
|
1272
|
+
},
|
|
1273
|
+
WRAP_PROCESS_TIMER: 5e3,
|
|
1274
|
+
FARM_CONTRACT: "yield.farms",
|
|
1275
|
+
WEBHOOK_PERMISSION: "webhook",
|
|
1276
|
+
PUBLIC_PERMISSION: "public",
|
|
1277
|
+
LIGHT_PERMISSION: "light",
|
|
1278
|
+
WRAP_AUTH_ACTION,
|
|
1279
|
+
METAL_ENDPOINT: chain === "proton" ? "https://cirrus.metalpay.com" : "https://cirrus-dev.metalpay.com",
|
|
1280
|
+
METAL_PROTON_ENDPOINT: chain === "proton" ? "https://identity.api.prod.metalx.com" : "https://identity.api.dev.metalx.com",
|
|
1281
|
+
METAL_DEX_HTTP_ENDPOINT: chain === "proton" ? "https://dex.api.mainnet.metalx.com/dex" : "https://dex.api.testnet.metalx.com/dex",
|
|
1282
|
+
METAL_DEX_WS_ENDPOINT: chain === "proton" ? "wss://dex.api.mainnet.metalx.com/dexws" : "wss://dex.api.testnet.metalx.com/dexws",
|
|
1283
|
+
PROTON_ENDPOINTS: chain === "proton" ? [
|
|
1284
|
+
"https://rpc.api.mainnet.metalx.com",
|
|
1285
|
+
"https://proton.greymass.com",
|
|
1286
|
+
"https://proton.eoscafeblock.com",
|
|
1287
|
+
"https://proton.cryptolions.io",
|
|
1288
|
+
"https://proton.eosusa.news"
|
|
1289
|
+
] : ["https://rpc.api.testnet.metalx.com", "https://testnet.protonchain.com"],
|
|
1290
|
+
CHAIN_ID: chain === "proton" ? "384da888112027f0321850a169f737c33e53b388aad48b5adace4bab97f437e0" : "71ee83bcf52142d61019d95f9cc5427ba6a0d7ff8accd9e2088ae2abeaf3d3dd",
|
|
1291
|
+
COINS_URL: chain === "proton" ? "https://app.metalx.com/mainnet-coins.json" : "https://app.metalx.com/testnet-coins.json",
|
|
1292
|
+
DEX_PROCESS_SIZE: 30,
|
|
1293
|
+
DEX_SLTPPROCESS_SIZE: 10,
|
|
1294
|
+
MAX_PRICE: "9223372036854775806",
|
|
1295
|
+
MAX_ITEMS_PER_PAGE_DESKTOP: 100,
|
|
1296
|
+
MIN_PRICE: 1,
|
|
1297
|
+
DEFAULT_DEX_SYMBOL: "XPR_XMD",
|
|
1298
|
+
CHAIN: chain,
|
|
1299
|
+
SWAP_COINS: swapCoins,
|
|
1300
|
+
BRIDGE_COINS: bridgeCoins,
|
|
1301
|
+
ALL_ENABLED_COINS: allEnabledCoins,
|
|
1302
|
+
LEND_COINS: lendCoins,
|
|
1303
|
+
BORROW_COINS: borrowCoins,
|
|
1304
|
+
LOAN_COINS: loanCoins,
|
|
1305
|
+
ALL_COINS: allCoins,
|
|
1306
|
+
XMD_CONTRACT: "xmd.treasury",
|
|
1307
|
+
XMD_TOKEN_CONTRACT: "xmd.token",
|
|
1308
|
+
XMD_SYMBOL_CODE: "XMD",
|
|
1309
|
+
XMD_DECIMALS: 6,
|
|
1310
|
+
findBridgeCoinWalletByXtokenAndChain(xtokenSymbol, chain) {
|
|
1311
|
+
const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin) => bridgeCoin.xtokenSymbol === xtokenSymbol);
|
|
1312
|
+
if (!bridgeCoin) return void 0;
|
|
1313
|
+
const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet) => bridgeWallet.chain === chain);
|
|
1314
|
+
if (!bridgeWallet) return void 0;
|
|
1315
|
+
return {
|
|
1316
|
+
...bridgeCoin,
|
|
1317
|
+
...bridgeWallet
|
|
1318
|
+
};
|
|
1319
|
+
},
|
|
1320
|
+
findBridgeCoinWallet(coin, wallet) {
|
|
1321
|
+
const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin) => bridgeCoin.coin === coin);
|
|
1322
|
+
if (!bridgeCoin) return void 0;
|
|
1323
|
+
const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet) => bridgeWallet.wallet === wallet);
|
|
1324
|
+
if (!bridgeWallet) return void 0;
|
|
1325
|
+
return {
|
|
1326
|
+
...bridgeCoin,
|
|
1327
|
+
...bridgeWallet
|
|
1328
|
+
};
|
|
1329
|
+
},
|
|
1330
|
+
findBridgeCoinWalletByWallet(wallet) {
|
|
1331
|
+
const matches = [];
|
|
1332
|
+
constants.BRIDGE_COINS.forEach((bridgeCoin) => {
|
|
1333
|
+
bridgeCoin.wallets.forEach((bridgeWallet) => {
|
|
1334
|
+
if (bridgeWallet.wallet === wallet) matches.push({
|
|
1335
|
+
...bridgeCoin,
|
|
1336
|
+
...bridgeWallet
|
|
1337
|
+
});
|
|
1338
|
+
});
|
|
1339
|
+
});
|
|
1340
|
+
return matches.length === 1 ? matches[0] : void 0;
|
|
1341
|
+
},
|
|
1342
|
+
findBridgeCoinNetwork(coin, network) {
|
|
1343
|
+
const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin) => bridgeCoin.coin === coin);
|
|
1344
|
+
if (!bridgeCoin) return void 0;
|
|
1345
|
+
const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet) => bridgeWallet.network === network);
|
|
1346
|
+
if (!bridgeWallet) return void 0;
|
|
1347
|
+
return {
|
|
1348
|
+
...bridgeCoin,
|
|
1349
|
+
...bridgeWallet
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
};
|
|
1353
|
+
return constants;
|
|
1697
1354
|
};
|
|
1698
|
-
|
|
1699
1355
|
// src/parsers/auth.ts
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1356
|
+
const createAbstractAuthParser = (contract, action, data) => {
|
|
1357
|
+
return z.object({
|
|
1358
|
+
signer: authorizationParser,
|
|
1359
|
+
signatures: z.array(z.string()).length(1),
|
|
1360
|
+
transaction: singleActionTransactionParser(contract, action, data)
|
|
1361
|
+
});
|
|
1706
1362
|
};
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1363
|
+
const generateAuthData = {
|
|
1364
|
+
time: z.string(),
|
|
1365
|
+
protonAccount: z.string()
|
|
1710
1366
|
};
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
WRAP_AUTH_ACTION,
|
|
1714
|
-
generateAuthData
|
|
1715
|
-
);
|
|
1716
|
-
var generateAuthParser = createAbstractAuthParser(
|
|
1717
|
-
WRAP_CONTRACT,
|
|
1718
|
-
WRAP_AUTH_ACTION,
|
|
1719
|
-
generateAuthData
|
|
1720
|
-
);
|
|
1721
|
-
|
|
1367
|
+
const generateAuthActionsBaseParser = baseActionParser(WRAP_CONTRACT, WRAP_AUTH_ACTION, generateAuthData);
|
|
1368
|
+
const generateAuthParser = createAbstractAuthParser(WRAP_CONTRACT, WRAP_AUTH_ACTION, generateAuthData);
|
|
1722
1369
|
// src/parsers/address.ts
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
});
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
})
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
wallet: z4.string(),
|
|
1742
|
-
// "ETH",
|
|
1743
|
-
memo: z4.string().optional()
|
|
1744
|
-
});
|
|
1745
|
-
|
|
1370
|
+
const addressParser = z.object({
|
|
1371
|
+
index: z.number(),
|
|
1372
|
+
account: accountParser,
|
|
1373
|
+
chain: z.string(),
|
|
1374
|
+
address: z.string(),
|
|
1375
|
+
address_hash: z.string()
|
|
1376
|
+
});
|
|
1377
|
+
const generateAddressBodyParser = generateAuthParser.extend({
|
|
1378
|
+
coin: z.string(),
|
|
1379
|
+
wallet: z.string()
|
|
1380
|
+
});
|
|
1381
|
+
const generateAddressResponse = z.object({
|
|
1382
|
+
id: z.string(),
|
|
1383
|
+
address: z.string(),
|
|
1384
|
+
coin: z.string(),
|
|
1385
|
+
wallet: z.string(),
|
|
1386
|
+
memo: z.string().optional()
|
|
1387
|
+
});
|
|
1746
1388
|
// src/parsers/currency.ts
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
rates: z5.array(rateParser)
|
|
1389
|
+
const rateParser = z.object({
|
|
1390
|
+
counterCurrency: z.string(),
|
|
1391
|
+
price: z.number(),
|
|
1392
|
+
priceChangePercent: z.number(),
|
|
1393
|
+
marketCap: z.number(),
|
|
1394
|
+
volume: z.number(),
|
|
1395
|
+
timestamp: z.number()
|
|
1396
|
+
});
|
|
1397
|
+
const exchangeRateParser = z.object({
|
|
1398
|
+
contract: z.string(),
|
|
1399
|
+
symbol: z.string(),
|
|
1400
|
+
rank: z.number(),
|
|
1401
|
+
rates: z.array(rateParser)
|
|
1402
|
+
});
|
|
1403
|
+
const exchangeRatesParser = z.array(exchangeRateParser);
|
|
1404
|
+
const bloksRatesParser = z.array(z.object({
|
|
1405
|
+
contract: z.string(),
|
|
1406
|
+
symbol: z.string(),
|
|
1407
|
+
rank: z.number(),
|
|
1408
|
+
rates: z.array(rateParser)
|
|
1768
1409
|
}));
|
|
1769
|
-
|
|
1770
1410
|
// src/parsers/deposit.ts
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
// 10000000000000000
|
|
1798
|
-
valueString: z6.string(),
|
|
1799
|
-
// "10000000000000000"
|
|
1800
|
-
address: z6.string(),
|
|
1801
|
-
// "0x0000"
|
|
1802
|
-
type: z6.nativeEnum(Type),
|
|
1803
|
-
// "receive" or "send"
|
|
1804
|
-
state: z6.string(),
|
|
1805
|
-
// "confirmed"
|
|
1806
|
-
confirmations: z6.number(),
|
|
1807
|
-
// 1
|
|
1808
|
-
hash: z6.string(),
|
|
1809
|
-
// "b4781422be95fee8fbbf720e3e0fa9705ae834474ef25f5724cdd0f5d23211ed"
|
|
1810
|
-
blockHash: z6.string().optional().nullable(),
|
|
1811
|
-
// "000000000000000000089b270eb99f75107d6a9cde37ec944cb80a2998df7b43"
|
|
1812
|
-
blockHeight: z6.number().optional().nullable()
|
|
1813
|
-
// 643159
|
|
1814
|
-
});
|
|
1815
|
-
|
|
1411
|
+
let Type = /* @__PURE__ */ function(Type) {
|
|
1412
|
+
Type["RECEIVE"] = "receive";
|
|
1413
|
+
Type["SEND"] = "send";
|
|
1414
|
+
return Type;
|
|
1415
|
+
}({});
|
|
1416
|
+
const depositBodyParser = z.object({
|
|
1417
|
+
id: z.string(),
|
|
1418
|
+
type: z.enum(Type),
|
|
1419
|
+
hash: z.string(),
|
|
1420
|
+
coin: z.string(),
|
|
1421
|
+
wallet: z.string(),
|
|
1422
|
+
network: z.string()
|
|
1423
|
+
});
|
|
1424
|
+
const metalTransactionParser = z.object({
|
|
1425
|
+
id: z.string(),
|
|
1426
|
+
wallet: z.string(),
|
|
1427
|
+
value: z.number(),
|
|
1428
|
+
valueString: z.string(),
|
|
1429
|
+
address: z.string(),
|
|
1430
|
+
type: z.enum(Type),
|
|
1431
|
+
state: z.string(),
|
|
1432
|
+
confirmations: z.number(),
|
|
1433
|
+
hash: z.string(),
|
|
1434
|
+
blockHash: z.string().optional().nullable(),
|
|
1435
|
+
blockHeight: z.number().optional().nullable()
|
|
1436
|
+
});
|
|
1816
1437
|
// src/parsers/otc.ts
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
});
|
|
1834
|
-
|
|
1438
|
+
const otcOrderResponseParser = z.object({
|
|
1439
|
+
success: z.boolean(),
|
|
1440
|
+
transaction_id: z.string(),
|
|
1441
|
+
errormsg: z.string().optional()
|
|
1442
|
+
});
|
|
1443
|
+
const otcQuoteBodyParser = z.object({
|
|
1444
|
+
baseAmount: z.number(),
|
|
1445
|
+
baseSymbol: z.string(),
|
|
1446
|
+
quoteSymbol: z.string()
|
|
1447
|
+
});
|
|
1448
|
+
const otcQuoteResponseParser = z.object({
|
|
1449
|
+
success: z.boolean(),
|
|
1450
|
+
token: z.string(),
|
|
1451
|
+
qty: z.number(),
|
|
1452
|
+
errormsg: z.string().optional()
|
|
1453
|
+
});
|
|
1835
1454
|
// src/parsers/withdraw.ts
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
to: z8.literal(WRAP_CONTRACT),
|
|
1842
|
-
quantity: z8.string(),
|
|
1843
|
-
memo: z8.string()
|
|
1455
|
+
const withdrawData = {
|
|
1456
|
+
from: z.string().refine((val) => val !== WRAP_CONTRACT, { error: `${WRAP_CONTRACT} must be receiver` }),
|
|
1457
|
+
to: z.literal(WRAP_CONTRACT),
|
|
1458
|
+
quantity: z.string(),
|
|
1459
|
+
memo: z.string()
|
|
1844
1460
|
};
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
});
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
});
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
});
|
|
1863
|
-
|
|
1461
|
+
const withdrawBodyBaseAction = baseActionParser("*", "transfer", withdrawData);
|
|
1462
|
+
const withdrawBodyParser = z.object({
|
|
1463
|
+
signer: authorizationParser,
|
|
1464
|
+
signatures: z.array(z.string()).length(1),
|
|
1465
|
+
transaction: singleActionTransactionParser("*", "transfer", withdrawData),
|
|
1466
|
+
quoteId: z.string(),
|
|
1467
|
+
provider: z.string().optional()
|
|
1468
|
+
});
|
|
1469
|
+
const withdrawMetalResponseParser = z.object({
|
|
1470
|
+
success: z.boolean(),
|
|
1471
|
+
id: z.string()
|
|
1472
|
+
});
|
|
1473
|
+
const withdrawalFeeQuoteParser = z.object({
|
|
1474
|
+
quoteId: z.string(),
|
|
1475
|
+
estimatedFee: z.string(),
|
|
1476
|
+
currency: z.string(),
|
|
1477
|
+
network: z.string()
|
|
1478
|
+
});
|
|
1864
1479
|
// src/parsers/withdrawalHistory.ts
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
});
|
|
1884
|
-
|
|
1480
|
+
const withdrawHistoryMetalSwapParser = z.object({
|
|
1481
|
+
id: z.string(),
|
|
1482
|
+
status: z.string(),
|
|
1483
|
+
amount: z.string(),
|
|
1484
|
+
currency: z.string(),
|
|
1485
|
+
network: z.string(),
|
|
1486
|
+
created: z.string(),
|
|
1487
|
+
withdrawalAddress: z.string(),
|
|
1488
|
+
withdrawalHash: z.string().optional()
|
|
1489
|
+
});
|
|
1490
|
+
const withdrawHistoryMetalResponseParser = z.object({
|
|
1491
|
+
swaps: z.array(withdrawHistoryMetalSwapParser),
|
|
1492
|
+
page: z.number(),
|
|
1493
|
+
pageSize: z.number(),
|
|
1494
|
+
numberOfElements: z.number(),
|
|
1495
|
+
totalPages: z.number(),
|
|
1496
|
+
totalElements: z.number()
|
|
1497
|
+
});
|
|
1885
1498
|
// src/parsers/wrap.ts
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
});
|
|
1919
|
-
|
|
1499
|
+
let Status = /* @__PURE__ */ function(Status) {
|
|
1500
|
+
Status["PENDING"] = "pending";
|
|
1501
|
+
Status["SUCCESS"] = "success";
|
|
1502
|
+
Status["FAIL"] = "fail";
|
|
1503
|
+
Status["PROCESSING"] = "processing";
|
|
1504
|
+
return Status;
|
|
1505
|
+
}({});
|
|
1506
|
+
const wrapStartParser = z.object({
|
|
1507
|
+
balance: ExtendedAssetParser,
|
|
1508
|
+
id: z.string(),
|
|
1509
|
+
txid: z.string(),
|
|
1510
|
+
chain: z.string(),
|
|
1511
|
+
deposit_address: z.string(),
|
|
1512
|
+
confirmations: z.number()
|
|
1513
|
+
});
|
|
1514
|
+
const wrapSetConfParser = z.object({
|
|
1515
|
+
wrap_hash: z.string(),
|
|
1516
|
+
confirmations: z.number()
|
|
1517
|
+
});
|
|
1518
|
+
const wrapParser = z.object({
|
|
1519
|
+
index: z.number(),
|
|
1520
|
+
proton_account: z.string(),
|
|
1521
|
+
balance: ExtendedAssetParser,
|
|
1522
|
+
id: z.string(),
|
|
1523
|
+
txid: z.string(),
|
|
1524
|
+
chain: z.string(),
|
|
1525
|
+
deposit_address: z.string(),
|
|
1526
|
+
status: z.enum(Status),
|
|
1527
|
+
finish_txid: z.string(),
|
|
1528
|
+
wrap_hash: z.string(),
|
|
1529
|
+
confirmations: z.number()
|
|
1530
|
+
});
|
|
1920
1531
|
// src/parsers/dex.ts
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
});
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
});
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
});
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
});
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
});
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
});
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
});
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
1532
|
+
const booleanParamSchema = z.boolean().or(z.enum(["true", "false"]).transform((value) => value === "true"));
|
|
1533
|
+
const createLimit = (base, max) => z.coerce.number().default(base).refine((n) => +n > 0 && +n <= max, { error: `Limit must be between 0 and ${max}` });
|
|
1534
|
+
const createOffset = (base) => z.coerce.number().default(base);
|
|
1535
|
+
const ordinalOrderIdsParser = z.array(z.string()).or(z.string()).optional().transform((oids) => {
|
|
1536
|
+
if (!oids) return [];
|
|
1537
|
+
return Array.isArray(oids) ? oids : [oids];
|
|
1538
|
+
});
|
|
1539
|
+
const marketIdsParser = z.array(z.coerce.number()).or(z.coerce.number()).transform((mids) => Array.isArray(mids) ? mids : [mids]).refine((mids) => mids.length > 0, { error: "Must provide atleast one market ID" });
|
|
1540
|
+
const contractFiltersParser = z.array(z.string()).or(z.string()).optional().transform((oids) => {
|
|
1541
|
+
if (!oids) return [];
|
|
1542
|
+
return Array.isArray(oids) ? oids : [oids];
|
|
1543
|
+
});
|
|
1544
|
+
const sortDirectionEnum = z.enum(["asc", "desc"]);
|
|
1545
|
+
/**
|
|
1546
|
+
* OHLCV
|
|
1547
|
+
*/
|
|
1548
|
+
const ohlcvParser = z.object({
|
|
1549
|
+
time: z.number(),
|
|
1550
|
+
open: z.number(),
|
|
1551
|
+
high: z.number(),
|
|
1552
|
+
low: z.number(),
|
|
1553
|
+
close: z.number(),
|
|
1554
|
+
volume: z.number(),
|
|
1555
|
+
volume_bid: z.number(),
|
|
1556
|
+
count: z.number()
|
|
1557
|
+
});
|
|
1558
|
+
const getOhlcvParser = z.object({
|
|
1559
|
+
interval: z.string(),
|
|
1560
|
+
from: z.string(),
|
|
1561
|
+
to: z.string(),
|
|
1562
|
+
symbol: z.string(),
|
|
1563
|
+
limit: createLimit(500, 2e3)
|
|
1564
|
+
});
|
|
1565
|
+
const getOhlcvResponseParser = z.object({
|
|
1566
|
+
sync: z.number(),
|
|
1567
|
+
data: z.array(ohlcvParser)
|
|
1568
|
+
});
|
|
1569
|
+
/**
|
|
1570
|
+
* Order History
|
|
1571
|
+
*/
|
|
1572
|
+
const openOrderParser = z.object({
|
|
1573
|
+
block_time: z.string(),
|
|
1574
|
+
order_id: z.string(),
|
|
1575
|
+
ordinal_order_id: z.string(),
|
|
1576
|
+
market_id: z.number(),
|
|
1577
|
+
quantity_init: z.number().optional(),
|
|
1578
|
+
quantity_curr: z.number(),
|
|
1579
|
+
price: z.number(),
|
|
1580
|
+
account_name: z.string(),
|
|
1581
|
+
order_side: z.number(),
|
|
1582
|
+
order_type: z.number(),
|
|
1583
|
+
trigger_price: z.number(),
|
|
1584
|
+
fill_type: z.number(),
|
|
1585
|
+
status: z.string(),
|
|
1586
|
+
filled_total: z.number().optional(),
|
|
1587
|
+
filled_amount: z.number().optional(),
|
|
1588
|
+
filled_fee: z.number().optional(),
|
|
1589
|
+
created_at: z.string(),
|
|
1590
|
+
updated_at: z.string()
|
|
1591
|
+
});
|
|
1592
|
+
const orderLogParser = z.object({
|
|
1593
|
+
seq: z.string(),
|
|
1594
|
+
block_num: z.string(),
|
|
1595
|
+
block_time: z.string(),
|
|
1596
|
+
order_id: z.string(),
|
|
1597
|
+
market_id: z.number(),
|
|
1598
|
+
quantity: z.string(),
|
|
1599
|
+
price: z.string(),
|
|
1600
|
+
account_name: z.string(),
|
|
1601
|
+
order_side: z.number(),
|
|
1602
|
+
order_type: z.number(),
|
|
1603
|
+
trigger_price: z.string(),
|
|
1604
|
+
fill_type: z.number(),
|
|
1605
|
+
status: z.string(),
|
|
1606
|
+
quantity_change: z.string(),
|
|
1607
|
+
trx_id: z.string()
|
|
1608
|
+
});
|
|
1609
|
+
const orderHistoryParser = z.object({
|
|
1610
|
+
block_num: z.string(),
|
|
1611
|
+
block_time: z.string(),
|
|
1612
|
+
order_id: z.string(),
|
|
1613
|
+
ordinal_order_id: z.string(),
|
|
1614
|
+
market_id: z.number(),
|
|
1615
|
+
quantity_init: z.number().optional(),
|
|
1616
|
+
quantity_curr: z.number(),
|
|
1617
|
+
price: z.number(),
|
|
1618
|
+
account_name: z.string(),
|
|
1619
|
+
order_side: z.number(),
|
|
1620
|
+
order_type: z.number(),
|
|
1621
|
+
trigger_price: z.number(),
|
|
1622
|
+
fill_type: z.number(),
|
|
1623
|
+
status: z.string(),
|
|
1624
|
+
quantity_change: z.number(),
|
|
1625
|
+
filled_total: z.number().optional(),
|
|
1626
|
+
filled_amount: z.number().optional(),
|
|
1627
|
+
filled_fee: z.number().optional(),
|
|
1628
|
+
seq: z.string(),
|
|
1629
|
+
trx_id: z.string()
|
|
1630
|
+
});
|
|
1631
|
+
const getOpenOrdersParser = z.object({
|
|
1632
|
+
account: z.string(),
|
|
1633
|
+
symbol: z.string().optional(),
|
|
1634
|
+
offset: createOffset(0),
|
|
1635
|
+
limit: createLimit(100, 250),
|
|
1636
|
+
ordinal_order_ids: ordinalOrderIdsParser
|
|
1637
|
+
});
|
|
1638
|
+
const getOpenOrdersResponseParser = z.object({
|
|
1639
|
+
sync: z.number(),
|
|
1640
|
+
count: z.number(),
|
|
1641
|
+
data: z.array(openOrderParser)
|
|
1642
|
+
});
|
|
1643
|
+
const getOrderHistoryParser = z.object({
|
|
1644
|
+
account: z.string(),
|
|
1645
|
+
symbol: z.string().optional(),
|
|
1646
|
+
offset: createOffset(0),
|
|
1647
|
+
limit: createLimit(100, 250),
|
|
1648
|
+
ordinal_order_ids: ordinalOrderIdsParser,
|
|
1649
|
+
trx_id: z.string().optional(),
|
|
1650
|
+
status: z.string().optional()
|
|
1651
|
+
});
|
|
1652
|
+
const getOrderHistoryResponseParser = z.object({
|
|
1653
|
+
sync: z.number(),
|
|
1654
|
+
count: z.number(),
|
|
1655
|
+
data: z.array(orderHistoryParser)
|
|
1656
|
+
});
|
|
1657
|
+
const getOrderLifecycleParser = z.object({
|
|
1658
|
+
order_id: z.string().optional(),
|
|
1659
|
+
ordinal_order_id: z.string().optional()
|
|
1660
|
+
});
|
|
1661
|
+
const getOrderLifecycleResponseParser = z.object({
|
|
1662
|
+
sync: z.number(),
|
|
1663
|
+
data: z.array(orderHistoryParser)
|
|
1664
|
+
});
|
|
1665
|
+
/**
|
|
1666
|
+
* Submit Order
|
|
1667
|
+
*/
|
|
1668
|
+
const postSubmitOrderParser = z.object({
|
|
1669
|
+
serialized_tx_hex: z.string(),
|
|
1670
|
+
signatures: z.array(z.string())
|
|
1671
|
+
});
|
|
1672
|
+
const postSubmitOrderResponseParser = z.object({
|
|
1673
|
+
sync: z.number(),
|
|
1674
|
+
data: z.object({
|
|
1675
|
+
trx_id: z.string(),
|
|
1676
|
+
block_time: z.string(),
|
|
1677
|
+
orders: z.array(z.object({
|
|
1678
|
+
ordinal_order_id: z.string(),
|
|
1679
|
+
order_id: z.string(),
|
|
1680
|
+
status: z.string()
|
|
1681
|
+
}))
|
|
1682
|
+
})
|
|
1683
|
+
});
|
|
1684
|
+
/**
|
|
1685
|
+
* Serialize Order
|
|
1686
|
+
*/
|
|
1687
|
+
const postSerializeOrderParser = z.object({ transaction: z.object({ actions: z.array(z.object({
|
|
1688
|
+
account: z.string(),
|
|
1689
|
+
name: z.string(),
|
|
1690
|
+
authorization: z.array(authorizationParser),
|
|
1691
|
+
data: z.record(z.string(), z.any())
|
|
1692
|
+
})) }) });
|
|
1693
|
+
const postSerializeOrderResponseParser = z.object({ data: z.object({
|
|
1694
|
+
serialized_tx_hex: z.string(),
|
|
1695
|
+
digest_hex: z.string()
|
|
1696
|
+
}) });
|
|
1697
|
+
/**
|
|
1698
|
+
* Depth
|
|
1699
|
+
*/
|
|
1700
|
+
const depthParser = z.object({
|
|
1701
|
+
level: z.number(),
|
|
1702
|
+
ask: z.number(),
|
|
1703
|
+
bid: z.number(),
|
|
1704
|
+
count: z.number()
|
|
1705
|
+
});
|
|
1706
|
+
const getDepthParser = z.object({
|
|
1707
|
+
symbol: z.string(),
|
|
1708
|
+
step: z.coerce.number(),
|
|
1709
|
+
limit: createLimit(100, 250)
|
|
1710
|
+
});
|
|
1711
|
+
const getDepthResponseParser = z.object({
|
|
1712
|
+
sync: z.number(),
|
|
1713
|
+
data: z.object({
|
|
1714
|
+
bids: z.array(depthParser),
|
|
1715
|
+
asks: z.array(depthParser)
|
|
1716
|
+
})
|
|
1717
|
+
});
|
|
1718
|
+
/**
|
|
1719
|
+
* Daily
|
|
1720
|
+
*/
|
|
1721
|
+
const dailyParser = z.object({
|
|
1722
|
+
market_id: z.number(),
|
|
1723
|
+
symbol: z.string(),
|
|
1724
|
+
open: z.number(),
|
|
1725
|
+
high: z.number(),
|
|
1726
|
+
low: z.number(),
|
|
1727
|
+
close: z.number(),
|
|
1728
|
+
volume_bid: z.number(),
|
|
1729
|
+
volume_ask: z.number(),
|
|
1730
|
+
change_percentage: z.number()
|
|
1731
|
+
});
|
|
1732
|
+
const getDailyResponseParser = z.object({
|
|
1733
|
+
sync: z.number(),
|
|
1734
|
+
data: z.array(dailyParser)
|
|
1735
|
+
});
|
|
1736
|
+
/**
|
|
1737
|
+
* Markets
|
|
1738
|
+
*/
|
|
1739
|
+
const marketParser = z.object({
|
|
1740
|
+
market_id: z.number(),
|
|
1741
|
+
symbol: z.string(),
|
|
1742
|
+
status_code: z.number(),
|
|
1743
|
+
type: z.string(),
|
|
1744
|
+
maker_fee: z.number(),
|
|
1745
|
+
taker_fee: z.number(),
|
|
1746
|
+
order_min: z.number(),
|
|
1747
|
+
bid_token: z.object({
|
|
1748
|
+
code: z.string(),
|
|
1749
|
+
precision: z.number(),
|
|
1750
|
+
contract: z.string(),
|
|
1751
|
+
multiplier: z.number()
|
|
1752
|
+
}),
|
|
1753
|
+
ask_token: z.object({
|
|
1754
|
+
code: z.string(),
|
|
1755
|
+
precision: z.number(),
|
|
1756
|
+
contract: z.string(),
|
|
1757
|
+
multiplier: z.number()
|
|
1758
|
+
})
|
|
1759
|
+
});
|
|
1760
|
+
const dbMarketParser = z.object({
|
|
1761
|
+
market_id: z.number(),
|
|
1762
|
+
order_min: z.string(),
|
|
1763
|
+
status_code: z.number(),
|
|
1764
|
+
ask_oracle_index: z.string(),
|
|
1765
|
+
bid_token_c: z.string(),
|
|
1766
|
+
bid_token_s: z.string(),
|
|
1767
|
+
bid_token_m: z.string(),
|
|
1768
|
+
ask_token_c: z.string(),
|
|
1769
|
+
ask_token_s: z.string(),
|
|
1770
|
+
ask_token_m: z.string(),
|
|
1771
|
+
created_at: z.date(),
|
|
1772
|
+
updated_at: z.date()
|
|
1773
|
+
});
|
|
1774
|
+
const getMarketsResponseParser = z.object({
|
|
1775
|
+
sync: z.number(),
|
|
1776
|
+
data: z.array(marketParser)
|
|
1777
|
+
});
|
|
1778
|
+
/**
|
|
1779
|
+
* Trades
|
|
1780
|
+
*/
|
|
1781
|
+
const tradeLogParser = z.object({
|
|
1782
|
+
block_num: z.string(),
|
|
1783
|
+
block_time: z.string(),
|
|
1784
|
+
trade_id: z.string(),
|
|
1785
|
+
market_id: z.number(),
|
|
1786
|
+
price: z.string(),
|
|
1787
|
+
bid_user: z.string(),
|
|
1788
|
+
bid_user_order_id: z.string(),
|
|
1789
|
+
bid_total: z.string(),
|
|
1790
|
+
bid_amount: z.string(),
|
|
1791
|
+
bid_fee: z.string(),
|
|
1792
|
+
bid_referrer: z.string(),
|
|
1793
|
+
bid_referrer_fee: z.string(),
|
|
1794
|
+
ask_user: z.string(),
|
|
1795
|
+
ask_user_order_id: z.string(),
|
|
1796
|
+
ask_total: z.string(),
|
|
1797
|
+
ask_amount: z.string(),
|
|
1798
|
+
ask_fee: z.string(),
|
|
1799
|
+
ask_referrer: z.string(),
|
|
1800
|
+
ask_referrer_fee: z.string(),
|
|
1801
|
+
order_side: z.number(),
|
|
1802
|
+
trx_id: z.string()
|
|
1803
|
+
});
|
|
1804
|
+
const tradeParser = z.object({
|
|
1805
|
+
block_num: z.string(),
|
|
1806
|
+
block_time: z.string(),
|
|
1807
|
+
trade_id: z.string(),
|
|
1808
|
+
market_id: z.number(),
|
|
1809
|
+
price: z.number(),
|
|
1810
|
+
bid_user: z.string(),
|
|
1811
|
+
bid_user_order_id: z.string(),
|
|
1812
|
+
bid_user_ordinal_order_id: z.string(),
|
|
1813
|
+
bid_total: z.number(),
|
|
1814
|
+
bid_amount: z.number(),
|
|
1815
|
+
bid_fee: z.number(),
|
|
1816
|
+
bid_referrer: z.string(),
|
|
1817
|
+
bid_referrer_fee: z.number(),
|
|
1818
|
+
ask_user: z.string(),
|
|
1819
|
+
ask_user_order_id: z.string(),
|
|
1820
|
+
ask_user_ordinal_order_id: z.string(),
|
|
1821
|
+
ask_total: z.number(),
|
|
1822
|
+
ask_amount: z.number(),
|
|
1823
|
+
ask_fee: z.number(),
|
|
1824
|
+
ask_referrer: z.string(),
|
|
1825
|
+
ask_referrer_fee: z.number(),
|
|
1826
|
+
order_side: z.number(),
|
|
1827
|
+
trx_id: z.string()
|
|
1828
|
+
});
|
|
1829
|
+
const getTradesParser = z.object({
|
|
1830
|
+
symbol: z.string(),
|
|
1831
|
+
offset: createOffset(0),
|
|
1832
|
+
limit: createLimit(100, 250)
|
|
1833
|
+
});
|
|
1834
|
+
const getTradesResponseParser = z.object({
|
|
1835
|
+
sync: z.number(),
|
|
1836
|
+
data: z.array(tradeParser)
|
|
1837
|
+
});
|
|
1838
|
+
const getTradeHistoryParser = z.object({
|
|
1839
|
+
account: z.string(),
|
|
1840
|
+
symbol: z.string().optional(),
|
|
1841
|
+
offset: createOffset(0),
|
|
1842
|
+
ordinal_order_ids: ordinalOrderIdsParser,
|
|
1843
|
+
limit: createLimit(100, 250)
|
|
1844
|
+
});
|
|
1845
|
+
const getTradeHistoryResponseParser = z.object({
|
|
1846
|
+
sync: z.number(),
|
|
1847
|
+
count: z.number(),
|
|
1848
|
+
data: z.array(tradeParser)
|
|
1849
|
+
});
|
|
1850
|
+
/**
|
|
1851
|
+
* SYNC
|
|
1852
|
+
*/
|
|
1853
|
+
const syncParser = z.object({
|
|
1854
|
+
sourceid: z.number(),
|
|
1855
|
+
block_num: z.string(),
|
|
1856
|
+
block_time: z.string(),
|
|
1857
|
+
irreversible: z.string(),
|
|
1858
|
+
is_master: z.number(),
|
|
1859
|
+
last_updated: z.string()
|
|
1860
|
+
});
|
|
1861
|
+
const getSyncResponseParser = z.object({
|
|
1862
|
+
dbSecondsBehind: z.number(),
|
|
1863
|
+
chronicleSecondsBehind: z.number(),
|
|
1864
|
+
maxSecondsBehind: z.number()
|
|
1865
|
+
});
|
|
1866
|
+
/**
|
|
1867
|
+
* Referral Totals
|
|
1868
|
+
*/
|
|
1869
|
+
const refferalTotalParser = z.object({
|
|
1870
|
+
referrer: z.string(),
|
|
1871
|
+
market_id: z.number(),
|
|
1872
|
+
bid_fee: z.number(),
|
|
1873
|
+
bid_total: z.number(),
|
|
1874
|
+
ask_fee: z.number(),
|
|
1875
|
+
ask_total: z.number()
|
|
1876
|
+
});
|
|
1877
|
+
const getReferralTotalsParser = z.object({ referrer: z.string() });
|
|
1878
|
+
const getReferralTotalsResponseParser = z.object({
|
|
1879
|
+
sync: z.number(),
|
|
1880
|
+
data: z.array(refferalTotalParser)
|
|
1881
|
+
});
|
|
1882
|
+
/**
|
|
1883
|
+
* Referrals
|
|
1884
|
+
*/
|
|
1885
|
+
const refferalParser = z.object({ referred_user: z.string() });
|
|
1886
|
+
const getReferralsParser = z.object({ referrer: z.string() });
|
|
1887
|
+
const getReferralsResponseParser = z.object({
|
|
1888
|
+
sync: z.number(),
|
|
1889
|
+
data: z.array(refferalParser)
|
|
1890
|
+
});
|
|
1891
|
+
/**
|
|
1892
|
+
* Leaderboard
|
|
1893
|
+
*/
|
|
1894
|
+
const leaderboardParser = z.object({
|
|
1895
|
+
user: z.string(),
|
|
1896
|
+
total: z.number()
|
|
1897
|
+
});
|
|
1898
|
+
const getLeaderboardParser = z.object({
|
|
1899
|
+
market_ids: marketIdsParser,
|
|
1900
|
+
from: z.string(),
|
|
1901
|
+
to: z.string(),
|
|
1902
|
+
exclude_zero_fee: booleanParamSchema.prefault("true")
|
|
1903
|
+
});
|
|
1904
|
+
const getLeaderboardResponseParser = z.object({
|
|
1905
|
+
sync: z.number(),
|
|
1906
|
+
data: z.array(leaderboardParser)
|
|
1907
|
+
});
|
|
1908
|
+
/**
|
|
1909
|
+
* History Transaction
|
|
1910
|
+
*/
|
|
1911
|
+
const historyPartialParser = z.object({
|
|
1912
|
+
expiration: z.object({ utc_seconds: z.string() }),
|
|
1913
|
+
ref_block_num: z.string(),
|
|
1914
|
+
ref_block_prefix: z.string(),
|
|
1915
|
+
max_net_usage_words: z.string(),
|
|
1916
|
+
max_cpu_usage_ms: z.string(),
|
|
1917
|
+
delay_sec: z.string(),
|
|
1918
|
+
transaction_extensions: z.array(z.unknown()),
|
|
1919
|
+
signatures: z.array(z.string()),
|
|
1920
|
+
context_free_data: z.array(z.unknown())
|
|
1921
|
+
});
|
|
1922
|
+
const actParser = z.object({
|
|
1923
|
+
account: z.string(),
|
|
1924
|
+
name: z.string(),
|
|
1925
|
+
authorization: z.array(authorizationParser),
|
|
1926
|
+
data: z.any()
|
|
1927
|
+
});
|
|
1928
|
+
const receiptParser = z.object({
|
|
1929
|
+
receiver: z.string(),
|
|
1930
|
+
act_digest: z.string(),
|
|
1931
|
+
global_sequence: z.string(),
|
|
1932
|
+
recv_sequence: z.string(),
|
|
1933
|
+
auth_sequence: z.array(z.object({
|
|
1934
|
+
account: z.string(),
|
|
1935
|
+
sequence: z.string()
|
|
1936
|
+
})),
|
|
1937
|
+
code_sequence: z.string(),
|
|
1938
|
+
abi_sequence: z.string()
|
|
1939
|
+
});
|
|
1940
|
+
const actionTraceParser = z.object({
|
|
1941
|
+
action_ordinal: z.string(),
|
|
1942
|
+
creator_action_ordinal: z.string(),
|
|
1943
|
+
receipt: receiptParser,
|
|
1944
|
+
receiver: z.string(),
|
|
1945
|
+
act: actParser,
|
|
1946
|
+
context_free: z.string(),
|
|
1947
|
+
elapsed: z.string(),
|
|
1948
|
+
console: z.string(),
|
|
1949
|
+
account_ram_deltas: z.array(accountRamDeltaParser),
|
|
1950
|
+
except: z.string(),
|
|
1951
|
+
error_code: z.string().nullable(),
|
|
1952
|
+
return_value: z.string()
|
|
1953
|
+
});
|
|
1954
|
+
const traceParser = z.object({
|
|
1955
|
+
id: z.string(),
|
|
1956
|
+
status: z.string(),
|
|
1957
|
+
cpu_usage_us: z.string(),
|
|
1958
|
+
net_usage_words: z.string(),
|
|
1959
|
+
elapsed: z.string(),
|
|
1960
|
+
net_usage: z.string(),
|
|
1961
|
+
scheduled: z.string(),
|
|
1962
|
+
action_traces: z.array(actionTraceParser),
|
|
1963
|
+
account_ram_delta: z.array(accountRamDeltaParser).nullable(),
|
|
1964
|
+
except: z.string(),
|
|
1965
|
+
error_code: z.string().nullable(),
|
|
1966
|
+
failed_dtrx_trace: z.array(z.unknown()),
|
|
1967
|
+
partial: historyPartialParser
|
|
1968
|
+
});
|
|
1969
|
+
const historyTransactionParser = z.object({
|
|
1970
|
+
seq: z.string(),
|
|
1971
|
+
block_num: z.string(),
|
|
1972
|
+
block_time: z.string(),
|
|
1973
|
+
trx_id: z.string(),
|
|
1974
|
+
trace: z.object({
|
|
1975
|
+
block_num: z.string(),
|
|
1976
|
+
block_timestamp: z.string(),
|
|
1977
|
+
trace: traceParser
|
|
1978
|
+
}),
|
|
1979
|
+
irreversible: z.boolean()
|
|
1980
|
+
});
|
|
1981
|
+
const getHistoryTransactionResponseParser = z.object({ data: historyTransactionParser.nullable() });
|
|
1982
|
+
const chronicleTransactionParser = z.object({
|
|
1983
|
+
block_num: z.string(),
|
|
1984
|
+
block_timestamp: z.string(),
|
|
1985
|
+
trace: traceParser
|
|
1986
|
+
});
|
|
1987
|
+
const dbHistoryTransactionParser = z.object({
|
|
1988
|
+
seq: z.string(),
|
|
1989
|
+
block_num: z.string(),
|
|
1990
|
+
block_time: z.string(),
|
|
1991
|
+
trx_id: z.string(),
|
|
1992
|
+
trace: z.any()
|
|
1993
|
+
});
|
|
1994
|
+
/**
|
|
1995
|
+
* History Actions
|
|
1996
|
+
*/
|
|
1997
|
+
const getHistoryActionsParser = z.object({
|
|
1998
|
+
account: z.string().min(1, { error: "account is required" }),
|
|
1999
|
+
contract_filters: contractFiltersParser,
|
|
2000
|
+
account_seq_from: z.string().optional(),
|
|
2001
|
+
account_seq_to: z.string().optional(),
|
|
2002
|
+
date_from: z.string().optional(),
|
|
2003
|
+
date_to: z.string().optional(),
|
|
2004
|
+
direction: sortDirectionEnum.optional(),
|
|
2005
|
+
limit: createLimit(100, 250)
|
|
2006
|
+
});
|
|
2007
|
+
const historyActionParser = z.object({
|
|
2008
|
+
block_num: z.number(),
|
|
2009
|
+
block_time: z.string(),
|
|
2010
|
+
trx_id: z.string(),
|
|
2011
|
+
account_action_seq: z.number(),
|
|
2012
|
+
global_action_seq: z.number(),
|
|
2013
|
+
action_trace: actionTraceParser,
|
|
2014
|
+
irreversible: z.boolean()
|
|
2015
|
+
});
|
|
2016
|
+
const getHistoryActionsResponseParser = z.object({
|
|
2017
|
+
sync: z.number(),
|
|
2018
|
+
last_irreversible_block_num: z.number(),
|
|
2019
|
+
data: z.array(historyActionParser)
|
|
2020
|
+
});
|
|
2021
|
+
/**
|
|
2022
|
+
* History transfers
|
|
2023
|
+
*/
|
|
2024
|
+
const getHistoryTransfersParser = z.object({
|
|
2025
|
+
transfer_from: z.string().optional(),
|
|
2026
|
+
transfer_to: z.string().optional(),
|
|
2027
|
+
contract: z.string().optional(),
|
|
2028
|
+
symbol: z.string().optional(),
|
|
2029
|
+
amount_precision: z.string().optional(),
|
|
2030
|
+
amount_min: z.string().optional(),
|
|
2031
|
+
amount_max: z.string().optional(),
|
|
2032
|
+
date_from: z.string().optional(),
|
|
2033
|
+
date_to: z.string().optional(),
|
|
2034
|
+
global_seq_from: z.string().optional(),
|
|
2035
|
+
global_seq_to: z.string().optional(),
|
|
2036
|
+
direction: sortDirectionEnum.optional(),
|
|
2037
|
+
limit: createLimit(100, 250)
|
|
2038
|
+
});
|
|
2039
|
+
const historyTransferParser = z.object({
|
|
2040
|
+
block_num: z.number(),
|
|
2041
|
+
block_time: z.string(),
|
|
2042
|
+
trx_id: z.string(),
|
|
2043
|
+
account_action_seq: z.number(),
|
|
2044
|
+
global_action_seq: z.number(),
|
|
2045
|
+
action_trace: actionTraceParser,
|
|
2046
|
+
irreversible: z.boolean()
|
|
2047
|
+
});
|
|
2048
|
+
const getHistoryTransfersResponseParser = z.object({
|
|
2049
|
+
sync: z.number(),
|
|
2050
|
+
last_irreversible_block_num: z.number(),
|
|
2051
|
+
data: z.array(historyTransferParser)
|
|
2052
|
+
});
|
|
2053
|
+
/**
|
|
2054
|
+
* Open orders Balances
|
|
2055
|
+
*/
|
|
2056
|
+
const marketOpenOrdersBalanceParser = z.object({
|
|
2057
|
+
market_id: z.number(),
|
|
2058
|
+
bid_token_quantity: z.number(),
|
|
2059
|
+
bid_token: z.string(),
|
|
2060
|
+
ask_token_quantity: z.number(),
|
|
2061
|
+
ask_token: z.string()
|
|
2062
|
+
});
|
|
2063
|
+
const getOpenOrdersBalancesResponseParser = z.object({
|
|
2064
|
+
sync: z.number(),
|
|
2065
|
+
data: z.array(marketOpenOrdersBalanceParser)
|
|
2066
|
+
});
|
|
2067
|
+
/**
|
|
2068
|
+
* Basic Types
|
|
2069
|
+
*/
|
|
2070
|
+
let orderType = /* @__PURE__ */ function(orderType) {
|
|
2071
|
+
orderType[orderType["ORDERBOOK"] = 0] = "ORDERBOOK";
|
|
2072
|
+
orderType[orderType["LIMIT"] = 1] = "LIMIT";
|
|
2073
|
+
orderType[orderType["STOPLOSS"] = 2] = "STOPLOSS";
|
|
2074
|
+
orderType[orderType["TAKEPROFIT"] = 3] = "TAKEPROFIT";
|
|
2075
|
+
return orderType;
|
|
2076
|
+
}({});
|
|
2077
|
+
let orderSide = /* @__PURE__ */ function(orderSide) {
|
|
2078
|
+
orderSide[orderSide["INVALID"] = 0] = "INVALID";
|
|
2079
|
+
orderSide[orderSide["BUY"] = 1] = "BUY";
|
|
2080
|
+
orderSide[orderSide["SELL"] = 2] = "SELL";
|
|
2081
|
+
return orderSide;
|
|
2082
|
+
}({});
|
|
2083
|
+
let fillType = /* @__PURE__ */ function(fillType) {
|
|
2084
|
+
fillType[fillType["GTC"] = 0] = "GTC";
|
|
2085
|
+
fillType[fillType["IOC"] = 1] = "IOC";
|
|
2086
|
+
fillType[fillType["POST_ONLY"] = 2] = "POST_ONLY";
|
|
2087
|
+
return fillType;
|
|
2088
|
+
}({});
|
|
2089
|
+
let logStatus = /* @__PURE__ */ function(logStatus) {
|
|
2090
|
+
logStatus["CREATE"] = "create";
|
|
2091
|
+
logStatus["UPDATE"] = "update";
|
|
2092
|
+
logStatus["TRANSFER"] = "transfer";
|
|
2093
|
+
logStatus["CANCEL"] = "cancel";
|
|
2094
|
+
logStatus["DELETE"] = "delete";
|
|
2095
|
+
return logStatus;
|
|
2096
|
+
}({});
|
|
2097
|
+
let ITopics = /* @__PURE__ */ function(ITopics) {
|
|
2098
|
+
ITopics["TRADES"] = "TRADES";
|
|
2099
|
+
ITopics["ORDERS"] = "ORDERS";
|
|
2100
|
+
return ITopics;
|
|
2101
|
+
}({});
|
|
2102
|
+
const TOPICS = {
|
|
2103
|
+
["TRADES"]: { topic: "TRADES" },
|
|
2104
|
+
["ORDERS"]: { topic: "ORDERS" }
|
|
2465
2105
|
};
|
|
2466
|
-
|
|
2467
2106
|
// src/parsers/login.ts
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
}).merge(generateAuthParser);
|
|
2473
|
-
|
|
2107
|
+
const loginAccountParamsV3Parser = generateAuthParser.extend({
|
|
2108
|
+
email: z.string().optional(),
|
|
2109
|
+
verificationCode: z.string().optional()
|
|
2110
|
+
});
|
|
2474
2111
|
// src/utils.ts
|
|
2475
|
-
|
|
2476
|
-
|
|
2112
|
+
const isSameToken = (token1, token2) => {
|
|
2113
|
+
return token1.xtokenSymbol === token2.xtokenSymbol && token1.xtokenPrecision === token2.xtokenPrecision && token1.xtokenContract === token2.xtokenContract;
|
|
2477
2114
|
};
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
}
|
|
2484
|
-
return sorted[middle];
|
|
2115
|
+
const median = (numbers) => {
|
|
2116
|
+
const sorted = numbers.slice().sort((a, b) => a - b);
|
|
2117
|
+
const middle = Math.floor(sorted.length / 2);
|
|
2118
|
+
if (sorted.length % 2 === 0) return (sorted[middle - 1] + sorted[middle]) / 2;
|
|
2119
|
+
return sorted[middle];
|
|
2485
2120
|
};
|
|
2486
|
-
|
|
2487
2121
|
// src/graph.ts
|
|
2488
|
-
import cloneDeep from "lodash.clonedeep";
|
|
2489
2122
|
var INode = class {
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
}
|
|
2496
|
-
key;
|
|
2497
|
-
data = {};
|
|
2123
|
+
constructor(key, data) {
|
|
2124
|
+
this.key = key;
|
|
2125
|
+
this.data = {};
|
|
2126
|
+
if (data) this.data = data;
|
|
2127
|
+
}
|
|
2498
2128
|
};
|
|
2499
2129
|
var ILink = class {
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
}
|
|
2507
|
-
from;
|
|
2508
|
-
to;
|
|
2509
|
-
data = {};
|
|
2130
|
+
constructor(from, to, data) {
|
|
2131
|
+
this.from = from;
|
|
2132
|
+
this.to = to;
|
|
2133
|
+
this.data = {};
|
|
2134
|
+
if (data) this.data = data;
|
|
2135
|
+
}
|
|
2510
2136
|
};
|
|
2511
2137
|
var Graph = class {
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
seen = new Set(path.map((p) => p.key));
|
|
2583
|
-
if (stuck(x)) {
|
|
2584
|
-
return;
|
|
2585
|
-
}
|
|
2586
|
-
for (const y of this.findLinkedNodes(x)) {
|
|
2587
|
-
if (!path.includes(y)) {
|
|
2588
|
-
path.push(y);
|
|
2589
|
-
search(y);
|
|
2590
|
-
path.pop();
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
};
|
|
2594
|
-
search(fromNode);
|
|
2595
|
-
return allPaths;
|
|
2596
|
-
}
|
|
2138
|
+
constructor() {
|
|
2139
|
+
this.nodes = [];
|
|
2140
|
+
this.links = [];
|
|
2141
|
+
this.lastPathFound = [];
|
|
2142
|
+
this.isEquals = (a, b) => a.key === b.key;
|
|
2143
|
+
}
|
|
2144
|
+
addNode(k, v) {
|
|
2145
|
+
if (!this.findNode(k)) this.nodes.push(new INode(k, v));
|
|
2146
|
+
}
|
|
2147
|
+
addNodes(...nodes) {
|
|
2148
|
+
nodes.forEach((node) => typeof node === "string" ? this.addNode(node) : this.addNode(node[0], node[1]));
|
|
2149
|
+
}
|
|
2150
|
+
findNode(k) {
|
|
2151
|
+
const inode = new INode(k);
|
|
2152
|
+
return this.nodes.find((node) => this.isEquals(node, inode));
|
|
2153
|
+
}
|
|
2154
|
+
findNodes(...keys) {
|
|
2155
|
+
return keys.map((k) => this.findNode(k));
|
|
2156
|
+
}
|
|
2157
|
+
requireFindNodes(...keys) {
|
|
2158
|
+
const nodes = this.findNodes(...keys);
|
|
2159
|
+
if (nodes.some((n) => n === void 0)) throw new Error("One of the nodes does not exist");
|
|
2160
|
+
return nodes;
|
|
2161
|
+
}
|
|
2162
|
+
addLink(nodeA, nodeB, data) {
|
|
2163
|
+
const [inodeA, inodeB] = this.requireFindNodes(nodeA, nodeB);
|
|
2164
|
+
this.links.push(new ILink(inodeA, inodeB, data));
|
|
2165
|
+
}
|
|
2166
|
+
addLinks(...links) {
|
|
2167
|
+
links.forEach((link) => this.addLink(...link));
|
|
2168
|
+
}
|
|
2169
|
+
/**
|
|
2170
|
+
* Get all nodes linked
|
|
2171
|
+
* to from `node`.
|
|
2172
|
+
*/
|
|
2173
|
+
findLinkedNodes(node) {
|
|
2174
|
+
return this.links.reduce((acc, link) => {
|
|
2175
|
+
if (this.isEquals(link.from, node)) acc.push(link.to);
|
|
2176
|
+
return acc;
|
|
2177
|
+
}, []);
|
|
2178
|
+
}
|
|
2179
|
+
findAllPaths(from, to) {
|
|
2180
|
+
const allPaths = [];
|
|
2181
|
+
const [fromNode, toNode] = this.requireFindNodes(from, to);
|
|
2182
|
+
const path = [fromNode];
|
|
2183
|
+
let seen = /* @__PURE__ */ new Set();
|
|
2184
|
+
const stuck = (x) => {
|
|
2185
|
+
if (this.isEquals(x, toNode)) return false;
|
|
2186
|
+
for (const y of this.findLinkedNodes(x)) if (!seen.has(y.key)) {
|
|
2187
|
+
seen.add(y.key);
|
|
2188
|
+
if (!stuck(y)) return false;
|
|
2189
|
+
}
|
|
2190
|
+
return true;
|
|
2191
|
+
};
|
|
2192
|
+
const search = (x) => {
|
|
2193
|
+
if (this.isEquals(x, toNode)) {
|
|
2194
|
+
allPaths.push(cloneDeep(path));
|
|
2195
|
+
return;
|
|
2196
|
+
}
|
|
2197
|
+
seen = new Set(path.map((p) => p.key));
|
|
2198
|
+
if (stuck(x)) return;
|
|
2199
|
+
for (const y of this.findLinkedNodes(x)) if (!path.includes(y)) {
|
|
2200
|
+
path.push(y);
|
|
2201
|
+
search(y);
|
|
2202
|
+
path.pop();
|
|
2203
|
+
}
|
|
2204
|
+
};
|
|
2205
|
+
search(fromNode);
|
|
2206
|
+
return allPaths;
|
|
2207
|
+
}
|
|
2597
2208
|
};
|
|
2598
|
-
|
|
2599
2209
|
// src/math.ts
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
exchange_fee,
|
|
2618
|
-
precision
|
|
2619
|
-
);
|
|
2620
|
-
}
|
|
2621
|
-
const MAX_ITERATIONS = 10;
|
|
2622
|
-
const sum = reserve_in + reserve_out;
|
|
2623
|
-
let D = sum;
|
|
2624
|
-
let D_prev = 0;
|
|
2625
|
-
const F = (v) => {
|
|
2626
|
-
return (v >= 0 ? 1 : -1) * Math.floor(Math.abs(v));
|
|
2627
|
-
};
|
|
2628
|
-
let i = MAX_ITERATIONS;
|
|
2629
|
-
while (D != D_prev && i--) {
|
|
2630
|
-
const prod1 = F(F(D * D / (reserve_in * 2)) * D / (reserve_out * 2));
|
|
2631
|
-
D_prev = D;
|
|
2632
|
-
D = F(
|
|
2633
|
-
2 * D * (amplifier * sum + prod1) / ((2 * amplifier - 1) * D + 3 * prod1)
|
|
2634
|
-
);
|
|
2635
|
-
}
|
|
2636
|
-
const b = reserve_in + amount_in + F(D / (amplifier * 2)) - D;
|
|
2637
|
-
const c = F(
|
|
2638
|
-
F(D * D / ((reserve_in + amount_in) * 2)) * D / (amplifier * 4)
|
|
2639
|
-
);
|
|
2640
|
-
let x = D, x_prev = 0;
|
|
2641
|
-
i = MAX_ITERATIONS;
|
|
2642
|
-
while (x != x_prev && i--) {
|
|
2643
|
-
x_prev = F(x);
|
|
2644
|
-
x = +new BN(x * x + c).div(2 * x + b).toFixed(0, BN.ROUND_DOWN);
|
|
2645
|
-
}
|
|
2646
|
-
if (reserve_out <= x) {
|
|
2647
|
-
throw new Error("curve: insufficient reserve out");
|
|
2648
|
-
}
|
|
2649
|
-
const amount_out_with_fee = new BN(reserve_out - x);
|
|
2650
|
-
const fee = amount_out_with_fee.times(exchange_fee).div(FEE_FACTOR).plus(1).toFixed(0, BN.ROUND_DOWN);
|
|
2651
|
-
const amount_out = amount_out_with_fee.minus(fee);
|
|
2652
|
-
return amount_out.integerValue(BN.ROUND_DOWN).shiftedBy(-precision);
|
|
2210
|
+
/**
|
|
2211
|
+
* XPR<>XUSDT (XPR -> XUSDT)
|
|
2212
|
+
*
|
|
2213
|
+
* pool1 * pool2
|
|
2214
|
+
* term = pool2 - --------------
|
|
2215
|
+
* pool1 + swap
|
|
2216
|
+
*
|
|
2217
|
+
* result = term - (term * fee)
|
|
2218
|
+
*/
|
|
2219
|
+
const compute_transfer = (pool1, pool2, swap, exchange_fee, precision) => {
|
|
2220
|
+
const term1 = pool2;
|
|
2221
|
+
const term2over = pool1.times(pool2);
|
|
2222
|
+
const term2under = pool1.plus(swap);
|
|
2223
|
+
const term2 = term2over.div(term2under).integerValue(BN.ROUND_DOWN);
|
|
2224
|
+
const term = term1.minus(term2);
|
|
2225
|
+
const fee = new BN(exchange_fee).div(FEE_FACTOR);
|
|
2226
|
+
return term.minus(term.times(fee)).integerValue(BN.ROUND_DOWN).shiftedBy(-precision);
|
|
2653
2227
|
};
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2228
|
+
const compute_transfer_curve = (reserve_in, reserve_out, amount_in, exchange_fee, precision, amplifier) => {
|
|
2229
|
+
if (amplifier === 0) return compute_transfer(new BN(reserve_in), new BN(reserve_out), new BN(amount_in), exchange_fee, precision);
|
|
2230
|
+
const MAX_ITERATIONS = 10;
|
|
2231
|
+
const sum = reserve_in + reserve_out;
|
|
2232
|
+
let D = sum;
|
|
2233
|
+
let D_prev = 0;
|
|
2234
|
+
const F = (v) => {
|
|
2235
|
+
return (v >= 0 ? 1 : -1) * Math.floor(Math.abs(v));
|
|
2236
|
+
};
|
|
2237
|
+
let i = MAX_ITERATIONS;
|
|
2238
|
+
while (D != D_prev && i--) {
|
|
2239
|
+
const prod1 = F(F(D * D / (reserve_in * 2)) * D / (reserve_out * 2));
|
|
2240
|
+
D_prev = D;
|
|
2241
|
+
D = F(2 * D * (amplifier * sum + prod1) / ((2 * amplifier - 1) * D + 3 * prod1));
|
|
2242
|
+
}
|
|
2243
|
+
const b = reserve_in + amount_in + F(D / (amplifier * 2)) - D;
|
|
2244
|
+
const c = F(F(D * D / ((reserve_in + amount_in) * 2)) * D / (amplifier * 4));
|
|
2245
|
+
let x = D, x_prev = 0;
|
|
2246
|
+
i = MAX_ITERATIONS;
|
|
2247
|
+
while (x != x_prev && i--) {
|
|
2248
|
+
x_prev = F(x);
|
|
2249
|
+
x = +new BN(x * x + c).div(2 * x + b).toFixed(0, BN.ROUND_DOWN);
|
|
2250
|
+
}
|
|
2251
|
+
if (reserve_out <= x) throw new Error("curve: insufficient reserve out");
|
|
2252
|
+
const amount_out_with_fee = new BN(reserve_out - x);
|
|
2253
|
+
const fee = amount_out_with_fee.times(exchange_fee).div(FEE_FACTOR).plus(1).toFixed(0, BN.ROUND_DOWN);
|
|
2254
|
+
return amount_out_with_fee.minus(fee).integerValue(BN.ROUND_DOWN).shiftedBy(-precision);
|
|
2659
2255
|
};
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
const isDoubleDot = data === "." && value.indexOf(".") !== value.length - 1;
|
|
2665
|
-
const isPrecisionTooHigh = value && value.indexOf(".") !== -1 && value.split(".")[1].length > pool.xtokenPrecision;
|
|
2666
|
-
const isInvalid = !isBackspace && Boolean(isNumber || isDoubleDot || isPrecisionTooHigh);
|
|
2667
|
-
return isInvalid;
|
|
2256
|
+
const compute_liquidity = (amount_lt, pool, lt_supply, precision) => {
|
|
2257
|
+
const over = amount_lt.times(pool);
|
|
2258
|
+
const under = lt_supply;
|
|
2259
|
+
return +over.div(under).integerValue(BN.ROUND_DOWN).shiftedBy(-precision).toFixed(precision, BN.ROUND_DOWN);
|
|
2668
2260
|
};
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
} else {
|
|
2677
|
-
return fee;
|
|
2678
|
-
}
|
|
2261
|
+
const isInputInvalid = (data, value, pool) => {
|
|
2262
|
+
value = String(value);
|
|
2263
|
+
const isBackspace = data === null;
|
|
2264
|
+
const isNumber = !/[0-9]|\./.test(data);
|
|
2265
|
+
const isDoubleDot = data === "." && value.indexOf(".") !== value.length - 1;
|
|
2266
|
+
const isPrecisionTooHigh = value && value.indexOf(".") !== -1 && value.split(".")[1].length > pool.xtokenPrecision;
|
|
2267
|
+
return !isBackspace && Boolean(isNumber || isDoubleDot || isPrecisionTooHigh);
|
|
2679
2268
|
};
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
ILink,
|
|
2686
|
-
INode,
|
|
2687
|
-
ITopics,
|
|
2688
|
-
Networks,
|
|
2689
|
-
Providers,
|
|
2690
|
-
Status,
|
|
2691
|
-
TOPICS,
|
|
2692
|
-
Type,
|
|
2693
|
-
WRAP_AUTH_ACTION,
|
|
2694
|
-
WRAP_CONTRACT,
|
|
2695
|
-
accountParser,
|
|
2696
|
-
accountRamDeltaParser,
|
|
2697
|
-
actParser,
|
|
2698
|
-
actionTraceParser,
|
|
2699
|
-
addressParser,
|
|
2700
|
-
applyDiscountToFee,
|
|
2701
|
-
authorizationParser,
|
|
2702
|
-
authorizationsParser,
|
|
2703
|
-
baseActionParser,
|
|
2704
|
-
baseActionSerializedParser,
|
|
2705
|
-
bloksRatesParser,
|
|
2706
|
-
chronicleTransactionParser,
|
|
2707
|
-
compute_liquidity,
|
|
2708
|
-
compute_transfer,
|
|
2709
|
-
compute_transfer_curve,
|
|
2710
|
-
createAbstractAuthParser,
|
|
2711
|
-
dailyParser,
|
|
2712
|
-
dbHistoryTransactionParser,
|
|
2713
|
-
dbMarketParser,
|
|
2714
|
-
depositBodyParser,
|
|
2715
|
-
depthParser,
|
|
2716
|
-
exchangeRateParser,
|
|
2717
|
-
exchangeRatesParser,
|
|
2718
|
-
explorerLinkByChain,
|
|
2719
|
-
fillType,
|
|
2720
|
-
generateAddressBodyParser,
|
|
2721
|
-
generateAddressResponse,
|
|
2722
|
-
generateAuthParser,
|
|
2723
|
-
getDailyResponseParser,
|
|
2724
|
-
getDepthParser,
|
|
2725
|
-
getDepthResponseParser,
|
|
2726
|
-
getHistoryActionsParser,
|
|
2727
|
-
getHistoryActionsResponseParser,
|
|
2728
|
-
getHistoryTransactionResponseParser,
|
|
2729
|
-
getHistoryTransfersParser,
|
|
2730
|
-
getHistoryTransfersResponseParser,
|
|
2731
|
-
getLeaderboardParser,
|
|
2732
|
-
getLeaderboardResponseParser,
|
|
2733
|
-
getMarketsResponseParser,
|
|
2734
|
-
getOhlcvParser,
|
|
2735
|
-
getOhlcvResponseParser,
|
|
2736
|
-
getOpenOrdersBalancesResponseParser,
|
|
2737
|
-
getOpenOrdersParser,
|
|
2738
|
-
getOpenOrdersResponseParser,
|
|
2739
|
-
getOrderHistoryParser,
|
|
2740
|
-
getOrderHistoryResponseParser,
|
|
2741
|
-
getOrderLifecycleParser,
|
|
2742
|
-
getOrderLifecycleResponseParser,
|
|
2743
|
-
getReferralTotalsParser,
|
|
2744
|
-
getReferralTotalsResponseParser,
|
|
2745
|
-
getReferralsParser,
|
|
2746
|
-
getReferralsResponseParser,
|
|
2747
|
-
getSyncResponseParser,
|
|
2748
|
-
getTradeHistoryParser,
|
|
2749
|
-
getTradeHistoryResponseParser,
|
|
2750
|
-
getTradesParser,
|
|
2751
|
-
getTradesResponseParser,
|
|
2752
|
-
historyActionParser,
|
|
2753
|
-
historyPartialParser,
|
|
2754
|
-
historyTransactionParser,
|
|
2755
|
-
historyTransferParser,
|
|
2756
|
-
initializeCoins,
|
|
2757
|
-
initializeConstants,
|
|
2758
|
-
isInputInvalid,
|
|
2759
|
-
isSameToken,
|
|
2760
|
-
leaderboardParser,
|
|
2761
|
-
logStatus,
|
|
2762
|
-
loginAccountParamsV3Parser,
|
|
2763
|
-
marketOpenOrdersBalanceParser,
|
|
2764
|
-
marketParser,
|
|
2765
|
-
median,
|
|
2766
|
-
metalTransactionParser,
|
|
2767
|
-
ohlcvParser,
|
|
2768
|
-
openOrderParser,
|
|
2769
|
-
orderHistoryParser,
|
|
2770
|
-
orderLogParser,
|
|
2771
|
-
orderSide,
|
|
2772
|
-
orderType,
|
|
2773
|
-
otcOrderResponseParser,
|
|
2774
|
-
otcQuoteBodyParser,
|
|
2775
|
-
otcQuoteResponseParser,
|
|
2776
|
-
postSerializeOrderParser,
|
|
2777
|
-
postSerializeOrderResponseParser,
|
|
2778
|
-
postSubmitOrderParser,
|
|
2779
|
-
postSubmitOrderResponseParser,
|
|
2780
|
-
protonExplorerTxUrl,
|
|
2781
|
-
rateParser,
|
|
2782
|
-
receiptParser,
|
|
2783
|
-
refferalParser,
|
|
2784
|
-
refferalTotalParser,
|
|
2785
|
-
similarChains,
|
|
2786
|
-
singleActionTransactionParser,
|
|
2787
|
-
sortDirectionEnum,
|
|
2788
|
-
syncParser,
|
|
2789
|
-
traceParser,
|
|
2790
|
-
tradeLogParser,
|
|
2791
|
-
tradeParser,
|
|
2792
|
-
webauthActionParser,
|
|
2793
|
-
withdrawBodyParser,
|
|
2794
|
-
withdrawHistoryMetalResponseParser,
|
|
2795
|
-
withdrawHistoryMetalSwapParser,
|
|
2796
|
-
withdrawMetalResponseParser,
|
|
2797
|
-
withdrawalFeeQuoteParser,
|
|
2798
|
-
wrapParser,
|
|
2799
|
-
wrapSetConfParser,
|
|
2800
|
-
wrapStartParser
|
|
2269
|
+
const applyDiscountToFee = (fee, staked) => {
|
|
2270
|
+
if (staked >= 1e7) return fee * 0;
|
|
2271
|
+
else if (staked >= 1e6) return fee * .33;
|
|
2272
|
+
else if (staked >= 1e5) return fee * .66;
|
|
2273
|
+
else return fee;
|
|
2801
2274
|
};
|
|
2275
|
+
export { Chains, ExtendedAssetParser, FEE_FACTOR, Graph, ILink, INode, ITopics, Networks, Providers, Status, TOPICS, Type, WRAP_AUTH_ACTION, WRAP_CONTRACT, accountParser, accountRamDeltaParser, actParser, actionTraceParser, addressParser, applyDiscountToFee, authorizationParser, authorizationsParser, baseActionParser, baseActionSerializedParser, bloksRatesParser, chronicleTransactionParser, compute_liquidity, compute_transfer, compute_transfer_curve, createAbstractAuthParser, dailyParser, dbHistoryTransactionParser, dbMarketParser, depositBodyParser, depthParser, exchangeRateParser, exchangeRatesParser, explorerLinkByChain, fillType, generateAddressBodyParser, generateAddressResponse, generateAuthActionsBaseParser, generateAuthParser, getDailyResponseParser, getDepthParser, getDepthResponseParser, getHistoryActionsParser, getHistoryActionsResponseParser, getHistoryTransactionResponseParser, getHistoryTransfersParser, getHistoryTransfersResponseParser, getLeaderboardParser, getLeaderboardResponseParser, getMarketsResponseParser, getOhlcvParser, getOhlcvResponseParser, getOpenOrdersBalancesResponseParser, getOpenOrdersParser, getOpenOrdersResponseParser, getOrderHistoryParser, getOrderHistoryResponseParser, getOrderLifecycleParser, getOrderLifecycleResponseParser, getReferralTotalsParser, getReferralTotalsResponseParser, getReferralsParser, getReferralsResponseParser, getSyncResponseParser, getTradeHistoryParser, getTradeHistoryResponseParser, getTradesParser, getTradesResponseParser, historyActionParser, historyPartialParser, historyTransactionParser, historyTransferParser, initializeCoins, initializeConstants, isInputInvalid, isSameToken, leaderboardParser, logStatus, loginAccountParamsV3Parser, marketOpenOrdersBalanceParser, marketParser, median, metalTransactionParser, ohlcvParser, openOrderParser, orderHistoryParser, orderLogParser, orderSide, orderType, otcOrderResponseParser, otcQuoteBodyParser, otcQuoteResponseParser, postSerializeOrderParser, postSerializeOrderResponseParser, postSubmitOrderParser, postSubmitOrderResponseParser, protonExplorerTxUrl, rateParser, receiptParser, refferalParser, refferalTotalParser, similarChains, singleActionTransactionParser, sortDirectionEnum, syncParser, traceParser, tradeLogParser, tradeParser, webauthActionParser, withdrawBodyBaseAction, withdrawBodyParser, withdrawHistoryMetalResponseParser, withdrawHistoryMetalSwapParser, withdrawMetalResponseParser, withdrawalFeeQuoteParser, wrapParser, wrapSetConfParser, wrapStartParser };
|