@pafi-dev/issuer 0.5.43 → 0.6.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 +45 -304
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -153
- package/dist/index.d.ts +4 -153
- package/dist/index.js +21 -285
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2030,143 +2030,6 @@ var PTClaimHandler = class {
|
|
|
2030
2030
|
}
|
|
2031
2031
|
};
|
|
2032
2032
|
|
|
2033
|
-
// src/api/handlers/swapHandler.ts
|
|
2034
|
-
import {
|
|
2035
|
-
buildSwapWithGasDeduction,
|
|
2036
|
-
decodeBatchExecuteCalls as decodeBatchExecuteCalls2,
|
|
2037
|
-
findBestQuote,
|
|
2038
|
-
getContractAddresses as getContractAddresses4
|
|
2039
|
-
} from "@pafi-dev/core";
|
|
2040
|
-
var SwapError = class extends PafiSdkError {
|
|
2041
|
-
httpStatus = "unprocessable";
|
|
2042
|
-
code;
|
|
2043
|
-
constructor(code, message) {
|
|
2044
|
-
super(message);
|
|
2045
|
-
this.code = code;
|
|
2046
|
-
}
|
|
2047
|
-
};
|
|
2048
|
-
var DEFAULT_SLIPPAGE_BPS = 50;
|
|
2049
|
-
var DEFAULT_SWAP_DEADLINE_SEC = 5 * 60;
|
|
2050
|
-
var SwapHandler = class {
|
|
2051
|
-
cfg;
|
|
2052
|
-
constructor(config) {
|
|
2053
|
-
this.cfg = {
|
|
2054
|
-
...config,
|
|
2055
|
-
defaultSlippageBps: config.defaultSlippageBps ?? DEFAULT_SLIPPAGE_BPS,
|
|
2056
|
-
defaultSwapDeadlineSeconds: config.defaultSwapDeadlineSeconds ?? DEFAULT_SWAP_DEADLINE_SEC,
|
|
2057
|
-
now: config.now ?? (() => Date.now())
|
|
2058
|
-
};
|
|
2059
|
-
}
|
|
2060
|
-
async handle(request) {
|
|
2061
|
-
if (request.amountIn <= 0n) {
|
|
2062
|
-
throw new SwapError("INVALID_AMOUNT", "amountIn must be positive");
|
|
2063
|
-
}
|
|
2064
|
-
const slippageBps = request.slippageBps ?? this.cfg.defaultSlippageBps;
|
|
2065
|
-
const { usdt, pafiFeeRecipient, universalRouter } = getContractAddresses4(
|
|
2066
|
-
request.chainId
|
|
2067
|
-
);
|
|
2068
|
-
const poolsResponse = await this.cfg.poolsProvider({
|
|
2069
|
-
chainId: request.chainId,
|
|
2070
|
-
pointTokenAddress: request.pointTokenAddress
|
|
2071
|
-
});
|
|
2072
|
-
if (poolsResponse.pools.length === 0) {
|
|
2073
|
-
throw new SwapError(
|
|
2074
|
-
"QUOTE_UNAVAILABLE",
|
|
2075
|
-
"no liquidity pool found for this point token"
|
|
2076
|
-
);
|
|
2077
|
-
}
|
|
2078
|
-
let fallbackQuote;
|
|
2079
|
-
try {
|
|
2080
|
-
fallbackQuote = await findBestQuote(
|
|
2081
|
-
this.cfg.provider,
|
|
2082
|
-
request.chainId,
|
|
2083
|
-
request.pointTokenAddress,
|
|
2084
|
-
usdt,
|
|
2085
|
-
request.amountIn,
|
|
2086
|
-
poolsResponse.pools
|
|
2087
|
-
);
|
|
2088
|
-
} catch {
|
|
2089
|
-
throw new SwapError(
|
|
2090
|
-
"QUOTE_UNAVAILABLE",
|
|
2091
|
-
"no swap path found for this point token"
|
|
2092
|
-
);
|
|
2093
|
-
}
|
|
2094
|
-
const estimatedUsdtOutFallback = fallbackQuote.bestRoute.amountOut;
|
|
2095
|
-
const minAmountOutFallback = estimatedUsdtOutFallback * BigInt(1e4 - slippageBps) / 10000n;
|
|
2096
|
-
const deadline = request.deadline ?? BigInt(
|
|
2097
|
-
Math.floor(this.cfg.now() / 1e3) + this.cfg.defaultSwapDeadlineSeconds
|
|
2098
|
-
);
|
|
2099
|
-
const feeAmount = this.cfg.feeService ? await this.cfg.feeService.estimateGasFee() : 0n;
|
|
2100
|
-
if (feeAmount > 0n && feeAmount >= request.amountIn) {
|
|
2101
|
-
throw new SwapError(
|
|
2102
|
-
"FEE_EXCEEDS_AMOUNT",
|
|
2103
|
-
`gas fee (${feeAmount}) must be strictly less than swap amount (${request.amountIn})`
|
|
2104
|
-
);
|
|
2105
|
-
}
|
|
2106
|
-
const sponsoredAmountIn = request.amountIn - feeAmount;
|
|
2107
|
-
let estimatedUsdtOutSponsored = estimatedUsdtOutFallback;
|
|
2108
|
-
let sponsoredPath = fallbackQuote.bestRoute.path;
|
|
2109
|
-
if (feeAmount > 0n) {
|
|
2110
|
-
try {
|
|
2111
|
-
const sponsoredQuote = await findBestQuote(
|
|
2112
|
-
this.cfg.provider,
|
|
2113
|
-
request.chainId,
|
|
2114
|
-
request.pointTokenAddress,
|
|
2115
|
-
usdt,
|
|
2116
|
-
sponsoredAmountIn,
|
|
2117
|
-
poolsResponse.pools
|
|
2118
|
-
);
|
|
2119
|
-
estimatedUsdtOutSponsored = sponsoredQuote.bestRoute.amountOut;
|
|
2120
|
-
sponsoredPath = sponsoredQuote.bestRoute.path;
|
|
2121
|
-
} catch {
|
|
2122
|
-
throw new SwapError(
|
|
2123
|
-
"QUOTE_UNAVAILABLE",
|
|
2124
|
-
"no swap path found for sponsored amount (after fee deduction)"
|
|
2125
|
-
);
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
const minAmountOutSponsored = estimatedUsdtOutSponsored * BigInt(1e4 - slippageBps) / 10000n;
|
|
2129
|
-
const sponsoredOp = buildSwapWithGasDeduction({
|
|
2130
|
-
userAddress: request.userAddress,
|
|
2131
|
-
aaNonce: request.aaNonce,
|
|
2132
|
-
pointTokenAddress: request.pointTokenAddress,
|
|
2133
|
-
outputTokenAddress: usdt,
|
|
2134
|
-
universalRouterAddress: universalRouter,
|
|
2135
|
-
amountIn: sponsoredAmountIn,
|
|
2136
|
-
minAmountOut: minAmountOutSponsored,
|
|
2137
|
-
swapPath: sponsoredPath,
|
|
2138
|
-
deadline,
|
|
2139
|
-
gasFeePt: feeAmount,
|
|
2140
|
-
feeRecipient: pafiFeeRecipient
|
|
2141
|
-
});
|
|
2142
|
-
const fallbackOp = feeAmount > 0n ? buildSwapWithGasDeduction({
|
|
2143
|
-
userAddress: request.userAddress,
|
|
2144
|
-
aaNonce: request.aaNonce,
|
|
2145
|
-
pointTokenAddress: request.pointTokenAddress,
|
|
2146
|
-
outputTokenAddress: usdt,
|
|
2147
|
-
universalRouterAddress: universalRouter,
|
|
2148
|
-
amountIn: request.amountIn,
|
|
2149
|
-
minAmountOut: minAmountOutFallback,
|
|
2150
|
-
swapPath: fallbackQuote.bestRoute.path,
|
|
2151
|
-
deadline,
|
|
2152
|
-
gasFeePt: 0n,
|
|
2153
|
-
feeRecipient: pafiFeeRecipient
|
|
2154
|
-
}) : void 0;
|
|
2155
|
-
return {
|
|
2156
|
-
userOp: sponsoredOp,
|
|
2157
|
-
fallback: fallbackOp,
|
|
2158
|
-
feeAmount,
|
|
2159
|
-
estimatedUsdtOut: estimatedUsdtOutSponsored,
|
|
2160
|
-
minAmountOut: minAmountOutSponsored,
|
|
2161
|
-
estimatedUsdtOutFallback: fallbackOp ? estimatedUsdtOutFallback : void 0,
|
|
2162
|
-
minAmountOutFallback: fallbackOp ? minAmountOutFallback : void 0,
|
|
2163
|
-
deadline,
|
|
2164
|
-
calls: decodeBatchExecuteCalls2(sponsoredOp.callData),
|
|
2165
|
-
callsFallback: fallbackOp ? decodeBatchExecuteCalls2(fallbackOp.callData) : void 0
|
|
2166
|
-
};
|
|
2167
|
-
}
|
|
2168
|
-
};
|
|
2169
|
-
|
|
2170
2033
|
// src/api/handlers/perpDepositHandler.ts
|
|
2171
2034
|
import {
|
|
2172
2035
|
BROKER_HASHES,
|
|
@@ -2176,8 +2039,8 @@ import {
|
|
|
2176
2039
|
TOKEN_HASHES,
|
|
2177
2040
|
buildPerpDepositViaRelay,
|
|
2178
2041
|
computeAccountId,
|
|
2179
|
-
decodeBatchExecuteCalls as
|
|
2180
|
-
getContractAddresses as
|
|
2042
|
+
decodeBatchExecuteCalls as decodeBatchExecuteCalls2,
|
|
2043
|
+
getContractAddresses as getContractAddresses4
|
|
2181
2044
|
} from "@pafi-dev/core";
|
|
2182
2045
|
var PerpDepositError = class extends PafiSdkError {
|
|
2183
2046
|
httpStatus = "unprocessable";
|
|
@@ -2211,7 +2074,7 @@ var PerpDepositHandler = class {
|
|
|
2211
2074
|
`no Orderly Vault for chainId ${request.chainId}`
|
|
2212
2075
|
);
|
|
2213
2076
|
}
|
|
2214
|
-
const { orderlyRelay: relayAddress, pafiFeeRecipient } =
|
|
2077
|
+
const { orderlyRelay: relayAddress, pafiFeeRecipient } = getContractAddresses4(request.chainId);
|
|
2215
2078
|
const [usdcAddress, brokerAllowed] = await Promise.all([
|
|
2216
2079
|
this.cfg.provider.readContract({
|
|
2217
2080
|
address: vault,
|
|
@@ -2289,8 +2152,8 @@ var PerpDepositHandler = class {
|
|
|
2289
2152
|
brokerHash,
|
|
2290
2153
|
usdcAddress,
|
|
2291
2154
|
relayAddress,
|
|
2292
|
-
calls:
|
|
2293
|
-
callsFallback: fallbackOp ?
|
|
2155
|
+
calls: decodeBatchExecuteCalls2(sponsoredOp.callData),
|
|
2156
|
+
callsFallback: fallbackOp ? decodeBatchExecuteCalls2(fallbackOp.callData) : void 0
|
|
2294
2157
|
};
|
|
2295
2158
|
}
|
|
2296
2159
|
};
|
|
@@ -2300,7 +2163,7 @@ import {
|
|
|
2300
2163
|
ENTRY_POINT_V08 as ENTRY_POINT_V082,
|
|
2301
2164
|
buildEip7702Authorization,
|
|
2302
2165
|
encodeBatchExecute,
|
|
2303
|
-
getContractAddresses as
|
|
2166
|
+
getContractAddresses as getContractAddresses5,
|
|
2304
2167
|
serializeUserOpToJsonRpc as serializeUserOpToJsonRpc2
|
|
2305
2168
|
} from "@pafi-dev/core";
|
|
2306
2169
|
var DEFAULT_DELEGATE_GAS = {
|
|
@@ -2309,7 +2172,7 @@ var DEFAULT_DELEGATE_GAS = {
|
|
|
2309
2172
|
preVerificationGas: 50000n
|
|
2310
2173
|
};
|
|
2311
2174
|
async function handleDelegateSubmit(params) {
|
|
2312
|
-
const { batchExecutor } =
|
|
2175
|
+
const { batchExecutor } = getContractAddresses5(params.chainId);
|
|
2313
2176
|
const callData = encodeBatchExecute([]);
|
|
2314
2177
|
const userOp = {
|
|
2315
2178
|
sender: params.userAddress,
|
|
@@ -2371,74 +2234,6 @@ async function handleDelegateSubmit(params) {
|
|
|
2371
2234
|
};
|
|
2372
2235
|
}
|
|
2373
2236
|
|
|
2374
|
-
// src/api/quoteHelper.ts
|
|
2375
|
-
import {
|
|
2376
|
-
findBestQuote as findBestQuote2,
|
|
2377
|
-
getContractAddresses as getContractAddresses7
|
|
2378
|
-
} from "@pafi-dev/core";
|
|
2379
|
-
var DEFAULT_DEADLINE_SECONDS = 300;
|
|
2380
|
-
async function quotePointTokenToUsdt(params) {
|
|
2381
|
-
const now = params.now ?? (() => Date.now());
|
|
2382
|
-
const suggestedDeadline = Math.floor(now() / 1e3) + (params.deadlineSeconds ?? DEFAULT_DEADLINE_SECONDS);
|
|
2383
|
-
if (params.pointAmount === 0n) {
|
|
2384
|
-
return {
|
|
2385
|
-
estimatedUsdtOut: 0n,
|
|
2386
|
-
netUsdtOut: 0n,
|
|
2387
|
-
exchangeRate: "0.00000000",
|
|
2388
|
-
gasEstimate: 0n,
|
|
2389
|
-
suggestedDeadline
|
|
2390
|
-
};
|
|
2391
|
-
}
|
|
2392
|
-
if (params.pools.length === 0) {
|
|
2393
|
-
return {
|
|
2394
|
-
estimatedUsdtOut: 0n,
|
|
2395
|
-
netUsdtOut: 0n,
|
|
2396
|
-
exchangeRate: "0.00000000",
|
|
2397
|
-
gasEstimate: 0n,
|
|
2398
|
-
suggestedDeadline,
|
|
2399
|
-
quoteError: "QUOTE_UNAVAILABLE"
|
|
2400
|
-
};
|
|
2401
|
-
}
|
|
2402
|
-
const { usdt: usdtAddress } = getContractAddresses7(params.chainId);
|
|
2403
|
-
let estimatedUsdtOut = 0n;
|
|
2404
|
-
let gasEstimate = 0n;
|
|
2405
|
-
try {
|
|
2406
|
-
const best = await findBestQuote2(
|
|
2407
|
-
params.provider,
|
|
2408
|
-
params.chainId,
|
|
2409
|
-
params.pointTokenAddress,
|
|
2410
|
-
usdtAddress,
|
|
2411
|
-
params.pointAmount,
|
|
2412
|
-
params.pools
|
|
2413
|
-
);
|
|
2414
|
-
estimatedUsdtOut = best.bestRoute.amountOut;
|
|
2415
|
-
gasEstimate = best.bestRoute.gasEstimate;
|
|
2416
|
-
} catch {
|
|
2417
|
-
return {
|
|
2418
|
-
estimatedUsdtOut: 0n,
|
|
2419
|
-
netUsdtOut: 0n,
|
|
2420
|
-
exchangeRate: "0.00000000",
|
|
2421
|
-
gasEstimate: 0n,
|
|
2422
|
-
suggestedDeadline,
|
|
2423
|
-
quoteError: "QUOTE_UNAVAILABLE"
|
|
2424
|
-
};
|
|
2425
|
-
}
|
|
2426
|
-
const netUsdtOut = estimatedUsdtOut > params.gasFeeUsdt ? estimatedUsdtOut - params.gasFeeUsdt : 0n;
|
|
2427
|
-
const quoteError = estimatedUsdtOut > 0n && netUsdtOut === 0n ? "AMOUNT_TOO_SMALL_FOR_GAS" : void 0;
|
|
2428
|
-
const rateNum = estimatedUsdtOut > 0n ? Number(
|
|
2429
|
-
estimatedUsdtOut * 1000000n * 10n ** 18n / params.pointAmount
|
|
2430
|
-
) / 1e6 : 0;
|
|
2431
|
-
const exchangeRate = rateNum.toFixed(8);
|
|
2432
|
-
return {
|
|
2433
|
-
estimatedUsdtOut,
|
|
2434
|
-
netUsdtOut,
|
|
2435
|
-
exchangeRate,
|
|
2436
|
-
gasEstimate,
|
|
2437
|
-
suggestedDeadline,
|
|
2438
|
-
...quoteError ? { quoteError } : {}
|
|
2439
|
-
};
|
|
2440
|
-
}
|
|
2441
|
-
|
|
2442
2237
|
// src/api/errorMapper.ts
|
|
2443
2238
|
function createSdkErrorMapper(factories) {
|
|
2444
2239
|
return (err) => {
|
|
@@ -2469,10 +2264,10 @@ import { getAddress as getAddress9 } from "viem";
|
|
|
2469
2264
|
import {
|
|
2470
2265
|
buildAndSignSponsorAuth,
|
|
2471
2266
|
computeAuthorizationHash,
|
|
2472
|
-
decodeBatchExecuteCalls as
|
|
2267
|
+
decodeBatchExecuteCalls as decodeBatchExecuteCalls3,
|
|
2473
2268
|
encodeBatchExecute as encodeBatchExecute2,
|
|
2474
2269
|
ENTRY_POINT_V08 as ENTRY_POINT_V083,
|
|
2475
|
-
getContractAddresses as
|
|
2270
|
+
getContractAddresses as getContractAddresses6,
|
|
2476
2271
|
parseEip7702DelegatedAddress as parseEip7702DelegatedAddress2
|
|
2477
2272
|
} from "@pafi-dev/core";
|
|
2478
2273
|
var IssuerApiAdapter = class {
|
|
@@ -2518,34 +2313,8 @@ var IssuerApiAdapter = class {
|
|
|
2518
2313
|
isMinter: result.isMinter
|
|
2519
2314
|
};
|
|
2520
2315
|
}
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
this.cfg.issuerService.api.handleGasFee(),
|
|
2524
|
-
this.cfg.issuerService.api.handlePools(authenticatedAddress, {
|
|
2525
|
-
chainId,
|
|
2526
|
-
pointTokenAddress: getAddress9(pointTokenAddress)
|
|
2527
|
-
})
|
|
2528
|
-
]);
|
|
2529
|
-
const quote = await quotePointTokenToUsdt({
|
|
2530
|
-
provider: this.cfg.provider,
|
|
2531
|
-
chainId,
|
|
2532
|
-
pointTokenAddress: getAddress9(pointTokenAddress),
|
|
2533
|
-
pointAmount,
|
|
2534
|
-
pools: poolsResult.pools,
|
|
2535
|
-
gasFeeUsdt: gasFeeResult.gasFeeUsdt
|
|
2536
|
-
});
|
|
2537
|
-
const dto = {
|
|
2538
|
-
pointAmount: pointAmount.toString(),
|
|
2539
|
-
estimatedUsdtOut: quote.estimatedUsdtOut.toString(),
|
|
2540
|
-
gasFeeUsdt: gasFeeResult.gasFeeUsdt.toString(),
|
|
2541
|
-
netUsdtOut: quote.netUsdtOut.toString(),
|
|
2542
|
-
exchangeRate: quote.exchangeRate,
|
|
2543
|
-
suggestedDeadline: quote.suggestedDeadline.toString(),
|
|
2544
|
-
gasEstimate: quote.gasEstimate.toString()
|
|
2545
|
-
};
|
|
2546
|
-
if (quote.quoteError) dto.quoteError = quote.quoteError;
|
|
2547
|
-
return dto;
|
|
2548
|
-
}
|
|
2316
|
+
// quote() removed (2026-04-27) — FE PAFI calls @pafi-dev/trading
|
|
2317
|
+
// directly. Issuer SDK doesn't ship swap/quote anymore.
|
|
2549
2318
|
// ------------------------------ Action endpoints -------------------------
|
|
2550
2319
|
async claim(input) {
|
|
2551
2320
|
const ptClaimHandler = this.assertHandler(
|
|
@@ -2594,8 +2363,8 @@ var IssuerApiAdapter = class {
|
|
|
2594
2363
|
"burn"
|
|
2595
2364
|
);
|
|
2596
2365
|
return {
|
|
2597
|
-
calls:
|
|
2598
|
-
callsFallback: response.fallback ?
|
|
2366
|
+
calls: decodeBatchExecuteCalls3(response.userOp.callData),
|
|
2367
|
+
callsFallback: response.fallback ? decodeBatchExecuteCalls3(response.fallback.userOp.callData) : void 0,
|
|
2599
2368
|
feeAmount: response.feeAmount.toString(),
|
|
2600
2369
|
lockId: response.lockId,
|
|
2601
2370
|
lockIdFallback: response.fallback?.lockId,
|
|
@@ -2606,38 +2375,8 @@ var IssuerApiAdapter = class {
|
|
|
2606
2375
|
sponsorAuth
|
|
2607
2376
|
};
|
|
2608
2377
|
}
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
this.cfg.swapHandler,
|
|
2612
|
-
"swapHandler",
|
|
2613
|
-
"swap"
|
|
2614
|
-
);
|
|
2615
|
-
const result = await swapHandler.handle({
|
|
2616
|
-
userAddress: input.authenticatedAddress,
|
|
2617
|
-
chainId: input.chainId,
|
|
2618
|
-
pointTokenAddress: getAddress9(input.pointTokenAddress),
|
|
2619
|
-
amountIn: input.amountIn,
|
|
2620
|
-
aaNonce: input.aaNonce,
|
|
2621
|
-
slippageBps: input.slippageBps
|
|
2622
|
-
});
|
|
2623
|
-
const sponsorAuth = await this.buildSponsorAuth(
|
|
2624
|
-
input.authenticatedAddress,
|
|
2625
|
-
result.userOp.callData,
|
|
2626
|
-
input.chainId,
|
|
2627
|
-
"swap"
|
|
2628
|
-
);
|
|
2629
|
-
return {
|
|
2630
|
-
calls: result.calls,
|
|
2631
|
-
callsFallback: result.callsFallback,
|
|
2632
|
-
feeAmount: result.feeAmount.toString(),
|
|
2633
|
-
estimatedUsdtOut: result.estimatedUsdtOut.toString(),
|
|
2634
|
-
minAmountOut: result.minAmountOut.toString(),
|
|
2635
|
-
estimatedUsdtOutFallback: result.estimatedUsdtOutFallback?.toString(),
|
|
2636
|
-
minAmountOutFallback: result.minAmountOutFallback?.toString(),
|
|
2637
|
-
deadline: result.deadline.toString(),
|
|
2638
|
-
sponsorAuth
|
|
2639
|
-
};
|
|
2640
|
-
}
|
|
2378
|
+
// swap() removed (2026-04-27) — moved to @pafi-dev/trading.
|
|
2379
|
+
// PAFI's web FE calls TradingHandlers.handleSwap directly.
|
|
2641
2380
|
async perpDeposit(input) {
|
|
2642
2381
|
const perpHandler = this.assertHandler(
|
|
2643
2382
|
this.cfg.perpHandler,
|
|
@@ -2788,7 +2527,7 @@ var IssuerApiAdapter = class {
|
|
|
2788
2527
|
}
|
|
2789
2528
|
// ------------------------------ Delegate endpoints -----------------------
|
|
2790
2529
|
async delegateStatus(authenticatedAddress, chainId) {
|
|
2791
|
-
const { batchExecutor } =
|
|
2530
|
+
const { batchExecutor } = getContractAddresses6(chainId);
|
|
2792
2531
|
const code = await this.cfg.provider.getCode({
|
|
2793
2532
|
address: authenticatedAddress
|
|
2794
2533
|
});
|
|
@@ -2798,7 +2537,7 @@ var IssuerApiAdapter = class {
|
|
|
2798
2537
|
};
|
|
2799
2538
|
}
|
|
2800
2539
|
async delegatePrepare(authenticatedAddress, chainId) {
|
|
2801
|
-
const { batchExecutor } =
|
|
2540
|
+
const { batchExecutor } = getContractAddresses6(chainId);
|
|
2802
2541
|
const accountNonce = BigInt(
|
|
2803
2542
|
await this.cfg.provider.getTransactionCount({
|
|
2804
2543
|
address: authenticatedAddress
|
|
@@ -3504,7 +3243,7 @@ var PafiBackendClient = class {
|
|
|
3504
3243
|
|
|
3505
3244
|
// src/config.ts
|
|
3506
3245
|
import { getAddress as getAddress10 } from "viem";
|
|
3507
|
-
import { getContractAddresses as
|
|
3246
|
+
import { getContractAddresses as getContractAddresses7 } from "@pafi-dev/core";
|
|
3508
3247
|
function createIssuerService(config) {
|
|
3509
3248
|
if (!config.provider) {
|
|
3510
3249
|
throw new Error("createIssuerService: provider is required");
|
|
@@ -3574,7 +3313,7 @@ function createIssuerService(config) {
|
|
|
3574
3313
|
indexers.set(tokenAddress, new PointIndexer(indexerConfig));
|
|
3575
3314
|
}
|
|
3576
3315
|
const firstIndexer = indexers.get(tokenAddresses[0]);
|
|
3577
|
-
const chainAddresses =
|
|
3316
|
+
const chainAddresses = getContractAddresses7(config.chainId);
|
|
3578
3317
|
const resolvedContracts = {
|
|
3579
3318
|
batchExecutor: chainAddresses.batchExecutor,
|
|
3580
3319
|
usdt: chainAddresses.usdt,
|
|
@@ -3617,7 +3356,7 @@ import { getAddress as getAddress11 } from "viem";
|
|
|
3617
3356
|
import {
|
|
3618
3357
|
POINT_TOKEN_V2_ABI as POINT_TOKEN_V2_ABI3,
|
|
3619
3358
|
issuerRegistryGetIssuerFlatAbi,
|
|
3620
|
-
getContractAddresses as
|
|
3359
|
+
getContractAddresses as getContractAddresses8
|
|
3621
3360
|
} from "@pafi-dev/core";
|
|
3622
3361
|
var ISSUER_RECORD_TTL_MS = 3e4;
|
|
3623
3362
|
var IssuerStateValidator = class _IssuerStateValidator {
|
|
@@ -3635,7 +3374,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
|
|
|
3635
3374
|
* `CONTRACT_ADDRESSES` map for the given chain.
|
|
3636
3375
|
*/
|
|
3637
3376
|
static forChain(provider, chainId) {
|
|
3638
|
-
const { issuerRegistry } =
|
|
3377
|
+
const { issuerRegistry } = getContractAddresses8(chainId);
|
|
3639
3378
|
return new _IssuerStateValidator(provider, issuerRegistry);
|
|
3640
3379
|
}
|
|
3641
3380
|
/**
|
|
@@ -3808,8 +3547,6 @@ export {
|
|
|
3808
3547
|
PointIndexer,
|
|
3809
3548
|
RelayError,
|
|
3810
3549
|
RelayService,
|
|
3811
|
-
SwapError,
|
|
3812
|
-
SwapHandler,
|
|
3813
3550
|
authenticateRequest,
|
|
3814
3551
|
createIssuerService,
|
|
3815
3552
|
createNativePtQuoter,
|
|
@@ -3823,7 +3560,6 @@ export {
|
|
|
3823
3560
|
handleRedeemStatus,
|
|
3824
3561
|
mergePaymasterFields,
|
|
3825
3562
|
prepareMobileUserOp,
|
|
3826
|
-
quotePointTokenToUsdt,
|
|
3827
3563
|
relayUserOp,
|
|
3828
3564
|
requestPaymaster,
|
|
3829
3565
|
serializeEntryToJsonRpc,
|