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