@proton/wrap-constants 0.2.80 → 0.2.82

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.js CHANGED
@@ -1485,7 +1485,15 @@ var WRAP_CONTRACT = "proton.wrap";
1485
1485
  var WRAP_AUTH_ACTION = "generateauth";
1486
1486
  var FEE_FACTOR = 1e4;
1487
1487
  var initializeConstants = (chain) => {
1488
- const { swapCoins, bridgeCoins, allEnabledCoins, allCoins, lendCoins, borrowCoins, loanCoins } = initializeCoins(chain);
1488
+ const {
1489
+ swapCoins,
1490
+ bridgeCoins,
1491
+ allEnabledCoins,
1492
+ allCoins,
1493
+ lendCoins,
1494
+ borrowCoins,
1495
+ loanCoins
1496
+ } = initializeCoins(chain);
1489
1497
  const constants = {
1490
1498
  SWAP_CONTRACT: "proton.swaps",
1491
1499
  DEX_CONTRACT: "dex",
@@ -1525,7 +1533,16 @@ var initializeConstants = (chain) => {
1525
1533
  METAL_PROTON_ENDPOINT: chain === "proton" ? "https://api.protonchain.com" : "https://api-dev.protonchain.com",
1526
1534
  METAL_DEX_HTTP_ENDPOINT: chain === "proton" ? "https://metal-dexdb.global.binfra.one/dex" : "https://metallicus-dbapi-dev01.binfra.one/dex",
1527
1535
  METAL_DEX_WS_ENDPOINT: chain === "proton" ? "wss://metal-dexdb.global.binfra.one/dexws" : "wss://metallicus-dbapi-dev01.binfra.one/dexws",
1528
- PROTON_ENDPOINTS: chain === "proton" ? ["https://metal-proton-rpc.global.binfra.one", "https://proton.greymass.com", "https://proton.eoscafeblock.com", "https://proton.cryptolions.io", "https://proton.eosusa.news"] : ["https://metal-protontest-rpc.global.binfra.one", "https://testnet.protonchain.com"],
1536
+ PROTON_ENDPOINTS: chain === "proton" ? [
1537
+ "https://metal-proton-rpc.global.binfra.one",
1538
+ "https://proton.greymass.com",
1539
+ "https://proton.eoscafeblock.com",
1540
+ "https://proton.cryptolions.io",
1541
+ "https://proton.eosusa.news"
1542
+ ] : [
1543
+ "https://metal-protontest-rpc.global.binfra.one",
1544
+ "https://testnet.protonchain.com"
1545
+ ],
1529
1546
  CHAIN_ID: chain === "proton" ? "384da888112027f0321850a169f737c33e53b388aad48b5adace4bab97f437e0" : "71ee83bcf52142d61019d95f9cc5427ba6a0d7ff8accd9e2088ae2abeaf3d3dd",
1530
1547
  DEX_PROCESS_SIZE: 30,
1531
1548
  DEX_SLTPPROCESS_SIZE: 10,
@@ -1546,10 +1563,14 @@ var initializeConstants = (chain) => {
1546
1563
  XMD_SYMBOL_CODE: "XMD",
1547
1564
  XMD_DECIMALS: 6,
1548
1565
  findBridgeCoinWalletByXtokenAndChain(xtokenSymbol, chain2) {
1549
- const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin2) => bridgeCoin2.xtokenSymbol === xtokenSymbol);
1566
+ const bridgeCoin = constants.BRIDGE_COINS.find(
1567
+ (bridgeCoin2) => bridgeCoin2.xtokenSymbol === xtokenSymbol
1568
+ );
1550
1569
  if (!bridgeCoin)
1551
1570
  return void 0;
1552
- const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet2) => bridgeWallet2.chain === chain2);
1571
+ const bridgeWallet = bridgeCoin.wallets.find(
1572
+ (bridgeWallet2) => bridgeWallet2.chain === chain2
1573
+ );
1553
1574
  if (!bridgeWallet)
1554
1575
  return void 0;
1555
1576
  return {
@@ -1558,10 +1579,14 @@ var initializeConstants = (chain) => {
1558
1579
  };
1559
1580
  },
1560
1581
  findBridgeCoinWallet(coin, wallet) {
1561
- const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin2) => bridgeCoin2.coin === coin);
1582
+ const bridgeCoin = constants.BRIDGE_COINS.find(
1583
+ (bridgeCoin2) => bridgeCoin2.coin === coin
1584
+ );
1562
1585
  if (!bridgeCoin)
1563
1586
  return void 0;
1564
- const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet2) => bridgeWallet2.wallet === wallet);
1587
+ const bridgeWallet = bridgeCoin.wallets.find(
1588
+ (bridgeWallet2) => bridgeWallet2.wallet === wallet
1589
+ );
1565
1590
  if (!bridgeWallet)
1566
1591
  return void 0;
1567
1592
  return {
@@ -1570,10 +1595,14 @@ var initializeConstants = (chain) => {
1570
1595
  };
1571
1596
  },
1572
1597
  findBridgeCoinNetwork(coin, network) {
1573
- const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin2) => bridgeCoin2.coin === coin);
1598
+ const bridgeCoin = constants.BRIDGE_COINS.find(
1599
+ (bridgeCoin2) => bridgeCoin2.coin === coin
1600
+ );
1574
1601
  if (!bridgeCoin)
1575
1602
  return void 0;
1576
- const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet2) => bridgeWallet2.network === network);
1603
+ const bridgeWallet = bridgeCoin.wallets.find(
1604
+ (bridgeWallet2) => bridgeWallet2.network === network
1605
+ );
1577
1606
  if (!bridgeWallet)
1578
1607
  return void 0;
1579
1608
  return {
@@ -1822,10 +1851,9 @@ var getOhlcvResponseParser = z11.object({
1822
1851
  data: z11.array(ohlcvParser)
1823
1852
  });
1824
1853
  var orderHistoryParser = z11.object({
1825
- seq: z11.number(),
1826
- block_num: z11.number(),
1854
+ block_num: z11.string(),
1827
1855
  block_time: z11.string(),
1828
- order_id: z11.number(),
1856
+ order_id: z11.string(),
1829
1857
  market_id: z11.number(),
1830
1858
  quantity_init: z11.number().optional(),
1831
1859
  quantity_curr: z11.number(),
@@ -1837,10 +1865,11 @@ var orderHistoryParser = z11.object({
1837
1865
  fill_type: z11.number(),
1838
1866
  status: z11.string(),
1839
1867
  quantity_change: z11.number(),
1840
- trx_id: z11.string(),
1841
1868
  filled_total: z11.number().optional(),
1842
1869
  filled_amount: z11.number().optional(),
1843
- filled_fee: z11.number().optional()
1870
+ filled_fee: z11.number().optional(),
1871
+ seq: z11.string(),
1872
+ trx_id: z11.string()
1844
1873
  });
1845
1874
  var getOpenOrdersParser = z11.object({
1846
1875
  account: z11.string(),
@@ -1904,13 +1933,14 @@ var getDepthResponseParser = z11.object({
1904
1933
  });
1905
1934
  var dailyParser = z11.object({
1906
1935
  market_id: z11.number(),
1907
- first: z11.number(),
1908
- last: z11.number(),
1909
- bid: z11.number(),
1910
- ask: z11.number(),
1911
- change_percentage_24hr: z11.number(),
1936
+ symbol: z11.string(),
1937
+ open: z11.number(),
1912
1938
  high: z11.number(),
1913
- low: z11.number()
1939
+ low: z11.number(),
1940
+ close: z11.number(),
1941
+ volume_bid: z11.number(),
1942
+ volume_ask: z11.number(),
1943
+ change_percentage: z11.number()
1914
1944
  });
1915
1945
  var getDailyResponseParser = z11.object({
1916
1946
  sync: z11.number(),
@@ -1942,18 +1972,18 @@ var getMarketsResponseParser = z11.object({
1942
1972
  data: z11.array(marketParser)
1943
1973
  });
1944
1974
  var tradeParser = z11.object({
1945
- block_num: z11.number(),
1975
+ block_num: z11.string(),
1946
1976
  block_time: z11.string(),
1947
- trade_id: z11.number(),
1977
+ trade_id: z11.string(),
1948
1978
  market_id: z11.number(),
1949
1979
  price: z11.number(),
1950
1980
  bid_user: z11.string(),
1951
- bid_user_order_id: z11.number(),
1981
+ bid_user_order_id: z11.string(),
1952
1982
  bid_total: z11.number(),
1953
1983
  bid_amount: z11.number(),
1954
1984
  bid_fee: z11.number(),
1955
1985
  ask_user: z11.string(),
1956
- ask_user_order_id: z11.number(),
1986
+ ask_user_order_id: z11.string(),
1957
1987
  ask_total: z11.number(),
1958
1988
  ask_amount: z11.number(),
1959
1989
  ask_fee: z11.number(),
package/dist/index.mjs CHANGED
@@ -1355,7 +1355,15 @@ var WRAP_CONTRACT = "proton.wrap";
1355
1355
  var WRAP_AUTH_ACTION = "generateauth";
1356
1356
  var FEE_FACTOR = 1e4;
1357
1357
  var initializeConstants = (chain) => {
1358
- const { swapCoins, bridgeCoins, allEnabledCoins, allCoins, lendCoins, borrowCoins, loanCoins } = initializeCoins(chain);
1358
+ const {
1359
+ swapCoins,
1360
+ bridgeCoins,
1361
+ allEnabledCoins,
1362
+ allCoins,
1363
+ lendCoins,
1364
+ borrowCoins,
1365
+ loanCoins
1366
+ } = initializeCoins(chain);
1359
1367
  const constants = {
1360
1368
  SWAP_CONTRACT: "proton.swaps",
1361
1369
  DEX_CONTRACT: "dex",
@@ -1395,7 +1403,16 @@ var initializeConstants = (chain) => {
1395
1403
  METAL_PROTON_ENDPOINT: chain === "proton" ? "https://api.protonchain.com" : "https://api-dev.protonchain.com",
1396
1404
  METAL_DEX_HTTP_ENDPOINT: chain === "proton" ? "https://metal-dexdb.global.binfra.one/dex" : "https://metallicus-dbapi-dev01.binfra.one/dex",
1397
1405
  METAL_DEX_WS_ENDPOINT: chain === "proton" ? "wss://metal-dexdb.global.binfra.one/dexws" : "wss://metallicus-dbapi-dev01.binfra.one/dexws",
1398
- PROTON_ENDPOINTS: chain === "proton" ? ["https://metal-proton-rpc.global.binfra.one", "https://proton.greymass.com", "https://proton.eoscafeblock.com", "https://proton.cryptolions.io", "https://proton.eosusa.news"] : ["https://metal-protontest-rpc.global.binfra.one", "https://testnet.protonchain.com"],
1406
+ PROTON_ENDPOINTS: chain === "proton" ? [
1407
+ "https://metal-proton-rpc.global.binfra.one",
1408
+ "https://proton.greymass.com",
1409
+ "https://proton.eoscafeblock.com",
1410
+ "https://proton.cryptolions.io",
1411
+ "https://proton.eosusa.news"
1412
+ ] : [
1413
+ "https://metal-protontest-rpc.global.binfra.one",
1414
+ "https://testnet.protonchain.com"
1415
+ ],
1399
1416
  CHAIN_ID: chain === "proton" ? "384da888112027f0321850a169f737c33e53b388aad48b5adace4bab97f437e0" : "71ee83bcf52142d61019d95f9cc5427ba6a0d7ff8accd9e2088ae2abeaf3d3dd",
1400
1417
  DEX_PROCESS_SIZE: 30,
1401
1418
  DEX_SLTPPROCESS_SIZE: 10,
@@ -1416,10 +1433,14 @@ var initializeConstants = (chain) => {
1416
1433
  XMD_SYMBOL_CODE: "XMD",
1417
1434
  XMD_DECIMALS: 6,
1418
1435
  findBridgeCoinWalletByXtokenAndChain(xtokenSymbol, chain2) {
1419
- const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin2) => bridgeCoin2.xtokenSymbol === xtokenSymbol);
1436
+ const bridgeCoin = constants.BRIDGE_COINS.find(
1437
+ (bridgeCoin2) => bridgeCoin2.xtokenSymbol === xtokenSymbol
1438
+ );
1420
1439
  if (!bridgeCoin)
1421
1440
  return void 0;
1422
- const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet2) => bridgeWallet2.chain === chain2);
1441
+ const bridgeWallet = bridgeCoin.wallets.find(
1442
+ (bridgeWallet2) => bridgeWallet2.chain === chain2
1443
+ );
1423
1444
  if (!bridgeWallet)
1424
1445
  return void 0;
1425
1446
  return {
@@ -1428,10 +1449,14 @@ var initializeConstants = (chain) => {
1428
1449
  };
1429
1450
  },
1430
1451
  findBridgeCoinWallet(coin, wallet) {
1431
- const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin2) => bridgeCoin2.coin === coin);
1452
+ const bridgeCoin = constants.BRIDGE_COINS.find(
1453
+ (bridgeCoin2) => bridgeCoin2.coin === coin
1454
+ );
1432
1455
  if (!bridgeCoin)
1433
1456
  return void 0;
1434
- const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet2) => bridgeWallet2.wallet === wallet);
1457
+ const bridgeWallet = bridgeCoin.wallets.find(
1458
+ (bridgeWallet2) => bridgeWallet2.wallet === wallet
1459
+ );
1435
1460
  if (!bridgeWallet)
1436
1461
  return void 0;
1437
1462
  return {
@@ -1440,10 +1465,14 @@ var initializeConstants = (chain) => {
1440
1465
  };
1441
1466
  },
1442
1467
  findBridgeCoinNetwork(coin, network) {
1443
- const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin2) => bridgeCoin2.coin === coin);
1468
+ const bridgeCoin = constants.BRIDGE_COINS.find(
1469
+ (bridgeCoin2) => bridgeCoin2.coin === coin
1470
+ );
1444
1471
  if (!bridgeCoin)
1445
1472
  return void 0;
1446
- const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet2) => bridgeWallet2.network === network);
1473
+ const bridgeWallet = bridgeCoin.wallets.find(
1474
+ (bridgeWallet2) => bridgeWallet2.network === network
1475
+ );
1447
1476
  if (!bridgeWallet)
1448
1477
  return void 0;
1449
1478
  return {
@@ -1692,10 +1721,9 @@ var getOhlcvResponseParser = z11.object({
1692
1721
  data: z11.array(ohlcvParser)
1693
1722
  });
1694
1723
  var orderHistoryParser = z11.object({
1695
- seq: z11.number(),
1696
- block_num: z11.number(),
1724
+ block_num: z11.string(),
1697
1725
  block_time: z11.string(),
1698
- order_id: z11.number(),
1726
+ order_id: z11.string(),
1699
1727
  market_id: z11.number(),
1700
1728
  quantity_init: z11.number().optional(),
1701
1729
  quantity_curr: z11.number(),
@@ -1707,10 +1735,11 @@ var orderHistoryParser = z11.object({
1707
1735
  fill_type: z11.number(),
1708
1736
  status: z11.string(),
1709
1737
  quantity_change: z11.number(),
1710
- trx_id: z11.string(),
1711
1738
  filled_total: z11.number().optional(),
1712
1739
  filled_amount: z11.number().optional(),
1713
- filled_fee: z11.number().optional()
1740
+ filled_fee: z11.number().optional(),
1741
+ seq: z11.string(),
1742
+ trx_id: z11.string()
1714
1743
  });
1715
1744
  var getOpenOrdersParser = z11.object({
1716
1745
  account: z11.string(),
@@ -1774,13 +1803,14 @@ var getDepthResponseParser = z11.object({
1774
1803
  });
1775
1804
  var dailyParser = z11.object({
1776
1805
  market_id: z11.number(),
1777
- first: z11.number(),
1778
- last: z11.number(),
1779
- bid: z11.number(),
1780
- ask: z11.number(),
1781
- change_percentage_24hr: z11.number(),
1806
+ symbol: z11.string(),
1807
+ open: z11.number(),
1782
1808
  high: z11.number(),
1783
- low: z11.number()
1809
+ low: z11.number(),
1810
+ close: z11.number(),
1811
+ volume_bid: z11.number(),
1812
+ volume_ask: z11.number(),
1813
+ change_percentage: z11.number()
1784
1814
  });
1785
1815
  var getDailyResponseParser = z11.object({
1786
1816
  sync: z11.number(),
@@ -1812,18 +1842,18 @@ var getMarketsResponseParser = z11.object({
1812
1842
  data: z11.array(marketParser)
1813
1843
  });
1814
1844
  var tradeParser = z11.object({
1815
- block_num: z11.number(),
1845
+ block_num: z11.string(),
1816
1846
  block_time: z11.string(),
1817
- trade_id: z11.number(),
1847
+ trade_id: z11.string(),
1818
1848
  market_id: z11.number(),
1819
1849
  price: z11.number(),
1820
1850
  bid_user: z11.string(),
1821
- bid_user_order_id: z11.number(),
1851
+ bid_user_order_id: z11.string(),
1822
1852
  bid_total: z11.number(),
1823
1853
  bid_amount: z11.number(),
1824
1854
  bid_fee: z11.number(),
1825
1855
  ask_user: z11.string(),
1826
- ask_user_order_id: z11.number(),
1856
+ ask_user_order_id: z11.string(),
1827
1857
  ask_total: z11.number(),
1828
1858
  ask_amount: z11.number(),
1829
1859
  ask_fee: z11.number(),
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "0.2.80",
8
+ "version": "0.2.82",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.js",
11
11
  "typings": "dist/index.d.ts",
@@ -40,5 +40,5 @@
40
40
  "resolutions": {
41
41
  "typescript": "4.5"
42
42
  },
43
- "gitHead": "65986292a2f413dab3a16dbccf784f6436892829"
43
+ "gitHead": "f6b4f7a143424a86f9273f318b0a8bf4b7646972"
44
44
  }
package/src/constants.ts CHANGED
@@ -1,139 +1,180 @@
1
- import { Coin, CoinWallet, initializeCoins, Wallet } from './coins'
1
+ import { Coin, CoinWallet, initializeCoins, Wallet } from "./coins";
2
2
 
3
- export const WRAP_CONTRACT = 'proton.wrap'
4
- export const WRAP_AUTH_ACTION = 'generateauth'
5
- export const FEE_FACTOR = 10000
3
+ export const WRAP_CONTRACT = "proton.wrap";
4
+ export const WRAP_AUTH_ACTION = "generateauth";
5
+ export const FEE_FACTOR = 10000;
6
6
 
7
7
  export const initializeConstants = (chain: string) => {
8
- const { swapCoins, bridgeCoins, allEnabledCoins, allCoins, lendCoins, borrowCoins, loanCoins } = initializeCoins(chain)
9
-
10
- const constants = {
11
- SWAP_CONTRACT: 'proton.swaps',
12
- DEX_CONTRACT: 'dex',
13
- FEE_FACTOR,
14
- GOOGLE_MAPS_KEY: 'AIzaSyDb2_CrK032kSIqBXbkdwmaLKWELl0SxVs',
15
- SWAP_URL: chain === 'proton'
16
- ? 'https://otc.protonswap.com'
17
- : 'https://otc-test.protonswap.com',
18
- WRAP_SERVER_URL: chain === 'proton'
19
- ? 'https://www.api.bloks.io/proton-wrap-public2'
20
- : 'https://www.api.bloks.io/proton-wrap-testnet-public2',
21
- WRAP_CONTRACT,
22
- WRAP_ACTIONS: {
23
- SAVE_ADDRESS: 'saveaddress2',
24
- DELETE_ADDRESS: 'deladdress2',
25
- WRAP_START: 'wrapstart2',
26
- WRAP_FINISH: 'wrapfinish2',
27
- WRAP_PROCESS: 'wrapprocess2',
28
- WRAP_SET_CONF: 'wrapsetconf2',
29
- },
30
- WRAP_TABLES: {
31
- ADDRESSES: 'addresses2',
32
- WRAPS: 'wraps2'
33
- },
34
- ADDRESSES_INDEXES: {
35
- BY_ACCOUNT: 2,
36
- BY_ADDR_HASH: 3
37
- },
38
- WRAPS_INDEXES: {
39
- BY_ACCOUNT: 2,
40
- BY_STATUS: 3,
41
- BY_WRAP_HASH: 4
42
- },
43
- WRAP_PROCESS_TIMER: 5000,
44
-
45
- FARM_CONTRACT: 'yield.farms',
46
-
47
- WEBHOOK_PERMISSION: 'webhook',
48
- PUBLIC_PERMISSION: 'public',
49
- LIGHT_PERMISSION: 'light',
50
- WRAP_AUTH_ACTION: WRAP_AUTH_ACTION,
51
-
52
- METAL_ENDPOINT: chain === 'proton'
53
- ? 'https://cirrus.metalpay.com'
54
- : 'https://cirrus-dev.metalpay.com',
55
-
56
- METAL_PROTON_ENDPOINT: chain === 'proton'
57
- ? 'https://api.protonchain.com'
58
- : 'https://api-dev.protonchain.com',
59
-
60
- METAL_DEX_HTTP_ENDPOINT: chain === 'proton'
61
- ? 'https://metal-dexdb.global.binfra.one/dex'
62
- : 'https://metallicus-dbapi-dev01.binfra.one/dex',
63
-
64
- METAL_DEX_WS_ENDPOINT: chain === 'proton'
65
- ? 'wss://metal-dexdb.global.binfra.one/dexws'
66
- : 'wss://metallicus-dbapi-dev01.binfra.one/dexws',
67
-
68
- PROTON_ENDPOINTS: chain === 'proton'
69
- ? ['https://metal-proton-rpc.global.binfra.one', 'https://proton.greymass.com', 'https://proton.eoscafeblock.com', 'https://proton.cryptolions.io', 'https://proton.eosusa.news']
70
- : ['https://metal-protontest-rpc.global.binfra.one', 'https://testnet.protonchain.com'],
71
-
72
- CHAIN_ID: chain === 'proton'
73
- ? '384da888112027f0321850a169f737c33e53b388aad48b5adace4bab97f437e0'
74
- : '71ee83bcf52142d61019d95f9cc5427ba6a0d7ff8accd9e2088ae2abeaf3d3dd',
75
-
76
- DEX_PROCESS_SIZE: 30,
77
- DEX_SLTPPROCESS_SIZE: 10,
78
- MAX_PRICE: "9223372036854775806",
79
- MAX_ITEMS_PER_PAGE_DESKTOP: 25,
80
- MIN_PRICE: 1,
81
- DEFAULT_DEX_SYMBOL: chain === 'proton'
82
- ? 'XPR_XMD'
83
- : 'XPR_XUSDC',
84
-
85
- CHAIN: chain,
86
-
87
- SWAP_COINS: swapCoins,
88
- BRIDGE_COINS: bridgeCoins,
89
- ALL_ENABLED_COINS: allEnabledCoins,
90
- LEND_COINS: lendCoins,
91
- BORROW_COINS: borrowCoins,
92
- LOAN_COINS: loanCoins,
93
- ALL_COINS: allCoins,
94
-
95
- XMD_CONTRACT: 'xmd.treasury',
96
- XMD_TOKEN_CONTRACT: 'xmd.token',
97
- XMD_SYMBOL_CODE: 'XMD',
98
- XMD_DECIMALS: 6,
99
-
100
- findBridgeCoinWalletByXtokenAndChain (xtokenSymbol: string, chain: string): CoinWallet | undefined {
101
- const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin: Coin) => bridgeCoin.xtokenSymbol === xtokenSymbol)
102
- if (!bridgeCoin) return undefined
103
- const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet: Wallet) => bridgeWallet.chain === chain)
104
- if (!bridgeWallet) return undefined
105
-
106
- return {
107
- ...bridgeCoin,
108
- ...bridgeWallet
109
- }
110
- },
111
-
112
- findBridgeCoinWallet (coin: string, wallet: string): CoinWallet | undefined {
113
- const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin: Coin) => bridgeCoin.coin === coin)
114
- if (!bridgeCoin) return undefined
115
-
116
- const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet: Wallet) => bridgeWallet.wallet === wallet)
117
- if (!bridgeWallet) return undefined
118
-
119
- return {
120
- ...bridgeCoin,
121
- ...bridgeWallet
122
- }
123
- },
124
-
125
- findBridgeCoinNetwork (coin: string, network: string): CoinWallet | undefined {
126
- const bridgeCoin = constants.BRIDGE_COINS.find((bridgeCoin: Coin) => bridgeCoin.coin === coin)
127
- if (!bridgeCoin) return undefined
128
- const bridgeWallet = bridgeCoin.wallets.find((bridgeWallet: Wallet) => bridgeWallet.network === network)
129
- if (!bridgeWallet) return undefined
130
-
131
- return {
132
- ...bridgeCoin,
133
- ...bridgeWallet
134
- }
135
- }
136
- }
137
-
138
- return constants
139
- }
8
+ const {
9
+ swapCoins,
10
+ bridgeCoins,
11
+ allEnabledCoins,
12
+ allCoins,
13
+ lendCoins,
14
+ borrowCoins,
15
+ loanCoins,
16
+ } = initializeCoins(chain);
17
+
18
+ const constants = {
19
+ SWAP_CONTRACT: "proton.swaps",
20
+ DEX_CONTRACT: "dex",
21
+ FEE_FACTOR,
22
+ GOOGLE_MAPS_KEY: "AIzaSyDb2_CrK032kSIqBXbkdwmaLKWELl0SxVs",
23
+ SWAP_URL:
24
+ chain === "proton"
25
+ ? "https://otc.protonswap.com"
26
+ : "https://otc-test.protonswap.com",
27
+ WRAP_SERVER_URL:
28
+ chain === "proton"
29
+ ? "https://www.api.bloks.io/proton-wrap-public2"
30
+ : "https://www.api.bloks.io/proton-wrap-testnet-public2",
31
+ WRAP_CONTRACT,
32
+ WRAP_ACTIONS: {
33
+ SAVE_ADDRESS: "saveaddress2",
34
+ DELETE_ADDRESS: "deladdress2",
35
+ WRAP_START: "wrapstart2",
36
+ WRAP_FINISH: "wrapfinish2",
37
+ WRAP_PROCESS: "wrapprocess2",
38
+ WRAP_SET_CONF: "wrapsetconf2",
39
+ },
40
+ WRAP_TABLES: {
41
+ ADDRESSES: "addresses2",
42
+ WRAPS: "wraps2",
43
+ },
44
+ ADDRESSES_INDEXES: {
45
+ BY_ACCOUNT: 2,
46
+ BY_ADDR_HASH: 3,
47
+ },
48
+ WRAPS_INDEXES: {
49
+ BY_ACCOUNT: 2,
50
+ BY_STATUS: 3,
51
+ BY_WRAP_HASH: 4,
52
+ },
53
+ WRAP_PROCESS_TIMER: 5000,
54
+
55
+ FARM_CONTRACT: "yield.farms",
56
+
57
+ WEBHOOK_PERMISSION: "webhook",
58
+ PUBLIC_PERMISSION: "public",
59
+ LIGHT_PERMISSION: "light",
60
+ WRAP_AUTH_ACTION: WRAP_AUTH_ACTION,
61
+
62
+ METAL_ENDPOINT:
63
+ chain === "proton"
64
+ ? "https://cirrus.metalpay.com"
65
+ : "https://cirrus-dev.metalpay.com",
66
+
67
+ METAL_PROTON_ENDPOINT:
68
+ chain === "proton"
69
+ ? "https://api.protonchain.com"
70
+ : "https://api-dev.protonchain.com",
71
+
72
+ METAL_DEX_HTTP_ENDPOINT:
73
+ chain === "proton"
74
+ ? "https://metal-dexdb.global.binfra.one/dex"
75
+ : "https://metallicus-dbapi-dev01.binfra.one/dex",
76
+
77
+ METAL_DEX_WS_ENDPOINT:
78
+ chain === "proton"
79
+ ? "wss://metal-dexdb.global.binfra.one/dexws"
80
+ : "wss://metallicus-dbapi-dev01.binfra.one/dexws",
81
+
82
+ PROTON_ENDPOINTS:
83
+ chain === "proton"
84
+ ? [
85
+ "https://metal-proton-rpc.global.binfra.one",
86
+ "https://proton.greymass.com",
87
+ "https://proton.eoscafeblock.com",
88
+ "https://proton.cryptolions.io",
89
+ "https://proton.eosusa.news",
90
+ ]
91
+ : [
92
+ "https://metal-protontest-rpc.global.binfra.one",
93
+ "https://testnet.protonchain.com",
94
+ ],
95
+
96
+ CHAIN_ID:
97
+ chain === "proton"
98
+ ? "384da888112027f0321850a169f737c33e53b388aad48b5adace4bab97f437e0"
99
+ : "71ee83bcf52142d61019d95f9cc5427ba6a0d7ff8accd9e2088ae2abeaf3d3dd",
100
+
101
+ DEX_PROCESS_SIZE: 30,
102
+ DEX_SLTPPROCESS_SIZE: 10,
103
+ MAX_PRICE: "9223372036854775806",
104
+ MAX_ITEMS_PER_PAGE_DESKTOP: 25,
105
+ MIN_PRICE: 1,
106
+ DEFAULT_DEX_SYMBOL: chain === "proton" ? "XPR_XMD" : "XPR_XUSDC",
107
+
108
+ CHAIN: chain,
109
+
110
+ SWAP_COINS: swapCoins,
111
+ BRIDGE_COINS: bridgeCoins,
112
+ ALL_ENABLED_COINS: allEnabledCoins,
113
+ LEND_COINS: lendCoins,
114
+ BORROW_COINS: borrowCoins,
115
+ LOAN_COINS: loanCoins,
116
+ ALL_COINS: allCoins,
117
+
118
+ XMD_CONTRACT: "xmd.treasury",
119
+ XMD_TOKEN_CONTRACT: "xmd.token",
120
+ XMD_SYMBOL_CODE: "XMD",
121
+ XMD_DECIMALS: 6,
122
+
123
+ findBridgeCoinWalletByXtokenAndChain(
124
+ xtokenSymbol: string,
125
+ chain: string
126
+ ): CoinWallet | undefined {
127
+ const bridgeCoin = constants.BRIDGE_COINS.find(
128
+ (bridgeCoin: Coin) => bridgeCoin.xtokenSymbol === xtokenSymbol
129
+ );
130
+ if (!bridgeCoin) return undefined;
131
+ const bridgeWallet = bridgeCoin.wallets.find(
132
+ (bridgeWallet: Wallet) => bridgeWallet.chain === chain
133
+ );
134
+ if (!bridgeWallet) return undefined;
135
+
136
+ return {
137
+ ...bridgeCoin,
138
+ ...bridgeWallet,
139
+ };
140
+ },
141
+
142
+ findBridgeCoinWallet(coin: string, wallet: string): CoinWallet | undefined {
143
+ const bridgeCoin = constants.BRIDGE_COINS.find(
144
+ (bridgeCoin: Coin) => bridgeCoin.coin === coin
145
+ );
146
+ if (!bridgeCoin) return undefined;
147
+
148
+ const bridgeWallet = bridgeCoin.wallets.find(
149
+ (bridgeWallet: Wallet) => bridgeWallet.wallet === wallet
150
+ );
151
+ if (!bridgeWallet) return undefined;
152
+
153
+ return {
154
+ ...bridgeCoin,
155
+ ...bridgeWallet,
156
+ };
157
+ },
158
+
159
+ findBridgeCoinNetwork(
160
+ coin: string,
161
+ network: string
162
+ ): CoinWallet | undefined {
163
+ const bridgeCoin = constants.BRIDGE_COINS.find(
164
+ (bridgeCoin: Coin) => bridgeCoin.coin === coin
165
+ );
166
+ if (!bridgeCoin) return undefined;
167
+ const bridgeWallet = bridgeCoin.wallets.find(
168
+ (bridgeWallet: Wallet) => bridgeWallet.network === network
169
+ );
170
+ if (!bridgeWallet) return undefined;
171
+
172
+ return {
173
+ ...bridgeCoin,
174
+ ...bridgeWallet,
175
+ };
176
+ },
177
+ };
178
+
179
+ return constants;
180
+ };