@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sundaeswap/wallet-lite",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -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
- while (!this.api && shouldContinue) {
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" ||