@pafi-dev/core 0.5.14 → 0.5.16
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 +39 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -10
- package/dist/index.d.ts +65 -10
- package/dist/index.js +41 -43
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, Hex, PublicClient, HttpTransport, WalletClient } from 'viem';
|
|
1
|
+
import { Address, Hex, TypedDataDomain, PublicClient, HttpTransport, WalletClient } from 'viem';
|
|
2
2
|
import { P as PoolKey, C as ChainConfig, a as PafiSDKConfig, b as PointTokenDomainConfig, M as MintRequest, R as ReceiverConsent, E as EIP712Signature, S as SignatureVerification, B as BestQuote, Q as QuoteResult } from './types-JyuXUM8C.cjs';
|
|
3
3
|
export { c as BurnRequest, I as Issuer, d as PathKey } from './types-JyuXUM8C.cjs';
|
|
4
4
|
export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.cjs';
|
|
@@ -624,17 +624,67 @@ declare function assembleUserOperation(partial: PartialUserOperation, paymaster:
|
|
|
624
624
|
paymasterPostOpGasLimit: bigint;
|
|
625
625
|
}, signature: `0x${string}`): UserOperation;
|
|
626
626
|
|
|
627
|
+
declare const PACKED_USER_OPERATION_TYPES: {
|
|
628
|
+
readonly PackedUserOperation: readonly [{
|
|
629
|
+
readonly name: "sender";
|
|
630
|
+
readonly type: "address";
|
|
631
|
+
}, {
|
|
632
|
+
readonly name: "nonce";
|
|
633
|
+
readonly type: "uint256";
|
|
634
|
+
}, {
|
|
635
|
+
readonly name: "initCode";
|
|
636
|
+
readonly type: "bytes";
|
|
637
|
+
}, {
|
|
638
|
+
readonly name: "callData";
|
|
639
|
+
readonly type: "bytes";
|
|
640
|
+
}, {
|
|
641
|
+
readonly name: "accountGasLimits";
|
|
642
|
+
readonly type: "bytes32";
|
|
643
|
+
}, {
|
|
644
|
+
readonly name: "preVerificationGas";
|
|
645
|
+
readonly type: "uint256";
|
|
646
|
+
}, {
|
|
647
|
+
readonly name: "gasFees";
|
|
648
|
+
readonly type: "bytes32";
|
|
649
|
+
}, {
|
|
650
|
+
readonly name: "paymasterAndData";
|
|
651
|
+
readonly type: "bytes";
|
|
652
|
+
}];
|
|
653
|
+
};
|
|
654
|
+
type PackedUserOperationMessage = {
|
|
655
|
+
sender: Address;
|
|
656
|
+
nonce: bigint;
|
|
657
|
+
initCode: Hex;
|
|
658
|
+
callData: Hex;
|
|
659
|
+
accountGasLimits: Hex;
|
|
660
|
+
preVerificationGas: bigint;
|
|
661
|
+
gasFees: Hex;
|
|
662
|
+
paymasterAndData: Hex;
|
|
663
|
+
};
|
|
664
|
+
type UserOpTypedData = {
|
|
665
|
+
domain: TypedDataDomain;
|
|
666
|
+
types: typeof PACKED_USER_OPERATION_TYPES;
|
|
667
|
+
primaryType: "PackedUserOperation";
|
|
668
|
+
message: PackedUserOperationMessage;
|
|
669
|
+
};
|
|
627
670
|
/**
|
|
628
|
-
* ERC-4337 v0.
|
|
671
|
+
* Build the EIP-712 typed-data payload for an ERC-4337 v0.8 UserOp.
|
|
629
672
|
*
|
|
630
|
-
* The
|
|
631
|
-
*
|
|
632
|
-
*
|
|
673
|
+
* The deployed Pimlico `Simple7702Account` (impl `0xe6Cae8...`) validates
|
|
674
|
+
* the user's signature by calling `SignatureCheckerLib.isValidSignatureNow`
|
|
675
|
+
* with the **raw** userOpHash (no EIP-191 prefix). For an EOA signer this
|
|
676
|
+
* means `ecrecover(userOpHash, sig)` must equal the EOA address.
|
|
633
677
|
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
678
|
+
* Because `userOpHash` is itself the EIP-712 typed digest of the
|
|
679
|
+
* `PackedUserOperation` struct, signing the typed data with
|
|
680
|
+
* `eth_signTypedData_v4` produces a signature whose recover-from-raw-digest
|
|
681
|
+
* == the userOpHash. That matches what the contract expects.
|
|
682
|
+
*
|
|
683
|
+
* Do NOT sign with `personal_sign` / `signMessage({ raw })` — that adds the
|
|
684
|
+
* EIP-191 prefix, which the contract does not undo, so recovery returns a
|
|
685
|
+
* different address and the bundler reverts with `AA24 signature error`.
|
|
636
686
|
*/
|
|
637
|
-
declare function
|
|
687
|
+
declare function buildUserOpTypedData(userOp: {
|
|
638
688
|
sender: Address;
|
|
639
689
|
nonce: bigint;
|
|
640
690
|
callData: Hex;
|
|
@@ -647,7 +697,12 @@ declare function computeUserOpHash(userOp: {
|
|
|
647
697
|
paymasterVerificationGasLimit?: bigint;
|
|
648
698
|
paymasterPostOpGasLimit?: bigint;
|
|
649
699
|
paymasterData?: Hex;
|
|
650
|
-
}, chainId: number):
|
|
700
|
+
}, chainId: number): UserOpTypedData;
|
|
701
|
+
/**
|
|
702
|
+
* EIP-712 typed digest of an ERC-4337 v0.8 UserOp. Equals on-chain
|
|
703
|
+
* `EntryPoint.getUserOpHash(userOp)`.
|
|
704
|
+
*/
|
|
705
|
+
declare function computeUserOpHash(userOp: Parameters<typeof buildUserOpTypedData>[0], chainId: number): Hex;
|
|
651
706
|
|
|
652
707
|
/**
|
|
653
708
|
* EIP-7702 delegate impls supported by the PAFI mobile prepare/submit
|
|
@@ -1503,4 +1558,4 @@ declare class PafiSDK {
|
|
|
1503
1558
|
signLoginMessage(message: string): Promise<Hex>;
|
|
1504
1559
|
}
|
|
1505
1560
|
|
|
1506
|
-
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, ENTRY_POINT_V08, 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 };
|
|
1561
|
+
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, ENTRY_POINT_V08, 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 PackedUserOperationMessage, 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, type UserOpTypedData, UserOperation, V4_QUOTER_ADDRESSES, type VaultDepositFE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, buildUserOpTypedData, 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.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, Hex, PublicClient, HttpTransport, WalletClient } from 'viem';
|
|
1
|
+
import { Address, Hex, TypedDataDomain, PublicClient, HttpTransport, WalletClient } from 'viem';
|
|
2
2
|
import { P as PoolKey, C as ChainConfig, a as PafiSDKConfig, b as PointTokenDomainConfig, M as MintRequest, R as ReceiverConsent, E as EIP712Signature, S as SignatureVerification, B as BestQuote, Q as QuoteResult } from './types-JyuXUM8C.js';
|
|
3
3
|
export { c as BurnRequest, I as Issuer, d as PathKey } from './types-JyuXUM8C.js';
|
|
4
4
|
export { pointTokenAbi as POINT_TOKEN_V2_ABI, erc20Abi, issuerRegistryAbi, mintingOracleAbi, permit2Abi, pointTokenAbi, pointTokenFactoryAbi, universalRouterAbi, v4QuoterAbi } from './abi/index.js';
|
|
@@ -624,17 +624,67 @@ declare function assembleUserOperation(partial: PartialUserOperation, paymaster:
|
|
|
624
624
|
paymasterPostOpGasLimit: bigint;
|
|
625
625
|
}, signature: `0x${string}`): UserOperation;
|
|
626
626
|
|
|
627
|
+
declare const PACKED_USER_OPERATION_TYPES: {
|
|
628
|
+
readonly PackedUserOperation: readonly [{
|
|
629
|
+
readonly name: "sender";
|
|
630
|
+
readonly type: "address";
|
|
631
|
+
}, {
|
|
632
|
+
readonly name: "nonce";
|
|
633
|
+
readonly type: "uint256";
|
|
634
|
+
}, {
|
|
635
|
+
readonly name: "initCode";
|
|
636
|
+
readonly type: "bytes";
|
|
637
|
+
}, {
|
|
638
|
+
readonly name: "callData";
|
|
639
|
+
readonly type: "bytes";
|
|
640
|
+
}, {
|
|
641
|
+
readonly name: "accountGasLimits";
|
|
642
|
+
readonly type: "bytes32";
|
|
643
|
+
}, {
|
|
644
|
+
readonly name: "preVerificationGas";
|
|
645
|
+
readonly type: "uint256";
|
|
646
|
+
}, {
|
|
647
|
+
readonly name: "gasFees";
|
|
648
|
+
readonly type: "bytes32";
|
|
649
|
+
}, {
|
|
650
|
+
readonly name: "paymasterAndData";
|
|
651
|
+
readonly type: "bytes";
|
|
652
|
+
}];
|
|
653
|
+
};
|
|
654
|
+
type PackedUserOperationMessage = {
|
|
655
|
+
sender: Address;
|
|
656
|
+
nonce: bigint;
|
|
657
|
+
initCode: Hex;
|
|
658
|
+
callData: Hex;
|
|
659
|
+
accountGasLimits: Hex;
|
|
660
|
+
preVerificationGas: bigint;
|
|
661
|
+
gasFees: Hex;
|
|
662
|
+
paymasterAndData: Hex;
|
|
663
|
+
};
|
|
664
|
+
type UserOpTypedData = {
|
|
665
|
+
domain: TypedDataDomain;
|
|
666
|
+
types: typeof PACKED_USER_OPERATION_TYPES;
|
|
667
|
+
primaryType: "PackedUserOperation";
|
|
668
|
+
message: PackedUserOperationMessage;
|
|
669
|
+
};
|
|
627
670
|
/**
|
|
628
|
-
* ERC-4337 v0.
|
|
671
|
+
* Build the EIP-712 typed-data payload for an ERC-4337 v0.8 UserOp.
|
|
629
672
|
*
|
|
630
|
-
* The
|
|
631
|
-
*
|
|
632
|
-
*
|
|
673
|
+
* The deployed Pimlico `Simple7702Account` (impl `0xe6Cae8...`) validates
|
|
674
|
+
* the user's signature by calling `SignatureCheckerLib.isValidSignatureNow`
|
|
675
|
+
* with the **raw** userOpHash (no EIP-191 prefix). For an EOA signer this
|
|
676
|
+
* means `ecrecover(userOpHash, sig)` must equal the EOA address.
|
|
633
677
|
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
678
|
+
* Because `userOpHash` is itself the EIP-712 typed digest of the
|
|
679
|
+
* `PackedUserOperation` struct, signing the typed data with
|
|
680
|
+
* `eth_signTypedData_v4` produces a signature whose recover-from-raw-digest
|
|
681
|
+
* == the userOpHash. That matches what the contract expects.
|
|
682
|
+
*
|
|
683
|
+
* Do NOT sign with `personal_sign` / `signMessage({ raw })` — that adds the
|
|
684
|
+
* EIP-191 prefix, which the contract does not undo, so recovery returns a
|
|
685
|
+
* different address and the bundler reverts with `AA24 signature error`.
|
|
636
686
|
*/
|
|
637
|
-
declare function
|
|
687
|
+
declare function buildUserOpTypedData(userOp: {
|
|
638
688
|
sender: Address;
|
|
639
689
|
nonce: bigint;
|
|
640
690
|
callData: Hex;
|
|
@@ -647,7 +697,12 @@ declare function computeUserOpHash(userOp: {
|
|
|
647
697
|
paymasterVerificationGasLimit?: bigint;
|
|
648
698
|
paymasterPostOpGasLimit?: bigint;
|
|
649
699
|
paymasterData?: Hex;
|
|
650
|
-
}, chainId: number):
|
|
700
|
+
}, chainId: number): UserOpTypedData;
|
|
701
|
+
/**
|
|
702
|
+
* EIP-712 typed digest of an ERC-4337 v0.8 UserOp. Equals on-chain
|
|
703
|
+
* `EntryPoint.getUserOpHash(userOp)`.
|
|
704
|
+
*/
|
|
705
|
+
declare function computeUserOpHash(userOp: Parameters<typeof buildUserOpTypedData>[0], chainId: number): Hex;
|
|
651
706
|
|
|
652
707
|
/**
|
|
653
708
|
* EIP-7702 delegate impls supported by the PAFI mobile prepare/submit
|
|
@@ -1503,4 +1558,4 @@ declare class PafiSDK {
|
|
|
1503
1558
|
signLoginMessage(message: string): Promise<Hex>;
|
|
1504
1559
|
}
|
|
1505
1560
|
|
|
1506
|
-
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, ENTRY_POINT_V08, 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 };
|
|
1561
|
+
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, ENTRY_POINT_V08, 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 PackedUserOperationMessage, 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, type UserOpTypedData, UserOperation, V4_QUOTER_ADDRESSES, type VaultDepositFE, _resetPaymasterConfigForTests, assembleUserOperation, buildDelegationUserOp, buildPartialUserOperation, buildPerpDepositViaRelay, buildPerpDepositWithGasDeduction, buildUserOpTypedData, 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
|
@@ -381,12 +381,23 @@ function serializeUserOpToJsonRpc(userOp, signature) {
|
|
|
381
381
|
// src/userop/computeUserOpHash.ts
|
|
382
382
|
import {
|
|
383
383
|
concat,
|
|
384
|
-
|
|
385
|
-
keccak256 as keccak2562,
|
|
384
|
+
hashTypedData,
|
|
386
385
|
pad,
|
|
387
386
|
toHex
|
|
388
387
|
} from "viem";
|
|
389
|
-
|
|
388
|
+
var PACKED_USER_OPERATION_TYPES = {
|
|
389
|
+
PackedUserOperation: [
|
|
390
|
+
{ name: "sender", type: "address" },
|
|
391
|
+
{ name: "nonce", type: "uint256" },
|
|
392
|
+
{ name: "initCode", type: "bytes" },
|
|
393
|
+
{ name: "callData", type: "bytes" },
|
|
394
|
+
{ name: "accountGasLimits", type: "bytes32" },
|
|
395
|
+
{ name: "preVerificationGas", type: "uint256" },
|
|
396
|
+
{ name: "gasFees", type: "bytes32" },
|
|
397
|
+
{ name: "paymasterAndData", type: "bytes" }
|
|
398
|
+
]
|
|
399
|
+
};
|
|
400
|
+
function buildUserOpTypedData(userOp, chainId) {
|
|
390
401
|
const accountGasLimits = pack128(
|
|
391
402
|
userOp.verificationGasLimit,
|
|
392
403
|
userOp.callGasLimit
|
|
@@ -398,44 +409,30 @@ function computeUserOpHash(userOp, chainId) {
|
|
|
398
409
|
pad(toHex(userOp.paymasterPostOpGasLimit ?? 0n), { size: 16 }),
|
|
399
410
|
userOp.paymasterData ?? "0x"
|
|
400
411
|
]) : "0x";
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
keccak2562(userOp.callData),
|
|
426
|
-
accountGasLimits,
|
|
427
|
-
userOp.preVerificationGas,
|
|
428
|
-
gasFees,
|
|
429
|
-
keccak2562(paymasterAndData)
|
|
430
|
-
]
|
|
431
|
-
)
|
|
432
|
-
);
|
|
433
|
-
return keccak2562(
|
|
434
|
-
encodeAbiParameters2(
|
|
435
|
-
[{ type: "bytes32" }, { type: "address" }, { type: "uint256" }],
|
|
436
|
-
[packed, ENTRY_POINT_V08, BigInt(chainId)]
|
|
437
|
-
)
|
|
438
|
-
);
|
|
412
|
+
return {
|
|
413
|
+
domain: {
|
|
414
|
+
name: "ERC4337",
|
|
415
|
+
version: "1",
|
|
416
|
+
chainId,
|
|
417
|
+
verifyingContract: ENTRY_POINT_V08
|
|
418
|
+
},
|
|
419
|
+
types: PACKED_USER_OPERATION_TYPES,
|
|
420
|
+
primaryType: "PackedUserOperation",
|
|
421
|
+
message: {
|
|
422
|
+
sender: userOp.sender,
|
|
423
|
+
nonce: userOp.nonce,
|
|
424
|
+
initCode: "0x",
|
|
425
|
+
callData: userOp.callData,
|
|
426
|
+
accountGasLimits,
|
|
427
|
+
preVerificationGas: userOp.preVerificationGas,
|
|
428
|
+
gasFees,
|
|
429
|
+
paymasterAndData
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function computeUserOpHash(userOp, chainId) {
|
|
434
|
+
const td = buildUserOpTypedData(userOp, chainId);
|
|
435
|
+
return hashTypedData(td);
|
|
439
436
|
}
|
|
440
437
|
function pack128(hi, lo) {
|
|
441
438
|
return `0x${(hi << 128n | lo).toString(16).padStart(64, "0")}`;
|
|
@@ -568,14 +565,14 @@ async function getAaNonce(client, userAddress) {
|
|
|
568
565
|
}
|
|
569
566
|
|
|
570
567
|
// src/delegation/computeAuthorizationHash.ts
|
|
571
|
-
import { concat as concat2, keccak256 as
|
|
568
|
+
import { concat as concat2, keccak256 as keccak2562, toRlp } from "viem";
|
|
572
569
|
function computeAuthorizationHash(chainId, address, nonce) {
|
|
573
570
|
const rlpEncoded = toRlp([
|
|
574
571
|
toMinimalHex(BigInt(chainId)),
|
|
575
572
|
address,
|
|
576
573
|
toMinimalHex(nonce)
|
|
577
574
|
]);
|
|
578
|
-
return
|
|
575
|
+
return keccak2562(concat2(["0x05", rlpEncoded]));
|
|
579
576
|
}
|
|
580
577
|
function isDelegatedToTarget(code, target) {
|
|
581
578
|
if (!code || code === "0x") return false;
|
|
@@ -1151,6 +1148,7 @@ export {
|
|
|
1151
1148
|
buildSwapFromQuote,
|
|
1152
1149
|
buildSwapWithGasDeduction,
|
|
1153
1150
|
buildUniversalRouterExecuteArgs,
|
|
1151
|
+
buildUserOpTypedData,
|
|
1154
1152
|
buildV4SwapInput,
|
|
1155
1153
|
burnRequestTypes,
|
|
1156
1154
|
checkAllowance,
|