@openocean.finance/wallet 0.4.18 → 0.4.19

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.
@@ -150,44 +150,39 @@ var WalletConnect = /** @class */ (function (_super) {
150
150
  var currentChainId, address;
151
151
  return __generator(this, function (_a) {
152
152
  switch (_a.label) {
153
- case 0:
154
- // this.provider.infuraId = this.infuraId
155
- return [4 /*yield*/, this.provider.disconnect()];
156
- case 1:
153
+ case 0:
157
154
  // this.provider.infuraId = this.infuraId
158
- _a.sent();
159
- return [4 /*yield*/, new Promise(function (r) {
160
- setTimeout(r, 200);
161
- })];
162
- case 2:
163
- _a.sent();
155
+ // await this.provider.disconnect()
156
+ // await new Promise(r => {
157
+ // setTimeout(r, 200);
158
+ // })
164
159
  this.provider.chainId = chainId;
165
160
  this.provider.updateRpcUrl(chainId);
166
161
  return [4 /*yield*/, this.provider.enable()];
167
- case 3:
162
+ case 1:
168
163
  _a.sent();
169
164
  this.sdk = new web3_1.default(this.provider);
170
165
  return [4 /*yield*/, this.sdk.eth.getChainId()];
171
- case 4:
166
+ case 2:
172
167
  currentChainId = _a.sent();
173
- if (!(chainId && currentChainId != chainId && (this.sdk.currentProvider.walletMeta && this.sdk.currentProvider.walletMeta.name != "MetaMask"))) return [3 /*break*/, 8];
174
- if (!(config || !config.isTow)) return [3 /*break*/, 8];
168
+ if (!(chainId && currentChainId != chainId)) return [3 /*break*/, 6];
169
+ if (!(config || !config.isTow)) return [3 /*break*/, 6];
175
170
  return [4 /*yield*/, this.provider.disconnect()];
176
- case 5:
171
+ case 3:
177
172
  _a.sent();
178
173
  return [4 /*yield*/, new Promise(function (r) {
179
- setTimeout(r, 1000);
174
+ setTimeout(r, 500);
180
175
  })];
181
- case 6:
176
+ case 4:
182
177
  _a.sent();
183
178
  return [4 /*yield*/, this.requestConnect(chainId, __assign({ isTow: true }, config))];
184
- case 7: return [2 /*return*/, _a.sent()];
185
- case 8:
179
+ case 5: return [2 /*return*/, _a.sent()];
180
+ case 6:
186
181
  if (chainId && currentChainId != chainId) {
187
182
  throw new Error(types_1.EnumErrors.ChainIdNotMath);
188
183
  }
189
184
  return [4 /*yield*/, this.sdk.eth.getAccounts()];
190
- case 9:
185
+ case 7:
191
186
  address = (_a.sent())[0];
192
187
  this.address = address;
193
188
  this.chainId = currentChainId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/wallet",
3
- "version": "0.4.18",
3
+ "version": "0.4.19",
4
4
  "description": "A multi-chain wallets manager",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {