@openocean.finance/openocean-sdk 0.1.65 → 0.1.66
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/lib/index.js +2 -20
- package/package.json +1 -1
- package/lib/api/index.js +0 -136
- package/lib/api/vo/RequestVo.js +0 -401
- package/lib/asset/abi/aggregator.js +0 -391
- package/lib/config/Chains.js +0 -508
- package/lib/config/Wallets.js +0 -81
- package/lib/config/index.js +0 -11
- package/lib/swapSdk/Approve.js +0 -227
- package/lib/swapSdk/ConnectWallet.js +0 -282
- package/lib/swapSdk/NotoMobile.js +0 -141
- package/lib/swapSdk/RequestVo.js +0 -94
- package/lib/swapSdk/Swap.js +0 -739
- package/lib/swapSdk/getAllowance.js +0 -97
- package/lib/swapSdk/getBalance.js +0 -220
- package/lib/swapSdk/index.js +0 -256
- package/lib/swapSdk/qrcode.d.ts +0 -6
- package/lib/swapSdk/qrcode.js +0 -969
- package/lib/utils/ajx.js +0 -150
- package/lib/utils/index.js +0 -91
- package/lib/utils/web3.js +0 -9
package/lib/config/Chains.js
DELETED
|
@@ -1,508 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.chains = exports.Chains = void 0;
|
|
4
|
-
var Wallets_1 = require("./Wallets");
|
|
5
|
-
var utils_1 = require("./../utils");
|
|
6
|
-
var chainObj = {
|
|
7
|
-
"eth": {
|
|
8
|
-
chainName: "Ethereum Mainnet",
|
|
9
|
-
chainId: 1,
|
|
10
|
-
blockExplorerUrl: "https://etherscan.io/tx/",
|
|
11
|
-
nativeCurrency: { name: "ETH", symbol: "eth", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
|
|
12
|
-
popularToken: ["ETH", "USDT", "USDC", "BUSD", "UNI", "C98", "LINK", "MATIC"],
|
|
13
|
-
rpcUrls: [
|
|
14
|
-
"https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"
|
|
15
|
-
],
|
|
16
|
-
compiler: 'EVM'
|
|
17
|
-
},
|
|
18
|
-
"ropsten": {
|
|
19
|
-
chainName: "Ethereum Ropsten",
|
|
20
|
-
chainId: 3,
|
|
21
|
-
blockExplorerUrl: "https://ropsten.etherscan.io/",
|
|
22
|
-
nativeCurrency: { name: "ETH", symbol: "eth", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
|
|
23
|
-
popularToken: ["ETH", "USDT", "USDC", "BUSD", "UNI", "C98", "LINK", "MATIC"],
|
|
24
|
-
rpcUrls: [
|
|
25
|
-
"https://ropsten.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"
|
|
26
|
-
],
|
|
27
|
-
compiler: 'EVM',
|
|
28
|
-
isTest: true
|
|
29
|
-
},
|
|
30
|
-
"rinkeby": {
|
|
31
|
-
chainName: "Ethereum Rinkeby",
|
|
32
|
-
chainId: 4,
|
|
33
|
-
blockExplorerUrl: "https://rinkeby.etherscan.io/",
|
|
34
|
-
nativeCurrency: { name: "ETH", symbol: "eth", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
|
|
35
|
-
popularToken: ["ETH", "USDT", "USDC", "BUSD", "UNI", "C98", "LINK", "MATIC"],
|
|
36
|
-
rpcUrls: [
|
|
37
|
-
"https://rinkeby.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"
|
|
38
|
-
],
|
|
39
|
-
compiler: 'EVM',
|
|
40
|
-
isTest: true
|
|
41
|
-
},
|
|
42
|
-
"bsc": {
|
|
43
|
-
chainName: "Binance Smart Chain", chainId: 56, blockExplorerUrl: "https://bscscan.com/tx/",
|
|
44
|
-
popularToken: ["BNB", "USDT", "BUSD", "CAKE", "C98", "BAKE", "MBOX"],
|
|
45
|
-
nativeCurrency: { name: "BNB", symbol: "bnb", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
|
|
46
|
-
rpcUrls: ["https://bsc-dataseed1.binance.org/"],
|
|
47
|
-
compiler: 'EVM',
|
|
48
|
-
},
|
|
49
|
-
"solana": {
|
|
50
|
-
compiler: 'SOL',
|
|
51
|
-
chainName: "Solana Mainnet", blockExplorerUrl: "https://solscan.io/tx/", popularToken: ["SOL", "SNY", "USDT", "USDC", "RAY", "STEP"], rpcUrls: null
|
|
52
|
-
},
|
|
53
|
-
"flow": {
|
|
54
|
-
compiler: 'FLOW',
|
|
55
|
-
chainName: "Flow Mainnet", blockExplorerUrl: "https://flowscan.org/transaction/", popularToken: ["SOL", "SNY", "USDT", "USDC", "RAY", "STEP"], rpcUrls: null
|
|
56
|
-
},
|
|
57
|
-
"polygon": {
|
|
58
|
-
compiler: 'EVM',
|
|
59
|
-
chainName: "Polygon Mainnet", chainId: 137, blockExplorerUrl: "https://polygonscan.com/tx/", popularToken: ["USDT", "USDC", "MATIC", "AAVE", "DINO", "ADDY", "MIMATIC"], nativeCurrency: { name: "MATIC", symbol: "matic", decimals: 18, address: "0x0000000000000000000000000000000000001010" }, rpcUrls: ["https://rpc-mainnet.maticvigil.com"]
|
|
60
|
-
},
|
|
61
|
-
"avax": {
|
|
62
|
-
compiler: 'EVM',
|
|
63
|
-
chainName: "Avalanche", chainId: 43114, blockExplorerUrl: "https://cchain.explorer.avax.network/tx/", popularToken: ["AVAX", "PNG", "DAI.E", "ETH", "WAVAX", "JOE", "QI", "USDC.E"], nativeCurrency: { name: "AVAX", symbol: "avax", decimals: 18, address: "0x0000000000000000000000000000000000000000" }, rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"]
|
|
64
|
-
},
|
|
65
|
-
"fantom": {
|
|
66
|
-
compiler: 'EVM',
|
|
67
|
-
chainName: "Fantom", chainId: 250, blockExplorerUrl: "https://ftmscan.com/tx/", popularToken: ["ETH", "USDT", "USDC", "SPIRIT", "1INCH", "C98", "FTM", "fUSDT", "MIM", "BOO"], nativeCurrency: { name: "FTM", symbol: "ftm", decimals: 18, address: "0x0000000000000000000000000000000000000000" }, rpcUrls: ["https://rpcapi.fantom.network"]
|
|
68
|
-
},
|
|
69
|
-
"arbitrum": {
|
|
70
|
-
compiler: 'EVM',
|
|
71
|
-
chainName: "Arbitrum", chainId: 42161, blockExplorerUrl: "https://arbiscan.io/tx/", nativeCurrency: { name: "ETH", symbol: "eth", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" }, rpcUrls: ["https://arb1.arbitrum.io/rpc"]
|
|
72
|
-
},
|
|
73
|
-
"terra": {
|
|
74
|
-
compiler: 'TERRA',
|
|
75
|
-
chainName: "Terra Mainnet", blockExplorerUrl: "https://finder.terra.money/columbus-5/tx/", rpcUrls: null
|
|
76
|
-
},
|
|
77
|
-
"xdai": {
|
|
78
|
-
compiler: 'EVM',
|
|
79
|
-
chainName: "Gnosis Mainnet",
|
|
80
|
-
chainId: 100,
|
|
81
|
-
blockExplorerUrl: "https://blockscout.com/poa/xdai/tx/", popularToken: ["ETH", "USDT", "USDC", "BUSD", "1INCH", "C98"],
|
|
82
|
-
nativeCurrency: { name: "xDai", symbol: "xdai", decimals: 18, address: "0x0000000000000000000000000000000000000000" },
|
|
83
|
-
rpcUrls: ["https://rpc.gnosischain.com", "https://rpc.xdaichain.com/"]
|
|
84
|
-
},
|
|
85
|
-
"boba": {
|
|
86
|
-
compiler: 'EVM',
|
|
87
|
-
chainName: "Boba Mainnet", chainId: 288, blockExplorerUrl: "https://blockexplorer.boba.network/tx/", nativeCurrency: { name: "ETH", symbol: "eth", decimals: 18, address: "0x0000000000000000000000000000000000000000" }, rpcUrls: ["https://mainnet.boba.network"]
|
|
88
|
-
},
|
|
89
|
-
"ont": {
|
|
90
|
-
compiler: 'ONT',
|
|
91
|
-
chainName: "Ontology Mainnet", blockExplorerUrl: "https://explorer.ont.io/transaction/", popularToken: [], rpcUrls: null
|
|
92
|
-
},
|
|
93
|
-
"tron": {
|
|
94
|
-
compiler: 'TRON',
|
|
95
|
-
chainName: "Tron Mainnet",
|
|
96
|
-
blockExplorerUrl: "https://tronscan.io/#/transaction/",
|
|
97
|
-
popularToken: ["TRX", "WTRX", "ETH", "BTC", "USDT", "USDJ", "JST"],
|
|
98
|
-
rpcUrls: null
|
|
99
|
-
},
|
|
100
|
-
"heco": {
|
|
101
|
-
compiler: 'EVM',
|
|
102
|
-
chainName: "Heco Mainnet",
|
|
103
|
-
chainId: 128,
|
|
104
|
-
blockExplorerUrl: "https://http-mainnet.hecochain.com/tx/",
|
|
105
|
-
popularToken: ["HT", "ETH", "AAVE", "USDT", "USDC", "MDX", "DEP"],
|
|
106
|
-
nativeCurrency: { name: "HT", symbol: "ht", decimals: 18, address: "0x0000000000000000000000000000000000000000" },
|
|
107
|
-
rpcUrls: ["https://http-mainnet.hecochain.com"]
|
|
108
|
-
},
|
|
109
|
-
"okex": {
|
|
110
|
-
compiler: 'EVM',
|
|
111
|
-
chainName: "OEC Mainnet", chainId: 66, blockExplorerUrl: "https://www.oklink.com/okexchain/", popularToken: ["OKT", "OKB", "USDT", "USDC", "BUSD", "BNB", "CHE"], nativeCurrency: { name: "OKT", symbol: "okt", decimals: 18, address: "0x0000000000000000000000000000000000000000" }, rpcUrls: ["https://exchainrpc.okex.org"]
|
|
112
|
-
},
|
|
113
|
-
"optimism": {
|
|
114
|
-
compiler: 'EVM',
|
|
115
|
-
chainName: "Optimistic Ethereum",
|
|
116
|
-
chainId: 10,
|
|
117
|
-
blockExplorerUrl: "https://optimism.io/tx/",
|
|
118
|
-
nativeCurrency: { name: "OETH", symbol: "oeth", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
|
|
119
|
-
rpcUrls: ["https://rpc.ankr.com/optimism", "https://optimism-mainnet.public.blastapi.io", "https://mainnet.optimism.io"]
|
|
120
|
-
},
|
|
121
|
-
"harmony": {
|
|
122
|
-
compiler: 'EVM',
|
|
123
|
-
chainName: "Harmony",
|
|
124
|
-
chainId: '1666600000',
|
|
125
|
-
blockExplorerUrl: "https://explorer.harmony.one/",
|
|
126
|
-
nativeCurrency: { name: "ONE", symbol: "ONE", decimals: 18, address: "0x0000000000000000000000000000000000000000" },
|
|
127
|
-
popularToken: ["ETH", "USDT", "USDC", "BUSD", "1INCH", "C98"],
|
|
128
|
-
rpcUrls: ["https://api.s0.t.hmny.io", "https://api.harmony.one"]
|
|
129
|
-
},
|
|
130
|
-
"dot": {
|
|
131
|
-
compiler: 'EVM',
|
|
132
|
-
chainName: "Polkadot", blockExplorerUrl: "", popularToken: ["ETH", "USDT", "USDC", "BUSD", "1INCH", "C98"]
|
|
133
|
-
},
|
|
134
|
-
"neo": {
|
|
135
|
-
compiler: 'EVM',
|
|
136
|
-
chainName: "Neo", blockExplorerUrl: "", popularToken: ["ETH", "USDT", "USDC", "BUSD", "1INCH", "C98"]
|
|
137
|
-
},
|
|
138
|
-
"aurora": {
|
|
139
|
-
chainName: "Aurora Mainnet",
|
|
140
|
-
chainId: 1313161554,
|
|
141
|
-
blockExplorerUrl: "https://aurorascan.dev/tx/",
|
|
142
|
-
nativeCurrency: { name: "ETH", symbol: "eth", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
|
|
143
|
-
popularToken: [],
|
|
144
|
-
rpcUrls: [
|
|
145
|
-
"https://mainnet.aurora.dev"
|
|
146
|
-
],
|
|
147
|
-
compiler: 'EVM'
|
|
148
|
-
},
|
|
149
|
-
"cronos": {
|
|
150
|
-
chainName: "Cronos Mainnet",
|
|
151
|
-
chainId: 25,
|
|
152
|
-
blockExplorerUrl: "https://cronos.org/explorer",
|
|
153
|
-
nativeCurrency: {
|
|
154
|
-
name: "CRO",
|
|
155
|
-
symbol: "cro",
|
|
156
|
-
decimals: 18,
|
|
157
|
-
address: "0x0000000000000000000000000000000000000000"
|
|
158
|
-
},
|
|
159
|
-
popularToken: [],
|
|
160
|
-
rpcUrls: [
|
|
161
|
-
"https://evm.cronos.org"
|
|
162
|
-
],
|
|
163
|
-
compiler: 'EVM'
|
|
164
|
-
},
|
|
165
|
-
"moonriver": {
|
|
166
|
-
chainName: "Moonriver Mainnet",
|
|
167
|
-
chainId: 1285,
|
|
168
|
-
blockExplorerUrl: "https://moonriver.moonscan.io",
|
|
169
|
-
nativeCurrency: { name: "ETH", symbol: "eth", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
|
|
170
|
-
popularToken: [],
|
|
171
|
-
rpcUrls: [
|
|
172
|
-
"https://rpc.moonriver.moonbeam.network"
|
|
173
|
-
],
|
|
174
|
-
compiler: 'EVM'
|
|
175
|
-
},
|
|
176
|
-
"bsctest": {
|
|
177
|
-
chainName: "BSC Test Network",
|
|
178
|
-
chainId: 1285,
|
|
179
|
-
blockExplorerUrl: "https://testnet.bscscan.com/",
|
|
180
|
-
nativeCurrency: { name: "BNB", symbol: "bnb", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
|
|
181
|
-
popularToken: [],
|
|
182
|
-
rpcUrls: [
|
|
183
|
-
"https://data-seed-prebsc-1-s1.binance.org:8545"
|
|
184
|
-
],
|
|
185
|
-
compiler: 'EVM'
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
var Chains = /** @class */ (function () {
|
|
189
|
-
function Chains() {
|
|
190
|
-
var _this = this;
|
|
191
|
-
this.ethereumChainParams = {
|
|
192
|
-
rinkeby: [
|
|
193
|
-
{
|
|
194
|
-
chainId: "0x4",
|
|
195
|
-
chainName: "rinkeby",
|
|
196
|
-
key: 'rinkeby',
|
|
197
|
-
nativeCurrency: {
|
|
198
|
-
name: "ETH",
|
|
199
|
-
symbol: "eth",
|
|
200
|
-
decimals: 18,
|
|
201
|
-
},
|
|
202
|
-
rpcUrls: ["https://rinkeby.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"],
|
|
203
|
-
blockExplorerUrls: ["https://rinkeby.etherscan.io"],
|
|
204
|
-
},
|
|
205
|
-
],
|
|
206
|
-
bsc: [
|
|
207
|
-
{
|
|
208
|
-
chainId: "0x38",
|
|
209
|
-
chainName: "BSC Mainnet",
|
|
210
|
-
nativeCurrency: {
|
|
211
|
-
name: "BNB",
|
|
212
|
-
symbol: "bnb",
|
|
213
|
-
decimals: 18,
|
|
214
|
-
},
|
|
215
|
-
rpcUrls: ["https://bsc-dataseed1.binance.org/"],
|
|
216
|
-
blockExplorerUrls: ["https://bscscan.com/"],
|
|
217
|
-
},
|
|
218
|
-
],
|
|
219
|
-
ok: [
|
|
220
|
-
{
|
|
221
|
-
chainId: "0x42",
|
|
222
|
-
chainName: "OEC Mainnet",
|
|
223
|
-
nativeCurrency: {
|
|
224
|
-
name: "OKT",
|
|
225
|
-
symbol: "okt",
|
|
226
|
-
decimals: 18,
|
|
227
|
-
},
|
|
228
|
-
rpcUrls: ["https://exchainrpc.okex.org"],
|
|
229
|
-
blockExplorerUrls: ["https://www.oklink.com/okexchain/"],
|
|
230
|
-
},
|
|
231
|
-
],
|
|
232
|
-
polygon: [
|
|
233
|
-
{
|
|
234
|
-
chainId: "0x89",
|
|
235
|
-
chainName: "Matic Mainnet",
|
|
236
|
-
nativeCurrency: {
|
|
237
|
-
name: "MATIC",
|
|
238
|
-
symbol: "matic",
|
|
239
|
-
decimals: 18,
|
|
240
|
-
},
|
|
241
|
-
rpcUrls: ["https://rpc-mainnet.maticvigil.com"],
|
|
242
|
-
blockExplorerUrls: ["https://polygonscan.com"],
|
|
243
|
-
},
|
|
244
|
-
],
|
|
245
|
-
xdai: [
|
|
246
|
-
{
|
|
247
|
-
chainId: "0x64",
|
|
248
|
-
chainName: "Gnosis Mainnet",
|
|
249
|
-
nativeCurrency: {
|
|
250
|
-
name: "xDai",
|
|
251
|
-
symbol: "xdai",
|
|
252
|
-
decimals: 18,
|
|
253
|
-
},
|
|
254
|
-
rpcUrls: ["https://rpc.gnosischain.com", "https://rpc.xdaichain.com/"],
|
|
255
|
-
blockExplorerUrls: ["https://blockscout.com/poa/xdai", "https://blockscout.com/xdai/mainnet"],
|
|
256
|
-
},
|
|
257
|
-
],
|
|
258
|
-
fantom: [
|
|
259
|
-
{
|
|
260
|
-
chainId: "0xfa",
|
|
261
|
-
chainName: "Fantom Mainnet",
|
|
262
|
-
nativeCurrency: {
|
|
263
|
-
name: "FTM",
|
|
264
|
-
symbol: "ftm",
|
|
265
|
-
decimals: 18,
|
|
266
|
-
},
|
|
267
|
-
rpcUrls: ["https://rpcapi.fantom.network"],
|
|
268
|
-
blockExplorerUrls: ["https://ftmscan.com/"],
|
|
269
|
-
},
|
|
270
|
-
],
|
|
271
|
-
heco: [
|
|
272
|
-
{
|
|
273
|
-
chainId: "0x80",
|
|
274
|
-
chainName: "Heco Mainnet",
|
|
275
|
-
nativeCurrency: {
|
|
276
|
-
name: "HT",
|
|
277
|
-
symbol: "ht",
|
|
278
|
-
decimals: 18,
|
|
279
|
-
},
|
|
280
|
-
rpcUrls: ["https://http-mainnet.hecochain.com"],
|
|
281
|
-
blockExplorerUrls: ["https://http-mainnet.hecochain.com"],
|
|
282
|
-
},
|
|
283
|
-
],
|
|
284
|
-
avax: [
|
|
285
|
-
{
|
|
286
|
-
chainId: "0xa86a",
|
|
287
|
-
chainName: "Avalanche Mainnet C-Chain",
|
|
288
|
-
nativeCurrency: {
|
|
289
|
-
name: "AVAX",
|
|
290
|
-
symbol: "avax",
|
|
291
|
-
decimals: 18,
|
|
292
|
-
},
|
|
293
|
-
rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"],
|
|
294
|
-
blockExplorerUrls: ["https://cchain.explorer.avax.network/"],
|
|
295
|
-
},
|
|
296
|
-
],
|
|
297
|
-
okex: [
|
|
298
|
-
{
|
|
299
|
-
chainId: "0x42",
|
|
300
|
-
chainName: "OEC Mainnet",
|
|
301
|
-
nativeCurrency: {
|
|
302
|
-
name: "OKT",
|
|
303
|
-
symbol: "okt",
|
|
304
|
-
decimals: 18,
|
|
305
|
-
},
|
|
306
|
-
rpcUrls: ["https://exchainrpc.okex.org"],
|
|
307
|
-
blockExplorerUrls: ["https://www.oklink.com/okexchain"],
|
|
308
|
-
},
|
|
309
|
-
],
|
|
310
|
-
harmony: [
|
|
311
|
-
{
|
|
312
|
-
chainId: "0x63564c40",
|
|
313
|
-
chainName: "Harmony Mainnet",
|
|
314
|
-
nativeCurrency: {
|
|
315
|
-
name: "ONE",
|
|
316
|
-
symbol: "one",
|
|
317
|
-
decimals: 18,
|
|
318
|
-
},
|
|
319
|
-
rpcUrls: ["https://api.s0.t.hmny.io", "https://api.harmony.one"],
|
|
320
|
-
blockExplorerUrls: ["https://explorer.harmony.one/"],
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
arbitrum: [
|
|
324
|
-
{
|
|
325
|
-
chainId: "0xa4b1",
|
|
326
|
-
chainName: "Arbitrum One",
|
|
327
|
-
nativeCurrency: {
|
|
328
|
-
name: "ETH",
|
|
329
|
-
symbol: "eth",
|
|
330
|
-
decimals: 18,
|
|
331
|
-
},
|
|
332
|
-
rpcUrls: ["https://arb1.arbitrum.io/rpc"],
|
|
333
|
-
blockExplorerUrls: ["https://arbiscan.io"],
|
|
334
|
-
},
|
|
335
|
-
],
|
|
336
|
-
optimism: [
|
|
337
|
-
{
|
|
338
|
-
chainId: "0xa",
|
|
339
|
-
chainName: "Optimistic Ethereum",
|
|
340
|
-
nativeCurrency: {
|
|
341
|
-
name: "OETH",
|
|
342
|
-
symbol: "oeth",
|
|
343
|
-
decimals: 18,
|
|
344
|
-
},
|
|
345
|
-
rpcUrls: ["https://rpc.ankr.com/optimism", "https://optimism-mainnet.public.blastapi.io", "https://mainnet.optimism.io"],
|
|
346
|
-
blockExplorerUrls: ["https://optimism.io/"],
|
|
347
|
-
},
|
|
348
|
-
],
|
|
349
|
-
boba: [
|
|
350
|
-
{
|
|
351
|
-
chainId: "0x120",
|
|
352
|
-
chainName: "Boba Mainnet",
|
|
353
|
-
nativeCurrency: {
|
|
354
|
-
name: "ETH",
|
|
355
|
-
symbol: "eth",
|
|
356
|
-
decimals: 18,
|
|
357
|
-
},
|
|
358
|
-
rpcUrls: ["https://mainnet.boba.network"],
|
|
359
|
-
blockExplorerUrls: ["https://blockexplorer.boba.network"],
|
|
360
|
-
},
|
|
361
|
-
],
|
|
362
|
-
aurora: [
|
|
363
|
-
{
|
|
364
|
-
chainId: "0x4e454152",
|
|
365
|
-
chainName: "Aurora Mainnet",
|
|
366
|
-
nativeCurrency: {
|
|
367
|
-
name: "ETH",
|
|
368
|
-
symbol: "eth",
|
|
369
|
-
decimals: 18,
|
|
370
|
-
},
|
|
371
|
-
rpcUrls: ["https://mainnet.aurora.dev"],
|
|
372
|
-
blockExplorerUrls: ["https://aurorascan.dev/tx/"],
|
|
373
|
-
},
|
|
374
|
-
],
|
|
375
|
-
cronos: [
|
|
376
|
-
{
|
|
377
|
-
chainId: "0x19",
|
|
378
|
-
chainName: "Cronos Mainnet",
|
|
379
|
-
nativeCurrency: {
|
|
380
|
-
name: "CRO",
|
|
381
|
-
symbol: "cro",
|
|
382
|
-
decimals: 18,
|
|
383
|
-
},
|
|
384
|
-
rpcUrls: ["https://evm.cronos.org"],
|
|
385
|
-
blockExplorerUrls: ["https://cronos.org/explorer"],
|
|
386
|
-
},
|
|
387
|
-
],
|
|
388
|
-
moonriver: [
|
|
389
|
-
{
|
|
390
|
-
chainId: "0x505",
|
|
391
|
-
chainName: "Moonriver Mainnet",
|
|
392
|
-
nativeCurrency: {
|
|
393
|
-
name: "MOVR",
|
|
394
|
-
symbol: "movr",
|
|
395
|
-
decimals: 18,
|
|
396
|
-
},
|
|
397
|
-
rpcUrls: ["https://rpc.moonriver.moonbeam.network"],
|
|
398
|
-
blockExplorerUrls: ["https://moonriver.moonscan.io"],
|
|
399
|
-
},
|
|
400
|
-
],
|
|
401
|
-
bsctest: [
|
|
402
|
-
{
|
|
403
|
-
chainId: "0x61",
|
|
404
|
-
chainName: "BSC Test Network",
|
|
405
|
-
nativeCurrency: {
|
|
406
|
-
name: "BNB",
|
|
407
|
-
symbol: "bnb",
|
|
408
|
-
decimals: 18,
|
|
409
|
-
},
|
|
410
|
-
rpcUrls: ["https://data-seed-prebsc-1-s1.binance.org:8545"],
|
|
411
|
-
blockExplorerUrls: ["https://testnet.bscscan.com/"],
|
|
412
|
-
},
|
|
413
|
-
],
|
|
414
|
-
};
|
|
415
|
-
this.chainObj = {};
|
|
416
|
-
this.chainList = [];
|
|
417
|
-
this.chainIds = [];
|
|
418
|
-
this.chainNames = [];
|
|
419
|
-
this.chainApproveNames = [];
|
|
420
|
-
if (!utils_1.isPc) {
|
|
421
|
-
this.ethereumChainParams.eth = {
|
|
422
|
-
eth: [
|
|
423
|
-
{
|
|
424
|
-
chainId: "0x1",
|
|
425
|
-
chainName: "ethereum",
|
|
426
|
-
key: 'eth',
|
|
427
|
-
nativeCurrency: {
|
|
428
|
-
name: "ETH",
|
|
429
|
-
symbol: "eth",
|
|
430
|
-
decimals: 18,
|
|
431
|
-
},
|
|
432
|
-
rpcUrls: ["https://mainnet.infura.io/v3/"],
|
|
433
|
-
blockExplorerUrls: ["https://etherscan.io"],
|
|
434
|
-
},
|
|
435
|
-
],
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
Wallets_1.wallets.walletList.forEach(function (item) {
|
|
439
|
-
item.supportChains.forEach(function (chainName) {
|
|
440
|
-
if (chainObj[chainName] && chainObj[chainName].wallets) {
|
|
441
|
-
chainObj[chainName].wallets.push(item.key);
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
if (!chainObj[chainName]) {
|
|
445
|
-
chainObj[chainName] = {};
|
|
446
|
-
}
|
|
447
|
-
chainObj[chainName].key = chainName;
|
|
448
|
-
chainObj[chainName].wallets = [item.key];
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
this.chainObj = chainObj;
|
|
453
|
-
this.chainList = Object.keys(chainObj).map(function (key) {
|
|
454
|
-
if (chainObj[key].chainId) {
|
|
455
|
-
_this.chainIds.push(chainObj[key].chainId);
|
|
456
|
-
}
|
|
457
|
-
_this.chainNames.push(key);
|
|
458
|
-
if (chainObj[key].compiler === 'EVM' || chainObj[key].compiler === 'TRON') {
|
|
459
|
-
_this.chainApproveNames.push(key);
|
|
460
|
-
}
|
|
461
|
-
return chainObj[key];
|
|
462
|
-
});
|
|
463
|
-
// console.log(JSON.stringify(this.chainList))
|
|
464
|
-
}
|
|
465
|
-
Chains.prototype.isNativeToken = function (chainName, address) {
|
|
466
|
-
if (this.chainObj[chainName] && this.chainObj[chainName].nativeCurrency && this.chainObj[chainName].nativeCurrency.address) {
|
|
467
|
-
return this.chainObj[chainName].nativeCurrency.address.toUpperCase() === address.toUpperCase();
|
|
468
|
-
}
|
|
469
|
-
return false;
|
|
470
|
-
};
|
|
471
|
-
Chains.prototype.getNativeToken = function (chainName) {
|
|
472
|
-
return this.chainObj[chainName];
|
|
473
|
-
};
|
|
474
|
-
Chains.prototype.getIsNewChain = function () {
|
|
475
|
-
return ['eth', 'bsc', 'xdai', 'boba', 'arbitrum', 'heco', 'moonriver', 'cronos', 'optimism', 'harmony', 'fantom', 'avax', 'polygon', 'okex'];
|
|
476
|
-
};
|
|
477
|
-
Chains.prototype.getChainById = function (chainId) {
|
|
478
|
-
return this.chainList.find(function (item) {
|
|
479
|
-
return item.chainId == chainId;
|
|
480
|
-
});
|
|
481
|
-
};
|
|
482
|
-
Chains.prototype.getChainByName = function (name) {
|
|
483
|
-
return this.chainObj[name] || null;
|
|
484
|
-
};
|
|
485
|
-
Chains.prototype.getProxyContract = function (chainName) {
|
|
486
|
-
return {
|
|
487
|
-
eth: '0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3',
|
|
488
|
-
bsc: "0x7aeef1035ba6794c0478718a2330671ec8802af1",
|
|
489
|
-
fantom: "0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3",
|
|
490
|
-
avax: "0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3",
|
|
491
|
-
polygon: "0x38B7C17E62dcBD1C39f96eFe74848C4A037b3ed3",
|
|
492
|
-
okex: "0x6D5630eC1Ee74C907617a6fb7BCAdC4Bf0EF3fcA",
|
|
493
|
-
optimism: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
494
|
-
harmony: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
495
|
-
cronos: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
496
|
-
moonriver: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
497
|
-
arbitrum: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
498
|
-
heco: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
499
|
-
boba: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
500
|
-
xdai: "0x7AeEF1035Ba6794C0478718a2330671Ec8802aF1",
|
|
501
|
-
tron: "TTpcMZbsojNCMhea2a9LFHq9DLCxsgGZVv",
|
|
502
|
-
}[chainName];
|
|
503
|
-
};
|
|
504
|
-
;
|
|
505
|
-
return Chains;
|
|
506
|
-
}());
|
|
507
|
-
exports.Chains = Chains;
|
|
508
|
-
exports.chains = new Chains();
|
package/lib/config/Wallets.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wallets = exports.Wallets = exports.WalletNames = void 0;
|
|
4
|
-
var wallet_1 = require("@openocean.finance/wallet");
|
|
5
|
-
var WalletNames;
|
|
6
|
-
(function (WalletNames) {
|
|
7
|
-
WalletNames[WalletNames["MetaMask"] = 0] = "MetaMask";
|
|
8
|
-
WalletNames[WalletNames["WalletConnect"] = 1] = "WalletConnect";
|
|
9
|
-
WalletNames[WalletNames["BscWallet"] = 2] = "BscWallet";
|
|
10
|
-
WalletNames[WalletNames["Cyano"] = 3] = "Cyano";
|
|
11
|
-
WalletNames[WalletNames["OntoMobile"] = 4] = "OntoMobile";
|
|
12
|
-
WalletNames[WalletNames["TronLink"] = 5] = "TronLink";
|
|
13
|
-
WalletNames[WalletNames["Sollet"] = 6] = "Sollet";
|
|
14
|
-
WalletNames[WalletNames["SolflareWallet"] = 7] = "SolflareWallet";
|
|
15
|
-
WalletNames[WalletNames["TrustWallet"] = 8] = "TrustWallet";
|
|
16
|
-
WalletNames[WalletNames["MathWallet"] = 9] = "MathWallet";
|
|
17
|
-
WalletNames[WalletNames["TokenPocket"] = 10] = "TokenPocket";
|
|
18
|
-
WalletNames[WalletNames["SafePalWallet"] = 11] = "SafePalWallet";
|
|
19
|
-
WalletNames[WalletNames["OntoWallet"] = 12] = "OntoWallet";
|
|
20
|
-
WalletNames[WalletNames["Coin98Wallet"] = 13] = "Coin98Wallet";
|
|
21
|
-
WalletNames[WalletNames["ImTokenWallet"] = 14] = "ImTokenWallet";
|
|
22
|
-
WalletNames[WalletNames["Phantom"] = 15] = "Phantom";
|
|
23
|
-
WalletNames[WalletNames["TerraStation"] = 16] = "TerraStation";
|
|
24
|
-
WalletNames[WalletNames["CoinbaseWallet"] = 17] = "CoinbaseWallet";
|
|
25
|
-
WalletNames[WalletNames["GnosisSafeWallet"] = 18] = "GnosisSafeWallet";
|
|
26
|
-
WalletNames[WalletNames["BitKeepWallet"] = 19] = "BitKeepWallet";
|
|
27
|
-
WalletNames[WalletNames["CloverWallet"] = 20] = "CloverWallet";
|
|
28
|
-
WalletNames[WalletNames["CryptoCom"] = 21] = "CryptoCom";
|
|
29
|
-
WalletNames[WalletNames["BraveWallet"] = 22] = "BraveWallet";
|
|
30
|
-
WalletNames[WalletNames["XDEFIWallet"] = 23] = "XDEFIWallet";
|
|
31
|
-
WalletNames[WalletNames["MetaXWallet"] = 24] = "MetaXWallet";
|
|
32
|
-
WalletNames[WalletNames["SlopeWallet"] = 25] = "SlopeWallet";
|
|
33
|
-
WalletNames[WalletNames["KeplrWallet"] = 26] = "KeplrWallet";
|
|
34
|
-
WalletNames[WalletNames["BloctoWallet"] = 27] = "BloctoWallet";
|
|
35
|
-
})(WalletNames = exports.WalletNames || (exports.WalletNames = {}));
|
|
36
|
-
var WalletObj = {
|
|
37
|
-
MetaMask: new wallet_1.MetaMask(),
|
|
38
|
-
TrustWallet: new wallet_1.TrustWallet(),
|
|
39
|
-
BraveWallet: new wallet_1.BraveWallet(),
|
|
40
|
-
BscWallet: new wallet_1.BscWallet(),
|
|
41
|
-
WalletConnect: new wallet_1.WalletConnect(),
|
|
42
|
-
CoinbaseWallet: new wallet_1.CoinbaseWallet(),
|
|
43
|
-
SafePalWallet: new wallet_1.SafePalWallet(),
|
|
44
|
-
BitKeepWallet: new wallet_1.BitKeepWallet(),
|
|
45
|
-
XDEFIWallet: new wallet_1.XDEFIWallet(),
|
|
46
|
-
OntoWallet: new wallet_1.OntoWallet(),
|
|
47
|
-
Coin98Wallet: new wallet_1.Coin98(),
|
|
48
|
-
TokenPocket: new wallet_1.TokenPocket(),
|
|
49
|
-
CloverWallet: new wallet_1.CloverWallet(),
|
|
50
|
-
ImTokenWallet: new wallet_1.ImTokenWallet(),
|
|
51
|
-
MetaXWallet: new wallet_1.MetaXWallet(),
|
|
52
|
-
MathWallet: new wallet_1.MathWallet(),
|
|
53
|
-
CryptoCom: new wallet_1.CryptoCom(),
|
|
54
|
-
Cyano: new wallet_1.Cyano(),
|
|
55
|
-
OntoMobile: new wallet_1.OntoMobile(),
|
|
56
|
-
TronLink: new wallet_1.TronLink(),
|
|
57
|
-
Sollet: new wallet_1.Sollet(),
|
|
58
|
-
SolflareWallet: new wallet_1.SolflareWallet(),
|
|
59
|
-
Phantom: new wallet_1.Phantom(),
|
|
60
|
-
TerraStation: new wallet_1.TerraStation(),
|
|
61
|
-
GnosisSafeWallet: new wallet_1.GnosisSafeWallet(),
|
|
62
|
-
SlopeWallet: new wallet_1.SlopeWallet(),
|
|
63
|
-
KeplrWallet: new wallet_1.KeplrWallet(),
|
|
64
|
-
BloctoWallet: new wallet_1.BloctoWallet()
|
|
65
|
-
};
|
|
66
|
-
var Wallets = /** @class */ (function () {
|
|
67
|
-
function Wallets() {
|
|
68
|
-
this.walletObj = {};
|
|
69
|
-
this.walletList = [];
|
|
70
|
-
WalletObj.MetaMask.supportChains.push('rinkeby');
|
|
71
|
-
WalletObj.MetaMask.supportChains.push('ropsten');
|
|
72
|
-
this.walletObj = WalletObj;
|
|
73
|
-
this.walletList = Object.keys(WalletObj).map(function (key) {
|
|
74
|
-
WalletObj[key].key = key;
|
|
75
|
-
return WalletObj[key];
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return Wallets;
|
|
79
|
-
}());
|
|
80
|
-
exports.Wallets = Wallets;
|
|
81
|
-
exports.wallets = new Wallets();
|
package/lib/config/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.config = exports.ERC20_abi = void 0;
|
|
4
|
-
var Wallets_1 = require("./Wallets");
|
|
5
|
-
var Chains_1 = require("./Chains");
|
|
6
|
-
exports.ERC20_abi = [{ "constant": true, "inputs": [], "name": "name", "outputs": [{ "name": "", "type": "string" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "_spender", "type": "address" }, { "name": "_value", "type": "uint256" }], "name": "approve", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [{ "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "_from", "type": "address" }, { "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" }], "name": "transferFrom", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "decimals", "outputs": [{ "name": "", "type": "uint8" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [{ "name": "_owner", "type": "address" }], "name": "balanceOf", "outputs": [{ "name": "balance", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "symbol", "outputs": [{ "name": "", "type": "string" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" }], "name": "transfer", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [{ "name": "_owner", "type": "address" }, { "name": "_spender", "type": "address" }], "name": "allowance", "outputs": [{ "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "owner", "type": "address" }, { "indexed": true, "name": "spender", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" }], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "from", "type": "address" }, { "indexed": true, "name": "to", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" }], "name": "Transfer", "type": "event" }];
|
|
7
|
-
exports.config = {
|
|
8
|
-
chains: Chains_1.chains,
|
|
9
|
-
wallets: Wallets_1.wallets,
|
|
10
|
-
ERC20_abi: exports.ERC20_abi
|
|
11
|
-
};
|