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,4 +1,3 @@
|
|
|
1
|
-
import type { Address } from "viem"
|
|
2
1
|
import type { Client, Hash } from "viem"
|
|
3
2
|
import { chainId } from "../../actions/bundler/chainId"
|
|
4
3
|
import {
|
|
@@ -27,9 +26,10 @@ import {
|
|
|
27
26
|
} from "../../actions/bundler/waitForUserOperationReceipt"
|
|
28
27
|
import type { Prettify } from "../../types/"
|
|
29
28
|
import type { StateOverrides } from "../../types/bundler"
|
|
29
|
+
import type { EntryPoint } from "../../types/entrypoint"
|
|
30
30
|
import type { BundlerClient } from "../createBundlerClient"
|
|
31
31
|
|
|
32
|
-
export type BundlerActions = {
|
|
32
|
+
export type BundlerActions<entryPoint extends EntryPoint> = {
|
|
33
33
|
/**
|
|
34
34
|
*
|
|
35
35
|
* Sends user operation to the bundler
|
|
@@ -56,7 +56,9 @@ export type BundlerActions = {
|
|
|
56
56
|
* // Return '0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34'
|
|
57
57
|
*/
|
|
58
58
|
sendUserOperation: (
|
|
59
|
-
args: Prettify<
|
|
59
|
+
args: Prettify<
|
|
60
|
+
Omit<SendUserOperationParameters<entryPoint>, "entryPoint">
|
|
61
|
+
>
|
|
60
62
|
) => Promise<Hash>
|
|
61
63
|
/**
|
|
62
64
|
*
|
|
@@ -84,9 +86,11 @@ export type BundlerActions = {
|
|
|
84
86
|
* // Return {preVerificationGas: 43492n, verificationGasLimit: 59436n, callGasLimit: 9000n}
|
|
85
87
|
*/
|
|
86
88
|
estimateUserOperationGas: (
|
|
87
|
-
args: Prettify<
|
|
89
|
+
args: Prettify<
|
|
90
|
+
Omit<EstimateUserOperationGasParameters<entryPoint>, "entryPoint">
|
|
91
|
+
>,
|
|
88
92
|
stateOverrides?: StateOverrides
|
|
89
|
-
) => Promise<Prettify<EstimateUserOperationGasReturnType
|
|
93
|
+
) => Promise<Prettify<EstimateUserOperationGasReturnType<entryPoint>>>
|
|
90
94
|
/**
|
|
91
95
|
*
|
|
92
96
|
* Returns the supported entrypoints by the bundler service
|
|
@@ -108,7 +112,7 @@ export type BundlerActions = {
|
|
|
108
112
|
*
|
|
109
113
|
* // Return ['0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789']
|
|
110
114
|
*/
|
|
111
|
-
supportedEntryPoints: () => Promise<
|
|
115
|
+
supportedEntryPoints: () => Promise<EntryPoint[]>
|
|
112
116
|
/**
|
|
113
117
|
*
|
|
114
118
|
* Returns the supported chain id by the bundler service
|
|
@@ -153,7 +157,7 @@ export type BundlerActions = {
|
|
|
153
157
|
*/
|
|
154
158
|
getUserOperationByHash: (
|
|
155
159
|
args: Prettify<GetUserOperationByHashParameters>
|
|
156
|
-
) => Promise<Prettify<GetUserOperationByHashReturnType
|
|
160
|
+
) => Promise<Prettify<GetUserOperationByHashReturnType<entryPoint>> | null>
|
|
157
161
|
/**
|
|
158
162
|
*
|
|
159
163
|
* Returns the user operation receipt from userOpHash
|
|
@@ -205,25 +209,45 @@ export type BundlerActions = {
|
|
|
205
209
|
) => Promise<Prettify<GetUserOperationReceiptReturnType>>
|
|
206
210
|
}
|
|
207
211
|
|
|
208
|
-
const bundlerActions =
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
212
|
+
const bundlerActions =
|
|
213
|
+
<entryPoint extends EntryPoint>(entryPointAddress: entryPoint) =>
|
|
214
|
+
(client: Client): BundlerActions<entryPoint> => ({
|
|
215
|
+
sendUserOperation: async (
|
|
216
|
+
args: Omit<SendUserOperationParameters<entryPoint>, "entryPoint">
|
|
217
|
+
): Promise<Hash> =>
|
|
218
|
+
sendUserOperation<entryPoint>(client as BundlerClient<entryPoint>, {
|
|
219
|
+
...args,
|
|
220
|
+
entryPoint: entryPointAddress
|
|
221
|
+
}),
|
|
222
|
+
estimateUserOperationGas: (
|
|
223
|
+
args: Omit<
|
|
224
|
+
EstimateUserOperationGasParameters<entryPoint>,
|
|
225
|
+
"entryPoint"
|
|
226
|
+
>,
|
|
227
|
+
stateOverrides?: StateOverrides
|
|
228
|
+
) =>
|
|
229
|
+
estimateUserOperationGas<entryPoint>(
|
|
230
|
+
client as BundlerClient<entryPoint>,
|
|
231
|
+
{ ...args, entryPoint: entryPointAddress },
|
|
232
|
+
stateOverrides
|
|
233
|
+
),
|
|
234
|
+
supportedEntryPoints: (): Promise<EntryPoint[]> =>
|
|
235
|
+
supportedEntryPoints(client as BundlerClient<entryPoint>),
|
|
236
|
+
chainId: () => chainId(client as BundlerClient<entryPoint>),
|
|
237
|
+
getUserOperationByHash: (args: GetUserOperationByHashParameters) =>
|
|
238
|
+
getUserOperationByHash<entryPoint>(
|
|
239
|
+
client as BundlerClient<entryPoint>,
|
|
240
|
+
args
|
|
241
|
+
),
|
|
242
|
+
getUserOperationReceipt: (args: GetUserOperationReceiptParameters) =>
|
|
243
|
+
getUserOperationReceipt(client as BundlerClient<entryPoint>, args),
|
|
244
|
+
waitForUserOperationReceipt: (
|
|
245
|
+
args: WaitForUserOperationReceiptParameters
|
|
246
|
+
) =>
|
|
247
|
+
waitForUserOperationReceipt(
|
|
248
|
+
client as BundlerClient<entryPoint>,
|
|
249
|
+
args
|
|
250
|
+
)
|
|
251
|
+
})
|
|
228
252
|
|
|
229
253
|
export { bundlerActions }
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
sponsorUserOperation
|
|
22
22
|
} from "../../actions/pimlico/sponsorUserOperation"
|
|
23
23
|
import type { Prettify } from "../../types/"
|
|
24
|
+
import type { EntryPoint } from "../../types/entrypoint"
|
|
24
25
|
import type { PimlicoBundlerClient, PimlicoPaymasterClient } from "../pimlico"
|
|
25
26
|
|
|
26
27
|
export type PimlicoBundlerActions = {
|
|
@@ -97,19 +98,26 @@ export type PimlicoBundlerActions = {
|
|
|
97
98
|
) => Promise<Hash>
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
export const pimlicoBundlerActions = (
|
|
101
|
+
export const pimlicoBundlerActions = <entryPoint extends EntryPoint>(
|
|
101
102
|
client: Client
|
|
102
103
|
): PimlicoBundlerActions => ({
|
|
103
104
|
getUserOperationGasPrice: async () =>
|
|
104
|
-
getUserOperationGasPrice(client as PimlicoBundlerClient),
|
|
105
|
+
getUserOperationGasPrice(client as PimlicoBundlerClient<entryPoint>),
|
|
105
106
|
getUserOperationStatus: async (args: GetUserOperationStatusParameters) =>
|
|
106
|
-
getUserOperationStatus(
|
|
107
|
+
getUserOperationStatus(
|
|
108
|
+
client as PimlicoBundlerClient<entryPoint>,
|
|
109
|
+
args
|
|
110
|
+
),
|
|
107
111
|
sendCompressedUserOperation: async (
|
|
108
112
|
args: SendCompressedUserOperationParameters
|
|
109
|
-
) =>
|
|
113
|
+
) =>
|
|
114
|
+
sendCompressedUserOperation(
|
|
115
|
+
client as PimlicoBundlerClient<entryPoint>,
|
|
116
|
+
args
|
|
117
|
+
)
|
|
110
118
|
})
|
|
111
119
|
|
|
112
|
-
export type PimlicoPaymasterClientActions = {
|
|
120
|
+
export type PimlicoPaymasterClientActions<entryPoint extends EntryPoint> = {
|
|
113
121
|
/**
|
|
114
122
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
115
123
|
*
|
|
@@ -134,11 +142,11 @@ export type PimlicoPaymasterClientActions = {
|
|
|
134
142
|
*
|
|
135
143
|
*/
|
|
136
144
|
sponsorUserOperation: (
|
|
137
|
-
args: Prettify<PimlicoSponsorUserOperationParameters
|
|
138
|
-
) => Promise<Prettify<SponsorUserOperationReturnType
|
|
145
|
+
args: Prettify<PimlicoSponsorUserOperationParameters<entryPoint>>
|
|
146
|
+
) => Promise<Prettify<SponsorUserOperationReturnType<entryPoint>>>
|
|
139
147
|
|
|
140
148
|
validateSponsorshipPolicies: (
|
|
141
|
-
args: Prettify<ValidateSponsorshipPoliciesParameters
|
|
149
|
+
args: Prettify<ValidateSponsorshipPoliciesParameters<entryPoint>>
|
|
142
150
|
) => Promise<Prettify<ValidateSponsorshipPolicies>[]>
|
|
143
151
|
}
|
|
144
152
|
|
|
@@ -177,15 +185,33 @@ export type PimlicoPaymasterClientActions = {
|
|
|
177
185
|
* }
|
|
178
186
|
* ]
|
|
179
187
|
*/
|
|
180
|
-
export const pimlicoPaymasterActions =
|
|
181
|
-
|
|
182
|
-
): PimlicoPaymasterClientActions => ({
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
188
|
+
export const pimlicoPaymasterActions =
|
|
189
|
+
<entryPoint extends EntryPoint>(entryPointAddress: entryPoint) =>
|
|
190
|
+
(client: Client): PimlicoPaymasterClientActions<entryPoint> => ({
|
|
191
|
+
sponsorUserOperation: async (
|
|
192
|
+
args: Omit<
|
|
193
|
+
PimlicoSponsorUserOperationParameters<entryPoint>,
|
|
194
|
+
"entryPoint"
|
|
195
|
+
>
|
|
196
|
+
) =>
|
|
197
|
+
sponsorUserOperation<entryPoint>(
|
|
198
|
+
client as PimlicoPaymasterClient<entryPoint>,
|
|
199
|
+
{
|
|
200
|
+
...args,
|
|
201
|
+
entryPoint: entryPointAddress
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
validateSponsorshipPolicies: async (
|
|
205
|
+
args: Omit<
|
|
206
|
+
ValidateSponsorshipPoliciesParameters<entryPoint>,
|
|
207
|
+
"entryPoint"
|
|
208
|
+
>
|
|
209
|
+
) =>
|
|
210
|
+
validateSponsorshipPolicies<entryPoint>(
|
|
211
|
+
client as PimlicoPaymasterClient<entryPoint>,
|
|
212
|
+
{ ...args, entryPoint: entryPointAddress }
|
|
213
|
+
)
|
|
214
|
+
})
|
|
189
215
|
|
|
190
216
|
/**
|
|
191
217
|
* TODO: Add support for pimlicoActions after we support all the actions of v2 of the Pimlico API.
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
deployContract
|
|
22
22
|
} from "../../actions/smartAccount/deployContract"
|
|
23
23
|
import {
|
|
24
|
+
type Middleware,
|
|
24
25
|
type PrepareUserOperationRequestReturnType,
|
|
25
|
-
type SponsorUserOperationMiddleware,
|
|
26
26
|
prepareUserOperationRequest
|
|
27
27
|
} from "../../actions/smartAccount/prepareUserOperationRequest"
|
|
28
28
|
import {
|
|
@@ -41,10 +41,14 @@ import {
|
|
|
41
41
|
} from "../../actions/smartAccount/writeContract"
|
|
42
42
|
import type { Prettify } from "../../types/"
|
|
43
43
|
import type { StateOverrides } from "../../types/bundler"
|
|
44
|
+
import type { EntryPoint } from "../../types/entrypoint"
|
|
44
45
|
|
|
45
46
|
export type SmartAccountActions<
|
|
47
|
+
entryPoint extends EntryPoint,
|
|
46
48
|
TChain extends Chain | undefined = Chain | undefined,
|
|
47
|
-
TSmartAccount extends SmartAccount | undefined =
|
|
49
|
+
TSmartAccount extends SmartAccount<entryPoint> | undefined =
|
|
50
|
+
| SmartAccount<entryPoint>
|
|
51
|
+
| undefined
|
|
48
52
|
> = {
|
|
49
53
|
/**
|
|
50
54
|
* Creates, signs, and sends a new transaction to the network.
|
|
@@ -91,9 +95,7 @@ export type SmartAccountActions<
|
|
|
91
95
|
*/
|
|
92
96
|
sendTransaction: <TChainOverride extends Chain | undefined>(
|
|
93
97
|
args: SendTransactionParameters<TChain, TSmartAccount, TChainOverride>
|
|
94
|
-
) =>
|
|
95
|
-
typeof sendTransaction<TChain, TSmartAccount, TChainOverride>
|
|
96
|
-
>
|
|
98
|
+
) => Promise<Hash>
|
|
97
99
|
/**
|
|
98
100
|
* Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
|
|
99
101
|
*
|
|
@@ -138,8 +140,10 @@ export type SmartAccountActions<
|
|
|
138
140
|
* })
|
|
139
141
|
*/
|
|
140
142
|
signMessage: (
|
|
141
|
-
args: Parameters<
|
|
142
|
-
|
|
143
|
+
args: Parameters<
|
|
144
|
+
typeof signMessage<entryPoint, TChain, TSmartAccount>
|
|
145
|
+
>[1]
|
|
146
|
+
) => ReturnType<typeof signMessage<entryPoint, TChain, TSmartAccount>>
|
|
143
147
|
/**
|
|
144
148
|
* Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
|
|
145
149
|
*
|
|
@@ -242,6 +246,7 @@ export type SmartAccountActions<
|
|
|
242
246
|
>(
|
|
243
247
|
args: Parameters<
|
|
244
248
|
typeof signTypedData<
|
|
249
|
+
entryPoint,
|
|
245
250
|
TTypedData,
|
|
246
251
|
TPrimaryType,
|
|
247
252
|
TChain,
|
|
@@ -249,7 +254,13 @@ export type SmartAccountActions<
|
|
|
249
254
|
>
|
|
250
255
|
>[1]
|
|
251
256
|
) => ReturnType<
|
|
252
|
-
typeof signTypedData<
|
|
257
|
+
typeof signTypedData<
|
|
258
|
+
entryPoint,
|
|
259
|
+
TTypedData,
|
|
260
|
+
TPrimaryType,
|
|
261
|
+
TChain,
|
|
262
|
+
TSmartAccount
|
|
263
|
+
>
|
|
253
264
|
>
|
|
254
265
|
/**
|
|
255
266
|
* Deploys a contract to the network, given bytecode and constructor arguments.
|
|
@@ -289,7 +300,7 @@ export type SmartAccountActions<
|
|
|
289
300
|
TChainOverride
|
|
290
301
|
>
|
|
291
302
|
>
|
|
292
|
-
) => ReturnType<typeof deployContract<TChain, TSmartAccount>>
|
|
303
|
+
) => ReturnType<typeof deployContract<entryPoint, TChain, TSmartAccount>>
|
|
293
304
|
/**
|
|
294
305
|
* Executes a write function on a contract.
|
|
295
306
|
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
@@ -361,6 +372,7 @@ export type SmartAccountActions<
|
|
|
361
372
|
>
|
|
362
373
|
) => ReturnType<
|
|
363
374
|
typeof writeContract<
|
|
375
|
+
entryPoint,
|
|
364
376
|
TChain,
|
|
365
377
|
TSmartAccount,
|
|
366
378
|
TAbi,
|
|
@@ -373,6 +385,7 @@ export type SmartAccountActions<
|
|
|
373
385
|
args: Prettify<
|
|
374
386
|
Parameters<
|
|
375
387
|
typeof prepareUserOperationRequest<
|
|
388
|
+
entryPoint,
|
|
376
389
|
TTransport,
|
|
377
390
|
TChain,
|
|
378
391
|
TSmartAccount
|
|
@@ -380,11 +393,16 @@ export type SmartAccountActions<
|
|
|
380
393
|
>[1]
|
|
381
394
|
>,
|
|
382
395
|
stateOverrides?: StateOverrides
|
|
383
|
-
) => Promise<Prettify<PrepareUserOperationRequestReturnType
|
|
396
|
+
) => Promise<Prettify<PrepareUserOperationRequestReturnType<entryPoint>>>
|
|
384
397
|
sendUserOperation: <TTransport extends Transport>(
|
|
385
398
|
args: Prettify<
|
|
386
399
|
Parameters<
|
|
387
|
-
typeof sendUserOperation<
|
|
400
|
+
typeof sendUserOperation<
|
|
401
|
+
entryPoint,
|
|
402
|
+
TTransport,
|
|
403
|
+
TChain,
|
|
404
|
+
TSmartAccount
|
|
405
|
+
>
|
|
388
406
|
>[1]
|
|
389
407
|
>
|
|
390
408
|
) => Promise<Hash>
|
|
@@ -438,57 +456,117 @@ export type SmartAccountActions<
|
|
|
438
456
|
* }])
|
|
439
457
|
*/
|
|
440
458
|
sendTransactions: (
|
|
441
|
-
args: Prettify<
|
|
442
|
-
|
|
459
|
+
args: Prettify<
|
|
460
|
+
SendTransactionsWithPaymasterParameters<entryPoint, TSmartAccount>
|
|
461
|
+
>
|
|
462
|
+
) => ReturnType<typeof sendTransactions<TChain, TSmartAccount, entryPoint>>
|
|
443
463
|
}
|
|
444
464
|
|
|
445
|
-
export function smartAccountActions({
|
|
446
|
-
|
|
447
|
-
}:
|
|
465
|
+
export function smartAccountActions<entryPoint extends EntryPoint>({
|
|
466
|
+
middleware
|
|
467
|
+
}: Middleware<entryPoint>) {
|
|
448
468
|
return <
|
|
449
469
|
TTransport extends Transport,
|
|
450
470
|
TChain extends Chain | undefined = Chain | undefined,
|
|
451
|
-
TSmartAccount extends SmartAccount | undefined =
|
|
452
|
-
| SmartAccount
|
|
471
|
+
TSmartAccount extends SmartAccount<entryPoint> | undefined =
|
|
472
|
+
| SmartAccount<entryPoint>
|
|
453
473
|
| undefined
|
|
454
474
|
>(
|
|
455
475
|
client: Client<TTransport, TChain, TSmartAccount>
|
|
456
|
-
): SmartAccountActions<TChain, TSmartAccount> => ({
|
|
476
|
+
): SmartAccountActions<entryPoint, TChain, TSmartAccount> => ({
|
|
457
477
|
prepareUserOperationRequest: (args, stateOverrides) =>
|
|
458
478
|
prepareUserOperationRequest(
|
|
459
479
|
client,
|
|
460
480
|
{
|
|
461
481
|
...args,
|
|
462
|
-
|
|
482
|
+
middleware
|
|
463
483
|
},
|
|
464
484
|
stateOverrides
|
|
465
485
|
),
|
|
466
486
|
deployContract: (args) =>
|
|
467
487
|
deployContract(client, {
|
|
468
488
|
...args,
|
|
469
|
-
|
|
470
|
-
} as DeployContractParametersWithPaymaster),
|
|
489
|
+
middleware
|
|
490
|
+
} as DeployContractParametersWithPaymaster<entryPoint>),
|
|
471
491
|
sendTransaction: (args) =>
|
|
472
|
-
sendTransaction(client, {
|
|
492
|
+
sendTransaction<TChain, TSmartAccount, entryPoint>(client, {
|
|
473
493
|
...args,
|
|
474
|
-
|
|
475
|
-
} as SendTransactionWithPaymasterParameters<
|
|
494
|
+
middleware
|
|
495
|
+
} as SendTransactionWithPaymasterParameters<
|
|
496
|
+
entryPoint,
|
|
497
|
+
TChain,
|
|
498
|
+
TSmartAccount
|
|
499
|
+
>),
|
|
476
500
|
sendTransactions: (args) =>
|
|
477
|
-
sendTransactions(client, {
|
|
501
|
+
sendTransactions<TChain, TSmartAccount, entryPoint>(client, {
|
|
478
502
|
...args,
|
|
479
|
-
|
|
480
|
-
}
|
|
503
|
+
middleware
|
|
504
|
+
}),
|
|
481
505
|
sendUserOperation: (args) =>
|
|
482
|
-
sendUserOperation
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
506
|
+
sendUserOperation<entryPoint, TTransport, TChain, TSmartAccount>(
|
|
507
|
+
client,
|
|
508
|
+
{
|
|
509
|
+
...args,
|
|
510
|
+
middleware
|
|
511
|
+
} as SendUserOperationParameters<entryPoint, TSmartAccount>
|
|
512
|
+
),
|
|
513
|
+
signMessage: (args) =>
|
|
514
|
+
signMessage<entryPoint, TChain, TSmartAccount>(client, args),
|
|
515
|
+
signTypedData: <
|
|
516
|
+
const TTypedData extends TypedData | { [key: string]: unknown },
|
|
517
|
+
TPrimaryType extends string
|
|
518
|
+
>(
|
|
519
|
+
args: Parameters<
|
|
520
|
+
typeof signTypedData<
|
|
521
|
+
entryPoint,
|
|
522
|
+
TTypedData,
|
|
523
|
+
TPrimaryType,
|
|
524
|
+
TChain,
|
|
525
|
+
TSmartAccount
|
|
526
|
+
>
|
|
527
|
+
>[1]
|
|
528
|
+
) =>
|
|
529
|
+
signTypedData<
|
|
530
|
+
entryPoint,
|
|
531
|
+
TTypedData,
|
|
532
|
+
TPrimaryType,
|
|
533
|
+
TChain,
|
|
534
|
+
TSmartAccount
|
|
535
|
+
>(client, args),
|
|
536
|
+
writeContract: <
|
|
537
|
+
const TAbi extends Abi | readonly unknown[],
|
|
538
|
+
TFunctionName extends ContractFunctionName<
|
|
539
|
+
TAbi,
|
|
540
|
+
"nonpayable" | "payable"
|
|
541
|
+
> = ContractFunctionName<TAbi, "nonpayable" | "payable">,
|
|
542
|
+
TArgs extends ContractFunctionArgs<
|
|
543
|
+
TAbi,
|
|
544
|
+
"nonpayable" | "payable",
|
|
545
|
+
TFunctionName
|
|
546
|
+
> = ContractFunctionArgs<
|
|
547
|
+
TAbi,
|
|
548
|
+
"nonpayable" | "payable",
|
|
549
|
+
TFunctionName
|
|
550
|
+
>,
|
|
551
|
+
TChainOverride extends Chain | undefined = undefined
|
|
552
|
+
>(
|
|
553
|
+
args: WriteContractParameters<
|
|
554
|
+
TAbi,
|
|
555
|
+
TFunctionName,
|
|
556
|
+
TArgs,
|
|
557
|
+
TChain,
|
|
558
|
+
TSmartAccount,
|
|
559
|
+
TChainOverride
|
|
560
|
+
>
|
|
561
|
+
) =>
|
|
489
562
|
writeContract(client, {
|
|
490
563
|
...args,
|
|
491
|
-
|
|
492
|
-
} as WriteContractWithPaymasterParameters<
|
|
564
|
+
middleware
|
|
565
|
+
} as WriteContractWithPaymasterParameters<
|
|
566
|
+
entryPoint,
|
|
567
|
+
TChain,
|
|
568
|
+
TSmartAccount,
|
|
569
|
+
TAbi
|
|
570
|
+
>)
|
|
493
571
|
})
|
|
494
572
|
}
|
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
type SponsorUserOperationReturnType,
|
|
9
9
|
sponsorUserOperation
|
|
10
10
|
} from "../../actions/stackup/sponsorUserOperation"
|
|
11
|
+
import type { EntryPoint } from "../../types/entrypoint"
|
|
11
12
|
import { type StackupPaymasterClient } from "../stackup"
|
|
12
13
|
|
|
13
|
-
export type StackupPaymasterClientActions = {
|
|
14
|
+
export type StackupPaymasterClientActions<entryPoint extends EntryPoint> = {
|
|
14
15
|
/**
|
|
15
16
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
16
17
|
*
|
|
@@ -35,8 +36,8 @@ export type StackupPaymasterClientActions = {
|
|
|
35
36
|
*
|
|
36
37
|
*/
|
|
37
38
|
sponsorUserOperation: (
|
|
38
|
-
args: SponsorUserOperationParameters
|
|
39
|
-
) => Promise<SponsorUserOperationReturnType
|
|
39
|
+
args: SponsorUserOperationParameters<entryPoint>
|
|
40
|
+
) => Promise<SponsorUserOperationReturnType<entryPoint>>
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* Returns all the Paymaster addresses associated with an EntryPoint that’s owned by this service.
|
|
@@ -60,14 +61,17 @@ export type StackupPaymasterClientActions = {
|
|
|
60
61
|
* }})
|
|
61
62
|
*
|
|
62
63
|
*/
|
|
63
|
-
accounts: (args: AccountsParameters) => Promise<Address[]>
|
|
64
|
+
accounts: (args: AccountsParameters<entryPoint>) => Promise<Address[]>
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
export const stackupPaymasterActions = (
|
|
67
|
+
export const stackupPaymasterActions = <entryPoint extends EntryPoint>(
|
|
67
68
|
client: Client
|
|
68
|
-
): StackupPaymasterClientActions => ({
|
|
69
|
-
sponsorUserOperation: async (args
|
|
70
|
-
sponsorUserOperation(
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
): StackupPaymasterClientActions<entryPoint> => ({
|
|
70
|
+
sponsorUserOperation: async (args) =>
|
|
71
|
+
sponsorUserOperation<entryPoint>(
|
|
72
|
+
client as StackupPaymasterClient<entryPoint>,
|
|
73
|
+
args
|
|
74
|
+
),
|
|
75
|
+
accounts: async (args) =>
|
|
76
|
+
accounts(client as StackupPaymasterClient<entryPoint>, args)
|
|
73
77
|
})
|
package/clients/pimlico.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
Transport
|
|
7
7
|
} from "viem"
|
|
8
8
|
import { createClient } from "viem"
|
|
9
|
+
import type { EntryPoint } from "../types/entrypoint"
|
|
9
10
|
import type {
|
|
10
11
|
PimlicoBundlerRpcSchema,
|
|
11
12
|
PimlicoPaymasterRpcSchema
|
|
@@ -18,20 +19,20 @@ import {
|
|
|
18
19
|
pimlicoPaymasterActions
|
|
19
20
|
} from "./decorators/pimlico"
|
|
20
21
|
|
|
21
|
-
export type PimlicoBundlerClient = Client<
|
|
22
|
+
export type PimlicoBundlerClient<entryPoint extends EntryPoint> = Client<
|
|
22
23
|
Transport,
|
|
23
24
|
Chain | undefined,
|
|
24
25
|
Account | undefined,
|
|
25
26
|
PimlicoBundlerRpcSchema,
|
|
26
|
-
PimlicoBundlerActions & BundlerActions
|
|
27
|
+
PimlicoBundlerActions & BundlerActions<entryPoint>
|
|
27
28
|
>
|
|
28
29
|
|
|
29
|
-
export type PimlicoPaymasterClient = Client<
|
|
30
|
+
export type PimlicoPaymasterClient<entryPoint extends EntryPoint> = Client<
|
|
30
31
|
Transport,
|
|
31
32
|
Chain | undefined,
|
|
32
33
|
Account | undefined,
|
|
33
|
-
PimlicoPaymasterRpcSchema
|
|
34
|
-
PimlicoPaymasterClientActions
|
|
34
|
+
PimlicoPaymasterRpcSchema<entryPoint>,
|
|
35
|
+
PimlicoPaymasterClientActions<entryPoint>
|
|
35
36
|
>
|
|
36
37
|
|
|
37
38
|
/**
|
|
@@ -54,11 +55,14 @@ export type PimlicoPaymasterClient = Client<
|
|
|
54
55
|
* })
|
|
55
56
|
*/
|
|
56
57
|
export const createPimlicoBundlerClient = <
|
|
57
|
-
|
|
58
|
+
entryPoint extends EntryPoint,
|
|
59
|
+
transport extends Transport = Transport,
|
|
58
60
|
chain extends Chain | undefined = undefined
|
|
59
61
|
>(
|
|
60
|
-
parameters: PublicClientConfig<transport, chain>
|
|
61
|
-
|
|
62
|
+
parameters: PublicClientConfig<transport, chain> & {
|
|
63
|
+
entryPoint: entryPoint
|
|
64
|
+
}
|
|
65
|
+
): PimlicoBundlerClient<entryPoint> => {
|
|
62
66
|
const { key = "public", name = "Pimlico Bundler Client" } = parameters
|
|
63
67
|
const client = createClient({
|
|
64
68
|
...parameters,
|
|
@@ -66,7 +70,9 @@ export const createPimlicoBundlerClient = <
|
|
|
66
70
|
name,
|
|
67
71
|
type: "pimlicoBundlerClient"
|
|
68
72
|
})
|
|
69
|
-
return client
|
|
73
|
+
return client
|
|
74
|
+
.extend(bundlerActions(parameters.entryPoint))
|
|
75
|
+
.extend(pimlicoBundlerActions)
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
/**
|
|
@@ -89,11 +95,14 @@ export const createPimlicoBundlerClient = <
|
|
|
89
95
|
* })
|
|
90
96
|
*/
|
|
91
97
|
export const createPimlicoPaymasterClient = <
|
|
92
|
-
|
|
98
|
+
entryPoint extends EntryPoint,
|
|
99
|
+
transport extends Transport = Transport,
|
|
93
100
|
chain extends Chain | undefined = undefined
|
|
94
101
|
>(
|
|
95
|
-
parameters: PublicClientConfig<transport, chain>
|
|
96
|
-
|
|
102
|
+
parameters: PublicClientConfig<transport, chain> & {
|
|
103
|
+
entryPoint: entryPoint
|
|
104
|
+
}
|
|
105
|
+
): PimlicoPaymasterClient<entryPoint> => {
|
|
97
106
|
const { key = "public", name = "Pimlico Paymaster Client" } = parameters
|
|
98
107
|
const client = createClient({
|
|
99
108
|
...parameters,
|
|
@@ -101,5 +110,5 @@ export const createPimlicoPaymasterClient = <
|
|
|
101
110
|
name,
|
|
102
111
|
type: "pimlicoPaymasterClient"
|
|
103
112
|
})
|
|
104
|
-
return client.extend(pimlicoPaymasterActions)
|
|
113
|
+
return client.extend(pimlicoPaymasterActions(parameters.entryPoint))
|
|
105
114
|
}
|
package/clients/stackup.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type Transport,
|
|
7
7
|
createClient
|
|
8
8
|
} from "viem"
|
|
9
|
+
import type { EntryPoint } from "../types/entrypoint"
|
|
9
10
|
import type { StackupPaymasterRpcSchema } from "../types/stackup"
|
|
10
11
|
import { type BundlerActions, bundlerActions } from "./decorators/bundler"
|
|
11
12
|
import {
|
|
@@ -13,12 +14,12 @@ import {
|
|
|
13
14
|
stackupPaymasterActions
|
|
14
15
|
} from "./decorators/stackup"
|
|
15
16
|
|
|
16
|
-
export type StackupPaymasterClient = Client<
|
|
17
|
+
export type StackupPaymasterClient<entryPoint extends EntryPoint> = Client<
|
|
17
18
|
Transport,
|
|
18
19
|
Chain | undefined,
|
|
19
20
|
Account | undefined,
|
|
20
|
-
StackupPaymasterRpcSchema
|
|
21
|
-
StackupPaymasterClientActions & BundlerActions
|
|
21
|
+
StackupPaymasterRpcSchema<entryPoint>,
|
|
22
|
+
StackupPaymasterClientActions<entryPoint> & BundlerActions<entryPoint>
|
|
22
23
|
>
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -41,11 +42,14 @@ export type StackupPaymasterClient = Client<
|
|
|
41
42
|
* })
|
|
42
43
|
*/
|
|
43
44
|
export const createStackupPaymasterClient = <
|
|
44
|
-
|
|
45
|
+
entryPoint extends EntryPoint,
|
|
46
|
+
transport extends Transport = Transport,
|
|
45
47
|
chain extends Chain | undefined = undefined
|
|
46
48
|
>(
|
|
47
|
-
parameters: PublicClientConfig<transport, chain>
|
|
48
|
-
|
|
49
|
+
parameters: PublicClientConfig<transport, chain> & {
|
|
50
|
+
entryPoint: entryPoint
|
|
51
|
+
}
|
|
52
|
+
): StackupPaymasterClient<entryPoint> => {
|
|
49
53
|
const { key = "public", name = "Stackup Paymaster Client" } = parameters
|
|
50
54
|
const client = createClient({
|
|
51
55
|
...parameters,
|
|
@@ -53,5 +57,7 @@ export const createStackupPaymasterClient = <
|
|
|
53
57
|
name,
|
|
54
58
|
type: "stackupPaymasterClient"
|
|
55
59
|
})
|
|
56
|
-
return client
|
|
60
|
+
return client
|
|
61
|
+
.extend(bundlerActions(parameters.entryPoint))
|
|
62
|
+
.extend(stackupPaymasterActions<entryPoint>)
|
|
57
63
|
}
|