@pafi-dev/issuer 0.26.1 → 0.27.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.d.cts CHANGED
@@ -2510,6 +2510,22 @@ interface PrepareMobileUserOpParams {
2510
2510
  store: IPendingUserOpStore;
2511
2511
  /** TTL the store entry should outlive — typically the MintRequest deadline. */
2512
2512
  ttlSeconds: number;
2513
+ /**
2514
+ * Optional EIP-7702 authorization tuple. Persisted in the store entry
2515
+ * so `handleMobileSubmit` can replay it to the bundler at submit time.
2516
+ * NOT folded into the UserOp hash — Pimlico applies SetCode atomically
2517
+ * but the authorization itself is a top-level field of
2518
+ * `eth_sendUserOperation`, not part of `PackedUserOperation`. Hash
2519
+ * stays stable so the user's typed-data signature remains valid.
2520
+ */
2521
+ eip7702Auth?: {
2522
+ chainId: string;
2523
+ address: string;
2524
+ nonce: string;
2525
+ r: string;
2526
+ s: string;
2527
+ yParity: string;
2528
+ };
2513
2529
  }
2514
2530
  interface PrepareMobileUserOpResult {
2515
2531
  sponsored: PreparedUserOp;
@@ -2604,6 +2620,28 @@ interface HandleMobilePrepareParams {
2604
2620
  /** Optional — when omitted, paymaster is skipped and `sponsored: false` is returned. */
2605
2621
  pafiBackendClient?: PafiBackendClient | null;
2606
2622
  onWarning?: (msg: string) => void;
2623
+ /**
2624
+ * Optional EIP-7702 authorization tuple supplied by an FE that wants
2625
+ * atomic activation — the user signs the auth alongside the UserOp
2626
+ * typed-data, and the bundler applies SetCode + handleOps in one
2627
+ * bundler tx. When provided:
2628
+ * - `needsDelegation` is forced false (the bundler will activate
2629
+ * delegation regardless of current on-chain code).
2630
+ * - The auth is persisted in the pending-userop entry and replayed
2631
+ * to the bundler at submit time.
2632
+ *
2633
+ * Format matches Pimlico's `eth_sendUserOperation` `eip7702Auth` field.
2634
+ * The FE typically derives it from `useSign7702Authorization()` and
2635
+ * normalises with `attachDelegationIfNeeded()` in `@pafi-dev/core`.
2636
+ */
2637
+ eip7702Auth?: {
2638
+ chainId: string;
2639
+ address: string;
2640
+ nonce: string;
2641
+ r: string;
2642
+ s: string;
2643
+ yParity: string;
2644
+ };
2607
2645
  }
2608
2646
  interface HandleMobilePrepareResult extends PrepareMobileUserOpResult {
2609
2647
  /**
@@ -3323,6 +3361,20 @@ declare class IssuerApiAdapter {
3323
3361
  pointTokenAddress: Address;
3324
3362
  amount: bigint;
3325
3363
  aaNonce: bigint;
3364
+ /**
3365
+ * Optional EIP-7702 authorization tuple for atomic activation. When
3366
+ * present, the mobile flow merges SetCode + UserOp into one bundler
3367
+ * tx — no separate /delegate call required. See
3368
+ * `attachDelegationIfNeeded` in `@pafi-dev/core`.
3369
+ */
3370
+ eip7702Auth?: {
3371
+ chainId: string;
3372
+ address: string;
3373
+ nonce: string;
3374
+ r: string;
3375
+ s: string;
3376
+ yParity: string;
3377
+ };
3326
3378
  }): Promise<MobilePrepareDto>;
3327
3379
  claimSubmit(input: {
3328
3380
  authenticatedAddress: Address;
@@ -3336,6 +3388,18 @@ declare class IssuerApiAdapter {
3336
3388
  pointTokenAddress: Address;
3337
3389
  amount: bigint;
3338
3390
  aaNonce: bigint;
3391
+ /**
3392
+ * Optional EIP-7702 authorization for atomic activation — see
3393
+ * `claimPrepare` for the full rationale + Privy hook reference.
3394
+ */
3395
+ eip7702Auth?: {
3396
+ chainId: string;
3397
+ address: string;
3398
+ nonce: string;
3399
+ r: string;
3400
+ s: string;
3401
+ yParity: string;
3402
+ };
3339
3403
  }): Promise<RedeemPrepareDto>;
3340
3404
  redeemSubmit(input: {
3341
3405
  authenticatedAddress: Address;
package/dist/index.d.ts CHANGED
@@ -2510,6 +2510,22 @@ interface PrepareMobileUserOpParams {
2510
2510
  store: IPendingUserOpStore;
2511
2511
  /** TTL the store entry should outlive — typically the MintRequest deadline. */
2512
2512
  ttlSeconds: number;
2513
+ /**
2514
+ * Optional EIP-7702 authorization tuple. Persisted in the store entry
2515
+ * so `handleMobileSubmit` can replay it to the bundler at submit time.
2516
+ * NOT folded into the UserOp hash — Pimlico applies SetCode atomically
2517
+ * but the authorization itself is a top-level field of
2518
+ * `eth_sendUserOperation`, not part of `PackedUserOperation`. Hash
2519
+ * stays stable so the user's typed-data signature remains valid.
2520
+ */
2521
+ eip7702Auth?: {
2522
+ chainId: string;
2523
+ address: string;
2524
+ nonce: string;
2525
+ r: string;
2526
+ s: string;
2527
+ yParity: string;
2528
+ };
2513
2529
  }
2514
2530
  interface PrepareMobileUserOpResult {
2515
2531
  sponsored: PreparedUserOp;
@@ -2604,6 +2620,28 @@ interface HandleMobilePrepareParams {
2604
2620
  /** Optional — when omitted, paymaster is skipped and `sponsored: false` is returned. */
2605
2621
  pafiBackendClient?: PafiBackendClient | null;
2606
2622
  onWarning?: (msg: string) => void;
2623
+ /**
2624
+ * Optional EIP-7702 authorization tuple supplied by an FE that wants
2625
+ * atomic activation — the user signs the auth alongside the UserOp
2626
+ * typed-data, and the bundler applies SetCode + handleOps in one
2627
+ * bundler tx. When provided:
2628
+ * - `needsDelegation` is forced false (the bundler will activate
2629
+ * delegation regardless of current on-chain code).
2630
+ * - The auth is persisted in the pending-userop entry and replayed
2631
+ * to the bundler at submit time.
2632
+ *
2633
+ * Format matches Pimlico's `eth_sendUserOperation` `eip7702Auth` field.
2634
+ * The FE typically derives it from `useSign7702Authorization()` and
2635
+ * normalises with `attachDelegationIfNeeded()` in `@pafi-dev/core`.
2636
+ */
2637
+ eip7702Auth?: {
2638
+ chainId: string;
2639
+ address: string;
2640
+ nonce: string;
2641
+ r: string;
2642
+ s: string;
2643
+ yParity: string;
2644
+ };
2607
2645
  }
2608
2646
  interface HandleMobilePrepareResult extends PrepareMobileUserOpResult {
2609
2647
  /**
@@ -3323,6 +3361,20 @@ declare class IssuerApiAdapter {
3323
3361
  pointTokenAddress: Address;
3324
3362
  amount: bigint;
3325
3363
  aaNonce: bigint;
3364
+ /**
3365
+ * Optional EIP-7702 authorization tuple for atomic activation. When
3366
+ * present, the mobile flow merges SetCode + UserOp into one bundler
3367
+ * tx — no separate /delegate call required. See
3368
+ * `attachDelegationIfNeeded` in `@pafi-dev/core`.
3369
+ */
3370
+ eip7702Auth?: {
3371
+ chainId: string;
3372
+ address: string;
3373
+ nonce: string;
3374
+ r: string;
3375
+ s: string;
3376
+ yParity: string;
3377
+ };
3326
3378
  }): Promise<MobilePrepareDto>;
3327
3379
  claimSubmit(input: {
3328
3380
  authenticatedAddress: Address;
@@ -3336,6 +3388,18 @@ declare class IssuerApiAdapter {
3336
3388
  pointTokenAddress: Address;
3337
3389
  amount: bigint;
3338
3390
  aaNonce: bigint;
3391
+ /**
3392
+ * Optional EIP-7702 authorization for atomic activation — see
3393
+ * `claimPrepare` for the full rationale + Privy hook reference.
3394
+ */
3395
+ eip7702Auth?: {
3396
+ chainId: string;
3397
+ address: string;
3398
+ nonce: string;
3399
+ r: string;
3400
+ s: string;
3401
+ yParity: string;
3402
+ };
3339
3403
  }): Promise<RedeemPrepareDto>;
3340
3404
  redeemSubmit(input: {
3341
3405
  authenticatedAddress: Address;
package/dist/index.js CHANGED
@@ -2658,7 +2658,8 @@ async function prepareMobileUserOp(params) {
2658
2658
  paymasterData: userOp.paymasterData,
2659
2659
  chainId: params.chainId,
2660
2660
  userOpHash,
2661
- fallback: fallbackEntry
2661
+ fallback: fallbackEntry,
2662
+ eip7702Auth: params.eip7702Auth
2662
2663
  };
2663
2664
  await params.store.save(params.lockId, entry, params.ttlSeconds);
2664
2665
  return {
@@ -2813,7 +2814,7 @@ async function handleMobilePrepare(params) {
2813
2814
  params.provider.estimateFeesPerGas(),
2814
2815
  params.provider.getCode({ address: params.userAddress })
2815
2816
  ]);
2816
- const needsDelegation = parseEip7702DelegatedAddress(userCode) === null;
2817
+ const needsDelegation = !params.eip7702Auth && parseEip7702DelegatedAddress(userCode) === null;
2817
2818
  const sponsoredOp = {
2818
2819
  ...params.partialUserOp,
2819
2820
  maxFeePerGas: fees.maxFeePerGas ?? params.partialUserOp.maxFeePerGas ?? 0n,
@@ -2834,7 +2835,8 @@ async function handleMobilePrepare(params) {
2834
2835
  paymasterFields,
2835
2836
  chainId: params.chainId,
2836
2837
  store: params.store,
2837
- ttlSeconds: params.ttlSeconds
2838
+ ttlSeconds: params.ttlSeconds,
2839
+ eip7702Auth: params.eip7702Auth
2838
2840
  });
2839
2841
  return {
2840
2842
  ...prepared,
@@ -2855,7 +2857,8 @@ async function handleMobileSubmit(params) {
2855
2857
  const result = await relayUserOp({
2856
2858
  client: params.pafiBackendClient,
2857
2859
  userOp: userOpJson,
2858
- entryPoint: params.entryPoint ?? ENTRY_POINT_V08
2860
+ entryPoint: params.entryPoint ?? ENTRY_POINT_V08,
2861
+ eip7702Auth: entry.eip7702Auth
2859
2862
  });
2860
2863
  await params.bindUserOpHash(params.lockId, result.userOpHash);
2861
2864
  await params.store.delete(params.lockId);
@@ -3566,7 +3569,8 @@ var IssuerApiAdapter = class {
3566
3569
  claimResult.fallback,
3567
3570
  "mint",
3568
3571
  pointTokenAddress,
3569
- claimResult.expiresInSeconds
3572
+ claimResult.expiresInSeconds,
3573
+ input.eip7702Auth
3570
3574
  );
3571
3575
  return {
3572
3576
  lockId: claimResult.lockId,
@@ -3611,7 +3615,8 @@ var IssuerApiAdapter = class {
3611
3615
  redeemResponse.fallback?.userOp,
3612
3616
  "burn",
3613
3617
  pointTokenAddress,
3614
- redeemResponse.expiresInSeconds
3618
+ redeemResponse.expiresInSeconds,
3619
+ input.eip7702Auth
3615
3620
  );
3616
3621
  return {
3617
3622
  lockId: redeemResponse.lockId,
@@ -3745,7 +3750,7 @@ var IssuerApiAdapter = class {
3745
3750
  issuerSignerWallet: this.cfg.issuerSignerWallet
3746
3751
  });
3747
3752
  }
3748
- async runMobilePrepare(authenticatedAddress, chainId, lockId, partialUserOp, partialUserOpFallback, scenario, pointTokenAddress, ttlSeconds) {
3753
+ async runMobilePrepare(authenticatedAddress, chainId, lockId, partialUserOp, partialUserOpFallback, scenario, pointTokenAddress, ttlSeconds, eip7702Auth) {
3749
3754
  return await handleMobilePrepare({
3750
3755
  userAddress: authenticatedAddress,
3751
3756
  chainId,
@@ -3758,7 +3763,8 @@ var IssuerApiAdapter = class {
3758
3763
  store: this.cfg.pendingUserOpStore,
3759
3764
  provider: this.cfg.provider,
3760
3765
  pafiBackendClient: this.cfg.pafiBackendClient,
3761
- onWarning: this.cfg.onWarning
3766
+ onWarning: this.cfg.onWarning,
3767
+ eip7702Auth
3762
3768
  });
3763
3769
  }
3764
3770
  assertRedeemHandler() {
@@ -5021,7 +5027,7 @@ var MemoryRedemptionHistoryStore = class {
5021
5027
  };
5022
5028
 
5023
5029
  // src/index.ts
5024
- var PAFI_ISSUER_SDK_VERSION = true ? "0.26.0" : "dev";
5030
+ var PAFI_ISSUER_SDK_VERSION = true ? "0.27.0" : "dev";
5025
5031
  export {
5026
5032
  AdapterMisconfiguredError,
5027
5033
  AuthError,