permissionless 0.0.35 → 0.1.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/CHANGELOG.md +14 -0
- package/_cjs/accounts/biconomy/privateKeyToBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js +32 -15
- package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js +38 -20
- package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/safe/privateKeyToSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/safe/signerToSafeSmartAccount.js +42 -11
- package/_cjs/accounts/safe/signerToSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/simple/privateKeyToSimpleSmartAccount.js.map +1 -1
- package/_cjs/accounts/simple/signerToSimpleSmartAccount.js +104 -44
- package/_cjs/accounts/simple/signerToSimpleSmartAccount.js.map +1 -1
- package/_cjs/accounts/types.js.map +1 -1
- package/_cjs/actions/bundler/chainId.js.map +1 -1
- package/_cjs/actions/bundler/estimateUserOperationGas.js +20 -3
- package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_cjs/actions/bundler/getUserOperationByHash.js +28 -11
- package/_cjs/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/_cjs/actions/bundler/getUserOperationReceipt.js.map +1 -1
- package/_cjs/actions/bundler/sendUserOperation.js.map +1 -1
- package/_cjs/actions/bundler/supportedEntryPoints.js.map +1 -1
- package/_cjs/actions/pimlico/getUserOperationGasPrice.js +7 -7
- package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
- package/_cjs/actions/pimlico/sponsorUserOperation.js +19 -7
- package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_cjs/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
- package/_cjs/actions/public/getAccountNonce.js.map +1 -1
- package/_cjs/actions/public/getSenderAddress.js +5 -2
- package/_cjs/actions/public/getSenderAddress.js.map +1 -1
- package/_cjs/actions/smartAccount/deployContract.js +3 -4
- package/_cjs/actions/smartAccount/deployContract.js.map +1 -1
- package/_cjs/actions/smartAccount/prepareUserOperationRequest.js +142 -19
- package/_cjs/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
- package/_cjs/actions/smartAccount/sendTransaction.js +3 -4
- package/_cjs/actions/smartAccount/sendTransaction.js.map +1 -1
- package/_cjs/actions/smartAccount/sendTransactions.js +3 -4
- package/_cjs/actions/smartAccount/sendTransactions.js.map +1 -1
- package/_cjs/actions/smartAccount/sendUserOperation.js +1 -1
- package/_cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/_cjs/actions/smartAccount/signMessage.js.map +1 -1
- package/_cjs/actions/smartAccount/signTypedData.js.map +1 -1
- package/_cjs/actions/smartAccount/writeContract.js.map +1 -1
- package/_cjs/actions/stackup/accounts.js +2 -2
- package/_cjs/actions/stackup/accounts.js.map +1 -1
- package/_cjs/actions/stackup/sponsorUserOperation.js +20 -12
- package/_cjs/actions/stackup/sponsorUserOperation.js.map +1 -1
- package/_cjs/clients/createBundlerClient.js +1 -1
- package/_cjs/clients/createBundlerClient.js.map +1 -1
- package/_cjs/clients/createSmartAccountClient.js +3 -3
- package/_cjs/clients/createSmartAccountClient.js.map +1 -1
- package/_cjs/clients/decorators/bundler.js +6 -3
- package/_cjs/clients/decorators/bundler.js.map +1 -1
- package/_cjs/clients/decorators/pimlico.js +6 -3
- package/_cjs/clients/decorators/pimlico.js.map +1 -1
- package/_cjs/clients/decorators/smartAccount.js +7 -7
- package/_cjs/clients/decorators/smartAccount.js.map +1 -1
- package/_cjs/clients/decorators/stackup.js.map +1 -1
- package/_cjs/clients/pimlico.js +4 -2
- package/_cjs/clients/pimlico.js.map +1 -1
- package/_cjs/clients/stackup.js +3 -1
- package/_cjs/clients/stackup.js.map +1 -1
- package/_cjs/errors/estimateUserOperationGas.js.map +1 -1
- package/_cjs/errors/sendUserOperation.js.map +1 -1
- package/_cjs/types/entrypoint.js +3 -0
- package/_cjs/types/entrypoint.js.map +1 -0
- package/_cjs/utils/errors/getBundlerError.js.map +1 -1
- package/_cjs/utils/errors/getEstimateUserOperationGasError.js.map +1 -1
- package/_cjs/utils/errors/getSendUserOperationError.js.map +1 -1
- package/_cjs/utils/getEntryPointVersion.js +8 -0
- package/_cjs/utils/getEntryPointVersion.js.map +1 -0
- package/_cjs/utils/getRequiredPrefund.js +19 -6
- package/_cjs/utils/getRequiredPrefund.js.map +1 -1
- package/_cjs/utils/getUserOperationHash.js +81 -17
- package/_cjs/utils/getUserOperationHash.js.map +1 -1
- package/_cjs/utils/index.js +5 -1
- package/_cjs/utils/index.js.map +1 -1
- package/_cjs/utils/providerToSmartAccountSigner.js +1 -1
- package/_cjs/utils/providerToSmartAccountSigner.js.map +1 -1
- package/_cjs/utils/signUserOperationHashWithECDSA.js +2 -2
- package/_cjs/utils/signUserOperationHashWithECDSA.js.map +1 -1
- package/_esm/accounts/biconomy/privateKeyToBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js +32 -15
- package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js +38 -21
- package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/safe/privateKeyToSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/safe/signerToSafeSmartAccount.js +42 -11
- package/_esm/accounts/safe/signerToSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/simple/privateKeyToSimpleSmartAccount.js.map +1 -1
- package/_esm/accounts/simple/signerToSimpleSmartAccount.js +105 -44
- package/_esm/accounts/simple/signerToSimpleSmartAccount.js.map +1 -1
- package/_esm/accounts/types.js +0 -1
- package/_esm/accounts/types.js.map +1 -1
- package/_esm/actions/bundler/chainId.js.map +1 -1
- package/_esm/actions/bundler/estimateUserOperationGas.js +20 -3
- package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_esm/actions/bundler/getUserOperationByHash.js +28 -11
- package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/_esm/actions/bundler/getUserOperationReceipt.js.map +1 -1
- package/_esm/actions/bundler/sendUserOperation.js.map +1 -1
- package/_esm/actions/bundler/supportedEntryPoints.js.map +1 -1
- package/_esm/actions/pimlico/getUserOperationGasPrice.js +7 -7
- package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
- package/_esm/actions/pimlico/sponsorUserOperation.js +19 -7
- package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_esm/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
- package/_esm/actions/public/getAccountNonce.js.map +1 -1
- package/_esm/actions/public/getSenderAddress.js +6 -3
- package/_esm/actions/public/getSenderAddress.js.map +1 -1
- package/_esm/actions/smartAccount/deployContract.js +3 -4
- package/_esm/actions/smartAccount/deployContract.js.map +1 -1
- package/_esm/actions/smartAccount/prepareUserOperationRequest.js +142 -19
- package/_esm/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
- package/_esm/actions/smartAccount/sendTransaction.js +3 -4
- package/_esm/actions/smartAccount/sendTransaction.js.map +1 -1
- package/_esm/actions/smartAccount/sendTransactions.js +3 -4
- package/_esm/actions/smartAccount/sendTransactions.js.map +1 -1
- package/_esm/actions/smartAccount/sendUserOperation.js +1 -1
- package/_esm/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/_esm/actions/smartAccount/signMessage.js.map +1 -1
- package/_esm/actions/smartAccount/signTypedData.js.map +1 -1
- package/_esm/actions/smartAccount/writeContract.js.map +1 -1
- package/_esm/actions/stackup/accounts.js +2 -2
- package/_esm/actions/stackup/accounts.js.map +1 -1
- package/_esm/actions/stackup/sponsorUserOperation.js +20 -12
- package/_esm/actions/stackup/sponsorUserOperation.js.map +1 -1
- package/_esm/clients/createBundlerClient.js +1 -1
- package/_esm/clients/createBundlerClient.js.map +1 -1
- package/_esm/clients/createSmartAccountClient.js +22 -3
- package/_esm/clients/createSmartAccountClient.js.map +1 -1
- package/_esm/clients/decorators/bundler.js +6 -3
- package/_esm/clients/decorators/bundler.js.map +1 -1
- package/_esm/clients/decorators/pimlico.js +6 -3
- package/_esm/clients/decorators/pimlico.js.map +1 -1
- package/_esm/clients/decorators/smartAccount.js +7 -7
- package/_esm/clients/decorators/smartAccount.js.map +1 -1
- package/_esm/clients/decorators/stackup.js.map +1 -1
- package/_esm/clients/pimlico.js +4 -2
- package/_esm/clients/pimlico.js.map +1 -1
- package/_esm/clients/stackup.js +3 -1
- package/_esm/clients/stackup.js.map +1 -1
- package/_esm/errors/estimateUserOperationGas.js.map +1 -1
- package/_esm/errors/sendUserOperation.js.map +1 -1
- package/_esm/types/entrypoint.js +2 -0
- package/_esm/types/entrypoint.js.map +1 -0
- package/_esm/utils/errors/getBundlerError.js.map +1 -1
- package/_esm/utils/errors/getEstimateUserOperationGasError.js.map +1 -1
- package/_esm/utils/errors/getSendUserOperationError.js.map +1 -1
- package/_esm/utils/getEntryPointVersion.js +4 -0
- package/_esm/utils/getEntryPointVersion.js.map +1 -0
- package/_esm/utils/getRequiredPrefund.js +19 -6
- package/_esm/utils/getRequiredPrefund.js.map +1 -1
- package/_esm/utils/getUserOperationHash.js +82 -18
- package/_esm/utils/getUserOperationHash.js.map +1 -1
- package/_esm/utils/index.js +2 -1
- package/_esm/utils/index.js.map +1 -1
- package/_esm/utils/providerToSmartAccountSigner.js +1 -1
- package/_esm/utils/providerToSmartAccountSigner.js.map +1 -1
- package/_esm/utils/signUserOperationHashWithECDSA.js +2 -3
- package/_esm/utils/signUserOperationHashWithECDSA.js.map +1 -1
- package/_types/accounts/biconomy/privateKeyToBiconomySmartAccount.d.ts +4 -4
- package/_types/accounts/biconomy/privateKeyToBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/biconomy/signerToBiconomySmartAccount.d.ts +5 -4
- package/_types/accounts/biconomy/signerToBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts +5 -4
- package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/safe/privateKeyToSafeSmartAccount.d.ts +4 -4
- package/_types/accounts/safe/privateKeyToSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/safe/signerToSafeSmartAccount.d.ts +6 -5
- package/_types/accounts/safe/signerToSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/simple/privateKeyToSimpleSmartAccount.d.ts +4 -4
- package/_types/accounts/simple/privateKeyToSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/simple/signerToSimpleSmartAccount.d.ts +5 -4
- package/_types/accounts/simple/signerToSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/types.d.ts +8 -5
- package/_types/accounts/types.d.ts.map +1 -1
- package/_types/actions/bundler/chainId.d.ts +2 -1
- package/_types/actions/bundler/chainId.d.ts.map +1 -1
- package/_types/actions/bundler/estimateUserOperationGas.d.ts +14 -7
- package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
- package/_types/actions/bundler/getUserOperationByHash.d.ts +10 -3
- package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
- package/_types/actions/bundler/getUserOperationReceipt.d.ts +2 -1
- package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
- package/_types/actions/bundler/sendUserOperation.d.ts +6 -5
- package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/bundler/supportedEntryPoints.d.ts +3 -2
- package/_types/actions/bundler/supportedEntryPoints.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts +47 -6
- package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
- package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts +10 -5
- package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts.map +1 -1
- package/_types/actions/public/getAccountNonce.d.ts +2 -1
- package/_types/actions/public/getAccountNonce.d.ts.map +1 -1
- package/_types/actions/public/getSenderAddress.d.ts +11 -3
- package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
- package/_types/actions/smartAccount/deployContract.d.ts +4 -3
- package/_types/actions/smartAccount/deployContract.d.ts.map +1 -1
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts +21 -11
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts.map +1 -1
- package/_types/actions/smartAccount/sendTransaction.d.ts +4 -3
- package/_types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
- package/_types/actions/smartAccount/sendTransactions.d.ts +5 -4
- package/_types/actions/smartAccount/sendTransactions.d.ts.map +1 -1
- package/_types/actions/smartAccount/sendUserOperation.d.ts +6 -5
- package/_types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/smartAccount/signMessage.d.ts +2 -1
- package/_types/actions/smartAccount/signMessage.d.ts.map +1 -1
- package/_types/actions/smartAccount/signTypedData.d.ts +3 -2
- package/_types/actions/smartAccount/signTypedData.d.ts.map +1 -1
- package/_types/actions/smartAccount/writeContract.d.ts +4 -3
- package/_types/actions/smartAccount/writeContract.d.ts.map +1 -1
- package/_types/actions/smartAccount.d.ts +2 -2
- package/_types/actions/smartAccount.d.ts.map +1 -1
- package/_types/actions/stackup/accounts.d.ts +4 -3
- package/_types/actions/stackup/accounts.d.ts.map +1 -1
- package/_types/actions/stackup/sponsorUserOperation.d.ts +6 -6
- package/_types/actions/stackup/sponsorUserOperation.d.ts.map +1 -1
- package/_types/clients/createBundlerClient.d.ts +6 -3
- package/_types/clients/createBundlerClient.d.ts.map +1 -1
- package/_types/clients/createSmartAccountClient.d.ts +9 -5
- package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
- package/_types/clients/decorators/bundler.d.ts +7 -7
- package/_types/clients/decorators/bundler.d.ts.map +1 -1
- package/_types/clients/decorators/pimlico.d.ts +6 -5
- package/_types/clients/decorators/pimlico.d.ts.map +1 -1
- package/_types/clients/decorators/smartAccount.d.ts +12 -12
- package/_types/clients/decorators/smartAccount.d.ts.map +1 -1
- package/_types/clients/decorators/stackup.d.ts +5 -4
- package/_types/clients/decorators/stackup.d.ts.map +1 -1
- package/_types/clients/pimlico.d.ts +11 -6
- package/_types/clients/pimlico.d.ts.map +1 -1
- package/_types/clients/stackup.d.ts +6 -3
- package/_types/clients/stackup.d.ts.map +1 -1
- package/_types/errors/estimateUserOperationGas.d.ts +4 -3
- package/_types/errors/estimateUserOperationGas.d.ts.map +1 -1
- package/_types/errors/sendUserOperation.d.ts +4 -3
- package/_types/errors/sendUserOperation.d.ts.map +1 -1
- package/_types/types/bundler.d.ts +16 -21
- package/_types/types/bundler.d.ts.map +1 -1
- package/_types/types/entrypoint.d.ts +6 -0
- package/_types/types/entrypoint.d.ts.map +1 -0
- package/_types/types/index.d.ts +6 -4
- package/_types/types/index.d.ts.map +1 -1
- package/_types/types/pimlico.d.ts +20 -6
- package/_types/types/pimlico.d.ts.map +1 -1
- package/_types/types/stackup.d.ts +18 -4
- package/_types/types/stackup.d.ts.map +1 -1
- package/_types/types/userOperation.d.ts +51 -2
- package/_types/types/userOperation.d.ts.map +1 -1
- package/_types/utils/errors/getBundlerError.d.ts +4 -4
- package/_types/utils/errors/getBundlerError.d.ts.map +1 -1
- package/_types/utils/errors/getEstimateUserOperationGasError.d.ts +3 -2
- package/_types/utils/errors/getEstimateUserOperationGasError.d.ts.map +1 -1
- package/_types/utils/errors/getSendUserOperationError.d.ts +2 -1
- package/_types/utils/errors/getSendUserOperationError.d.ts.map +1 -1
- package/_types/utils/getEntryPointVersion.d.ts +6 -0
- package/_types/utils/getEntryPointVersion.d.ts.map +1 -0
- package/_types/utils/getRequiredPrefund.d.ts +5 -4
- package/_types/utils/getRequiredPrefund.d.ts.map +1 -1
- package/_types/utils/getUserOperationHash.d.ts +6 -5
- package/_types/utils/getUserOperationHash.d.ts.map +1 -1
- package/_types/utils/index.d.ts +2 -1
- package/_types/utils/index.d.ts.map +1 -1
- package/_types/utils/providerToSmartAccountSigner.d.ts +4 -1
- package/_types/utils/providerToSmartAccountSigner.d.ts.map +1 -1
- package/_types/utils/signUserOperationHashWithECDSA.d.ts +6 -6
- package/_types/utils/signUserOperationHashWithECDSA.d.ts.map +1 -1
- package/accounts/biconomy/privateKeyToBiconomySmartAccount.ts +17 -6
- package/accounts/biconomy/signerToBiconomySmartAccount.ts +50 -21
- package/accounts/kernel/signerToEcdsaKernelSmartAccount.ts +64 -30
- package/accounts/safe/privateKeyToSafeSmartAccount.ts +8 -5
- package/accounts/safe/signerToSafeSmartAccount.ts +57 -17
- package/accounts/simple/privateKeyToSimpleSmartAccount.ts +25 -7
- package/accounts/simple/signerToSimpleSmartAccount.ts +127 -56
- package/accounts/types.ts +12 -4
- package/actions/bundler/chainId.ts +3 -1
- package/actions/bundler/estimateUserOperationGas.ts +77 -22
- package/actions/bundler/getUserOperationByHash.ts +44 -15
- package/actions/bundler/getUserOperationReceipt.ts +3 -1
- package/actions/bundler/sendUserOperation.ts +13 -17
- package/actions/bundler/supportedEntryPoints.ts +5 -3
- package/actions/pimlico/getUserOperationGasPrice.ts +7 -9
- package/actions/pimlico/sponsorUserOperation.ts +97 -23
- package/actions/pimlico/validateSponsorshipPolicies.ts +18 -7
- package/actions/public/getAccountNonce.ts +2 -1
- package/actions/public/getSenderAddress.ts +30 -5
- package/actions/smartAccount/deployContract.ts +14 -10
- package/actions/smartAccount/prepareUserOperationRequest.ts +339 -49
- package/actions/smartAccount/sendTransaction.ts +20 -11
- package/actions/smartAccount/sendTransactions.ts +17 -11
- package/actions/smartAccount/sendUserOperation.ts +56 -23
- package/actions/smartAccount/signMessage.ts +3 -1
- package/actions/smartAccount/signTypedData.ts +3 -1
- package/actions/smartAccount/writeContract.ts +12 -5
- package/actions/smartAccount.ts +2 -2
- package/actions/stackup/accounts.ts +7 -6
- package/actions/stackup/sponsorUserOperation.ts +85 -31
- package/clients/createBundlerClient.ts +11 -6
- package/clients/createSmartAccountClient.ts +34 -20
- package/clients/decorators/bundler.ts +51 -27
- package/clients/decorators/pimlico.ts +43 -17
- package/clients/decorators/smartAccount.ts +115 -37
- package/clients/decorators/stackup.ts +14 -10
- package/clients/pimlico.ts +22 -13
- package/clients/stackup.ts +13 -7
- package/errors/estimateUserOperationGas.ts +7 -4
- package/errors/sendUserOperation.ts +9 -5
- package/package.json +1 -1
- package/types/bundler.ts +40 -28
- package/types/entrypoint.ts +13 -0
- package/types/index.ts +15 -5
- package/types/pimlico.ts +43 -17
- package/types/stackup.ts +39 -15
- package/types/userOperation.ts +82 -26
- package/utils/errors/getBundlerError.ts +10 -6
- package/utils/errors/getEstimateUserOperationGasError.ts +13 -10
- package/utils/errors/getSendUserOperationError.ts +4 -3
- package/utils/getEntryPointVersion.ts +15 -0
- package/utils/getRequiredPrefund.ts +35 -11
- package/utils/getUserOperationHash.ts +113 -23
- package/utils/index.ts +9 -1
- package/utils/providerToSmartAccountSigner.ts +6 -3
- package/utils/signUserOperationHashWithECDSA.ts +13 -7
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { BaseError } from "viem"
|
|
2
2
|
import type { EstimateUserOperationGasParameters } from "../actions/bundler/estimateUserOperationGas"
|
|
3
|
+
import type { EntryPoint } from "../types/entrypoint"
|
|
3
4
|
import { prettyPrint } from "./utils"
|
|
4
5
|
|
|
5
|
-
export type EstimateUserOperationGasErrorType =
|
|
6
|
-
EstimateUserOperationGasError & {
|
|
6
|
+
export type EstimateUserOperationGasErrorType<entryPoint extends EntryPoint> =
|
|
7
|
+
EstimateUserOperationGasError<entryPoint> & {
|
|
7
8
|
name: "EstimateUserOperationGasError"
|
|
8
9
|
}
|
|
9
|
-
export class EstimateUserOperationGasError
|
|
10
|
+
export class EstimateUserOperationGasError<
|
|
11
|
+
entryPoint extends EntryPoint
|
|
12
|
+
> extends BaseError {
|
|
10
13
|
override cause: BaseError
|
|
11
14
|
|
|
12
15
|
override name = "EstimateUserOperationGasError"
|
|
@@ -17,7 +20,7 @@ export class EstimateUserOperationGasError extends BaseError {
|
|
|
17
20
|
userOperation,
|
|
18
21
|
entryPoint,
|
|
19
22
|
docsPath
|
|
20
|
-
}: EstimateUserOperationGasParameters & {
|
|
23
|
+
}: EstimateUserOperationGasParameters<entryPoint> & {
|
|
21
24
|
docsPath?: string
|
|
22
25
|
}
|
|
23
26
|
) {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { BaseError } from "viem"
|
|
2
2
|
import { type SendUserOperationParameters } from "../actions/bundler/sendUserOperation"
|
|
3
|
+
import type { EntryPoint } from "../types/entrypoint"
|
|
3
4
|
import { prettyPrint } from "./utils"
|
|
4
5
|
|
|
5
|
-
export type SendUserOperationErrorType
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export type SendUserOperationErrorType<entryPoint extends EntryPoint> =
|
|
7
|
+
SendUserOperationError<entryPoint> & {
|
|
8
|
+
name: "SendUserOperationError"
|
|
9
|
+
}
|
|
10
|
+
export class SendUserOperationError<
|
|
11
|
+
entryPoint extends EntryPoint
|
|
12
|
+
> extends BaseError {
|
|
9
13
|
override cause: BaseError
|
|
10
14
|
|
|
11
15
|
override name = "SendUserOperationError"
|
|
@@ -16,7 +20,7 @@ export class SendUserOperationError extends BaseError {
|
|
|
16
20
|
userOperation,
|
|
17
21
|
entryPoint,
|
|
18
22
|
docsPath
|
|
19
|
-
}: SendUserOperationParameters & {
|
|
23
|
+
}: SendUserOperationParameters<entryPoint> & {
|
|
20
24
|
docsPath?: string
|
|
21
25
|
}
|
|
22
26
|
) {
|
package/package.json
CHANGED
package/types/bundler.ts
CHANGED
|
@@ -1,43 +1,53 @@
|
|
|
1
1
|
import type { Address, Hash, Hex } from "viem"
|
|
2
2
|
import type { PartialBy } from "viem/types/utils"
|
|
3
|
+
import type { EntryPoint, GetEntryPointVersion } from "./entrypoint"
|
|
3
4
|
import type { UserOperationWithBigIntAsHex } from "./userOperation"
|
|
4
5
|
|
|
5
|
-
export type BundlerRpcSchema = [
|
|
6
|
+
export type BundlerRpcSchema<entryPoint extends EntryPoint> = [
|
|
6
7
|
{
|
|
7
8
|
Method: "eth_sendUserOperation"
|
|
8
9
|
Parameters: [
|
|
9
|
-
userOperation: UserOperationWithBigIntAsHex
|
|
10
|
-
|
|
10
|
+
userOperation: UserOperationWithBigIntAsHex<
|
|
11
|
+
GetEntryPointVersion<entryPoint>
|
|
12
|
+
>,
|
|
13
|
+
entryPoint: entryPoint
|
|
11
14
|
]
|
|
12
15
|
ReturnType: Hash
|
|
13
16
|
},
|
|
14
17
|
{
|
|
15
18
|
Method: "eth_estimateUserOperationGas"
|
|
16
19
|
Parameters: [
|
|
17
|
-
userOperation:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
20
|
+
userOperation: GetEntryPointVersion<entryPoint> extends "v0.6"
|
|
21
|
+
? PartialBy<
|
|
22
|
+
UserOperationWithBigIntAsHex<"v0.6">,
|
|
23
|
+
| "callGasLimit"
|
|
24
|
+
| "preVerificationGas"
|
|
25
|
+
| "verificationGasLimit"
|
|
26
|
+
>
|
|
27
|
+
: PartialBy<
|
|
28
|
+
UserOperationWithBigIntAsHex<"v0.7">,
|
|
29
|
+
| "callGasLimit"
|
|
30
|
+
| "preVerificationGas"
|
|
31
|
+
| "verificationGasLimit"
|
|
32
|
+
| "paymasterVerificationGasLimit"
|
|
33
|
+
| "paymasterPostOpGasLimit"
|
|
34
|
+
>,
|
|
35
|
+
entryPoint: entryPoint,
|
|
36
|
+
stateOverrides?: StateOverrides
|
|
35
37
|
]
|
|
36
|
-
ReturnType:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
ReturnType: GetEntryPointVersion<entryPoint> extends "v0.6"
|
|
39
|
+
? {
|
|
40
|
+
preVerificationGas: Hex
|
|
41
|
+
verificationGasLimit: Hex
|
|
42
|
+
callGasLimit: Hex
|
|
43
|
+
}
|
|
44
|
+
: {
|
|
45
|
+
preVerificationGas: Hex
|
|
46
|
+
verificationGasLimit: Hex
|
|
47
|
+
callGasLimit: Hex | null | undefined
|
|
48
|
+
paymasterVerificationGasLimit: Hex | null | undefined
|
|
49
|
+
paymasterPostOpGasLimit: Hex | null | undefined
|
|
50
|
+
}
|
|
41
51
|
},
|
|
42
52
|
{
|
|
43
53
|
Method: "eth_supportedEntryPoints"
|
|
@@ -53,8 +63,10 @@ export type BundlerRpcSchema = [
|
|
|
53
63
|
Method: "eth_getUserOperationByHash"
|
|
54
64
|
Parameters: [hash: Hash]
|
|
55
65
|
ReturnType: {
|
|
56
|
-
userOperation: UserOperationWithBigIntAsHex
|
|
57
|
-
|
|
66
|
+
userOperation: UserOperationWithBigIntAsHex<
|
|
67
|
+
GetEntryPointVersion<entryPoint>
|
|
68
|
+
>
|
|
69
|
+
entryPoint: entryPoint
|
|
58
70
|
transactionHash: Hash
|
|
59
71
|
blockHash: Hash
|
|
60
72
|
blockNumber: Hex
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type EntryPointVersion = "v0.6" | "v0.7"
|
|
2
|
+
|
|
3
|
+
export type ENTRYPOINT_ADDRESS_V06_TYPE =
|
|
4
|
+
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
|
|
5
|
+
export type ENTRYPOINT_ADDRESS_V07_TYPE =
|
|
6
|
+
"0x0000000071727De22E5E9d8BAf0edAc6f37da032"
|
|
7
|
+
|
|
8
|
+
export type GetEntryPointVersion<entryPoint extends EntryPoint> =
|
|
9
|
+
entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE ? "v0.6" : "v0.7"
|
|
10
|
+
|
|
11
|
+
export type EntryPoint =
|
|
12
|
+
| ENTRYPOINT_ADDRESS_V06_TYPE
|
|
13
|
+
| ENTRYPOINT_ADDRESS_V07_TYPE
|
package/types/index.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { Account, Chain, Client, Transport } from "viem"
|
|
2
|
+
import type { IsUndefined } from "viem/types/utils"
|
|
2
3
|
import type { SmartAccount } from "../accounts/types"
|
|
4
|
+
import type { EntryPoint } from "./entrypoint"
|
|
3
5
|
import type { UserOperation } from "./userOperation"
|
|
4
6
|
export type { UserOperation }
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
export type {
|
|
8
|
+
EntryPointVersion,
|
|
9
|
+
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
10
|
+
ENTRYPOINT_ADDRESS_V07_TYPE,
|
|
11
|
+
GetEntryPointVersion,
|
|
12
|
+
EntryPoint
|
|
13
|
+
} from "./entrypoint"
|
|
7
14
|
|
|
8
15
|
export type GetAccountParameterWithClient<
|
|
9
16
|
TTransport extends Transport = Transport,
|
|
@@ -14,10 +21,13 @@ export type GetAccountParameterWithClient<
|
|
|
14
21
|
: { client: Client<TTransport, TChain, TAccount>; account?: Account }
|
|
15
22
|
|
|
16
23
|
export type GetAccountParameter<
|
|
17
|
-
|
|
24
|
+
entryPoint extends EntryPoint,
|
|
25
|
+
TAccount extends SmartAccount<entryPoint> | undefined =
|
|
26
|
+
| SmartAccount<entryPoint>
|
|
27
|
+
| undefined
|
|
18
28
|
> = IsUndefined<TAccount> extends true
|
|
19
|
-
? { account: SmartAccount }
|
|
20
|
-
: { account?: SmartAccount }
|
|
29
|
+
? { account: SmartAccount<entryPoint> }
|
|
30
|
+
: { account?: SmartAccount<entryPoint> }
|
|
21
31
|
|
|
22
32
|
export type Prettify<T> = {
|
|
23
33
|
[K in keyof T]: T[K]
|
package/types/pimlico.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Address, Hash, Hex } from "viem"
|
|
2
2
|
import type { PartialBy } from "viem/types/utils"
|
|
3
|
+
import type { EntryPoint, GetEntryPointVersion } from "./entrypoint"
|
|
3
4
|
import type { UserOperationWithBigIntAsHex } from "./userOperation"
|
|
4
5
|
|
|
5
6
|
type PimlicoUserOperationGasPriceWithBigIntAsHex = {
|
|
@@ -51,34 +52,59 @@ export type PimlicoBundlerRpcSchema = [
|
|
|
51
52
|
}
|
|
52
53
|
]
|
|
53
54
|
|
|
54
|
-
export type PimlicoPaymasterRpcSchema = [
|
|
55
|
+
export type PimlicoPaymasterRpcSchema<entryPoint extends EntryPoint> = [
|
|
55
56
|
{
|
|
56
57
|
Method: "pm_sponsorUserOperation"
|
|
57
58
|
Parameters: [
|
|
58
|
-
userOperation:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
userOperation: GetEntryPointVersion<entryPoint> extends "v0.6"
|
|
60
|
+
? PartialBy<
|
|
61
|
+
UserOperationWithBigIntAsHex<"v0.6">,
|
|
62
|
+
| "callGasLimit"
|
|
63
|
+
| "preVerificationGas"
|
|
64
|
+
| "verificationGasLimit"
|
|
65
|
+
>
|
|
66
|
+
: PartialBy<
|
|
67
|
+
UserOperationWithBigIntAsHex<"v0.7">,
|
|
68
|
+
| "callGasLimit"
|
|
69
|
+
| "preVerificationGas"
|
|
70
|
+
| "verificationGasLimit"
|
|
71
|
+
| "paymasterVerificationGasLimit"
|
|
72
|
+
| "paymasterPostOpGasLimit"
|
|
73
|
+
>,
|
|
74
|
+
entryPoint: entryPoint,
|
|
66
75
|
metadata?: {
|
|
67
76
|
sponsorshipPolicyId?: string
|
|
68
77
|
}
|
|
69
78
|
]
|
|
70
|
-
ReturnType:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
ReturnType: GetEntryPointVersion<entryPoint> extends "v0.6"
|
|
80
|
+
? {
|
|
81
|
+
paymasterAndData: Hex
|
|
82
|
+
preVerificationGas: Hex
|
|
83
|
+
verificationGasLimit: Hex
|
|
84
|
+
callGasLimit: Hex
|
|
85
|
+
paymaster?: never
|
|
86
|
+
paymasterVerificationGasLimit?: never
|
|
87
|
+
paymasterPostOpGasLimit?: never
|
|
88
|
+
paymasterData?: never
|
|
89
|
+
}
|
|
90
|
+
: {
|
|
91
|
+
preVerificationGas: Hex
|
|
92
|
+
verificationGasLimit: Hex
|
|
93
|
+
callGasLimit: Hex
|
|
94
|
+
paymaster: Address
|
|
95
|
+
paymasterVerificationGasLimit: Hex
|
|
96
|
+
paymasterPostOpGasLimit: Hex
|
|
97
|
+
paymasterData: Hex
|
|
98
|
+
paymasterAndData?: never
|
|
99
|
+
}
|
|
76
100
|
},
|
|
77
101
|
{
|
|
78
102
|
Method: "pm_validateSponsorshipPolicies"
|
|
79
103
|
Parameters: [
|
|
80
|
-
userOperation: UserOperationWithBigIntAsHex
|
|
81
|
-
|
|
104
|
+
userOperation: UserOperationWithBigIntAsHex<
|
|
105
|
+
GetEntryPointVersion<entryPoint>
|
|
106
|
+
>,
|
|
107
|
+
entryPoint: entryPoint,
|
|
82
108
|
sponsorshipPolicyIds: string[]
|
|
83
109
|
]
|
|
84
110
|
ReturnType: {
|
package/types/stackup.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Address, Hex } from "viem"
|
|
2
2
|
import type { PartialBy } from "viem/types/utils"
|
|
3
|
+
import type { ENTRYPOINT_ADDRESS_V06_TYPE, EntryPoint } from "./entrypoint"
|
|
3
4
|
import type { UserOperationWithBigIntAsHex } from "./userOperation"
|
|
4
5
|
|
|
5
6
|
interface StackupPaymasterContextType {
|
|
@@ -10,26 +11,49 @@ export type StackupPaymasterContext =
|
|
|
10
11
|
| (StackupPaymasterContextType & { type: "erc20token"; token: string })
|
|
11
12
|
| (StackupPaymasterContextType & { type: "payg" })
|
|
12
13
|
|
|
13
|
-
export type StackupPaymasterRpcSchema = [
|
|
14
|
+
export type StackupPaymasterRpcSchema<entryPoint extends EntryPoint> = [
|
|
14
15
|
{
|
|
15
16
|
Method: "pm_sponsorUserOperation"
|
|
16
17
|
Parameters: [
|
|
17
|
-
userOperation:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
userOperation: entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
|
|
19
|
+
? PartialBy<
|
|
20
|
+
UserOperationWithBigIntAsHex<"v0.6">,
|
|
21
|
+
| "callGasLimit"
|
|
22
|
+
| "preVerificationGas"
|
|
23
|
+
| "verificationGasLimit"
|
|
24
|
+
>
|
|
25
|
+
: PartialBy<
|
|
26
|
+
UserOperationWithBigIntAsHex<"v0.7">,
|
|
27
|
+
| "callGasLimit"
|
|
28
|
+
| "preVerificationGas"
|
|
29
|
+
| "verificationGasLimit"
|
|
30
|
+
| "paymasterVerificationGasLimit"
|
|
31
|
+
| "paymasterPostOpGasLimit"
|
|
32
|
+
>,
|
|
33
|
+
entryPoint: entryPoint,
|
|
25
34
|
context: StackupPaymasterContext
|
|
26
35
|
]
|
|
27
|
-
ReturnType:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
ReturnType: entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
|
|
37
|
+
? {
|
|
38
|
+
paymasterAndData: Hex
|
|
39
|
+
preVerificationGas: Hex
|
|
40
|
+
verificationGasLimit: Hex
|
|
41
|
+
callGasLimit: Hex
|
|
42
|
+
paymaster?: never
|
|
43
|
+
paymasterVerificationGasLimit?: never
|
|
44
|
+
paymasterPostOpGasLimit?: never
|
|
45
|
+
paymasterData?: never
|
|
46
|
+
}
|
|
47
|
+
: {
|
|
48
|
+
preVerificationGas: Hex
|
|
49
|
+
verificationGasLimit: Hex
|
|
50
|
+
callGasLimit: Hex
|
|
51
|
+
paymaster: Address
|
|
52
|
+
paymasterVerificationGasLimit: Hex
|
|
53
|
+
paymasterPostOpGasLimit: Hex
|
|
54
|
+
paymasterData: Hex
|
|
55
|
+
paymasterAndData?: never
|
|
56
|
+
}
|
|
33
57
|
},
|
|
34
58
|
{
|
|
35
59
|
Method: "pm_accounts"
|
package/types/userOperation.ts
CHANGED
|
@@ -1,32 +1,88 @@
|
|
|
1
1
|
import type { Address } from "viem"
|
|
2
2
|
import type { Hex } from "viem"
|
|
3
|
+
import type { EntryPointVersion } from "./entrypoint"
|
|
3
4
|
|
|
4
5
|
export type TStatus = "success" | "reverted"
|
|
5
6
|
|
|
6
|
-
export type UserOperationWithBigIntAsHex
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
export type UserOperationWithBigIntAsHex<
|
|
8
|
+
entryPointVersion extends EntryPointVersion
|
|
9
|
+
> = entryPointVersion extends "v0.6"
|
|
10
|
+
? {
|
|
11
|
+
sender: Address
|
|
12
|
+
nonce: Hex
|
|
13
|
+
initCode: Hex
|
|
14
|
+
callData: Hex
|
|
15
|
+
callGasLimit: Hex
|
|
16
|
+
verificationGasLimit: Hex
|
|
17
|
+
preVerificationGas: Hex
|
|
18
|
+
maxFeePerGas: Hex
|
|
19
|
+
maxPriorityFeePerGas: Hex
|
|
20
|
+
paymasterAndData: Hex
|
|
21
|
+
signature: Hex
|
|
22
|
+
factory?: never
|
|
23
|
+
factoryData?: never
|
|
24
|
+
paymaster?: never
|
|
25
|
+
paymasterVerificationGasLimit?: never
|
|
26
|
+
paymasterPostOpGasLimit?: never
|
|
27
|
+
paymasterData?: never
|
|
28
|
+
}
|
|
29
|
+
: {
|
|
30
|
+
sender: Address
|
|
31
|
+
nonce: Hex
|
|
32
|
+
factory: Address
|
|
33
|
+
factoryData: Hex
|
|
34
|
+
callData: Hex
|
|
35
|
+
callGasLimit: Hex
|
|
36
|
+
verificationGasLimit: Hex
|
|
37
|
+
preVerificationGas: Hex
|
|
38
|
+
maxFeePerGas: Hex
|
|
39
|
+
maxPriorityFeePerGas: Hex
|
|
40
|
+
paymaster: Address
|
|
41
|
+
paymasterVerificationGasLimit: Hex
|
|
42
|
+
paymasterPostOpGasLimit: Hex
|
|
43
|
+
paymasterData: Hex
|
|
44
|
+
signature: Hex
|
|
45
|
+
initCode?: never
|
|
46
|
+
paymasterAndData?: never
|
|
47
|
+
}
|
|
19
48
|
|
|
20
|
-
export type UserOperation =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
export type UserOperation<entryPointVersion extends EntryPointVersion> =
|
|
50
|
+
entryPointVersion extends "v0.6"
|
|
51
|
+
? {
|
|
52
|
+
sender: Address
|
|
53
|
+
nonce: bigint
|
|
54
|
+
initCode: Hex
|
|
55
|
+
callData: Hex
|
|
56
|
+
callGasLimit: bigint
|
|
57
|
+
verificationGasLimit: bigint
|
|
58
|
+
preVerificationGas: bigint
|
|
59
|
+
maxFeePerGas: bigint
|
|
60
|
+
maxPriorityFeePerGas: bigint
|
|
61
|
+
paymasterAndData: Hex
|
|
62
|
+
signature: Hex
|
|
63
|
+
factory?: never
|
|
64
|
+
factoryData?: never
|
|
65
|
+
paymaster?: never
|
|
66
|
+
paymasterVerificationGasLimit?: never
|
|
67
|
+
paymasterPostOpGasLimit?: never
|
|
68
|
+
paymasterData?: never
|
|
69
|
+
}
|
|
70
|
+
: {
|
|
71
|
+
sender: Address
|
|
72
|
+
nonce: bigint
|
|
73
|
+
factory: Address | undefined
|
|
74
|
+
factoryData: Hex | undefined
|
|
75
|
+
callData: Hex
|
|
76
|
+
callGasLimit: bigint
|
|
77
|
+
verificationGasLimit: bigint
|
|
78
|
+
preVerificationGas: bigint
|
|
79
|
+
maxFeePerGas: bigint
|
|
80
|
+
maxPriorityFeePerGas: bigint
|
|
81
|
+
paymaster: Address | undefined
|
|
82
|
+
paymasterVerificationGasLimit: bigint | undefined
|
|
83
|
+
paymasterPostOpGasLimit: bigint | undefined
|
|
84
|
+
paymasterData: Hex | undefined
|
|
85
|
+
signature: Hex
|
|
86
|
+
initCode?: never
|
|
87
|
+
paymasterAndData?: never
|
|
88
|
+
}
|
|
@@ -38,10 +38,14 @@ import {
|
|
|
38
38
|
PaymasterValidityPeriodError,
|
|
39
39
|
type PaymasterValidityPeriodErrorType
|
|
40
40
|
} from "../../errors/paymaster"
|
|
41
|
-
import type {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
import type {
|
|
42
|
+
EntryPoint,
|
|
43
|
+
GetEntryPointVersion,
|
|
44
|
+
UserOperation
|
|
45
|
+
} from "../../types"
|
|
46
|
+
|
|
47
|
+
export type GetBundlerErrorParameters<entryPoint extends EntryPoint> = {
|
|
48
|
+
userOperation: Partial<UserOperation<GetEntryPointVersion<entryPoint>>>
|
|
45
49
|
entryPoint: Address
|
|
46
50
|
}
|
|
47
51
|
|
|
@@ -63,9 +67,9 @@ export type GetBundlerErrorReturnType =
|
|
|
63
67
|
| PaymasterValidationRevertedErrorType
|
|
64
68
|
| PaymasterDataRejectedErrorType
|
|
65
69
|
|
|
66
|
-
export function getBundlerError(
|
|
70
|
+
export function getBundlerError<entryPoint extends EntryPoint>(
|
|
67
71
|
err: BaseError,
|
|
68
|
-
args: GetBundlerErrorParameters
|
|
72
|
+
args: GetBundlerErrorParameters<entryPoint>
|
|
69
73
|
) {
|
|
70
74
|
const message = (err.details || "").toLowerCase()
|
|
71
75
|
|
|
@@ -5,26 +5,29 @@ import {
|
|
|
5
5
|
type EstimateUserOperationGasErrorType
|
|
6
6
|
} from "../../errors/estimateUserOperationGas"
|
|
7
7
|
import { type ErrorType } from "../../errors/utils"
|
|
8
|
+
import type { EntryPoint } from "../../types/entrypoint"
|
|
8
9
|
import {
|
|
9
10
|
type GetBundlerErrorParameters,
|
|
10
11
|
type GetBundlerErrorReturnType,
|
|
11
12
|
getBundlerError
|
|
12
13
|
} from "./getBundlerError"
|
|
13
14
|
|
|
14
|
-
export type GetEstimateUserOperationGasErrorReturnType<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export type GetEstimateUserOperationGasErrorReturnType<
|
|
16
|
+
entryPoint extends EntryPoint,
|
|
17
|
+
cause = ErrorType
|
|
18
|
+
> = Omit<EstimateUserOperationGasErrorType<entryPoint>, "cause"> & {
|
|
19
|
+
cause: cause | GetBundlerErrorReturnType
|
|
20
|
+
}
|
|
18
21
|
|
|
19
|
-
export function getEstimateUserOperationGasError<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
) {
|
|
22
|
+
export function getEstimateUserOperationGasError<
|
|
23
|
+
err extends ErrorType<string>,
|
|
24
|
+
entryPoint extends EntryPoint
|
|
25
|
+
>(error: err, args: EstimateUserOperationGasParameters<entryPoint>) {
|
|
23
26
|
const cause = (() => {
|
|
24
27
|
const cause = getBundlerError(
|
|
25
28
|
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
26
29
|
error as {} as BaseError,
|
|
27
|
-
args as GetBundlerErrorParameters
|
|
30
|
+
args as GetBundlerErrorParameters<entryPoint>
|
|
28
31
|
)
|
|
29
32
|
// biome-ignore lint/complexity/noBannedTypes: <explanation>
|
|
30
33
|
if (cause instanceof UnknownNodeError) return error as {} as BaseError
|
|
@@ -33,5 +36,5 @@ export function getEstimateUserOperationGasError<err extends ErrorType<string>>(
|
|
|
33
36
|
|
|
34
37
|
throw new EstimateUserOperationGasError(cause, {
|
|
35
38
|
...args
|
|
36
|
-
}) as GetEstimateUserOperationGasErrorReturnType<err>
|
|
39
|
+
}) as GetEstimateUserOperationGasErrorReturnType<entryPoint, err>
|
|
37
40
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { BaseError, UnknownNodeError } from "viem"
|
|
2
2
|
import type { SendUserOperationParameters } from "../../actions/bundler/sendUserOperation"
|
|
3
3
|
import { SendUserOperationError } from "../../errors"
|
|
4
|
+
import type { EntryPoint } from "../../types/entrypoint"
|
|
4
5
|
import {
|
|
5
6
|
type GetBundlerErrorParameters,
|
|
6
7
|
getBundlerError
|
|
7
8
|
} from "./getBundlerError"
|
|
8
9
|
|
|
9
|
-
export function getSendUserOperationError(
|
|
10
|
+
export function getSendUserOperationError<entryPoint extends EntryPoint>(
|
|
10
11
|
err: BaseError,
|
|
11
|
-
args: SendUserOperationParameters
|
|
12
|
+
args: SendUserOperationParameters<entryPoint>
|
|
12
13
|
) {
|
|
13
14
|
const cause = (() => {
|
|
14
15
|
const cause = getBundlerError(
|
|
15
16
|
err as BaseError,
|
|
16
|
-
args as GetBundlerErrorParameters
|
|
17
|
+
args as GetBundlerErrorParameters<entryPoint>
|
|
17
18
|
)
|
|
18
19
|
if (cause instanceof UnknownNodeError) return err as BaseError
|
|
19
20
|
return cause
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
3
|
+
ENTRYPOINT_ADDRESS_V07_TYPE
|
|
4
|
+
} from "../types"
|
|
5
|
+
import type { EntryPoint, GetEntryPointVersion } from "../types/entrypoint"
|
|
6
|
+
|
|
7
|
+
export const ENTRYPOINT_ADDRESS_V06: ENTRYPOINT_ADDRESS_V06_TYPE =
|
|
8
|
+
"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
|
|
9
|
+
export const ENTRYPOINT_ADDRESS_V07: ENTRYPOINT_ADDRESS_V07_TYPE =
|
|
10
|
+
"0x0000000071727De22E5E9d8BAf0edAc6f37da032"
|
|
11
|
+
|
|
12
|
+
export const getEntryPointVersion = (
|
|
13
|
+
entryPoint: EntryPoint
|
|
14
|
+
): GetEntryPointVersion<EntryPoint> =>
|
|
15
|
+
entryPoint === ENTRYPOINT_ADDRESS_V06 ? "v0.6" : "v0.7"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { UserOperation } from "../types"
|
|
1
|
+
import type { EntryPoint, GetEntryPointVersion, UserOperation } from "../types"
|
|
2
|
+
import { ENTRYPOINT_ADDRESS_V06 } from "./getEntryPointVersion"
|
|
2
3
|
|
|
3
|
-
export type GetRequiredPrefundReturnType = {
|
|
4
|
-
userOperation: UserOperation
|
|
4
|
+
export type GetRequiredPrefundReturnType<entryPoint extends EntryPoint> = {
|
|
5
|
+
userOperation: UserOperation<GetEntryPointVersion<entryPoint>>
|
|
6
|
+
entryPoint: entryPoint
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -18,14 +20,36 @@ export type GetRequiredPrefundReturnType = {
|
|
|
18
20
|
* userOperation
|
|
19
21
|
* })
|
|
20
22
|
*/
|
|
21
|
-
export const getRequiredPrefund = ({
|
|
22
|
-
userOperation
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
export const getRequiredPrefund = <entryPoint extends EntryPoint>({
|
|
24
|
+
userOperation,
|
|
25
|
+
entryPoint: entryPointAddress
|
|
26
|
+
}: GetRequiredPrefundReturnType<entryPoint>): bigint => {
|
|
27
|
+
if (entryPointAddress === ENTRYPOINT_ADDRESS_V06) {
|
|
28
|
+
const userOperationVersion0_6 = userOperation as UserOperation<"v0.6">
|
|
29
|
+
const multiplier =
|
|
30
|
+
userOperationVersion0_6.paymasterAndData.length > 2 ? 3n : 1n
|
|
31
|
+
const requiredGas =
|
|
32
|
+
userOperationVersion0_6.callGasLimit +
|
|
33
|
+
userOperationVersion0_6.verificationGasLimit * multiplier +
|
|
34
|
+
userOperationVersion0_6.preVerificationGas
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
BigInt(requiredGas) * BigInt(userOperationVersion0_6.maxFeePerGas)
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const userOperationV07 = userOperation as UserOperation<"v0.7">
|
|
42
|
+
const multiplier = userOperationV07.paymaster ? 3n : 1n
|
|
43
|
+
|
|
44
|
+
const verificationGasLimit =
|
|
45
|
+
userOperationV07.verificationGasLimit +
|
|
46
|
+
(userOperationV07.paymasterPostOpGasLimit || 0n) +
|
|
47
|
+
(userOperationV07.paymasterVerificationGasLimit || 0n)
|
|
48
|
+
|
|
25
49
|
const requiredGas =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
50
|
+
userOperationV07.callGasLimit +
|
|
51
|
+
verificationGasLimit * multiplier +
|
|
52
|
+
userOperationV07.preVerificationGas
|
|
29
53
|
|
|
30
|
-
return BigInt(requiredGas) * BigInt(
|
|
54
|
+
return BigInt(requiredGas) * BigInt(userOperationV07.maxFeePerGas)
|
|
31
55
|
}
|