@proton/wrap-constants 0.1.1 → 0.2.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/coins.d.ts +42 -9
- package/dist/constants.d.ts +10 -0
- package/dist/graph.d.ts +30 -0
- package/dist/index.d.ts +2 -0
- package/dist/math.d.ts +17 -0
- package/dist/parsers/actions.d.ts +1323 -0
- package/dist/parsers/address.d.ts +932 -0
- package/dist/parsers/auth.d.ts +1816 -0
- package/dist/parsers/base.d.ts +35 -0
- package/dist/parsers/currency.d.ts +236 -0
- package/dist/parsers/deposit.d.ts +63 -0
- package/dist/parsers/dex.d.ts +508 -0
- package/dist/parsers/index.d.ts +12 -0
- package/dist/parsers/otc.d.ts +46 -0
- package/dist/parsers/pool.d.ts +51 -0
- package/dist/parsers/withdraw.d.ts +1053 -0
- package/dist/parsers/withdrawalHistory.d.ts +98 -0
- package/dist/parsers/wrap.d.ts +109 -0
- package/dist/utils.d.ts +1 -0
- package/dist/wrap-constants.cjs.development.js +1325 -310
- package/dist/wrap-constants.cjs.development.js.map +1 -1
- package/dist/wrap-constants.cjs.production.min.js +1 -1
- package/dist/wrap-constants.cjs.production.min.js.map +1 -1
- package/dist/wrap-constants.esm.js +1303 -311
- package/dist/wrap-constants.esm.js.map +1 -1
- package/package.json +14 -8
- package/src/coins.ts +563 -149
- package/src/constants.ts +41 -14
- package/src/graph.ts +126 -0
- package/src/index.ts +3 -1
- package/src/math.ts +112 -0
- package/src/parsers/actions.ts +82 -0
- package/src/parsers/address.ts +27 -0
- package/src/parsers/auth.ts +22 -0
- package/src/parsers/base.ts +18 -0
- package/src/parsers/currency.ts +89 -0
- package/src/parsers/deposit.ts +30 -0
- package/src/parsers/dex.ts +167 -0
- package/src/parsers/index.ts +12 -0
- package/src/parsers/otc.ts +23 -0
- package/src/parsers/pool.ts +51 -0
- package/src/parsers/withdraw.ts +39 -0
- package/src/parsers/withdrawalHistory.ts +23 -0
- package/src/parsers/wrap.ts +41 -0
- package/src/utils.ts +12 -1
- package/dist/parsers.d.ts +0 -849
- package/dist/pools.d.ts +0 -31
- package/src/parsers.ts +0 -258
- package/src/pools.ts +0 -26
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from 'nestjs-zod/z';
|
|
2
|
+
import { createZodDto } from 'nestjs-zod';
|
|
3
|
+
import cloneDeep from 'lodash.clonedeep';
|
|
4
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
5
|
|
|
3
|
-
var _explorerLinkByChain;
|
|
6
|
+
var _similarChains, _explorerLinkByChain;
|
|
4
7
|
|
|
5
8
|
var Chains;
|
|
6
9
|
|
|
@@ -10,14 +13,28 @@ var Chains;
|
|
|
10
13
|
Chains["EthereumMainnet"] = "Ethereum";
|
|
11
14
|
Chains["EthereumRopsten"] = "Ethereum (Ropsten)";
|
|
12
15
|
Chains["LitecoinMainnet"] = "Litecoin";
|
|
16
|
+
Chains["LitecoinTestnet"] = "Litecoin (Testnet)";
|
|
13
17
|
Chains["BitcoinCashMainnet"] = "Bitcoin Cash";
|
|
18
|
+
Chains["BitcoinCashTestnet"] = "Bitcoin Cash (Testnet)";
|
|
14
19
|
Chains["StellarMainnet"] = "Stellar";
|
|
20
|
+
Chains["StellarTestnet"] = "Stellar (Testnet)";
|
|
15
21
|
Chains["ProtonMainnet"] = "Proton";
|
|
16
22
|
Chains["ProtonTestnet"] = "Proton (Testnet)";
|
|
17
23
|
Chains["PolkadotMainnet"] = "Polkadot";
|
|
18
24
|
Chains["BinanceBEP2"] = "Binance (BEP2)";
|
|
19
25
|
Chains["BinanceBEP20"] = "Binance (BEP20)";
|
|
20
26
|
Chains["EosMainnet"] = "EOS";
|
|
27
|
+
Chains["EosTestnet"] = "EOS (Jungle Testnet)";
|
|
28
|
+
Chains["HederaMainnet"] = "Hedera (Mainnet)";
|
|
29
|
+
Chains["HederaTestnet"] = "Hedera (Testnet)";
|
|
30
|
+
Chains["DogeMainnet"] = "Dogecoin";
|
|
31
|
+
Chains["CardanoMainnet"] = "Cardano";
|
|
32
|
+
Chains["AvalancheXChain"] = "Avalanche X-Chain";
|
|
33
|
+
Chains["AvalancheCChain"] = "Avalanche C-Chain";
|
|
34
|
+
Chains["PolygonMainnet"] = "Polygon";
|
|
35
|
+
Chains["TerraMainnet"] = "Terra";
|
|
36
|
+
Chains["RippleMainnet"] = "Ripple";
|
|
37
|
+
Chains["SolanaMainnet"] = "Solana";
|
|
21
38
|
})(Chains || (Chains = {}));
|
|
22
39
|
|
|
23
40
|
var Networks;
|
|
@@ -28,8 +45,10 @@ var Networks;
|
|
|
28
45
|
Networks["Ropsten"] = "ropsten";
|
|
29
46
|
Networks["ERC20"] = "erc20";
|
|
30
47
|
Networks["BEP20"] = "bep20";
|
|
48
|
+
Networks["XLM"] = "xlm";
|
|
31
49
|
})(Networks || (Networks = {}));
|
|
32
50
|
|
|
51
|
+
var similarChains = (_similarChains = {}, _similarChains[Chains.EthereumMainnet] = [Chains.BinanceBEP20], _similarChains[Chains.BinanceBEP20] = [Chains.EthereumMainnet], _similarChains);
|
|
33
52
|
var explorerLinkByChain = (_explorerLinkByChain = {}, _explorerLinkByChain[Chains.BitcoinMainnet] = function (txid) {
|
|
34
53
|
return "https://blockchain.com/btc/tx/" + txid;
|
|
35
54
|
}, _explorerLinkByChain[Chains.BitcoinTestnet] = function (txid) {
|
|
@@ -40,37 +59,69 @@ var explorerLinkByChain = (_explorerLinkByChain = {}, _explorerLinkByChain[Chain
|
|
|
40
59
|
return "https://ropsten.etherscan.io/tx/" + txid;
|
|
41
60
|
}, _explorerLinkByChain[Chains.LitecoinMainnet] = function (txid) {
|
|
42
61
|
return "https://blockchair.com/litecoin/transaction/" + txid;
|
|
62
|
+
}, _explorerLinkByChain[Chains.LitecoinTestnet] = function (txid) {
|
|
63
|
+
return "https://blockexplorer.one/litecoin/testnet/blockHash/" + txid;
|
|
43
64
|
}, _explorerLinkByChain[Chains.BitcoinCashMainnet] = function (txid) {
|
|
44
65
|
return "https://blockchair.com/bitcoin-cash/transaction/" + txid;
|
|
66
|
+
}, _explorerLinkByChain[Chains.BitcoinCashTestnet] = function (txid) {
|
|
67
|
+
return "https://blockexplorer.one/bitcoin-cash/testnet/blockHash/" + txid;
|
|
45
68
|
}, _explorerLinkByChain[Chains.StellarMainnet] = function (txid) {
|
|
46
69
|
return "https://blockchair.com/stellar/transaction/" + txid;
|
|
47
|
-
}, _explorerLinkByChain[Chains.
|
|
48
|
-
return "https://
|
|
49
|
-
}, _explorerLinkByChain[Chains.
|
|
50
|
-
return "https://proton
|
|
70
|
+
}, _explorerLinkByChain[Chains.StellarTestnet] = function (txid) {
|
|
71
|
+
return "https://testnet.steexp.com/tx/" + txid;
|
|
72
|
+
}, _explorerLinkByChain[Chains.ProtonMainnet] = function (txid, traces) {
|
|
73
|
+
return "https://proton.bloks.io/transaction/" + txid + (traces ? '?tab=traces' : '');
|
|
74
|
+
}, _explorerLinkByChain[Chains.ProtonTestnet] = function (txid, traces) {
|
|
75
|
+
return "https://proton-test.bloks.io/transaction/" + txid + (traces ? '?tab=traces' : '');
|
|
51
76
|
}, _explorerLinkByChain[Chains.PolkadotMainnet] = function (txid) {
|
|
52
77
|
return "https://polkadot.subscan.io/extrinsic/" + txid;
|
|
53
|
-
}, _explorerLinkByChain[Chains.EosMainnet] = function (txid) {
|
|
54
|
-
return "https://bloks.io/transaction/" + txid;
|
|
55
78
|
}, _explorerLinkByChain[Chains.BinanceBEP2] = function (txid) {
|
|
56
79
|
return "https://binance.mintscan.io/txs/" + txid;
|
|
57
80
|
}, _explorerLinkByChain[Chains.BinanceBEP20] = function (txid) {
|
|
58
81
|
return "https://bscscan.com/tx/" + txid;
|
|
82
|
+
}, _explorerLinkByChain[Chains.EosMainnet] = function (txid) {
|
|
83
|
+
return "https://bloks.io/transaction/" + txid;
|
|
84
|
+
}, _explorerLinkByChain[Chains.EosTestnet] = function (txid) {
|
|
85
|
+
return "https://jungle.bloks.io/transaction/" + txid;
|
|
86
|
+
}, _explorerLinkByChain[Chains.HederaMainnet] = function (txid) {
|
|
87
|
+
return "https://app.dragonglass.me/transactions/" + txid;
|
|
88
|
+
}, _explorerLinkByChain[Chains.HederaTestnet] = function (txid) {
|
|
89
|
+
return "https://testnet.dragonglass.me/transactions/" + txid;
|
|
90
|
+
}, _explorerLinkByChain[Chains.DogeMainnet] = function (txid) {
|
|
91
|
+
return "https://blockchair.com/dogecoin/transaction/" + txid;
|
|
92
|
+
}, _explorerLinkByChain[Chains.CardanoMainnet] = function (txid) {
|
|
93
|
+
return "https://explorer.cardano.org/en/transaction?id=" + txid;
|
|
94
|
+
}, _explorerLinkByChain[Chains.AvalancheXChain] = function (txid) {
|
|
95
|
+
return "https://avascan.info/blockchain/x/tx/" + txid;
|
|
96
|
+
}, _explorerLinkByChain[Chains.AvalancheCChain] = function (txid) {
|
|
97
|
+
return "https://snowtrace.io/tx/" + txid;
|
|
98
|
+
}, _explorerLinkByChain[Chains.PolygonMainnet] = function (txid) {
|
|
99
|
+
return "https://polygonscan.com/tx/" + txid;
|
|
100
|
+
}, _explorerLinkByChain[Chains.TerraMainnet] = function (txid) {
|
|
101
|
+
return "https://terra.stake.id/?#/tx/" + txid;
|
|
102
|
+
}, _explorerLinkByChain[Chains.RippleMainnet] = function (txid) {
|
|
103
|
+
return "https://xrpscan.com/tx/" + txid;
|
|
104
|
+
}, _explorerLinkByChain[Chains.SolanaMainnet] = function (txid) {
|
|
105
|
+
return "https://explorer.solana.com/tx/" + txid;
|
|
59
106
|
}, _explorerLinkByChain);
|
|
107
|
+
var protonExplorerTxUrl = function protonExplorerTxUrl(chain, txId, traces) {
|
|
108
|
+
return chain === 'proton' ? explorerLinkByChain[Chains.ProtonMainnet](txId, traces) : explorerLinkByChain[Chains.ProtonTestnet](txId, traces);
|
|
109
|
+
}; // Initialize
|
|
110
|
+
|
|
60
111
|
var initializeCoins = function initializeCoins(protonChain) {
|
|
61
112
|
var IS_MAINNET = protonChain === 'proton';
|
|
62
113
|
var IS_TESTNET = protonChain === 'proton-test';
|
|
63
114
|
var coins = [{
|
|
64
115
|
allowSwap: true,
|
|
65
|
-
allowBridge:
|
|
66
|
-
allowLend:
|
|
67
|
-
allowBorrow:
|
|
116
|
+
allowBridge: IS_MAINNET,
|
|
117
|
+
allowLend: true,
|
|
118
|
+
allowBorrow: true,
|
|
68
119
|
name: 'Proton',
|
|
69
120
|
coin: 'XPR',
|
|
70
121
|
xtokenSymbol: 'XPR',
|
|
71
122
|
xtokenPrecision: 4,
|
|
72
123
|
xtokenContract: 'eosio.token',
|
|
73
|
-
wallets: [{
|
|
124
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
74
125
|
wallet: 'XPR-ERC20',
|
|
75
126
|
symbol: 'XPR',
|
|
76
127
|
chain: Chains.EthereumMainnet,
|
|
@@ -78,7 +129,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
78
129
|
precision: 4,
|
|
79
130
|
contract: '0xD7EFB00D12C2C13131FD319336FDF952525DA2AF',
|
|
80
131
|
hasWithdrawMemo: false
|
|
81
|
-
}
|
|
132
|
+
}, {
|
|
82
133
|
wallet: 'XPR-BEP20',
|
|
83
134
|
symbol: 'XPR',
|
|
84
135
|
chain: Chains.BinanceBEP20,
|
|
@@ -87,18 +138,19 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
87
138
|
contract: '0x5DE3939B2F811A61D830E6F52D13B066881412AB',
|
|
88
139
|
hasWithdrawMemo: false
|
|
89
140
|
}] : []),
|
|
90
|
-
image: '/
|
|
141
|
+
image: 'https://www.proton.org/images/tokens/eosio-tokenXPR.png',
|
|
142
|
+
coingeckoId: 'proton'
|
|
91
143
|
}, {
|
|
92
144
|
allowSwap: true,
|
|
93
145
|
allowBridge: true,
|
|
94
|
-
allowLend:
|
|
95
|
-
allowBorrow:
|
|
146
|
+
allowLend: true,
|
|
147
|
+
allowBorrow: true,
|
|
96
148
|
name: 'USD Coin',
|
|
97
149
|
coin: 'USDC',
|
|
98
150
|
xtokenSymbol: 'XUSDC',
|
|
99
151
|
xtokenPrecision: 6,
|
|
100
152
|
xtokenContract: 'xtokens',
|
|
101
|
-
wallets: [{
|
|
153
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
102
154
|
wallet: 'USDC',
|
|
103
155
|
symbol: 'USDC',
|
|
104
156
|
chain: Chains.EthereumMainnet,
|
|
@@ -106,19 +158,52 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
106
158
|
precision: 6,
|
|
107
159
|
contract: '0xA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48',
|
|
108
160
|
hasWithdrawMemo: false
|
|
109
|
-
}
|
|
110
|
-
|
|
161
|
+
}, {
|
|
162
|
+
wallet: 'USDC-BEP20',
|
|
163
|
+
symbol: 'USDC',
|
|
164
|
+
chain: Chains.BinanceBEP20,
|
|
165
|
+
network: Networks.BEP20,
|
|
166
|
+
precision: 18,
|
|
167
|
+
contract: '0x8AC76A51CC950D9822D68B83FE1AD97B32CD580D',
|
|
168
|
+
hasWithdrawMemo: false
|
|
169
|
+
}, {
|
|
170
|
+
wallet: 'USDC-XLM',
|
|
171
|
+
symbol: 'USDC',
|
|
172
|
+
chain: Chains.StellarMainnet,
|
|
173
|
+
network: Networks.XLM,
|
|
174
|
+
precision: 7,
|
|
175
|
+
contract: undefined,
|
|
176
|
+
hasWithdrawMemo: true
|
|
177
|
+
}] : [], IS_TESTNET ? [{
|
|
178
|
+
wallet: 'USDC',
|
|
179
|
+
symbol: 'USDC',
|
|
180
|
+
chain: Chains.EthereumRopsten,
|
|
181
|
+
network: Networks.Ropsten,
|
|
182
|
+
precision: 6,
|
|
183
|
+
contract: '0xA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48',
|
|
184
|
+
hasWithdrawMemo: false
|
|
185
|
+
}, {
|
|
186
|
+
wallet: 'USDC-XLM',
|
|
187
|
+
symbol: 'USDC',
|
|
188
|
+
chain: Chains.StellarTestnet,
|
|
189
|
+
network: Networks.XLM,
|
|
190
|
+
precision: 7,
|
|
191
|
+
contract: undefined,
|
|
192
|
+
hasWithdrawMemo: true
|
|
193
|
+
}] : []),
|
|
194
|
+
image: 'https://www.proton.org/images/tokens/xtokensXUSDC.png',
|
|
195
|
+
coingeckoId: 'usd-coin'
|
|
111
196
|
}, {
|
|
112
197
|
allowSwap: true,
|
|
113
|
-
allowBridge:
|
|
114
|
-
allowLend:
|
|
115
|
-
allowBorrow:
|
|
198
|
+
allowBridge: IS_MAINNET,
|
|
199
|
+
allowLend: true,
|
|
200
|
+
allowBorrow: true,
|
|
116
201
|
name: 'Metal',
|
|
117
202
|
coin: 'MTL',
|
|
118
203
|
xtokenSymbol: 'XMT',
|
|
119
204
|
xtokenPrecision: 8,
|
|
120
205
|
xtokenContract: 'xtokens',
|
|
121
|
-
wallets: [{
|
|
206
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
122
207
|
wallet: 'MTL',
|
|
123
208
|
symbol: 'MTL',
|
|
124
209
|
chain: Chains.EthereumMainnet,
|
|
@@ -126,19 +211,20 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
126
211
|
precision: 8,
|
|
127
212
|
contract: '0xF433089366899D83A9F26A773D59EC7ECF30355E',
|
|
128
213
|
hasWithdrawMemo: false
|
|
129
|
-
}],
|
|
130
|
-
image: '/
|
|
214
|
+
}] : []),
|
|
215
|
+
image: 'https://www.proton.org/images/tokens/xtokensXMT.png',
|
|
216
|
+
coingeckoId: 'metal'
|
|
131
217
|
}, {
|
|
132
218
|
allowSwap: true,
|
|
133
219
|
allowBridge: true,
|
|
134
|
-
allowLend:
|
|
135
|
-
allowBorrow:
|
|
220
|
+
allowLend: true,
|
|
221
|
+
allowBorrow: true,
|
|
136
222
|
name: 'Bitcoin',
|
|
137
223
|
coin: 'BTC',
|
|
138
224
|
xtokenSymbol: 'XBTC',
|
|
139
225
|
xtokenPrecision: 8,
|
|
140
226
|
xtokenContract: 'xtokens',
|
|
141
|
-
wallets: [{
|
|
227
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
142
228
|
wallet: 'BTC',
|
|
143
229
|
symbol: 'BTC',
|
|
144
230
|
chain: Chains.BitcoinMainnet,
|
|
@@ -146,8 +232,8 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
146
232
|
precision: 8,
|
|
147
233
|
contract: undefined,
|
|
148
234
|
hasWithdrawMemo: false
|
|
149
|
-
}]
|
|
150
|
-
wallet: 'BTC
|
|
235
|
+
}] : [], IS_TESTNET ? [{
|
|
236
|
+
wallet: 'BTC',
|
|
151
237
|
symbol: 'BTC',
|
|
152
238
|
chain: Chains.BitcoinTestnet,
|
|
153
239
|
network: Networks.Testnet,
|
|
@@ -155,18 +241,19 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
155
241
|
contract: undefined,
|
|
156
242
|
hasWithdrawMemo: false
|
|
157
243
|
}] : []),
|
|
158
|
-
image: '/
|
|
244
|
+
image: 'https://www.proton.org/images/tokens/xtokensXBTC.png',
|
|
245
|
+
coingeckoId: 'bitcoin'
|
|
159
246
|
}, {
|
|
160
247
|
allowSwap: true,
|
|
161
248
|
allowBridge: true,
|
|
162
|
-
allowLend:
|
|
163
|
-
allowBorrow:
|
|
249
|
+
allowLend: true,
|
|
250
|
+
allowBorrow: true,
|
|
164
251
|
name: 'Ethereum',
|
|
165
252
|
coin: 'ETH',
|
|
166
253
|
xtokenSymbol: 'XETH',
|
|
167
254
|
xtokenPrecision: 8,
|
|
168
255
|
xtokenContract: 'xtokens',
|
|
169
|
-
wallets: [{
|
|
256
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
170
257
|
wallet: 'ETH',
|
|
171
258
|
symbol: 'ETH',
|
|
172
259
|
chain: Chains.EthereumMainnet,
|
|
@@ -174,8 +261,8 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
174
261
|
precision: 18,
|
|
175
262
|
contract: '0x0000000000000000000000000000000000000000',
|
|
176
263
|
hasWithdrawMemo: false
|
|
177
|
-
}]
|
|
178
|
-
wallet: 'ETH
|
|
264
|
+
}] : [], IS_TESTNET ? [{
|
|
265
|
+
wallet: 'ETH',
|
|
179
266
|
symbol: 'ETH',
|
|
180
267
|
chain: Chains.EthereumRopsten,
|
|
181
268
|
network: Networks.Ropsten,
|
|
@@ -183,9 +270,23 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
183
270
|
contract: '0x0000000000000000000000000000000000000000',
|
|
184
271
|
hasWithdrawMemo: false
|
|
185
272
|
}] : []),
|
|
186
|
-
image: '/
|
|
273
|
+
image: 'https://www.proton.org/images/tokens/xtokensXETH.png',
|
|
274
|
+
coingeckoId: 'ethereum'
|
|
187
275
|
}, {
|
|
188
|
-
allowSwap:
|
|
276
|
+
allowSwap: true,
|
|
277
|
+
allowBridge: false,
|
|
278
|
+
allowLend: false,
|
|
279
|
+
allowBorrow: false,
|
|
280
|
+
name: 'Loan',
|
|
281
|
+
coin: 'LOAN',
|
|
282
|
+
xtokenSymbol: 'LOAN',
|
|
283
|
+
xtokenPrecision: 4,
|
|
284
|
+
xtokenContract: 'loan.token',
|
|
285
|
+
wallets: [],
|
|
286
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/loan.png',
|
|
287
|
+
coingeckoId: 'proton-loan'
|
|
288
|
+
}, {
|
|
289
|
+
allowSwap: true,
|
|
189
290
|
allowBridge: true,
|
|
190
291
|
allowLend: false,
|
|
191
292
|
allowBorrow: false,
|
|
@@ -194,7 +295,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
194
295
|
xtokenSymbol: 'XUSDT',
|
|
195
296
|
xtokenPrecision: 6,
|
|
196
297
|
xtokenContract: 'xtokens',
|
|
197
|
-
wallets: [{
|
|
298
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
198
299
|
wallet: 'USDT',
|
|
199
300
|
symbol: 'USDT',
|
|
200
301
|
chain: Chains.EthereumMainnet,
|
|
@@ -202,11 +303,28 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
202
303
|
precision: 6,
|
|
203
304
|
contract: '0xDAC17F958D2EE523A2206206994597C13D831EC7',
|
|
204
305
|
hasWithdrawMemo: false
|
|
205
|
-
}],
|
|
206
|
-
|
|
306
|
+
}] : [], IS_MAINNET ? [{
|
|
307
|
+
wallet: 'USDT-BEP20',
|
|
308
|
+
symbol: 'USDT',
|
|
309
|
+
chain: Chains.BinanceBEP20,
|
|
310
|
+
network: Networks.BEP20,
|
|
311
|
+
precision: 18,
|
|
312
|
+
contract: '0x55d398326f99059fF775485246999027B3197955',
|
|
313
|
+
hasWithdrawMemo: false
|
|
314
|
+
}] : [], IS_TESTNET ? [{
|
|
315
|
+
wallet: 'USDT',
|
|
316
|
+
symbol: 'USDT',
|
|
317
|
+
chain: Chains.EthereumRopsten,
|
|
318
|
+
network: Networks.Ropsten,
|
|
319
|
+
precision: 6,
|
|
320
|
+
contract: '0xDAC17F958D2EE523A2206206994597C13D831EC7',
|
|
321
|
+
hasWithdrawMemo: false
|
|
322
|
+
}] : []),
|
|
323
|
+
image: 'https://www.proton.org/images/tokens/xtokensXUSDT.png',
|
|
324
|
+
coingeckoId: 'tether'
|
|
207
325
|
}, {
|
|
208
326
|
allowSwap: false,
|
|
209
|
-
allowBridge:
|
|
327
|
+
allowBridge: IS_MAINNET,
|
|
210
328
|
allowLend: false,
|
|
211
329
|
allowBorrow: false,
|
|
212
330
|
name: 'TrueUSD',
|
|
@@ -214,7 +332,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
214
332
|
xtokenSymbol: 'XTUSD',
|
|
215
333
|
xtokenPrecision: 6,
|
|
216
334
|
xtokenContract: 'xtokens',
|
|
217
|
-
wallets: [{
|
|
335
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
218
336
|
wallet: 'TUSD',
|
|
219
337
|
symbol: 'TUSD',
|
|
220
338
|
chain: Chains.EthereumMainnet,
|
|
@@ -222,11 +340,12 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
222
340
|
precision: 18,
|
|
223
341
|
contract: '0x0000000000085D4780B73119B644AE5ECD22B376',
|
|
224
342
|
hasWithdrawMemo: false
|
|
225
|
-
}],
|
|
226
|
-
image: '/
|
|
343
|
+
}] : []),
|
|
344
|
+
image: 'https://www.proton.org/images/tokens/xtokensXTUSD.png',
|
|
345
|
+
coingeckoId: 'true-usd'
|
|
227
346
|
}, {
|
|
228
347
|
allowSwap: false,
|
|
229
|
-
allowBridge:
|
|
348
|
+
allowBridge: IS_MAINNET,
|
|
230
349
|
allowLend: false,
|
|
231
350
|
allowBorrow: false,
|
|
232
351
|
name: 'Paxos Standard',
|
|
@@ -234,7 +353,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
234
353
|
xtokenSymbol: 'XPAX',
|
|
235
354
|
xtokenPrecision: 6,
|
|
236
355
|
xtokenContract: 'xtokens',
|
|
237
|
-
wallets: [{
|
|
356
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
238
357
|
wallet: 'PAX',
|
|
239
358
|
symbol: 'PAX',
|
|
240
359
|
chain: Chains.EthereumMainnet,
|
|
@@ -242,8 +361,9 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
242
361
|
precision: 18,
|
|
243
362
|
contract: '0x8E870D67F660D95D5BE530380D0EC0BD388289E1',
|
|
244
363
|
hasWithdrawMemo: false
|
|
245
|
-
}],
|
|
246
|
-
image: '/
|
|
364
|
+
}] : []),
|
|
365
|
+
image: 'https://www.proton.org/images/tokens/xtokensXPAX.png',
|
|
366
|
+
coingeckoId: 'paxos-standard'
|
|
247
367
|
}, {
|
|
248
368
|
allowSwap: false,
|
|
249
369
|
allowBridge: true,
|
|
@@ -254,7 +374,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
254
374
|
xtokenSymbol: 'XPAXG',
|
|
255
375
|
xtokenPrecision: 8,
|
|
256
376
|
xtokenContract: 'xtokens',
|
|
257
|
-
wallets: [{
|
|
377
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
258
378
|
wallet: 'PAXG',
|
|
259
379
|
symbol: 'PAXG',
|
|
260
380
|
chain: Chains.EthereumMainnet,
|
|
@@ -262,11 +382,59 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
262
382
|
precision: 18,
|
|
263
383
|
contract: '0x45804880DE22913DAFE09F4980848ECE6ECBAF78',
|
|
264
384
|
hasWithdrawMemo: false
|
|
265
|
-
}],
|
|
266
|
-
|
|
385
|
+
}] : [], IS_TESTNET ? [{
|
|
386
|
+
wallet: 'PAXG',
|
|
387
|
+
symbol: 'PAXG',
|
|
388
|
+
chain: Chains.EthereumRopsten,
|
|
389
|
+
network: Networks.Ropsten,
|
|
390
|
+
precision: 18,
|
|
391
|
+
contract: '0x45804880DE22913DAFE09F4980848ECE6ECBAF78',
|
|
392
|
+
hasWithdrawMemo: false
|
|
393
|
+
}] : []),
|
|
394
|
+
image: 'https://www.proton.org/images/tokens/xtokensXPAXG.png',
|
|
395
|
+
coingeckoId: 'pax-gold'
|
|
267
396
|
}, {
|
|
268
397
|
allowSwap: IS_MAINNET,
|
|
269
|
-
allowBridge:
|
|
398
|
+
allowBridge: false,
|
|
399
|
+
allowLend: false,
|
|
400
|
+
allowBorrow: false,
|
|
401
|
+
name: 'Storex',
|
|
402
|
+
coin: 'STRX',
|
|
403
|
+
xtokenSymbol: 'STRX',
|
|
404
|
+
xtokenPrecision: 4,
|
|
405
|
+
xtokenContract: 'storex',
|
|
406
|
+
wallets: [],
|
|
407
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/strx.png',
|
|
408
|
+
coingeckoId: ''
|
|
409
|
+
}, {
|
|
410
|
+
allowSwap: IS_MAINNET,
|
|
411
|
+
allowBridge: false,
|
|
412
|
+
allowLend: false,
|
|
413
|
+
allowBorrow: false,
|
|
414
|
+
name: 'Mint',
|
|
415
|
+
coin: 'MINT',
|
|
416
|
+
xtokenSymbol: 'MINT',
|
|
417
|
+
xtokenPrecision: 4,
|
|
418
|
+
xtokenContract: 'protonmint',
|
|
419
|
+
wallets: [],
|
|
420
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/PMLogo-04.png',
|
|
421
|
+
coingeckoId: ''
|
|
422
|
+
}, {
|
|
423
|
+
allowSwap: IS_MAINNET,
|
|
424
|
+
allowBridge: false,
|
|
425
|
+
allowLend: false,
|
|
426
|
+
allowBorrow: false,
|
|
427
|
+
name: 'Snipcoins',
|
|
428
|
+
coin: 'SNIPS',
|
|
429
|
+
xtokenSymbol: 'SNIPS',
|
|
430
|
+
xtokenPrecision: 4,
|
|
431
|
+
xtokenContract: 'snipcoins',
|
|
432
|
+
wallets: [],
|
|
433
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/snips.png',
|
|
434
|
+
coingeckoId: ''
|
|
435
|
+
}, {
|
|
436
|
+
allowSwap: IS_MAINNET,
|
|
437
|
+
allowBridge: true,
|
|
270
438
|
allowLend: false,
|
|
271
439
|
allowBorrow: false,
|
|
272
440
|
name: 'Uniswap',
|
|
@@ -274,7 +442,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
274
442
|
xtokenSymbol: 'XUNI',
|
|
275
443
|
xtokenPrecision: 6,
|
|
276
444
|
xtokenContract: 'xtokens',
|
|
277
|
-
wallets: [{
|
|
445
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
278
446
|
wallet: 'UNI',
|
|
279
447
|
symbol: 'UNI',
|
|
280
448
|
chain: Chains.EthereumMainnet,
|
|
@@ -282,8 +450,17 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
282
450
|
precision: 18,
|
|
283
451
|
contract: '0x1F9840A85D5AF5BF1D1762F925BDADDC4201F984',
|
|
284
452
|
hasWithdrawMemo: false
|
|
285
|
-
}],
|
|
286
|
-
|
|
453
|
+
}] : [], IS_TESTNET ? [{
|
|
454
|
+
wallet: 'UNI',
|
|
455
|
+
symbol: 'UNI',
|
|
456
|
+
chain: Chains.EthereumRopsten,
|
|
457
|
+
network: Networks.Ropsten,
|
|
458
|
+
precision: 18,
|
|
459
|
+
contract: '0x1F9840A85D5AF5BF1D1762F925BDADDC4201F984',
|
|
460
|
+
hasWithdrawMemo: false
|
|
461
|
+
}] : []),
|
|
462
|
+
image: 'https://www.proton.org/images/tokens/xtokensXUNI.png',
|
|
463
|
+
coingeckoId: 'uniswap'
|
|
287
464
|
}, {
|
|
288
465
|
allowSwap: false,
|
|
289
466
|
allowBridge: false,
|
|
@@ -294,7 +471,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
294
471
|
xtokenSymbol: 'XINCH',
|
|
295
472
|
xtokenPrecision: 6,
|
|
296
473
|
xtokenContract: 'xtokens',
|
|
297
|
-
wallets: [{
|
|
474
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
298
475
|
wallet: '1INCH',
|
|
299
476
|
symbol: '1INCH',
|
|
300
477
|
chain: Chains.EthereumMainnet,
|
|
@@ -302,8 +479,9 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
302
479
|
precision: 18,
|
|
303
480
|
contract: '0x111111111117DC0AA78B770FA6A738034120C302',
|
|
304
481
|
hasWithdrawMemo: false
|
|
305
|
-
}],
|
|
306
|
-
image: '/
|
|
482
|
+
}] : []),
|
|
483
|
+
image: 'https://www.proton.org/images/tokens/xtokensXINCH.png',
|
|
484
|
+
coingeckoId: '1inch'
|
|
307
485
|
}, {
|
|
308
486
|
allowSwap: false,
|
|
309
487
|
allowBridge: false,
|
|
@@ -314,7 +492,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
314
492
|
xtokenSymbol: 'XLINK',
|
|
315
493
|
xtokenPrecision: 6,
|
|
316
494
|
xtokenContract: 'xtokens',
|
|
317
|
-
wallets: [{
|
|
495
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
318
496
|
wallet: 'LINK',
|
|
319
497
|
symbol: 'LINK',
|
|
320
498
|
chain: Chains.EthereumMainnet,
|
|
@@ -322,11 +500,12 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
322
500
|
precision: 18,
|
|
323
501
|
contract: '0x514910771AF9CA656AF840DFF83E8264ECF986CA',
|
|
324
502
|
hasWithdrawMemo: false
|
|
325
|
-
}],
|
|
326
|
-
image: '/
|
|
503
|
+
}] : []),
|
|
504
|
+
image: 'https://www.proton.org/images/tokens/xtokensXLINK.png',
|
|
505
|
+
coingeckoId: 'chainlink'
|
|
327
506
|
}, {
|
|
328
507
|
allowSwap: IS_MAINNET,
|
|
329
|
-
allowBridge:
|
|
508
|
+
allowBridge: true,
|
|
330
509
|
allowLend: false,
|
|
331
510
|
allowBorrow: false,
|
|
332
511
|
name: 'Litecoin',
|
|
@@ -334,7 +513,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
334
513
|
xtokenSymbol: 'XLTC',
|
|
335
514
|
xtokenPrecision: 8,
|
|
336
515
|
xtokenContract: 'xtokens',
|
|
337
|
-
wallets: [{
|
|
516
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
338
517
|
wallet: 'LTC',
|
|
339
518
|
symbol: 'LTC',
|
|
340
519
|
chain: Chains.LitecoinMainnet,
|
|
@@ -342,11 +521,20 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
342
521
|
precision: 8,
|
|
343
522
|
contract: undefined,
|
|
344
523
|
hasWithdrawMemo: false
|
|
345
|
-
}],
|
|
346
|
-
|
|
524
|
+
}] : [], IS_TESTNET ? [{
|
|
525
|
+
wallet: 'LTC',
|
|
526
|
+
symbol: 'LTC',
|
|
527
|
+
chain: Chains.LitecoinTestnet,
|
|
528
|
+
network: Networks.Testnet,
|
|
529
|
+
precision: 8,
|
|
530
|
+
contract: undefined,
|
|
531
|
+
hasWithdrawMemo: false
|
|
532
|
+
}] : []),
|
|
533
|
+
image: 'https://www.proton.org/images/tokens/xtokensXLTC.png',
|
|
534
|
+
coingeckoId: 'litecoin'
|
|
347
535
|
}, {
|
|
348
536
|
allowSwap: IS_MAINNET,
|
|
349
|
-
allowBridge:
|
|
537
|
+
allowBridge: true,
|
|
350
538
|
allowLend: false,
|
|
351
539
|
allowBorrow: false,
|
|
352
540
|
name: 'Bitcoin Cash',
|
|
@@ -354,7 +542,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
354
542
|
xtokenSymbol: 'XBCH',
|
|
355
543
|
xtokenPrecision: 8,
|
|
356
544
|
xtokenContract: 'xtokens',
|
|
357
|
-
wallets: [{
|
|
545
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
358
546
|
wallet: 'BCH',
|
|
359
547
|
symbol: 'BCH',
|
|
360
548
|
chain: Chains.BitcoinCashMainnet,
|
|
@@ -362,11 +550,20 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
362
550
|
precision: 8,
|
|
363
551
|
contract: undefined,
|
|
364
552
|
hasWithdrawMemo: false
|
|
365
|
-
}],
|
|
366
|
-
|
|
553
|
+
}] : [], IS_TESTNET ? [{
|
|
554
|
+
wallet: 'BCH',
|
|
555
|
+
symbol: 'BCH',
|
|
556
|
+
chain: Chains.BitcoinCashTestnet,
|
|
557
|
+
network: Networks.Testnet,
|
|
558
|
+
precision: 8,
|
|
559
|
+
contract: undefined,
|
|
560
|
+
hasWithdrawMemo: false
|
|
561
|
+
}] : []),
|
|
562
|
+
image: 'https://www.proton.org/images/tokens/xtokensXBCH.png',
|
|
563
|
+
coingeckoId: 'bitcoin-cash'
|
|
367
564
|
}, {
|
|
368
565
|
allowSwap: false,
|
|
369
|
-
allowBridge:
|
|
566
|
+
allowBridge: IS_TESTNET,
|
|
370
567
|
allowLend: false,
|
|
371
568
|
allowBorrow: false,
|
|
372
569
|
name: 'Stellar',
|
|
@@ -374,18 +571,27 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
374
571
|
xtokenSymbol: 'XXLM',
|
|
375
572
|
xtokenPrecision: 6,
|
|
376
573
|
xtokenContract: 'xtokens',
|
|
377
|
-
wallets: [{
|
|
574
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
378
575
|
wallet: 'XLM',
|
|
379
576
|
symbol: 'XLM',
|
|
380
577
|
chain: Chains.StellarMainnet,
|
|
381
578
|
network: Networks.Mainnet,
|
|
382
579
|
precision: 7,
|
|
383
580
|
contract: undefined,
|
|
384
|
-
hasWithdrawMemo:
|
|
385
|
-
}],
|
|
386
|
-
|
|
581
|
+
hasWithdrawMemo: true
|
|
582
|
+
}] : [], IS_TESTNET ? [{
|
|
583
|
+
wallet: 'XLM',
|
|
584
|
+
symbol: 'XLM',
|
|
585
|
+
chain: Chains.StellarTestnet,
|
|
586
|
+
network: Networks.Testnet,
|
|
587
|
+
precision: 7,
|
|
588
|
+
contract: undefined,
|
|
589
|
+
hasWithdrawMemo: true
|
|
590
|
+
}] : []),
|
|
591
|
+
image: 'https://www.proton.org/images/tokens/xtokensXXLM.png',
|
|
592
|
+
coingeckoId: 'stellar'
|
|
387
593
|
}, {
|
|
388
|
-
allowSwap:
|
|
594
|
+
allowSwap: false,
|
|
389
595
|
allowBridge: false,
|
|
390
596
|
allowLend: false,
|
|
391
597
|
allowBorrow: false,
|
|
@@ -395,7 +601,8 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
395
601
|
xtokenPrecision: 4,
|
|
396
602
|
xtokenContract: 'sense',
|
|
397
603
|
wallets: [],
|
|
398
|
-
image: '/
|
|
604
|
+
image: 'https://www.proton.org/images/tokens/senseXSENSE.png',
|
|
605
|
+
coingeckoId: 'sense'
|
|
399
606
|
}, {
|
|
400
607
|
allowSwap: false,
|
|
401
608
|
allowBridge: false,
|
|
@@ -406,7 +613,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
406
613
|
xtokenSymbol: 'XDOT',
|
|
407
614
|
xtokenPrecision: 8,
|
|
408
615
|
xtokenContract: 'xtokens',
|
|
409
|
-
wallets: [{
|
|
616
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
410
617
|
wallet: 'DOT',
|
|
411
618
|
symbol: 'DOT',
|
|
412
619
|
chain: Chains.PolkadotMainnet,
|
|
@@ -414,11 +621,12 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
414
621
|
precision: 10,
|
|
415
622
|
contract: undefined,
|
|
416
623
|
hasWithdrawMemo: false
|
|
417
|
-
}],
|
|
418
|
-
image: '/
|
|
624
|
+
}] : []),
|
|
625
|
+
image: 'https://www.proton.org/images/tokens/xtokensXDOT.png',
|
|
626
|
+
coingeckoId: 'polkadot'
|
|
419
627
|
}, {
|
|
420
628
|
allowSwap: true,
|
|
421
|
-
allowBridge:
|
|
629
|
+
allowBridge: IS_MAINNET,
|
|
422
630
|
allowLend: false,
|
|
423
631
|
allowBorrow: false,
|
|
424
632
|
name: 'Binance Coin',
|
|
@@ -426,16 +634,38 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
426
634
|
xtokenSymbol: 'XBNB',
|
|
427
635
|
xtokenPrecision: 8,
|
|
428
636
|
xtokenContract: 'xtokens',
|
|
429
|
-
wallets: [{
|
|
637
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
430
638
|
wallet: 'BNB',
|
|
431
639
|
symbol: 'BNB',
|
|
432
|
-
chain: Chains.
|
|
433
|
-
network: Networks.
|
|
434
|
-
precision:
|
|
640
|
+
chain: Chains.BinanceBEP20,
|
|
641
|
+
network: Networks.BEP20,
|
|
642
|
+
precision: 18,
|
|
435
643
|
contract: undefined,
|
|
436
|
-
hasWithdrawMemo:
|
|
437
|
-
}],
|
|
438
|
-
image: '/
|
|
644
|
+
hasWithdrawMemo: false
|
|
645
|
+
}] : []),
|
|
646
|
+
image: 'https://www.proton.org/images/tokens/xtokensXBNB.png',
|
|
647
|
+
coingeckoId: 'binancecoin'
|
|
648
|
+
}, {
|
|
649
|
+
allowSwap: false,
|
|
650
|
+
allowBridge: IS_MAINNET,
|
|
651
|
+
allowLend: false,
|
|
652
|
+
allowBorrow: false,
|
|
653
|
+
name: 'Binance USD',
|
|
654
|
+
coin: 'BUSD',
|
|
655
|
+
xtokenSymbol: 'XBUSD',
|
|
656
|
+
xtokenPrecision: 6,
|
|
657
|
+
xtokenContract: 'xtokens',
|
|
658
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
659
|
+
wallet: 'BUSD-BEP20',
|
|
660
|
+
symbol: 'BUSD',
|
|
661
|
+
chain: Chains.BinanceBEP20,
|
|
662
|
+
network: Networks.BEP20,
|
|
663
|
+
precision: 18,
|
|
664
|
+
contract: '0xe9e7cea3dedca5984780bafc599bd69add087d56',
|
|
665
|
+
hasWithdrawMemo: false
|
|
666
|
+
}] : []),
|
|
667
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/xbusd.png',
|
|
668
|
+
coingeckoId: 'binance-usd'
|
|
439
669
|
}, {
|
|
440
670
|
allowSwap: true,
|
|
441
671
|
allowBridge: true,
|
|
@@ -446,7 +676,7 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
446
676
|
xtokenSymbol: 'XEOS',
|
|
447
677
|
xtokenPrecision: 4,
|
|
448
678
|
xtokenContract: 'xtokens',
|
|
449
|
-
wallets: [{
|
|
679
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
450
680
|
wallet: 'EOS',
|
|
451
681
|
symbol: 'EOS',
|
|
452
682
|
chain: Chains.EosMainnet,
|
|
@@ -454,24 +684,41 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
454
684
|
precision: 4,
|
|
455
685
|
contract: undefined,
|
|
456
686
|
hasWithdrawMemo: true
|
|
457
|
-
}],
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
687
|
+
}] : [], IS_TESTNET ? [{
|
|
688
|
+
wallet: 'EOS',
|
|
689
|
+
symbol: 'EOS',
|
|
690
|
+
chain: Chains.EosTestnet,
|
|
691
|
+
network: Networks.Testnet,
|
|
692
|
+
precision: 4,
|
|
693
|
+
contract: undefined,
|
|
694
|
+
hasWithdrawMemo: true
|
|
695
|
+
}] : []),
|
|
696
|
+
image: 'https://www.proton.org/images/tokens/xtokensXEOS.png',
|
|
697
|
+
coingeckoId: 'eos'
|
|
698
|
+
}, {
|
|
461
699
|
allowSwap: IS_MAINNET,
|
|
462
|
-
allowBridge:
|
|
463
|
-
allowLend:
|
|
464
|
-
allowBorrow:
|
|
700
|
+
allowBridge: IS_MAINNET,
|
|
701
|
+
allowLend: true,
|
|
702
|
+
allowBorrow: true,
|
|
465
703
|
name: 'Dogecoin',
|
|
466
704
|
coin: 'DOGE',
|
|
467
705
|
xtokenSymbol: 'XDOGE',
|
|
468
706
|
xtokenPrecision: 6,
|
|
469
707
|
xtokenContract: 'xtokens',
|
|
470
|
-
wallets: []
|
|
471
|
-
|
|
708
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
709
|
+
wallet: 'DOGE',
|
|
710
|
+
symbol: 'DOGE',
|
|
711
|
+
chain: Chains.DogeMainnet,
|
|
712
|
+
network: Networks.Mainnet,
|
|
713
|
+
precision: 8,
|
|
714
|
+
contract: undefined,
|
|
715
|
+
hasWithdrawMemo: false
|
|
716
|
+
}] : []),
|
|
717
|
+
image: 'https://www.proton.org/images/tokens/xtokensXDOGE.png',
|
|
718
|
+
coingeckoId: 'dogecoin'
|
|
472
719
|
}, {
|
|
473
720
|
allowSwap: IS_MAINNET,
|
|
474
|
-
allowBridge:
|
|
721
|
+
allowBridge: IS_MAINNET,
|
|
475
722
|
allowLend: false,
|
|
476
723
|
allowBorrow: false,
|
|
477
724
|
name: 'Cardano',
|
|
@@ -479,45 +726,179 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
479
726
|
xtokenSymbol: 'XADA',
|
|
480
727
|
xtokenPrecision: 6,
|
|
481
728
|
xtokenContract: 'xtokens',
|
|
482
|
-
wallets: []
|
|
483
|
-
|
|
729
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
730
|
+
wallet: 'ADA',
|
|
731
|
+
symbol: 'ADA',
|
|
732
|
+
chain: Chains.CardanoMainnet,
|
|
733
|
+
network: Networks.Mainnet,
|
|
734
|
+
precision: 6,
|
|
735
|
+
contract: undefined,
|
|
736
|
+
hasWithdrawMemo: false
|
|
737
|
+
}] : []),
|
|
738
|
+
image: 'https://www.proton.org/images/tokens/xtokensXADA.png',
|
|
739
|
+
coingeckoId: 'cardano'
|
|
740
|
+
}, // Adding
|
|
741
|
+
{
|
|
742
|
+
allowSwap: false,
|
|
743
|
+
allowBridge: IS_MAINNET,
|
|
744
|
+
allowLend: false,
|
|
745
|
+
allowBorrow: false,
|
|
746
|
+
name: 'Terra',
|
|
747
|
+
coin: 'LUNA',
|
|
748
|
+
xtokenSymbol: 'XLUNA',
|
|
749
|
+
xtokenPrecision: 6,
|
|
750
|
+
xtokenContract: 'xtokens',
|
|
751
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
752
|
+
wallet: 'LUNA',
|
|
753
|
+
symbol: 'LUNA',
|
|
754
|
+
chain: Chains.TerraMainnet,
|
|
755
|
+
network: Networks.Mainnet,
|
|
756
|
+
precision: 6,
|
|
757
|
+
contract: undefined,
|
|
758
|
+
hasWithdrawMemo: true
|
|
759
|
+
}] : []),
|
|
760
|
+
image: 'https://www.proton.org/images/tokens/xtokensXLUNA.png',
|
|
761
|
+
coingeckoId: 'terra-luna'
|
|
484
762
|
}, {
|
|
485
763
|
allowSwap: false,
|
|
486
|
-
allowBridge:
|
|
764
|
+
allowBridge: IS_MAINNET,
|
|
487
765
|
allowLend: false,
|
|
488
766
|
allowBorrow: false,
|
|
489
|
-
name: '
|
|
490
|
-
coin: '
|
|
491
|
-
xtokenSymbol: '
|
|
767
|
+
name: 'TerraUSD',
|
|
768
|
+
coin: 'UST',
|
|
769
|
+
xtokenSymbol: 'XUST',
|
|
492
770
|
xtokenPrecision: 6,
|
|
493
771
|
xtokenContract: 'xtokens',
|
|
494
|
-
wallets: []
|
|
495
|
-
|
|
772
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
773
|
+
wallet: 'UST',
|
|
774
|
+
symbol: 'UST',
|
|
775
|
+
chain: Chains.TerraMainnet,
|
|
776
|
+
network: Networks.Mainnet,
|
|
777
|
+
precision: 6,
|
|
778
|
+
contract: undefined,
|
|
779
|
+
hasWithdrawMemo: true
|
|
780
|
+
}] : []),
|
|
781
|
+
image: 'https://www.proton.org/images/tokens/xtokensXUST.png',
|
|
782
|
+
coingeckoId: 'terrausd'
|
|
496
783
|
}, {
|
|
497
784
|
allowSwap: false,
|
|
498
|
-
allowBridge:
|
|
785
|
+
allowBridge: IS_MAINNET,
|
|
499
786
|
allowLend: false,
|
|
500
787
|
allowBorrow: false,
|
|
501
|
-
name: '
|
|
502
|
-
coin: '
|
|
503
|
-
xtokenSymbol: '
|
|
788
|
+
name: 'Solana',
|
|
789
|
+
coin: 'SOL',
|
|
790
|
+
xtokenSymbol: 'XSOL',
|
|
504
791
|
xtokenPrecision: 6,
|
|
505
792
|
xtokenContract: 'xtokens',
|
|
506
|
-
wallets: []
|
|
507
|
-
|
|
793
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
794
|
+
wallet: 'SOL',
|
|
795
|
+
symbol: 'SOL',
|
|
796
|
+
chain: Chains.SolanaMainnet,
|
|
797
|
+
network: Networks.Mainnet,
|
|
798
|
+
precision: 9,
|
|
799
|
+
contract: undefined,
|
|
800
|
+
hasWithdrawMemo: false
|
|
801
|
+
}] : []),
|
|
802
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/xsol.png',
|
|
803
|
+
coingeckoId: 'solana'
|
|
804
|
+
}, {
|
|
805
|
+
allowSwap: false,
|
|
806
|
+
allowBridge: IS_MAINNET,
|
|
807
|
+
allowLend: false,
|
|
808
|
+
allowBorrow: false,
|
|
809
|
+
name: 'Ripple',
|
|
810
|
+
coin: 'XRP',
|
|
811
|
+
xtokenSymbol: 'XXRP',
|
|
812
|
+
xtokenPrecision: 6,
|
|
813
|
+
xtokenContract: 'xtokens',
|
|
814
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
815
|
+
wallet: 'XRP',
|
|
816
|
+
symbol: 'XRP',
|
|
817
|
+
chain: Chains.RippleMainnet,
|
|
818
|
+
network: Networks.Mainnet,
|
|
819
|
+
precision: 6,
|
|
820
|
+
contract: undefined,
|
|
821
|
+
hasWithdrawMemo: true
|
|
822
|
+
}] : []),
|
|
823
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/xxrp.png',
|
|
824
|
+
coingeckoId: 'ripple'
|
|
825
|
+
}, // Future
|
|
826
|
+
{
|
|
827
|
+
allowSwap: false,
|
|
828
|
+
allowBridge: false,
|
|
829
|
+
allowLend: false,
|
|
830
|
+
allowBorrow: false,
|
|
831
|
+
name: 'Avalanche',
|
|
832
|
+
coin: 'AVAX',
|
|
833
|
+
xtokenSymbol: 'XAVAX',
|
|
834
|
+
xtokenPrecision: 9,
|
|
835
|
+
xtokenContract: 'xtokens',
|
|
836
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
837
|
+
wallet: 'AVAX',
|
|
838
|
+
symbol: 'AVAX',
|
|
839
|
+
chain: Chains.AvalancheCChain,
|
|
840
|
+
network: Networks.Mainnet,
|
|
841
|
+
precision: 9,
|
|
842
|
+
contract: undefined,
|
|
843
|
+
hasWithdrawMemo: false
|
|
844
|
+
}] : []),
|
|
845
|
+
image: 'https://www.proton.org/images/tokens/xtokensXAVAX.png',
|
|
846
|
+
coingeckoId: 'avalanche-2'
|
|
508
847
|
}, {
|
|
509
848
|
allowSwap: false,
|
|
510
849
|
allowBridge: false,
|
|
511
850
|
allowLend: false,
|
|
512
851
|
allowBorrow: false,
|
|
513
|
-
name: '
|
|
514
|
-
coin: '
|
|
515
|
-
xtokenSymbol: '
|
|
852
|
+
name: 'Polygon',
|
|
853
|
+
coin: 'MATIC',
|
|
854
|
+
xtokenSymbol: 'XMATIC',
|
|
855
|
+
xtokenPrecision: 8,
|
|
856
|
+
xtokenContract: 'xtokens',
|
|
857
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
858
|
+
wallet: 'MATIC',
|
|
859
|
+
symbol: 'MATIC',
|
|
860
|
+
chain: Chains.PolygonMainnet,
|
|
861
|
+
network: Networks.Mainnet,
|
|
862
|
+
precision: 18,
|
|
863
|
+
contract: '0x0000000000000000000000000000000000000000',
|
|
864
|
+
hasWithdrawMemo: false
|
|
865
|
+
}] : []),
|
|
866
|
+
image: 'https://www.proton.org/images/tokens/xtokensXMATIC.png',
|
|
867
|
+
coingeckoId: 'matic-network'
|
|
868
|
+
}, {
|
|
869
|
+
allowSwap: false,
|
|
870
|
+
allowBridge: IS_TESTNET,
|
|
871
|
+
allowLend: false,
|
|
872
|
+
allowBorrow: false,
|
|
873
|
+
name: 'HBAR',
|
|
874
|
+
coin: 'HBAR',
|
|
875
|
+
xtokenSymbol: 'XHBAR',
|
|
516
876
|
xtokenPrecision: 6,
|
|
517
877
|
xtokenContract: 'xtokens',
|
|
518
|
-
wallets: []
|
|
519
|
-
|
|
520
|
-
|
|
878
|
+
wallets: [].concat(IS_TESTNET ? [{
|
|
879
|
+
wallet: 'HBAR',
|
|
880
|
+
symbol: 'HBAR',
|
|
881
|
+
chain: Chains.HederaTestnet,
|
|
882
|
+
network: Networks.Testnet,
|
|
883
|
+
precision: 8,
|
|
884
|
+
contract: undefined,
|
|
885
|
+
hasWithdrawMemo: true
|
|
886
|
+
}] : []),
|
|
887
|
+
image: 'https://www.proton.org/images/tokens/xtokensXHBAR.png',
|
|
888
|
+
coingeckoId: 'hedera-hashgraph'
|
|
889
|
+
}]; // Validation
|
|
890
|
+
|
|
891
|
+
var walletWithDuplicateChains = coins.find(function (coin) {
|
|
892
|
+
var chains = coin.wallets.map(function (wallet) {
|
|
893
|
+
return wallet.chain;
|
|
894
|
+
});
|
|
895
|
+
return new Set(chains).size !== chains.length;
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
if (walletWithDuplicateChains) {
|
|
899
|
+
throw new Error("Coin " + walletWithDuplicateChains.coin + " has duplicate chains in wallet");
|
|
900
|
+
}
|
|
901
|
+
|
|
521
902
|
return {
|
|
522
903
|
allCoins: coins,
|
|
523
904
|
swapCoins: coins.filter(function (coin) {
|
|
@@ -541,6 +922,90 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
541
922
|
};
|
|
542
923
|
};
|
|
543
924
|
|
|
925
|
+
var accountParser = /*#__PURE__*/z.string().regex(/^[.1-5a-z]{0,12}[.1-5a-j]?$/);
|
|
926
|
+
var authorizationParser = /*#__PURE__*/z.object({
|
|
927
|
+
actor: accountParser,
|
|
928
|
+
permission: /*#__PURE__*/z.string()
|
|
929
|
+
});
|
|
930
|
+
var authorizationsParser = /*#__PURE__*/z.array(authorizationParser).min(1);
|
|
931
|
+
var ExtendedAssetParser = /*#__PURE__*/z.object({
|
|
932
|
+
quantity: /*#__PURE__*/z.string(),
|
|
933
|
+
contract: accountParser
|
|
934
|
+
});
|
|
935
|
+
|
|
936
|
+
var actionParser = /*#__PURE__*/z.object({
|
|
937
|
+
account: /*#__PURE__*/z.string(),
|
|
938
|
+
name: /*#__PURE__*/z.string(),
|
|
939
|
+
authorization: /*#__PURE__*/z.array( /*#__PURE__*/z.object({
|
|
940
|
+
actor: /*#__PURE__*/z.string(),
|
|
941
|
+
permission: /*#__PURE__*/z.string()
|
|
942
|
+
})),
|
|
943
|
+
data: /*#__PURE__*/z.any(),
|
|
944
|
+
hex_data: /*#__PURE__*/z.string().optional()
|
|
945
|
+
});
|
|
946
|
+
var transactionExtensionsParser = /*#__PURE__*/z.array(z.number().or(z.string())).optional();
|
|
947
|
+
var rawTransactionParser = /*#__PURE__*/z.object({
|
|
948
|
+
expiration: /*#__PURE__*/z.string(),
|
|
949
|
+
ref_block_num: /*#__PURE__*/z.number(),
|
|
950
|
+
ref_block_prefix: /*#__PURE__*/z.number(),
|
|
951
|
+
max_net_usage_words: /*#__PURE__*/z.number(),
|
|
952
|
+
max_cpu_usage_ms: /*#__PURE__*/z.number(),
|
|
953
|
+
delay_sec: /*#__PURE__*/z.number(),
|
|
954
|
+
context_free_actions: /*#__PURE__*/z.array(actionParser),
|
|
955
|
+
transaction_extensions: /*#__PURE__*/z.array(transactionExtensionsParser)
|
|
956
|
+
});
|
|
957
|
+
var baseActionParser = function baseActionParser(contract, action, data) {
|
|
958
|
+
return z.object({
|
|
959
|
+
account: contract === '*' ? accountParser : z.literal(contract),
|
|
960
|
+
name: z.literal(action),
|
|
961
|
+
data: z.object(data),
|
|
962
|
+
authorization: authorizationsParser
|
|
963
|
+
});
|
|
964
|
+
};
|
|
965
|
+
var baseActionSerializedParser = function baseActionSerializedParser(contract, action, data) {
|
|
966
|
+
return z.object({
|
|
967
|
+
account: contract === '*' ? accountParser : z.literal(contract),
|
|
968
|
+
name: z.literal(action),
|
|
969
|
+
data: z.string().or(z.object(data)),
|
|
970
|
+
authorization: authorizationsParser
|
|
971
|
+
});
|
|
972
|
+
};
|
|
973
|
+
var webauthActionParser = function webauthActionParser(contract, action, data) {
|
|
974
|
+
return z.object({
|
|
975
|
+
account: z.literal('webauthn'),
|
|
976
|
+
name: z.literal('exec'),
|
|
977
|
+
data: z.object({
|
|
978
|
+
account: accountParser,
|
|
979
|
+
key: z.object({
|
|
980
|
+
key: z.array(z.string().or(z.object({
|
|
981
|
+
modulus: z.string(),
|
|
982
|
+
exponent: z.string()
|
|
983
|
+
}))),
|
|
984
|
+
user_presence: z.number(),
|
|
985
|
+
rpid: z.string()
|
|
986
|
+
}),
|
|
987
|
+
nonce: z.number(),
|
|
988
|
+
permissions: authorizationsParser,
|
|
989
|
+
signature: z.object({
|
|
990
|
+
auth_data: z.string(),
|
|
991
|
+
client_json: z.string(),
|
|
992
|
+
signature: z.string()
|
|
993
|
+
}),
|
|
994
|
+
trx: rawTransactionParser.merge(z.object({
|
|
995
|
+
actions: z.array(baseActionSerializedParser(contract, action, data)).length(1)
|
|
996
|
+
}))
|
|
997
|
+
}),
|
|
998
|
+
authorization: authorizationsParser
|
|
999
|
+
});
|
|
1000
|
+
};
|
|
1001
|
+
var singleActionTransactionParser = function singleActionTransactionParser(contract, action, data) {
|
|
1002
|
+
var baseAction = baseActionParser(contract, action, data);
|
|
1003
|
+
var webauthAction = webauthActionParser(contract, action, data);
|
|
1004
|
+
return rawTransactionParser.merge(z.object({
|
|
1005
|
+
actions: z.array(baseAction.or(webauthAction)).length(1)
|
|
1006
|
+
}));
|
|
1007
|
+
};
|
|
1008
|
+
|
|
544
1009
|
function _extends() {
|
|
545
1010
|
_extends = Object.assign || function (target) {
|
|
546
1011
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -559,31 +1024,92 @@ function _extends() {
|
|
|
559
1024
|
return _extends.apply(this, arguments);
|
|
560
1025
|
}
|
|
561
1026
|
|
|
1027
|
+
function _inheritsLoose(subClass, superClass) {
|
|
1028
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
1029
|
+
subClass.prototype.constructor = subClass;
|
|
1030
|
+
|
|
1031
|
+
_setPrototypeOf(subClass, superClass);
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
function _setPrototypeOf(o, p) {
|
|
1035
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
1036
|
+
o.__proto__ = p;
|
|
1037
|
+
return o;
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
return _setPrototypeOf(o, p);
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
1044
|
+
if (!o) return;
|
|
1045
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
1046
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1047
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1048
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1049
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
function _arrayLikeToArray(arr, len) {
|
|
1053
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1054
|
+
|
|
1055
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1056
|
+
|
|
1057
|
+
return arr2;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
1061
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
1062
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
1063
|
+
|
|
1064
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
1065
|
+
if (it) o = it;
|
|
1066
|
+
var i = 0;
|
|
1067
|
+
return function () {
|
|
1068
|
+
if (i >= o.length) return {
|
|
1069
|
+
done: true
|
|
1070
|
+
};
|
|
1071
|
+
return {
|
|
1072
|
+
done: false,
|
|
1073
|
+
value: o[i++]
|
|
1074
|
+
};
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1079
|
+
}
|
|
1080
|
+
|
|
562
1081
|
var WRAP_CONTRACT = 'proton.wrap';
|
|
1082
|
+
var WRAP_AUTH_ACTION = 'generateauth';
|
|
1083
|
+
var FEE_FACTOR = 10000;
|
|
563
1084
|
var initializeConstants = function initializeConstants(chain) {
|
|
564
1085
|
var _initializeCoins = initializeCoins(chain),
|
|
565
1086
|
swapCoins = _initializeCoins.swapCoins,
|
|
566
1087
|
bridgeCoins = _initializeCoins.bridgeCoins,
|
|
567
1088
|
allEnabledCoins = _initializeCoins.allEnabledCoins,
|
|
568
|
-
allCoins = _initializeCoins.allCoins
|
|
1089
|
+
allCoins = _initializeCoins.allCoins,
|
|
1090
|
+
lendCoins = _initializeCoins.lendCoins,
|
|
1091
|
+
borrowCoins = _initializeCoins.borrowCoins,
|
|
1092
|
+
loanCoins = _initializeCoins.loanCoins;
|
|
569
1093
|
|
|
570
1094
|
var constants = {
|
|
571
1095
|
SWAP_CONTRACT: 'proton.swaps',
|
|
572
|
-
|
|
1096
|
+
DEX_CONTRACT: chain === 'proton' ? 'dextest21' : 'dex',
|
|
1097
|
+
FEE_FACTOR: FEE_FACTOR,
|
|
573
1098
|
GOOGLE_MAPS_KEY: 'AIzaSyDb2_CrK032kSIqBXbkdwmaLKWELl0SxVs',
|
|
574
1099
|
SWAP_URL: chain === 'proton' ? 'https://otc.protonswap.com' : 'https://otc-test.protonswap.com',
|
|
575
|
-
WRAP_SERVER_URL: chain === 'proton' ? 'https://www.api.bloks.io/proton-wrap-
|
|
1100
|
+
WRAP_SERVER_URL: chain === 'proton' ? 'https://www.api.bloks.io/proton-wrap-public2' : 'https://www.api.bloks.io/proton-wrap-testnet-public2',
|
|
576
1101
|
WRAP_CONTRACT: WRAP_CONTRACT,
|
|
577
1102
|
WRAP_ACTIONS: {
|
|
578
|
-
SAVE_ADDRESS: '
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
1103
|
+
SAVE_ADDRESS: 'saveaddress2',
|
|
1104
|
+
DELETE_ADDRESS: 'deladdress2',
|
|
1105
|
+
WRAP_START: 'wrapstart2',
|
|
1106
|
+
WRAP_FINISH: 'wrapfinish2',
|
|
1107
|
+
WRAP_PROCESS: 'wrapprocess2',
|
|
1108
|
+
WRAP_SET_CONF: 'wrapsetconf2'
|
|
583
1109
|
},
|
|
584
1110
|
WRAP_TABLES: {
|
|
585
|
-
ADDRESSES: '
|
|
586
|
-
WRAPS: '
|
|
1111
|
+
ADDRESSES: 'addresses2',
|
|
1112
|
+
WRAPS: 'wraps2'
|
|
587
1113
|
},
|
|
588
1114
|
ADDRESSES_INDEXES: {
|
|
589
1115
|
BY_ACCOUNT: 2,
|
|
@@ -598,16 +1124,32 @@ var initializeConstants = function initializeConstants(chain) {
|
|
|
598
1124
|
FARM_CONTRACT: 'yield.farms',
|
|
599
1125
|
WEBHOOK_PERMISSION: 'webhook',
|
|
600
1126
|
PUBLIC_PERMISSION: 'public',
|
|
601
|
-
|
|
1127
|
+
LIGHT_PERMISSION: 'light',
|
|
1128
|
+
WRAP_AUTH_ACTION: WRAP_AUTH_ACTION,
|
|
602
1129
|
METAL_ENDPOINT: chain === 'proton' ? 'https://cirrus.metalpay.com' : 'https://cirrus-dev.metalpay.com',
|
|
603
1130
|
METAL_PROTON_ENDPOINT: chain === 'proton' ? 'https://api.protonchain.com' : 'https://api-dev.protonchain.com',
|
|
604
|
-
|
|
1131
|
+
METAL_DEX_ENDPOINT: chain === 'proton' ? 'https://metallicus-dbapi-dev01.binfra.one' : 'https://metallicus-dbapi-dev01.binfra.one',
|
|
1132
|
+
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'],
|
|
605
1133
|
CHAIN_ID: chain === 'proton' ? '384da888112027f0321850a169f737c33e53b388aad48b5adace4bab97f437e0' : '71ee83bcf52142d61019d95f9cc5427ba6a0d7ff8accd9e2088ae2abeaf3d3dd',
|
|
606
1134
|
CHAIN: chain,
|
|
607
1135
|
SWAP_COINS: swapCoins,
|
|
608
1136
|
BRIDGE_COINS: bridgeCoins,
|
|
609
1137
|
ALL_ENABLED_COINS: allEnabledCoins,
|
|
1138
|
+
LEND_COINS: lendCoins,
|
|
1139
|
+
BORROW_COINS: borrowCoins,
|
|
1140
|
+
LOAN_COINS: loanCoins,
|
|
610
1141
|
ALL_COINS: allCoins,
|
|
1142
|
+
findBridgeCoinWalletByXtokenAndChain: function findBridgeCoinWalletByXtokenAndChain(xtokenSymbol, chain) {
|
|
1143
|
+
var bridgeCoin = constants.BRIDGE_COINS.find(function (bridgeCoin) {
|
|
1144
|
+
return bridgeCoin.xtokenSymbol === xtokenSymbol;
|
|
1145
|
+
});
|
|
1146
|
+
if (!bridgeCoin) return undefined;
|
|
1147
|
+
var bridgeWallet = bridgeCoin.wallets.find(function (bridgeWallet) {
|
|
1148
|
+
return bridgeWallet.chain === chain;
|
|
1149
|
+
});
|
|
1150
|
+
if (!bridgeWallet) return undefined;
|
|
1151
|
+
return _extends({}, bridgeCoin, bridgeWallet);
|
|
1152
|
+
},
|
|
611
1153
|
findBridgeCoinWallet: function findBridgeCoinWallet(coin, wallet) {
|
|
612
1154
|
var bridgeCoin = constants.BRIDGE_COINS.find(function (bridgeCoin) {
|
|
613
1155
|
return bridgeCoin.coin === coin;
|
|
@@ -634,215 +1176,665 @@ var initializeConstants = function initializeConstants(chain) {
|
|
|
634
1176
|
return constants;
|
|
635
1177
|
};
|
|
636
1178
|
|
|
637
|
-
var
|
|
1179
|
+
var createAbstractAuthParser = function createAbstractAuthParser(contract, action, data) {
|
|
1180
|
+
return z.object({
|
|
1181
|
+
signer: authorizationParser,
|
|
1182
|
+
signatures: z.array(z.string()).length(1),
|
|
1183
|
+
transaction: singleActionTransactionParser(contract, action, data)
|
|
1184
|
+
});
|
|
1185
|
+
};
|
|
1186
|
+
var generateAuthData = {
|
|
1187
|
+
time: /*#__PURE__*/z.string(),
|
|
1188
|
+
protonAccount: /*#__PURE__*/z.string()
|
|
1189
|
+
};
|
|
1190
|
+
var generateAuthParser = /*#__PURE__*/createAbstractAuthParser(WRAP_CONTRACT, WRAP_AUTH_ACTION, generateAuthData);
|
|
638
1191
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
1192
|
+
var addressParser = /*#__PURE__*/z.object({
|
|
1193
|
+
index: /*#__PURE__*/z.number(),
|
|
1194
|
+
account: accountParser,
|
|
1195
|
+
chain: /*#__PURE__*/z.string(),
|
|
1196
|
+
address: /*#__PURE__*/z.string(),
|
|
1197
|
+
address_hash: /*#__PURE__*/z.string()
|
|
1198
|
+
});
|
|
1199
|
+
var generateAddressBodyParser = /*#__PURE__*/z.object({
|
|
1200
|
+
coin: z.string(),
|
|
1201
|
+
wallet: z.string()
|
|
1202
|
+
}).merge(generateAuthParser);
|
|
1203
|
+
var generateAddressResponse = /*#__PURE__*/z.object({
|
|
1204
|
+
id: /*#__PURE__*/z.string(),
|
|
1205
|
+
address: /*#__PURE__*/z.string(),
|
|
1206
|
+
coin: /*#__PURE__*/z.string(),
|
|
1207
|
+
wallet: /*#__PURE__*/z.string(),
|
|
1208
|
+
memo: /*#__PURE__*/z.string().optional()
|
|
1209
|
+
});
|
|
645
1210
|
|
|
646
|
-
var
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
1211
|
+
var rateParser = /*#__PURE__*/z.object({
|
|
1212
|
+
counterCurrency: /*#__PURE__*/z.string(),
|
|
1213
|
+
price: /*#__PURE__*/z.number(),
|
|
1214
|
+
priceChangePercent: /*#__PURE__*/z.number(),
|
|
1215
|
+
marketCap: /*#__PURE__*/z.number(),
|
|
1216
|
+
volume: /*#__PURE__*/z.number(),
|
|
1217
|
+
timestamp: /*#__PURE__*/z.number()
|
|
650
1218
|
});
|
|
651
|
-
var
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
max_cpu_usage_ms: /*#__PURE__*/number(),
|
|
657
|
-
delay_sec: /*#__PURE__*/number(),
|
|
658
|
-
context_free_actions: /*#__PURE__*/array( /*#__PURE__*/any()),
|
|
659
|
-
transaction_extensions: /*#__PURE__*/array( /*#__PURE__*/any())
|
|
1219
|
+
var exchangeRateParser = /*#__PURE__*/z.object({
|
|
1220
|
+
contract: /*#__PURE__*/z.string(),
|
|
1221
|
+
symbol: /*#__PURE__*/z.string(),
|
|
1222
|
+
rank: /*#__PURE__*/z.number(),
|
|
1223
|
+
rates: /*#__PURE__*/z.array(rateParser)
|
|
660
1224
|
});
|
|
661
|
-
var
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
1225
|
+
var exchangeRatesParser = /*#__PURE__*/z.array(exchangeRateParser);
|
|
1226
|
+
var bloksRatesParser = /*#__PURE__*/z.array( /*#__PURE__*/z.object({
|
|
1227
|
+
contract: /*#__PURE__*/z.string(),
|
|
1228
|
+
symbol: /*#__PURE__*/z.string(),
|
|
1229
|
+
rank: /*#__PURE__*/z.number(),
|
|
1230
|
+
rates: /*#__PURE__*/z.array(rateParser)
|
|
1231
|
+
}));
|
|
1232
|
+
|
|
1233
|
+
var Type;
|
|
1234
|
+
|
|
1235
|
+
(function (Type) {
|
|
1236
|
+
Type["RECEIVE"] = "receive";
|
|
1237
|
+
Type["SEND"] = "send";
|
|
1238
|
+
})(Type || (Type = {}));
|
|
1239
|
+
|
|
1240
|
+
var depositBodyParser = /*#__PURE__*/z.object({
|
|
1241
|
+
id: /*#__PURE__*/z.string(),
|
|
1242
|
+
type: /*#__PURE__*/z.nativeEnum(Type),
|
|
1243
|
+
hash: /*#__PURE__*/z.string(),
|
|
1244
|
+
coin: /*#__PURE__*/z.string(),
|
|
1245
|
+
wallet: /*#__PURE__*/z.string() // "ETH-ROPSTEN" or "XPR-MAINNET"
|
|
1246
|
+
|
|
675
1247
|
});
|
|
676
|
-
var
|
|
677
|
-
|
|
678
|
-
wallet: string()
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
1248
|
+
var transactionParser = /*#__PURE__*/z.object({
|
|
1249
|
+
id: /*#__PURE__*/z.string(),
|
|
1250
|
+
wallet: /*#__PURE__*/z.string(),
|
|
1251
|
+
value: /*#__PURE__*/z.number(),
|
|
1252
|
+
valueString: /*#__PURE__*/z.string(),
|
|
1253
|
+
address: /*#__PURE__*/z.string(),
|
|
1254
|
+
type: /*#__PURE__*/z.nativeEnum(Type),
|
|
1255
|
+
state: /*#__PURE__*/z.string(),
|
|
1256
|
+
confirmations: /*#__PURE__*/z.number(),
|
|
1257
|
+
hash: /*#__PURE__*/z.string(),
|
|
1258
|
+
blockHash: /*#__PURE__*/z.string().optional().nullable(),
|
|
1259
|
+
blockHeight: /*#__PURE__*/z.number().optional().nullable() // 643159
|
|
1260
|
+
|
|
686
1261
|
});
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
coin: /*#__PURE__*/string(),
|
|
693
|
-
wallet: /*#__PURE__*/string()
|
|
1262
|
+
|
|
1263
|
+
var otcOrderResponseParser = /*#__PURE__*/z.object({
|
|
1264
|
+
success: /*#__PURE__*/z["boolean"](),
|
|
1265
|
+
transaction_id: /*#__PURE__*/z.string(),
|
|
1266
|
+
errormsg: /*#__PURE__*/z.string().optional()
|
|
694
1267
|
});
|
|
695
|
-
var
|
|
1268
|
+
var otcQuoteBodyParser = /*#__PURE__*/z.object({
|
|
1269
|
+
baseAmount: /*#__PURE__*/z.number(),
|
|
1270
|
+
baseSymbol: /*#__PURE__*/z.string(),
|
|
1271
|
+
quoteSymbol: /*#__PURE__*/z.string()
|
|
1272
|
+
});
|
|
1273
|
+
var otcQuoteResponseParser = /*#__PURE__*/z.object({
|
|
1274
|
+
success: /*#__PURE__*/z["boolean"](),
|
|
1275
|
+
token: /*#__PURE__*/z.string(),
|
|
1276
|
+
qty: /*#__PURE__*/z.number(),
|
|
1277
|
+
errormsg: /*#__PURE__*/z.string().optional()
|
|
1278
|
+
});
|
|
1279
|
+
|
|
1280
|
+
var withdrawData = {
|
|
1281
|
+
from: /*#__PURE__*/z.string().refine(function (val) {
|
|
1282
|
+
return val !== WRAP_CONTRACT;
|
|
1283
|
+
}, {
|
|
1284
|
+
message: WRAP_CONTRACT + " must be receiver"
|
|
1285
|
+
}),
|
|
1286
|
+
to: /*#__PURE__*/z.literal(WRAP_CONTRACT),
|
|
1287
|
+
quantity: /*#__PURE__*/z.string(),
|
|
1288
|
+
memo: /*#__PURE__*/z.string()
|
|
1289
|
+
};
|
|
1290
|
+
var withdrawBodyParser = /*#__PURE__*/z.object({
|
|
696
1291
|
signer: authorizationParser,
|
|
697
|
-
signatures: /*#__PURE__*/array(string()).
|
|
698
|
-
transaction: /*#__PURE__*/
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
name: literal('transfer'),
|
|
702
|
-
data: object({
|
|
703
|
-
from: string().refine(function (val) {
|
|
704
|
-
return val !== WRAP_CONTRACT;
|
|
705
|
-
}, {
|
|
706
|
-
message: WRAP_CONTRACT + " must be receiver"
|
|
707
|
-
}),
|
|
708
|
-
to: literal(WRAP_CONTRACT),
|
|
709
|
-
quantity: string(),
|
|
710
|
-
memo: string()
|
|
711
|
-
}),
|
|
712
|
-
authorization: array(authorizationParser).min(1)
|
|
713
|
-
})).min(1)
|
|
714
|
-
})),
|
|
715
|
-
quoteId: /*#__PURE__*/string()
|
|
1292
|
+
signatures: /*#__PURE__*/z.array(z.string()).length(1),
|
|
1293
|
+
transaction: /*#__PURE__*/singleActionTransactionParser('*', 'transfer', withdrawData),
|
|
1294
|
+
quoteId: /*#__PURE__*/z.string(),
|
|
1295
|
+
provider: /*#__PURE__*/z.string().optional()
|
|
716
1296
|
});
|
|
717
|
-
var withdrawMetalResponseParser = /*#__PURE__*/object({
|
|
718
|
-
success: /*#__PURE__*/boolean(),
|
|
719
|
-
id: /*#__PURE__*/string()
|
|
1297
|
+
var withdrawMetalResponseParser = /*#__PURE__*/z.object({
|
|
1298
|
+
success: /*#__PURE__*/z["boolean"](),
|
|
1299
|
+
id: /*#__PURE__*/z.string()
|
|
720
1300
|
});
|
|
721
|
-
var
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
network: /*#__PURE__*/string(),
|
|
727
|
-
created: /*#__PURE__*/string(),
|
|
728
|
-
withdrawalAddress: /*#__PURE__*/string(),
|
|
729
|
-
withdrawalHash: /*#__PURE__*/string().optional()
|
|
1301
|
+
var withdrawalFeeQuoteParser = /*#__PURE__*/z.object({
|
|
1302
|
+
quoteId: /*#__PURE__*/z.string(),
|
|
1303
|
+
estimatedFee: /*#__PURE__*/z.string(),
|
|
1304
|
+
currency: /*#__PURE__*/z.string(),
|
|
1305
|
+
network: /*#__PURE__*/z.string()
|
|
730
1306
|
});
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
1307
|
+
|
|
1308
|
+
var withdrawHistoryMetalSwapParser = /*#__PURE__*/z.object({
|
|
1309
|
+
id: /*#__PURE__*/z.string(),
|
|
1310
|
+
status: /*#__PURE__*/z.string(),
|
|
1311
|
+
amount: /*#__PURE__*/z.string(),
|
|
1312
|
+
currency: /*#__PURE__*/z.string(),
|
|
1313
|
+
network: /*#__PURE__*/z.string(),
|
|
1314
|
+
created: /*#__PURE__*/z.string(),
|
|
1315
|
+
withdrawalAddress: /*#__PURE__*/z.string(),
|
|
1316
|
+
withdrawalHash: /*#__PURE__*/z.string().optional()
|
|
738
1317
|
});
|
|
739
|
-
var
|
|
740
|
-
|
|
741
|
-
|
|
1318
|
+
var withdrawHistoryMetalResponseParser = /*#__PURE__*/z.object({
|
|
1319
|
+
swaps: /*#__PURE__*/z.array(withdrawHistoryMetalSwapParser),
|
|
1320
|
+
page: /*#__PURE__*/z.number(),
|
|
1321
|
+
pageSize: /*#__PURE__*/z.number(),
|
|
1322
|
+
numberOfElements: /*#__PURE__*/z.number(),
|
|
1323
|
+
totalPages: /*#__PURE__*/z.number(),
|
|
1324
|
+
totalElements: /*#__PURE__*/z.number()
|
|
742
1325
|
});
|
|
743
|
-
|
|
1326
|
+
|
|
1327
|
+
var Status;
|
|
1328
|
+
|
|
1329
|
+
(function (Status) {
|
|
1330
|
+
Status["PENDING"] = "pending";
|
|
1331
|
+
Status["SUCCESS"] = "success";
|
|
1332
|
+
Status["FAIL"] = "fail";
|
|
1333
|
+
Status["PROCESSING"] = "processing";
|
|
1334
|
+
})(Status || (Status = {}));
|
|
1335
|
+
|
|
1336
|
+
var wrapStartParser = /*#__PURE__*/z.object({
|
|
744
1337
|
balance: ExtendedAssetParser,
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
deposit_address: /*#__PURE__*/string(),
|
|
749
|
-
confirmations: /*#__PURE__*/number()
|
|
1338
|
+
id: /*#__PURE__*/z.string(),
|
|
1339
|
+
txid: /*#__PURE__*/z.string(),
|
|
1340
|
+
chain: /*#__PURE__*/z.string(),
|
|
1341
|
+
deposit_address: /*#__PURE__*/z.string(),
|
|
1342
|
+
confirmations: /*#__PURE__*/z.number()
|
|
750
1343
|
});
|
|
751
|
-
var wrapSetConfParser = /*#__PURE__*/object({
|
|
752
|
-
wrap_hash: /*#__PURE__*/string(),
|
|
753
|
-
confirmations: /*#__PURE__*/number()
|
|
1344
|
+
var wrapSetConfParser = /*#__PURE__*/z.object({
|
|
1345
|
+
wrap_hash: /*#__PURE__*/z.string(),
|
|
1346
|
+
confirmations: /*#__PURE__*/z.number()
|
|
754
1347
|
});
|
|
755
|
-
var wrapParser = /*#__PURE__*/object({
|
|
756
|
-
index: /*#__PURE__*/number(),
|
|
757
|
-
proton_account: /*#__PURE__*/string(),
|
|
1348
|
+
var wrapParser = /*#__PURE__*/z.object({
|
|
1349
|
+
index: /*#__PURE__*/z.number(),
|
|
1350
|
+
proton_account: /*#__PURE__*/z.string(),
|
|
758
1351
|
balance: ExtendedAssetParser,
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
deposit_address: /*#__PURE__*/string(),
|
|
763
|
-
status: /*#__PURE__*/nativeEnum(Status),
|
|
764
|
-
finish_txid: /*#__PURE__*/string(),
|
|
765
|
-
wrap_hash: /*#__PURE__*/string(),
|
|
766
|
-
confirmations: /*#__PURE__*/number()
|
|
1352
|
+
id: /*#__PURE__*/z.string(),
|
|
1353
|
+
txid: /*#__PURE__*/z.string(),
|
|
1354
|
+
chain: /*#__PURE__*/z.string(),
|
|
1355
|
+
deposit_address: /*#__PURE__*/z.string(),
|
|
1356
|
+
status: /*#__PURE__*/z.nativeEnum(Status),
|
|
1357
|
+
finish_txid: /*#__PURE__*/z.string(),
|
|
1358
|
+
wrap_hash: /*#__PURE__*/z.string(),
|
|
1359
|
+
confirmations: /*#__PURE__*/z.number()
|
|
767
1360
|
});
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
wallet: /*#__PURE__*/string(),
|
|
780
|
-
value: /*#__PURE__*/number(),
|
|
781
|
-
valueString: /*#__PURE__*/string(),
|
|
782
|
-
isChange: /*#__PURE__*/boolean()
|
|
783
|
-
})),
|
|
784
|
-
outputs: /*#__PURE__*/array( /*#__PURE__*/object({
|
|
785
|
-
address: /*#__PURE__*/string(),
|
|
786
|
-
wallet: /*#__PURE__*/string(),
|
|
787
|
-
fromWallet: /*#__PURE__*/string(),
|
|
788
|
-
value: /*#__PURE__*/number(),
|
|
789
|
-
valueString: /*#__PURE__*/string(),
|
|
790
|
-
coinbase: /*#__PURE__*/boolean()
|
|
791
|
-
})),
|
|
792
|
-
value: /*#__PURE__*/number(),
|
|
793
|
-
valueString: /*#__PURE__*/string(),
|
|
794
|
-
pending: /*#__PURE__*/boolean(),
|
|
795
|
-
instant: /*#__PURE__*/boolean()
|
|
1361
|
+
|
|
1362
|
+
var numTransform = /*#__PURE__*/z.string().regex(/\d+/).transform(Number);
|
|
1363
|
+
var ohlcvParser = /*#__PURE__*/z.object({
|
|
1364
|
+
time: /*#__PURE__*/z.number(),
|
|
1365
|
+
open: /*#__PURE__*/z.number(),
|
|
1366
|
+
high: /*#__PURE__*/z.number(),
|
|
1367
|
+
low: /*#__PURE__*/z.number(),
|
|
1368
|
+
close: /*#__PURE__*/z.number(),
|
|
1369
|
+
volume: /*#__PURE__*/z.number(),
|
|
1370
|
+
volume_bid: /*#__PURE__*/z.number(),
|
|
1371
|
+
count: /*#__PURE__*/z.number()
|
|
796
1372
|
});
|
|
797
|
-
var
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
1373
|
+
var OHLCV_DTO = /*#__PURE__*/function (_createZodDto) {
|
|
1374
|
+
_inheritsLoose(OHLCV_DTO, _createZodDto);
|
|
1375
|
+
|
|
1376
|
+
function OHLCV_DTO() {
|
|
1377
|
+
return _createZodDto.apply(this, arguments) || this;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
return OHLCV_DTO;
|
|
1381
|
+
}( /*#__PURE__*/createZodDto(ohlcvParser));
|
|
1382
|
+
var getOhlcvParser = /*#__PURE__*/z.object({
|
|
1383
|
+
interval: /*#__PURE__*/z.string(),
|
|
1384
|
+
dateFrom: /*#__PURE__*/z.string(),
|
|
1385
|
+
dateTo: /*#__PURE__*/z.string(),
|
|
1386
|
+
marketId: /*#__PURE__*/z.number().or(numTransform),
|
|
1387
|
+
limit: /*#__PURE__*/z.number().or(numTransform)["default"](500).refine(function (n) {
|
|
1388
|
+
return n <= 1000;
|
|
1389
|
+
}, 'Max limit is 1000')
|
|
804
1390
|
});
|
|
805
|
-
var
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
1391
|
+
var GetOHLCV_DTO = /*#__PURE__*/function (_createZodDto2) {
|
|
1392
|
+
_inheritsLoose(GetOHLCV_DTO, _createZodDto2);
|
|
1393
|
+
|
|
1394
|
+
function GetOHLCV_DTO() {
|
|
1395
|
+
return _createZodDto2.apply(this, arguments) || this;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
return GetOHLCV_DTO;
|
|
1399
|
+
}( /*#__PURE__*/createZodDto(getOhlcvParser));
|
|
1400
|
+
var orderHistoryParser = /*#__PURE__*/z.object({
|
|
1401
|
+
seq: /*#__PURE__*/z.number(),
|
|
1402
|
+
block_num: /*#__PURE__*/z.number(),
|
|
1403
|
+
block_time: /*#__PURE__*/z.string(),
|
|
1404
|
+
order_id: /*#__PURE__*/z.number(),
|
|
1405
|
+
market_id: /*#__PURE__*/z.number(),
|
|
1406
|
+
quantity_init: /*#__PURE__*/z.number().optional(),
|
|
1407
|
+
quantity_curr: /*#__PURE__*/z.number(),
|
|
1408
|
+
price: /*#__PURE__*/z.number(),
|
|
1409
|
+
account_name: /*#__PURE__*/z.string(),
|
|
1410
|
+
order_side: /*#__PURE__*/z.number(),
|
|
1411
|
+
order_type: /*#__PURE__*/z.number(),
|
|
1412
|
+
status: /*#__PURE__*/z.string(),
|
|
1413
|
+
quantity_change: /*#__PURE__*/z.number(),
|
|
1414
|
+
trx_id: /*#__PURE__*/z.string()
|
|
809
1415
|
});
|
|
810
|
-
var
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1416
|
+
var OrderHistory_DTO = /*#__PURE__*/function (_createZodDto3) {
|
|
1417
|
+
_inheritsLoose(OrderHistory_DTO, _createZodDto3);
|
|
1418
|
+
|
|
1419
|
+
function OrderHistory_DTO() {
|
|
1420
|
+
return _createZodDto3.apply(this, arguments) || this;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
return OrderHistory_DTO;
|
|
1424
|
+
}( /*#__PURE__*/createZodDto(orderHistoryParser));
|
|
1425
|
+
var getOrderHistoryParser = /*#__PURE__*/z.object({
|
|
1426
|
+
account: /*#__PURE__*/z.string(),
|
|
1427
|
+
offset: /*#__PURE__*/z.number().or(numTransform)["default"](0),
|
|
1428
|
+
limit: /*#__PURE__*/z.number().or(numTransform)["default"](100).refine(function (n) {
|
|
1429
|
+
return n <= 250;
|
|
1430
|
+
}, 'Max limit is 250')
|
|
814
1431
|
});
|
|
815
|
-
var
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
1432
|
+
var GetOrderHistory_DTO = /*#__PURE__*/function (_createZodDto4) {
|
|
1433
|
+
_inheritsLoose(GetOrderHistory_DTO, _createZodDto4);
|
|
1434
|
+
|
|
1435
|
+
function GetOrderHistory_DTO() {
|
|
1436
|
+
return _createZodDto4.apply(this, arguments) || this;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
return GetOrderHistory_DTO;
|
|
1440
|
+
}( /*#__PURE__*/createZodDto(getOrderHistoryParser));
|
|
1441
|
+
var depthParser = /*#__PURE__*/z.object({
|
|
1442
|
+
level: /*#__PURE__*/z.number(),
|
|
1443
|
+
ask: /*#__PURE__*/z.number(),
|
|
1444
|
+
bid: /*#__PURE__*/z.number(),
|
|
1445
|
+
count: /*#__PURE__*/z.number()
|
|
820
1446
|
});
|
|
821
|
-
var
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
1447
|
+
var Depth_DTO = /*#__PURE__*/function (_createZodDto5) {
|
|
1448
|
+
_inheritsLoose(Depth_DTO, _createZodDto5);
|
|
1449
|
+
|
|
1450
|
+
function Depth_DTO() {
|
|
1451
|
+
return _createZodDto5.apply(this, arguments) || this;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
return Depth_DTO;
|
|
1455
|
+
}( /*#__PURE__*/createZodDto(depthParser));
|
|
1456
|
+
var getDepthParser = /*#__PURE__*/z.object({
|
|
1457
|
+
marketId: /*#__PURE__*/z.number(),
|
|
1458
|
+
step: /*#__PURE__*/z.string(),
|
|
1459
|
+
side: /*#__PURE__*/z.string(),
|
|
1460
|
+
limit: /*#__PURE__*/z.number().or(numTransform)["default"](100).refine(function (n) {
|
|
1461
|
+
return n <= 250;
|
|
1462
|
+
}, 'Max limit is 250')
|
|
828
1463
|
});
|
|
829
|
-
var
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
1464
|
+
var GetDepth_DTO = /*#__PURE__*/function (_createZodDto6) {
|
|
1465
|
+
_inheritsLoose(GetDepth_DTO, _createZodDto6);
|
|
1466
|
+
|
|
1467
|
+
function GetDepth_DTO() {
|
|
1468
|
+
return _createZodDto6.apply(this, arguments) || this;
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
return GetDepth_DTO;
|
|
1472
|
+
}( /*#__PURE__*/createZodDto(getDepthParser));
|
|
1473
|
+
var tradeParser = /*#__PURE__*/z.object({
|
|
1474
|
+
block_num: /*#__PURE__*/z.number(),
|
|
1475
|
+
block_time: /*#__PURE__*/z.string(),
|
|
1476
|
+
trade_id: /*#__PURE__*/z.number(),
|
|
1477
|
+
market_id: /*#__PURE__*/z.number(),
|
|
1478
|
+
price: /*#__PURE__*/z.number(),
|
|
1479
|
+
bid_user: /*#__PURE__*/z.string(),
|
|
1480
|
+
bid_user_order_id: /*#__PURE__*/z.number(),
|
|
1481
|
+
bid_amount: /*#__PURE__*/z.number(),
|
|
1482
|
+
bid_fee: /*#__PURE__*/z.number(),
|
|
1483
|
+
ask_user: /*#__PURE__*/z.string(),
|
|
1484
|
+
ask_user_order_id: /*#__PURE__*/z.number(),
|
|
1485
|
+
ask_amount: /*#__PURE__*/z.number(),
|
|
1486
|
+
ask_fee: /*#__PURE__*/z.number(),
|
|
1487
|
+
order_side: /*#__PURE__*/z.number(),
|
|
1488
|
+
trx_id: /*#__PURE__*/z.string()
|
|
834
1489
|
});
|
|
835
|
-
var
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
1490
|
+
var Trade_DTO = /*#__PURE__*/function (_createZodDto7) {
|
|
1491
|
+
_inheritsLoose(Trade_DTO, _createZodDto7);
|
|
1492
|
+
|
|
1493
|
+
function Trade_DTO() {
|
|
1494
|
+
return _createZodDto7.apply(this, arguments) || this;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
return Trade_DTO;
|
|
1498
|
+
}( /*#__PURE__*/createZodDto(tradeParser));
|
|
1499
|
+
var getTradesParser = /*#__PURE__*/z.object({
|
|
1500
|
+
marketId: /*#__PURE__*/z.number().or(numTransform),
|
|
1501
|
+
offset: /*#__PURE__*/z.number().or(numTransform)["default"](0),
|
|
1502
|
+
limit: /*#__PURE__*/z.number().or(numTransform)["default"](100).refine(function (n) {
|
|
1503
|
+
return n <= 250;
|
|
1504
|
+
}, 'Max limit is 250')
|
|
841
1505
|
});
|
|
1506
|
+
var GetTrades_DTO = /*#__PURE__*/function (_createZodDto8) {
|
|
1507
|
+
_inheritsLoose(GetTrades_DTO, _createZodDto8);
|
|
1508
|
+
|
|
1509
|
+
function GetTrades_DTO() {
|
|
1510
|
+
return _createZodDto8.apply(this, arguments) || this;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
return GetTrades_DTO;
|
|
1514
|
+
}( /*#__PURE__*/createZodDto(getTradesParser));
|
|
1515
|
+
var orderType;
|
|
1516
|
+
|
|
1517
|
+
(function (orderType) {
|
|
1518
|
+
orderType[orderType["INVALID"] = 0] = "INVALID";
|
|
1519
|
+
orderType[orderType["MARKET"] = 1] = "MARKET";
|
|
1520
|
+
orderType[orderType["LIMIT"] = 2] = "LIMIT";
|
|
1521
|
+
orderType[orderType["STOPLOSS"] = 3] = "STOPLOSS";
|
|
1522
|
+
orderType[orderType["TAKEPROFIT"] = 4] = "TAKEPROFIT";
|
|
1523
|
+
})(orderType || (orderType = {}));
|
|
1524
|
+
|
|
1525
|
+
var orderSide;
|
|
1526
|
+
|
|
1527
|
+
(function (orderSide) {
|
|
1528
|
+
orderSide[orderSide["INVALID"] = 0] = "INVALID";
|
|
1529
|
+
orderSide[orderSide["BUY"] = 1] = "BUY";
|
|
1530
|
+
orderSide[orderSide["SELL"] = 2] = "SELL";
|
|
1531
|
+
})(orderSide || (orderSide = {}));
|
|
1532
|
+
|
|
1533
|
+
var logStatus;
|
|
1534
|
+
|
|
1535
|
+
(function (logStatus) {
|
|
1536
|
+
logStatus["CREATE"] = "create";
|
|
1537
|
+
logStatus["UPDATE"] = "update";
|
|
1538
|
+
logStatus["TRANSFER"] = "transfer";
|
|
1539
|
+
logStatus["CANCEL"] = "cancel";
|
|
1540
|
+
logStatus["DELETE"] = "delete";
|
|
1541
|
+
})(logStatus || (logStatus = {}));
|
|
842
1542
|
|
|
843
1543
|
var isSameToken = function isSameToken(token1, token2) {
|
|
844
1544
|
return token1.xtokenSymbol === token2.xtokenSymbol && token1.xtokenPrecision === token2.xtokenPrecision && token1.xtokenContract === token2.xtokenContract;
|
|
845
1545
|
};
|
|
1546
|
+
var median = function median(numbers) {
|
|
1547
|
+
var sorted = numbers.slice().sort(function (a, b) {
|
|
1548
|
+
return a - b;
|
|
1549
|
+
});
|
|
1550
|
+
var middle = Math.floor(sorted.length / 2);
|
|
1551
|
+
|
|
1552
|
+
if (sorted.length % 2 === 0) {
|
|
1553
|
+
return (sorted[middle - 1] + sorted[middle]) / 2;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
return sorted[middle];
|
|
1557
|
+
};
|
|
1558
|
+
|
|
1559
|
+
var INode = function INode(key, data) {
|
|
1560
|
+
this.key = void 0;
|
|
1561
|
+
this.data = {};
|
|
1562
|
+
this.key = key;
|
|
1563
|
+
|
|
1564
|
+
if (data) {
|
|
1565
|
+
this.data = data;
|
|
1566
|
+
}
|
|
1567
|
+
};
|
|
1568
|
+
var ILink = function ILink(from, to, data) {
|
|
1569
|
+
this.from = void 0;
|
|
1570
|
+
this.to = void 0;
|
|
1571
|
+
this.data = {};
|
|
1572
|
+
this.from = from;
|
|
1573
|
+
this.to = to;
|
|
1574
|
+
|
|
1575
|
+
if (data) {
|
|
1576
|
+
this.data = data;
|
|
1577
|
+
}
|
|
1578
|
+
};
|
|
1579
|
+
var Graph = /*#__PURE__*/function () {
|
|
1580
|
+
function Graph() {
|
|
1581
|
+
this.nodes = [];
|
|
1582
|
+
this.links = [];
|
|
1583
|
+
this.lastPathFound = [];
|
|
1584
|
+
|
|
1585
|
+
this.isEquals = function (a, b) {
|
|
1586
|
+
return a.key === b.key;
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
var _proto = Graph.prototype;
|
|
1591
|
+
|
|
1592
|
+
_proto.addNode = function addNode(k, v) {
|
|
1593
|
+
var node = this.findNode(k);
|
|
1594
|
+
|
|
1595
|
+
if (!node) {
|
|
1596
|
+
this.nodes.push(new INode(k, v));
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1600
|
+
_proto.addNodes = function addNodes() {
|
|
1601
|
+
var _this = this;
|
|
1602
|
+
|
|
1603
|
+
for (var _len = arguments.length, nodes = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1604
|
+
nodes[_key] = arguments[_key];
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
nodes.forEach(function (node) {
|
|
1608
|
+
return typeof node === "string" ? _this.addNode(node) : _this.addNode(node[0], node[1]);
|
|
1609
|
+
});
|
|
1610
|
+
};
|
|
1611
|
+
|
|
1612
|
+
_proto.findNode = function findNode(k) {
|
|
1613
|
+
var _this2 = this;
|
|
1614
|
+
|
|
1615
|
+
var inode = new INode(k);
|
|
1616
|
+
return this.nodes.find(function (node) {
|
|
1617
|
+
return _this2.isEquals(node, inode);
|
|
1618
|
+
});
|
|
1619
|
+
};
|
|
1620
|
+
|
|
1621
|
+
_proto.findNodes = function findNodes() {
|
|
1622
|
+
var _this3 = this;
|
|
1623
|
+
|
|
1624
|
+
for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1625
|
+
keys[_key2] = arguments[_key2];
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
return keys.map(function (k) {
|
|
1629
|
+
return _this3.findNode(k);
|
|
1630
|
+
});
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1633
|
+
_proto.requireFindNodes = function requireFindNodes() {
|
|
1634
|
+
var nodes = this.findNodes.apply(this, arguments);
|
|
1635
|
+
|
|
1636
|
+
if (nodes.some(function (n) {
|
|
1637
|
+
return n === undefined;
|
|
1638
|
+
})) {
|
|
1639
|
+
throw new Error('One of the nodes does not exist');
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
return nodes;
|
|
1643
|
+
};
|
|
1644
|
+
|
|
1645
|
+
_proto.addLink = function addLink(nodeA, nodeB, data) {
|
|
1646
|
+
var _this$requireFindNode = this.requireFindNodes(nodeA, nodeB),
|
|
1647
|
+
inodeA = _this$requireFindNode[0],
|
|
1648
|
+
inodeB = _this$requireFindNode[1];
|
|
1649
|
+
|
|
1650
|
+
this.links.push(new ILink(inodeA, inodeB, data));
|
|
1651
|
+
};
|
|
1652
|
+
|
|
1653
|
+
_proto.addLinks = function addLinks() {
|
|
1654
|
+
var _this4 = this;
|
|
1655
|
+
|
|
1656
|
+
for (var _len3 = arguments.length, links = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1657
|
+
links[_key3] = arguments[_key3];
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
links.forEach(function (link) {
|
|
1661
|
+
return _this4.addLink.apply(_this4, link);
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Get all nodes linked
|
|
1666
|
+
* to from `node`.
|
|
1667
|
+
*/
|
|
1668
|
+
;
|
|
1669
|
+
|
|
1670
|
+
_proto.findLinkedNodes = function findLinkedNodes(node) {
|
|
1671
|
+
var _this5 = this;
|
|
1672
|
+
|
|
1673
|
+
return this.links.reduce(function (acc, link) {
|
|
1674
|
+
if (_this5.isEquals(link.from, node)) {
|
|
1675
|
+
acc.push(link.to);
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
return acc;
|
|
1679
|
+
}, []);
|
|
1680
|
+
};
|
|
1681
|
+
|
|
1682
|
+
_proto.findAllPaths = function findAllPaths(from, to) {
|
|
1683
|
+
var _this6 = this;
|
|
1684
|
+
|
|
1685
|
+
var allPaths = [];
|
|
1686
|
+
|
|
1687
|
+
var _this$requireFindNode2 = this.requireFindNodes(from, to),
|
|
1688
|
+
fromNode = _this$requireFindNode2[0],
|
|
1689
|
+
toNode = _this$requireFindNode2[1];
|
|
1690
|
+
|
|
1691
|
+
var path = [fromNode];
|
|
1692
|
+
var seen = new Set();
|
|
1693
|
+
|
|
1694
|
+
var stuck = function stuck(x) {
|
|
1695
|
+
if (_this6.isEquals(x, toNode)) {
|
|
1696
|
+
return false;
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
for (var _iterator = _createForOfIteratorHelperLoose(_this6.findLinkedNodes(x)), _step; !(_step = _iterator()).done;) {
|
|
1700
|
+
var y = _step.value;
|
|
1701
|
+
|
|
1702
|
+
if (!seen.has(y.key)) {
|
|
1703
|
+
seen.add(y.key);
|
|
1704
|
+
|
|
1705
|
+
if (!stuck(y)) {
|
|
1706
|
+
return false;
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
return true;
|
|
1712
|
+
};
|
|
1713
|
+
|
|
1714
|
+
var search = function search(x) {
|
|
1715
|
+
if (_this6.isEquals(x, toNode)) {
|
|
1716
|
+
allPaths.push(cloneDeep(path));
|
|
1717
|
+
return;
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
seen = new Set(path.map(function (p) {
|
|
1721
|
+
return p.key;
|
|
1722
|
+
}));
|
|
1723
|
+
|
|
1724
|
+
if (stuck(x)) {
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.findLinkedNodes(x)), _step2; !(_step2 = _iterator2()).done;) {
|
|
1729
|
+
var y = _step2.value;
|
|
1730
|
+
|
|
1731
|
+
if (!path.includes(y)) {
|
|
1732
|
+
path.push(y);
|
|
1733
|
+
search(y);
|
|
1734
|
+
path.pop();
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
|
|
1739
|
+
search(fromNode);
|
|
1740
|
+
return allPaths;
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1743
|
+
return Graph;
|
|
1744
|
+
}();
|
|
1745
|
+
|
|
1746
|
+
/**
|
|
1747
|
+
* XPR<>XUSDT (XPR -> XUSDT)
|
|
1748
|
+
*
|
|
1749
|
+
* pool1 * pool2
|
|
1750
|
+
* term = pool2 - --------------
|
|
1751
|
+
* pool1 + swap
|
|
1752
|
+
*
|
|
1753
|
+
* result = term - (term * fee)
|
|
1754
|
+
*/
|
|
1755
|
+
|
|
1756
|
+
var compute_transfer = function compute_transfer(pool1, pool2, swap, exchange_fee, precision) {
|
|
1757
|
+
var term1 = pool2;
|
|
1758
|
+
var term2over = pool1.multipliedBy(pool2);
|
|
1759
|
+
var term2under = pool1.plus(swap);
|
|
1760
|
+
var term2 = term2over.dividedBy(term2under).integerValue(BigNumber.ROUND_DOWN);
|
|
1761
|
+
var term = term1.minus(term2);
|
|
1762
|
+
var fee = new BigNumber(exchange_fee).dividedBy(FEE_FACTOR);
|
|
1763
|
+
var result = term.minus(term.multipliedBy(fee));
|
|
1764
|
+
return result.integerValue(BigNumber.ROUND_DOWN).shiftedBy(-precision);
|
|
1765
|
+
};
|
|
1766
|
+
var compute_transfer_curve = function compute_transfer_curve(reserve_in, reserve_out, amount_in, exchange_fee, precision, amplifier) {
|
|
1767
|
+
if (amplifier === 0) {
|
|
1768
|
+
return compute_transfer(new BigNumber(reserve_in), new BigNumber(reserve_out), new BigNumber(amount_in), exchange_fee, precision);
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
var MAX_ITERATIONS = 10;
|
|
1772
|
+
var sum = reserve_in + reserve_out;
|
|
1773
|
+
var D = sum;
|
|
1774
|
+
var D_prev = 0;
|
|
1775
|
+
|
|
1776
|
+
var F = function F(v) {
|
|
1777
|
+
return (v >= 0 ? 1 : -1) * Math.floor(Math.abs(v));
|
|
1778
|
+
};
|
|
1779
|
+
|
|
1780
|
+
var i = MAX_ITERATIONS;
|
|
1781
|
+
|
|
1782
|
+
while (D != D_prev && i--) {
|
|
1783
|
+
var prod1 = F(F(D * D / (reserve_in * 2)) * D / (reserve_out * 2));
|
|
1784
|
+
D_prev = D;
|
|
1785
|
+
D = F(2 * D * (amplifier * sum + prod1) / ((2 * amplifier - 1) * D + 3 * prod1));
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
var b = reserve_in + amount_in + F(D / (amplifier * 2)) - D;
|
|
1789
|
+
var c = F(F(D * D / ((reserve_in + amount_in) * 2)) * D / (amplifier * 4));
|
|
1790
|
+
var x = D,
|
|
1791
|
+
x_prev = 0;
|
|
1792
|
+
i = MAX_ITERATIONS;
|
|
1793
|
+
|
|
1794
|
+
while (x != x_prev && i--) {
|
|
1795
|
+
x_prev = F(x);
|
|
1796
|
+
x = +new BigNumber(x * x + c).dividedBy(2 * x + b).toFixed(0, BigNumber.ROUND_DOWN);
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
if (reserve_out <= x) {
|
|
1800
|
+
throw new Error("curve: insufficient reserve out");
|
|
1801
|
+
} // Amount out + Fee + 1
|
|
1802
|
+
|
|
1803
|
+
|
|
1804
|
+
var amount_out_with_fee = new BigNumber(reserve_out - x); // Fee + 1
|
|
1805
|
+
// +1 covers small precision issues
|
|
1806
|
+
|
|
1807
|
+
var fee = amount_out_with_fee.multipliedBy(exchange_fee).dividedBy(FEE_FACTOR).plus(1).toFixed(0, BigNumber.ROUND_DOWN); // Amount out
|
|
1808
|
+
|
|
1809
|
+
var amount_out = amount_out_with_fee.minus(fee);
|
|
1810
|
+
return amount_out.integerValue(BigNumber.ROUND_DOWN).shiftedBy(-precision);
|
|
1811
|
+
};
|
|
1812
|
+
var compute_liquidity = function compute_liquidity(amount_lt, pool, lt_supply, precision) {
|
|
1813
|
+
var over = amount_lt.multipliedBy(pool);
|
|
1814
|
+
var under = lt_supply;
|
|
1815
|
+
var result = over.dividedBy(under).integerValue(BigNumber.ROUND_DOWN);
|
|
1816
|
+
return +result.shiftedBy(-precision).toFixed(precision, BigNumber.ROUND_DOWN);
|
|
1817
|
+
};
|
|
1818
|
+
var isInputInvalid = function isInputInvalid(data, value, pool) {
|
|
1819
|
+
value = String(value);
|
|
1820
|
+
var isBackspace = data === null;
|
|
1821
|
+
var isNumber = !/[0-9]|\./.test(data);
|
|
1822
|
+
var isDoubleDot = data === '.' && value.indexOf('.') !== value.length - 1;
|
|
1823
|
+
var isPrecisionTooHigh = value && value.indexOf('.') !== -1 && value.split('.')[1].length > pool.xtokenPrecision;
|
|
1824
|
+
var isInvalid = !isBackspace && Boolean(isNumber || isDoubleDot || isPrecisionTooHigh);
|
|
1825
|
+
return isInvalid;
|
|
1826
|
+
};
|
|
1827
|
+
var applyDiscountToFee = function applyDiscountToFee(fee, staked) {
|
|
1828
|
+
if (staked >= 10000000) {
|
|
1829
|
+
return fee * 0;
|
|
1830
|
+
} else if (staked >= 1000000) {
|
|
1831
|
+
return fee * 0.33;
|
|
1832
|
+
} else if (staked >= 100000) {
|
|
1833
|
+
return fee * 0.66;
|
|
1834
|
+
} else {
|
|
1835
|
+
return fee;
|
|
1836
|
+
}
|
|
1837
|
+
};
|
|
846
1838
|
|
|
847
|
-
export { Chains, Networks, Status, WRAP_CONTRACT, accountParser, addressParser, authorizationParser, depositBodyParser, exchangeRateParser, exchangeRatesParser, explorerLinkByChain, generateAddressBodyParser, generateAddressResponse, generateAuthParser, initializeCoins, initializeConstants, isSameToken, otcOrderResponseParser, otcQuoteBodyParser, otcQuoteResponseParser, rateParser,
|
|
1839
|
+
export { Chains, Depth_DTO, ExtendedAssetParser, FEE_FACTOR, GetDepth_DTO, GetOHLCV_DTO, GetOrderHistory_DTO, GetTrades_DTO, Graph, ILink, INode, Networks, OHLCV_DTO, OrderHistory_DTO, Status, Trade_DTO, Type, WRAP_AUTH_ACTION, WRAP_CONTRACT, accountParser, addressParser, applyDiscountToFee, authorizationParser, authorizationsParser, baseActionParser, baseActionSerializedParser, bloksRatesParser, compute_liquidity, compute_transfer, compute_transfer_curve, createAbstractAuthParser, depositBodyParser, exchangeRateParser, exchangeRatesParser, explorerLinkByChain, generateAddressBodyParser, generateAddressResponse, generateAuthParser, initializeCoins, initializeConstants, isInputInvalid, isSameToken, logStatus, median, orderSide, orderType, otcOrderResponseParser, otcQuoteBodyParser, otcQuoteResponseParser, protonExplorerTxUrl, rateParser, similarChains, singleActionTransactionParser, transactionParser, webauthActionParser, withdrawBodyParser, withdrawHistoryMetalResponseParser, withdrawHistoryMetalSwapParser, withdrawMetalResponseParser, withdrawalFeeQuoteParser, wrapParser, wrapSetConfParser, wrapStartParser };
|
|
848
1840
|
//# sourceMappingURL=wrap-constants.esm.js.map
|