@aa-sdk/core 4.0.0-alpha.4 → 4.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/account/smartContractAccount.d.ts +9 -3
- package/dist/cjs/account/smartContractAccount.js +11 -6
- package/dist/cjs/account/smartContractAccount.js.map +1 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
- package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/cjs/client/bundlerClient.js.map +1 -1
- package/dist/cjs/client/decorators/bundlerClient.js.map +1 -1
- package/dist/cjs/client/isSmartAccountClient.js.map +1 -1
- package/dist/cjs/client/types.d.ts +2 -7
- package/dist/cjs/client/types.js.map +1 -1
- package/dist/cjs/errors/account.js.map +1 -1
- package/dist/cjs/errors/client.js.map +1 -1
- package/dist/cjs/errors/entrypoint.js.map +1 -1
- package/dist/cjs/errors/signer.js.map +1 -1
- package/dist/cjs/errors/transaction.js.map +1 -1
- package/dist/cjs/errors/useroperation.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -5
- package/dist/cjs/index.js +6 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logger.js.map +1 -1
- package/dist/cjs/middleware/actions.js +2 -18
- package/dist/cjs/middleware/actions.js.map +1 -1
- package/dist/cjs/middleware/defaults/gasEstimator.js +3 -2
- package/dist/cjs/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/cjs/middleware/erc7677middleware.d.ts +40 -0
- package/dist/cjs/middleware/erc7677middleware.js +77 -0
- package/dist/cjs/middleware/erc7677middleware.js.map +1 -0
- package/dist/cjs/middleware/noopMiddleware.d.ts +2 -1
- package/dist/cjs/middleware/noopMiddleware.js.map +1 -1
- package/dist/cjs/middleware/types.d.ts +3 -2
- package/dist/cjs/middleware/types.js.map +1 -1
- package/dist/cjs/signer/local-account.d.ts +46 -46
- package/dist/cjs/signer/local-account.js.map +1 -1
- package/dist/cjs/signer/wallet-client.d.ts +46 -46
- package/dist/cjs/signer/wallet-client.js.map +1 -1
- package/dist/cjs/transport/split.js.map +1 -1
- package/dist/cjs/utils/bigint.js.map +1 -1
- package/dist/cjs/utils/bytes.js.map +1 -1
- package/dist/cjs/utils/defaults.d.ts +1 -3
- package/dist/cjs/utils/defaults.js +1 -41
- package/dist/cjs/utils/defaults.js.map +1 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/types.js.map +1 -1
- package/dist/cjs/utils/userop.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/account/smartContractAccount.d.ts +9 -3
- package/dist/esm/account/smartContractAccount.js +6 -1
- package/dist/esm/account/smartContractAccount.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/esm/client/bundlerClient.js.map +1 -1
- package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
- package/dist/esm/client/isSmartAccountClient.js.map +1 -1
- package/dist/esm/client/types.d.ts +2 -7
- package/dist/esm/client/types.js.map +1 -1
- package/dist/esm/errors/account.js.map +1 -1
- package/dist/esm/errors/client.js.map +1 -1
- package/dist/esm/errors/entrypoint.js.map +1 -1
- package/dist/esm/errors/signer.js.map +1 -1
- package/dist/esm/errors/transaction.js.map +1 -1
- package/dist/esm/errors/useroperation.js.map +1 -1
- package/dist/esm/index.d.ts +3 -5
- package/dist/esm/index.js +2 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/middleware/actions.js +3 -18
- package/dist/esm/middleware/actions.js.map +1 -1
- package/dist/esm/middleware/defaults/gasEstimator.js +3 -2
- package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/esm/middleware/erc7677middleware.d.ts +40 -0
- package/dist/esm/middleware/erc7677middleware.js +73 -0
- package/dist/esm/middleware/erc7677middleware.js.map +1 -0
- package/dist/esm/middleware/noopMiddleware.d.ts +2 -1
- package/dist/esm/middleware/noopMiddleware.js.map +1 -1
- package/dist/esm/middleware/types.d.ts +3 -2
- package/dist/esm/middleware/types.js.map +1 -1
- package/dist/esm/signer/local-account.d.ts +46 -46
- package/dist/esm/signer/local-account.js.map +1 -1
- package/dist/esm/signer/wallet-client.d.ts +46 -46
- package/dist/esm/signer/wallet-client.js.map +1 -1
- package/dist/esm/transport/split.js.map +1 -1
- package/dist/esm/utils/bigint.js.map +1 -1
- package/dist/esm/utils/bytes.js.map +1 -1
- package/dist/esm/utils/defaults.d.ts +1 -3
- package/dist/esm/utils/defaults.js +1 -40
- package/dist/esm/utils/defaults.js.map +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/types.js.map +1 -1
- package/dist/esm/utils/userop.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/account/smartContractAccount.d.ts +17 -11
- package/dist/types/account/smartContractAccount.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts +33 -33
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts +43 -59
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +18 -18
- package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts +3 -3
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts +3 -4
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts +0 -14
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts +0 -7
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts +17 -3
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
- package/dist/types/client/bundlerClient.d.ts +2 -2
- package/dist/types/client/decorators/bundlerClient.d.ts +8 -8
- package/dist/types/client/isSmartAccountClient.d.ts +4 -4
- package/dist/types/client/types.d.ts +2 -7
- package/dist/types/client/types.d.ts.map +1 -1
- package/dist/types/errors/account.d.ts +53 -4
- package/dist/types/errors/account.d.ts.map +1 -1
- package/dist/types/errors/client.d.ts +15 -0
- package/dist/types/errors/client.d.ts.map +1 -1
- package/dist/types/errors/entrypoint.d.ts +12 -0
- package/dist/types/errors/entrypoint.d.ts.map +1 -1
- package/dist/types/errors/signer.d.ts +5 -0
- package/dist/types/errors/signer.d.ts.map +1 -1
- package/dist/types/errors/transaction.d.ts +8 -1
- package/dist/types/errors/transaction.d.ts.map +1 -1
- package/dist/types/errors/useroperation.d.ts +5 -5
- package/dist/types/errors/useroperation.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logger.d.ts +88 -0
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/middleware/actions.d.ts +3 -3
- package/dist/types/middleware/actions.d.ts.map +1 -1
- package/dist/types/middleware/defaults/gasEstimator.d.ts +2 -2
- package/dist/types/middleware/defaults/gasEstimator.d.ts.map +1 -1
- package/dist/types/middleware/erc7677middleware.d.ts +62 -0
- package/dist/types/middleware/erc7677middleware.d.ts.map +1 -0
- package/dist/types/middleware/noopMiddleware.d.ts +4 -4
- package/dist/types/middleware/noopMiddleware.d.ts.map +1 -1
- package/dist/types/middleware/types.d.ts +3 -2
- package/dist/types/middleware/types.d.ts.map +1 -1
- package/dist/types/signer/local-account.d.ts +139 -47
- package/dist/types/signer/local-account.d.ts.map +1 -1
- package/dist/types/signer/wallet-client.d.ts +135 -46
- package/dist/types/signer/wallet-client.d.ts.map +1 -1
- package/dist/types/transport/split.d.ts +2 -2
- package/dist/types/utils/bigint.d.ts +14 -14
- package/dist/types/utils/bigint.d.ts.map +1 -1
- package/dist/types/utils/bytes.d.ts +5 -5
- package/dist/types/utils/defaults.d.ts +1 -11
- package/dist/types/utils/defaults.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +12 -12
- package/dist/types/utils/types.d.ts +2 -2
- package/dist/types/utils/userop.d.ts +33 -33
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -2
- package/src/account/smartContractAccount.ts +19 -12
- package/src/actions/smartAccount/buildUserOperationFromTx.ts +35 -35
- package/src/actions/smartAccount/buildUserOperationFromTxs.ts +44 -60
- package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +19 -19
- package/src/actions/smartAccount/estimateUserOperationGas.ts +3 -3
- package/src/actions/smartAccount/internal/initUserOperation.ts +3 -4
- package/src/actions/smartAccount/internal/runMiddlewareStack.ts +0 -22
- package/src/actions/smartAccount/internal/sendUserOperation.ts +0 -7
- package/src/actions/smartAccount/sendUserOperation.ts +17 -3
- package/src/client/bundlerClient.ts +2 -2
- package/src/client/decorators/bundlerClient.ts +8 -8
- package/src/client/isSmartAccountClient.ts +4 -4
- package/src/client/types.ts +2 -15
- package/src/errors/account.ts +64 -4
- package/src/errors/client.ts +18 -0
- package/src/errors/entrypoint.ts +12 -0
- package/src/errors/signer.ts +6 -0
- package/src/errors/transaction.ts +10 -1
- package/src/errors/useroperation.ts +5 -6
- package/src/index.ts +2 -8
- package/src/logger.ts +88 -0
- package/src/middleware/actions.ts +6 -27
- package/src/middleware/defaults/gasEstimator.ts +8 -5
- package/src/middleware/erc7677middleware.ts +201 -0
- package/src/middleware/noopMiddleware.ts +6 -4
- package/src/middleware/types.ts +16 -7
- package/src/signer/local-account.ts +94 -2
- package/src/signer/wallet-client.ts +89 -0
- package/src/transport/split.ts +2 -2
- package/src/utils/bigint.ts +15 -15
- package/src/utils/bytes.ts +5 -5
- package/src/utils/defaults.ts +2 -74
- package/src/utils/index.ts +12 -12
- package/src/utils/types.ts +2 -2
- package/src/utils/userop.ts +33 -33
- package/src/version.ts +1 -1
- package/dist/cjs/account/base.d.ts +0 -49
- package/dist/cjs/account/base.js +0 -257
- package/dist/cjs/account/base.js.map +0 -1
- package/dist/cjs/account/schema.d.ts +0 -100
- package/dist/cjs/account/schema.js +0 -43
- package/dist/cjs/account/schema.js.map +0 -1
- package/dist/cjs/account/simple.d.ts +0 -14
- package/dist/cjs/account/simple.js +0 -119
- package/dist/cjs/account/simple.js.map +0 -1
- package/dist/cjs/account/types.d.ts +0 -30
- package/dist/cjs/account/types.js +0 -3
- package/dist/cjs/account/types.js.map +0 -1
- package/dist/esm/account/base.d.ts +0 -49
- package/dist/esm/account/base.js +0 -253
- package/dist/esm/account/base.js.map +0 -1
- package/dist/esm/account/schema.d.ts +0 -100
- package/dist/esm/account/schema.js +0 -35
- package/dist/esm/account/schema.js.map +0 -1
- package/dist/esm/account/simple.d.ts +0 -14
- package/dist/esm/account/simple.js +0 -115
- package/dist/esm/account/simple.js.map +0 -1
- package/dist/esm/account/types.d.ts +0 -30
- package/dist/esm/account/types.js +0 -2
- package/dist/esm/account/types.js.map +0 -1
- package/dist/types/account/base.d.ts +0 -128
- package/dist/types/account/base.d.ts.map +0 -1
- package/dist/types/account/schema.d.ts +0 -101
- package/dist/types/account/schema.d.ts.map +0 -1
- package/dist/types/account/simple.d.ts +0 -15
- package/dist/types/account/simple.d.ts.map +0 -1
- package/dist/types/account/types.d.ts +0 -144
- package/dist/types/account/types.d.ts.map +0 -1
- package/src/account/base.ts +0 -415
- package/src/account/schema.ts +0 -51
- package/src/account/simple.ts +0 -221
- package/src/account/types.ts +0 -184
|
@@ -55,10 +55,10 @@ export type BundlerActions = {
|
|
|
55
55
|
/**
|
|
56
56
|
* calls `eth_estimateUserOperationGas` and returns the result
|
|
57
57
|
*
|
|
58
|
-
* @param request - the
|
|
58
|
+
* @param request - the UserOperationRequest to estimate gas for
|
|
59
59
|
* @param entryPoint - the entry point address the op will be sent to
|
|
60
60
|
* @param stateOverride - the state override to use for the estimation
|
|
61
|
-
* @returns the gas estimates for the given response
|
|
61
|
+
* @returns the gas estimates for the given response
|
|
62
62
|
*/
|
|
63
63
|
estimateUserOperationGas<
|
|
64
64
|
TEntryPointVersion extends EntryPointVersion = EntryPointVersion
|
|
@@ -71,7 +71,7 @@ export type BundlerActions = {
|
|
|
71
71
|
/**
|
|
72
72
|
* calls `eth_sendUserOperation` and returns the hash of the sent UserOperation
|
|
73
73
|
*
|
|
74
|
-
* @param request - the
|
|
74
|
+
* @param request - the UserOperationRequest to send
|
|
75
75
|
* @param entryPoint - the entry point address the op will be sent to
|
|
76
76
|
* @returns the hash of the sent UserOperation
|
|
77
77
|
*/
|
|
@@ -83,25 +83,25 @@ export type BundlerActions = {
|
|
|
83
83
|
): Promise<Hash>;
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* calls `eth_getUserOperationByHash` and returns the
|
|
86
|
+
* calls `eth_getUserOperationByHash` and returns the UserOperationResponse
|
|
87
87
|
*
|
|
88
88
|
* @param hash - the hash of the UserOperation to fetch
|
|
89
|
-
* @returns -
|
|
89
|
+
* @returns - the user operation if found or null
|
|
90
90
|
*/
|
|
91
91
|
getUserOperationByHash(hash: Hash): Promise<UserOperationResponse | null>;
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* calls `eth_getUserOperationReceipt` and returns the
|
|
94
|
+
* calls `eth_getUserOperationReceipt` and returns the UserOperationReceipt
|
|
95
95
|
*
|
|
96
96
|
* @param hash - the hash of the UserOperation to get the receipt for
|
|
97
|
-
* @returns -
|
|
97
|
+
* @returns - a user operation receipt or null if not found
|
|
98
98
|
*/
|
|
99
99
|
getUserOperationReceipt(hash: Hash): Promise<UserOperationReceipt | null>;
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
102
|
* calls `eth_supportedEntryPoints` and returns the entry points the RPC supports
|
|
103
103
|
*
|
|
104
|
-
* @returns -
|
|
104
|
+
* @returns - an array of the entrypoint addresses supported
|
|
105
105
|
*/
|
|
106
106
|
getSupportedEntryPoints(): Promise<Address[]>;
|
|
107
107
|
};
|
|
@@ -11,8 +11,8 @@ import type {
|
|
|
11
11
|
* Useful for narrowing the type of the client down when used within the
|
|
12
12
|
* smart account client decorators
|
|
13
13
|
*
|
|
14
|
-
* @param client a viem client
|
|
15
|
-
* @returns true if the client is a SmartAccountClient
|
|
14
|
+
* @param {Client<TTransport, TChain, TAccount>} client a viem client
|
|
15
|
+
* @returns {boolean} true if the client is a SmartAccountClient
|
|
16
16
|
*/
|
|
17
17
|
export function isSmartAccountClient<
|
|
18
18
|
TTransport extends Transport = Transport,
|
|
@@ -37,8 +37,8 @@ export function isSmartAccountClient<
|
|
|
37
37
|
* Useful for narrowing the type of the client down when used within the
|
|
38
38
|
* smart account action decorators
|
|
39
39
|
*
|
|
40
|
-
* @param client a viem client
|
|
41
|
-
* @returns true if the account is a BaseSmartAccountClient
|
|
40
|
+
* @param {Client<TTransport, TChain, TAccount>} client a viem client
|
|
41
|
+
* @returns {boolean} true if the account is a BaseSmartAccountClient
|
|
42
42
|
*/
|
|
43
43
|
export function isBaseSmartAccountClient<
|
|
44
44
|
TTransport extends Transport = Transport,
|
package/src/client/types.ts
CHANGED
|
@@ -3,10 +3,7 @@ import type { Hash, Hex } from "viem";
|
|
|
3
3
|
import type { z } from "zod";
|
|
4
4
|
import type { UserOperationContext } from "../actions/smartAccount/types.js";
|
|
5
5
|
import type { EntryPointVersion } from "../entrypoint/types.js";
|
|
6
|
-
import type {
|
|
7
|
-
ClientMiddleware,
|
|
8
|
-
ClientMiddlewareFn,
|
|
9
|
-
} from "../middleware/types.js";
|
|
6
|
+
import type { ClientMiddleware } from "../middleware/types.js";
|
|
10
7
|
import type { UserOperationRequest } from "../types.js";
|
|
11
8
|
import type { ConnectionConfigSchema } from "./schema.js";
|
|
12
9
|
|
|
@@ -37,15 +34,5 @@ export type ClientMiddlewareConfig<
|
|
|
37
34
|
TContext extends UserOperationContext | undefined =
|
|
38
35
|
| UserOperationContext
|
|
39
36
|
| undefined
|
|
40
|
-
> =
|
|
41
|
-
Partial<ClientMiddleware<TContext>>,
|
|
42
|
-
"dummyPaymasterAndData" | "paymasterAndData"
|
|
43
|
-
> & {
|
|
44
|
-
paymasterAndData?: {
|
|
45
|
-
dummyPaymasterAndData: () =>
|
|
46
|
-
| UserOperationRequest<"0.6.0">["paymasterAndData"]
|
|
47
|
-
| Pick<UserOperationRequest<"0.7.0">, "paymaster" | "paymasterData">;
|
|
48
|
-
paymasterAndData: ClientMiddlewareFn<TContext>;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
37
|
+
> = Partial<ClientMiddleware<TContext>>;
|
|
51
38
|
// [!endregion ClientMiddlewareConfig]
|
package/src/errors/account.ts
CHANGED
|
@@ -9,7 +9,10 @@ export class AccountNotFoundError extends BaseError {
|
|
|
9
9
|
override name = "AccountNotFoundError";
|
|
10
10
|
|
|
11
11
|
// TODO: extend this further using docs path as well
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Constructor for initializing an error message indicating that an account could not be found to execute the specified action.
|
|
15
|
+
*/ constructor() {
|
|
13
16
|
super("Could not find an Account to execute with this Action.");
|
|
14
17
|
}
|
|
15
18
|
}
|
|
@@ -20,6 +23,14 @@ export class AccountNotFoundError extends BaseError {
|
|
|
20
23
|
*/
|
|
21
24
|
export class DefaultFactoryNotDefinedError extends BaseError {
|
|
22
25
|
override name = "DefaultFactoryNotDefinedError";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} accountType the type of account
|
|
31
|
+
* @param {Chain} chain the blockchain chain
|
|
32
|
+
* @param {EntryPointVersion} version the entry point version
|
|
33
|
+
*/
|
|
23
34
|
constructor(accountType: string, chain: Chain, version: EntryPointVersion) {
|
|
24
35
|
super(
|
|
25
36
|
[
|
|
@@ -35,7 +46,10 @@ export class DefaultFactoryNotDefinedError extends BaseError {
|
|
|
35
46
|
*/
|
|
36
47
|
export class GetCounterFactualAddressError extends BaseError {
|
|
37
48
|
override name = "GetCounterFactualAddressError";
|
|
38
|
-
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Constructor for initializing an error message indicating the failure of fetching the counter-factual address.
|
|
52
|
+
*/ constructor() {
|
|
39
53
|
super("getCounterFactualAddress failed");
|
|
40
54
|
}
|
|
41
55
|
}
|
|
@@ -45,6 +59,12 @@ export class GetCounterFactualAddressError extends BaseError {
|
|
|
45
59
|
*/
|
|
46
60
|
export class UpgradesNotSupportedError extends BaseError {
|
|
47
61
|
override name = "UpgradesNotSupported";
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Error constructor for indicating that upgrades are not supported by the given account type.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} accountType The type of account that does not support upgrades
|
|
67
|
+
*/
|
|
48
68
|
constructor(accountType: string) {
|
|
49
69
|
super(`Upgrades are not supported by ${accountType}`);
|
|
50
70
|
}
|
|
@@ -55,7 +75,12 @@ export class UpgradesNotSupportedError extends BaseError {
|
|
|
55
75
|
*/
|
|
56
76
|
export class SignTransactionNotSupportedError extends BaseError {
|
|
57
77
|
override name = "SignTransactionNotSupported";
|
|
58
|
-
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Throws an error indicating that signing a transaction is not supported by smart contracts.
|
|
81
|
+
*
|
|
82
|
+
|
|
83
|
+
*/ constructor() {
|
|
59
84
|
super(`SignTransaction is not supported by smart contracts`);
|
|
60
85
|
}
|
|
61
86
|
}
|
|
@@ -65,6 +90,13 @@ export class SignTransactionNotSupportedError extends BaseError {
|
|
|
65
90
|
*/
|
|
66
91
|
export class FailedToGetStorageSlotError extends BaseError {
|
|
67
92
|
override name = "FailedToGetStorageSlotError";
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Custom error message constructor for failing to get a specific storage slot.
|
|
96
|
+
*
|
|
97
|
+
* @param {string} slot The storage slot that failed to be accessed or retrieved
|
|
98
|
+
* @param {string} slotDescriptor A description of the storage slot, for additional context in the error message
|
|
99
|
+
*/
|
|
68
100
|
constructor(slot: string, slotDescriptor: string) {
|
|
69
101
|
super(`Failed to get storage slot ${slot} (${slotDescriptor})`);
|
|
70
102
|
}
|
|
@@ -75,6 +107,12 @@ export class FailedToGetStorageSlotError extends BaseError {
|
|
|
75
107
|
*/
|
|
76
108
|
export class BatchExecutionNotSupportedError extends BaseError {
|
|
77
109
|
override name = "BatchExecutionNotSupportedError";
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Constructs an error message indicating that batch execution is not supported by the specified account type.
|
|
113
|
+
*
|
|
114
|
+
* @param {string} accountType the type of account that does not support batch execution
|
|
115
|
+
*/
|
|
78
116
|
constructor(accountType: string) {
|
|
79
117
|
super(`Batch execution is not supported by ${accountType}`);
|
|
80
118
|
}
|
|
@@ -85,6 +123,12 @@ export class BatchExecutionNotSupportedError extends BaseError {
|
|
|
85
123
|
*/
|
|
86
124
|
export class AccountRequiresOwnerError extends BaseError {
|
|
87
125
|
override name = "AccountRequiresOwnerError";
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Constructs an error indicating that an account of the specified type requires an owner to execute.
|
|
129
|
+
*
|
|
130
|
+
* @param {string} accountType The type of account that requires an owner
|
|
131
|
+
*/
|
|
88
132
|
constructor(accountType: string) {
|
|
89
133
|
super(`Account of type ${accountType} requires an owner to execute`);
|
|
90
134
|
}
|
|
@@ -95,6 +139,12 @@ export class AccountRequiresOwnerError extends BaseError {
|
|
|
95
139
|
*/
|
|
96
140
|
export class UpgradeToAndCallNotSupportedError extends BaseError {
|
|
97
141
|
override name = "UpgradeToAndCallNotSupportedError";
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.
|
|
145
|
+
*
|
|
146
|
+
* @param {string} accountType The type of account that does not support `UpgradeToAndCall`
|
|
147
|
+
*/
|
|
98
148
|
constructor(accountType: string) {
|
|
99
149
|
super(`UpgradeToAndCall is not supported by ${accountType}`);
|
|
100
150
|
}
|
|
@@ -105,6 +155,13 @@ export class UpgradeToAndCallNotSupportedError extends BaseError {
|
|
|
105
155
|
*/
|
|
106
156
|
export class IncorrectAccountType extends BaseError {
|
|
107
157
|
override name = "IncorrectAccountTypeError";
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Constructs an error object indicating that the expected account type does not match the actual account type.
|
|
161
|
+
*
|
|
162
|
+
* @param {string} expected the expected account type
|
|
163
|
+
* @param {string} actual the actual account type that was received
|
|
164
|
+
*/
|
|
108
165
|
constructor(expected: string, actual: string) {
|
|
109
166
|
super(`Expected account type ${expected}, got ${actual}`);
|
|
110
167
|
}
|
|
@@ -115,7 +172,10 @@ export class IncorrectAccountType extends BaseError {
|
|
|
115
172
|
*/
|
|
116
173
|
export class SmartAccountWithSignerRequiredError extends BaseError {
|
|
117
174
|
override name = "SmartAccountWithSignerRequiredError";
|
|
118
|
-
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.
|
|
178
|
+
*/ constructor() {
|
|
119
179
|
super("Smart account requires a signer");
|
|
120
180
|
}
|
|
121
181
|
}
|
package/src/errors/client.ts
CHANGED
|
@@ -6,6 +6,14 @@ import { BaseError } from "./base.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export class IncompatibleClientError extends BaseError {
|
|
8
8
|
override name = "IncompatibleClientError";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Throws an error when the client type does not match the expected client type.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} expectedClient The expected type of the client.
|
|
14
|
+
* @param {string} method The method that was called.
|
|
15
|
+
* @param {Client} client The client instance.
|
|
16
|
+
*/
|
|
9
17
|
constructor(expectedClient: string, method: string, client: Client) {
|
|
10
18
|
super(
|
|
11
19
|
[
|
|
@@ -21,6 +29,12 @@ export class IncompatibleClientError extends BaseError {
|
|
|
21
29
|
*/
|
|
22
30
|
export class InvalidRpcUrlError extends BaseError {
|
|
23
31
|
override name = "InvalidRpcUrlError";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates an instance of an error with a message indicating an invalid RPC URL.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} [rpcUrl] The invalid RPC URL that caused the error
|
|
37
|
+
*/
|
|
24
38
|
constructor(rpcUrl?: string) {
|
|
25
39
|
super(`Invalid RPC URL ${rpcUrl}`);
|
|
26
40
|
}
|
|
@@ -31,6 +45,10 @@ export class InvalidRpcUrlError extends BaseError {
|
|
|
31
45
|
*/
|
|
32
46
|
export class ChainNotFoundError extends BaseError {
|
|
33
47
|
override name = "ChainNotFoundError";
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Initializes a new instance of the error message with a default message indicating that no chain was supplied to the client.
|
|
51
|
+
*/
|
|
34
52
|
constructor() {
|
|
35
53
|
super("No chain supplied to the client");
|
|
36
54
|
}
|
package/src/errors/entrypoint.ts
CHANGED
|
@@ -7,6 +7,12 @@ import { BaseError } from "./base.js";
|
|
|
7
7
|
export class EntryPointNotFoundError extends BaseError {
|
|
8
8
|
override name = "EntryPointNotFoundError";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Constructs an error message indicating that no default entry point exists for the given chain and entry point version.
|
|
12
|
+
*
|
|
13
|
+
* @param {Chain} chain The blockchain network for which the entry point is being queried
|
|
14
|
+
* @param {any} entryPointVersion The version of the entry point for which no default exists
|
|
15
|
+
*/
|
|
10
16
|
constructor(chain: Chain, entryPointVersion: any) {
|
|
11
17
|
super(
|
|
12
18
|
[
|
|
@@ -23,6 +29,12 @@ export class EntryPointNotFoundError extends BaseError {
|
|
|
23
29
|
export class InvalidEntryPointError extends BaseError {
|
|
24
30
|
override name = "InvalidEntryPointError";
|
|
25
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Constructs an error indicating an invalid entry point version for a specific chain.
|
|
34
|
+
*
|
|
35
|
+
* @param {Chain} chain The chain object containing information about the blockchain
|
|
36
|
+
* @param {any} entryPointVersion The entry point version that is invalid
|
|
37
|
+
*/
|
|
26
38
|
constructor(chain: Chain, entryPointVersion: any) {
|
|
27
39
|
super(
|
|
28
40
|
`Invalid entry point: unexpected version ${entryPointVersion} for ${chain.name}.`
|
package/src/errors/signer.ts
CHANGED
|
@@ -5,6 +5,12 @@ import { BaseError } from "./base.js";
|
|
|
5
5
|
*/
|
|
6
6
|
export class InvalidSignerTypeError extends BaseError {
|
|
7
7
|
override name = "InvalidSignerTypeError";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Constructs an error message when an invalid signer type is passed to SmartAccountSigner.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} [signerType] An optional parameter specifying the signer type. If not provided, a default error message will be used.
|
|
13
|
+
*/
|
|
8
14
|
constructor(signerType?: string) {
|
|
9
15
|
super(
|
|
10
16
|
[
|
|
@@ -6,7 +6,10 @@ import { BaseError } from "./base.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export class TransactionMissingToParamError extends BaseError {
|
|
8
8
|
override name = "TransactionMissingToParamError";
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Throws an error indicating that a transaction is missing the `to` address in the request.
|
|
12
|
+
*/ constructor() {
|
|
10
13
|
super("Transaction is missing `to` address set on request");
|
|
11
14
|
}
|
|
12
15
|
}
|
|
@@ -16,6 +19,12 @@ export class TransactionMissingToParamError extends BaseError {
|
|
|
16
19
|
*/
|
|
17
20
|
export class FailedToFindTransactionError extends BaseError {
|
|
18
21
|
override name = "FailedToFindTransactionError";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Constructs a new error message indicating a failure to find the transaction for the specified user operation hash.
|
|
25
|
+
*
|
|
26
|
+
* @param {Hex} hash The hexadecimal value representing the user operation hash.
|
|
27
|
+
*/
|
|
19
28
|
constructor(hash: Hex) {
|
|
20
29
|
super(`Failed to find transaction for user operation ${hash}`);
|
|
21
30
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { UserOperationRequest, UserOperationStruct } from "../types.js";
|
|
2
2
|
import { BaseError } from "./base.js";
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
|
-
import type { dropAndReplaceUserOperation } from "../actions/smartAccount/dropAndReplaceUserOperation.js";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
* Thrown when a
|
|
6
|
+
* Thrown when a UserOperationStruct is not a valid request
|
|
8
7
|
*
|
|
9
8
|
* extends viem BaseError
|
|
10
9
|
*/
|
|
@@ -18,7 +17,7 @@ export class InvalidUserOperationError extends BaseError {
|
|
|
18
17
|
*
|
|
19
18
|
* InvalidUserOperationError constructor
|
|
20
19
|
*
|
|
21
|
-
* @param uo the invalid user operation struct
|
|
20
|
+
* @param {UserOperationStruct} uo the invalid user operation struct
|
|
22
21
|
*/
|
|
23
22
|
constructor(uo: UserOperationStruct) {
|
|
24
23
|
super(
|
|
@@ -41,12 +40,12 @@ export class InvalidUserOperationError extends BaseError {
|
|
|
41
40
|
* Error thrown when waiting for user operation request to be mined.
|
|
42
41
|
*
|
|
43
42
|
* Includes the internal error as well as the request that failed. This request
|
|
44
|
-
* can then be used with
|
|
43
|
+
* can then be used with dropAndReplaceUserOperation to retry the operation.
|
|
45
44
|
*/
|
|
46
45
|
export class WaitForUserOperationError extends BaseError {
|
|
47
46
|
/**
|
|
48
|
-
* @param request the user operation request that failed
|
|
49
|
-
* @param error the underlying error that caused the failure
|
|
47
|
+
* @param {UserOperationRequest} request the user operation request that failed
|
|
48
|
+
* @param {Error} error the underlying error that caused the failure
|
|
50
49
|
*/
|
|
51
50
|
constructor(public request: UserOperationRequest, error: Error) {
|
|
52
51
|
super(`Failed to find User Operation: ${error.message}`);
|
package/src/index.ts
CHANGED
|
@@ -7,9 +7,6 @@ export { EntryPointAbi_v7 } from "./abis/EntryPointAbi_v7.js";
|
|
|
7
7
|
export { SimpleAccountAbi_v6 } from "./abis/SimpleAccountAbi_v6.js";
|
|
8
8
|
export { SimpleAccountAbi_v7 } from "./abis/SimpleAccountAbi_v7.js";
|
|
9
9
|
export { SimpleAccountFactoryAbi } from "./abis/SimpleAccountFactoryAbi.js";
|
|
10
|
-
export { BaseSmartContractAccount } from "./account/base.js";
|
|
11
|
-
export { createSimpleSmartAccount } from "./account/simple.js";
|
|
12
|
-
export type { SimpleSmartAccount } from "./account/simple.js";
|
|
13
10
|
export type * from "./account/smartContractAccount.js";
|
|
14
11
|
export {
|
|
15
12
|
getAccountAddress,
|
|
@@ -17,10 +14,6 @@ export {
|
|
|
17
14
|
parseFactoryAddressFromAccountInitCode,
|
|
18
15
|
toSmartContractAccount,
|
|
19
16
|
} from "./account/smartContractAccount.js";
|
|
20
|
-
export type {
|
|
21
|
-
BaseSmartAccountParams,
|
|
22
|
-
SignTypedDataParams,
|
|
23
|
-
} from "./account/types.js";
|
|
24
17
|
export { buildUserOperation } from "./actions/smartAccount/buildUserOperation.js";
|
|
25
18
|
export { buildUserOperationFromTx } from "./actions/smartAccount/buildUserOperationFromTx.js";
|
|
26
19
|
export { buildUserOperationFromTxs } from "./actions/smartAccount/buildUserOperationFromTxs.js";
|
|
@@ -101,6 +94,8 @@ export { defaultFeeEstimator } from "./middleware/defaults/feeEstimator.js";
|
|
|
101
94
|
export { defaultGasEstimator } from "./middleware/defaults/gasEstimator.js";
|
|
102
95
|
export { defaultPaymasterAndData } from "./middleware/defaults/paymasterAndData.js";
|
|
103
96
|
export { defaultUserOpSigner } from "./middleware/defaults/userOpSigner.js";
|
|
97
|
+
export type * from "./middleware/erc7677middleware.js";
|
|
98
|
+
export { erc7677Middleware } from "./middleware/erc7677middleware.js";
|
|
104
99
|
export { noopMiddleware } from "./middleware/noopMiddleware.js";
|
|
105
100
|
export type * from "./middleware/types.js";
|
|
106
101
|
export { LocalAccountSigner } from "./signer/local-account.js";
|
|
@@ -132,7 +127,6 @@ export {
|
|
|
132
127
|
concatPaymasterAndData,
|
|
133
128
|
deepHexlify,
|
|
134
129
|
filterUndefined,
|
|
135
|
-
getDefaultSimpleAccountFactoryAddress,
|
|
136
130
|
getDefaultUserOperationFeeOptions,
|
|
137
131
|
isBigNumberish,
|
|
138
132
|
isMultiplier,
|
package/src/logger.ts
CHANGED
|
@@ -14,38 +14,126 @@ export class Logger {
|
|
|
14
14
|
static logLevel: LogLevel = LogLevel.INFO;
|
|
15
15
|
static logFilter?: string;
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Sets the log level for logging purposes.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { Logger, LogLevel } from "@aa-sdk/core";
|
|
23
|
+
* Logger.setLogLevel(LogLevel.DEBUG);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param {LogLevel} logLevel The desired log level
|
|
27
|
+
*/
|
|
17
28
|
static setLogLevel(logLevel: LogLevel) {
|
|
18
29
|
this.logLevel = logLevel;
|
|
19
30
|
}
|
|
20
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Sets the log filter pattern.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { Logger } from "@aa-sdk/core";
|
|
38
|
+
*
|
|
39
|
+
* Logger.setLogFilter("error");
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param {string} pattern The pattern to set as the log filter
|
|
43
|
+
*/
|
|
21
44
|
static setLogFilter(pattern: string) {
|
|
22
45
|
this.logFilter = pattern;
|
|
23
46
|
}
|
|
24
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Logs an error message to the console if the logging condition is met.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { Logger } from "@aa-sdk/core";
|
|
54
|
+
*
|
|
55
|
+
* Logger.error("An error occurred while processing the request");
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @param {string} msg The primary error message to be logged
|
|
59
|
+
* @param {...any[]} args Additional arguments to be logged along with the error message
|
|
60
|
+
*/
|
|
25
61
|
static error(msg: string, ...args: any[]) {
|
|
26
62
|
if (!this.shouldLog(msg, LogLevel.ERROR)) return;
|
|
27
63
|
|
|
28
64
|
console.error(msg, ...args);
|
|
29
65
|
}
|
|
30
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Logs a warning message if the logging conditions are met.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { Logger } from "@aa-sdk/core";
|
|
73
|
+
*
|
|
74
|
+
* Logger.warn("Careful...");
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @param {string} msg The message to log as a warning
|
|
78
|
+
* @param {...any[]} args Additional parameters to log along with the message
|
|
79
|
+
*/
|
|
31
80
|
static warn(msg: string, ...args: any[]) {
|
|
32
81
|
if (!this.shouldLog(msg, LogLevel.WARN)) return;
|
|
33
82
|
|
|
34
83
|
console.warn(msg, ...args);
|
|
35
84
|
}
|
|
36
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Logs a debug message to the console if the log level allows it.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import { Logger } from "@aa-sdk/core";
|
|
92
|
+
*
|
|
93
|
+
* Logger.debug("Something is happening");
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @param {string} msg The message to log
|
|
97
|
+
* @param {...any[]} args Additional arguments to pass to the console.debug method
|
|
98
|
+
*/
|
|
37
99
|
static debug(msg: string, ...args: any[]) {
|
|
38
100
|
if (!this.shouldLog(msg, LogLevel.DEBUG)) return;
|
|
39
101
|
|
|
40
102
|
console.debug(msg, ...args);
|
|
41
103
|
}
|
|
42
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Logs an informational message to the console if the logging level is set to INFO.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import { Logger } from "@aa-sdk/core";
|
|
111
|
+
*
|
|
112
|
+
* Logger.info("Something is happening");
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @param {string} msg the message to log
|
|
116
|
+
* @param {...any[]} args additional arguments to log alongside the message
|
|
117
|
+
*/
|
|
43
118
|
static info(msg: string, ...args: any[]) {
|
|
44
119
|
if (!this.shouldLog(msg, LogLevel.INFO)) return;
|
|
45
120
|
|
|
46
121
|
console.info(msg, ...args);
|
|
47
122
|
}
|
|
48
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Logs a message with additional arguments if the logging level permits it.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* import { Logger } from "@aa-sdk/core";
|
|
130
|
+
*
|
|
131
|
+
* Logger.verbose("Something is happening");
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @param {string} msg The message to log
|
|
135
|
+
* @param {...any[]} args Additional arguments to be logged
|
|
136
|
+
*/
|
|
49
137
|
static verbose(msg: string, ...args: any[]) {
|
|
50
138
|
if (!this.shouldLog(msg, LogLevel.VERBOSE)) return;
|
|
51
139
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
isHex,
|
|
3
2
|
type Chain,
|
|
4
3
|
type Client,
|
|
5
4
|
type PublicActions,
|
|
@@ -12,10 +11,6 @@ import type {
|
|
|
12
11
|
BundlerRpcSchema,
|
|
13
12
|
} from "../client/decorators/bundlerClient.js";
|
|
14
13
|
import type { ClientMiddlewareConfig } from "../client/types.js";
|
|
15
|
-
import {
|
|
16
|
-
concatPaymasterAndData,
|
|
17
|
-
parsePaymasterAndData,
|
|
18
|
-
} from "../utils/userop.js";
|
|
19
14
|
import { defaultFeeEstimator } from "./defaults/feeEstimator.js";
|
|
20
15
|
import { defaultGasEstimator } from "./defaults/gasEstimator.js";
|
|
21
16
|
import { defaultPaymasterAndData } from "./defaults/paymasterAndData.js";
|
|
@@ -45,11 +40,11 @@ export type MiddlewareClient<
|
|
|
45
40
|
>;
|
|
46
41
|
|
|
47
42
|
/**
|
|
48
|
-
*
|
|
43
|
+
* function that takes in ClientMiddlewareConfig used during client initiation
|
|
49
44
|
* and returns the middleware actions object that the smart account client extends with
|
|
50
45
|
*
|
|
51
|
-
* @param
|
|
52
|
-
* @returns middleware actions object
|
|
46
|
+
* @param {ClientMiddlewareConfig} overrides config used during client initiation for overriding default middlewares
|
|
47
|
+
* @returns {(client: MiddlewareClient<TTransport, TChain, TAccount>) => { middleware: ClientMiddleware }} middleware actions object
|
|
53
48
|
*/
|
|
54
49
|
export const middlewareActions =
|
|
55
50
|
(overrides: ClientMiddlewareConfig) =>
|
|
@@ -64,27 +59,11 @@ export const middlewareActions =
|
|
|
64
59
|
): { middleware: ClientMiddleware } => ({
|
|
65
60
|
middleware: {
|
|
66
61
|
customMiddleware: overrides.customMiddleware ?? noopMiddleware,
|
|
67
|
-
dummyPaymasterAndData:
|
|
68
|
-
|
|
69
|
-
const data = overrides.paymasterAndData!.dummyPaymasterAndData();
|
|
70
|
-
const paymasterOverrides =
|
|
71
|
-
account.getEntryPoint().version === "0.7.0"
|
|
72
|
-
? isHex(data)
|
|
73
|
-
? parsePaymasterAndData(data)
|
|
74
|
-
: data
|
|
75
|
-
: {
|
|
76
|
-
paymasterAndData: isHex(data)
|
|
77
|
-
? data
|
|
78
|
-
: concatPaymasterAndData(data),
|
|
79
|
-
};
|
|
80
|
-
return { ...struct, ...paymasterOverrides };
|
|
81
|
-
}
|
|
82
|
-
: defaultPaymasterAndData,
|
|
83
|
-
|
|
62
|
+
dummyPaymasterAndData:
|
|
63
|
+
overrides.dummyPaymasterAndData ?? defaultPaymasterAndData,
|
|
84
64
|
feeEstimator: overrides.feeEstimator ?? defaultFeeEstimator(client),
|
|
85
65
|
gasEstimator: overrides.gasEstimator ?? defaultGasEstimator(client),
|
|
86
|
-
paymasterAndData:
|
|
87
|
-
overrides.paymasterAndData?.paymasterAndData ?? defaultPaymasterAndData,
|
|
66
|
+
paymasterAndData: overrides.paymasterAndData ?? defaultPaymasterAndData,
|
|
88
67
|
userOperationSimulator:
|
|
89
68
|
overrides.userOperationSimulator ?? noopMiddleware,
|
|
90
69
|
signUserOperation: overrides.signUserOperation ?? defaultUserOpSigner,
|
|
@@ -13,13 +13,13 @@ import type { ClientMiddlewareFn } from "../types.js";
|
|
|
13
13
|
* You can override this middleware with your custom gas estimator middleware
|
|
14
14
|
* by passing it to the client constructor
|
|
15
15
|
*
|
|
16
|
-
* @param client smart account client instance to apply the middleware to
|
|
17
|
-
* @returns middleware execution function used to estimate gas for user operations
|
|
16
|
+
* @param {MiddlewareClient} client smart account client instance to apply the middleware to
|
|
17
|
+
* @returns {ClientMiddlewareFn} middleware execution function used to estimate gas for user operations
|
|
18
18
|
*/
|
|
19
19
|
export const defaultGasEstimator: <C extends MiddlewareClient>(
|
|
20
20
|
client: C
|
|
21
21
|
) => ClientMiddlewareFn =
|
|
22
|
-
(client) =>
|
|
22
|
+
(client: MiddlewareClient): ClientMiddlewareFn =>
|
|
23
23
|
async (struct, { account, overrides, feeOptions }) => {
|
|
24
24
|
const request = deepHexlify(await resolveProperties(struct));
|
|
25
25
|
|
|
@@ -58,8 +58,11 @@ export const defaultGasEstimator: <C extends MiddlewareClient>(
|
|
|
58
58
|
(feeOptions as UserOperationFeeOptions<"0.7.0">)
|
|
59
59
|
?.paymasterVerificationGasLimit
|
|
60
60
|
);
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const uo_v7 = struct as UserOperationStruct<"0.7.0">;
|
|
62
|
+
|
|
63
|
+
uo_v7.paymasterVerificationGasLimit = paymasterVerificationGasLimit;
|
|
64
|
+
|
|
65
|
+
uo_v7.paymasterPostOpGasLimit = uo_v7.paymasterPostOpGasLimit ?? "0x0";
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
return struct;
|