@pafi-dev/issuer 0.39.3 → 0.40.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 +57 -262
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -156
- package/dist/index.d.ts +33 -156
- package/dist/index.js +40 -243
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2508,25 +2508,7 @@ var MemoryPendingUserOpStore = class {
|
|
|
2508
2508
|
};
|
|
2509
2509
|
|
|
2510
2510
|
// src/userop-store/prepareUserOp.ts
|
|
2511
|
-
import {
|
|
2512
|
-
function serializeUserOpTypedData(td) {
|
|
2513
|
-
return {
|
|
2514
|
-
domain: td.domain,
|
|
2515
|
-
types: td.types,
|
|
2516
|
-
primaryType: td.primaryType,
|
|
2517
|
-
message: {
|
|
2518
|
-
sender: td.message.sender,
|
|
2519
|
-
nonce: `0x${td.message.nonce.toString(16)}`,
|
|
2520
|
-
initCode: td.message.initCode,
|
|
2521
|
-
callData: td.message.callData,
|
|
2522
|
-
accountGasLimits: td.message.accountGasLimits,
|
|
2523
|
-
preVerificationGas: `0x${td.message.preVerificationGas.toString(16)}`,
|
|
2524
|
-
gasFees: td.message.gasFees,
|
|
2525
|
-
paymasterAndData: td.message.paymasterAndData
|
|
2526
|
-
}
|
|
2527
|
-
};
|
|
2528
|
-
}
|
|
2529
|
-
__name(serializeUserOpTypedData, "serializeUserOpTypedData");
|
|
2511
|
+
import { computeUserOpHash } from "@pafi-dev/core";
|
|
2530
2512
|
function mergePaymasterFields(userOp, paymasterFields) {
|
|
2531
2513
|
if (!paymasterFields) return userOp;
|
|
2532
2514
|
const merged = {
|
|
@@ -2542,8 +2524,7 @@ function applyPaymasterGasEstimates(partialUserOp, paymasterFields, chainId) {
|
|
|
2542
2524
|
const userOp = mergePaymasterFields(partialUserOp, paymasterFields);
|
|
2543
2525
|
return {
|
|
2544
2526
|
userOp,
|
|
2545
|
-
userOpHash: computeUserOpHash(userOp, chainId)
|
|
2546
|
-
typedData: serializeUserOpTypedData(buildUserOpTypedData(userOp, chainId))
|
|
2527
|
+
userOpHash: computeUserOpHash(userOp, chainId)
|
|
2547
2528
|
};
|
|
2548
2529
|
}
|
|
2549
2530
|
__name(applyPaymasterGasEstimates, "applyPaymasterGasEstimates");
|
|
@@ -2817,7 +2798,7 @@ __name(handleMobileSubmit, "handleMobileSubmit");
|
|
|
2817
2798
|
|
|
2818
2799
|
// src/api/handlers/ptClaimHandler.ts
|
|
2819
2800
|
import { getAddress as getAddress9 } from "viem";
|
|
2820
|
-
import { POINT_TOKEN_ABI as POINT_TOKEN_ABI2,
|
|
2801
|
+
import { POINT_TOKEN_ABI as POINT_TOKEN_ABI2, decodeKernelExecuteCalls, getContractAddresses as getContractAddresses3 } from "@pafi-dev/core";
|
|
2821
2802
|
|
|
2822
2803
|
// src/issuer-state/types.ts
|
|
2823
2804
|
var IssuerStateError = class extends PafiSdkError {
|
|
@@ -2908,7 +2889,7 @@ var PTClaimHandler = class {
|
|
|
2908
2889
|
}
|
|
2909
2890
|
}
|
|
2910
2891
|
const chainAddresses = getContractAddresses3(request.chainId);
|
|
2911
|
-
const {
|
|
2892
|
+
const { kernel: batchExecutorAddress } = chainAddresses;
|
|
2912
2893
|
let mintRequestNonce;
|
|
2913
2894
|
try {
|
|
2914
2895
|
mintRequestNonce = await this.cfg.provider.readContract({
|
|
@@ -3022,8 +3003,8 @@ var PTClaimHandler = class {
|
|
|
3022
3003
|
throw new PTClaimError("BUILD_FAILED", `prepareMint (fallback) failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
3023
3004
|
}
|
|
3024
3005
|
}
|
|
3025
|
-
const calls =
|
|
3026
|
-
const callsFallback = fallback ?
|
|
3006
|
+
const calls = decodeKernelExecuteCalls(userOp.callData);
|
|
3007
|
+
const callsFallback = fallback ? decodeKernelExecuteCalls(fallback.callData) : void 0;
|
|
3027
3008
|
return {
|
|
3028
3009
|
userOp,
|
|
3029
3010
|
fallback,
|
|
@@ -3047,7 +3028,7 @@ var PTClaimHandler = class {
|
|
|
3047
3028
|
};
|
|
3048
3029
|
|
|
3049
3030
|
// src/api/handlers/perpDepositHandler.ts
|
|
3050
|
-
import { BROKER_HASHES, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, TOKEN_HASHES, buildPerpDepositViaRelay, computeAccountId,
|
|
3031
|
+
import { BROKER_HASHES, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, TOKEN_HASHES, buildPerpDepositViaRelay, computeAccountId, decodeKernelExecuteCalls as decodeKernelExecuteCalls2, getContractAddresses as getContractAddresses4, quoteOperatorFeeUsdt } from "@pafi-dev/core";
|
|
3051
3032
|
var PerpDepositError = class extends PafiSdkError {
|
|
3052
3033
|
static {
|
|
3053
3034
|
__name(this, "PerpDepositError");
|
|
@@ -3168,122 +3149,15 @@ var PerpDepositHandler = class {
|
|
|
3168
3149
|
brokerHash,
|
|
3169
3150
|
usdcAddress,
|
|
3170
3151
|
relayAddress,
|
|
3171
|
-
calls:
|
|
3172
|
-
callsFallback: fallbackOp ?
|
|
3152
|
+
calls: decodeKernelExecuteCalls2(sponsoredOp.callData),
|
|
3153
|
+
callsFallback: fallbackOp ? decodeKernelExecuteCalls2(fallbackOp.callData) : void 0
|
|
3173
3154
|
};
|
|
3174
3155
|
}
|
|
3175
3156
|
};
|
|
3176
3157
|
|
|
3177
|
-
// src/api/delegateHandler.ts
|
|
3178
|
-
import { ENTRY_POINT_V08 as ENTRY_POINT_V082, buildDelegationUserOp, buildEip7702Authorization, getContractAddresses as getContractAddresses5, serializeUserOpToJsonRpc as serializeUserOpToJsonRpc2 } from "@pafi-dev/core";
|
|
3179
|
-
import { getAddress as getAddress10 } from "viem";
|
|
3180
|
-
var DEFAULT_DELEGATE_GAS = {
|
|
3181
|
-
callGasLimit: 100000n,
|
|
3182
|
-
verificationGasLimit: 150000n,
|
|
3183
|
-
preVerificationGas: 50000n
|
|
3184
|
-
};
|
|
3185
|
-
async function handleDelegatePrepare(params) {
|
|
3186
|
-
const { batchExecutor } = getContractAddresses5(params.chainId);
|
|
3187
|
-
const partial = buildDelegationUserOp({
|
|
3188
|
-
userAddress: params.userAddress,
|
|
3189
|
-
aaNonce: params.aaNonce,
|
|
3190
|
-
gasLimits: {
|
|
3191
|
-
callGasLimit: params.gasLimits?.callGasLimit ?? DEFAULT_DELEGATE_GAS.callGasLimit,
|
|
3192
|
-
verificationGasLimit: params.gasLimits?.verificationGasLimit ?? DEFAULT_DELEGATE_GAS.verificationGasLimit,
|
|
3193
|
-
preVerificationGas: params.gasLimits?.preVerificationGas ?? DEFAULT_DELEGATE_GAS.preVerificationGas
|
|
3194
|
-
}
|
|
3195
|
-
});
|
|
3196
|
-
const userOp = {
|
|
3197
|
-
sender: partial.sender,
|
|
3198
|
-
nonce: partial.nonce,
|
|
3199
|
-
callData: partial.callData,
|
|
3200
|
-
callGasLimit: partial.callGasLimit,
|
|
3201
|
-
verificationGasLimit: partial.verificationGasLimit,
|
|
3202
|
-
preVerificationGas: partial.preVerificationGas,
|
|
3203
|
-
maxFeePerGas: params.fees.maxFeePerGas ?? 0n,
|
|
3204
|
-
maxPriorityFeePerGas: params.fees.maxPriorityFeePerGas ?? 0n
|
|
3205
|
-
};
|
|
3206
|
-
const authorization = buildEip7702Authorization({
|
|
3207
|
-
chainId: params.chainId,
|
|
3208
|
-
address: batchExecutor,
|
|
3209
|
-
nonce: params.delegationNonce,
|
|
3210
|
-
authSig: params.authSig
|
|
3211
|
-
});
|
|
3212
|
-
const paymasterFields = await requestPaymaster({
|
|
3213
|
-
client: params.pafiBackendClient,
|
|
3214
|
-
chainId: params.chainId,
|
|
3215
|
-
scenario: "delegate",
|
|
3216
|
-
userOp,
|
|
3217
|
-
pointTokenAddress: batchExecutor,
|
|
3218
|
-
eip7702Auth: authorization,
|
|
3219
|
-
onWarning: params.onWarning
|
|
3220
|
-
});
|
|
3221
|
-
const prepared = applyPaymasterGasEstimates(userOp, paymasterFields, params.chainId);
|
|
3222
|
-
const merged = prepared.userOp;
|
|
3223
|
-
const userOpHash = prepared.userOpHash;
|
|
3224
|
-
await params.store.save(params.lockId, {
|
|
3225
|
-
sender: merged.sender,
|
|
3226
|
-
nonce: merged.nonce.toString(10),
|
|
3227
|
-
callData: merged.callData,
|
|
3228
|
-
callGasLimit: merged.callGasLimit.toString(10),
|
|
3229
|
-
verificationGasLimit: merged.verificationGasLimit.toString(10),
|
|
3230
|
-
preVerificationGas: merged.preVerificationGas.toString(10),
|
|
3231
|
-
maxFeePerGas: merged.maxFeePerGas.toString(10),
|
|
3232
|
-
maxPriorityFeePerGas: merged.maxPriorityFeePerGas.toString(10),
|
|
3233
|
-
...merged.paymaster ? {
|
|
3234
|
-
paymaster: merged.paymaster
|
|
3235
|
-
} : {},
|
|
3236
|
-
...merged.paymasterVerificationGasLimit ? {
|
|
3237
|
-
paymasterVerificationGasLimit: merged.paymasterVerificationGasLimit.toString(10)
|
|
3238
|
-
} : {},
|
|
3239
|
-
...merged.paymasterPostOpGasLimit ? {
|
|
3240
|
-
paymasterPostOpGasLimit: merged.paymasterPostOpGasLimit.toString(10)
|
|
3241
|
-
} : {},
|
|
3242
|
-
...merged.paymasterData ? {
|
|
3243
|
-
paymasterData: merged.paymasterData
|
|
3244
|
-
} : {},
|
|
3245
|
-
chainId: params.chainId,
|
|
3246
|
-
userOpHash,
|
|
3247
|
-
eip7702Auth: authorization
|
|
3248
|
-
}, params.ttlSeconds);
|
|
3249
|
-
return {
|
|
3250
|
-
lockId: params.lockId,
|
|
3251
|
-
userOpHash,
|
|
3252
|
-
typedData: prepared.typedData,
|
|
3253
|
-
expiresInSeconds: params.ttlSeconds,
|
|
3254
|
-
isSponsored: !!paymasterFields
|
|
3255
|
-
};
|
|
3256
|
-
}
|
|
3257
|
-
__name(handleDelegatePrepare, "handleDelegatePrepare");
|
|
3258
|
-
async function handleDelegateSubmit(params) {
|
|
3259
|
-
const entry = await params.store.get(params.lockId);
|
|
3260
|
-
if (!entry) {
|
|
3261
|
-
throw new PendingUserOpNotFoundError(params.lockId);
|
|
3262
|
-
}
|
|
3263
|
-
if (getAddress10(entry.sender) !== getAddress10(params.authenticatedAddress)) {
|
|
3264
|
-
throw new PendingUserOpForbiddenError(params.lockId);
|
|
3265
|
-
}
|
|
3266
|
-
if (!entry.eip7702Auth) {
|
|
3267
|
-
throw new Error(`delegate entry ${params.lockId} missing eip7702Auth \u2014 prepare step did not run correctly`);
|
|
3268
|
-
}
|
|
3269
|
-
const userOpJson = serializeEntryToJsonRpc(entry, params.userOpSig, "sponsored");
|
|
3270
|
-
const result = await relayUserOp({
|
|
3271
|
-
client: params.pafiBackendClient,
|
|
3272
|
-
userOp: userOpJson,
|
|
3273
|
-
entryPoint: params.entryPoint ?? ENTRY_POINT_V082,
|
|
3274
|
-
eip7702Auth: entry.eip7702Auth
|
|
3275
|
-
});
|
|
3276
|
-
await params.store.delete(params.lockId);
|
|
3277
|
-
return {
|
|
3278
|
-
userOpHash: result.userOpHash
|
|
3279
|
-
};
|
|
3280
|
-
}
|
|
3281
|
-
__name(handleDelegateSubmit, "handleDelegateSubmit");
|
|
3282
|
-
|
|
3283
3158
|
// src/api/issuerApiAdapter.ts
|
|
3284
|
-
import {
|
|
3285
|
-
import {
|
|
3286
|
-
import { buildAndSignSponsorAuth, decodeBatchExecuteCalls as decodeBatchExecuteCalls3, encodeBatchExecute, ENTRY_POINT_V08 as ENTRY_POINT_V083, getContractAddresses as getContractAddresses6, parseEip7702DelegatedAddress as parseEip7702DelegatedAddress2 } from "@pafi-dev/core";
|
|
3159
|
+
import { getAddress as getAddress10 } from "viem";
|
|
3160
|
+
import { buildAndSignSponsorAuth, decodeKernelExecuteCalls as decodeKernelExecuteCalls3 } from "@pafi-dev/core";
|
|
3287
3161
|
var AdapterMisconfiguredError = class extends Error {
|
|
3288
3162
|
static {
|
|
3289
3163
|
__name(this, "AdapterMisconfiguredError");
|
|
@@ -3338,7 +3212,7 @@ var IssuerApiAdapter = class {
|
|
|
3338
3212
|
async pools(authenticatedAddress, chainId, pointTokenAddress) {
|
|
3339
3213
|
const result = await this.cfg.issuerService.api.handlePools(authenticatedAddress, {
|
|
3340
3214
|
chainId,
|
|
3341
|
-
pointTokenAddress:
|
|
3215
|
+
pointTokenAddress: getAddress10(pointTokenAddress)
|
|
3342
3216
|
});
|
|
3343
3217
|
return {
|
|
3344
3218
|
pools: result.pools
|
|
@@ -3347,8 +3221,8 @@ var IssuerApiAdapter = class {
|
|
|
3347
3221
|
async user(authenticatedAddress, chainId, userAddress, pointTokenAddress) {
|
|
3348
3222
|
const result = await this.cfg.issuerService.api.handleUser(authenticatedAddress, {
|
|
3349
3223
|
chainId,
|
|
3350
|
-
userAddress:
|
|
3351
|
-
pointTokenAddress:
|
|
3224
|
+
userAddress: getAddress10(userAddress),
|
|
3225
|
+
pointTokenAddress: getAddress10(pointTokenAddress)
|
|
3352
3226
|
});
|
|
3353
3227
|
return {
|
|
3354
3228
|
offChainBalance: result.offChainBalance.toString(),
|
|
@@ -3363,7 +3237,7 @@ var IssuerApiAdapter = class {
|
|
|
3363
3237
|
// ------------------------------ Action endpoints -------------------------
|
|
3364
3238
|
async claim(input) {
|
|
3365
3239
|
const ptClaimHandler = this.assertHandler(this.cfg.ptClaimHandler, "ptClaimHandler", "claim");
|
|
3366
|
-
const pointTokenAddress =
|
|
3240
|
+
const pointTokenAddress = getAddress10(input.pointTokenAddress);
|
|
3367
3241
|
const result = await ptClaimHandler.handle({
|
|
3368
3242
|
authenticatedAddress: input.authenticatedAddress,
|
|
3369
3243
|
userAddress: input.authenticatedAddress,
|
|
@@ -3384,7 +3258,7 @@ var IssuerApiAdapter = class {
|
|
|
3384
3258
|
}
|
|
3385
3259
|
async redeem(input) {
|
|
3386
3260
|
this.assertRedeemHandler();
|
|
3387
|
-
const pointTokenAddress =
|
|
3261
|
+
const pointTokenAddress = getAddress10(input.pointTokenAddress);
|
|
3388
3262
|
const response = await this.cfg.ptRedeemHandler.handle({
|
|
3389
3263
|
userAddress: input.authenticatedAddress,
|
|
3390
3264
|
authenticatedAddress: input.authenticatedAddress,
|
|
@@ -3395,8 +3269,8 @@ var IssuerApiAdapter = class {
|
|
|
3395
3269
|
});
|
|
3396
3270
|
const sponsorAuth = await this.buildSponsorAuth(input.authenticatedAddress, response.userOp.callData, input.chainId, "burn");
|
|
3397
3271
|
return {
|
|
3398
|
-
calls:
|
|
3399
|
-
callsFallback: response.fallback ?
|
|
3272
|
+
calls: decodeKernelExecuteCalls3(response.userOp.callData),
|
|
3273
|
+
callsFallback: response.fallback ? decodeKernelExecuteCalls3(response.fallback.userOp.callData) : void 0,
|
|
3400
3274
|
feeAmount: response.feeAmount.toString(),
|
|
3401
3275
|
lockId: response.lockId,
|
|
3402
3276
|
lockIdFallback: response.fallback?.lockId,
|
|
@@ -3436,7 +3310,7 @@ var IssuerApiAdapter = class {
|
|
|
3436
3310
|
// ------------------------------ Mobile endpoints -------------------------
|
|
3437
3311
|
async claimPrepare(input) {
|
|
3438
3312
|
const ptClaimHandler = this.assertHandler(this.cfg.ptClaimHandler, "ptClaimHandler", "claimPrepare");
|
|
3439
|
-
const pointTokenAddress =
|
|
3313
|
+
const pointTokenAddress = getAddress10(input.pointTokenAddress);
|
|
3440
3314
|
const claimResult = await ptClaimHandler.handle({
|
|
3441
3315
|
authenticatedAddress: input.authenticatedAddress,
|
|
3442
3316
|
userAddress: input.authenticatedAddress,
|
|
@@ -3449,9 +3323,7 @@ var IssuerApiAdapter = class {
|
|
|
3449
3323
|
return {
|
|
3450
3324
|
lockId: claimResult.lockId,
|
|
3451
3325
|
userOpHash: prepared.sponsored.userOpHash,
|
|
3452
|
-
typedData: prepared.sponsored.typedData,
|
|
3453
3326
|
userOpHashFallback: prepared.fallback?.userOpHash,
|
|
3454
|
-
typedDataFallback: prepared.fallback?.typedData,
|
|
3455
3327
|
feeAmount: claimResult.feeAmount.toString(),
|
|
3456
3328
|
signatureDeadline: claimResult.signatureDeadline.toString(),
|
|
3457
3329
|
expiresInSeconds: claimResult.expiresInSeconds,
|
|
@@ -3472,7 +3344,7 @@ var IssuerApiAdapter = class {
|
|
|
3472
3344
|
}
|
|
3473
3345
|
async redeemPrepare(input) {
|
|
3474
3346
|
this.assertRedeemHandler();
|
|
3475
|
-
const pointTokenAddress =
|
|
3347
|
+
const pointTokenAddress = getAddress10(input.pointTokenAddress);
|
|
3476
3348
|
const redeemResponse = await this.cfg.ptRedeemHandler.handle({
|
|
3477
3349
|
userAddress: input.authenticatedAddress,
|
|
3478
3350
|
authenticatedAddress: input.authenticatedAddress,
|
|
@@ -3486,9 +3358,7 @@ var IssuerApiAdapter = class {
|
|
|
3486
3358
|
lockId: redeemResponse.lockId,
|
|
3487
3359
|
lockIdFallback: redeemResponse.fallback?.lockId,
|
|
3488
3360
|
userOpHash: prepared.sponsored.userOpHash,
|
|
3489
|
-
typedData: prepared.sponsored.typedData,
|
|
3490
3361
|
userOpHashFallback: prepared.fallback?.userOpHash,
|
|
3491
|
-
typedDataFallback: prepared.fallback?.typedData,
|
|
3492
3362
|
netCreditAmount: redeemResponse.netCreditAmount.toString(),
|
|
3493
3363
|
netCreditAmountFallback: redeemResponse.fallback?.netCreditAmount.toString(),
|
|
3494
3364
|
feeAmount: redeemResponse.feeAmount.toString(),
|
|
@@ -3529,81 +3399,10 @@ var IssuerApiAdapter = class {
|
|
|
3529
3399
|
onWarning: this.cfg.onWarning
|
|
3530
3400
|
});
|
|
3531
3401
|
}
|
|
3532
|
-
//
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
this.cfg.provider.getCode({
|
|
3537
|
-
address: authenticatedAddress
|
|
3538
|
-
}),
|
|
3539
|
-
this.cfg.provider.getTransactionCount({
|
|
3540
|
-
address: authenticatedAddress,
|
|
3541
|
-
blockTag: "pending"
|
|
3542
|
-
})
|
|
3543
|
-
]);
|
|
3544
|
-
return {
|
|
3545
|
-
isDelegated: parseEip7702DelegatedAddress2(code) !== null,
|
|
3546
|
-
batchExecutorAddress: batchExecutor,
|
|
3547
|
-
delegationNonce: nonce.toString(),
|
|
3548
|
-
chainId
|
|
3549
|
-
};
|
|
3550
|
-
}
|
|
3551
|
-
/**
|
|
3552
|
-
* Build the delegation-anchor UserOp + obtain paymaster sponsorship
|
|
3553
|
-
* + persist as a pending entry. Mobile must:
|
|
3554
|
-
*
|
|
3555
|
-
* 1. Sign EIP-7702 authorization LOCALLY (Privy `signAuthorization`
|
|
3556
|
-
* with `{contractAddress: batchExecutorAddress, chainId,
|
|
3557
|
-
* nonce: delegationNonce}`) → 65-byte authSig hex.
|
|
3558
|
-
* 2. POST `/delegate/prepare` with `{ chainId, delegationNonce,
|
|
3559
|
-
* authSig }` → this method.
|
|
3560
|
-
* 3. Sign returned `userOpHash` LOCALLY (`signTypedData(typedData)`).
|
|
3561
|
-
* 4. POST `/delegate/submit` with `{ lockId, userOpSig }`.
|
|
3562
|
-
*
|
|
3563
|
-
* v0.7.7 — replaces single-shot delegateSubmit that tried to relay
|
|
3564
|
-
* a UserOp with empty `signature: "0x"` (Simple7702Account's
|
|
3565
|
-
* validateUserOp reverts `ECDSAInvalidSignatureLength` 0xfce698f7).
|
|
3566
|
-
*/
|
|
3567
|
-
async delegatePrepare(authenticatedAddress, input) {
|
|
3568
|
-
const { batchExecutor } = getContractAddresses6(input.chainId);
|
|
3569
|
-
const fees = await this.cfg.provider.estimateFeesPerGas();
|
|
3570
|
-
const lockId = randomUUID();
|
|
3571
|
-
const result = await handleDelegatePrepare({
|
|
3572
|
-
userAddress: authenticatedAddress,
|
|
3573
|
-
chainId: input.chainId,
|
|
3574
|
-
delegationNonce: input.delegationNonce,
|
|
3575
|
-
aaNonce: input.aaNonce,
|
|
3576
|
-
authSig: input.authSig,
|
|
3577
|
-
fees,
|
|
3578
|
-
lockId,
|
|
3579
|
-
store: this.cfg.pendingUserOpStore,
|
|
3580
|
-
ttlSeconds: 15 * 60,
|
|
3581
|
-
pafiBackendClient: this.cfg.pafiBackendClient,
|
|
3582
|
-
onWarning: this.cfg.onWarning
|
|
3583
|
-
});
|
|
3584
|
-
return {
|
|
3585
|
-
lockId: result.lockId,
|
|
3586
|
-
userOpHash: result.userOpHash,
|
|
3587
|
-
typedData: result.typedData,
|
|
3588
|
-
expiresInSeconds: result.expiresInSeconds,
|
|
3589
|
-
isSponsored: result.isSponsored,
|
|
3590
|
-
delegationNonce: input.delegationNonce.toString(),
|
|
3591
|
-
batchExecutorAddress: batchExecutor,
|
|
3592
|
-
chainId: input.chainId
|
|
3593
|
-
};
|
|
3594
|
-
}
|
|
3595
|
-
async delegateSubmit(input) {
|
|
3596
|
-
const result = await handleDelegateSubmit({
|
|
3597
|
-
lockId: input.lockId,
|
|
3598
|
-
authenticatedAddress: input.authenticatedAddress,
|
|
3599
|
-
userOpSig: input.userOpSig,
|
|
3600
|
-
store: this.cfg.pendingUserOpStore,
|
|
3601
|
-
pafiBackendClient: this.cfg.pafiBackendClient
|
|
3602
|
-
});
|
|
3603
|
-
return {
|
|
3604
|
-
userOpHash: result.userOpHash
|
|
3605
|
-
};
|
|
3606
|
-
}
|
|
3402
|
+
// Delegate endpoints removed — folded-in delegation (via
|
|
3403
|
+
// `eip7702Auth` on claim/redeem prepare) is now the only path. The
|
|
3404
|
+
// bundler applies SetCode + handleOps in one tx, so there is no
|
|
3405
|
+
// separate `/delegate/*` flow. See `handleMobilePrepare`.
|
|
3607
3406
|
// ------------------------------ Internal helpers -------------------------
|
|
3608
3407
|
/**
|
|
3609
3408
|
* Build + sign a SponsorAuth payload. Returns `undefined` when no
|
|
@@ -4211,8 +4010,8 @@ var PafiBackendClient = class {
|
|
|
4211
4010
|
};
|
|
4212
4011
|
|
|
4213
4012
|
// src/config.ts
|
|
4214
|
-
import { getAddress as
|
|
4215
|
-
import { getContractAddresses as
|
|
4013
|
+
import { getAddress as getAddress11 } from "viem";
|
|
4014
|
+
import { getContractAddresses as getContractAddresses5 } from "@pafi-dev/core";
|
|
4216
4015
|
|
|
4217
4016
|
// src/redemption/evaluator.ts
|
|
4218
4017
|
var SECONDS_PER_DAY = 24 * 60 * 60;
|
|
@@ -4626,7 +4425,7 @@ async function createIssuerService(config) {
|
|
|
4626
4425
|
if (rawAddresses.length === 0) {
|
|
4627
4426
|
throw new Error("createIssuerService: at least one of pointTokenAddress / pointTokenAddresses is required");
|
|
4628
4427
|
}
|
|
4629
|
-
const tokenAddresses = rawAddresses.map((a) =>
|
|
4428
|
+
const tokenAddresses = rawAddresses.map((a) => getAddress11(a));
|
|
4630
4429
|
const ledger = config.ledger;
|
|
4631
4430
|
const sessionStore = config.sessionStore ?? new MemorySessionStore();
|
|
4632
4431
|
const policy = config.policy ?? new DefaultPolicyEngine({
|
|
@@ -4653,7 +4452,7 @@ async function createIssuerService(config) {
|
|
|
4653
4452
|
provider: config.provider
|
|
4654
4453
|
});
|
|
4655
4454
|
}
|
|
4656
|
-
const sdkWrapperAddress =
|
|
4455
|
+
const sdkWrapperAddress = getContractAddresses5(config.chainId).mintFeeWrapper;
|
|
4657
4456
|
const wrapperOverride = config.indexer?.mintFeeWrapperAddress;
|
|
4658
4457
|
const resolvedWrapperAddress = wrapperOverride !== void 0 ? wrapperOverride : sdkWrapperAddress;
|
|
4659
4458
|
const baseCursorStore = config.indexer?.cursorStore;
|
|
@@ -4688,9 +4487,9 @@ async function createIssuerService(config) {
|
|
|
4688
4487
|
}
|
|
4689
4488
|
indexers.set(tokenAddress, new PointIndexer(indexerConfig));
|
|
4690
4489
|
}
|
|
4691
|
-
const chainAddresses =
|
|
4490
|
+
const chainAddresses = getContractAddresses5(config.chainId);
|
|
4692
4491
|
const resolvedContracts = {
|
|
4693
|
-
|
|
4492
|
+
kernel: chainAddresses.kernel,
|
|
4694
4493
|
usdt: chainAddresses.usdt,
|
|
4695
4494
|
issuerRegistry: chainAddresses.issuerRegistry,
|
|
4696
4495
|
mintingOracle: chainAddresses.mintingOracle,
|
|
@@ -4778,8 +4577,8 @@ async function createIssuerService(config) {
|
|
|
4778
4577
|
__name(createIssuerService, "createIssuerService");
|
|
4779
4578
|
|
|
4780
4579
|
// src/issuer-state/validator.ts
|
|
4781
|
-
import { getAddress as
|
|
4782
|
-
import { POINT_TOKEN_ABI as POINT_TOKEN_ABI3, issuerRegistryAbi, getContractAddresses as
|
|
4580
|
+
import { getAddress as getAddress12 } from "viem";
|
|
4581
|
+
import { POINT_TOKEN_ABI as POINT_TOKEN_ABI3, issuerRegistryAbi, getContractAddresses as getContractAddresses6 } from "@pafi-dev/core";
|
|
4783
4582
|
var ISSUER_RECORD_TTL_MS = 1e4;
|
|
4784
4583
|
var IssuerStateValidator = class _IssuerStateValidator {
|
|
4785
4584
|
static {
|
|
@@ -4799,7 +4598,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
|
|
|
4799
4598
|
* `CONTRACT_ADDRESSES` map for the given chain.
|
|
4800
4599
|
*/
|
|
4801
4600
|
static forChain(provider, chainId) {
|
|
4802
|
-
const { issuerRegistry } =
|
|
4601
|
+
const { issuerRegistry } = getContractAddresses6(chainId);
|
|
4803
4602
|
return new _IssuerStateValidator(provider, issuerRegistry);
|
|
4804
4603
|
}
|
|
4805
4604
|
/**
|
|
@@ -4810,7 +4609,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
|
|
|
4810
4609
|
*/
|
|
4811
4610
|
invalidate(pointToken) {
|
|
4812
4611
|
if (pointToken) {
|
|
4813
|
-
const key =
|
|
4612
|
+
const key = getAddress12(pointToken);
|
|
4814
4613
|
this.pointTokenIssuerCache.delete(key);
|
|
4815
4614
|
this.stateCache.delete(key);
|
|
4816
4615
|
this.inflight.delete(key);
|
|
@@ -4825,7 +4624,7 @@ var IssuerStateValidator = class _IssuerStateValidator {
|
|
|
4825
4624
|
* The issuer field is set at `initialize()` and never changes.
|
|
4826
4625
|
*/
|
|
4827
4626
|
async getIssuerAddressForPointToken(pointToken) {
|
|
4828
|
-
const key =
|
|
4627
|
+
const key = getAddress12(pointToken);
|
|
4829
4628
|
const cached = this.pointTokenIssuerCache.get(key);
|
|
4830
4629
|
if (cached) return cached;
|
|
4831
4630
|
const issuer = await this.provider.readContract({
|
|
@@ -4833,15 +4632,15 @@ var IssuerStateValidator = class _IssuerStateValidator {
|
|
|
4833
4632
|
abi: POINT_TOKEN_ABI3,
|
|
4834
4633
|
functionName: "issuer"
|
|
4835
4634
|
});
|
|
4836
|
-
this.pointTokenIssuerCache.set(key,
|
|
4837
|
-
return
|
|
4635
|
+
this.pointTokenIssuerCache.set(key, getAddress12(issuer));
|
|
4636
|
+
return getAddress12(issuer);
|
|
4838
4637
|
}
|
|
4839
4638
|
/**
|
|
4840
4639
|
* Read registry record + totalSupply, with 30s cache and in-flight
|
|
4841
4640
|
* deduplication. Does NOT throw on inactive/missing — returns raw state.
|
|
4842
4641
|
*/
|
|
4843
4642
|
async getIssuerState(pointToken) {
|
|
4844
|
-
const tokenAddr =
|
|
4643
|
+
const tokenAddr = getAddress12(pointToken);
|
|
4845
4644
|
const now = Date.now();
|
|
4846
4645
|
const cached = this.stateCache.get(tokenAddr);
|
|
4847
4646
|
if (cached && cached.expiresAt > now) return cached.value;
|
|
@@ -4976,7 +4775,7 @@ var MemoryRedemptionHistoryStore = class {
|
|
|
4976
4775
|
};
|
|
4977
4776
|
|
|
4978
4777
|
// src/index.ts
|
|
4979
|
-
var PAFI_ISSUER_SDK_VERSION = true ? "0.
|
|
4778
|
+
var PAFI_ISSUER_SDK_VERSION = true ? "0.40.0" : "dev";
|
|
4980
4779
|
export {
|
|
4981
4780
|
AdapterMisconfiguredError,
|
|
4982
4781
|
AuthError,
|
|
@@ -5040,7 +4839,6 @@ export {
|
|
|
5040
4839
|
defaultPolicyFor,
|
|
5041
4840
|
evaluateRedemption,
|
|
5042
4841
|
handleClaimStatus,
|
|
5043
|
-
handleDelegateSubmit,
|
|
5044
4842
|
handleMobilePrepare,
|
|
5045
4843
|
handleMobileSubmit,
|
|
5046
4844
|
handleRedeemStatus,
|
|
@@ -5052,7 +4850,6 @@ export {
|
|
|
5052
4850
|
prepareMobileUserOp,
|
|
5053
4851
|
relayUserOp,
|
|
5054
4852
|
requestPaymaster,
|
|
5055
|
-
serializeEntryToJsonRpc
|
|
5056
|
-
serializeUserOpTypedData
|
|
4853
|
+
serializeEntryToJsonRpc
|
|
5057
4854
|
};
|
|
5058
4855
|
//# sourceMappingURL=index.js.map
|