@pafi-dev/core 0.5.11 → 0.5.12
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 +23 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -633,6 +633,55 @@ declare function computeUserOpHash(userOp: {
|
|
|
633
633
|
paymasterData?: Hex;
|
|
634
634
|
}, chainId: number): Hex;
|
|
635
635
|
|
|
636
|
+
/**
|
|
637
|
+
* EIP-7702 delegate impls supported by the PAFI mobile prepare/submit
|
|
638
|
+
* flow. Each impl exposes `execute((address,uint256,bytes)[])` (same
|
|
639
|
+
* selector `0x34fcd5be...`) so callData encoding is identical, but
|
|
640
|
+
* each may use a slightly different dummy-signature pattern that
|
|
641
|
+
* Pimlico's `pm_sponsorUserOperation` simulation accepts.
|
|
642
|
+
*/
|
|
643
|
+
type DelegateImpl = "simple7702" | "batchExecutor" | "unknown";
|
|
644
|
+
/**
|
|
645
|
+
* Pimlico's `Simple7702Account` implementation address on Base mainnet.
|
|
646
|
+
* Used by `permissionless.to7702SimpleSmartAccount`.
|
|
647
|
+
*/
|
|
648
|
+
declare const SIMPLE_7702_IMPL_BASE_MAINNET: Address;
|
|
649
|
+
/**
|
|
650
|
+
* Coinbase Smart Wallet v2 BatchExecutor — original PAFI delegation
|
|
651
|
+
* target. Same on Base mainnet + Base Sepolia.
|
|
652
|
+
*/
|
|
653
|
+
declare const BATCH_EXECUTOR_7702_IMPL: Address;
|
|
654
|
+
/**
|
|
655
|
+
* Standard ERC-4337 v0.7 ECDSA dummy signature — 65 bytes that
|
|
656
|
+
* are well-formed (so signature recovery doesn't crash) but
|
|
657
|
+
* obviously invalid (so they can't accidentally authorize a real
|
|
658
|
+
* tx). Both Simple7702 and BatchExecutor accept this pattern as
|
|
659
|
+
* the "estimating" signature during paymaster simulation.
|
|
660
|
+
*
|
|
661
|
+
* Source: viem-account-abstraction's default; matches what
|
|
662
|
+
* `permissionless.toSimpleSmartAccount` and `to7702SimpleSmartAccount`
|
|
663
|
+
* use for `getStubSignature()`.
|
|
664
|
+
*/
|
|
665
|
+
declare const DUMMY_SIGNATURE_V07: Hex;
|
|
666
|
+
/**
|
|
667
|
+
* Map an EIP-7702 delegate target address to its `DelegateImpl` kind.
|
|
668
|
+
* Returns `'unknown'` when the address isn't a recognised PAFI-supported
|
|
669
|
+
* impl — caller should reject or fall back to a default behaviour.
|
|
670
|
+
*/
|
|
671
|
+
declare function detectDelegateImpl(delegate: Address | null | undefined): DelegateImpl;
|
|
672
|
+
/**
|
|
673
|
+
* Return a dummy signature appropriate for a given delegate impl. Used
|
|
674
|
+
* by sponsor-relayer's `pm_sponsorUserOperation` forwarding so Pimlico
|
|
675
|
+
* can simulate validateUserOp without the user's actual signature
|
|
676
|
+
* (which is supplied later via `personal_sign(userOpHash)`).
|
|
677
|
+
*
|
|
678
|
+
* Currently both Simple7702 and BatchExecutor use the same v0.7 ECDSA
|
|
679
|
+
* dummy. Kept impl-keyed so future impls (Safe, Kernel, Biconomy) can
|
|
680
|
+
* supply their own pattern (e.g. ERC-1271 stubs) without forcing a
|
|
681
|
+
* sponsor-relayer redeploy.
|
|
682
|
+
*/
|
|
683
|
+
declare function getDummySignatureFor7702(impl: DelegateImpl): Hex;
|
|
684
|
+
|
|
636
685
|
/**
|
|
637
686
|
* Module-level paymaster config shared by all batch builders and the
|
|
638
687
|
* `@pafi/issuer` RelayService. Holds the fee recipient address and the
|
|
@@ -1438,4 +1487,4 @@ declare class PafiSDK {
|
|
|
1438
1487
|
signLoginMessage(message: string): Promise<Hex>;
|
|
1439
1488
|
}
|
|
1440
1489
|
|
|
1441
|
-
export { ApiError, BATCH_EXECUTOR_ABI, BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, BROKER_HASHES, BestQuote, type BuildDelegationUserOpParams, type BuildPartialUserOpParams, type BuildPerpDepositViaRelayParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, EIP712Signature, ENTRY_POINT_V07, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, Operation, type OrderlyRelayDepositRequest, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_POOLS, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSDKError, type PafiWebModalAdapter, type PafiWebModalHandle, PartialUserOperation, type PaymasterConfig, PointTokenDomainConfig, PoolKey, QuoteResult, ReceiverConsent, SUPPORTED_CHAINS, type SendWithPaymasterFallbackParams, type SignatureStruct, SignatureVerification, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, SwapSimulationResult, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, UserOperation, V4_QUOTER_ADDRESSES, type VaultDepositFE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, createPafiProxyTransport, decodeBatchExecuteCalls, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getPafiWebModalAdapter, getPaymasterConfig, isDelegatedTo, isDelegatedToTarget, isPaymasterConfigured, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, rawCallOp, receiverConsentTypes, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, setPaymasterConfig, webPopupAdapter };
|
|
1490
|
+
export { ApiError, BATCH_EXECUTOR_7702_IMPL, BATCH_EXECUTOR_ABI, BATCH_EXECUTOR_ADDRESS_BASE_MAINNET, BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA, BROKER_HASHES, BestQuote, type BuildDelegationUserOpParams, type BuildPartialUserOpParams, type BuildPerpDepositViaRelayParams, type BuildPerpDepositWithGasDeductionParams, COMMON_POOLS, COMMON_TOKENS, CONTRACT_ADDRESSES, ChainConfig, type CheckEthAndBranchParams, ConfigurationError, type ContractAddresses, DUMMY_SIGNATURE_V07, type DelegateImpl, EIP712Signature, ENTRY_POINT_V07, LoginMessageParams, MintRequest, type ModalOpenOptions, ORDERLY_RELAY_ABI, ORDERLY_VAULT_ABI, ORDERLY_VAULT_ADDRESSES, ORDERLY_VAULT_BASE_MAINNET, Operation, type OrderlyRelayDepositRequest, PAFI_SUBGRAPH_URL, PERMIT2_ADDRESS, POINT_TOKEN_FACTORY_ADDRESSES, POINT_TOKEN_IMPL_ADDRESSES, POINT_TOKEN_POOLS, type PafiProxyTransportParams, PafiSDK, PafiSDKConfig, PafiSDKError, type PafiWebModalAdapter, type PafiWebModalHandle, PartialUserOperation, type PaymasterConfig, PointTokenDomainConfig, PoolKey, QuoteResult, ReceiverConsent, SIMPLE_7702_IMPL_BASE_MAINNET, SUPPORTED_CHAINS, type SendWithPaymasterFallbackParams, type SignatureStruct, SignatureVerification, SigningError, SimulationError, type SmartAccountSender, type SponsorshipScenario, type SubmissionPath, SwapSimulationResult, TOKEN_HASHES, UNIVERSAL_ROUTER_ADDRESSES, UserOperation, V4_QUOTER_ADDRESSES, type VaultDepositFE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, burnRequestTypes, checkDelegation, checkEthAndBranch, computeAccountId, computeAuthorizationHash, computeUserOpHash, createPafiProxyTransport, decodeBatchExecuteCalls, detectDelegateImpl, encodeBatchExecute, erc20ApproveOp, erc20BurnOp, erc20TransferOp, fetchPafiPools, getAaNonce, getContractAddresses, getDummySignatureFor7702, getPafiWebModalAdapter, getPaymasterConfig, isDelegatedTo, isDelegatedToTarget, isPaymasterConfigured, isPaymasterError, mintRequestTypes, openPafiWebModal, openWebPopup, parseEip7702DelegatedAddress, rawCallOp, receiverConsentTypes, sendWithPaymasterFallback, serializeUserOpToJsonRpc, setPafiWebModalAdapter, setPaymasterConfig, webPopupAdapter };
|
package/dist/index.js
CHANGED
|
@@ -440,6 +440,23 @@ function pack128(hi, lo) {
|
|
|
440
440
|
return `0x${(hi << 128n | lo).toString(16).padStart(64, "0")}`;
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
+
// src/userop/eip7702Helpers.ts
|
|
444
|
+
import { getAddress } from "viem";
|
|
445
|
+
var SIMPLE_7702_IMPL_BASE_MAINNET = "0xe6Cae83BdE06E4c305530e199D7217f42808555B";
|
|
446
|
+
var BATCH_EXECUTOR_7702_IMPL = "0x7702cb554e6bFb442cb743A7dF23154544a7176C";
|
|
447
|
+
var DUMMY_SIGNATURE_V07 = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
|
|
448
|
+
function detectDelegateImpl(delegate) {
|
|
449
|
+
if (!delegate) return "unknown";
|
|
450
|
+
const addr = getAddress(delegate).toLowerCase();
|
|
451
|
+
if (addr === SIMPLE_7702_IMPL_BASE_MAINNET.toLowerCase()) return "simple7702";
|
|
452
|
+
if (addr === BATCH_EXECUTOR_7702_IMPL.toLowerCase()) return "batchExecutor";
|
|
453
|
+
return "unknown";
|
|
454
|
+
}
|
|
455
|
+
function getDummySignatureFor7702(impl) {
|
|
456
|
+
void impl;
|
|
457
|
+
return DUMMY_SIGNATURE_V07;
|
|
458
|
+
}
|
|
459
|
+
|
|
443
460
|
// src/paymaster/config.ts
|
|
444
461
|
var _config = null;
|
|
445
462
|
function setPaymasterConfig(config) {
|
|
@@ -1077,6 +1094,7 @@ var PafiSDK = class {
|
|
|
1077
1094
|
};
|
|
1078
1095
|
export {
|
|
1079
1096
|
ApiError,
|
|
1097
|
+
BATCH_EXECUTOR_7702_IMPL,
|
|
1080
1098
|
BATCH_EXECUTOR_ABI,
|
|
1081
1099
|
BATCH_EXECUTOR_ADDRESS_BASE_MAINNET,
|
|
1082
1100
|
BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA,
|
|
@@ -1085,6 +1103,7 @@ export {
|
|
|
1085
1103
|
COMMON_TOKENS,
|
|
1086
1104
|
CONTRACT_ADDRESSES,
|
|
1087
1105
|
ConfigurationError,
|
|
1106
|
+
DUMMY_SIGNATURE_V07,
|
|
1088
1107
|
ENTRY_POINT_V07,
|
|
1089
1108
|
ORDERLY_RELAY_ABI,
|
|
1090
1109
|
ORDERLY_VAULT_ABI,
|
|
@@ -1099,6 +1118,7 @@ export {
|
|
|
1099
1118
|
PafiSDK,
|
|
1100
1119
|
PafiSDKError,
|
|
1101
1120
|
SETTLE_ALL,
|
|
1121
|
+
SIMPLE_7702_IMPL_BASE_MAINNET,
|
|
1102
1122
|
SPONSOR_AUTH_DOMAIN_NAME,
|
|
1103
1123
|
SPONSOR_AUTH_TYPES,
|
|
1104
1124
|
SUPPORTED_CHAINS,
|
|
@@ -1142,6 +1162,7 @@ export {
|
|
|
1142
1162
|
createLoginMessage,
|
|
1143
1163
|
createPafiProxyTransport,
|
|
1144
1164
|
decodeBatchExecuteCalls,
|
|
1165
|
+
detectDelegateImpl,
|
|
1145
1166
|
encodeBatchExecute,
|
|
1146
1167
|
erc20Abi,
|
|
1147
1168
|
erc20ApproveOp,
|
|
@@ -1152,6 +1173,7 @@ export {
|
|
|
1152
1173
|
getAaNonce,
|
|
1153
1174
|
getBurnRequestNonce,
|
|
1154
1175
|
getContractAddresses,
|
|
1176
|
+
getDummySignatureFor7702,
|
|
1155
1177
|
getIssuer2 as getIssuer,
|
|
1156
1178
|
getMintRequestNonce,
|
|
1157
1179
|
getPafiWebModalAdapter,
|