@openocean.finance/wallet 1.2.6 → 1.2.8

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/Chains.d.ts CHANGED
@@ -1,12 +1,11 @@
1
- declare const EthereumChainParams: any;
2
1
  interface Chain {
3
2
  chainName: string;
4
3
  chainId: string | number;
5
4
  key: string;
6
5
  blockExplorerUrl: string;
7
6
  nativeCurrency: any;
8
- popularToken: [];
9
- rpcUrls: [];
7
+ popularToken: [any];
8
+ rpcUrls: [any];
10
9
  compiler: string;
11
10
  }
12
11
  declare class Chains {
@@ -23,4 +22,4 @@ declare class Chains {
23
22
  isNativeToken(chainName: string, address: string): boolean;
24
23
  }
25
24
  declare const chainsObj: Chains;
26
- export { chainsObj, Chains, Chain, EthereumChainParams };
25
+ export { chainsObj, Chains, Chain };
package/lib/Chains.js CHANGED
@@ -1,311 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EthereumChainParams = exports.Chains = exports.chainsObj = void 0;
3
+ exports.Chains = exports.chainsObj = void 0;
4
4
  var index_1 = require("./Wallets/index");
5
- var util_1 = require("./util");
6
- var EthereumChainParams = {
7
- rinkeby: [
8
- {
9
- chainId: "0x4",
10
- chainName: "rinkeby",
11
- key: 'rinkeby',
12
- nativeCurrency: {
13
- name: "ETH",
14
- symbol: "ETH",
15
- decimals: 18,
16
- },
17
- rpcUrls: ["https://rinkeby.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"],
18
- blockExplorerUrls: ["https://rinkeby.etherscan.io"],
19
- },
20
- ],
21
- bsc: [
22
- {
23
- chainId: "0x38",
24
- chainName: "Binance Smart Chain Mainnet",
25
- nativeCurrency: {
26
- name: "BNB",
27
- symbol: "BNB",
28
- decimals: 18,
29
- },
30
- rpcUrls: ["https://bsc-dataseed1.binance.org"],
31
- blockExplorerUrls: ["https://bscscan.com/"],
32
- },
33
- ],
34
- ok: [
35
- {
36
- chainId: "0x42",
37
- chainName: "OEC Mainnet",
38
- nativeCurrency: {
39
- name: "OKT",
40
- symbol: "OKT",
41
- decimals: 18,
42
- },
43
- rpcUrls: ["https://exchainrpc.okex.org"],
44
- blockExplorerUrls: ["https://www.oklink.com/okexchain/"],
45
- },
46
- ],
47
- polygon: [
48
- {
49
- chainId: "0x89",
50
- chainName: "Polygon Mainnet",
51
- nativeCurrency: {
52
- name: "MATIC",
53
- symbol: "MATIC",
54
- decimals: 18,
55
- },
56
- rpcUrls: ["https://polygon-rpc.com/"],
57
- blockExplorerUrls: ["https://polygonscan.com"],
58
- },
59
- ],
60
- xdai: [
61
- {
62
- chainId: "0x64",
63
- chainName: "Gnosis Mainnet",
64
- nativeCurrency: {
65
- name: "xDai",
66
- symbol: "XDAI",
67
- decimals: 18,
68
- },
69
- rpcUrls: ["https://rpc.gnosischain.com", "https://rpc.xdaichain.com/"],
70
- blockExplorerUrls: ["https://blockscout.com/poa/xdai", "https://blockscout.com/xdai/mainnet"],
71
- },
72
- ],
73
- fantom: [
74
- {
75
- chainId: "0xfa",
76
- chainName: "Fantom Mainnet",
77
- nativeCurrency: {
78
- name: "FTM",
79
- symbol: "FTM",
80
- decimals: 18,
81
- },
82
- rpcUrls: ["https://rpcapi.fantom.network"],
83
- blockExplorerUrls: ["https://ftmscan.com/"],
84
- },
85
- ],
86
- heco: [
87
- {
88
- chainId: "0x80",
89
- chainName: "Heco Mainnet",
90
- nativeCurrency: {
91
- name: "HT",
92
- symbol: "HT",
93
- decimals: 18,
94
- },
95
- rpcUrls: ["https://http-mainnet.hecochain.com"],
96
- blockExplorerUrls: ["https://http-mainnet.hecochain.com"],
97
- },
98
- ],
99
- avax: [
100
- {
101
- chainId: "0xa86a",
102
- chainName: "Avalanche Mainnet C-Chain",
103
- nativeCurrency: {
104
- name: "AVAX",
105
- symbol: "AVAX",
106
- decimals: 18,
107
- },
108
- rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"],
109
- blockExplorerUrls: ["https://cchain.explorer.avax.network/"],
110
- },
111
- ],
112
- okex: [
113
- {
114
- chainId: "0x42",
115
- chainName: "OEC Mainnet",
116
- nativeCurrency: {
117
- name: "OKT",
118
- symbol: "OKT",
119
- decimals: 18,
120
- },
121
- rpcUrls: ["https://exchainrpc.okex.org"],
122
- blockExplorerUrls: ["https://www.oklink.com/okexchain"],
123
- },
124
- ],
125
- harmony: [
126
- {
127
- chainId: "0x63564c40",
128
- chainName: "Harmony Mainnet",
129
- nativeCurrency: {
130
- name: "ONE",
131
- symbol: "ONE",
132
- decimals: 18,
133
- },
134
- rpcUrls: ["https://api.s0.t.hmny.io", "https://api.harmony.one"],
135
- blockExplorerUrls: ["https://explorer.harmony.one/"],
136
- },
137
- ],
138
- ontevm: [
139
- {
140
- chainId: "0x3a",
141
- chainName: "Ontology EVM",
142
- nativeCurrency: {
143
- name: "ONG",
144
- symbol: "ONG",
145
- decimals: 18,
146
- },
147
- rpcUrls: ["https://dappnode1.ont.io:10339"],
148
- blockExplorerUrls: ["https://explorer.ont.io"],
149
- },
150
- ],
151
- metis: [
152
- {
153
- chainId: "0x440",
154
- chainName: "Andromeda (Metis)",
155
- nativeCurrency: {
156
- name: "METIS",
157
- symbol: "METIS",
158
- decimals: 18,
159
- },
160
- rpcUrls: ["https://andromeda.metis.io/?owner=1088"],
161
- blockExplorerUrls: ["https://andromeda-explorer.metis.io"],
162
- },
163
- ],
164
- arbitrum: [
165
- {
166
- chainId: "0xa4b1",
167
- chainName: "Arbitrum One",
168
- nativeCurrency: {
169
- name: "ETH",
170
- symbol: "ETH",
171
- decimals: 18,
172
- },
173
- rpcUrls: ["https://arb1.arbitrum.io/rpc"],
174
- blockExplorerUrls: ["https://arbiscan.io"],
175
- },
176
- ],
177
- optimism: [
178
- {
179
- chainId: "0xa",
180
- chainName: "optimism",
181
- nativeCurrency: {
182
- name: "ETH",
183
- symbol: "ETH",
184
- decimals: 18,
185
- },
186
- rpcUrls: ["https://rpc.ankr.com/optimism", "https://optimism-mainnet.public.blastapi.io", "https://mainnet.optimism.io"],
187
- blockExplorerUrls: ["https://optimism.io/"],
188
- },
189
- ],
190
- boba: [
191
- {
192
- chainId: "0x120",
193
- chainName: "Boba Mainnet",
194
- nativeCurrency: {
195
- name: "ETH",
196
- symbol: "ETH",
197
- decimals: 18,
198
- },
199
- rpcUrls: ["https://mainnet.boba.network"],
200
- blockExplorerUrls: ["https://blockexplorer.boba.network"],
201
- },
202
- ],
203
- aurora: [
204
- {
205
- chainId: "0x4e454152",
206
- chainName: "Aurora Mainnet",
207
- nativeCurrency: {
208
- name: "ETH",
209
- symbol: "ETH",
210
- decimals: 18,
211
- },
212
- rpcUrls: ["https://mainnet.aurora.dev"],
213
- blockExplorerUrls: ["https://aurorascan.dev/tx/"],
214
- },
215
- ],
216
- cronos: [
217
- {
218
- chainId: "0x19",
219
- chainName: "Cronos Mainnet",
220
- nativeCurrency: {
221
- name: "CRO",
222
- symbol: "CRO",
223
- decimals: 18,
224
- },
225
- rpcUrls: ["https://evm.cronos.org"],
226
- blockExplorerUrls: ["https://cronos.org/explorer"],
227
- },
228
- ],
229
- moonriver: [
230
- {
231
- chainId: "0x505",
232
- chainName: "Moonriver Mainnet",
233
- nativeCurrency: {
234
- name: "MOVR",
235
- symbol: "MOVR",
236
- decimals: 18,
237
- },
238
- rpcUrls: ["https://rpc.moonriver.moonbeam.network"],
239
- blockExplorerUrls: ["https://moonriver.moonscan.io"],
240
- },
241
- ],
242
- bsctest: [
243
- {
244
- chainId: "0x61",
245
- chainName: "BSC Test Network",
246
- nativeCurrency: {
247
- name: "BNB",
248
- symbol: "BNB",
249
- decimals: 18,
250
- },
251
- rpcUrls: ["https://data-seed-prebsc-1-s1.binance.org:8545"],
252
- blockExplorerUrls: ["https://testnet.bscscan.com/"],
253
- },
254
- ],
255
- kava: [
256
- {
257
- chainId: "0x8ae",
258
- chainName: "Kava EVM",
259
- nativeCurrency: {
260
- name: "KAVA",
261
- symbol: "KAVA",
262
- decimals: 18,
263
- },
264
- rpcUrls: ["https://evm.kava.io"],
265
- blockExplorerUrls: ["https://explorer.kava.io"],
266
- },
267
- ],
268
- celo: [
269
- {
270
- chainId: "0xa4ec",
271
- chainName: "Celo Network",
272
- nativeCurrency: {
273
- name: "CELO",
274
- symbol: "CELO",
275
- decimals: 18,
276
- },
277
- rpcUrls: ["https://forno.celo.org"],
278
- blockExplorerUrls: ["https://explorer.celo.org"],
279
- },
280
- ],
281
- klaytn: [
282
- {
283
- chainId: "0x2019",
284
- chainName: "Klaytn Cypress",
285
- nativeCurrency: {
286
- name: "KLAY",
287
- symbol: "KLAY",
288
- decimals: 18,
289
- },
290
- rpcUrls: ["https://public-node-api.klaytnapi.com/v1/cypress"],
291
- blockExplorerUrls: ["https://scope.klaytn.com"],
292
- },
293
- ],
294
- zksync: [
295
- {
296
- chainId: "0x144",
297
- chainName: "zkSync Era Mainnet",
298
- nativeCurrency: {
299
- name: "Ethereum",
300
- symbol: "ETH",
301
- decimals: 18,
302
- },
303
- rpcUrls: ["https://mainnet.era.zksync.io"],
304
- blockExplorerUrls: ["https://explorer.zksync.io"],
305
- },
306
- ],
307
- };
308
- exports.EthereumChainParams = EthereumChainParams;
309
5
  var chainObj = {
310
6
  "eth": {
311
7
  chainName: "Ethereum Mainnet",
@@ -318,30 +14,30 @@ var chainObj = {
318
14
  ],
319
15
  compiler: 'EVM'
320
16
  },
321
- "ropsten": {
322
- chainName: "Ethereum Ropsten",
323
- chainId: 3,
324
- blockExplorerUrl: "https://ropsten.etherscan.io/",
325
- nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
326
- popularToken: ["ETH", "USDT", "USDC", "BUSD", "UNI", "C98", "LINK", "MATIC"],
327
- rpcUrls: [
328
- "https://ropsten.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"
329
- ],
330
- compiler: 'EVM',
331
- isTest: true
332
- },
333
- "rinkeby": {
334
- chainName: "Ethereum Rinkeby",
335
- chainId: 4,
336
- blockExplorerUrl: "https://rinkeby.etherscan.io/",
337
- nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
338
- popularToken: ["ETH", "USDT", "USDC", "BUSD", "UNI", "C98", "LINK", "MATIC"],
339
- rpcUrls: [
340
- "https://rinkeby.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"
341
- ],
342
- compiler: 'EVM',
343
- isTest: true
344
- },
17
+ // "ropsten": {
18
+ // chainName: "Ethereum Ropsten",
19
+ // chainId: 3,
20
+ // blockExplorerUrl: "https://ropsten.etherscan.io/",
21
+ // nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
22
+ // popularToken: ["ETH", "USDT", "USDC", "BUSD", "UNI", "C98", "LINK", "MATIC"],
23
+ // rpcUrls: [
24
+ // "https://ropsten.infura.io/v3"
25
+ // ],
26
+ // compiler: 'EVM',
27
+ // isTest: true
28
+ // },
29
+ // "rinkeby": {
30
+ // chainName: "Ethereum Rinkeby",
31
+ // chainId: 4,
32
+ // blockExplorerUrl: "https://rinkeby.etherscan.io/",
33
+ // nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
34
+ // popularToken: ["ETH", "USDT", "USDC", "BUSD", "UNI", "C98", "LINK", "MATIC"],
35
+ // rpcUrls: [
36
+ // "https://rinkeby.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"
37
+ // ],
38
+ // compiler: 'EVM',
39
+ // isTest: true
40
+ // },
345
41
  "bsc": {
346
42
  chainName: "Binance Smart Chain", chainId: 56, blockExplorerUrl: "https://bscscan.com/tx/",
347
43
  popularToken: ["BNB", "USDT", "BUSD", "CAKE", "C98", "BAKE", "MBOX"],
@@ -351,31 +47,38 @@ var chainObj = {
351
47
  },
352
48
  "solana": {
353
49
  compiler: 'SOL',
354
- chainName: "Solana Mainnet", blockExplorerUrl: "https://solscan.io/tx/", popularToken: ["SOL", "SNY", "USDT", "USDC", "RAY", "STEP"], rpcUrls: null
50
+ chainName: "Solana Mainnet", blockExplorerUrl: "https://solscan.io/tx/", popularToken: ["SOL", "SNY", "USDT", "USDC", "RAY", "STEP"],
51
+ rpcUrls: null
355
52
  },
356
53
  "flow": {
357
54
  compiler: 'FLOW',
358
- chainName: "Flow Mainnet", blockExplorerUrl: "https://flowscan.org/transaction/", popularToken: ["SOL", "SNY", "USDT", "USDC", "RAY", "STEP"], rpcUrls: null
55
+ chainName: "Flow Mainnet", blockExplorerUrl: "https://flowscan.org/transaction/", popularToken: ["SOL", "SNY", "USDT", "USDC", "RAY", "STEP"],
56
+ rpcUrls: null
359
57
  },
360
58
  "polygon": {
361
59
  compiler: 'EVM',
362
- 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
+ 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" },
61
+ rpcUrls: ["https://rpc-mainnet.maticvigil.com"]
363
62
  },
364
63
  "avax": {
365
64
  compiler: 'EVM',
366
- 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"]
65
+ 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" },
66
+ rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"]
367
67
  },
368
68
  "fantom": {
369
69
  compiler: 'EVM',
370
- 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"]
70
+ 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" },
71
+ rpcUrls: ["https://rpcapi.fantom.network"]
371
72
  },
372
73
  "arbitrum": {
373
74
  compiler: 'EVM',
374
- chainName: "Arbitrum", chainId: 42161, blockExplorerUrl: "https://arbiscan.io/tx/", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" }, rpcUrls: ["https://arb1.arbitrum.io/rpc"]
75
+ chainName: "Arbitrum", chainId: 42161, blockExplorerUrl: "https://arbiscan.io/tx/", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18, address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" },
76
+ rpcUrls: ["https://arb1.arbitrum.io/rpc"]
375
77
  },
376
78
  "terra": {
377
79
  compiler: 'TERRA',
378
- chainName: "Terra Mainnet", blockExplorerUrl: "https://finder.terra.money/columbus-5/tx/", rpcUrls: null
80
+ chainName: "Terra Mainnet", blockExplorerUrl: "https://finder.terra.money/columbus-5/tx/",
81
+ rpcUrls: null
379
82
  },
380
83
  "xdai": {
381
84
  compiler: 'EVM',
@@ -387,19 +90,23 @@ var chainObj = {
387
90
  },
388
91
  "boba": {
389
92
  compiler: 'EVM',
390
- 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"]
93
+ chainName: "Boba Mainnet", chainId: 288, blockExplorerUrl: "https://blockexplorer.boba.network/tx/", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18, address: "0x0000000000000000000000000000000000000000" },
94
+ rpcUrls: ["https://mainnet.boba.network"]
391
95
  },
392
96
  "ont": {
393
97
  compiler: 'ONT',
394
- chainName: "Ontology Mainnet", blockExplorerUrl: "https://explorer.ont.io/transaction/", popularToken: [], rpcUrls: null
98
+ chainName: "Ontology Mainnet", blockExplorerUrl: "https://explorer.ont.io/transaction/", popularToken: [],
99
+ rpcUrls: null
395
100
  },
396
101
  "ontevm": {
397
102
  compiler: 'EVM',
398
- chainName: "Ontology Evm", chainId: 58, blockExplorerUrl: "https://explorer.ont.io/transaction/", nativeCurrency: { name: "ONG", symbol: "ONG", decimals: 18, address: "0x0000000000000000000000000000000000000000" }, rpcUrls: ["https://dappnode10.ont.io:10339"]
103
+ chainName: "Ontology Evm", chainId: 58, blockExplorerUrl: "https://explorer.ont.io/transaction/", nativeCurrency: { name: "ONG", symbol: "ONG", decimals: 18, address: "0x0000000000000000000000000000000000000000" },
104
+ rpcUrls: ["https://dappnode10.ont.io:10339"]
399
105
  },
400
106
  "metis": {
401
107
  compiler: 'EVM',
402
- chainName: "Andromeda (Metis)", chainId: 1088, blockExplorerUrl: "https://andromeda-explorer.metis.io/tx/", nativeCurrency: { name: "METIS", symbol: "METIS", decimals: 18, address: "0x0000000000000000000000000000000000000000" }, rpcUrls: ["https://andromeda.metis.io/?owner=1088"]
108
+ chainName: "Andromeda (Metis)", chainId: 1088, blockExplorerUrl: "https://andromeda-explorer.metis.io/tx/", nativeCurrency: { name: "METIS", symbol: "METIS", decimals: 18, address: "0x0000000000000000000000000000000000000000" },
109
+ rpcUrls: ["https://andromeda.metis.io/?owner=1088"]
403
110
  },
404
111
  "tron": {
405
112
  compiler: 'TRON',
@@ -419,7 +126,8 @@ var chainObj = {
419
126
  },
420
127
  "okex": {
421
128
  compiler: 'EVM',
422
- 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"]
129
+ 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" },
130
+ rpcUrls: ["https://exchainrpc.okex.org"]
423
131
  },
424
132
  "optimism": {
425
133
  compiler: 'EVM',
@@ -587,24 +295,6 @@ var Chains = /** @class */ (function () {
587
295
  this.chainIds = [];
588
296
  this.chainNames = [];
589
297
  this.chainApproveNames = [];
590
- if (!util_1.isPc) {
591
- EthereumChainParams.eth = {
592
- eth: [
593
- {
594
- chainId: "0x1",
595
- chainName: "ethereum",
596
- key: 'eth',
597
- nativeCurrency: {
598
- name: "ETH",
599
- symbol: "ETH",
600
- decimals: 18,
601
- },
602
- rpcUrls: ["https://mainnet.infura.io/v3/"],
603
- blockExplorerUrls: ["https://etherscan.io"],
604
- },
605
- ],
606
- };
607
- }
608
298
  index_1.walletsObj.walletList.forEach(function (item) {
609
299
  item.supportChains.forEach(function (chainName) {
610
300
  if (chainObj[chainName] && chainObj[chainName].wallets) {
@@ -62,7 +62,7 @@ function isChainIdEq(wallet, chainId, utilsEht, k) {
62
62
  wallet.chainId = chainId;
63
63
  return [2 /*return*/, true];
64
64
  case 2:
65
- if (!(key < 3)) return [3 /*break*/, 4];
65
+ if (!(key < 4)) return [3 /*break*/, 4];
66
66
  return [4 /*yield*/, isChainIdEq(wallet, chainId, utilsEht, key + 1)];
67
67
  case 3: return [2 /*return*/, _a.sent()];
68
68
  case 4: throw new Error('User rejected the request.');
@@ -218,7 +218,7 @@ function link(reqConnectWalletVo, chain) {
218
218
  throw new Error('No Switch');
219
219
  }
220
220
  if (!(message === "40006" && currentProvider)) return [3 /*break*/, 28];
221
- return [4 /*yield*/, linkAddOrSwitch(reqConnectWalletVo, wallet, chainId)];
221
+ return [4 /*yield*/, linkAddOrSwitch(wallet, chain)];
222
222
  case 27: return [2 /*return*/, _c.sent()];
223
223
  case 28: throw new Error(message);
224
224
  case 29: return [3 /*break*/, 30];
@@ -227,21 +227,28 @@ function link(reqConnectWalletVo, chain) {
227
227
  });
228
228
  });
229
229
  }
230
- function linkAddOrSwitch(reqConnectWalletVo, wallet, chainId) {
230
+ function linkAddOrSwitch(wallet, chain) {
231
231
  return __awaiter(this, void 0, void 0, function () {
232
- var _a, currentProvider, utilsEht, params, address, address, switchError_1, address, address, error_1, address, address;
232
+ var _a, currentProvider, utilsEht, chainId, params, address, address, switchError_1, address, address, error_1;
233
233
  return __generator(this, function (_b) {
234
234
  switch (_b.label) {
235
235
  case 0:
236
236
  _a = wallet.sdk || {}, currentProvider = _a.currentProvider, utilsEht = _a.utils;
237
- params = Chains_1.EthereumChainParams[reqConnectWalletVo.chain];
238
- if (!params) return [3 /*break*/, 23];
237
+ chainId = chain.chainId + '';
238
+ if (!chain) return [3 /*break*/, 23];
239
+ params = {
240
+ chainId: utilsEht.toHex(chainId),
241
+ chainName: chain.chainName,
242
+ nativeCurrency: chain.nativeCurrency,
243
+ rpcUrls: chain.rpcUrls,
244
+ blockExplorerUrls: [chain.blockExplorerUrl],
245
+ };
239
246
  _b.label = 1;
240
247
  case 1:
241
248
  _b.trys.push([1, 9, , 22]);
242
249
  return [4 /*yield*/, currentProvider.request({
243
250
  method: 'wallet_switchEthereumChain',
244
- params: [{ chainId: params[0].chainId }],
251
+ params: [{ chainId: params.chainId }],
245
252
  })];
246
253
  case 2:
247
254
  _b.sent();
@@ -265,13 +272,14 @@ function linkAddOrSwitch(reqConnectWalletVo, wallet, chainId) {
265
272
  switchError_1 = _b.sent();
266
273
  console.log('wallet_switchEthereumChain errer');
267
274
  console.log(JSON.stringify(switchError_1));
275
+ console.log(params);
268
276
  if (!(switchError_1.code === 4902 || (switchError_1.data && switchError_1.data.originalError && switchError_1.data.originalError.code == 4902))) return [3 /*break*/, 20];
269
277
  _b.label = 10;
270
278
  case 10:
271
279
  _b.trys.push([10, 18, , 19]);
272
280
  return [4 /*yield*/, currentProvider.request({
273
281
  method: "wallet_addEthereumChain",
274
- params: params
282
+ params: [params]
275
283
  })];
276
284
  case 11:
277
285
  _b.sent();
@@ -298,42 +306,16 @@ function linkAddOrSwitch(reqConnectWalletVo, wallet, chainId) {
298
306
  case 19: return [3 /*break*/, 21];
299
307
  case 20: throw new Error(switchError_1);
300
308
  case 21: return [3 /*break*/, 22];
301
- case 22: return [3 /*break*/, 32];
302
- case 23:
303
- if (!(chainId == '1' || chainId == '3' || chainId == '4')) return [3 /*break*/, 31];
304
- return [4 /*yield*/, currentProvider.request({
305
- method: 'wallet_switchEthereumChain',
306
- params: [{
307
- chainId: utilsEht.toHex(chainId)
308
- }],
309
- })];
310
- case 24:
311
- _b.sent();
312
- return [4 /*yield*/, isChainIdEq(wallet, chainId, utilsEht)];
313
- case 25:
314
- if (!_b.sent()) return [3 /*break*/, 30];
315
- if (!(wallet.type === 'WalletConnect')) return [3 /*break*/, 27];
316
- return [4 /*yield*/, wallet.sdk.eth.getAccounts()];
317
- case 26:
318
- address = (_b.sent())[0];
319
- wallet.address = address;
320
- return [3 /*break*/, 29];
321
- case 27: return [4 /*yield*/, wallet.sdk.eth.requestAccounts()];
322
- case 28:
323
- address = (_b.sent())[0];
324
- wallet.address = address;
325
- _b.label = 29;
326
- case 29: return [2 /*return*/, wallet];
327
- case 30: return [3 /*break*/, 32];
328
- case 31: throw new Error('Network error');
329
- case 32: return [2 /*return*/];
309
+ case 22: return [3 /*break*/, 24];
310
+ case 23: throw new Error('Network error');
311
+ case 24: return [2 /*return*/];
330
312
  }
331
313
  });
332
314
  });
333
315
  }
334
316
  function tryWalletConnect(reqConnectWalletVo) {
335
317
  return __awaiter(this, void 0, void 0, function () {
336
- var chain, wallet, sdk, account, chainId, localProvider, localRpcUrl, params;
318
+ var chain, wallet, sdk, account, chainId, localProvider, localRpcUrl;
337
319
  return __generator(this, function (_a) {
338
320
  switch (_a.label) {
339
321
  case 0:
@@ -376,9 +358,8 @@ function tryWalletConnect(reqConnectWalletVo) {
376
358
  localProvider = null;
377
359
  localRpcUrl = '';
378
360
  if (chain.compiler == 'EVM') {
379
- params = Chains_1.EthereumChainParams[reqConnectWalletVo.chainName];
380
- if (params) {
381
- localRpcUrl = params[0].rpcUrls[0];
361
+ if (chain.rpcUrls && chain.rpcUrls.length) {
362
+ localRpcUrl = chain.rpcUrls[0];
382
363
  }
383
364
  else if (chain.chainId == '1') {
384
365
  localRpcUrl = 'https://mainnet.infura.io/v3/';
@@ -82,6 +82,7 @@ var BitKeepWallet = /** @class */ (function (_super) {
82
82
  types_1.EnumChains.Avalanche,
83
83
  types_1.EnumChains.Arbitrum,
84
84
  types_1.EnumChains.Optimism,
85
+ types_1.EnumChains.ZKSYNC
85
86
  // EnumChains.Boba,
86
87
  // EnumChains.Moonriver,
87
88
  // EnumChains.Aurora,
@@ -71,7 +71,7 @@ var ImTokenWallet = /** @class */ (function (_super) {
71
71
  var _this = _super !== null && _super.apply(this, arguments) || this;
72
72
  _this.name = types_1.EnumWalletName.ImTokenWallet;
73
73
  _this.icon = imtoken_svg_1.default;
74
- _this.supportChains = [types_1.EnumChains.ETH, types_1.EnumChains.BSC, types_1.EnumChains.Polygon, types_1.EnumChains.OKEX, types_1.EnumChains.XDai, types_1.EnumChains.HECO, types_1.EnumChains.Fantom, types_1.EnumChains.Avalanche];
74
+ _this.supportChains = [types_1.EnumChains.ETH, types_1.EnumChains.BSC, types_1.EnumChains.Polygon, types_1.EnumChains.OKEX, types_1.EnumChains.XDai, types_1.EnumChains.HECO, types_1.EnumChains.Fantom, types_1.EnumChains.Avalanche, types_1.EnumChains.ZKSYNC];
75
75
  _this.type = types_1.EnumWalletType.Mobile;
76
76
  _this.sdk = null;
77
77
  _this.installUrl = "https://token.im/download";
package/lib/index.d.ts CHANGED
@@ -45,6 +45,6 @@ import SenderWallet from "./Wallets/SenderWallet";
45
45
  import LedgerWallet from "./Wallets/LedgerWallet";
46
46
  import { EnumChains, EnumWalletName } from "./types";
47
47
  import { tryWalletConnect, ReqConnectWalletVo } from "./TryWalletConnect";
48
- import { chainsObj, Chains, Chain, EthereumChainParams } from "./Chains";
48
+ import { chainsObj, Chains, Chain } from "./Chains";
49
49
  import { walletsObj, Wallets } from "./Wallets/index";
50
- export { chainsObj, Chains, Chain, EthereumChainParams, walletsObj, Wallets, ReqConnectWalletVo, tryWalletConnect, EnumChains, EnumWalletName, BaseWallet, MetaMask, BscWallet, Cyano, TronLink, Sollet, SolletIo, OntoMobile, WalletConnect, MathWallet, OntoWallet, SafePalWallet, ImTokenWallet, TokenPocket, TrustWallet, Coin98, Phantom, TerraStation, CoinbaseWallet, CloverWallet, XDEFIWallet, SlopeWallet, SolflareWallet, OKXWallet, KeplrWallet, BraveWallet, CryptoCom, NearWallet, BitKeepWallet, GnosisSafeWallet, BloctoWallet, PetraWallet, MartianWallet, PontemWallet, UnstoppableDomains, MyNearWallet, MeteorWallet, SenderWallet, LedgerWallet };
50
+ export { chainsObj, Chains, Chain, walletsObj, Wallets, ReqConnectWalletVo, tryWalletConnect, EnumChains, EnumWalletName, BaseWallet, MetaMask, BscWallet, Cyano, TronLink, Sollet, SolletIo, OntoMobile, WalletConnect, MathWallet, OntoWallet, SafePalWallet, ImTokenWallet, TokenPocket, TrustWallet, Coin98, Phantom, TerraStation, CoinbaseWallet, CloverWallet, XDEFIWallet, SlopeWallet, SolflareWallet, OKXWallet, KeplrWallet, BraveWallet, CryptoCom, NearWallet, BitKeepWallet, GnosisSafeWallet, BloctoWallet, PetraWallet, MartianWallet, PontemWallet, UnstoppableDomains, MyNearWallet, MeteorWallet, SenderWallet, LedgerWallet };
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LedgerWallet = exports.SenderWallet = exports.MeteorWallet = exports.MyNearWallet = exports.UnstoppableDomains = exports.PontemWallet = exports.MartianWallet = exports.PetraWallet = exports.BloctoWallet = exports.GnosisSafeWallet = exports.BitKeepWallet = exports.NearWallet = exports.CryptoCom = exports.BraveWallet = exports.KeplrWallet = exports.OKXWallet = exports.SolflareWallet = exports.SlopeWallet = exports.XDEFIWallet = exports.CloverWallet = exports.CoinbaseWallet = exports.TerraStation = exports.Phantom = exports.Coin98 = exports.TrustWallet = exports.TokenPocket = exports.ImTokenWallet = exports.SafePalWallet = exports.OntoWallet = exports.MathWallet = exports.WalletConnect = exports.OntoMobile = exports.SolletIo = exports.Sollet = exports.TronLink = exports.Cyano = exports.BscWallet = exports.MetaMask = exports.BaseWallet = exports.EnumWalletName = exports.EnumChains = exports.tryWalletConnect = exports.Wallets = exports.walletsObj = exports.EthereumChainParams = exports.Chains = exports.chainsObj = void 0;
6
+ exports.LedgerWallet = exports.SenderWallet = exports.MeteorWallet = exports.MyNearWallet = exports.UnstoppableDomains = exports.PontemWallet = exports.MartianWallet = exports.PetraWallet = exports.BloctoWallet = exports.GnosisSafeWallet = exports.BitKeepWallet = exports.NearWallet = exports.CryptoCom = exports.BraveWallet = exports.KeplrWallet = exports.OKXWallet = exports.SolflareWallet = exports.SlopeWallet = exports.XDEFIWallet = exports.CloverWallet = exports.CoinbaseWallet = exports.TerraStation = exports.Phantom = exports.Coin98 = exports.TrustWallet = exports.TokenPocket = exports.ImTokenWallet = exports.SafePalWallet = exports.OntoWallet = exports.MathWallet = exports.WalletConnect = exports.OntoMobile = exports.SolletIo = exports.Sollet = exports.TronLink = exports.Cyano = exports.BscWallet = exports.MetaMask = exports.BaseWallet = exports.EnumWalletName = exports.EnumChains = exports.tryWalletConnect = exports.Wallets = exports.walletsObj = exports.Chains = exports.chainsObj = void 0;
7
7
  /**
8
8
  * wallets-manager entry
9
9
  * @author openocean
@@ -96,7 +96,6 @@ Object.defineProperty(exports, "tryWalletConnect", { enumerable: true, get: func
96
96
  var Chains_1 = require("./Chains");
97
97
  Object.defineProperty(exports, "chainsObj", { enumerable: true, get: function () { return Chains_1.chainsObj; } });
98
98
  Object.defineProperty(exports, "Chains", { enumerable: true, get: function () { return Chains_1.Chains; } });
99
- Object.defineProperty(exports, "EthereumChainParams", { enumerable: true, get: function () { return Chains_1.EthereumChainParams; } });
100
99
  var index_1 = require("./Wallets/index");
101
100
  Object.defineProperty(exports, "walletsObj", { enumerable: true, get: function () { return index_1.walletsObj; } });
102
101
  Object.defineProperty(exports, "Wallets", { enumerable: true, get: function () { return index_1.Wallets; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/wallet",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "A multi-chain wallets manager",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {