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