@sundaeswap/wallet-lite 0.0.31 → 0.0.33
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/cjs/classes/WalletObserver.class.js +21 -20
- package/dist/cjs/classes/WalletObserver.class.js.map +1 -1
- package/dist/esm/classes/WalletObserver.class.js +4 -3
- package/dist/esm/classes/WalletObserver.class.js.map +1 -1
- package/dist/types/classes/WalletObserver.class.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/classes/WalletObserver.class.ts +5 -3
package/package.json
CHANGED
|
@@ -197,6 +197,7 @@ export class WalletObserver<
|
|
|
197
197
|
return result;
|
|
198
198
|
} catch (e) {
|
|
199
199
|
this._performingSync = false;
|
|
200
|
+
this.dispatch(EWalletObserverEvents.SYNCING_WALLET_END);
|
|
200
201
|
throw e;
|
|
201
202
|
}
|
|
202
203
|
};
|
|
@@ -229,8 +230,6 @@ export class WalletObserver<
|
|
|
229
230
|
* @returns {Promise<Cip30WalletApi>} - A promise that resolves to the API instance.
|
|
230
231
|
*/
|
|
231
232
|
syncApi = async (activeWallet?: TSupportedWalletExtensions): Promise<any> => {
|
|
232
|
-
let attempts = 0;
|
|
233
|
-
this.api = undefined;
|
|
234
233
|
if (!activeWallet && !this.activeWallet) {
|
|
235
234
|
throw new Error(
|
|
236
235
|
"A wallet is required to be passed as a parameter, or to be defined in the class."
|
|
@@ -240,8 +239,10 @@ export class WalletObserver<
|
|
|
240
239
|
const selectedWallet =
|
|
241
240
|
activeWallet || (this.activeWallet as TSupportedWalletExtensions);
|
|
242
241
|
|
|
242
|
+
let attempts = 0;
|
|
243
243
|
let shouldContinue = true;
|
|
244
|
-
|
|
244
|
+
|
|
245
|
+
while (shouldContinue) {
|
|
245
246
|
if (attempts === 10) {
|
|
246
247
|
throw new Error(
|
|
247
248
|
"Could not reconnect to the selected wallet. Please check your extension."
|
|
@@ -257,6 +258,7 @@ export class WalletObserver<
|
|
|
257
258
|
|
|
258
259
|
this.api = api;
|
|
259
260
|
this.network = await api.getNetworkId();
|
|
261
|
+
shouldContinue = false;
|
|
260
262
|
} catch (e) {
|
|
261
263
|
if (
|
|
262
264
|
(e as Error)?.message === "user canceled connection" ||
|