@pafi-dev/issuer 0.26.1 → 0.27.1

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,
@@ -2825,7 +2826,8 @@ async function handleMobilePrepare(params) {
2825
2826
  scenario: params.scenario,
2826
2827
  userOp: sponsoredOp,
2827
2828
  pointTokenAddress: params.pointTokenAddress,
2828
- onWarning: params.onWarning
2829
+ onWarning: params.onWarning,
2830
+ eip7702Auth: params.eip7702Auth
2829
2831
  });
2830
2832
  const prepared = await prepareMobileUserOp({
2831
2833
  lockId: params.lockId,
@@ -2834,7 +2836,8 @@ async function handleMobilePrepare(params) {
2834
2836
  paymasterFields,
2835
2837
  chainId: params.chainId,
2836
2838
  store: params.store,
2837
- ttlSeconds: params.ttlSeconds
2839
+ ttlSeconds: params.ttlSeconds,
2840
+ eip7702Auth: params.eip7702Auth
2838
2841
  });
2839
2842
  return {
2840
2843
  ...prepared,
@@ -2855,7 +2858,8 @@ async function handleMobileSubmit(params) {
2855
2858
  const result = await relayUserOp({
2856
2859
  client: params.pafiBackendClient,
2857
2860
  userOp: userOpJson,
2858
- entryPoint: params.entryPoint ?? ENTRY_POINT_V08
2861
+ entryPoint: params.entryPoint ?? ENTRY_POINT_V08,
2862
+ eip7702Auth: entry.eip7702Auth
2859
2863
  });
2860
2864
  await params.bindUserOpHash(params.lockId, result.userOpHash);
2861
2865
  await params.store.delete(params.lockId);
@@ -3566,7 +3570,8 @@ var IssuerApiAdapter = class {
3566
3570
  claimResult.fallback,
3567
3571
  "mint",
3568
3572
  pointTokenAddress,
3569
- claimResult.expiresInSeconds
3573
+ claimResult.expiresInSeconds,
3574
+ input.eip7702Auth
3570
3575
  );
3571
3576
  return {
3572
3577
  lockId: claimResult.lockId,
@@ -3611,7 +3616,8 @@ var IssuerApiAdapter = class {
3611
3616
  redeemResponse.fallback?.userOp,
3612
3617
  "burn",
3613
3618
  pointTokenAddress,
3614
- redeemResponse.expiresInSeconds
3619
+ redeemResponse.expiresInSeconds,
3620
+ input.eip7702Auth
3615
3621
  );
3616
3622
  return {
3617
3623
  lockId: redeemResponse.lockId,
@@ -3745,7 +3751,7 @@ var IssuerApiAdapter = class {
3745
3751
  issuerSignerWallet: this.cfg.issuerSignerWallet
3746
3752
  });
3747
3753
  }
3748
- async runMobilePrepare(authenticatedAddress, chainId, lockId, partialUserOp, partialUserOpFallback, scenario, pointTokenAddress, ttlSeconds) {
3754
+ async runMobilePrepare(authenticatedAddress, chainId, lockId, partialUserOp, partialUserOpFallback, scenario, pointTokenAddress, ttlSeconds, eip7702Auth) {
3749
3755
  return await handleMobilePrepare({
3750
3756
  userAddress: authenticatedAddress,
3751
3757
  chainId,
@@ -3758,7 +3764,8 @@ var IssuerApiAdapter = class {
3758
3764
  store: this.cfg.pendingUserOpStore,
3759
3765
  provider: this.cfg.provider,
3760
3766
  pafiBackendClient: this.cfg.pafiBackendClient,
3761
- onWarning: this.cfg.onWarning
3767
+ onWarning: this.cfg.onWarning,
3768
+ eip7702Auth
3762
3769
  });
3763
3770
  }
3764
3771
  assertRedeemHandler() {
@@ -5021,7 +5028,7 @@ var MemoryRedemptionHistoryStore = class {
5021
5028
  };
5022
5029
 
5023
5030
  // src/index.ts
5024
- var PAFI_ISSUER_SDK_VERSION = true ? "0.26.0" : "dev";
5031
+ var PAFI_ISSUER_SDK_VERSION = true ? "0.27.1" : "dev";
5025
5032
  export {
5026
5033
  AdapterMisconfiguredError,
5027
5034
  AuthError,