@aa-sdk/core 4.34.1 → 4.35.1
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/README.md +1 -1
- package/dist/esm/account/smartContractAccount.d.ts +1 -1
- package/dist/esm/account/smartContractAccount.js.map +1 -1
- package/dist/esm/actions/bundler/estimateUserOperationGas.d.ts +3 -2
- package/dist/esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/dist/esm/actions/bundler/getSupportedEntryPoints.js.map +1 -1
- package/dist/esm/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/dist/esm/actions/bundler/getUserOperationReceipt.js.map +1 -1
- package/dist/esm/actions/bundler/sendRawUserOperation.d.ts +2 -1
- package/dist/esm/actions/bundler/sendRawUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperation.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/dropAndReplaceUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/esm/actions/smartAccount/getAddress.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/sendTransaction.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/signMessage.js.map +1 -1
- package/dist/esm/actions/smartAccount/signTypedData.js.map +1 -1
- package/dist/esm/actions/smartAccount/signUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/types.js.map +1 -1
- package/dist/esm/actions/smartAccount/upgradeAccount.js.map +1 -1
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
- package/dist/esm/client/addBreadcrumb.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/decorators/smartAccountClient.js.map +1 -1
- package/dist/esm/client/isSmartAccountClient.js.map +1 -1
- package/dist/esm/client/schema.d.ts +25 -25
- package/dist/esm/client/schema.js.map +1 -1
- package/dist/esm/client/smartAccountClient.js +5 -8
- package/dist/esm/client/smartAccountClient.js.map +1 -1
- package/dist/esm/client/types.js.map +1 -1
- package/dist/esm/ens/utils.js.map +1 -1
- package/dist/esm/entrypoint/0.6.d.ts +2 -2
- package/dist/esm/entrypoint/0.6.js.map +1 -1
- package/dist/esm/entrypoint/0.7.d.ts +1 -1
- package/dist/esm/entrypoint/0.7.js.map +1 -1
- package/dist/esm/entrypoint/index.d.ts +1 -1
- package/dist/esm/entrypoint/index.js.map +1 -1
- package/dist/esm/entrypoint/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/useroperation.js.map +1 -1
- package/dist/esm/middleware/actions.js.map +1 -1
- package/dist/esm/middleware/defaults/7702gasEstimator.d.ts +2 -2
- package/dist/esm/middleware/defaults/7702gasEstimator.js +2 -2
- package/dist/esm/middleware/defaults/7702gasEstimator.js.map +1 -1
- package/dist/esm/middleware/defaults/7702signer.d.ts +1 -1
- package/dist/esm/middleware/defaults/7702signer.js +1 -1
- package/dist/esm/middleware/defaults/7702signer.js.map +1 -1
- package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
- package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
- package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
- package/dist/esm/middleware/erc7677middleware.js.map +1 -1
- package/dist/esm/middleware/types.js.map +1 -1
- package/dist/esm/signer/local-account.d.ts +2 -207
- package/dist/esm/signer/local-account.js.map +1 -1
- package/dist/esm/signer/schema.d.ts +1 -1
- package/dist/esm/signer/types.js.map +1 -1
- package/dist/esm/signer/wallet-client.d.ts +2 -207
- package/dist/esm/signer/wallet-client.js.map +1 -1
- package/dist/esm/transport/split.js +1 -1
- package/dist/esm/transport/split.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/bigint.js.map +1 -1
- package/dist/esm/utils/defaults.js.map +1 -1
- package/dist/esm/utils/index.d.ts +2 -2
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/schema.js.map +1 -1
- package/dist/esm/utils/stateOverride.js.map +1 -1
- package/dist/esm/utils/testUtils.js.map +1 -1
- package/dist/esm/utils/traceHeader.js.map +1 -1
- package/dist/esm/utils/types.js.map +1 -1
- package/dist/esm/utils/userop.d.ts +2 -2
- package/dist/esm/utils/userop.js +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 +1 -1
- package/dist/types/account/smartContractAccount.d.ts.map +1 -1
- package/dist/types/actions/bundler/estimateUserOperationGas.d.ts +3 -2
- package/dist/types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
- package/dist/types/actions/bundler/getSupportedEntryPoints.d.ts.map +1 -1
- package/dist/types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
- package/dist/types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
- package/dist/types/actions/bundler/sendRawUserOperation.d.ts +2 -1
- package/dist/types/actions/bundler/sendRawUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/buildUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/signUserOperation.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/types.d.ts.map +1 -1
- package/dist/types/client/decorators/smartAccountClient.d.ts.map +1 -1
- package/dist/types/client/schema.d.ts +25 -25
- package/dist/types/client/schema.d.ts.map +1 -1
- package/dist/types/client/smartAccountClient.d.ts.map +1 -1
- package/dist/types/ens/utils.d.ts.map +1 -1
- package/dist/types/entrypoint/0.6.d.ts +2 -2
- package/dist/types/entrypoint/0.6.d.ts.map +1 -1
- package/dist/types/entrypoint/0.7.d.ts +1 -1
- package/dist/types/entrypoint/0.7.d.ts.map +1 -1
- package/dist/types/entrypoint/index.d.ts +1 -1
- package/dist/types/entrypoint/index.d.ts.map +1 -1
- package/dist/types/entrypoint/types.d.ts.map +1 -1
- package/dist/types/errors/useroperation.d.ts.map +1 -1
- package/dist/types/middleware/actions.d.ts.map +1 -1
- package/dist/types/middleware/defaults/7702gasEstimator.d.ts +2 -2
- package/dist/types/middleware/defaults/7702signer.d.ts +1 -1
- package/dist/types/middleware/types.d.ts.map +1 -1
- package/dist/types/signer/local-account.d.ts +2 -207
- package/dist/types/signer/local-account.d.ts.map +1 -1
- package/dist/types/signer/schema.d.ts +1 -1
- package/dist/types/signer/schema.d.ts.map +1 -1
- package/dist/types/signer/utils.d.ts.map +1 -1
- package/dist/types/signer/wallet-client.d.ts +2 -207
- package/dist/types/signer/wallet-client.d.ts.map +1 -1
- package/dist/types/transport/split.d.ts.map +1 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/bigint.d.ts.map +1 -1
- package/dist/types/utils/bytes.d.ts.map +1 -1
- package/dist/types/utils/defaults.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/testUtils.d.ts.map +1 -1
- package/dist/types/utils/traceHeader.d.ts.map +1 -1
- package/dist/types/utils/userop.d.ts +2 -2
- package/dist/types/utils/userop.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -6
- package/src/account/smartContractAccount.ts +27 -25
- package/src/actions/bundler/estimateUserOperationGas.ts +2 -2
- package/src/actions/bundler/getSupportedEntryPoints.ts +2 -2
- package/src/actions/bundler/getUserOperationByHash.ts +2 -2
- package/src/actions/bundler/getUserOperationReceipt.ts +2 -2
- package/src/actions/bundler/sendRawUserOperation.ts +2 -2
- package/src/actions/smartAccount/buildUserOperation.ts +5 -4
- package/src/actions/smartAccount/buildUserOperationFromTx.ts +4 -3
- package/src/actions/smartAccount/buildUserOperationFromTxs.ts +9 -8
- package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +5 -4
- package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +7 -6
- package/src/actions/smartAccount/estimateUserOperationGas.ts +5 -4
- package/src/actions/smartAccount/getAddress.ts +2 -2
- package/src/actions/smartAccount/internal/initUserOperation.ts +7 -6
- package/src/actions/smartAccount/internal/runMiddlewareStack.ts +13 -12
- package/src/actions/smartAccount/internal/sendUserOperation.ts +3 -2
- package/src/actions/smartAccount/sendTransaction.ts +5 -4
- package/src/actions/smartAccount/sendTransactions.ts +3 -3
- package/src/actions/smartAccount/sendUserOperation.ts +4 -3
- package/src/actions/smartAccount/signMessage.ts +3 -3
- package/src/actions/smartAccount/signTypedData.ts +3 -3
- package/src/actions/smartAccount/signUserOperation.ts +4 -3
- package/src/actions/smartAccount/types.ts +23 -15
- package/src/actions/smartAccount/upgradeAccount.ts +3 -3
- package/src/actions/smartAccount/waitForUserOperationTransacation.ts +5 -5
- package/src/client/addBreadcrumb.ts +1 -1
- package/src/client/bundlerClient.ts +5 -5
- package/src/client/decorators/bundlerClient.ts +7 -7
- package/src/client/decorators/smartAccountClient.ts +20 -18
- package/src/client/isSmartAccountClient.ts +4 -4
- package/src/client/schema.ts +2 -2
- package/src/client/smartAccountClient.ts +98 -104
- package/src/client/types.ts +2 -2
- package/src/ens/utils.ts +1 -1
- package/src/entrypoint/0.6.ts +3 -3
- package/src/entrypoint/0.7.ts +4 -4
- package/src/entrypoint/index.ts +10 -9
- package/src/entrypoint/types.ts +30 -28
- package/src/errors/account.ts +1 -1
- package/src/errors/client.ts +3 -3
- package/src/errors/entrypoint.ts +2 -2
- package/src/errors/signer.ts +1 -1
- package/src/errors/useroperation.ts +6 -3
- package/src/middleware/actions.ts +3 -3
- package/src/middleware/defaults/7702gasEstimator.ts +4 -4
- package/src/middleware/defaults/7702signer.ts +3 -3
- package/src/middleware/defaults/feeEstimator.ts +4 -4
- package/src/middleware/defaults/gasEstimator.ts +6 -6
- package/src/middleware/defaults/paymasterAndData.ts +1 -1
- package/src/middleware/defaults/userOpSigner.ts +2 -2
- package/src/middleware/erc7677middleware.ts +9 -9
- package/src/middleware/types.ts +7 -5
- package/src/signer/local-account.ts +7 -7
- package/src/signer/types.ts +3 -3
- package/src/signer/wallet-client.ts +2 -2
- package/src/transport/split.ts +9 -12
- package/src/types.ts +29 -29
- package/src/utils/bigint.ts +4 -4
- package/src/utils/defaults.ts +1 -1
- package/src/utils/index.ts +12 -9
- package/src/utils/schema.ts +2 -2
- package/src/utils/stateOverride.ts +4 -4
- package/src/utils/testUtils.ts +2 -2
- package/src/utils/traceHeader.ts +14 -11
- package/src/utils/types.ts +1 -1
- package/src/utils/userop.ts +17 -17
- package/src/version.ts +1 -1
|
@@ -8,7 +8,7 @@ import { AccountNotFoundError } from "../../errors/account.js";
|
|
|
8
8
|
export type SignMessageParameters<
|
|
9
9
|
TAccount extends SmartContractAccount | undefined =
|
|
10
10
|
| SmartContractAccount
|
|
11
|
-
| undefined
|
|
11
|
+
| undefined,
|
|
12
12
|
> = { message: SignableMessage } & GetAccountParameter<TAccount>;
|
|
13
13
|
|
|
14
14
|
export const signMessage: <
|
|
@@ -16,10 +16,10 @@ export const signMessage: <
|
|
|
16
16
|
TChain extends Chain | undefined = Chain | undefined,
|
|
17
17
|
TAccount extends SmartContractAccount | undefined =
|
|
18
18
|
| SmartContractAccount
|
|
19
|
-
| undefined
|
|
19
|
+
| undefined,
|
|
20
20
|
>(
|
|
21
21
|
client: Client<TTransport, TChain, TAccount>,
|
|
22
|
-
args: SignMessageParameters<TAccount
|
|
22
|
+
args: SignMessageParameters<TAccount>,
|
|
23
23
|
) => Promise<Hex> = async (client, { account = client.account, message }) => {
|
|
24
24
|
if (!account) {
|
|
25
25
|
throw new AccountNotFoundError();
|
|
@@ -17,7 +17,7 @@ export type SignTypedDataParameters<
|
|
|
17
17
|
TPrimaryType extends string = string,
|
|
18
18
|
TAccount extends SmartContractAccount | undefined =
|
|
19
19
|
| SmartContractAccount
|
|
20
|
-
| undefined
|
|
20
|
+
| undefined,
|
|
21
21
|
> = {
|
|
22
22
|
typedData: TypedDataDefinition<TTypedData, TPrimaryType>;
|
|
23
23
|
} & GetAccountParameter<TAccount>;
|
|
@@ -29,10 +29,10 @@ export const signTypedData: <
|
|
|
29
29
|
TChain extends Chain | undefined = Chain | undefined,
|
|
30
30
|
TAccount extends SmartContractAccount | undefined =
|
|
31
31
|
| SmartContractAccount
|
|
32
|
-
| undefined
|
|
32
|
+
| undefined,
|
|
33
33
|
>(
|
|
34
34
|
client: Client<TTransport, TChain, TAccount>,
|
|
35
|
-
args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount
|
|
35
|
+
args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>,
|
|
36
36
|
) => Promise<Hex> = async (client, { account = client.account, typedData }) => {
|
|
37
37
|
if (!account) {
|
|
38
38
|
throw new AccountNotFoundError();
|
|
@@ -19,10 +19,11 @@ export async function signUserOperation<
|
|
|
19
19
|
TAccount extends SmartContractAccount | undefined =
|
|
20
20
|
| SmartContractAccount
|
|
21
21
|
| undefined,
|
|
22
|
-
TEntryPointVersion extends
|
|
22
|
+
TEntryPointVersion extends
|
|
23
|
+
GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
|
|
23
24
|
>(
|
|
24
25
|
client: Client<TTransport, TChain, TAccount>,
|
|
25
|
-
args: SignUserOperationParameters<TAccount
|
|
26
|
+
args: SignUserOperationParameters<TAccount>,
|
|
26
27
|
): Promise<UserOperationRequest<TEntryPointVersion>> {
|
|
27
28
|
const { account = client.account, context } = args;
|
|
28
29
|
|
|
@@ -34,7 +35,7 @@ export async function signUserOperation<
|
|
|
34
35
|
throw new IncompatibleClientError(
|
|
35
36
|
"BaseSmartAccountClient",
|
|
36
37
|
"signUserOperation",
|
|
37
|
-
client
|
|
38
|
+
client,
|
|
38
39
|
);
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -21,7 +21,8 @@ export type UpgradeAccountParams<
|
|
|
21
21
|
TContext extends UserOperationContext | undefined =
|
|
22
22
|
| UserOperationContext
|
|
23
23
|
| undefined,
|
|
24
|
-
TEntryPointVersion extends
|
|
24
|
+
TEntryPointVersion extends
|
|
25
|
+
GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
|
|
25
26
|
> = {
|
|
26
27
|
upgradeTo: UpgradeToData;
|
|
27
28
|
waitForTx?: boolean;
|
|
@@ -36,7 +37,8 @@ export type SendUserOperationParameters<
|
|
|
36
37
|
TContext extends UserOperationContext | undefined =
|
|
37
38
|
| UserOperationContext
|
|
38
39
|
| undefined,
|
|
39
|
-
TEntryPointVersion extends
|
|
40
|
+
TEntryPointVersion extends
|
|
41
|
+
GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
|
|
40
42
|
> = {
|
|
41
43
|
uo: UserOperationCallData | BatchUserOperationCallData;
|
|
42
44
|
} & GetAccountParameter<TAccount> &
|
|
@@ -50,7 +52,8 @@ export type BuildUserOperationParameters<
|
|
|
50
52
|
TContext extends UserOperationContext | undefined =
|
|
51
53
|
| UserOperationContext
|
|
52
54
|
| undefined,
|
|
53
|
-
TEntryPointVersion extends
|
|
55
|
+
TEntryPointVersion extends
|
|
56
|
+
GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
|
|
54
57
|
> = SendUserOperationParameters<TAccount, TContext, TEntryPointVersion>;
|
|
55
58
|
// [!endregion BuildUserOperationParameters]
|
|
56
59
|
|
|
@@ -59,10 +62,11 @@ export type SignUserOperationParameters<
|
|
|
59
62
|
TAccount extends SmartContractAccount | undefined =
|
|
60
63
|
| SmartContractAccount
|
|
61
64
|
| undefined,
|
|
62
|
-
TEntryPointVersion extends
|
|
65
|
+
TEntryPointVersion extends
|
|
66
|
+
GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
|
|
63
67
|
TContext extends UserOperationContext | undefined =
|
|
64
68
|
| UserOperationContext
|
|
65
|
-
| undefined
|
|
69
|
+
| undefined,
|
|
66
70
|
> = {
|
|
67
71
|
uoStruct: UserOperationStruct<TEntryPointVersion>;
|
|
68
72
|
} & GetAccountParameter<TAccount> &
|
|
@@ -75,7 +79,8 @@ export type SendTransactionsParameters<
|
|
|
75
79
|
TContext extends UserOperationContext | undefined =
|
|
76
80
|
| UserOperationContext
|
|
77
81
|
| undefined,
|
|
78
|
-
TEntryPointVersion extends
|
|
82
|
+
TEntryPointVersion extends
|
|
83
|
+
GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
|
|
79
84
|
> = {
|
|
80
85
|
requests: RpcTransactionRequest[];
|
|
81
86
|
} & GetAccountParameter<TAccount> &
|
|
@@ -89,7 +94,8 @@ export type BuildTransactionParameters<
|
|
|
89
94
|
TContext extends UserOperationContext | undefined =
|
|
90
95
|
| UserOperationContext
|
|
91
96
|
| undefined,
|
|
92
|
-
TEntryPointVersion extends
|
|
97
|
+
TEntryPointVersion extends
|
|
98
|
+
GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
|
|
93
99
|
> = SendTransactionsParameters<TAccount, TContext, TEntryPointVersion>;
|
|
94
100
|
// [!endregion BuildTransactionParameters]
|
|
95
101
|
|
|
@@ -99,7 +105,8 @@ export type DropAndReplaceUserOperationParameters<
|
|
|
99
105
|
TContext extends UserOperationContext | undefined =
|
|
100
106
|
| UserOperationContext
|
|
101
107
|
| undefined,
|
|
102
|
-
TEntryPointVersion extends
|
|
108
|
+
TEntryPointVersion extends
|
|
109
|
+
GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
|
|
103
110
|
> = {
|
|
104
111
|
uoToDrop: UserOperationRequest<TEntryPointVersion>;
|
|
105
112
|
} & GetAccountParameter<TAccount> &
|
|
@@ -134,7 +141,7 @@ export type WaitForUserOperationTxParameters = {
|
|
|
134
141
|
|
|
135
142
|
// [!region BuildUserOperationFromTransactionsResult]
|
|
136
143
|
export type BuildUserOperationFromTransactionsResult<
|
|
137
|
-
TEntryPointVersion extends EntryPointVersion = EntryPointVersion
|
|
144
|
+
TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
|
|
138
145
|
> = {
|
|
139
146
|
uoStruct: UserOperationStruct<TEntryPointVersion>;
|
|
140
147
|
batch: BatchUserOperationCallData;
|
|
@@ -149,10 +156,11 @@ export type UserOperationContext = Record<string, any>;
|
|
|
149
156
|
export type GetContextParameter<
|
|
150
157
|
TContext extends UserOperationContext | undefined =
|
|
151
158
|
| UserOperationContext
|
|
152
|
-
| undefined
|
|
153
|
-
> =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
| undefined,
|
|
160
|
+
> =
|
|
161
|
+
IsUndefined<TContext> extends true
|
|
162
|
+
? {
|
|
163
|
+
context?: TContext;
|
|
164
|
+
}
|
|
165
|
+
: { context: TContext };
|
|
158
166
|
// [!endregion GetContextParameter]
|
|
@@ -16,10 +16,10 @@ export const upgradeAccount: <
|
|
|
16
16
|
| undefined,
|
|
17
17
|
TContext extends UserOperationContext | undefined =
|
|
18
18
|
| UserOperationContext
|
|
19
|
-
| undefined
|
|
19
|
+
| undefined,
|
|
20
20
|
>(
|
|
21
21
|
client: Client<TTransport, TChain, TAccount>,
|
|
22
|
-
args: UpgradeAccountParams<TAccount, TContext
|
|
22
|
+
args: UpgradeAccountParams<TAccount, TContext>,
|
|
23
23
|
) => Promise<Hash> = async (client_, args) => {
|
|
24
24
|
const client = clientHeaderTrack(client_, "upgradeAccount");
|
|
25
25
|
const {
|
|
@@ -38,7 +38,7 @@ export const upgradeAccount: <
|
|
|
38
38
|
throw new IncompatibleClientError(
|
|
39
39
|
"BaseSmartAccountClient",
|
|
40
40
|
"upgradeAccount",
|
|
41
|
-
client
|
|
41
|
+
client,
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -32,17 +32,17 @@ import { clientHeaderTrack } from "../../index.js";
|
|
|
32
32
|
*/
|
|
33
33
|
export const waitForUserOperationTransaction: <
|
|
34
34
|
TTransport extends Transport = Transport,
|
|
35
|
-
TChain extends Chain | undefined = Chain | undefined
|
|
35
|
+
TChain extends Chain | undefined = Chain | undefined,
|
|
36
36
|
>(
|
|
37
37
|
client: Client<TTransport, TChain, any>,
|
|
38
|
-
args: WaitForUserOperationTxParameters
|
|
38
|
+
args: WaitForUserOperationTxParameters,
|
|
39
39
|
) => Promise<Hex> = async (client_, args) => {
|
|
40
40
|
const client = clientHeaderTrack(client_, "waitForUserOperationTransaction");
|
|
41
41
|
if (!isBaseSmartAccountClient(client)) {
|
|
42
42
|
throw new IncompatibleClientError(
|
|
43
43
|
"BaseSmartAccountClient",
|
|
44
44
|
"waitForUserOperationTransaction",
|
|
45
|
-
client
|
|
45
|
+
client,
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -61,14 +61,14 @@ export const waitForUserOperationTransaction: <
|
|
|
61
61
|
Math.random() * 100;
|
|
62
62
|
|
|
63
63
|
await new Promise((resolve) =>
|
|
64
|
-
setTimeout(resolve, txRetryIntervalWithJitterMs)
|
|
64
|
+
setTimeout(resolve, txRetryIntervalWithJitterMs),
|
|
65
65
|
);
|
|
66
66
|
|
|
67
67
|
const receipt = await client
|
|
68
68
|
.getUserOperationReceipt(hash as `0x${string}`)
|
|
69
69
|
.catch((e) => {
|
|
70
70
|
Logger.error(
|
|
71
|
-
`[SmartAccountProvider] waitForUserOperationTransaction error fetching receipt for ${hash}: ${e}
|
|
71
|
+
`[SmartAccountProvider] waitForUserOperationTransaction error fetching receipt for ${hash}: ${e}`,
|
|
72
72
|
);
|
|
73
73
|
});
|
|
74
74
|
|
|
@@ -45,11 +45,11 @@ export type BundlerClient<T extends Transport = Transport> = Client<
|
|
|
45
45
|
* @returns {BundlerClient<T>} A bundler client that extends the functionality of the provided public client
|
|
46
46
|
*/
|
|
47
47
|
export const createBundlerClientFromExisting: <
|
|
48
|
-
T extends Transport | FallbackTransport = Transport
|
|
48
|
+
T extends Transport | FallbackTransport = Transport,
|
|
49
49
|
>(
|
|
50
|
-
client: PublicClient<T, Chain
|
|
50
|
+
client: PublicClient<T, Chain>,
|
|
51
51
|
) => BundlerClient<T> = <T extends Transport | FallbackTransport = Transport>(
|
|
52
|
-
client: PublicClient<T, Chain
|
|
52
|
+
client: PublicClient<T, Chain>,
|
|
53
53
|
): BundlerClient<T> => {
|
|
54
54
|
return client.extend(bundlerActions);
|
|
55
55
|
};
|
|
@@ -62,7 +62,7 @@ export const createBundlerClientFromExisting: <
|
|
|
62
62
|
* @returns {BundlerClient<TTransport>} a PublicClient with methods for calling Bundler RPC methods
|
|
63
63
|
*/
|
|
64
64
|
export function createBundlerClient<TTransport extends Transport>(
|
|
65
|
-
args: PublicClientConfig<TTransport, Chain> & { type?: string }
|
|
65
|
+
args: PublicClientConfig<TTransport, Chain> & { type?: string },
|
|
66
66
|
): BundlerClient<TTransport>;
|
|
67
67
|
|
|
68
68
|
/**
|
|
@@ -83,7 +83,7 @@ export function createBundlerClient<TTransport extends Transport>(
|
|
|
83
83
|
* @returns {BundlerClient} The created Bundler Client with extended public and bundler actions
|
|
84
84
|
*/
|
|
85
85
|
export function createBundlerClient(
|
|
86
|
-
args: PublicClientConfig & { type?: string }
|
|
86
|
+
args: PublicClientConfig & { type?: string },
|
|
87
87
|
): BundlerClient {
|
|
88
88
|
if (!args.chain) {
|
|
89
89
|
throw new ChainNotFoundError();
|
|
@@ -47,7 +47,7 @@ export type BundlerRpcSchema = [
|
|
|
47
47
|
Method: "eth_supportedEntryPoints";
|
|
48
48
|
Parameters: [];
|
|
49
49
|
ReturnType: Address[];
|
|
50
|
-
}
|
|
50
|
+
},
|
|
51
51
|
];
|
|
52
52
|
|
|
53
53
|
// [!region BundlerActions]
|
|
@@ -61,11 +61,11 @@ export type BundlerActions = {
|
|
|
61
61
|
* @returns the gas estimates for the given response
|
|
62
62
|
*/
|
|
63
63
|
estimateUserOperationGas<
|
|
64
|
-
TEntryPointVersion extends EntryPointVersion = EntryPointVersion
|
|
64
|
+
TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
|
|
65
65
|
>(
|
|
66
66
|
request: UserOperationRequest<TEntryPointVersion>,
|
|
67
67
|
entryPoint: Address,
|
|
68
|
-
stateOverride?: StateOverride
|
|
68
|
+
stateOverride?: StateOverride,
|
|
69
69
|
): Promise<UserOperationEstimateGasResponse<TEntryPointVersion>>;
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -76,10 +76,10 @@ export type BundlerActions = {
|
|
|
76
76
|
* @returns the hash of the sent UserOperation
|
|
77
77
|
*/
|
|
78
78
|
sendRawUserOperation<
|
|
79
|
-
TEntryPointVersion extends EntryPointVersion = EntryPointVersion
|
|
79
|
+
TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
|
|
80
80
|
>(
|
|
81
81
|
request: UserOperationRequest<TEntryPointVersion>,
|
|
82
|
-
entryPoint: Address
|
|
82
|
+
entryPoint: Address,
|
|
83
83
|
): Promise<Hash>;
|
|
84
84
|
|
|
85
85
|
/**
|
|
@@ -122,9 +122,9 @@ export const bundlerActions: <
|
|
|
122
122
|
Chain | undefined,
|
|
123
123
|
any,
|
|
124
124
|
[...PublicRpcSchema, ...BundlerRpcSchema]
|
|
125
|
-
|
|
125
|
+
>,
|
|
126
126
|
>(
|
|
127
|
-
client: TClient
|
|
127
|
+
client: TClient,
|
|
128
128
|
) => BundlerActions = (client) => ({
|
|
129
129
|
estimateUserOperationGas: async (request, entryPoint, stateOverride) =>
|
|
130
130
|
estimateUserOperationGas(client, { request, entryPoint, stateOverride }),
|
|
@@ -64,64 +64,66 @@ export type BaseSmartAccountClientActions<
|
|
|
64
64
|
TContext extends UserOperationContext | undefined =
|
|
65
65
|
| UserOperationContext
|
|
66
66
|
| undefined,
|
|
67
|
-
TEntryPointVersion extends
|
|
67
|
+
TEntryPointVersion extends
|
|
68
|
+
GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
|
|
68
69
|
> = {
|
|
69
70
|
buildUserOperation: (
|
|
70
|
-
args: BuildUserOperationParameters<TAccount, TContext
|
|
71
|
+
args: BuildUserOperationParameters<TAccount, TContext>,
|
|
71
72
|
) => Promise<UserOperationStruct<TEntryPointVersion>>;
|
|
72
73
|
buildUserOperationFromTx: (
|
|
73
74
|
args: SendTransactionParameters<TChain, TAccount>,
|
|
74
75
|
overrides?: UserOperationOverrides<TEntryPointVersion>,
|
|
75
|
-
context?: TContext
|
|
76
|
+
context?: TContext,
|
|
76
77
|
) => Promise<UserOperationStruct<TEntryPointVersion>>;
|
|
77
78
|
buildUserOperationFromTxs: (
|
|
78
|
-
args: BuildTransactionParameters<TAccount, TContext
|
|
79
|
+
args: BuildTransactionParameters<TAccount, TContext>,
|
|
79
80
|
) => Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>>;
|
|
80
81
|
checkGasSponsorshipEligibility: <
|
|
81
82
|
TContext extends UserOperationContext | undefined =
|
|
82
83
|
| UserOperationContext
|
|
83
84
|
| undefined,
|
|
84
|
-
TEntryPointVersion extends
|
|
85
|
+
TEntryPointVersion extends
|
|
86
|
+
GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
|
|
85
87
|
>(
|
|
86
|
-
args: SendUserOperationParameters<TAccount, TContext
|
|
88
|
+
args: SendUserOperationParameters<TAccount, TContext>,
|
|
87
89
|
) => Promise<
|
|
88
90
|
CheckGasSponsorshipEligibilityResult<TAccount, TEntryPointVersion>
|
|
89
91
|
>;
|
|
90
92
|
signUserOperation: (
|
|
91
|
-
args: SignUserOperationParameters<TAccount, TEntryPointVersion, TContext
|
|
93
|
+
args: SignUserOperationParameters<TAccount, TEntryPointVersion, TContext>,
|
|
92
94
|
) => Promise<UserOperationRequest<TEntryPointVersion>>;
|
|
93
95
|
dropAndReplaceUserOperation: (
|
|
94
|
-
args: DropAndReplaceUserOperationParameters<TAccount, TContext
|
|
96
|
+
args: DropAndReplaceUserOperationParameters<TAccount, TContext>,
|
|
95
97
|
) => Promise<SendUserOperationResult<TEntryPointVersion>>;
|
|
96
98
|
// TODO: for v4 we should combine override and context into an `opts` parameter
|
|
97
99
|
// which wraps both of these properties so we can use GetContextParameter
|
|
98
100
|
sendTransaction: <TChainOverride extends Chain | undefined = undefined>(
|
|
99
101
|
args: SendTransactionParameters<TChain, TAccount, TChainOverride>,
|
|
100
102
|
overrides?: UserOperationOverrides<TEntryPointVersion>,
|
|
101
|
-
context?: TContext
|
|
103
|
+
context?: TContext,
|
|
102
104
|
) => Promise<Hex>;
|
|
103
105
|
sendTransactions: (
|
|
104
|
-
args: SendTransactionsParameters<TAccount, TContext
|
|
106
|
+
args: SendTransactionsParameters<TAccount, TContext>,
|
|
105
107
|
) => Promise<Hex>;
|
|
106
108
|
sendUserOperation: (
|
|
107
109
|
args: SendUserOperationParameters<
|
|
108
110
|
TAccount,
|
|
109
111
|
TContext,
|
|
110
112
|
GetEntryPointFromAccount<TAccount>
|
|
111
|
-
|
|
113
|
+
>,
|
|
112
114
|
) => Promise<SendUserOperationResult<TEntryPointVersion>>;
|
|
113
115
|
waitForUserOperationTransaction: (
|
|
114
|
-
args: WaitForUserOperationTxParameters
|
|
116
|
+
args: WaitForUserOperationTxParameters,
|
|
115
117
|
) => Promise<Hex>;
|
|
116
118
|
upgradeAccount: (
|
|
117
|
-
args: UpgradeAccountParams<TAccount, TContext
|
|
119
|
+
args: UpgradeAccountParams<TAccount, TContext>,
|
|
118
120
|
) => Promise<Hex>;
|
|
119
121
|
signMessage: (args: SignMessageParameters<TAccount>) => Promise<Hex>;
|
|
120
122
|
signTypedData: <
|
|
121
123
|
const TTypedData extends TypedData | { [key: string]: unknown },
|
|
122
|
-
TPrimaryType extends string = string
|
|
124
|
+
TPrimaryType extends string = string,
|
|
123
125
|
>(
|
|
124
|
-
args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount
|
|
126
|
+
args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>,
|
|
125
127
|
) => Promise<Hex>;
|
|
126
128
|
} & (IsUndefined<TAccount> extends false
|
|
127
129
|
? { getAddress: () => Address }
|
|
@@ -146,9 +148,9 @@ export const smartAccountClientActions: <
|
|
|
146
148
|
| undefined,
|
|
147
149
|
TContext extends UserOperationContext | undefined =
|
|
148
150
|
| UserOperationContext
|
|
149
|
-
| undefined
|
|
151
|
+
| undefined,
|
|
150
152
|
>(
|
|
151
|
-
client: Client<TTransport, TChain, TAccount
|
|
153
|
+
client: Client<TTransport, TChain, TAccount>,
|
|
152
154
|
) => BaseSmartAccountClientActions<TChain, TAccount, TContext> = (client) => ({
|
|
153
155
|
buildUserOperation: (args) => buildUserOperation(client, args),
|
|
154
156
|
buildUserOperationFromTx: (args, overrides, context) =>
|
|
@@ -173,7 +175,7 @@ export const smartAccountClientActions: <
|
|
|
173
175
|
|
|
174
176
|
export const smartAccountClientMethodKeys = Object.keys(
|
|
175
177
|
// @ts-expect-error we just want to get the keys
|
|
176
|
-
smartAccountClientActions(undefined)
|
|
178
|
+
smartAccountClientActions(undefined),
|
|
177
179
|
).reduce((accum, curr) => {
|
|
178
180
|
accum.add(curr);
|
|
179
181
|
return accum;
|
|
@@ -19,9 +19,9 @@ export function isSmartAccountClient<
|
|
|
19
19
|
TChain extends Chain | undefined = Chain | undefined,
|
|
20
20
|
TAccount extends SmartContractAccount | undefined =
|
|
21
21
|
| SmartContractAccount
|
|
22
|
-
| undefined
|
|
22
|
+
| undefined,
|
|
23
23
|
>(
|
|
24
|
-
client: Client<TTransport, TChain, TAccount
|
|
24
|
+
client: Client<TTransport, TChain, TAccount>,
|
|
25
25
|
): client is SmartAccountClient<TTransport, TChain, TAccount> {
|
|
26
26
|
for (const key of smartAccountClientMethodKeys) {
|
|
27
27
|
if (!(key in client)) {
|
|
@@ -45,9 +45,9 @@ export function isBaseSmartAccountClient<
|
|
|
45
45
|
TChain extends Chain | undefined = Chain | undefined,
|
|
46
46
|
TAccount extends SmartContractAccount | undefined =
|
|
47
47
|
| SmartContractAccount
|
|
48
|
-
| undefined
|
|
48
|
+
| undefined,
|
|
49
49
|
>(
|
|
50
|
-
client: Client<TTransport, TChain, TAccount
|
|
50
|
+
client: Client<TTransport, TChain, TAccount>,
|
|
51
51
|
): client is BaseSmartAccountClient<TTransport, TChain, TAccount> {
|
|
52
52
|
return client && "middleware" in client;
|
|
53
53
|
}
|
package/src/client/schema.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { BigNumberishRangeSchema, MultiplierSchema } from "../utils/index.js";
|
|
|
5
5
|
import type { BundlerClient } from "./bundlerClient.js";
|
|
6
6
|
|
|
7
7
|
export const createPublicErc4337ClientSchema = <
|
|
8
|
-
TTransport extends Transport = Transport
|
|
8
|
+
TTransport extends Transport = Transport,
|
|
9
9
|
>() =>
|
|
10
10
|
z.custom<BundlerClient<TTransport>>((provider) => {
|
|
11
11
|
return (
|
|
@@ -45,7 +45,7 @@ export const ConnectionConfigSchema = z.intersection(
|
|
|
45
45
|
]),
|
|
46
46
|
z.object({
|
|
47
47
|
chainAgnosticUrl: z.string().optional(),
|
|
48
|
-
})
|
|
48
|
+
}),
|
|
49
49
|
);
|
|
50
50
|
// [!endregion ConnectionConfigSchema]
|
|
51
51
|
|