@pafi-dev/issuer 0.39.3 → 0.41.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
@@ -45,7 +45,7 @@ __export(index_exports, {
45
45
  NonceManager: () => NonceManager,
46
46
  NoopRateLimiter: () => NoopRateLimiter,
47
47
  PAFI_ISSUER_SDK_VERSION: () => PAFI_ISSUER_SDK_VERSION,
48
- PAFI_SUBGRAPH_URL: () => import_core15.PAFI_SUBGRAPH_URL,
48
+ PAFI_SUBGRAPH_URL: () => import_core14.PAFI_SUBGRAPH_URL,
49
49
  PTClaimError: () => PTClaimError,
50
50
  PTClaimHandler: () => PTClaimHandler,
51
51
  PTRedeemError: () => PTRedeemError,
@@ -83,7 +83,6 @@ __export(index_exports, {
83
83
  defaultPolicyFor: () => defaultPolicyFor,
84
84
  evaluateRedemption: () => evaluateRedemption,
85
85
  handleClaimStatus: () => handleClaimStatus,
86
- handleDelegateSubmit: () => handleDelegateSubmit,
87
86
  handleMobilePrepare: () => handleMobilePrepare,
88
87
  handleMobileSubmit: () => handleMobileSubmit,
89
88
  handleRedeemStatus: () => handleRedeemStatus,
@@ -95,8 +94,7 @@ __export(index_exports, {
95
94
  prepareMobileUserOp: () => prepareMobileUserOp,
96
95
  relayUserOp: () => relayUserOp,
97
96
  requestPaymaster: () => requestPaymaster,
98
- serializeEntryToJsonRpc: () => serializeEntryToJsonRpc,
99
- serializeUserOpTypedData: () => serializeUserOpTypedData
97
+ serializeEntryToJsonRpc: () => serializeEntryToJsonRpc
100
98
  });
101
99
  module.exports = __toCommonJS(index_exports);
102
100
 
@@ -2770,24 +2768,6 @@ var MemoryPendingUserOpStore = class {
2770
2768
 
2771
2769
  // src/userop-store/prepareUserOp.ts
2772
2770
  var import_core9 = require("@pafi-dev/core");
2773
- function serializeUserOpTypedData(td) {
2774
- return {
2775
- domain: td.domain,
2776
- types: td.types,
2777
- primaryType: td.primaryType,
2778
- message: {
2779
- sender: td.message.sender,
2780
- nonce: `0x${td.message.nonce.toString(16)}`,
2781
- initCode: td.message.initCode,
2782
- callData: td.message.callData,
2783
- accountGasLimits: td.message.accountGasLimits,
2784
- preVerificationGas: `0x${td.message.preVerificationGas.toString(16)}`,
2785
- gasFees: td.message.gasFees,
2786
- paymasterAndData: td.message.paymasterAndData
2787
- }
2788
- };
2789
- }
2790
- __name(serializeUserOpTypedData, "serializeUserOpTypedData");
2791
2771
  function mergePaymasterFields(userOp, paymasterFields) {
2792
2772
  if (!paymasterFields) return userOp;
2793
2773
  const merged = {
@@ -2803,8 +2783,7 @@ function applyPaymasterGasEstimates(partialUserOp, paymasterFields, chainId) {
2803
2783
  const userOp = mergePaymasterFields(partialUserOp, paymasterFields);
2804
2784
  return {
2805
2785
  userOp,
2806
- userOpHash: (0, import_core9.computeUserOpHash)(userOp, chainId),
2807
- typedData: serializeUserOpTypedData((0, import_core9.buildUserOpTypedData)(userOp, chainId))
2786
+ userOpHash: (0, import_core9.computeUserOpHash)(userOp, chainId)
2808
2787
  };
2809
2788
  }
2810
2789
  __name(applyPaymasterGasEstimates, "applyPaymasterGasEstimates");
@@ -3064,7 +3043,7 @@ async function handleMobileSubmit(params) {
3064
3043
  const result = await relayUserOp({
3065
3044
  client: params.pafiBackendClient,
3066
3045
  userOp: userOpJson,
3067
- entryPoint: params.entryPoint ?? import_core10.ENTRY_POINT_V08,
3046
+ entryPoint: params.entryPoint ?? import_core10.ENTRY_POINT_V07,
3068
3047
  eip7702Auth: entry.eip7702Auth
3069
3048
  });
3070
3049
  const targetLockId = variant === "fallback" && entry.fallback?.lockId ? entry.fallback.lockId : params.lockId;
@@ -3169,7 +3148,7 @@ var PTClaimHandler = class {
3169
3148
  }
3170
3149
  }
3171
3150
  const chainAddresses = (0, import_core11.getContractAddresses)(request.chainId);
3172
- const { batchExecutor: batchExecutorAddress } = chainAddresses;
3151
+ const { kernel: batchExecutorAddress } = chainAddresses;
3173
3152
  let mintRequestNonce;
3174
3153
  try {
3175
3154
  mintRequestNonce = await this.cfg.provider.readContract({
@@ -3283,8 +3262,8 @@ var PTClaimHandler = class {
3283
3262
  throw new PTClaimError("BUILD_FAILED", `prepareMint (fallback) failed: ${err instanceof Error ? err.message : String(err)}`);
3284
3263
  }
3285
3264
  }
3286
- const calls = (0, import_core11.decodeBatchExecuteCalls)(userOp.callData);
3287
- const callsFallback = fallback ? (0, import_core11.decodeBatchExecuteCalls)(fallback.callData) : void 0;
3265
+ const calls = (0, import_core11.decodeKernelExecuteCalls)(userOp.callData);
3266
+ const callsFallback = fallback ? (0, import_core11.decodeKernelExecuteCalls)(fallback.callData) : void 0;
3288
3267
  return {
3289
3268
  userOp,
3290
3269
  fallback,
@@ -3429,122 +3408,15 @@ var PerpDepositHandler = class {
3429
3408
  brokerHash,
3430
3409
  usdcAddress,
3431
3410
  relayAddress,
3432
- calls: (0, import_core12.decodeBatchExecuteCalls)(sponsoredOp.callData),
3433
- callsFallback: fallbackOp ? (0, import_core12.decodeBatchExecuteCalls)(fallbackOp.callData) : void 0
3411
+ calls: (0, import_core12.decodeKernelExecuteCalls)(sponsoredOp.callData),
3412
+ callsFallback: fallbackOp ? (0, import_core12.decodeKernelExecuteCalls)(fallbackOp.callData) : void 0
3434
3413
  };
3435
3414
  }
3436
3415
  };
3437
3416
 
3438
- // src/api/delegateHandler.ts
3439
- var import_core13 = require("@pafi-dev/core");
3440
- var import_viem11 = require("viem");
3441
- var DEFAULT_DELEGATE_GAS = {
3442
- callGasLimit: 100000n,
3443
- verificationGasLimit: 150000n,
3444
- preVerificationGas: 50000n
3445
- };
3446
- async function handleDelegatePrepare(params) {
3447
- const { batchExecutor } = (0, import_core13.getContractAddresses)(params.chainId);
3448
- const partial = (0, import_core13.buildDelegationUserOp)({
3449
- userAddress: params.userAddress,
3450
- aaNonce: params.aaNonce,
3451
- gasLimits: {
3452
- callGasLimit: params.gasLimits?.callGasLimit ?? DEFAULT_DELEGATE_GAS.callGasLimit,
3453
- verificationGasLimit: params.gasLimits?.verificationGasLimit ?? DEFAULT_DELEGATE_GAS.verificationGasLimit,
3454
- preVerificationGas: params.gasLimits?.preVerificationGas ?? DEFAULT_DELEGATE_GAS.preVerificationGas
3455
- }
3456
- });
3457
- const userOp = {
3458
- sender: partial.sender,
3459
- nonce: partial.nonce,
3460
- callData: partial.callData,
3461
- callGasLimit: partial.callGasLimit,
3462
- verificationGasLimit: partial.verificationGasLimit,
3463
- preVerificationGas: partial.preVerificationGas,
3464
- maxFeePerGas: params.fees.maxFeePerGas ?? 0n,
3465
- maxPriorityFeePerGas: params.fees.maxPriorityFeePerGas ?? 0n
3466
- };
3467
- const authorization = (0, import_core13.buildEip7702Authorization)({
3468
- chainId: params.chainId,
3469
- address: batchExecutor,
3470
- nonce: params.delegationNonce,
3471
- authSig: params.authSig
3472
- });
3473
- const paymasterFields = await requestPaymaster({
3474
- client: params.pafiBackendClient,
3475
- chainId: params.chainId,
3476
- scenario: "delegate",
3477
- userOp,
3478
- pointTokenAddress: batchExecutor,
3479
- eip7702Auth: authorization,
3480
- onWarning: params.onWarning
3481
- });
3482
- const prepared = applyPaymasterGasEstimates(userOp, paymasterFields, params.chainId);
3483
- const merged = prepared.userOp;
3484
- const userOpHash = prepared.userOpHash;
3485
- await params.store.save(params.lockId, {
3486
- sender: merged.sender,
3487
- nonce: merged.nonce.toString(10),
3488
- callData: merged.callData,
3489
- callGasLimit: merged.callGasLimit.toString(10),
3490
- verificationGasLimit: merged.verificationGasLimit.toString(10),
3491
- preVerificationGas: merged.preVerificationGas.toString(10),
3492
- maxFeePerGas: merged.maxFeePerGas.toString(10),
3493
- maxPriorityFeePerGas: merged.maxPriorityFeePerGas.toString(10),
3494
- ...merged.paymaster ? {
3495
- paymaster: merged.paymaster
3496
- } : {},
3497
- ...merged.paymasterVerificationGasLimit ? {
3498
- paymasterVerificationGasLimit: merged.paymasterVerificationGasLimit.toString(10)
3499
- } : {},
3500
- ...merged.paymasterPostOpGasLimit ? {
3501
- paymasterPostOpGasLimit: merged.paymasterPostOpGasLimit.toString(10)
3502
- } : {},
3503
- ...merged.paymasterData ? {
3504
- paymasterData: merged.paymasterData
3505
- } : {},
3506
- chainId: params.chainId,
3507
- userOpHash,
3508
- eip7702Auth: authorization
3509
- }, params.ttlSeconds);
3510
- return {
3511
- lockId: params.lockId,
3512
- userOpHash,
3513
- typedData: prepared.typedData,
3514
- expiresInSeconds: params.ttlSeconds,
3515
- isSponsored: !!paymasterFields
3516
- };
3517
- }
3518
- __name(handleDelegatePrepare, "handleDelegatePrepare");
3519
- async function handleDelegateSubmit(params) {
3520
- const entry = await params.store.get(params.lockId);
3521
- if (!entry) {
3522
- throw new PendingUserOpNotFoundError(params.lockId);
3523
- }
3524
- if ((0, import_viem11.getAddress)(entry.sender) !== (0, import_viem11.getAddress)(params.authenticatedAddress)) {
3525
- throw new PendingUserOpForbiddenError(params.lockId);
3526
- }
3527
- if (!entry.eip7702Auth) {
3528
- throw new Error(`delegate entry ${params.lockId} missing eip7702Auth \u2014 prepare step did not run correctly`);
3529
- }
3530
- const userOpJson = serializeEntryToJsonRpc(entry, params.userOpSig, "sponsored");
3531
- const result = await relayUserOp({
3532
- client: params.pafiBackendClient,
3533
- userOp: userOpJson,
3534
- entryPoint: params.entryPoint ?? import_core13.ENTRY_POINT_V08,
3535
- eip7702Auth: entry.eip7702Auth
3536
- });
3537
- await params.store.delete(params.lockId);
3538
- return {
3539
- userOpHash: result.userOpHash
3540
- };
3541
- }
3542
- __name(handleDelegateSubmit, "handleDelegateSubmit");
3543
-
3544
3417
  // src/api/issuerApiAdapter.ts
3545
- var import_node_crypto3 = require("crypto");
3546
- var import_viem12 = require("viem");
3547
- var import_core14 = require("@pafi-dev/core");
3418
+ var import_viem11 = require("viem");
3419
+ var import_core13 = require("@pafi-dev/core");
3548
3420
  var AdapterMisconfiguredError = class extends Error {
3549
3421
  static {
3550
3422
  __name(this, "AdapterMisconfiguredError");
@@ -3599,7 +3471,7 @@ var IssuerApiAdapter = class {
3599
3471
  async pools(authenticatedAddress, chainId, pointTokenAddress) {
3600
3472
  const result = await this.cfg.issuerService.api.handlePools(authenticatedAddress, {
3601
3473
  chainId,
3602
- pointTokenAddress: (0, import_viem12.getAddress)(pointTokenAddress)
3474
+ pointTokenAddress: (0, import_viem11.getAddress)(pointTokenAddress)
3603
3475
  });
3604
3476
  return {
3605
3477
  pools: result.pools
@@ -3608,8 +3480,8 @@ var IssuerApiAdapter = class {
3608
3480
  async user(authenticatedAddress, chainId, userAddress, pointTokenAddress) {
3609
3481
  const result = await this.cfg.issuerService.api.handleUser(authenticatedAddress, {
3610
3482
  chainId,
3611
- userAddress: (0, import_viem12.getAddress)(userAddress),
3612
- pointTokenAddress: (0, import_viem12.getAddress)(pointTokenAddress)
3483
+ userAddress: (0, import_viem11.getAddress)(userAddress),
3484
+ pointTokenAddress: (0, import_viem11.getAddress)(pointTokenAddress)
3613
3485
  });
3614
3486
  return {
3615
3487
  offChainBalance: result.offChainBalance.toString(),
@@ -3624,7 +3496,7 @@ var IssuerApiAdapter = class {
3624
3496
  // ------------------------------ Action endpoints -------------------------
3625
3497
  async claim(input) {
3626
3498
  const ptClaimHandler = this.assertHandler(this.cfg.ptClaimHandler, "ptClaimHandler", "claim");
3627
- const pointTokenAddress = (0, import_viem12.getAddress)(input.pointTokenAddress);
3499
+ const pointTokenAddress = (0, import_viem11.getAddress)(input.pointTokenAddress);
3628
3500
  const result = await ptClaimHandler.handle({
3629
3501
  authenticatedAddress: input.authenticatedAddress,
3630
3502
  userAddress: input.authenticatedAddress,
@@ -3633,19 +3505,17 @@ var IssuerApiAdapter = class {
3633
3505
  chainId: input.chainId,
3634
3506
  aaNonce: input.aaNonce
3635
3507
  });
3636
- const sponsorAuth = await this.buildSponsorAuth(input.authenticatedAddress, result.userOp.callData, input.chainId, "mint");
3637
3508
  return {
3638
3509
  calls: result.calls,
3639
3510
  callsFallback: result.callsFallback,
3640
3511
  feeAmount: result.feeAmount.toString(),
3641
3512
  lockId: result.lockId,
3642
- signatureDeadline: result.signatureDeadline.toString(),
3643
- sponsorAuth
3513
+ signatureDeadline: result.signatureDeadline.toString()
3644
3514
  };
3645
3515
  }
3646
3516
  async redeem(input) {
3647
3517
  this.assertRedeemHandler();
3648
- const pointTokenAddress = (0, import_viem12.getAddress)(input.pointTokenAddress);
3518
+ const pointTokenAddress = (0, import_viem11.getAddress)(input.pointTokenAddress);
3649
3519
  const response = await this.cfg.ptRedeemHandler.handle({
3650
3520
  userAddress: input.authenticatedAddress,
3651
3521
  authenticatedAddress: input.authenticatedAddress,
@@ -3654,18 +3524,16 @@ var IssuerApiAdapter = class {
3654
3524
  aaNonce: input.aaNonce,
3655
3525
  chainId: input.chainId
3656
3526
  });
3657
- const sponsorAuth = await this.buildSponsorAuth(input.authenticatedAddress, response.userOp.callData, input.chainId, "burn");
3658
3527
  return {
3659
- calls: (0, import_core14.decodeBatchExecuteCalls)(response.userOp.callData),
3660
- callsFallback: response.fallback ? (0, import_core14.decodeBatchExecuteCalls)(response.fallback.userOp.callData) : void 0,
3528
+ calls: (0, import_core13.decodeKernelExecuteCalls)(response.userOp.callData),
3529
+ callsFallback: response.fallback ? (0, import_core13.decodeKernelExecuteCalls)(response.fallback.userOp.callData) : void 0,
3661
3530
  feeAmount: response.feeAmount.toString(),
3662
3531
  lockId: response.lockId,
3663
3532
  lockIdFallback: response.fallback?.lockId,
3664
3533
  netCreditAmount: response.netCreditAmount.toString(),
3665
3534
  netCreditAmountFallback: response.fallback?.netCreditAmount.toString(),
3666
3535
  expiresInSeconds: response.expiresInSeconds,
3667
- signatureDeadline: response.signatureDeadline.toString(),
3668
- sponsorAuth
3536
+ signatureDeadline: response.signatureDeadline.toString()
3669
3537
  };
3670
3538
  }
3671
3539
  // swap() removed (2026-04-27) — moved to @pafi-dev/trading.
@@ -3679,7 +3547,6 @@ var IssuerApiAdapter = class {
3679
3547
  brokerId: input.brokerId,
3680
3548
  aaNonce: input.aaNonce
3681
3549
  });
3682
- const sponsorAuth = await this.buildSponsorAuth(input.authenticatedAddress, result.userOp.callData, input.chainId, "perp-deposit");
3683
3550
  return {
3684
3551
  calls: result.calls,
3685
3552
  callsFallback: result.callsFallback,
@@ -3690,14 +3557,13 @@ var IssuerApiAdapter = class {
3690
3557
  accountId: result.accountId,
3691
3558
  brokerHash: result.brokerHash,
3692
3559
  usdcAddress: result.usdcAddress,
3693
- relayAddress: result.relayAddress,
3694
- sponsorAuth
3560
+ relayAddress: result.relayAddress
3695
3561
  };
3696
3562
  }
3697
3563
  // ------------------------------ Mobile endpoints -------------------------
3698
3564
  async claimPrepare(input) {
3699
3565
  const ptClaimHandler = this.assertHandler(this.cfg.ptClaimHandler, "ptClaimHandler", "claimPrepare");
3700
- const pointTokenAddress = (0, import_viem12.getAddress)(input.pointTokenAddress);
3566
+ const pointTokenAddress = (0, import_viem11.getAddress)(input.pointTokenAddress);
3701
3567
  const claimResult = await ptClaimHandler.handle({
3702
3568
  authenticatedAddress: input.authenticatedAddress,
3703
3569
  userAddress: input.authenticatedAddress,
@@ -3710,9 +3576,7 @@ var IssuerApiAdapter = class {
3710
3576
  return {
3711
3577
  lockId: claimResult.lockId,
3712
3578
  userOpHash: prepared.sponsored.userOpHash,
3713
- typedData: prepared.sponsored.typedData,
3714
3579
  userOpHashFallback: prepared.fallback?.userOpHash,
3715
- typedDataFallback: prepared.fallback?.typedData,
3716
3580
  feeAmount: claimResult.feeAmount.toString(),
3717
3581
  signatureDeadline: claimResult.signatureDeadline.toString(),
3718
3582
  expiresInSeconds: claimResult.expiresInSeconds,
@@ -3733,7 +3597,7 @@ var IssuerApiAdapter = class {
3733
3597
  }
3734
3598
  async redeemPrepare(input) {
3735
3599
  this.assertRedeemHandler();
3736
- const pointTokenAddress = (0, import_viem12.getAddress)(input.pointTokenAddress);
3600
+ const pointTokenAddress = (0, import_viem11.getAddress)(input.pointTokenAddress);
3737
3601
  const redeemResponse = await this.cfg.ptRedeemHandler.handle({
3738
3602
  userAddress: input.authenticatedAddress,
3739
3603
  authenticatedAddress: input.authenticatedAddress,
@@ -3747,9 +3611,7 @@ var IssuerApiAdapter = class {
3747
3611
  lockId: redeemResponse.lockId,
3748
3612
  lockIdFallback: redeemResponse.fallback?.lockId,
3749
3613
  userOpHash: prepared.sponsored.userOpHash,
3750
- typedData: prepared.sponsored.typedData,
3751
3614
  userOpHashFallback: prepared.fallback?.userOpHash,
3752
- typedDataFallback: prepared.fallback?.typedData,
3753
3615
  netCreditAmount: redeemResponse.netCreditAmount.toString(),
3754
3616
  netCreditAmountFallback: redeemResponse.fallback?.netCreditAmount.toString(),
3755
3617
  feeAmount: redeemResponse.feeAmount.toString(),
@@ -3790,97 +3652,11 @@ var IssuerApiAdapter = class {
3790
3652
  onWarning: this.cfg.onWarning
3791
3653
  });
3792
3654
  }
3793
- // ------------------------------ Delegate endpoints -----------------------
3794
- async delegateStatus(authenticatedAddress, chainId) {
3795
- const { batchExecutor } = (0, import_core14.getContractAddresses)(chainId);
3796
- const [code, nonce] = await Promise.all([
3797
- this.cfg.provider.getCode({
3798
- address: authenticatedAddress
3799
- }),
3800
- this.cfg.provider.getTransactionCount({
3801
- address: authenticatedAddress,
3802
- blockTag: "pending"
3803
- })
3804
- ]);
3805
- return {
3806
- isDelegated: (0, import_core14.parseEip7702DelegatedAddress)(code) !== null,
3807
- batchExecutorAddress: batchExecutor,
3808
- delegationNonce: nonce.toString(),
3809
- chainId
3810
- };
3811
- }
3812
- /**
3813
- * Build the delegation-anchor UserOp + obtain paymaster sponsorship
3814
- * + persist as a pending entry. Mobile must:
3815
- *
3816
- * 1. Sign EIP-7702 authorization LOCALLY (Privy `signAuthorization`
3817
- * with `{contractAddress: batchExecutorAddress, chainId,
3818
- * nonce: delegationNonce}`) → 65-byte authSig hex.
3819
- * 2. POST `/delegate/prepare` with `{ chainId, delegationNonce,
3820
- * authSig }` → this method.
3821
- * 3. Sign returned `userOpHash` LOCALLY (`signTypedData(typedData)`).
3822
- * 4. POST `/delegate/submit` with `{ lockId, userOpSig }`.
3823
- *
3824
- * v0.7.7 — replaces single-shot delegateSubmit that tried to relay
3825
- * a UserOp with empty `signature: "0x"` (Simple7702Account's
3826
- * validateUserOp reverts `ECDSAInvalidSignatureLength` 0xfce698f7).
3827
- */
3828
- async delegatePrepare(authenticatedAddress, input) {
3829
- const { batchExecutor } = (0, import_core14.getContractAddresses)(input.chainId);
3830
- const fees = await this.cfg.provider.estimateFeesPerGas();
3831
- const lockId = (0, import_node_crypto3.randomUUID)();
3832
- const result = await handleDelegatePrepare({
3833
- userAddress: authenticatedAddress,
3834
- chainId: input.chainId,
3835
- delegationNonce: input.delegationNonce,
3836
- aaNonce: input.aaNonce,
3837
- authSig: input.authSig,
3838
- fees,
3839
- lockId,
3840
- store: this.cfg.pendingUserOpStore,
3841
- ttlSeconds: 15 * 60,
3842
- pafiBackendClient: this.cfg.pafiBackendClient,
3843
- onWarning: this.cfg.onWarning
3844
- });
3845
- return {
3846
- lockId: result.lockId,
3847
- userOpHash: result.userOpHash,
3848
- typedData: result.typedData,
3849
- expiresInSeconds: result.expiresInSeconds,
3850
- isSponsored: result.isSponsored,
3851
- delegationNonce: input.delegationNonce.toString(),
3852
- batchExecutorAddress: batchExecutor,
3853
- chainId: input.chainId
3854
- };
3855
- }
3856
- async delegateSubmit(input) {
3857
- const result = await handleDelegateSubmit({
3858
- lockId: input.lockId,
3859
- authenticatedAddress: input.authenticatedAddress,
3860
- userOpSig: input.userOpSig,
3861
- store: this.cfg.pendingUserOpStore,
3862
- pafiBackendClient: this.cfg.pafiBackendClient
3863
- });
3864
- return {
3865
- userOpHash: result.userOpHash
3866
- };
3867
- }
3655
+ // Delegate endpoints removed — folded-in delegation (via
3656
+ // `eip7702Auth` on claim/redeem prepare) is now the only path. The
3657
+ // bundler applies SetCode + handleOps in one tx, so there is no
3658
+ // separate `/delegate/*` flow. See `handleMobilePrepare`.
3868
3659
  // ------------------------------ Internal helpers -------------------------
3869
- /**
3870
- * Build + sign a SponsorAuth payload. Returns `undefined` when no
3871
- * issuer id is configured, so the controller can skip the field.
3872
- */
3873
- async buildSponsorAuth(authenticatedAddress, callData, chainId, scenario) {
3874
- if (!this.cfg.pafiIssuerId) return void 0;
3875
- return (0, import_core14.buildAndSignSponsorAuth)({
3876
- userAddress: authenticatedAddress,
3877
- callData,
3878
- chainId,
3879
- scenario,
3880
- issuerId: this.cfg.pafiIssuerId,
3881
- issuerSignerWallet: this.cfg.issuerSignerWallet
3882
- });
3883
- }
3884
3660
  async runMobilePrepare(authenticatedAddress, chainId, lockId, partialUserOp, partialUserOpFallback, scenario, pointTokenAddress, ttlSeconds, eip7702Auth, lockIdFallback) {
3885
3661
  return await handleMobilePrepare({
3886
3662
  userAddress: authenticatedAddress,
@@ -3919,8 +3695,8 @@ var IssuerApiAdapter = class {
3919
3695
  };
3920
3696
 
3921
3697
  // src/pools/subgraphPoolsProvider.ts
3922
- var import_viem13 = require("viem");
3923
- var import_core15 = require("@pafi-dev/core");
3698
+ var import_viem12 = require("viem");
3699
+ var import_core14 = require("@pafi-dev/core");
3924
3700
  var DEFAULT_CACHE_TTL_MS = 3e4;
3925
3701
  var MAX_REASONABLE_FEE_TIER = 1e6;
3926
3702
  var POOL_QUERY = `
@@ -3937,7 +3713,7 @@ var POOL_QUERY = `
3937
3713
  }
3938
3714
  `;
3939
3715
  function createSubgraphPoolsProvider(config = {}) {
3940
- const subgraphUrl = config.subgraphUrl ?? import_core15.PAFI_SUBGRAPH_URL;
3716
+ const subgraphUrl = config.subgraphUrl ?? import_core14.PAFI_SUBGRAPH_URL;
3941
3717
  try {
3942
3718
  const parsed = new URL(subgraphUrl);
3943
3719
  if (process.env.NODE_ENV === "production" && parsed.protocol !== "https:") {
@@ -4034,7 +3810,7 @@ async function fetchPoolsFromSubgraph(fetchImpl, subgraphUrl, pointTokenAddress,
4034
3810
  return [];
4035
3811
  }
4036
3812
  const { pool } = token;
4037
- if (!(0, import_viem13.isAddress)(pool.token0.id) || !(0, import_viem13.isAddress)(pool.token1.id)) {
3813
+ if (!(0, import_viem12.isAddress)(pool.token0.id) || !(0, import_viem12.isAddress)(pool.token1.id)) {
4038
3814
  const error = new Error("[PAFI] SubgraphPoolsProvider: invalid token address in response");
4039
3815
  console.error(error.message, "\u2014 skipping pool");
4040
3816
  reportError(error);
@@ -4082,7 +3858,7 @@ var PRICE_QUERY = `
4082
3858
  }
4083
3859
  `;
4084
3860
  function createSubgraphNativeUsdtQuoter(config = {}) {
4085
- const subgraphUrl = config.subgraphUrl ?? import_core15.PAFI_SUBGRAPH_URL;
3861
+ const subgraphUrl = config.subgraphUrl ?? import_core14.PAFI_SUBGRAPH_URL;
4086
3862
  try {
4087
3863
  const parsed = new URL(subgraphUrl);
4088
3864
  if (process.env.NODE_ENV === "production" && parsed.protocol !== "https:") {
@@ -4176,8 +3952,8 @@ function toUsdtPerNative(priceFloat, usdtDecimals) {
4176
3952
  __name(toUsdtPerNative, "toUsdtPerNative");
4177
3953
 
4178
3954
  // src/pools/nativePtQuoter.ts
4179
- var import_viem14 = require("viem");
4180
- var CHAINLINK_ABI = (0, import_viem14.parseAbi)([
3955
+ var import_viem13 = require("viem");
3956
+ var CHAINLINK_ABI = (0, import_viem13.parseAbi)([
4181
3957
  "function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)"
4182
3958
  ]);
4183
3959
  var CHAINLINK_MAX_AGE_S = 3600n;
@@ -4194,7 +3970,7 @@ var POOL_PRICE_QUERY = `
4194
3970
  }
4195
3971
  `;
4196
3972
  function createNativePtQuoter(config) {
4197
- const { provider, pointTokenAddress, chainlinkFeedAddress = "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70", subgraphUrl = import_core15.PAFI_SUBGRAPH_URL, cacheTtlMs = 3e4, fallbackEthPriceUsd = 3e3, fallbackPtPriceUsdt = 0.1, failClosed = false, fetchImpl = globalThis.fetch, now = /* @__PURE__ */ __name(() => Date.now(), "now") } = config;
3973
+ const { provider, pointTokenAddress, chainlinkFeedAddress = "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70", subgraphUrl = import_core14.PAFI_SUBGRAPH_URL, cacheTtlMs = 3e4, fallbackEthPriceUsd = 3e3, fallbackPtPriceUsdt = 0.1, failClosed = false, fetchImpl = globalThis.fetch, now = /* @__PURE__ */ __name(() => Date.now(), "now") } = config;
4198
3974
  let ethPriceCache;
4199
3975
  let ptPriceCache;
4200
3976
  async function getEthPrice8dec() {
@@ -4290,7 +4066,7 @@ function parseBigDecimalTo18(s) {
4290
4066
  __name(parseBigDecimalTo18, "parseBigDecimalTo18");
4291
4067
 
4292
4068
  // src/pafi-backend/client.ts
4293
- var import_core16 = require("@pafi-dev/core");
4069
+ var import_core15 = require("@pafi-dev/core");
4294
4070
  function extractPafiErrorFields(json, status) {
4295
4071
  const inner = typeof json.error === "object" && json.error !== null ? json.error : null;
4296
4072
  const code = inner?.code ?? json.code ?? "INTERNAL_ERROR";
@@ -4320,7 +4096,7 @@ var PafiBackendClient = class {
4320
4096
  if (!config.issuerId) throw new Error("PafiBackendClient: issuerId is required");
4321
4097
  if (!config.apiKey) throw new Error("PafiBackendClient: apiKey is required");
4322
4098
  this.config = config;
4323
- this.baseUrl = (0, import_core16.getPafiServiceUrls)(config.chainId, {
4099
+ this.baseUrl = (0, import_core15.getPafiServiceUrls)(config.chainId, {
4324
4100
  sponsorRelayer: config.baseUrl
4325
4101
  }).sponsorRelayer;
4326
4102
  }
@@ -4472,8 +4248,8 @@ var PafiBackendClient = class {
4472
4248
  };
4473
4249
 
4474
4250
  // src/config.ts
4475
- var import_viem15 = require("viem");
4476
- var import_core19 = require("@pafi-dev/core");
4251
+ var import_viem14 = require("viem");
4252
+ var import_core18 = require("@pafi-dev/core");
4477
4253
 
4478
4254
  // src/redemption/evaluator.ts
4479
4255
  var SECONDS_PER_DAY = 24 * 60 * 60;
@@ -4587,10 +4363,10 @@ __name(nextBlackoutEndAfter, "nextBlackoutEndAfter");
4587
4363
  var REDEMPTION_HISTORY_WINDOW_SEC = SECONDS_PER_DAY;
4588
4364
 
4589
4365
  // src/redemption/policyProvider.ts
4590
- var import_core18 = require("@pafi-dev/core");
4366
+ var import_core17 = require("@pafi-dev/core");
4591
4367
 
4592
4368
  // src/redemption/settlementClient.ts
4593
- var import_core17 = require("@pafi-dev/core");
4369
+ var import_core16 = require("@pafi-dev/core");
4594
4370
  var DEFAULT_TIMEOUT_MS = 1e3;
4595
4371
  var SettlementClient = class {
4596
4372
  static {
@@ -4602,7 +4378,7 @@ var SettlementClient = class {
4602
4378
  if (!config.issuerId) throw new Error("SettlementClient: issuerId is required");
4603
4379
  if (!config.apiKey) throw new Error("SettlementClient: apiKey is required");
4604
4380
  this.config = {
4605
- baseUrl: (0, import_core17.getPafiServiceUrls)(config.chainId, {
4381
+ baseUrl: (0, import_core16.getPafiServiceUrls)(config.chainId, {
4606
4382
  issuerApi: config.baseUrl
4607
4383
  }).issuerApi.replace(/\/+$/, ""),
4608
4384
  issuerId: config.issuerId,
@@ -4737,7 +4513,7 @@ __name(defaultPolicyFor, "defaultPolicyFor");
4737
4513
 
4738
4514
  // src/redemption/policyProvider.ts
4739
4515
  var DEFAULT_CACHE_TTL_MS3 = 5 * 60 * 1e3;
4740
- var PolicyProviderUnavailableError = class extends import_core18.PafiSdkError {
4516
+ var PolicyProviderUnavailableError = class extends import_core17.PafiSdkError {
4741
4517
  static {
4742
4518
  __name(this, "PolicyProviderUnavailableError");
4743
4519
  }
@@ -4887,7 +4663,7 @@ async function createIssuerService(config) {
4887
4663
  if (rawAddresses.length === 0) {
4888
4664
  throw new Error("createIssuerService: at least one of pointTokenAddress / pointTokenAddresses is required");
4889
4665
  }
4890
- const tokenAddresses = rawAddresses.map((a) => (0, import_viem15.getAddress)(a));
4666
+ const tokenAddresses = rawAddresses.map((a) => (0, import_viem14.getAddress)(a));
4891
4667
  const ledger = config.ledger;
4892
4668
  const sessionStore = config.sessionStore ?? new MemorySessionStore();
4893
4669
  const policy = config.policy ?? new DefaultPolicyEngine({
@@ -4914,7 +4690,7 @@ async function createIssuerService(config) {
4914
4690
  provider: config.provider
4915
4691
  });
4916
4692
  }
4917
- const sdkWrapperAddress = (0, import_core19.getContractAddresses)(config.chainId).mintFeeWrapper;
4693
+ const sdkWrapperAddress = (0, import_core18.getContractAddresses)(config.chainId).mintFeeWrapper;
4918
4694
  const wrapperOverride = config.indexer?.mintFeeWrapperAddress;
4919
4695
  const resolvedWrapperAddress = wrapperOverride !== void 0 ? wrapperOverride : sdkWrapperAddress;
4920
4696
  const baseCursorStore = config.indexer?.cursorStore;
@@ -4949,9 +4725,9 @@ async function createIssuerService(config) {
4949
4725
  }
4950
4726
  indexers.set(tokenAddress, new PointIndexer(indexerConfig));
4951
4727
  }
4952
- const chainAddresses = (0, import_core19.getContractAddresses)(config.chainId);
4728
+ const chainAddresses = (0, import_core18.getContractAddresses)(config.chainId);
4953
4729
  const resolvedContracts = {
4954
- batchExecutor: chainAddresses.batchExecutor,
4730
+ kernel: chainAddresses.kernel,
4955
4731
  usdt: chainAddresses.usdt,
4956
4732
  issuerRegistry: chainAddresses.issuerRegistry,
4957
4733
  mintingOracle: chainAddresses.mintingOracle,
@@ -5039,8 +4815,8 @@ async function createIssuerService(config) {
5039
4815
  __name(createIssuerService, "createIssuerService");
5040
4816
 
5041
4817
  // src/issuer-state/validator.ts
5042
- var import_viem16 = require("viem");
5043
- var import_core20 = require("@pafi-dev/core");
4818
+ var import_viem15 = require("viem");
4819
+ var import_core19 = require("@pafi-dev/core");
5044
4820
  var ISSUER_RECORD_TTL_MS = 1e4;
5045
4821
  var IssuerStateValidator = class _IssuerStateValidator {
5046
4822
  static {
@@ -5060,7 +4836,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
5060
4836
  * `CONTRACT_ADDRESSES` map for the given chain.
5061
4837
  */
5062
4838
  static forChain(provider, chainId) {
5063
- const { issuerRegistry } = (0, import_core20.getContractAddresses)(chainId);
4839
+ const { issuerRegistry } = (0, import_core19.getContractAddresses)(chainId);
5064
4840
  return new _IssuerStateValidator(provider, issuerRegistry);
5065
4841
  }
5066
4842
  /**
@@ -5071,7 +4847,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
5071
4847
  */
5072
4848
  invalidate(pointToken) {
5073
4849
  if (pointToken) {
5074
- const key = (0, import_viem16.getAddress)(pointToken);
4850
+ const key = (0, import_viem15.getAddress)(pointToken);
5075
4851
  this.pointTokenIssuerCache.delete(key);
5076
4852
  this.stateCache.delete(key);
5077
4853
  this.inflight.delete(key);
@@ -5086,23 +4862,23 @@ var IssuerStateValidator = class _IssuerStateValidator {
5086
4862
  * The issuer field is set at `initialize()` and never changes.
5087
4863
  */
5088
4864
  async getIssuerAddressForPointToken(pointToken) {
5089
- const key = (0, import_viem16.getAddress)(pointToken);
4865
+ const key = (0, import_viem15.getAddress)(pointToken);
5090
4866
  const cached = this.pointTokenIssuerCache.get(key);
5091
4867
  if (cached) return cached;
5092
4868
  const issuer = await this.provider.readContract({
5093
4869
  address: key,
5094
- abi: import_core20.POINT_TOKEN_ABI,
4870
+ abi: import_core19.POINT_TOKEN_ABI,
5095
4871
  functionName: "issuer"
5096
4872
  });
5097
- this.pointTokenIssuerCache.set(key, (0, import_viem16.getAddress)(issuer));
5098
- return (0, import_viem16.getAddress)(issuer);
4873
+ this.pointTokenIssuerCache.set(key, (0, import_viem15.getAddress)(issuer));
4874
+ return (0, import_viem15.getAddress)(issuer);
5099
4875
  }
5100
4876
  /**
5101
4877
  * Read registry record + totalSupply, with 30s cache and in-flight
5102
4878
  * deduplication. Does NOT throw on inactive/missing — returns raw state.
5103
4879
  */
5104
4880
  async getIssuerState(pointToken) {
5105
- const tokenAddr = (0, import_viem16.getAddress)(pointToken);
4881
+ const tokenAddr = (0, import_viem15.getAddress)(pointToken);
5106
4882
  const now = Date.now();
5107
4883
  const cached = this.stateCache.get(tokenAddr);
5108
4884
  if (cached && cached.expiresAt > now) return cached.value;
@@ -5163,7 +4939,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
5163
4939
  const issuerAddr = await this.getIssuerAddressForPointToken(tokenAddr);
5164
4940
  const issuerStruct = await this.provider.readContract({
5165
4941
  address: this.registryAddress,
5166
- abi: import_core20.issuerRegistryAbi,
4942
+ abi: import_core19.issuerRegistryAbi,
5167
4943
  functionName: "getIssuer",
5168
4944
  args: [
5169
4945
  issuerAddr
@@ -5178,7 +4954,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
5178
4954
  };
5179
4955
  const equitySupply = await this.provider.readContract({
5180
4956
  address: tokenAddr,
5181
- abi: import_core20.POINT_TOKEN_ABI,
4957
+ abi: import_core19.POINT_TOKEN_ABI,
5182
4958
  functionName: "equitySupply"
5183
4959
  });
5184
4960
  const hardCap = issuer.capitalBase * BigInt(issuer.basisPoints) / 10000n;
@@ -5237,7 +5013,7 @@ var MemoryRedemptionHistoryStore = class {
5237
5013
  };
5238
5014
 
5239
5015
  // src/index.ts
5240
- var PAFI_ISSUER_SDK_VERSION = true ? "0.39.3" : "dev";
5016
+ var PAFI_ISSUER_SDK_VERSION = true ? "0.41.0" : "dev";
5241
5017
  // Annotate the CommonJS export names for ESM import in node:
5242
5018
  0 && (module.exports = {
5243
5019
  AdapterMisconfiguredError,
@@ -5302,7 +5078,6 @@ var PAFI_ISSUER_SDK_VERSION = true ? "0.39.3" : "dev";
5302
5078
  defaultPolicyFor,
5303
5079
  evaluateRedemption,
5304
5080
  handleClaimStatus,
5305
- handleDelegateSubmit,
5306
5081
  handleMobilePrepare,
5307
5082
  handleMobileSubmit,
5308
5083
  handleRedeemStatus,
@@ -5314,7 +5089,6 @@ var PAFI_ISSUER_SDK_VERSION = true ? "0.39.3" : "dev";
5314
5089
  prepareMobileUserOp,
5315
5090
  relayUserOp,
5316
5091
  requestPaymaster,
5317
- serializeEntryToJsonRpc,
5318
- serializeUserOpTypedData
5092
+ serializeEntryToJsonRpc
5319
5093
  });
5320
5094
  //# sourceMappingURL=index.cjs.map