@partylayer/sdk 0.13.0 → 0.13.2
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 +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +36 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,6 @@ import { Cantor8Adapter } from '@partylayer/adapter-cantor8';
|
|
|
12
12
|
export { Cantor8Adapter } from '@partylayer/adapter-cantor8';
|
|
13
13
|
import { NightlyAdapter } from '@partylayer/adapter-nightly';
|
|
14
14
|
export { NightlyAdapter } from '@partylayer/adapter-nightly';
|
|
15
|
-
import { SendAdapter } from '@partylayer/adapter-send';
|
|
16
15
|
export { SendAdapter } from '@partylayer/adapter-send';
|
|
17
16
|
export { BronAdapter } from '@partylayer/adapter-bron';
|
|
18
17
|
|
|
@@ -528,10 +527,11 @@ function getBuiltinAdapters() {
|
|
|
528
527
|
// 5N Loop - QR code / popup
|
|
529
528
|
new Cantor8Adapter(),
|
|
530
529
|
// Cantor8 - deep link transport
|
|
531
|
-
new NightlyAdapter()
|
|
530
|
+
new NightlyAdapter()
|
|
532
531
|
// Nightly - multichain wallet (injected)
|
|
533
|
-
|
|
534
|
-
//
|
|
532
|
+
// Send is served via the generic CIP-0103 announce path (registry
|
|
533
|
+
// transport:'announce') — no longer in defaults; SendAdapter stays exported
|
|
534
|
+
// below for opt-in manual/bespoke use.
|
|
535
535
|
];
|
|
536
536
|
}
|
|
537
537
|
var SDK_VERSION = "0.3.0";
|
|
@@ -750,6 +750,13 @@ var PartyLayerClient = class {
|
|
|
750
750
|
warmPlans = /* @__PURE__ */ new Map();
|
|
751
751
|
eventHandlers = /* @__PURE__ */ new Map();
|
|
752
752
|
activeSession = null;
|
|
753
|
+
/**
|
|
754
|
+
* True when `activeSession` was revived AS-IS (no live `status()` probe) because
|
|
755
|
+
* its adapter wasn't registered yet at restore time (the lazy configured-announce
|
|
756
|
+
* case). Cleared once a live probe validates it (or on fresh connect). When set,
|
|
757
|
+
* `aggregateAnnouncedWallets` re-probes the session the moment that adapter is born.
|
|
758
|
+
*/
|
|
759
|
+
activeSessionNeedsProbe = false;
|
|
753
760
|
registryClient;
|
|
754
761
|
// Expose for React hooks
|
|
755
762
|
logger;
|
|
@@ -1029,6 +1036,28 @@ var PartyLayerClient = class {
|
|
|
1029
1036
|
config: deriveAnnounceConfig(entry)
|
|
1030
1037
|
});
|
|
1031
1038
|
this.adapters.set(configured.walletId, configured);
|
|
1039
|
+
const active = this.activeSession;
|
|
1040
|
+
if (active && this.activeSessionNeedsProbe && active.walletId === configured.walletId && configured.restore) {
|
|
1041
|
+
try {
|
|
1042
|
+
const reprobed = await configured.restore(this.createAdapterContext(), {
|
|
1043
|
+
...active,
|
|
1044
|
+
encrypted: ""
|
|
1045
|
+
});
|
|
1046
|
+
if (reprobed) {
|
|
1047
|
+
this.activeSession = reprobed;
|
|
1048
|
+
this.activeSessionNeedsProbe = false;
|
|
1049
|
+
await this.persistSession(reprobed);
|
|
1050
|
+
this.emit("session:connected", { type: "session:connected", session: reprobed });
|
|
1051
|
+
} else {
|
|
1052
|
+
await this.removeSession(active.sessionId);
|
|
1053
|
+
this.activeSession = null;
|
|
1054
|
+
this.activeSessionNeedsProbe = false;
|
|
1055
|
+
this.emit("session:expired", { type: "session:expired", sessionId: active.sessionId });
|
|
1056
|
+
}
|
|
1057
|
+
} catch (err) {
|
|
1058
|
+
this.logger.warn("Restore re-probe failed; leaving session as-is", err);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1032
1061
|
}
|
|
1033
1062
|
} catch {
|
|
1034
1063
|
}
|
|
@@ -1255,6 +1284,7 @@ var PartyLayerClient = class {
|
|
|
1255
1284
|
}
|
|
1256
1285
|
await this.persistSession(session);
|
|
1257
1286
|
this.activeSession = session;
|
|
1287
|
+
this.activeSessionNeedsProbe = false;
|
|
1258
1288
|
this.updateRegistryStatus();
|
|
1259
1289
|
this.telemetry?.increment?.(METRICS.WALLET_CONNECT_SUCCESS);
|
|
1260
1290
|
this.telemetry?.increment?.(METRICS.SESSIONS_CREATED);
|
|
@@ -1645,6 +1675,7 @@ var PartyLayerClient = class {
|
|
|
1645
1675
|
});
|
|
1646
1676
|
if (restored) {
|
|
1647
1677
|
this.activeSession = restored;
|
|
1678
|
+
this.activeSessionNeedsProbe = false;
|
|
1648
1679
|
await this.persistSession(restored);
|
|
1649
1680
|
this.telemetry?.increment?.(METRICS.SESSIONS_RESTORED);
|
|
1650
1681
|
this.telemetry?.increment?.(METRICS.WALLET_CONNECT_SUCCESS);
|
|
@@ -1663,6 +1694,7 @@ var PartyLayerClient = class {
|
|
|
1663
1694
|
}
|
|
1664
1695
|
}
|
|
1665
1696
|
this.activeSession = session;
|
|
1697
|
+
this.activeSessionNeedsProbe = true;
|
|
1666
1698
|
return session;
|
|
1667
1699
|
} catch (err) {
|
|
1668
1700
|
this.logger.warn("Failed to restore session", err);
|