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
|
@@ -6,55 +6,88 @@ import type {
|
|
|
6
6
|
Prettify,
|
|
7
7
|
UserOperation
|
|
8
8
|
} from "../../types/"
|
|
9
|
+
import type {
|
|
10
|
+
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
11
|
+
EntryPoint,
|
|
12
|
+
GetEntryPointVersion
|
|
13
|
+
} from "../../types/entrypoint"
|
|
9
14
|
import { AccountOrClientNotFoundError, parseAccount } from "../../utils/"
|
|
10
15
|
import { getAction } from "../../utils/getAction"
|
|
11
16
|
import { sendUserOperation as sendUserOperationBundler } from "../bundler/sendUserOperation"
|
|
12
17
|
import {
|
|
13
|
-
type
|
|
18
|
+
type Middleware,
|
|
14
19
|
prepareUserOperationRequest
|
|
15
20
|
} from "./prepareUserOperationRequest"
|
|
16
21
|
|
|
17
22
|
export type SendUserOperationParameters<
|
|
18
|
-
|
|
23
|
+
entryPoint extends EntryPoint,
|
|
24
|
+
TAccount extends SmartAccount<entryPoint> | undefined =
|
|
25
|
+
| SmartAccount<entryPoint>
|
|
26
|
+
| undefined
|
|
19
27
|
> = {
|
|
20
|
-
userOperation:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
userOperation: entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
|
|
29
|
+
? PartialBy<
|
|
30
|
+
UserOperation<"v0.6">,
|
|
31
|
+
| "sender"
|
|
32
|
+
| "nonce"
|
|
33
|
+
| "initCode"
|
|
34
|
+
| "callGasLimit"
|
|
35
|
+
| "verificationGasLimit"
|
|
36
|
+
| "preVerificationGas"
|
|
37
|
+
| "maxFeePerGas"
|
|
38
|
+
| "maxPriorityFeePerGas"
|
|
39
|
+
| "paymasterAndData"
|
|
40
|
+
| "signature"
|
|
41
|
+
>
|
|
42
|
+
: PartialBy<
|
|
43
|
+
UserOperation<"v0.7">,
|
|
44
|
+
| "sender"
|
|
45
|
+
| "nonce"
|
|
46
|
+
| "factory"
|
|
47
|
+
| "factoryData"
|
|
48
|
+
| "callGasLimit"
|
|
49
|
+
| "verificationGasLimit"
|
|
50
|
+
| "preVerificationGas"
|
|
51
|
+
| "maxFeePerGas"
|
|
52
|
+
| "maxPriorityFeePerGas"
|
|
53
|
+
| "paymaster"
|
|
54
|
+
| "paymasterVerificationGasLimit"
|
|
55
|
+
| "paymasterPostOpGasLimit"
|
|
56
|
+
| "paymasterData"
|
|
57
|
+
| "signature"
|
|
58
|
+
>
|
|
59
|
+
} & GetAccountParameter<entryPoint, TAccount> &
|
|
60
|
+
Middleware<entryPoint>
|
|
35
61
|
|
|
36
62
|
export async function sendUserOperation<
|
|
63
|
+
entryPoint extends EntryPoint,
|
|
37
64
|
TTransport extends Transport = Transport,
|
|
38
65
|
TChain extends Chain | undefined = Chain | undefined,
|
|
39
|
-
TAccount extends SmartAccount | undefined =
|
|
66
|
+
TAccount extends SmartAccount<entryPoint> | undefined =
|
|
67
|
+
| SmartAccount<entryPoint>
|
|
68
|
+
| undefined
|
|
40
69
|
>(
|
|
41
70
|
client: Client<TTransport, TChain, TAccount>,
|
|
42
|
-
args: Prettify<SendUserOperationParameters<TAccount>>
|
|
71
|
+
args: Prettify<SendUserOperationParameters<entryPoint, TAccount>>
|
|
43
72
|
): Promise<Hash> {
|
|
44
73
|
const { account: account_ = client.account } = args
|
|
45
74
|
if (!account_) throw new AccountOrClientNotFoundError()
|
|
46
75
|
|
|
47
|
-
const account = parseAccount(account_) as SmartAccount
|
|
76
|
+
const account = parseAccount(account_) as SmartAccount<entryPoint>
|
|
48
77
|
|
|
49
78
|
const userOperation = await getAction(
|
|
50
79
|
client,
|
|
51
|
-
prepareUserOperationRequest
|
|
80
|
+
prepareUserOperationRequest<entryPoint, TTransport, TChain, TAccount>
|
|
52
81
|
)(args)
|
|
53
82
|
|
|
54
|
-
userOperation.signature = await account.signUserOperation(
|
|
83
|
+
userOperation.signature = await account.signUserOperation(
|
|
84
|
+
userOperation as UserOperation<GetEntryPointVersion<entryPoint>>
|
|
85
|
+
)
|
|
55
86
|
|
|
56
87
|
return sendUserOperationBundler(client, {
|
|
57
|
-
userOperation: userOperation
|
|
88
|
+
userOperation: userOperation as UserOperation<
|
|
89
|
+
GetEntryPointVersion<entryPoint>
|
|
90
|
+
>,
|
|
58
91
|
entryPoint: account.entryPoint
|
|
59
92
|
})
|
|
60
93
|
}
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
Transport
|
|
7
7
|
} from "viem"
|
|
8
8
|
import { type SmartAccount } from "../../accounts/types"
|
|
9
|
+
import type { EntryPoint } from "../../types/entrypoint"
|
|
9
10
|
import { AccountOrClientNotFoundError, parseAccount } from "../../utils/"
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -55,8 +56,9 @@ import { AccountOrClientNotFoundError, parseAccount } from "../../utils/"
|
|
|
55
56
|
* })
|
|
56
57
|
*/
|
|
57
58
|
export async function signMessage<
|
|
59
|
+
entryPoint extends EntryPoint,
|
|
58
60
|
TChain extends Chain | undefined,
|
|
59
|
-
TAccount extends SmartAccount | undefined
|
|
61
|
+
TAccount extends SmartAccount<entryPoint> | undefined
|
|
60
62
|
>(
|
|
61
63
|
client: Client<Transport, TChain, TAccount>,
|
|
62
64
|
{
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
validateTypedData
|
|
11
11
|
} from "viem"
|
|
12
12
|
import { type SmartAccount } from "../../accounts/types"
|
|
13
|
+
import type { EntryPoint } from "../../types/entrypoint"
|
|
13
14
|
import { AccountOrClientNotFoundError, parseAccount } from "../../utils/"
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -111,10 +112,11 @@ import { AccountOrClientNotFoundError, parseAccount } from "../../utils/"
|
|
|
111
112
|
* })
|
|
112
113
|
*/
|
|
113
114
|
export async function signTypedData<
|
|
115
|
+
entryPoint extends EntryPoint,
|
|
114
116
|
const TTypedData extends TypedData | { [key: string]: unknown },
|
|
115
117
|
TPrimaryType extends string,
|
|
116
118
|
TChain extends Chain | undefined,
|
|
117
|
-
TAccount extends SmartAccount | undefined
|
|
119
|
+
TAccount extends SmartAccount<entryPoint> | undefined
|
|
118
120
|
>(
|
|
119
121
|
client: Client<Transport, TChain, TAccount>,
|
|
120
122
|
{
|
|
@@ -11,8 +11,9 @@ import {
|
|
|
11
11
|
encodeFunctionData
|
|
12
12
|
} from "viem"
|
|
13
13
|
import { type SmartAccount } from "../../accounts/types"
|
|
14
|
+
import type { EntryPoint } from "../../types/entrypoint"
|
|
14
15
|
import { getAction } from "../../utils/getAction"
|
|
15
|
-
import { type
|
|
16
|
+
import { type Middleware } from "./prepareUserOperationRequest"
|
|
16
17
|
import {
|
|
17
18
|
type SendTransactionWithPaymasterParameters,
|
|
18
19
|
sendTransaction
|
|
@@ -70,8 +71,11 @@ import {
|
|
|
70
71
|
* const hash = await writeContract(client, request)
|
|
71
72
|
*/
|
|
72
73
|
export type WriteContractWithPaymasterParameters<
|
|
74
|
+
entryPoint extends EntryPoint,
|
|
73
75
|
TChain extends Chain | undefined = Chain | undefined,
|
|
74
|
-
TAccount extends SmartAccount | undefined =
|
|
76
|
+
TAccount extends SmartAccount<entryPoint> | undefined =
|
|
77
|
+
| SmartAccount<entryPoint>
|
|
78
|
+
| undefined,
|
|
75
79
|
TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[],
|
|
76
80
|
TFunctionName extends ContractFunctionName<
|
|
77
81
|
TAbi,
|
|
@@ -91,11 +95,12 @@ export type WriteContractWithPaymasterParameters<
|
|
|
91
95
|
TAccount,
|
|
92
96
|
TChainOverride
|
|
93
97
|
> &
|
|
94
|
-
|
|
98
|
+
Middleware<entryPoint>
|
|
95
99
|
|
|
96
100
|
export async function writeContract<
|
|
101
|
+
entryPoint extends EntryPoint,
|
|
97
102
|
TChain extends Chain | undefined,
|
|
98
|
-
TAccount extends SmartAccount | undefined,
|
|
103
|
+
TAccount extends SmartAccount<entryPoint> | undefined,
|
|
99
104
|
const TAbi extends Abi | readonly unknown[],
|
|
100
105
|
TFunctionName extends ContractFunctionName<
|
|
101
106
|
TAbi,
|
|
@@ -117,6 +122,7 @@ export async function writeContract<
|
|
|
117
122
|
functionName,
|
|
118
123
|
...request
|
|
119
124
|
}: WriteContractWithPaymasterParameters<
|
|
125
|
+
entryPoint,
|
|
120
126
|
TChain,
|
|
121
127
|
TAccount,
|
|
122
128
|
TAbi,
|
|
@@ -132,12 +138,13 @@ export async function writeContract<
|
|
|
132
138
|
} as EncodeFunctionDataParameters<TAbi, TFunctionName>)
|
|
133
139
|
const hash = await getAction(
|
|
134
140
|
client,
|
|
135
|
-
sendTransaction<TChain, TAccount, TChainOverride>
|
|
141
|
+
sendTransaction<TChain, TAccount, entryPoint, TChainOverride>
|
|
136
142
|
)({
|
|
137
143
|
data: `${data}${dataSuffix ? dataSuffix.replace("0x", "") : ""}`,
|
|
138
144
|
to: address,
|
|
139
145
|
...request
|
|
140
146
|
} as unknown as SendTransactionWithPaymasterParameters<
|
|
147
|
+
entryPoint,
|
|
141
148
|
TChain,
|
|
142
149
|
TAccount,
|
|
143
150
|
TChainOverride
|
package/actions/smartAccount.ts
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
} from "./smartAccount/deployContract"
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
+
type Middleware,
|
|
7
8
|
type PrepareUserOperationRequestParameters,
|
|
8
9
|
type PrepareUserOperationRequestReturnType,
|
|
9
|
-
type SponsorUserOperationMiddleware,
|
|
10
10
|
prepareUserOperationRequest
|
|
11
11
|
} from "./smartAccount/prepareUserOperationRequest"
|
|
12
12
|
|
|
@@ -46,7 +46,7 @@ export {
|
|
|
46
46
|
signMessage,
|
|
47
47
|
signTypedData,
|
|
48
48
|
type SendTransactionWithPaymasterParameters,
|
|
49
|
-
type
|
|
49
|
+
type Middleware,
|
|
50
50
|
sendTransactions,
|
|
51
51
|
type SendTransactionsWithPaymasterParameters,
|
|
52
52
|
type WriteContractWithPaymasterParameters,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Address } from "viem"
|
|
2
2
|
import type { StackupPaymasterClient } from "../../clients/stackup"
|
|
3
|
+
import type { EntryPoint } from "../../types"
|
|
3
4
|
|
|
4
|
-
export type AccountsParameters = {
|
|
5
|
-
entryPoint:
|
|
5
|
+
export type AccountsParameters<entryPoint extends EntryPoint> = {
|
|
6
|
+
entryPoint: entryPoint
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -27,13 +28,13 @@ export type AccountsParameters = {
|
|
|
27
28
|
* }})
|
|
28
29
|
*
|
|
29
30
|
*/
|
|
30
|
-
export const accounts = async (
|
|
31
|
-
client: StackupPaymasterClient
|
|
32
|
-
{ entryPoint }: AccountsParameters
|
|
31
|
+
export const accounts = async <entryPoint extends EntryPoint>(
|
|
32
|
+
client: StackupPaymasterClient<entryPoint>,
|
|
33
|
+
{ entryPoint: entryPointAddress }: AccountsParameters<entryPoint>
|
|
33
34
|
): Promise<Address[]> => {
|
|
34
35
|
const response = await client.request({
|
|
35
36
|
method: "pm_accounts",
|
|
36
|
-
params: [
|
|
37
|
+
params: [entryPointAddress]
|
|
37
38
|
})
|
|
38
39
|
|
|
39
40
|
return response
|
|
@@ -1,26 +1,52 @@
|
|
|
1
|
-
import type { Address } from "viem"
|
|
1
|
+
import type { Address, Hex } from "viem"
|
|
2
2
|
import type { PartialBy } from "viem/types/utils"
|
|
3
3
|
import { type StackupPaymasterClient } from "../../clients/stackup"
|
|
4
|
-
import type { StackupPaymasterContext } from "../../types/stackup"
|
|
5
4
|
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "../../types/
|
|
5
|
+
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
6
|
+
EntryPoint
|
|
7
|
+
} from "../../types/entrypoint"
|
|
8
|
+
import type { StackupPaymasterContext } from "../../types/stackup"
|
|
9
|
+
import type { UserOperation } from "../../types/userOperation"
|
|
9
10
|
import { deepHexlify } from "../../utils/deepHexlify"
|
|
11
|
+
import { ENTRYPOINT_ADDRESS_V06 } from "../../utils/getEntryPointVersion"
|
|
10
12
|
|
|
11
|
-
export type SponsorUserOperationParameters = {
|
|
12
|
-
userOperation:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
export type SponsorUserOperationParameters<entryPoint extends EntryPoint> = {
|
|
14
|
+
userOperation: entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
|
|
15
|
+
? PartialBy<
|
|
16
|
+
UserOperation<"v0.6">,
|
|
17
|
+
"callGasLimit" | "preVerificationGas" | "verificationGasLimit"
|
|
18
|
+
>
|
|
19
|
+
: PartialBy<
|
|
20
|
+
UserOperation<"v0.7">,
|
|
21
|
+
| "callGasLimit"
|
|
22
|
+
| "preVerificationGas"
|
|
23
|
+
| "verificationGasLimit"
|
|
24
|
+
| "paymasterVerificationGasLimit"
|
|
25
|
+
| "paymasterPostOpGasLimit"
|
|
26
|
+
>
|
|
27
|
+
entryPoint: entryPoint
|
|
20
28
|
context: StackupPaymasterContext
|
|
21
29
|
}
|
|
22
30
|
|
|
23
|
-
export type SponsorUserOperationReturnType =
|
|
31
|
+
export type SponsorUserOperationReturnType<entryPoint extends EntryPoint> =
|
|
32
|
+
entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
|
|
33
|
+
? Pick<
|
|
34
|
+
UserOperation<"v0.6">,
|
|
35
|
+
| "callGasLimit"
|
|
36
|
+
| "verificationGasLimit"
|
|
37
|
+
| "preVerificationGas"
|
|
38
|
+
| "paymasterAndData"
|
|
39
|
+
>
|
|
40
|
+
: Pick<
|
|
41
|
+
UserOperation<"v0.7">,
|
|
42
|
+
| "callGasLimit"
|
|
43
|
+
| "verificationGasLimit"
|
|
44
|
+
| "preVerificationGas"
|
|
45
|
+
| "paymaster"
|
|
46
|
+
| "paymasterVerificationGasLimit"
|
|
47
|
+
| "paymasterPostOpGasLimit"
|
|
48
|
+
| "paymasterData"
|
|
49
|
+
>
|
|
24
50
|
|
|
25
51
|
/**
|
|
26
52
|
* Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
|
|
@@ -47,26 +73,54 @@ export type SponsorUserOperationReturnType = UserOperation
|
|
|
47
73
|
* }})
|
|
48
74
|
*
|
|
49
75
|
*/
|
|
50
|
-
export const sponsorUserOperation = async (
|
|
51
|
-
client: StackupPaymasterClient
|
|
52
|
-
args: SponsorUserOperationParameters
|
|
53
|
-
): Promise<SponsorUserOperationReturnType
|
|
76
|
+
export const sponsorUserOperation = async <entryPoint extends EntryPoint>(
|
|
77
|
+
client: StackupPaymasterClient<entryPoint>,
|
|
78
|
+
args: SponsorUserOperationParameters<entryPoint>
|
|
79
|
+
): Promise<SponsorUserOperationReturnType<entryPoint>> => {
|
|
54
80
|
const response = await client.request({
|
|
55
81
|
method: "pm_sponsorUserOperation",
|
|
56
|
-
params: [
|
|
57
|
-
deepHexlify(args.userOperation) as UserOperationWithBigIntAsHex,
|
|
58
|
-
args.entryPoint,
|
|
59
|
-
args.context
|
|
60
|
-
]
|
|
82
|
+
params: [deepHexlify(args.userOperation), args.entryPoint, args.context]
|
|
61
83
|
})
|
|
62
84
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
85
|
+
if (args.entryPoint === ENTRYPOINT_ADDRESS_V06) {
|
|
86
|
+
const responseV06 = response as {
|
|
87
|
+
paymasterAndData: Hex
|
|
88
|
+
preVerificationGas: Hex
|
|
89
|
+
verificationGasLimit: Hex
|
|
90
|
+
callGasLimit: Hex
|
|
91
|
+
paymaster?: never
|
|
92
|
+
paymasterVerificationGasLimit?: never
|
|
93
|
+
paymasterPostOpGasLimit?: never
|
|
94
|
+
paymasterData?: never
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
paymasterAndData: responseV06.paymasterAndData,
|
|
98
|
+
preVerificationGas: BigInt(responseV06.preVerificationGas),
|
|
99
|
+
verificationGasLimit: BigInt(responseV06.verificationGasLimit),
|
|
100
|
+
callGasLimit: BigInt(responseV06.callGasLimit)
|
|
101
|
+
} as SponsorUserOperationReturnType<entryPoint>
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const responseV07 = response as {
|
|
105
|
+
preVerificationGas: Hex
|
|
106
|
+
verificationGasLimit: Hex
|
|
107
|
+
callGasLimit: Hex
|
|
108
|
+
paymaster: Address
|
|
109
|
+
paymasterVerificationGasLimit: Hex
|
|
110
|
+
paymasterPostOpGasLimit: Hex
|
|
111
|
+
paymasterData: Hex
|
|
112
|
+
paymasterAndData?: never
|
|
69
113
|
}
|
|
70
114
|
|
|
71
|
-
return
|
|
115
|
+
return {
|
|
116
|
+
callGasLimit: BigInt(responseV07.callGasLimit),
|
|
117
|
+
verificationGasLimit: BigInt(responseV07.verificationGasLimit),
|
|
118
|
+
preVerificationGas: BigInt(responseV07.preVerificationGas),
|
|
119
|
+
paymaster: responseV07.paymaster,
|
|
120
|
+
paymasterVerificationGasLimit: BigInt(
|
|
121
|
+
responseV07.paymasterVerificationGasLimit
|
|
122
|
+
),
|
|
123
|
+
paymasterPostOpGasLimit: BigInt(responseV07.paymasterPostOpGasLimit),
|
|
124
|
+
paymasterData: responseV07.paymasterData
|
|
125
|
+
} as SponsorUserOperationReturnType<entryPoint>
|
|
72
126
|
}
|
|
@@ -7,16 +7,18 @@ import type {
|
|
|
7
7
|
} from "viem"
|
|
8
8
|
import { createClient } from "viem"
|
|
9
9
|
import type { BundlerRpcSchema } from "../types/bundler"
|
|
10
|
+
import type { EntryPoint } from "../types/entrypoint"
|
|
10
11
|
import { type BundlerActions, bundlerActions } from "./decorators/bundler"
|
|
11
12
|
|
|
12
13
|
export type BundlerClient<
|
|
14
|
+
entryPoint extends EntryPoint,
|
|
13
15
|
TChain extends Chain | undefined = Chain | undefined
|
|
14
16
|
> = Client<
|
|
15
17
|
Transport,
|
|
16
18
|
TChain,
|
|
17
19
|
Account | undefined,
|
|
18
|
-
BundlerRpcSchema
|
|
19
|
-
BundlerActions
|
|
20
|
+
BundlerRpcSchema<entryPoint>,
|
|
21
|
+
BundlerActions<entryPoint>
|
|
20
22
|
>
|
|
21
23
|
/**
|
|
22
24
|
* Creates a EIP-4337 compliant Bundler Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
|
|
@@ -38,11 +40,14 @@ export type BundlerClient<
|
|
|
38
40
|
* })
|
|
39
41
|
*/
|
|
40
42
|
export const createBundlerClient = <
|
|
41
|
-
|
|
43
|
+
entryPoint extends EntryPoint,
|
|
44
|
+
transport extends Transport = Transport,
|
|
42
45
|
chain extends Chain | undefined = undefined
|
|
43
46
|
>(
|
|
44
|
-
parameters: PublicClientConfig<transport, chain>
|
|
45
|
-
|
|
47
|
+
parameters: PublicClientConfig<transport, chain> & {
|
|
48
|
+
entryPoint: entryPoint
|
|
49
|
+
}
|
|
50
|
+
): BundlerClient<entryPoint> => {
|
|
46
51
|
const { key = "public", name = "Bundler Client" } = parameters
|
|
47
52
|
const client = createClient({
|
|
48
53
|
...parameters,
|
|
@@ -50,5 +55,5 @@ export const createBundlerClient = <
|
|
|
50
55
|
name,
|
|
51
56
|
type: "bundlerClient"
|
|
52
57
|
})
|
|
53
|
-
return client.extend(bundlerActions)
|
|
58
|
+
return client.extend(bundlerActions(parameters.entryPoint))
|
|
54
59
|
}
|
|
@@ -7,9 +7,10 @@ import type {
|
|
|
7
7
|
} from "viem"
|
|
8
8
|
import { createClient } from "viem"
|
|
9
9
|
import { type SmartAccount } from "../accounts/types"
|
|
10
|
-
import { type
|
|
10
|
+
import { type Middleware } from "../actions/smartAccount/prepareUserOperationRequest"
|
|
11
11
|
import type { Prettify } from "../types/"
|
|
12
12
|
import { type BundlerRpcSchema } from "../types/bundler"
|
|
13
|
+
import type { EntryPoint } from "../types/entrypoint"
|
|
13
14
|
import {
|
|
14
15
|
type SmartAccountActions,
|
|
15
16
|
smartAccountActions
|
|
@@ -21,30 +22,39 @@ import {
|
|
|
21
22
|
* - Fix typing, 'accounts' is required to signMessage, signTypedData, signTransaction, but not needed here, since account is embedded in the client
|
|
22
23
|
*/
|
|
23
24
|
export type SmartAccountClient<
|
|
25
|
+
entryPoint extends EntryPoint,
|
|
24
26
|
transport extends Transport = Transport,
|
|
25
27
|
chain extends Chain | undefined = Chain | undefined,
|
|
26
|
-
account extends SmartAccount | undefined =
|
|
28
|
+
account extends SmartAccount<entryPoint> | undefined =
|
|
29
|
+
| SmartAccount<entryPoint>
|
|
30
|
+
| undefined
|
|
27
31
|
> = Prettify<
|
|
28
32
|
Client<
|
|
29
33
|
transport,
|
|
30
34
|
chain,
|
|
31
35
|
account,
|
|
32
|
-
BundlerRpcSchema
|
|
33
|
-
SmartAccountActions<chain, account>
|
|
36
|
+
BundlerRpcSchema<entryPoint>,
|
|
37
|
+
SmartAccountActions<entryPoint, chain, account>
|
|
34
38
|
>
|
|
35
39
|
>
|
|
36
40
|
|
|
37
41
|
export type SmartAccountClientConfig<
|
|
42
|
+
entryPoint extends EntryPoint,
|
|
38
43
|
transport extends Transport = Transport,
|
|
39
44
|
chain extends Chain | undefined = Chain | undefined,
|
|
40
|
-
account extends SmartAccount | undefined =
|
|
45
|
+
account extends SmartAccount<entryPoint> | undefined =
|
|
46
|
+
| SmartAccount<entryPoint>
|
|
47
|
+
| undefined
|
|
41
48
|
> = Prettify<
|
|
42
49
|
Pick<
|
|
43
50
|
ClientConfig<transport, chain, account>,
|
|
44
|
-
"cacheTime" | "chain" | "key" | "name" | "pollingInterval"
|
|
51
|
+
"cacheTime" | "chain" | "key" | "name" | "pollingInterval"
|
|
45
52
|
> & {
|
|
46
53
|
account?: account
|
|
47
|
-
|
|
54
|
+
bundlerTransport: Transport
|
|
55
|
+
} & Middleware<entryPoint> & {
|
|
56
|
+
entryPoint: entryPoint
|
|
57
|
+
}
|
|
48
58
|
>
|
|
49
59
|
|
|
50
60
|
/**
|
|
@@ -68,32 +78,36 @@ export type SmartAccountClientConfig<
|
|
|
68
78
|
*/
|
|
69
79
|
|
|
70
80
|
export function createSmartAccountClient<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
entryPoint extends EntryPoint,
|
|
82
|
+
TSmartAccount extends SmartAccount<entryPoint> | undefined =
|
|
83
|
+
| SmartAccount<entryPoint>
|
|
84
|
+
| undefined,
|
|
85
|
+
TTransport extends Transport = Transport,
|
|
86
|
+
TChain extends Chain | undefined = undefined
|
|
74
87
|
>(
|
|
75
|
-
parameters: SmartAccountClientConfig<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
88
|
+
parameters: SmartAccountClientConfig<
|
|
89
|
+
entryPoint,
|
|
90
|
+
TTransport,
|
|
91
|
+
TChain,
|
|
92
|
+
TSmartAccount
|
|
93
|
+
>
|
|
94
|
+
): SmartAccountClient<entryPoint, TTransport, TChain, TSmartAccount> {
|
|
81
95
|
const {
|
|
82
96
|
key = "Account",
|
|
83
97
|
name = "Smart Account Client",
|
|
84
|
-
|
|
98
|
+
bundlerTransport
|
|
85
99
|
} = parameters
|
|
86
100
|
const client = createClient({
|
|
87
101
|
...parameters,
|
|
88
102
|
key,
|
|
89
103
|
name,
|
|
90
|
-
transport:
|
|
104
|
+
transport: bundlerTransport,
|
|
91
105
|
type: "smartAccountClient"
|
|
92
106
|
})
|
|
93
107
|
|
|
94
108
|
return client.extend(
|
|
95
109
|
smartAccountActions({
|
|
96
|
-
|
|
110
|
+
middleware: parameters.middleware
|
|
97
111
|
})
|
|
98
|
-
)
|
|
112
|
+
) as SmartAccountClient<entryPoint, TTransport, TChain, TSmartAccount>
|
|
99
113
|
}
|