@pafi-dev/issuer 0.5.28 → 0.5.30

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.cts CHANGED
@@ -1730,6 +1730,26 @@ interface PendingUserOpEntry {
1730
1730
  chainId: number;
1731
1731
  /** Hex-encoded userOpHash — the value the user signed via personal_sign. */
1732
1732
  userOpHash: Hex;
1733
+ /**
1734
+ * Fee-stripped fallback variant. Set by `/claim/prepare` and
1735
+ * `/redeem/prepare` when a PT operator fee is configured AND the
1736
+ * paymaster sponsorship attached successfully — i.e. the user might
1737
+ * still want to submit without paymaster (paying ETH gas), and in
1738
+ * that case shouldn't be charged the PT fee. `/claim/submit` reads
1739
+ * this branch when its request body specifies
1740
+ * `variant: "fallback"`.
1741
+ *
1742
+ * Has a different `callData` (no PT.transfer prepended) and
1743
+ * therefore a different `userOpHash`. Paymaster fields are NOT
1744
+ * present — the fallback is by definition unsponsored.
1745
+ */
1746
+ fallback?: {
1747
+ callData: Hex;
1748
+ callGasLimit: string;
1749
+ verificationGasLimit: string;
1750
+ preVerificationGas: string;
1751
+ userOpHash: Hex;
1752
+ };
1733
1753
  }
1734
1754
  /**
1735
1755
  * Storage backend for pending UserOps in the mobile prepare/submit pattern.
@@ -1755,7 +1775,7 @@ interface IPendingUserOpStore {
1755
1775
  * Bridges the gap between the serialized storage format (decimal strings,
1756
1776
  * safe for JSON/Redis) and `serializeUserOpToJsonRpc` which expects bigints.
1757
1777
  */
1758
- declare function serializeEntryToJsonRpc(entry: PendingUserOpEntry, signature: Hex): Record<string, string | null>;
1778
+ declare function serializeEntryToJsonRpc(entry: PendingUserOpEntry, signature: Hex, variant?: "sponsored" | "fallback"): Record<string, string | null>;
1759
1779
 
1760
1780
  interface IssuerRegistryRecord {
1761
1781
  issuerAddress: Address;
package/dist/index.d.ts CHANGED
@@ -1730,6 +1730,26 @@ interface PendingUserOpEntry {
1730
1730
  chainId: number;
1731
1731
  /** Hex-encoded userOpHash — the value the user signed via personal_sign. */
1732
1732
  userOpHash: Hex;
1733
+ /**
1734
+ * Fee-stripped fallback variant. Set by `/claim/prepare` and
1735
+ * `/redeem/prepare` when a PT operator fee is configured AND the
1736
+ * paymaster sponsorship attached successfully — i.e. the user might
1737
+ * still want to submit without paymaster (paying ETH gas), and in
1738
+ * that case shouldn't be charged the PT fee. `/claim/submit` reads
1739
+ * this branch when its request body specifies
1740
+ * `variant: "fallback"`.
1741
+ *
1742
+ * Has a different `callData` (no PT.transfer prepended) and
1743
+ * therefore a different `userOpHash`. Paymaster fields are NOT
1744
+ * present — the fallback is by definition unsponsored.
1745
+ */
1746
+ fallback?: {
1747
+ callData: Hex;
1748
+ callGasLimit: string;
1749
+ verificationGasLimit: string;
1750
+ preVerificationGas: string;
1751
+ userOpHash: Hex;
1752
+ };
1733
1753
  }
1734
1754
  /**
1735
1755
  * Storage backend for pending UserOps in the mobile prepare/submit pattern.
@@ -1755,7 +1775,7 @@ interface IPendingUserOpStore {
1755
1775
  * Bridges the gap between the serialized storage format (decimal strings,
1756
1776
  * safe for JSON/Redis) and `serializeUserOpToJsonRpc` which expects bigints.
1757
1777
  */
1758
- declare function serializeEntryToJsonRpc(entry: PendingUserOpEntry, signature: Hex): Record<string, string | null>;
1778
+ declare function serializeEntryToJsonRpc(entry: PendingUserOpEntry, signature: Hex, variant?: "sponsored" | "fallback"): Record<string, string | null>;
1759
1779
 
1760
1780
  interface IssuerRegistryRecord {
1761
1781
  issuerAddress: Address;
package/dist/index.js CHANGED
@@ -2280,7 +2280,28 @@ function createIssuerService(config) {
2280
2280
 
2281
2281
  // src/userop-store/serialize.ts
2282
2282
  import { serializeUserOpToJsonRpc } from "@pafi-dev/core";
2283
- function serializeEntryToJsonRpc(entry, signature) {
2283
+ function serializeEntryToJsonRpc(entry, signature, variant = "sponsored") {
2284
+ if (variant === "fallback") {
2285
+ if (!entry.fallback) {
2286
+ throw new Error(
2287
+ "serializeEntryToJsonRpc: variant=fallback requested but the stored entry has no `fallback` branch \u2014 caller should resubmit with variant='sponsored' or re-prepare with a fee configured."
2288
+ );
2289
+ }
2290
+ return serializeUserOpToJsonRpc(
2291
+ {
2292
+ sender: entry.sender,
2293
+ nonce: BigInt(entry.nonce),
2294
+ callData: entry.fallback.callData,
2295
+ callGasLimit: BigInt(entry.fallback.callGasLimit),
2296
+ verificationGasLimit: BigInt(entry.fallback.verificationGasLimit),
2297
+ preVerificationGas: BigInt(entry.fallback.preVerificationGas),
2298
+ maxFeePerGas: BigInt(entry.maxFeePerGas),
2299
+ maxPriorityFeePerGas: BigInt(entry.maxPriorityFeePerGas)
2300
+ // intentionally no paymaster — user pays ETH gas
2301
+ },
2302
+ signature
2303
+ );
2304
+ }
2284
2305
  return serializeUserOpToJsonRpc(
2285
2306
  {
2286
2307
  sender: entry.sender,