@naculus/connect-appkit-core 0.6.0 → 0.7.0

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.cjs CHANGED
@@ -67,8 +67,13 @@ __export(src_exports, {
67
67
  normalizeCapabilities: () => normalizeCapabilities,
68
68
  normalizeEip155ChainId: () => normalizeEip155ChainId,
69
69
  parseUserOperationReceipt: () => parseUserOperationReceipt,
70
+ readCurrentMppSessionChannel: () => readCurrentMppSessionChannel,
70
71
  readDecimals: () => readDecimals,
72
+ readMppRecoveryChannelId: () => readMppRecoveryChannelId,
73
+ readMppSessionChannel: () => readMppSessionChannel,
74
+ readMppSessionReceipt: () => readMppSessionReceipt,
71
75
  readSolanaRoles: () => readSolanaRoles,
76
+ replayNotificationSettings: () => replayNotificationSettings,
72
77
  resetSharedSessionKeyManager: () => resetSharedSessionKeyManager,
73
78
  resolveChain: () => resolveChain,
74
79
  resolveContextSimulationEndpoint: () => resolveContextSimulationEndpoint,
@@ -573,6 +578,13 @@ function saveNotificationSettings(storage, settings) {
573
578
  function updateNotificationSettings(current, update) {
574
579
  return { ...current, ...update };
575
580
  }
581
+ function replayNotificationSettings(persisted, updates) {
582
+ let settings = persisted ?? DEFAULT_NOTIFICATION_SETTINGS;
583
+ for (const update of updates) {
584
+ settings = updateNotificationSettings(settings, update(settings));
585
+ }
586
+ return settings;
587
+ }
576
588
  function channelsUpdate(channels) {
577
589
  const update = {};
578
590
  if (channels.includes("telegram")) update.telegram = true;
@@ -1420,6 +1432,36 @@ function describePayment(input, result) {
1420
1432
  };
1421
1433
  }
1422
1434
 
1435
+ // src/mpp-session.ts
1436
+ function record2(value) {
1437
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
1438
+ }
1439
+ function readMppSessionChannel(value) {
1440
+ const channel = record2(value);
1441
+ if (!channel || typeof channel.channelId !== "string" || typeof channel.payer !== "string" || typeof channel.payee !== "string" || typeof channel.mint !== "string" || typeof channel.channelProgram !== "string" || typeof channel.deposit !== "bigint" || typeof channel.gracePeriodSeconds !== "number" || typeof channel.openSlot !== "bigint" || typeof channel.salt !== "bigint") {
1442
+ return null;
1443
+ }
1444
+ return channel;
1445
+ }
1446
+ function readCurrentMppSessionChannel(session) {
1447
+ for (let index = session.channels.length - 1; index >= 0; index--) {
1448
+ const channel = readMppSessionChannel(session.channels[index]);
1449
+ if (channel) return channel;
1450
+ }
1451
+ return null;
1452
+ }
1453
+ function readMppSessionReceipt(value) {
1454
+ const receipt = record2(value);
1455
+ if (receipt?.status !== "success" || typeof receipt.method !== "string" || typeof receipt.timestamp !== "string" || typeof receipt.reference !== "string") {
1456
+ return null;
1457
+ }
1458
+ return receipt;
1459
+ }
1460
+ function readMppRecoveryChannelId(error) {
1461
+ const channelId = record2(error)?.channelId;
1462
+ return typeof channelId === "string" && channelId !== "" ? channelId : null;
1463
+ }
1464
+
1423
1465
  // src/solana-session-key.ts
1424
1466
  var import_connect_core17 = require("@naculus/connect-core");
1425
1467
  function send(rpc) {
@@ -1684,8 +1726,13 @@ function siwxResultToSession(result, now = /* @__PURE__ */ new Date()) {
1684
1726
  normalizeCapabilities,
1685
1727
  normalizeEip155ChainId,
1686
1728
  parseUserOperationReceipt,
1729
+ readCurrentMppSessionChannel,
1687
1730
  readDecimals,
1731
+ readMppRecoveryChannelId,
1732
+ readMppSessionChannel,
1733
+ readMppSessionReceipt,
1688
1734
  readSolanaRoles,
1735
+ replayNotificationSettings,
1689
1736
  resetSharedSessionKeyManager,
1690
1737
  resolveChain,
1691
1738
  resolveContextSimulationEndpoint,