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