@naculus/connect-appkit-core 0.12.1 → 0.14.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
@@ -36,6 +36,7 @@ __export(src_exports, {
36
36
  chainNumber: () => chainNumber,
37
37
  chainsForNamespace: () => chainsForNamespace,
38
38
  channelsUpdate: () => channelsUpdate,
39
+ checkSessionKeyRailGrant: () => checkSessionKeyRailGrant,
39
40
  clearOneInAppNotification: () => clearOneInAppNotification,
40
41
  compareCostsKey: () => compareCostsKey,
41
42
  createDecimalsCache: () => createDecimalsCache,
@@ -769,6 +770,22 @@ function resetSharedSessionKeyManager() {
769
770
  sharedFingerprint = null;
770
771
  }
771
772
 
773
+ // src/session-key-rail.ts
774
+ var knownRails = /* @__PURE__ */ new Set([
775
+ "transfer",
776
+ "x402-exact",
777
+ "mpp-charge"
778
+ ]);
779
+ function checkSessionKeyRailGrant(scope, rail) {
780
+ const rails = scope?.rails;
781
+ if (!Array.isArray(rails) || rails.length === 0 || new Set(rails).size !== rails.length || !Array.from(rails).every(
782
+ (candidate) => typeof candidate === "string" && knownRails.has(candidate)
783
+ ) || !rails.includes(rail)) {
784
+ return { status: "needs-regrant", missingRail: rail };
785
+ }
786
+ return { status: "ok", rail };
787
+ }
788
+
772
789
  // src/user-op-receipt.ts
773
790
  var InvalidUserOperationReceiptError = class extends Error {
774
791
  constructor(message) {
@@ -1934,6 +1951,7 @@ function siwxResultToSession(result, now = /* @__PURE__ */ new Date()) {
1934
1951
  chainNumber,
1935
1952
  chainsForNamespace,
1936
1953
  channelsUpdate,
1954
+ checkSessionKeyRailGrant,
1937
1955
  clearOneInAppNotification,
1938
1956
  compareCostsKey,
1939
1957
  createDecimalsCache,