@pafi-dev/issuer 0.5.43 → 0.6.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.cjs CHANGED
@@ -38,7 +38,7 @@ __export(index_exports, {
38
38
  MemorySessionStore: () => MemorySessionStore,
39
39
  NonceManager: () => NonceManager,
40
40
  PAFI_ISSUER_SDK_VERSION: () => PAFI_ISSUER_SDK_VERSION,
41
- PAFI_SUBGRAPH_URL: () => import_core14.PAFI_SUBGRAPH_URL,
41
+ PAFI_SUBGRAPH_URL: () => import_core12.PAFI_SUBGRAPH_URL,
42
42
  PTClaimError: () => PTClaimError,
43
43
  PTClaimHandler: () => PTClaimHandler,
44
44
  PTRedeemError: () => PTRedeemError,
@@ -53,8 +53,6 @@ __export(index_exports, {
53
53
  PointIndexer: () => PointIndexer,
54
54
  RelayError: () => RelayError,
55
55
  RelayService: () => RelayService,
56
- SwapError: () => SwapError,
57
- SwapHandler: () => SwapHandler,
58
56
  authenticateRequest: () => authenticateRequest,
59
57
  createIssuerService: () => createIssuerService,
60
58
  createNativePtQuoter: () => createNativePtQuoter,
@@ -68,7 +66,6 @@ __export(index_exports, {
68
66
  handleRedeemStatus: () => handleRedeemStatus,
69
67
  mergePaymasterFields: () => mergePaymasterFields,
70
68
  prepareMobileUserOp: () => prepareMobileUserOp,
71
- quotePointTokenToUsdt: () => quotePointTokenToUsdt,
72
69
  relayUserOp: () => relayUserOp,
73
70
  requestPaymaster: () => requestPaymaster,
74
71
  serializeEntryToJsonRpc: () => serializeEntryToJsonRpc,
@@ -2080,140 +2077,8 @@ var PTClaimHandler = class {
2080
2077
  }
2081
2078
  };
2082
2079
 
2083
- // src/api/handlers/swapHandler.ts
2084
- var import_core9 = require("@pafi-dev/core");
2085
- var SwapError = class extends PafiSdkError {
2086
- httpStatus = "unprocessable";
2087
- code;
2088
- constructor(code, message) {
2089
- super(message);
2090
- this.code = code;
2091
- }
2092
- };
2093
- var DEFAULT_SLIPPAGE_BPS = 50;
2094
- var DEFAULT_SWAP_DEADLINE_SEC = 5 * 60;
2095
- var SwapHandler = class {
2096
- cfg;
2097
- constructor(config) {
2098
- this.cfg = {
2099
- ...config,
2100
- defaultSlippageBps: config.defaultSlippageBps ?? DEFAULT_SLIPPAGE_BPS,
2101
- defaultSwapDeadlineSeconds: config.defaultSwapDeadlineSeconds ?? DEFAULT_SWAP_DEADLINE_SEC,
2102
- now: config.now ?? (() => Date.now())
2103
- };
2104
- }
2105
- async handle(request) {
2106
- if (request.amountIn <= 0n) {
2107
- throw new SwapError("INVALID_AMOUNT", "amountIn must be positive");
2108
- }
2109
- const slippageBps = request.slippageBps ?? this.cfg.defaultSlippageBps;
2110
- const { usdt, pafiFeeRecipient, universalRouter } = (0, import_core9.getContractAddresses)(
2111
- request.chainId
2112
- );
2113
- const poolsResponse = await this.cfg.poolsProvider({
2114
- chainId: request.chainId,
2115
- pointTokenAddress: request.pointTokenAddress
2116
- });
2117
- if (poolsResponse.pools.length === 0) {
2118
- throw new SwapError(
2119
- "QUOTE_UNAVAILABLE",
2120
- "no liquidity pool found for this point token"
2121
- );
2122
- }
2123
- let fallbackQuote;
2124
- try {
2125
- fallbackQuote = await (0, import_core9.findBestQuote)(
2126
- this.cfg.provider,
2127
- request.chainId,
2128
- request.pointTokenAddress,
2129
- usdt,
2130
- request.amountIn,
2131
- poolsResponse.pools
2132
- );
2133
- } catch {
2134
- throw new SwapError(
2135
- "QUOTE_UNAVAILABLE",
2136
- "no swap path found for this point token"
2137
- );
2138
- }
2139
- const estimatedUsdtOutFallback = fallbackQuote.bestRoute.amountOut;
2140
- const minAmountOutFallback = estimatedUsdtOutFallback * BigInt(1e4 - slippageBps) / 10000n;
2141
- const deadline = request.deadline ?? BigInt(
2142
- Math.floor(this.cfg.now() / 1e3) + this.cfg.defaultSwapDeadlineSeconds
2143
- );
2144
- const feeAmount = this.cfg.feeService ? await this.cfg.feeService.estimateGasFee() : 0n;
2145
- if (feeAmount > 0n && feeAmount >= request.amountIn) {
2146
- throw new SwapError(
2147
- "FEE_EXCEEDS_AMOUNT",
2148
- `gas fee (${feeAmount}) must be strictly less than swap amount (${request.amountIn})`
2149
- );
2150
- }
2151
- const sponsoredAmountIn = request.amountIn - feeAmount;
2152
- let estimatedUsdtOutSponsored = estimatedUsdtOutFallback;
2153
- let sponsoredPath = fallbackQuote.bestRoute.path;
2154
- if (feeAmount > 0n) {
2155
- try {
2156
- const sponsoredQuote = await (0, import_core9.findBestQuote)(
2157
- this.cfg.provider,
2158
- request.chainId,
2159
- request.pointTokenAddress,
2160
- usdt,
2161
- sponsoredAmountIn,
2162
- poolsResponse.pools
2163
- );
2164
- estimatedUsdtOutSponsored = sponsoredQuote.bestRoute.amountOut;
2165
- sponsoredPath = sponsoredQuote.bestRoute.path;
2166
- } catch {
2167
- throw new SwapError(
2168
- "QUOTE_UNAVAILABLE",
2169
- "no swap path found for sponsored amount (after fee deduction)"
2170
- );
2171
- }
2172
- }
2173
- const minAmountOutSponsored = estimatedUsdtOutSponsored * BigInt(1e4 - slippageBps) / 10000n;
2174
- const sponsoredOp = (0, import_core9.buildSwapWithGasDeduction)({
2175
- userAddress: request.userAddress,
2176
- aaNonce: request.aaNonce,
2177
- pointTokenAddress: request.pointTokenAddress,
2178
- outputTokenAddress: usdt,
2179
- universalRouterAddress: universalRouter,
2180
- amountIn: sponsoredAmountIn,
2181
- minAmountOut: minAmountOutSponsored,
2182
- swapPath: sponsoredPath,
2183
- deadline,
2184
- gasFeePt: feeAmount,
2185
- feeRecipient: pafiFeeRecipient
2186
- });
2187
- const fallbackOp = feeAmount > 0n ? (0, import_core9.buildSwapWithGasDeduction)({
2188
- userAddress: request.userAddress,
2189
- aaNonce: request.aaNonce,
2190
- pointTokenAddress: request.pointTokenAddress,
2191
- outputTokenAddress: usdt,
2192
- universalRouterAddress: universalRouter,
2193
- amountIn: request.amountIn,
2194
- minAmountOut: minAmountOutFallback,
2195
- swapPath: fallbackQuote.bestRoute.path,
2196
- deadline,
2197
- gasFeePt: 0n,
2198
- feeRecipient: pafiFeeRecipient
2199
- }) : void 0;
2200
- return {
2201
- userOp: sponsoredOp,
2202
- fallback: fallbackOp,
2203
- feeAmount,
2204
- estimatedUsdtOut: estimatedUsdtOutSponsored,
2205
- minAmountOut: minAmountOutSponsored,
2206
- estimatedUsdtOutFallback: fallbackOp ? estimatedUsdtOutFallback : void 0,
2207
- minAmountOutFallback: fallbackOp ? minAmountOutFallback : void 0,
2208
- deadline,
2209
- calls: (0, import_core9.decodeBatchExecuteCalls)(sponsoredOp.callData),
2210
- callsFallback: fallbackOp ? (0, import_core9.decodeBatchExecuteCalls)(fallbackOp.callData) : void 0
2211
- };
2212
- }
2213
- };
2214
-
2215
2080
  // src/api/handlers/perpDepositHandler.ts
2216
- var import_core10 = require("@pafi-dev/core");
2081
+ var import_core9 = require("@pafi-dev/core");
2217
2082
  var PerpDepositError = class extends PafiSdkError {
2218
2083
  httpStatus = "unprocessable";
2219
2084
  code;
@@ -2237,26 +2102,26 @@ var PerpDepositHandler = class {
2237
2102
  if (request.amount <= 0n) {
2238
2103
  throw new PerpDepositError("INVALID_AMOUNT", "amount must be positive");
2239
2104
  }
2240
- const brokerHash = import_core10.BROKER_HASHES[request.brokerId];
2241
- const tokenHash = import_core10.TOKEN_HASHES.USDC;
2242
- const vault = import_core10.ORDERLY_VAULT_ADDRESSES[request.chainId];
2105
+ const brokerHash = import_core9.BROKER_HASHES[request.brokerId];
2106
+ const tokenHash = import_core9.TOKEN_HASHES.USDC;
2107
+ const vault = import_core9.ORDERLY_VAULT_ADDRESSES[request.chainId];
2243
2108
  if (!vault) {
2244
2109
  throw new PerpDepositError(
2245
2110
  "PERP_DEPOSIT_UNAVAILABLE",
2246
2111
  `no Orderly Vault for chainId ${request.chainId}`
2247
2112
  );
2248
2113
  }
2249
- const { orderlyRelay: relayAddress, pafiFeeRecipient } = (0, import_core10.getContractAddresses)(request.chainId);
2114
+ const { orderlyRelay: relayAddress, pafiFeeRecipient } = (0, import_core9.getContractAddresses)(request.chainId);
2250
2115
  const [usdcAddress, brokerAllowed] = await Promise.all([
2251
2116
  this.cfg.provider.readContract({
2252
2117
  address: vault,
2253
- abi: import_core10.ORDERLY_VAULT_ABI,
2118
+ abi: import_core9.ORDERLY_VAULT_ABI,
2254
2119
  functionName: "getAllowedToken",
2255
2120
  args: [tokenHash]
2256
2121
  }),
2257
2122
  this.cfg.provider.readContract({
2258
2123
  address: vault,
2259
- abi: import_core10.ORDERLY_VAULT_ABI,
2124
+ abi: import_core9.ORDERLY_VAULT_ABI,
2260
2125
  functionName: "getAllowedBroker",
2261
2126
  args: [brokerHash]
2262
2127
  })
@@ -2267,7 +2132,7 @@ var PerpDepositHandler = class {
2267
2132
  `broker "${request.brokerId}" is not whitelisted on Orderly Vault`
2268
2133
  );
2269
2134
  }
2270
- const accountId = (0, import_core10.computeAccountId)(request.userAddress, brokerHash);
2135
+ const accountId = (0, import_core9.computeAccountId)(request.userAddress, brokerHash);
2271
2136
  const requestForQuote = {
2272
2137
  token: usdcAddress,
2273
2138
  receiver: request.userAddress,
@@ -2278,7 +2143,7 @@ var PerpDepositHandler = class {
2278
2143
  const [relayTokenFee, ptGasFee] = await Promise.all([
2279
2144
  this.cfg.provider.readContract({
2280
2145
  address: relayAddress,
2281
- abi: import_core10.ORDERLY_RELAY_ABI,
2146
+ abi: import_core9.ORDERLY_RELAY_ABI,
2282
2147
  functionName: "quoteTokenFee",
2283
2148
  args: [requestForQuote]
2284
2149
  }),
@@ -2298,7 +2163,7 @@ var PerpDepositHandler = class {
2298
2163
  totalAmount: request.amount,
2299
2164
  maxFee
2300
2165
  };
2301
- const sponsoredOp = (0, import_core10.buildPerpDepositViaRelay)({
2166
+ const sponsoredOp = (0, import_core9.buildPerpDepositViaRelay)({
2302
2167
  userAddress: request.userAddress,
2303
2168
  aaNonce: request.aaNonce,
2304
2169
  relayAddress,
@@ -2307,7 +2172,7 @@ var PerpDepositHandler = class {
2307
2172
  gasFeePt: ptGasFee,
2308
2173
  gasFeePtRecipient: pafiFeeRecipient
2309
2174
  });
2310
- const fallbackOp = ptGasFee > 0n ? (0, import_core10.buildPerpDepositViaRelay)({
2175
+ const fallbackOp = ptGasFee > 0n ? (0, import_core9.buildPerpDepositViaRelay)({
2311
2176
  userAddress: request.userAddress,
2312
2177
  aaNonce: request.aaNonce,
2313
2178
  relayAddress,
@@ -2324,22 +2189,22 @@ var PerpDepositHandler = class {
2324
2189
  brokerHash,
2325
2190
  usdcAddress,
2326
2191
  relayAddress,
2327
- calls: (0, import_core10.decodeBatchExecuteCalls)(sponsoredOp.callData),
2328
- callsFallback: fallbackOp ? (0, import_core10.decodeBatchExecuteCalls)(fallbackOp.callData) : void 0
2192
+ calls: (0, import_core9.decodeBatchExecuteCalls)(sponsoredOp.callData),
2193
+ callsFallback: fallbackOp ? (0, import_core9.decodeBatchExecuteCalls)(fallbackOp.callData) : void 0
2329
2194
  };
2330
2195
  }
2331
2196
  };
2332
2197
 
2333
2198
  // src/api/delegateHandler.ts
2334
- var import_core11 = require("@pafi-dev/core");
2199
+ var import_core10 = require("@pafi-dev/core");
2335
2200
  var DEFAULT_DELEGATE_GAS = {
2336
2201
  callGasLimit: 100000n,
2337
2202
  verificationGasLimit: 150000n,
2338
2203
  preVerificationGas: 50000n
2339
2204
  };
2340
2205
  async function handleDelegateSubmit(params) {
2341
- const { batchExecutor } = (0, import_core11.getContractAddresses)(params.chainId);
2342
- const callData = (0, import_core11.encodeBatchExecute)([]);
2206
+ const { batchExecutor } = (0, import_core10.getContractAddresses)(params.chainId);
2207
+ const callData = (0, import_core10.encodeBatchExecute)([]);
2343
2208
  const userOp = {
2344
2209
  sender: params.userAddress,
2345
2210
  nonce: params.aaNonce,
@@ -2362,7 +2227,7 @@ async function handleDelegateSubmit(params) {
2362
2227
  ...userOp,
2363
2228
  ...paymasterFields ?? {}
2364
2229
  };
2365
- const userOpJson = (0, import_core11.serializeUserOpToJsonRpc)(
2230
+ const userOpJson = (0, import_core10.serializeUserOpToJsonRpc)(
2366
2231
  {
2367
2232
  sender: merged.sender,
2368
2233
  nonce: merged.nonce,
@@ -2381,7 +2246,7 @@ async function handleDelegateSubmit(params) {
2381
2246
  // is the user's "consent"; no separate AA signature is needed.
2382
2247
  "0x"
2383
2248
  );
2384
- const authorization = (0, import_core11.buildEip7702Authorization)({
2249
+ const authorization = (0, import_core10.buildEip7702Authorization)({
2385
2250
  chainId: params.chainId,
2386
2251
  address: batchExecutor,
2387
2252
  nonce: params.delegationNonce,
@@ -2390,7 +2255,7 @@ async function handleDelegateSubmit(params) {
2390
2255
  const result = await relayUserOp({
2391
2256
  client: params.pafiBackendClient,
2392
2257
  userOp: userOpJson,
2393
- entryPoint: import_core11.ENTRY_POINT_V08,
2258
+ entryPoint: import_core10.ENTRY_POINT_V08,
2394
2259
  eip7702Auth: authorization
2395
2260
  });
2396
2261
  return {
@@ -2400,71 +2265,6 @@ async function handleDelegateSubmit(params) {
2400
2265
  };
2401
2266
  }
2402
2267
 
2403
- // src/api/quoteHelper.ts
2404
- var import_core12 = require("@pafi-dev/core");
2405
- var DEFAULT_DEADLINE_SECONDS = 300;
2406
- async function quotePointTokenToUsdt(params) {
2407
- const now = params.now ?? (() => Date.now());
2408
- const suggestedDeadline = Math.floor(now() / 1e3) + (params.deadlineSeconds ?? DEFAULT_DEADLINE_SECONDS);
2409
- if (params.pointAmount === 0n) {
2410
- return {
2411
- estimatedUsdtOut: 0n,
2412
- netUsdtOut: 0n,
2413
- exchangeRate: "0.00000000",
2414
- gasEstimate: 0n,
2415
- suggestedDeadline
2416
- };
2417
- }
2418
- if (params.pools.length === 0) {
2419
- return {
2420
- estimatedUsdtOut: 0n,
2421
- netUsdtOut: 0n,
2422
- exchangeRate: "0.00000000",
2423
- gasEstimate: 0n,
2424
- suggestedDeadline,
2425
- quoteError: "QUOTE_UNAVAILABLE"
2426
- };
2427
- }
2428
- const { usdt: usdtAddress } = (0, import_core12.getContractAddresses)(params.chainId);
2429
- let estimatedUsdtOut = 0n;
2430
- let gasEstimate = 0n;
2431
- try {
2432
- const best = await (0, import_core12.findBestQuote)(
2433
- params.provider,
2434
- params.chainId,
2435
- params.pointTokenAddress,
2436
- usdtAddress,
2437
- params.pointAmount,
2438
- params.pools
2439
- );
2440
- estimatedUsdtOut = best.bestRoute.amountOut;
2441
- gasEstimate = best.bestRoute.gasEstimate;
2442
- } catch {
2443
- return {
2444
- estimatedUsdtOut: 0n,
2445
- netUsdtOut: 0n,
2446
- exchangeRate: "0.00000000",
2447
- gasEstimate: 0n,
2448
- suggestedDeadline,
2449
- quoteError: "QUOTE_UNAVAILABLE"
2450
- };
2451
- }
2452
- const netUsdtOut = estimatedUsdtOut > params.gasFeeUsdt ? estimatedUsdtOut - params.gasFeeUsdt : 0n;
2453
- const quoteError = estimatedUsdtOut > 0n && netUsdtOut === 0n ? "AMOUNT_TOO_SMALL_FOR_GAS" : void 0;
2454
- const rateNum = estimatedUsdtOut > 0n ? Number(
2455
- estimatedUsdtOut * 1000000n * 10n ** 18n / params.pointAmount
2456
- ) / 1e6 : 0;
2457
- const exchangeRate = rateNum.toFixed(8);
2458
- return {
2459
- estimatedUsdtOut,
2460
- netUsdtOut,
2461
- exchangeRate,
2462
- gasEstimate,
2463
- suggestedDeadline,
2464
- ...quoteError ? { quoteError } : {}
2465
- };
2466
- }
2467
-
2468
2268
  // src/api/errorMapper.ts
2469
2269
  function createSdkErrorMapper(factories) {
2470
2270
  return (err) => {
@@ -2492,7 +2292,7 @@ function createSdkErrorMapper(factories) {
2492
2292
 
2493
2293
  // src/api/issuerApiAdapter.ts
2494
2294
  var import_viem10 = require("viem");
2495
- var import_core13 = require("@pafi-dev/core");
2295
+ var import_core11 = require("@pafi-dev/core");
2496
2296
  var IssuerApiAdapter = class {
2497
2297
  cfg;
2498
2298
  constructor(config) {
@@ -2536,34 +2336,8 @@ var IssuerApiAdapter = class {
2536
2336
  isMinter: result.isMinter
2537
2337
  };
2538
2338
  }
2539
- async quote(authenticatedAddress, chainId, pointTokenAddress, pointAmount) {
2540
- const [gasFeeResult, poolsResult] = await Promise.all([
2541
- this.cfg.issuerService.api.handleGasFee(),
2542
- this.cfg.issuerService.api.handlePools(authenticatedAddress, {
2543
- chainId,
2544
- pointTokenAddress: (0, import_viem10.getAddress)(pointTokenAddress)
2545
- })
2546
- ]);
2547
- const quote = await quotePointTokenToUsdt({
2548
- provider: this.cfg.provider,
2549
- chainId,
2550
- pointTokenAddress: (0, import_viem10.getAddress)(pointTokenAddress),
2551
- pointAmount,
2552
- pools: poolsResult.pools,
2553
- gasFeeUsdt: gasFeeResult.gasFeeUsdt
2554
- });
2555
- const dto = {
2556
- pointAmount: pointAmount.toString(),
2557
- estimatedUsdtOut: quote.estimatedUsdtOut.toString(),
2558
- gasFeeUsdt: gasFeeResult.gasFeeUsdt.toString(),
2559
- netUsdtOut: quote.netUsdtOut.toString(),
2560
- exchangeRate: quote.exchangeRate,
2561
- suggestedDeadline: quote.suggestedDeadline.toString(),
2562
- gasEstimate: quote.gasEstimate.toString()
2563
- };
2564
- if (quote.quoteError) dto.quoteError = quote.quoteError;
2565
- return dto;
2566
- }
2339
+ // quote() removed (2026-04-27) — FE PAFI calls @pafi-dev/trading
2340
+ // directly. Issuer SDK doesn't ship swap/quote anymore.
2567
2341
  // ------------------------------ Action endpoints -------------------------
2568
2342
  async claim(input) {
2569
2343
  const ptClaimHandler = this.assertHandler(
@@ -2612,8 +2386,8 @@ var IssuerApiAdapter = class {
2612
2386
  "burn"
2613
2387
  );
2614
2388
  return {
2615
- calls: (0, import_core13.decodeBatchExecuteCalls)(response.userOp.callData),
2616
- callsFallback: response.fallback ? (0, import_core13.decodeBatchExecuteCalls)(response.fallback.userOp.callData) : void 0,
2389
+ calls: (0, import_core11.decodeBatchExecuteCalls)(response.userOp.callData),
2390
+ callsFallback: response.fallback ? (0, import_core11.decodeBatchExecuteCalls)(response.fallback.userOp.callData) : void 0,
2617
2391
  feeAmount: response.feeAmount.toString(),
2618
2392
  lockId: response.lockId,
2619
2393
  lockIdFallback: response.fallback?.lockId,
@@ -2624,38 +2398,8 @@ var IssuerApiAdapter = class {
2624
2398
  sponsorAuth
2625
2399
  };
2626
2400
  }
2627
- async swap(input) {
2628
- const swapHandler = this.assertHandler(
2629
- this.cfg.swapHandler,
2630
- "swapHandler",
2631
- "swap"
2632
- );
2633
- const result = await swapHandler.handle({
2634
- userAddress: input.authenticatedAddress,
2635
- chainId: input.chainId,
2636
- pointTokenAddress: (0, import_viem10.getAddress)(input.pointTokenAddress),
2637
- amountIn: input.amountIn,
2638
- aaNonce: input.aaNonce,
2639
- slippageBps: input.slippageBps
2640
- });
2641
- const sponsorAuth = await this.buildSponsorAuth(
2642
- input.authenticatedAddress,
2643
- result.userOp.callData,
2644
- input.chainId,
2645
- "swap"
2646
- );
2647
- return {
2648
- calls: result.calls,
2649
- callsFallback: result.callsFallback,
2650
- feeAmount: result.feeAmount.toString(),
2651
- estimatedUsdtOut: result.estimatedUsdtOut.toString(),
2652
- minAmountOut: result.minAmountOut.toString(),
2653
- estimatedUsdtOutFallback: result.estimatedUsdtOutFallback?.toString(),
2654
- minAmountOutFallback: result.minAmountOutFallback?.toString(),
2655
- deadline: result.deadline.toString(),
2656
- sponsorAuth
2657
- };
2658
- }
2401
+ // swap() removed (2026-04-27) — moved to @pafi-dev/trading.
2402
+ // PAFI's web FE calls TradingHandlers.handleSwap directly.
2659
2403
  async perpDeposit(input) {
2660
2404
  const perpHandler = this.assertHandler(
2661
2405
  this.cfg.perpHandler,
@@ -2806,23 +2550,23 @@ var IssuerApiAdapter = class {
2806
2550
  }
2807
2551
  // ------------------------------ Delegate endpoints -----------------------
2808
2552
  async delegateStatus(authenticatedAddress, chainId) {
2809
- const { batchExecutor } = (0, import_core13.getContractAddresses)(chainId);
2553
+ const { batchExecutor } = (0, import_core11.getContractAddresses)(chainId);
2810
2554
  const code = await this.cfg.provider.getCode({
2811
2555
  address: authenticatedAddress
2812
2556
  });
2813
2557
  return {
2814
- isDelegated: (0, import_core13.parseEip7702DelegatedAddress)(code) !== null,
2558
+ isDelegated: (0, import_core11.parseEip7702DelegatedAddress)(code) !== null,
2815
2559
  batchExecutorAddress: batchExecutor
2816
2560
  };
2817
2561
  }
2818
2562
  async delegatePrepare(authenticatedAddress, chainId) {
2819
- const { batchExecutor } = (0, import_core13.getContractAddresses)(chainId);
2563
+ const { batchExecutor } = (0, import_core11.getContractAddresses)(chainId);
2820
2564
  const accountNonce = BigInt(
2821
2565
  await this.cfg.provider.getTransactionCount({
2822
2566
  address: authenticatedAddress
2823
2567
  })
2824
2568
  );
2825
- const authorizationHash = (0, import_core13.computeAuthorizationHash)(
2569
+ const authorizationHash = (0, import_core11.computeAuthorizationHash)(
2826
2570
  chainId,
2827
2571
  batchExecutor,
2828
2572
  accountNonce
@@ -2855,7 +2599,7 @@ var IssuerApiAdapter = class {
2855
2599
  */
2856
2600
  async buildSponsorAuth(authenticatedAddress, callData, chainId, scenario) {
2857
2601
  if (!this.cfg.pafiIssuerId) return void 0;
2858
- return (0, import_core13.buildAndSignSponsorAuth)({
2602
+ return (0, import_core11.buildAndSignSponsorAuth)({
2859
2603
  userAddress: authenticatedAddress,
2860
2604
  callData,
2861
2605
  chainId,
@@ -2905,7 +2649,7 @@ var IssuerApiAdapter = class {
2905
2649
 
2906
2650
  // src/pools/subgraphPoolsProvider.ts
2907
2651
  var import_viem11 = require("viem");
2908
- var import_core14 = require("@pafi-dev/core");
2652
+ var import_core12 = require("@pafi-dev/core");
2909
2653
  var DEFAULT_CACHE_TTL_MS = 3e4;
2910
2654
  var POOL_QUERY = `
2911
2655
  query GetPoolForPointToken($id: ID!) {
@@ -2923,7 +2667,7 @@ var POOL_QUERY = `
2923
2667
  }
2924
2668
  `;
2925
2669
  function createSubgraphPoolsProvider(config = {}) {
2926
- const subgraphUrl = config.subgraphUrl ?? import_core14.PAFI_SUBGRAPH_URL;
2670
+ const subgraphUrl = config.subgraphUrl ?? import_core12.PAFI_SUBGRAPH_URL;
2927
2671
  try {
2928
2672
  const parsed = new URL(subgraphUrl);
2929
2673
  if (process.env.NODE_ENV === "production" && parsed.protocol !== "https:") {
@@ -3055,7 +2799,7 @@ var PRICE_QUERY = `
3055
2799
  }
3056
2800
  `;
3057
2801
  function createSubgraphNativeUsdtQuoter(config = {}) {
3058
- const subgraphUrl = config.subgraphUrl ?? import_core14.PAFI_SUBGRAPH_URL;
2802
+ const subgraphUrl = config.subgraphUrl ?? import_core12.PAFI_SUBGRAPH_URL;
3059
2803
  try {
3060
2804
  const parsed = new URL(subgraphUrl);
3061
2805
  if (process.env.NODE_ENV === "production" && parsed.protocol !== "https:") {
@@ -3185,7 +2929,7 @@ function createNativePtQuoter(config) {
3185
2929
  provider,
3186
2930
  pointTokenAddress,
3187
2931
  chainlinkFeedAddress = "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70",
3188
- subgraphUrl = import_core14.PAFI_SUBGRAPH_URL,
2932
+ subgraphUrl = import_core12.PAFI_SUBGRAPH_URL,
3189
2933
  cacheTtlMs = 3e4,
3190
2934
  fallbackEthPriceUsd = 3e3,
3191
2935
  fallbackPtPriceUsdt = 0.1,
@@ -3267,7 +3011,7 @@ function parseBigDecimalTo18(s) {
3267
3011
  }
3268
3012
 
3269
3013
  // src/balance/balanceAggregator.ts
3270
- var import_core15 = require("@pafi-dev/core");
3014
+ var import_core13 = require("@pafi-dev/core");
3271
3015
  var BalanceAggregator = class {
3272
3016
  provider;
3273
3017
  ledger;
@@ -3288,7 +3032,7 @@ var BalanceAggregator = class {
3288
3032
  async getCombinedBalance(user, pointToken) {
3289
3033
  const [offChain, onChain] = await Promise.all([
3290
3034
  this.ledger.getBalance(user, pointToken),
3291
- (0, import_core15.getPointTokenBalance)(this.provider, pointToken, user)
3035
+ (0, import_core13.getPointTokenBalance)(this.provider, pointToken, user)
3292
3036
  ]);
3293
3037
  return {
3294
3038
  offChain,
@@ -3522,7 +3266,7 @@ var PafiBackendClient = class {
3522
3266
 
3523
3267
  // src/config.ts
3524
3268
  var import_viem13 = require("viem");
3525
- var import_core16 = require("@pafi-dev/core");
3269
+ var import_core14 = require("@pafi-dev/core");
3526
3270
  function createIssuerService(config) {
3527
3271
  if (!config.provider) {
3528
3272
  throw new Error("createIssuerService: provider is required");
@@ -3592,7 +3336,7 @@ function createIssuerService(config) {
3592
3336
  indexers.set(tokenAddress, new PointIndexer(indexerConfig));
3593
3337
  }
3594
3338
  const firstIndexer = indexers.get(tokenAddresses[0]);
3595
- const chainAddresses = (0, import_core16.getContractAddresses)(config.chainId);
3339
+ const chainAddresses = (0, import_core14.getContractAddresses)(config.chainId);
3596
3340
  const resolvedContracts = {
3597
3341
  batchExecutor: chainAddresses.batchExecutor,
3598
3342
  usdt: chainAddresses.usdt,
@@ -3632,7 +3376,7 @@ function createIssuerService(config) {
3632
3376
 
3633
3377
  // src/issuer-state/validator.ts
3634
3378
  var import_viem14 = require("viem");
3635
- var import_core17 = require("@pafi-dev/core");
3379
+ var import_core15 = require("@pafi-dev/core");
3636
3380
  var ISSUER_RECORD_TTL_MS = 3e4;
3637
3381
  var IssuerStateValidator = class _IssuerStateValidator {
3638
3382
  constructor(provider, registryAddress) {
@@ -3649,7 +3393,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
3649
3393
  * `CONTRACT_ADDRESSES` map for the given chain.
3650
3394
  */
3651
3395
  static forChain(provider, chainId) {
3652
- const { issuerRegistry } = (0, import_core17.getContractAddresses)(chainId);
3396
+ const { issuerRegistry } = (0, import_core15.getContractAddresses)(chainId);
3653
3397
  return new _IssuerStateValidator(provider, issuerRegistry);
3654
3398
  }
3655
3399
  /**
@@ -3678,7 +3422,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
3678
3422
  if (cached) return cached;
3679
3423
  const issuer = await this.provider.readContract({
3680
3424
  address: key,
3681
- abi: import_core17.POINT_TOKEN_V2_ABI,
3425
+ abi: import_core15.POINT_TOKEN_V2_ABI,
3682
3426
  functionName: "issuer"
3683
3427
  });
3684
3428
  this.pointTokenIssuerCache.set(key, (0, import_viem14.getAddress)(issuer));
@@ -3759,13 +3503,13 @@ var IssuerStateValidator = class _IssuerStateValidator {
3759
3503
  const [issuerTuple, totalSupply] = await Promise.all([
3760
3504
  this.provider.readContract({
3761
3505
  address: this.registryAddress,
3762
- abi: import_core17.issuerRegistryGetIssuerFlatAbi,
3506
+ abi: import_core15.issuerRegistryGetIssuerFlatAbi,
3763
3507
  functionName: "getIssuer",
3764
3508
  args: [issuerAddr]
3765
3509
  }),
3766
3510
  this.provider.readContract({
3767
3511
  address: tokenAddr,
3768
- abi: import_core17.POINT_TOKEN_V2_ABI,
3512
+ abi: import_core15.POINT_TOKEN_V2_ABI,
3769
3513
  functionName: "totalSupply"
3770
3514
  })
3771
3515
  ]);
@@ -3823,8 +3567,6 @@ var PAFI_ISSUER_SDK_VERSION = "0.4.0";
3823
3567
  PointIndexer,
3824
3568
  RelayError,
3825
3569
  RelayService,
3826
- SwapError,
3827
- SwapHandler,
3828
3570
  authenticateRequest,
3829
3571
  createIssuerService,
3830
3572
  createNativePtQuoter,
@@ -3838,7 +3580,6 @@ var PAFI_ISSUER_SDK_VERSION = "0.4.0";
3838
3580
  handleRedeemStatus,
3839
3581
  mergePaymasterFields,
3840
3582
  prepareMobileUserOp,
3841
- quotePointTokenToUsdt,
3842
3583
  relayUserOp,
3843
3584
  requestPaymaster,
3844
3585
  serializeEntryToJsonRpc,