@partylayer/sdk 0.13.0 → 0.13.1

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/index.d.mts CHANGED
@@ -340,6 +340,13 @@ declare class PartyLayerClient {
340
340
  private readonly warmPlans;
341
341
  private eventHandlers;
342
342
  private activeSession;
343
+ /**
344
+ * True when `activeSession` was revived AS-IS (no live `status()` probe) because
345
+ * its adapter wasn't registered yet at restore time (the lazy configured-announce
346
+ * case). Cleared once a live probe validates it (or on fresh connect). When set,
347
+ * `aggregateAnnouncedWallets` re-probes the session the moment that adapter is born.
348
+ */
349
+ private activeSessionNeedsProbe;
343
350
  readonly registryClient: RegistryClient;
344
351
  private logger;
345
352
  private crypto;
package/dist/index.d.ts CHANGED
@@ -340,6 +340,13 @@ declare class PartyLayerClient {
340
340
  private readonly warmPlans;
341
341
  private eventHandlers;
342
342
  private activeSession;
343
+ /**
344
+ * True when `activeSession` was revived AS-IS (no live `status()` probe) because
345
+ * its adapter wasn't registered yet at restore time (the lazy configured-announce
346
+ * case). Cleared once a live probe validates it (or on fresh connect). When set,
347
+ * `aggregateAnnouncedWallets` re-probes the session the moment that adapter is born.
348
+ */
349
+ private activeSessionNeedsProbe;
343
350
  readonly registryClient: RegistryClient;
344
351
  private logger;
345
352
  private crypto;
package/dist/index.js CHANGED
@@ -744,6 +744,13 @@ var PartyLayerClient = class {
744
744
  warmPlans = /* @__PURE__ */ new Map();
745
745
  eventHandlers = /* @__PURE__ */ new Map();
746
746
  activeSession = null;
747
+ /**
748
+ * True when `activeSession` was revived AS-IS (no live `status()` probe) because
749
+ * its adapter wasn't registered yet at restore time (the lazy configured-announce
750
+ * case). Cleared once a live probe validates it (or on fresh connect). When set,
751
+ * `aggregateAnnouncedWallets` re-probes the session the moment that adapter is born.
752
+ */
753
+ activeSessionNeedsProbe = false;
747
754
  registryClient;
748
755
  // Expose for React hooks
749
756
  logger;
@@ -1023,6 +1030,28 @@ var PartyLayerClient = class {
1023
1030
  config: deriveAnnounceConfig(entry)
1024
1031
  });
1025
1032
  this.adapters.set(configured.walletId, configured);
1033
+ const active = this.activeSession;
1034
+ if (active && this.activeSessionNeedsProbe && active.walletId === configured.walletId && configured.restore) {
1035
+ try {
1036
+ const reprobed = await configured.restore(this.createAdapterContext(), {
1037
+ ...active,
1038
+ encrypted: ""
1039
+ });
1040
+ if (reprobed) {
1041
+ this.activeSession = reprobed;
1042
+ this.activeSessionNeedsProbe = false;
1043
+ await this.persistSession(reprobed);
1044
+ this.emit("session:connected", { type: "session:connected", session: reprobed });
1045
+ } else {
1046
+ await this.removeSession(active.sessionId);
1047
+ this.activeSession = null;
1048
+ this.activeSessionNeedsProbe = false;
1049
+ this.emit("session:expired", { type: "session:expired", sessionId: active.sessionId });
1050
+ }
1051
+ } catch (err) {
1052
+ this.logger.warn("Restore re-probe failed; leaving session as-is", err);
1053
+ }
1054
+ }
1026
1055
  }
1027
1056
  } catch {
1028
1057
  }
@@ -1249,6 +1278,7 @@ var PartyLayerClient = class {
1249
1278
  }
1250
1279
  await this.persistSession(session);
1251
1280
  this.activeSession = session;
1281
+ this.activeSessionNeedsProbe = false;
1252
1282
  this.updateRegistryStatus();
1253
1283
  this.telemetry?.increment?.(core.METRICS.WALLET_CONNECT_SUCCESS);
1254
1284
  this.telemetry?.increment?.(core.METRICS.SESSIONS_CREATED);
@@ -1639,6 +1669,7 @@ var PartyLayerClient = class {
1639
1669
  });
1640
1670
  if (restored) {
1641
1671
  this.activeSession = restored;
1672
+ this.activeSessionNeedsProbe = false;
1642
1673
  await this.persistSession(restored);
1643
1674
  this.telemetry?.increment?.(core.METRICS.SESSIONS_RESTORED);
1644
1675
  this.telemetry?.increment?.(core.METRICS.WALLET_CONNECT_SUCCESS);
@@ -1657,6 +1688,7 @@ var PartyLayerClient = class {
1657
1688
  }
1658
1689
  }
1659
1690
  this.activeSession = session;
1691
+ this.activeSessionNeedsProbe = true;
1660
1692
  return session;
1661
1693
  } catch (err) {
1662
1694
  this.logger.warn("Failed to restore session", err);