@pafi-dev/core 0.23.0 → 0.25.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/auth/index.cjs +2 -2
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-75JWR5SA.cjs → chunk-6DSK5VR2.cjs} +1 -1
- package/dist/{chunk-75JWR5SA.cjs.map → chunk-6DSK5VR2.cjs.map} +1 -1
- package/dist/{chunk-4EGXLYMM.js → chunk-IKLFFJJK.js} +1 -1
- package/dist/{chunk-4EGXLYMM.js.map → chunk-IKLFFJJK.js.map} +1 -1
- package/dist/index.cjs +168 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +129 -212
- package/dist/index.d.ts +129 -212
- package/dist/index.js +162 -127
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -25,7 +25,7 @@ var _chunk2DVM77Y2cjs = require('./chunk-2DVM77Y2.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunk6DSK5VR2cjs = require('./chunk-6DSK5VR2.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
@@ -332,36 +332,116 @@ function rawCallOp(target, data, value = 0n) {
|
|
|
332
332
|
return { target, value, data };
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
-
// src/userop/
|
|
335
|
+
// src/userop/kernelExecute.ts
|
|
336
336
|
|
|
337
|
-
|
|
338
|
-
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
var KERNEL_EXECUTE_ABI = _viem.parseAbi.call(void 0, [
|
|
346
|
+
"function execute(bytes32 execMode, bytes executionCalldata)"
|
|
339
347
|
]);
|
|
340
|
-
|
|
348
|
+
var KERNEL_EXECUTE_SELECTOR = "0xe9ae5c53";
|
|
349
|
+
var KERNEL_EXECUTE_USEROP_SELECTOR = "0x8dd7712f";
|
|
350
|
+
var CALLTYPE_SINGLE = "0x00";
|
|
351
|
+
var CALLTYPE_BATCH = "0x01";
|
|
352
|
+
var EXECUTION_BATCH_ABI = [
|
|
353
|
+
{
|
|
354
|
+
name: "executionBatch",
|
|
355
|
+
type: "tuple[]",
|
|
356
|
+
components: [
|
|
357
|
+
{ name: "target", type: "address" },
|
|
358
|
+
{ name: "value", type: "uint256" },
|
|
359
|
+
{ name: "callData", type: "bytes" }
|
|
360
|
+
]
|
|
361
|
+
}
|
|
362
|
+
];
|
|
363
|
+
function execMode(callType) {
|
|
364
|
+
return _viem.pad.call(void 0, callType, { dir: "right", size: 32 });
|
|
365
|
+
}
|
|
366
|
+
function encodeKernelExecute(operations) {
|
|
341
367
|
if (operations.length === 0) {
|
|
342
|
-
throw new Error("
|
|
368
|
+
throw new Error("encodeKernelExecute: operations array must not be empty");
|
|
369
|
+
}
|
|
370
|
+
if (operations.length === 1) {
|
|
371
|
+
const op = operations[0];
|
|
372
|
+
const executionCalldata2 = _viem.concat.call(void 0, [
|
|
373
|
+
op.target,
|
|
374
|
+
_viem.toHex.call(void 0, op.value, { size: 32 }),
|
|
375
|
+
op.data
|
|
376
|
+
]);
|
|
377
|
+
return _viem.encodeFunctionData.call(void 0, {
|
|
378
|
+
abi: KERNEL_EXECUTE_ABI,
|
|
379
|
+
functionName: "execute",
|
|
380
|
+
args: [execMode(CALLTYPE_SINGLE), executionCalldata2]
|
|
381
|
+
});
|
|
343
382
|
}
|
|
383
|
+
const executionCalldata = _viem.encodeAbiParameters.call(void 0, EXECUTION_BATCH_ABI, [
|
|
384
|
+
operations.map((op) => ({
|
|
385
|
+
target: op.target,
|
|
386
|
+
value: op.value,
|
|
387
|
+
callData: op.data
|
|
388
|
+
}))
|
|
389
|
+
]);
|
|
344
390
|
return _viem.encodeFunctionData.call(void 0, {
|
|
345
|
-
abi:
|
|
346
|
-
functionName: "
|
|
347
|
-
args: [
|
|
348
|
-
operations.map((op) => ({
|
|
349
|
-
target: op.target,
|
|
350
|
-
value: op.value,
|
|
351
|
-
data: op.data
|
|
352
|
-
}))
|
|
353
|
-
]
|
|
391
|
+
abi: KERNEL_EXECUTE_ABI,
|
|
392
|
+
functionName: "execute",
|
|
393
|
+
args: [execMode(CALLTYPE_BATCH), executionCalldata]
|
|
354
394
|
});
|
|
355
395
|
}
|
|
356
|
-
function
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
data
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
396
|
+
function decodeKernelExecute(callData) {
|
|
397
|
+
let data = callData.toLowerCase();
|
|
398
|
+
if (data.startsWith(KERNEL_EXECUTE_USEROP_SELECTOR)) {
|
|
399
|
+
data = "0x" + data.slice(KERNEL_EXECUTE_USEROP_SELECTOR.length);
|
|
400
|
+
}
|
|
401
|
+
if (!data.startsWith(KERNEL_EXECUTE_SELECTOR)) return null;
|
|
402
|
+
let mode;
|
|
403
|
+
let executionCalldata;
|
|
404
|
+
try {
|
|
405
|
+
[mode, executionCalldata] = _viem.decodeAbiParameters.call(void 0,
|
|
406
|
+
[{ type: "bytes32" }, { type: "bytes" }],
|
|
407
|
+
"0x" + data.slice(10)
|
|
408
|
+
);
|
|
409
|
+
} catch (e2) {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
const callType = mode.slice(2, 4);
|
|
413
|
+
const execType = mode.slice(4, 6);
|
|
414
|
+
if (execType !== "00") return null;
|
|
415
|
+
if (callType === "00") {
|
|
416
|
+
const body = executionCalldata.slice(2);
|
|
417
|
+
if (body.length < (20 + 32) * 2) return null;
|
|
418
|
+
return [
|
|
419
|
+
{
|
|
420
|
+
target: "0x" + body.slice(0, 40),
|
|
421
|
+
value: BigInt("0x" + body.slice(40, 40 + 64)),
|
|
422
|
+
data: "0x" + body.slice(40 + 64)
|
|
423
|
+
}
|
|
424
|
+
];
|
|
425
|
+
}
|
|
426
|
+
if (callType === "01") {
|
|
427
|
+
try {
|
|
428
|
+
const [rows] = _viem.decodeAbiParameters.call(void 0, EXECUTION_BATCH_ABI, executionCalldata);
|
|
429
|
+
return rows.map((r) => ({ target: r.target, value: r.value, data: r.callData }));
|
|
430
|
+
} catch (e3) {
|
|
431
|
+
return null;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
function decodeKernelExecuteCalls(callData) {
|
|
437
|
+
const ops = decodeKernelExecute(callData);
|
|
438
|
+
if (!ops) {
|
|
439
|
+
throw new Error("decodeKernelExecuteCalls: callData is not a Kernel execute");
|
|
440
|
+
}
|
|
441
|
+
return ops.map((op) => ({
|
|
442
|
+
to: op.target,
|
|
443
|
+
data: op.data,
|
|
444
|
+
value: op.value.toString()
|
|
365
445
|
}));
|
|
366
446
|
}
|
|
367
447
|
|
|
@@ -373,7 +453,7 @@ function buildPartialUserOperation(params) {
|
|
|
373
453
|
return {
|
|
374
454
|
sender: params.sender,
|
|
375
455
|
nonce: params.nonce,
|
|
376
|
-
callData:
|
|
456
|
+
callData: encodeKernelExecute(params.operations),
|
|
377
457
|
callGasLimit: _nullishCoalesce(_optionalChain([params, 'access', _3 => _3.gasLimits, 'optionalAccess', _4 => _4.callGasLimit]), () => ( DEFAULT_CALL_GAS_LIMIT)),
|
|
378
458
|
verificationGasLimit: _nullishCoalesce(_optionalChain([params, 'access', _5 => _5.gasLimits, 'optionalAccess', _6 => _6.verificationGasLimit]), () => ( DEFAULT_VERIFICATION_GAS_LIMIT)),
|
|
379
459
|
preVerificationGas: _nullishCoalesce(_optionalChain([params, 'access', _7 => _7.gasLimits, 'optionalAccess', _8 => _8.preVerificationGas]), () => ( DEFAULT_PRE_VERIFICATION_GAS)),
|
|
@@ -603,75 +683,41 @@ function serializeUserOpToJsonRpc(userOp, signature) {
|
|
|
603
683
|
}
|
|
604
684
|
|
|
605
685
|
// src/userop/computeUserOpHash.ts
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
{ name: "preVerificationGas", type: "uint256" },
|
|
620
|
-
{ name: "gasFees", type: "bytes32" },
|
|
621
|
-
{ name: "paymasterAndData", type: "bytes" }
|
|
622
|
-
]
|
|
623
|
-
};
|
|
624
|
-
function buildUserOpTypedData(userOp, chainId) {
|
|
625
|
-
const accountGasLimits = pack128(
|
|
626
|
-
userOp.verificationGasLimit,
|
|
627
|
-
userOp.callGasLimit
|
|
628
|
-
);
|
|
629
|
-
const gasFees = pack128(userOp.maxPriorityFeePerGas, userOp.maxFeePerGas);
|
|
630
|
-
const paymasterAndData = userOp.paymaster ? _viem.concat.call(void 0, [
|
|
631
|
-
userOp.paymaster,
|
|
632
|
-
_viem.pad.call(void 0, _viem.toHex.call(void 0, _nullishCoalesce(userOp.paymasterVerificationGasLimit, () => ( 0n))), { size: 16 }),
|
|
633
|
-
_viem.pad.call(void 0, _viem.toHex.call(void 0, _nullishCoalesce(userOp.paymasterPostOpGasLimit, () => ( 0n))), { size: 16 }),
|
|
634
|
-
_nullishCoalesce(userOp.paymasterData, () => ( "0x"))
|
|
635
|
-
]) : "0x";
|
|
636
|
-
return {
|
|
637
|
-
domain: {
|
|
638
|
-
name: "ERC4337",
|
|
639
|
-
version: "1",
|
|
640
|
-
chainId,
|
|
641
|
-
verifyingContract: _chunk3ZT7KTN4cjs.ENTRY_POINT_V08
|
|
642
|
-
},
|
|
643
|
-
types: PACKED_USER_OPERATION_TYPES,
|
|
644
|
-
primaryType: "PackedUserOperation",
|
|
645
|
-
message: {
|
|
686
|
+
var _accountabstraction = require('viem/account-abstraction');
|
|
687
|
+
function computeUserOpHash(userOp, chainId) {
|
|
688
|
+
const paymasterFields = userOp.paymaster ? {
|
|
689
|
+
paymaster: userOp.paymaster,
|
|
690
|
+
paymasterVerificationGasLimit: _nullishCoalesce(userOp.paymasterVerificationGasLimit, () => ( 0n)),
|
|
691
|
+
paymasterPostOpGasLimit: _nullishCoalesce(userOp.paymasterPostOpGasLimit, () => ( 0n)),
|
|
692
|
+
paymasterData: _nullishCoalesce(userOp.paymasterData, () => ( "0x"))
|
|
693
|
+
} : {};
|
|
694
|
+
return _accountabstraction.getUserOperationHash.call(void 0, {
|
|
695
|
+
chainId,
|
|
696
|
+
entryPointAddress: _chunk3ZT7KTN4cjs.ENTRY_POINT_V07,
|
|
697
|
+
entryPointVersion: "0.7",
|
|
698
|
+
userOperation: {
|
|
646
699
|
sender: userOp.sender,
|
|
647
700
|
nonce: userOp.nonce,
|
|
648
|
-
initCode: "0x",
|
|
649
701
|
callData: userOp.callData,
|
|
650
|
-
|
|
702
|
+
callGasLimit: userOp.callGasLimit,
|
|
703
|
+
verificationGasLimit: userOp.verificationGasLimit,
|
|
651
704
|
preVerificationGas: userOp.preVerificationGas,
|
|
652
|
-
|
|
653
|
-
|
|
705
|
+
maxFeePerGas: userOp.maxFeePerGas,
|
|
706
|
+
maxPriorityFeePerGas: userOp.maxPriorityFeePerGas,
|
|
707
|
+
signature: "0x",
|
|
708
|
+
...paymasterFields
|
|
654
709
|
}
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
function computeUserOpHash(userOp, chainId) {
|
|
658
|
-
const td = buildUserOpTypedData(userOp, chainId);
|
|
659
|
-
return _viem.hashTypedData.call(void 0, td);
|
|
660
|
-
}
|
|
661
|
-
function pack128(hi, lo) {
|
|
662
|
-
return `0x${(hi << 128n | lo).toString(16).padStart(64, "0")}`;
|
|
710
|
+
});
|
|
663
711
|
}
|
|
664
712
|
|
|
665
713
|
// src/userop/eip7702Helpers.ts
|
|
666
714
|
|
|
667
|
-
var
|
|
668
|
-
var BATCH_EXECUTOR_7702_IMPL = "0x7702cb554e6bFb442cb743A7dF23154544a7176C";
|
|
715
|
+
var KERNEL_V3_3_IMPL = "0xd6CEDDe84be40893d153Be9d467CD6aD37875b28";
|
|
669
716
|
var DUMMY_SIGNATURE_V07 = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
|
|
670
717
|
function detectDelegateImpl(delegate) {
|
|
671
718
|
if (!delegate) return "unknown";
|
|
672
719
|
const addr = _viem.getAddress.call(void 0, delegate).toLowerCase();
|
|
673
|
-
if (addr ===
|
|
674
|
-
if (addr === BATCH_EXECUTOR_7702_IMPL.toLowerCase()) return "batchExecutor";
|
|
720
|
+
if (addr === KERNEL_V3_3_IMPL.toLowerCase()) return "kernel";
|
|
675
721
|
return "unknown";
|
|
676
722
|
}
|
|
677
723
|
function getDummySignatureFor7702(impl) {
|
|
@@ -774,29 +820,7 @@ async function isDelegatedTo(client, address, target) {
|
|
|
774
820
|
return impl.toLowerCase() === target.toLowerCase();
|
|
775
821
|
}
|
|
776
822
|
|
|
777
|
-
// src/delegation/
|
|
778
|
-
function buildDelegationUserOp(params) {
|
|
779
|
-
return buildPartialUserOperation({
|
|
780
|
-
sender: params.userAddress,
|
|
781
|
-
nonce: params.aaNonce,
|
|
782
|
-
operations: [
|
|
783
|
-
{
|
|
784
|
-
// Self-call with no data — triggers EIP-7702 delegation without
|
|
785
|
-
// executing any inner logic. The BatchExecutor.execute([]) call with
|
|
786
|
-
// an empty array would revert, so we target the EOA itself (which
|
|
787
|
-
// forwards to BatchExecutor that then no-ops on empty input).
|
|
788
|
-
target: params.userAddress,
|
|
789
|
-
value: 0n,
|
|
790
|
-
data: "0x"
|
|
791
|
-
}
|
|
792
|
-
],
|
|
793
|
-
gasLimits: {
|
|
794
|
-
callGasLimit: _nullishCoalesce(_optionalChain([params, 'access', _31 => _31.gasLimits, 'optionalAccess', _32 => _32.callGasLimit]), () => ( 50000n)),
|
|
795
|
-
verificationGasLimit: _nullishCoalesce(_optionalChain([params, 'access', _33 => _33.gasLimits, 'optionalAccess', _34 => _34.verificationGasLimit]), () => ( 150000n)),
|
|
796
|
-
preVerificationGas: _nullishCoalesce(_optionalChain([params, 'access', _35 => _35.gasLimits, 'optionalAccess', _36 => _36.preVerificationGas]), () => ( 50000n))
|
|
797
|
-
}
|
|
798
|
-
});
|
|
799
|
-
}
|
|
823
|
+
// src/delegation/aaNonce.ts
|
|
800
824
|
async function getAaNonce(client, userAddress) {
|
|
801
825
|
const NONCE_ABI = [
|
|
802
826
|
{
|
|
@@ -811,7 +835,7 @@ async function getAaNonce(client, userAddress) {
|
|
|
811
835
|
}
|
|
812
836
|
];
|
|
813
837
|
return client.readContract({
|
|
814
|
-
address: _chunk3ZT7KTN4cjs.
|
|
838
|
+
address: _chunk3ZT7KTN4cjs.ENTRY_POINT_V07,
|
|
815
839
|
abi: NONCE_ABI,
|
|
816
840
|
functionName: "getNonce",
|
|
817
841
|
args: [userAddress, 0n]
|
|
@@ -883,8 +907,11 @@ var CONTRACT_ADDRESSES = {
|
|
|
883
907
|
// were rotated as part of the dual-bucket schema change.
|
|
884
908
|
// ──────────────────────────────────────────────────────────────────
|
|
885
909
|
8453: {
|
|
886
|
-
// ── Periphery
|
|
887
|
-
|
|
910
|
+
// ── Periphery ─────────────────────────────────────────────────
|
|
911
|
+
// ZeroDev Kernel v3.3 impl — EIP-7702 delegation target (replaces
|
|
912
|
+
// the retired Pimlico Simple7702Account 0xe6Cae83…8555B).
|
|
913
|
+
// CREATE2-deterministic → identical address on every chain.
|
|
914
|
+
kernel: "0xd6CEDDe84be40893d153Be9d467CD6aD37875b28",
|
|
888
915
|
chainlinkEthUsd: "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70",
|
|
889
916
|
orderlyRelay: "0xDA082DAce1522c185aeB5A713FcA6fa6B6E99e7f",
|
|
890
917
|
pafiFeeRecipient: "0xa3F71eadEd101513a0151007590020dCFD7C495e",
|
|
@@ -930,7 +957,8 @@ var CONTRACT_ADDRESSES = {
|
|
|
930
957
|
// Base Sepolia — not in active use; placeholders kept so the map
|
|
931
958
|
// compiles for tooling that enumerates chains.
|
|
932
959
|
84532: {
|
|
933
|
-
|
|
960
|
+
// Kernel v3.3 impl is CREATE2-deterministic — same address as mainnet.
|
|
961
|
+
kernel: "0xd6CEDDe84be40893d153Be9d467CD6aD37875b28",
|
|
934
962
|
usdt: PLACEHOLDER_DEAD("dead"),
|
|
935
963
|
issuerRegistry: PLACEHOLDER_DEAD("dead"),
|
|
936
964
|
mintingOracle: PLACEHOLDER_DEAD("dead"),
|
|
@@ -978,7 +1006,7 @@ function getContractAddresses(chainId) {
|
|
|
978
1006
|
|
|
979
1007
|
// src/delegation/delegateDirect.ts
|
|
980
1008
|
async function delegateDirect(params) {
|
|
981
|
-
const target = _nullishCoalesce(params.contractAddress, () => ( getContractAddresses(params.chainId).
|
|
1009
|
+
const target = _nullishCoalesce(params.contractAddress, () => ( getContractAddresses(params.chainId).kernel));
|
|
982
1010
|
if (params.skipIfAlreadyDelegated !== false) {
|
|
983
1011
|
const code = await params.publicClient.getCode({
|
|
984
1012
|
address: params.userAddress
|
|
@@ -1041,7 +1069,7 @@ async function delegateDirect(params) {
|
|
|
1041
1069
|
hash: txHash
|
|
1042
1070
|
});
|
|
1043
1071
|
} catch (err) {
|
|
1044
|
-
_optionalChain([params, 'access',
|
|
1072
|
+
_optionalChain([params, 'access', _31 => _31.onWarning, 'optionalCall', _32 => _32(
|
|
1045
1073
|
`delegateDirect: tx ${txHash} sent but receipt fetch failed: ${err instanceof Error ? err.message : String(err)}`
|
|
1046
1074
|
)]);
|
|
1047
1075
|
}
|
|
@@ -1109,7 +1137,7 @@ function createPafiProxyTransport(params) {
|
|
|
1109
1137
|
// fetchFn intercepts every fetch call the viem http transport makes,
|
|
1110
1138
|
// injecting the auth headers before the request leaves the browser.
|
|
1111
1139
|
fetchFn: (input, init) => {
|
|
1112
|
-
const headers = new Headers(_optionalChain([init, 'optionalAccess',
|
|
1140
|
+
const headers = new Headers(_optionalChain([init, 'optionalAccess', _33 => _33.headers]));
|
|
1113
1141
|
const token = getIdentityToken();
|
|
1114
1142
|
if (token) {
|
|
1115
1143
|
headers.set("authorization", `Bearer ${token}`);
|
|
@@ -1133,7 +1161,7 @@ var PAYMASTER_PATTERNS = [
|
|
|
1133
1161
|
function isPaymasterError(err) {
|
|
1134
1162
|
if (err == null || typeof err !== "object") return false;
|
|
1135
1163
|
const e = err;
|
|
1136
|
-
const status = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(e.status, () => ( e.statusCode)), () => ( _optionalChain([e, 'access',
|
|
1164
|
+
const status = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(e.status, () => ( e.statusCode)), () => ( _optionalChain([e, 'access', _34 => _34.response, 'optionalAccess', _35 => _35.status]))), () => ( _optionalChain([e, 'access', _36 => _36.cause, 'optionalAccess', _37 => _37.status])));
|
|
1137
1165
|
if (typeof status === "number" && PAYMASTER_HTTP_STATUSES.has(status)) {
|
|
1138
1166
|
return true;
|
|
1139
1167
|
}
|
|
@@ -1146,8 +1174,8 @@ async function sendWithPaymasterFallback(params) {
|
|
|
1146
1174
|
return await primaryClient.sendTransaction(txParams);
|
|
1147
1175
|
} catch (err) {
|
|
1148
1176
|
if (isPaymasterError(err) && fallbackClient) {
|
|
1149
|
-
const msg = _nullishCoalesce(_optionalChain([err, 'optionalAccess',
|
|
1150
|
-
_optionalChain([onFallback, 'optionalCall',
|
|
1177
|
+
const msg = _nullishCoalesce(_optionalChain([err, 'optionalAccess', _38 => _38.message]), () => ( String(err)));
|
|
1178
|
+
_optionalChain([onFallback, 'optionalCall', _39 => _39(msg)]);
|
|
1151
1179
|
return await fallbackClient.sendTransaction(_nullishCoalesce(txParamsFallback, () => ( txParams)));
|
|
1152
1180
|
}
|
|
1153
1181
|
throw err;
|
|
@@ -1212,7 +1240,7 @@ async function fetchPafiPools(_chainId, pointTokenAddress, subgraphUrl = PAFI_SU
|
|
|
1212
1240
|
);
|
|
1213
1241
|
return [];
|
|
1214
1242
|
}
|
|
1215
|
-
const pool = _optionalChain([json, 'access',
|
|
1243
|
+
const pool = _optionalChain([json, 'access', _40 => _40.data, 'optionalAccess', _41 => _41.pafiToken, 'optionalAccess', _42 => _42.pool]);
|
|
1216
1244
|
if (!pool) return [];
|
|
1217
1245
|
if (!_viem.isAddress.call(void 0, pool.token0.id) || !_viem.isAddress.call(void 0, pool.token1.id) || !Number.isFinite(Number(pool.feeTier))) {
|
|
1218
1246
|
console.error("[fetchPafiPools] invalid pool data in subgraph response \u2014 skipping");
|
|
@@ -1399,10 +1427,10 @@ async function getPtPerUsdt18dec(fetchImpl, subgraphUrl, pointTokenAddress, fall
|
|
|
1399
1427
|
});
|
|
1400
1428
|
if (!response.ok) throw new Error(`subgraph HTTP ${response.status}`);
|
|
1401
1429
|
const json = await response.json();
|
|
1402
|
-
if (_optionalChain([json, 'access',
|
|
1430
|
+
if (_optionalChain([json, 'access', _43 => _43.errors, 'optionalAccess', _44 => _44.length])) {
|
|
1403
1431
|
throw new Error(json.errors.map((e) => e.message).join("; "));
|
|
1404
1432
|
}
|
|
1405
|
-
const pool = _optionalChain([json, 'access',
|
|
1433
|
+
const pool = _optionalChain([json, 'access', _45 => _45.data, 'optionalAccess', _46 => _46.pafiToken, 'optionalAccess', _47 => _47.pool]);
|
|
1406
1434
|
if (!pool) throw new Error("pafiToken or pool not found");
|
|
1407
1435
|
const isPtToken0 = pool.token0.id.toLowerCase() === pointTokenAddress.toLowerCase();
|
|
1408
1436
|
let ptPerUsdtHumanStr;
|
|
@@ -1505,9 +1533,9 @@ var POINT_TOKEN_ABI = _viem.parseAbi.call(void 0, [
|
|
|
1505
1533
|
"event MintingOracleUpdated(address indexed mintingOracle)"
|
|
1506
1534
|
]);
|
|
1507
1535
|
|
|
1508
|
-
// src/contracts/real/
|
|
1509
|
-
var
|
|
1510
|
-
var
|
|
1536
|
+
// src/contracts/real/kernel.ts
|
|
1537
|
+
var KERNEL_ADDRESS_BASE_MAINNET = getContractAddresses(8453).kernel;
|
|
1538
|
+
var KERNEL_ADDRESS_BASE_SEPOLIA = getContractAddresses(84532).kernel;
|
|
1511
1539
|
|
|
1512
1540
|
// src/contracts/real/pafi-services.ts
|
|
1513
1541
|
var PAFI_SERVICE_URLS = {
|
|
@@ -1522,14 +1550,21 @@ var PAFI_SERVICE_URLS = {
|
|
|
1522
1550
|
issuerApi: "https://api-dev.pacificfinance.org/api/issuer"
|
|
1523
1551
|
}
|
|
1524
1552
|
};
|
|
1525
|
-
function getPafiServiceUrls(chainId) {
|
|
1526
|
-
const
|
|
1527
|
-
if (!
|
|
1553
|
+
function getPafiServiceUrls(chainId, overrides) {
|
|
1554
|
+
const defaults = PAFI_SERVICE_URLS[chainId];
|
|
1555
|
+
if (!defaults) {
|
|
1528
1556
|
throw new Error(
|
|
1529
|
-
`getPafiServiceUrls: no PAFI service URLs for chainId ${chainId}. Supported: ${Object.keys(PAFI_SERVICE_URLS).join(", ")}
|
|
1557
|
+
`getPafiServiceUrls: no PAFI service URLs for chainId ${chainId}. Supported: ${Object.keys(PAFI_SERVICE_URLS).join(", ")}. Provide explicit overrides for unsupported chains.`
|
|
1530
1558
|
);
|
|
1531
1559
|
}
|
|
1532
|
-
|
|
1560
|
+
const cleanOverrides = {};
|
|
1561
|
+
if (_optionalChain([overrides, 'optionalAccess', _48 => _48.sponsorRelayer])) {
|
|
1562
|
+
cleanOverrides.sponsorRelayer = overrides.sponsorRelayer;
|
|
1563
|
+
}
|
|
1564
|
+
if (_optionalChain([overrides, 'optionalAccess', _49 => _49.issuerApi])) {
|
|
1565
|
+
cleanOverrides.issuerApi = overrides.issuerApi;
|
|
1566
|
+
}
|
|
1567
|
+
return { ...defaults, ...cleanOverrides };
|
|
1533
1568
|
}
|
|
1534
1569
|
|
|
1535
1570
|
// src/web-handoff/webPopup.ts
|
|
@@ -1545,8 +1580,8 @@ function openWebPopup(url, options = {}) {
|
|
|
1545
1580
|
const width = _nullishCoalesce(options.width, () => ( DEFAULT_WIDTH));
|
|
1546
1581
|
const height = _nullishCoalesce(options.height, () => ( DEFAULT_HEIGHT));
|
|
1547
1582
|
const name = _nullishCoalesce(options.windowName, () => ( DEFAULT_NAME));
|
|
1548
|
-
const screenW = _nullishCoalesce(_optionalChain([window, 'access',
|
|
1549
|
-
const screenH = _nullishCoalesce(_optionalChain([window, 'access',
|
|
1583
|
+
const screenW = _nullishCoalesce(_optionalChain([window, 'access', _50 => _50.screen, 'optionalAccess', _51 => _51.availWidth]), () => ( window.innerWidth));
|
|
1584
|
+
const screenH = _nullishCoalesce(_optionalChain([window, 'access', _52 => _52.screen, 'optionalAccess', _53 => _53.availHeight]), () => ( window.innerHeight));
|
|
1550
1585
|
const left = Math.max(0, Math.floor((screenW - width) / 2));
|
|
1551
1586
|
const top = Math.max(0, Math.floor((screenH - height) / 2));
|
|
1552
1587
|
const features = [
|
|
@@ -1579,7 +1614,7 @@ function openWebPopup(url, options = {}) {
|
|
|
1579
1614
|
window.removeEventListener("message", messageListener);
|
|
1580
1615
|
messageListener = null;
|
|
1581
1616
|
}
|
|
1582
|
-
_optionalChain([options, 'access',
|
|
1617
|
+
_optionalChain([options, 'access', _54 => _54.onClose, 'optionalCall', _55 => _55()]);
|
|
1583
1618
|
};
|
|
1584
1619
|
pollId = setInterval(() => {
|
|
1585
1620
|
if (popup.closed) {
|
|
@@ -1609,7 +1644,7 @@ function openWebPopup(url, options = {}) {
|
|
|
1609
1644
|
if (closed) return;
|
|
1610
1645
|
try {
|
|
1611
1646
|
popup.close();
|
|
1612
|
-
} catch (
|
|
1647
|
+
} catch (e4) {
|
|
1613
1648
|
}
|
|
1614
1649
|
dispose();
|
|
1615
1650
|
},
|
|
@@ -1617,14 +1652,14 @@ function openWebPopup(url, options = {}) {
|
|
|
1617
1652
|
if (closed || popup.closed) return;
|
|
1618
1653
|
try {
|
|
1619
1654
|
popup.focus();
|
|
1620
|
-
} catch (
|
|
1655
|
+
} catch (e5) {
|
|
1621
1656
|
}
|
|
1622
1657
|
},
|
|
1623
1658
|
postMessage(data) {
|
|
1624
1659
|
if (closed || popup.closed) return;
|
|
1625
1660
|
try {
|
|
1626
1661
|
popup.postMessage(data, "*");
|
|
1627
|
-
} catch (
|
|
1662
|
+
} catch (e6) {
|
|
1628
1663
|
}
|
|
1629
1664
|
}
|
|
1630
1665
|
};
|
|
@@ -1783,7 +1818,7 @@ var PafiSDK = class {
|
|
|
1783
1818
|
if (!account) {
|
|
1784
1819
|
throw new ConfigurationError("signer has no account attached");
|
|
1785
1820
|
}
|
|
1786
|
-
return
|
|
1821
|
+
return _chunk6DSK5VR2cjs.createLoginMessage.call(void 0, { ...params, address: account.address, chainId });
|
|
1787
1822
|
}
|
|
1788
1823
|
/** Sign a login message string with the current signer (personal_sign) */
|
|
1789
1824
|
async signLoginMessage(message) {
|
|
@@ -1944,5 +1979,5 @@ var PafiSDK = class {
|
|
|
1944
1979
|
|
|
1945
1980
|
|
|
1946
1981
|
|
|
1947
|
-
exports.ApiError = ApiError; exports.
|
|
1982
|
+
exports.ApiError = ApiError; exports.BROKER_HASHES = BROKER_HASHES; exports.COMMON_POOLS = _chunk3ZT7KTN4cjs.COMMON_POOLS; exports.COMMON_TOKENS = _chunk3ZT7KTN4cjs.COMMON_TOKENS; exports.CONTRACT_ADDRESSES = CONTRACT_ADDRESSES; exports.ConfigurationError = ConfigurationError; exports.DUMMY_SIGNATURE_V07 = DUMMY_SIGNATURE_V07; exports.ENTRY_POINT_V07 = _chunk3ZT7KTN4cjs.ENTRY_POINT_V07; exports.ENTRY_POINT_V08 = _chunk3ZT7KTN4cjs.ENTRY_POINT_V08; exports.Eip712DomainMismatchError = _chunk3ZT7KTN4cjs.Eip712DomainMismatchError; exports.KERNEL_ADDRESS_BASE_MAINNET = KERNEL_ADDRESS_BASE_MAINNET; exports.KERNEL_ADDRESS_BASE_SEPOLIA = KERNEL_ADDRESS_BASE_SEPOLIA; exports.KERNEL_EXECUTE_ABI = KERNEL_EXECUTE_ABI; exports.KERNEL_EXECUTE_SELECTOR = KERNEL_EXECUTE_SELECTOR; exports.KERNEL_EXECUTE_USEROP_SELECTOR = KERNEL_EXECUTE_USEROP_SELECTOR; exports.KERNEL_V3_3_IMPL = KERNEL_V3_3_IMPL; exports.ORDERLY_RELAY_ABI = ORDERLY_RELAY_ABI; exports.ORDERLY_VAULT_ABI = ORDERLY_VAULT_ABI; exports.ORDERLY_VAULT_ADDRESSES = ORDERLY_VAULT_ADDRESSES; exports.ORDERLY_VAULT_BASE_MAINNET = ORDERLY_VAULT_BASE_MAINNET; exports.OracleStaleError = OracleStaleError; exports.PAFI_SERVICE_URLS = PAFI_SERVICE_URLS; exports.PAFI_SUBGRAPH_URL = PAFI_SUBGRAPH_URL; exports.PERMIT2_ADDRESS = _chunk3ZT7KTN4cjs.PERMIT2_ADDRESS; exports.POINT_TOKEN_ABI = POINT_TOKEN_ABI; exports.POINT_TOKEN_BEACON_ADDRESSES = POINT_TOKEN_BEACON_ADDRESSES; exports.POINT_TOKEN_BURN_SIG_ABI = POINT_TOKEN_BURN_SIG_ABI; exports.POINT_TOKEN_FACTORY_ADDRESSES = POINT_TOKEN_FACTORY_ADDRESSES; exports.POINT_TOKEN_IMPL_ADDRESSES = POINT_TOKEN_IMPL_ADDRESSES; exports.POINT_TOKEN_MINT_SIG_ABI = POINT_TOKEN_MINT_SIG_ABI; exports.POINT_TOKEN_POOLS = _chunk3ZT7KTN4cjs.POINT_TOKEN_POOLS; exports.PafiSDK = PafiSDK; exports.PafiSdkError = PafiSdkError; exports.QUOTER_V2_ADDRESSES = _chunk3ZT7KTN4cjs.QUOTER_V2_ADDRESSES; exports.SCENARIO_GAS_UNITS = SCENARIO_GAS_UNITS; exports.SDK_ERROR_HTTP_STATUS_CODE = SDK_ERROR_HTTP_STATUS_CODE; exports.SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET = _chunk6DSK5VR2cjs.SPONSOR_AUTH_DOMAIN_ANCHOR_BASE_MAINNET; exports.SPONSOR_AUTH_DOMAIN_NAME = _chunk6DSK5VR2cjs.SPONSOR_AUTH_DOMAIN_NAME; exports.SPONSOR_AUTH_TYPES = _chunk6DSK5VR2cjs.SPONSOR_AUTH_TYPES; exports.SUPPORTED_CHAINS = _chunk3ZT7KTN4cjs.SUPPORTED_CHAINS; exports.SigningError = SigningError; exports.SimulationError = SimulationError; exports.Source = _chunkDQKCPH6Bcjs.Source; exports.TOKEN_HASHES = TOKEN_HASHES; exports.UNIVERSAL_ROUTER_ADDRESSES = _chunk3ZT7KTN4cjs.UNIVERSAL_ROUTER_ADDRESSES; exports.V3_FACTORY_ADDRESSES = _chunk3ZT7KTN4cjs.V3_FACTORY_ADDRESSES; exports.V3_POOL_INIT_CODE_HASH = _chunk3ZT7KTN4cjs.V3_POOL_INIT_CODE_HASH; exports.V3_SWAP_ROUTER_ADDRESSES = _chunk3ZT7KTN4cjs.V3_SWAP_ROUTER_ADDRESSES; exports.VAULT_BEACON_ADDRESSES = VAULT_BEACON_ADDRESSES; exports.ValidationError = ValidationError; exports.ZERO_VALUE = ZERO_VALUE; exports.assembleUserOperation = assembleUserOperation; exports.assertDomainMatchesContract = _chunk3ZT7KTN4cjs.assertDomainMatchesContract; exports.attachDelegationIfNeeded = attachDelegationIfNeeded; exports.buildAndSignSponsorAuth = _chunk6DSK5VR2cjs.buildAndSignSponsorAuth; exports.buildBurnRequestTypedData = _chunk3ZT7KTN4cjs.buildBurnRequestTypedData; exports.buildDomain = _chunk3ZT7KTN4cjs.buildDomain; exports.buildEip7702Authorization = buildEip7702Authorization; exports.buildErc20TransferUserOp = buildErc20TransferUserOp; exports.buildMintRequestTypedData = _chunk3ZT7KTN4cjs.buildMintRequestTypedData; exports.buildPartialUserOperation = buildPartialUserOperation; exports.buildPerpDepositViaRelay = buildPerpDepositViaRelay; exports.buildPerpDepositWithGasDeduction = buildPerpDepositWithGasDeduction; exports.buildSponsorAuthDomain = _chunk6DSK5VR2cjs.buildSponsorAuthDomain; exports.buildSponsorAuthTypedData = _chunk6DSK5VR2cjs.buildSponsorAuthTypedData; exports.burnRequestTypes = _chunk3ZT7KTN4cjs.burnRequestTypes; exports.checkDelegation = checkDelegation; exports.checkEthAndBranch = checkEthAndBranch; exports.computeAccountId = computeAccountId; exports.computeAuthorizationHash = computeAuthorizationHash; exports.computeCallDataHash = _chunk6DSK5VR2cjs.computeCallDataHash; exports.computeEquityCap = _chunkDQKCPH6Bcjs.computeEquityCap; exports.computeUserOpHash = computeUserOpHash; exports.computeV3PoolAddress = computeV3PoolAddress; exports.createLoginMessage = _chunk6DSK5VR2cjs.createLoginMessage; exports.createPafiProxyTransport = createPafiProxyTransport; exports.decodeKernelExecute = decodeKernelExecute; exports.decodeKernelExecuteCalls = decodeKernelExecuteCalls; exports.defaultErrorTypeForStatus = defaultErrorTypeForStatus; exports.delegateDirect = delegateDirect; exports.detectDelegateImpl = detectDelegateImpl; exports.encodeKernelExecute = encodeKernelExecute; exports.encodeV3Path = encodeV3Path; exports.encodeV3PathReversed = encodeV3PathReversed; exports.erc20Abi = _chunk2DVM77Y2cjs.erc20Abi; exports.erc20ApproveOp = erc20ApproveOp; exports.erc20BurnOp = erc20BurnOp; exports.erc20TransferOp = erc20TransferOp; exports.fetchPafiPools = fetchPafiPools; exports.generateSponsorAuthNonce = _chunk6DSK5VR2cjs.generateSponsorAuthNonce; exports.getAaNonce = getAaNonce; exports.getBurnRequestNonce = _chunkDQKCPH6Bcjs.getBurnRequestNonce; exports.getContractAddresses = getContractAddresses; exports.getDummySignatureFor7702 = getDummySignatureFor7702; exports.getIssuer = _chunkDQKCPH6Bcjs.getIssuer2; exports.getMintFeeBps = _chunkDQKCPH6Bcjs.getMintFeeBps; exports.getMintFeeRecipients = _chunkDQKCPH6Bcjs.getMintFeeRecipients; exports.getMintRequestNonce = _chunkDQKCPH6Bcjs.getMintRequestNonce; exports.getOracleRegistries = _chunkDQKCPH6Bcjs.getOracleRegistries; exports.getPafiServiceUrls = getPafiServiceUrls; exports.getPafiWebModalAdapter = getPafiWebModalAdapter; exports.getPointTokenBalance = _chunkDQKCPH6Bcjs.getPointTokenBalance; exports.getPointTokenIssuerAddress = _chunkDQKCPH6Bcjs.getIssuer; exports.getSponsorAuthDomainAnchor = _chunk6DSK5VR2cjs.getSponsorAuthDomainAnchor; exports.getTokenName = _chunkDQKCPH6Bcjs.getTokenName; exports.isActiveIssuer = _chunkDQKCPH6Bcjs.isActiveIssuer; exports.isDelegatedTo = isDelegatedTo; exports.isDelegatedToTarget = isDelegatedToTarget; exports.isMinter = _chunkDQKCPH6Bcjs.isMinter; exports.isPaymasterError = isPaymasterError; exports.issuerRegistryAbi = _chunk2CU7ZH2Acjs.issuerRegistryAbi; exports.issuerRegistryGetIssuerFlatAbi = _chunkDQKCPH6Bcjs.issuerRegistryGetIssuerFlatAbi; exports.mintFeeWrapperAbi = _chunk2CU7ZH2Acjs.mintFeeWrapperAbi; exports.mintRequestTypes = _chunk3ZT7KTN4cjs.mintRequestTypes; exports.mintingOracleAbi = _chunk2CU7ZH2Acjs.mintingOracleAbi; exports.openPafiWebModal = openPafiWebModal; exports.openWebPopup = openWebPopup; exports.parseEip7702DelegatedAddress = parseEip7702DelegatedAddress; exports.parseLoginMessage = _chunk6DSK5VR2cjs.parseLoginMessage; exports.permit2Abi = _chunk2DVM77Y2cjs.permit2Abi; exports.pointModuleCoreAbi = _chunk2DVM77Y2cjs.pointModuleCoreAbi; exports.pointTokenAbi = _chunk245YA3CQcjs.pointTokenAbi; exports.pointTokenFactoryAbi = _chunk2DVM77Y2cjs.pointTokenFactoryAbi; exports.quoteOperatorFeeForTransfer = quoteOperatorFeeForTransfer; exports.quoteOperatorFeePt = quoteOperatorFeePt; exports.quoteOperatorFeeUsdt = quoteOperatorFeeUsdt; exports.rawCallOp = rawCallOp; exports.sendWithPaymasterFallback = sendWithPaymasterFallback; exports.serializeUserOpToJsonRpc = serializeUserOpToJsonRpc; exports.setPafiWebModalAdapter = setPafiWebModalAdapter; exports.settlementVaultAbi = _chunk2DVM77Y2cjs.settlementVaultAbi; exports.signBurnRequest = _chunk3ZT7KTN4cjs.signBurnRequest; exports.signMintRequest = _chunk3ZT7KTN4cjs.signMintRequest; exports.signSponsorAuth = _chunk6DSK5VR2cjs.signSponsorAuth; exports.splitAuthorizationSig = splitAuthorizationSig; exports.tokenRegistryAbi = _chunk2DVM77Y2cjs.tokenRegistryAbi; exports.universalRouterAbi = _chunk2DVM77Y2cjs.universalRouterAbi; exports.v3QuoterV2Abi = _chunk2DVM77Y2cjs.v3QuoterV2Abi; exports.vaultFactoryAbi = _chunk2DVM77Y2cjs.vaultFactoryAbi; exports.vaultRegistryAbi = _chunk2DVM77Y2cjs.vaultRegistryAbi; exports.verifyBurnRequest = _chunk3ZT7KTN4cjs.verifyBurnRequest; exports.verifyEquityMint = _chunkDQKCPH6Bcjs.verifyEquityMint; exports.verifyIssuerOperative = _chunkDQKCPH6Bcjs.verifyIssuerOperative; exports.verifyLoginMessage = _chunk6DSK5VR2cjs.verifyLoginMessage; exports.verifyMint = _chunkDQKCPH6Bcjs.verifyMint; exports.verifyMintRequest = _chunk3ZT7KTN4cjs.verifyMintRequest; exports.verifySponsorAuth = _chunk6DSK5VR2cjs.verifySponsorAuth; exports.webPopupAdapter = webPopupAdapter;
|
|
1948
1983
|
//# sourceMappingURL=index.cjs.map
|