@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.
- package/lib/Wallets/WalletConnect.js +15 -20
- package/package.json +1 -1
|
@@ -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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
|
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
|
|
166
|
+
case 2:
|
|
172
167
|
currentChainId = _a.sent();
|
|
173
|
-
if (!(chainId && currentChainId != chainId
|
|
174
|
-
if (!(config || !config.isTow)) return [3 /*break*/,
|
|
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
|
|
171
|
+
case 3:
|
|
177
172
|
_a.sent();
|
|
178
173
|
return [4 /*yield*/, new Promise(function (r) {
|
|
179
|
-
setTimeout(r,
|
|
174
|
+
setTimeout(r, 500);
|
|
180
175
|
})];
|
|
181
|
-
case
|
|
176
|
+
case 4:
|
|
182
177
|
_a.sent();
|
|
183
178
|
return [4 /*yield*/, this.requestConnect(chainId, __assign({ isTow: true }, config))];
|
|
184
|
-
case
|
|
185
|
-
case
|
|
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
|
|
185
|
+
case 7:
|
|
191
186
|
address = (_a.sent())[0];
|
|
192
187
|
this.address = address;
|
|
193
188
|
this.chainId = currentChainId;
|