@zerodev/sdk 5.2.11 → 5.2.12-alpha-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/_cjs/accounts/kernel/createKernelAccount.js +8 -0
- package/_cjs/accounts/kernel/createKernelAccount.js.map +1 -1
- package/_cjs/accounts/utils/toKernelPluginManager.js +33 -0
- package/_cjs/accounts/utils/toKernelPluginManager.js.map +1 -1
- package/_cjs/actions/account-client/prepareMultiUserOpRequest.js +114 -0
- package/_cjs/actions/account-client/prepareMultiUserOpRequest.js.map +1 -0
- package/_cjs/actions/account-client/sendSignedUserOperation.js +17 -0
- package/_cjs/actions/account-client/sendSignedUserOperation.js.map +1 -0
- package/_cjs/clients/decorators/kernel.js +5 -1
- package/_cjs/clients/decorators/kernel.js.map +1 -1
- package/_cjs/index.js +3 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/types/kernel.js.map +1 -1
- package/_esm/accounts/kernel/createKernelAccount.js +9 -0
- package/_esm/accounts/kernel/createKernelAccount.js.map +1 -1
- package/_esm/accounts/utils/toKernelPluginManager.js +33 -0
- package/_esm/accounts/utils/toKernelPluginManager.js.map +1 -1
- package/_esm/actions/account-client/prepareMultiUserOpRequest.js +112 -0
- package/_esm/actions/account-client/prepareMultiUserOpRequest.js.map +1 -0
- package/_esm/actions/account-client/sendSignedUserOperation.js +14 -0
- package/_esm/actions/account-client/sendSignedUserOperation.js.map +1 -0
- package/_esm/clients/decorators/kernel.js +5 -1
- package/_esm/clients/decorators/kernel.js.map +1 -1
- package/_esm/index.js +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/types/kernel.js.map +1 -1
- package/_types/accounts/kernel/createKernelAccount.d.ts +2 -1
- package/_types/accounts/kernel/createKernelAccount.d.ts.map +1 -1
- package/_types/accounts/utils/toKernelPluginManager.d.ts.map +1 -1
- package/_types/actions/account-client/prepareMultiUserOpRequest.d.ts +31 -0
- package/_types/actions/account-client/prepareMultiUserOpRequest.d.ts.map +1 -0
- package/_types/actions/account-client/sendSignedUserOperation.d.ts +7 -0
- package/_types/actions/account-client/sendSignedUserOperation.d.ts.map +1 -0
- package/_types/clients/decorators/kernel.d.ts +10 -3
- package/_types/clients/decorators/kernel.d.ts.map +1 -1
- package/_types/index.d.ts +2 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/types/kernel.d.ts +6 -1
- package/_types/types/kernel.d.ts.map +1 -1
- package/accounts/kernel/createKernelAccount.ts +22 -1
- package/accounts/utils/toKernelPluginManager.ts +36 -0
- package/actions/account-client/prepareMultiUserOpRequest.ts +238 -0
- package/actions/account-client/sendSignedUserOperation.ts +36 -0
- package/clients/decorators/kernel.ts +50 -4
- package/index.ts +3 -1
- package/package.json +1 -1
- package/types/kernel.ts +13 -1
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccountOrClientNotFoundError,
|
|
3
|
+
type UserOperation,
|
|
4
|
+
estimateUserOperationGas,
|
|
5
|
+
parseAccount
|
|
6
|
+
} from "permissionless"
|
|
7
|
+
import type {
|
|
8
|
+
PrepareUserOperationRequestParameters,
|
|
9
|
+
PrepareUserOperationRequestReturnType,
|
|
10
|
+
SponsorUserOperationReturnType
|
|
11
|
+
} from "permissionless/actions/smartAccount"
|
|
12
|
+
import type { StateOverrides } from "permissionless/types/bundler"
|
|
13
|
+
import type {
|
|
14
|
+
ENTRYPOINT_ADDRESS_V07_TYPE,
|
|
15
|
+
EntryPoint,
|
|
16
|
+
GetEntryPointVersion
|
|
17
|
+
} from "permissionless/types/entrypoint"
|
|
18
|
+
import type {
|
|
19
|
+
Abi,
|
|
20
|
+
Address,
|
|
21
|
+
Chain,
|
|
22
|
+
Client,
|
|
23
|
+
Hex,
|
|
24
|
+
LocalAccount,
|
|
25
|
+
Transport
|
|
26
|
+
} from "viem"
|
|
27
|
+
import { estimateFeesPerGas } from "viem/actions"
|
|
28
|
+
import type { Prettify } from "viem/chains"
|
|
29
|
+
import { type EncodeDeployDataParameters, getAction } from "viem/utils"
|
|
30
|
+
import type { KernelSmartAccount } from "../../accounts"
|
|
31
|
+
|
|
32
|
+
export type SmartAccount<
|
|
33
|
+
entryPoint extends EntryPoint,
|
|
34
|
+
TSource extends string = string,
|
|
35
|
+
transport extends Transport = Transport,
|
|
36
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
37
|
+
TAbi extends Abi | readonly unknown[] = Abi
|
|
38
|
+
> = LocalAccount<TSource> & {
|
|
39
|
+
client: Client<transport, chain>
|
|
40
|
+
entryPoint: entryPoint
|
|
41
|
+
getNonce: () => Promise<bigint>
|
|
42
|
+
getInitCode: () => Promise<Hex>
|
|
43
|
+
getFactory: () => Promise<Address | undefined>
|
|
44
|
+
getFactoryData: () => Promise<Hex | undefined>
|
|
45
|
+
encodeCallData: (
|
|
46
|
+
args:
|
|
47
|
+
| {
|
|
48
|
+
to: Address
|
|
49
|
+
value: bigint
|
|
50
|
+
data: Hex
|
|
51
|
+
}
|
|
52
|
+
| {
|
|
53
|
+
to: Address
|
|
54
|
+
value: bigint
|
|
55
|
+
data: Hex
|
|
56
|
+
}[]
|
|
57
|
+
) => Promise<Hex>
|
|
58
|
+
getDummySignature(
|
|
59
|
+
userOperation: UserOperation<GetEntryPointVersion<entryPoint>>
|
|
60
|
+
): Promise<Hex>
|
|
61
|
+
getMultiUserOpDummySignature(
|
|
62
|
+
userOperation: UserOperation<GetEntryPointVersion<entryPoint>>,
|
|
63
|
+
numOfUserOps: number
|
|
64
|
+
): Promise<Hex>
|
|
65
|
+
encodeDeployCallData: ({
|
|
66
|
+
abi,
|
|
67
|
+
args,
|
|
68
|
+
bytecode
|
|
69
|
+
}: EncodeDeployDataParameters<TAbi>) => Promise<Hex>
|
|
70
|
+
signUserOperation: (
|
|
71
|
+
userOperation: UserOperation<GetEntryPointVersion<entryPoint>>
|
|
72
|
+
) => Promise<Hex>
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export async function prepareMultiUserOpRequest<
|
|
76
|
+
entryPoint extends EntryPoint = ENTRYPOINT_ADDRESS_V07_TYPE,
|
|
77
|
+
TTransport extends Transport = Transport,
|
|
78
|
+
TChain extends Chain | undefined = Chain | undefined,
|
|
79
|
+
TSmartAccount extends KernelSmartAccount<entryPoint> | undefined =
|
|
80
|
+
| KernelSmartAccount<entryPoint>
|
|
81
|
+
| undefined
|
|
82
|
+
>(
|
|
83
|
+
client: Client<TTransport, TChain, TSmartAccount>,
|
|
84
|
+
args: Prettify<
|
|
85
|
+
PrepareUserOperationRequestParameters<entryPoint, TSmartAccount>
|
|
86
|
+
>,
|
|
87
|
+
numOfUserOps: number,
|
|
88
|
+
stateOverrides?: StateOverrides
|
|
89
|
+
): Promise<Prettify<PrepareUserOperationRequestReturnType<entryPoint>>> {
|
|
90
|
+
const {
|
|
91
|
+
account: account_ = client.account,
|
|
92
|
+
userOperation: partialUserOperation,
|
|
93
|
+
middleware
|
|
94
|
+
} = args
|
|
95
|
+
|
|
96
|
+
if (!account_) throw new AccountOrClientNotFoundError()
|
|
97
|
+
|
|
98
|
+
const account = parseAccount(
|
|
99
|
+
account_
|
|
100
|
+
) as SmartAccount<ENTRYPOINT_ADDRESS_V07_TYPE>
|
|
101
|
+
|
|
102
|
+
const [sender, nonce, factory, factoryData, callData, gasEstimation] =
|
|
103
|
+
await Promise.all([
|
|
104
|
+
partialUserOperation.sender || account.address,
|
|
105
|
+
partialUserOperation.nonce || account.getNonce(),
|
|
106
|
+
partialUserOperation.factory || account.getFactory(),
|
|
107
|
+
partialUserOperation.factoryData || account.getFactoryData(),
|
|
108
|
+
partialUserOperation.callData,
|
|
109
|
+
!partialUserOperation.maxFeePerGas ||
|
|
110
|
+
!partialUserOperation.maxPriorityFeePerGas
|
|
111
|
+
? estimateFeesPerGas(account.client)
|
|
112
|
+
: undefined
|
|
113
|
+
])
|
|
114
|
+
|
|
115
|
+
const userOperation: UserOperation<"v0.7"> = {
|
|
116
|
+
sender,
|
|
117
|
+
nonce,
|
|
118
|
+
factory: factory,
|
|
119
|
+
factoryData: factoryData,
|
|
120
|
+
callData,
|
|
121
|
+
callGasLimit: partialUserOperation.callGasLimit || BigInt(0),
|
|
122
|
+
verificationGasLimit:
|
|
123
|
+
partialUserOperation.verificationGasLimit || BigInt(0),
|
|
124
|
+
preVerificationGas:
|
|
125
|
+
partialUserOperation.preVerificationGas || BigInt(0),
|
|
126
|
+
maxFeePerGas:
|
|
127
|
+
partialUserOperation.maxFeePerGas ||
|
|
128
|
+
gasEstimation?.maxFeePerGas ||
|
|
129
|
+
BigInt(0),
|
|
130
|
+
maxPriorityFeePerGas:
|
|
131
|
+
partialUserOperation.maxPriorityFeePerGas ||
|
|
132
|
+
gasEstimation?.maxPriorityFeePerGas ||
|
|
133
|
+
BigInt(0),
|
|
134
|
+
signature: partialUserOperation.signature || "0x"
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (typeof middleware === "function") {
|
|
138
|
+
return middleware({
|
|
139
|
+
userOperation,
|
|
140
|
+
entryPoint: account.entryPoint
|
|
141
|
+
} as {
|
|
142
|
+
userOperation: UserOperation<GetEntryPointVersion<entryPoint>>
|
|
143
|
+
entryPoint: entryPoint
|
|
144
|
+
}) as Promise<PrepareUserOperationRequestReturnType<entryPoint>>
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (middleware && typeof middleware !== "function" && middleware.gasPrice) {
|
|
148
|
+
const gasPrice = await middleware.gasPrice()
|
|
149
|
+
userOperation.maxFeePerGas = gasPrice.maxFeePerGas
|
|
150
|
+
userOperation.maxPriorityFeePerGas = gasPrice.maxPriorityFeePerGas
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (!userOperation.maxFeePerGas || !userOperation.maxPriorityFeePerGas) {
|
|
154
|
+
const estimateGas = await estimateFeesPerGas(account.client)
|
|
155
|
+
userOperation.maxFeePerGas =
|
|
156
|
+
userOperation.maxFeePerGas || estimateGas.maxFeePerGas
|
|
157
|
+
userOperation.maxPriorityFeePerGas =
|
|
158
|
+
userOperation.maxPriorityFeePerGas ||
|
|
159
|
+
estimateGas.maxPriorityFeePerGas
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (userOperation.signature === "0x") {
|
|
163
|
+
userOperation.signature = await account.getMultiUserOpDummySignature(
|
|
164
|
+
userOperation,
|
|
165
|
+
numOfUserOps
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (
|
|
170
|
+
middleware &&
|
|
171
|
+
typeof middleware !== "function" &&
|
|
172
|
+
middleware.sponsorUserOperation
|
|
173
|
+
) {
|
|
174
|
+
const sponsorUserOperationData = (await middleware.sponsorUserOperation(
|
|
175
|
+
{
|
|
176
|
+
userOperation,
|
|
177
|
+
entryPoint: account.entryPoint
|
|
178
|
+
} as {
|
|
179
|
+
userOperation: UserOperation<GetEntryPointVersion<entryPoint>>
|
|
180
|
+
entryPoint: entryPoint
|
|
181
|
+
}
|
|
182
|
+
)) as SponsorUserOperationReturnType<ENTRYPOINT_ADDRESS_V07_TYPE>
|
|
183
|
+
|
|
184
|
+
userOperation.callGasLimit = sponsorUserOperationData.callGasLimit
|
|
185
|
+
userOperation.verificationGasLimit =
|
|
186
|
+
sponsorUserOperationData.verificationGasLimit
|
|
187
|
+
userOperation.preVerificationGas =
|
|
188
|
+
sponsorUserOperationData.preVerificationGas
|
|
189
|
+
userOperation.paymaster = sponsorUserOperationData.paymaster
|
|
190
|
+
userOperation.paymasterVerificationGasLimit =
|
|
191
|
+
sponsorUserOperationData.paymasterVerificationGasLimit
|
|
192
|
+
userOperation.paymasterPostOpGasLimit =
|
|
193
|
+
sponsorUserOperationData.paymasterPostOpGasLimit
|
|
194
|
+
userOperation.paymasterData = sponsorUserOperationData.paymasterData
|
|
195
|
+
userOperation.maxFeePerGas =
|
|
196
|
+
sponsorUserOperationData.maxFeePerGas || userOperation.maxFeePerGas
|
|
197
|
+
userOperation.maxPriorityFeePerGas =
|
|
198
|
+
sponsorUserOperationData.maxPriorityFeePerGas ||
|
|
199
|
+
userOperation.maxPriorityFeePerGas
|
|
200
|
+
|
|
201
|
+
return userOperation as PrepareUserOperationRequestReturnType<entryPoint>
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (
|
|
205
|
+
!userOperation.callGasLimit ||
|
|
206
|
+
!userOperation.verificationGasLimit ||
|
|
207
|
+
!userOperation.preVerificationGas
|
|
208
|
+
) {
|
|
209
|
+
const gasParameters = await getAction(
|
|
210
|
+
client,
|
|
211
|
+
estimateUserOperationGas<ENTRYPOINT_ADDRESS_V07_TYPE>,
|
|
212
|
+
"estimateUserOperationGas"
|
|
213
|
+
)(
|
|
214
|
+
{
|
|
215
|
+
userOperation,
|
|
216
|
+
entryPoint: account.entryPoint
|
|
217
|
+
},
|
|
218
|
+
// @ts-ignore getAction takes only two params but when compiled this will work
|
|
219
|
+
stateOverrides
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
userOperation.callGasLimit |= gasParameters.callGasLimit
|
|
223
|
+
userOperation.verificationGasLimit =
|
|
224
|
+
userOperation.verificationGasLimit ||
|
|
225
|
+
gasParameters.verificationGasLimit
|
|
226
|
+
userOperation.preVerificationGas =
|
|
227
|
+
userOperation.preVerificationGas || gasParameters.preVerificationGas
|
|
228
|
+
|
|
229
|
+
userOperation.paymasterPostOpGasLimit =
|
|
230
|
+
userOperation.paymasterPostOpGasLimit ||
|
|
231
|
+
gasParameters.paymasterPostOpGasLimit
|
|
232
|
+
userOperation.paymasterPostOpGasLimit =
|
|
233
|
+
userOperation.paymasterPostOpGasLimit ||
|
|
234
|
+
gasParameters.paymasterPostOpGasLimit
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return userOperation as PrepareUserOperationRequestReturnType<entryPoint>
|
|
238
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type SendUserOperationParameters, deepHexlify } from "permissionless"
|
|
2
|
+
import type { SmartAccount } from "permissionless/accounts"
|
|
3
|
+
import type { BundlerRpcSchema } from "permissionless/types/bundler"
|
|
4
|
+
import type {
|
|
5
|
+
EntryPoint,
|
|
6
|
+
GetEntryPointVersion
|
|
7
|
+
} from "permissionless/types/entrypoint"
|
|
8
|
+
import type { UserOperationWithBigIntAsHex } from "permissionless/types/userOperation"
|
|
9
|
+
import type { Chain, Client, Hash, Transport } from "viem"
|
|
10
|
+
|
|
11
|
+
export async function sendSignedUserOperation<
|
|
12
|
+
entryPoint extends EntryPoint,
|
|
13
|
+
TTransport extends Transport = Transport,
|
|
14
|
+
TChain extends Chain | undefined = Chain | undefined,
|
|
15
|
+
TAccount extends SmartAccount<entryPoint> | undefined =
|
|
16
|
+
| SmartAccount<entryPoint>
|
|
17
|
+
| undefined
|
|
18
|
+
>(
|
|
19
|
+
client: Client<TTransport, TChain, TAccount, BundlerRpcSchema<entryPoint>>,
|
|
20
|
+
args: SendUserOperationParameters<entryPoint>
|
|
21
|
+
): Promise<Hash> {
|
|
22
|
+
const { userOperation, entryPoint } = args
|
|
23
|
+
|
|
24
|
+
// send user operation directly without signing
|
|
25
|
+
const userOperationHash = await client.request({
|
|
26
|
+
method: "eth_sendUserOperation",
|
|
27
|
+
params: [
|
|
28
|
+
deepHexlify(userOperation) as UserOperationWithBigIntAsHex<
|
|
29
|
+
GetEntryPointVersion<entryPoint>
|
|
30
|
+
>,
|
|
31
|
+
entryPoint
|
|
32
|
+
]
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
return userOperationHash
|
|
36
|
+
}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type SmartAccountActions,
|
|
3
|
+
type sendUserOperation,
|
|
4
|
+
smartAccountActions
|
|
5
|
+
} from "permissionless"
|
|
6
|
+
import type {
|
|
7
|
+
Middleware,
|
|
8
|
+
PrepareUserOperationRequestReturnType
|
|
9
|
+
} from "permissionless/actions/smartAccount"
|
|
3
10
|
import type { EntryPoint, Prettify } from "permissionless/types"
|
|
4
|
-
import type { Chain, Client, Transport } from "viem"
|
|
11
|
+
import type { Chain, Client, Hash, Transport } from "viem"
|
|
5
12
|
import type { KernelSmartAccount } from "../../accounts/index.js"
|
|
6
13
|
import {
|
|
7
14
|
type GetUserOperationGasPriceReturnType,
|
|
8
15
|
getUserOperationGasPrice
|
|
9
16
|
} from "../../actions/account-client/getUserOperationGasPrice.js"
|
|
17
|
+
import { prepareMultiUserOpRequest } from "../../actions/account-client/prepareMultiUserOpRequest.js"
|
|
18
|
+
import { sendSignedUserOperation } from "../../actions/account-client/sendSignedUserOperation.js"
|
|
10
19
|
import type {
|
|
11
20
|
SignUserOperationParameters,
|
|
12
21
|
SignUserOperationReturnType
|
|
@@ -87,6 +96,35 @@ export type KernelAccountClientActions<
|
|
|
87
96
|
getUserOperationGasPrice: () => Promise<
|
|
88
97
|
Prettify<GetUserOperationGasPriceReturnType>
|
|
89
98
|
>
|
|
99
|
+
/**
|
|
100
|
+
*
|
|
101
|
+
* @returns
|
|
102
|
+
*/
|
|
103
|
+
prepareMultiUserOpRequest: (
|
|
104
|
+
args: Prettify<
|
|
105
|
+
Parameters<
|
|
106
|
+
typeof prepareMultiUserOpRequest<
|
|
107
|
+
entryPoint,
|
|
108
|
+
Transport,
|
|
109
|
+
TChain,
|
|
110
|
+
TSmartAccount
|
|
111
|
+
>
|
|
112
|
+
>[1]
|
|
113
|
+
>,
|
|
114
|
+
numOfUserOps: number
|
|
115
|
+
) => Promise<Prettify<PrepareUserOperationRequestReturnType<entryPoint>>>
|
|
116
|
+
sendSignedUserOperation: <TTransport extends Transport>(
|
|
117
|
+
args: Prettify<
|
|
118
|
+
Parameters<
|
|
119
|
+
typeof sendUserOperation<
|
|
120
|
+
entryPoint,
|
|
121
|
+
TTransport,
|
|
122
|
+
TChain,
|
|
123
|
+
TSmartAccount
|
|
124
|
+
>
|
|
125
|
+
>[1]
|
|
126
|
+
>
|
|
127
|
+
) => Promise<Hash>
|
|
90
128
|
}
|
|
91
129
|
|
|
92
130
|
export function kernelAccountClientActions<entryPoint extends EntryPoint>({
|
|
@@ -110,6 +148,14 @@ export function kernelAccountClientActions<entryPoint extends EntryPoint>({
|
|
|
110
148
|
middleware
|
|
111
149
|
} as SignUserOperationParameters<entryPoint, TSmartAccount>
|
|
112
150
|
),
|
|
113
|
-
getUserOperationGasPrice: async () => getUserOperationGasPrice(client)
|
|
151
|
+
getUserOperationGasPrice: async () => getUserOperationGasPrice(client),
|
|
152
|
+
prepareMultiUserOpRequest: async (args, numOfUserOps) =>
|
|
153
|
+
prepareMultiUserOpRequest(
|
|
154
|
+
client,
|
|
155
|
+
{ ...args, middleware },
|
|
156
|
+
numOfUserOps
|
|
157
|
+
),
|
|
158
|
+
sendSignedUserOperation: async (args) =>
|
|
159
|
+
sendSignedUserOperation(client, args)
|
|
114
160
|
})
|
|
115
161
|
}
|
package/index.ts
CHANGED
|
@@ -30,7 +30,8 @@ export { createFallbackKernelAccountClient } from "./clients/fallbackKernelAccou
|
|
|
30
30
|
export {
|
|
31
31
|
type KernelValidator,
|
|
32
32
|
type ZeroDevPaymasterRpcSchema,
|
|
33
|
-
type KernelPluginManager
|
|
33
|
+
type KernelPluginManager,
|
|
34
|
+
type Action
|
|
34
35
|
} from "./types/kernel.js"
|
|
35
36
|
export { KernelAccountAbi } from "./accounts/kernel/abi/KernelAccountAbi.js"
|
|
36
37
|
export { KernelFactoryAbi } from "./accounts/kernel/abi/KernelFactoryAbi.js"
|
|
@@ -50,3 +51,4 @@ export {
|
|
|
50
51
|
getCustomNonceKeyFromString
|
|
51
52
|
} from "./accounts/utils/index.js"
|
|
52
53
|
export { KernelEIP1193Provider } from "./providers/index.js"
|
|
54
|
+
export { getEncodedPluginsData } from "./accounts/kernel/utils/plugins/ep0_7/getEncodedPluginsData.js"
|
package/package.json
CHANGED
package/types/kernel.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
UserOperation,
|
|
8
8
|
UserOperationWithBigIntAsHex
|
|
9
9
|
} from "permissionless/types/userOperation"
|
|
10
|
-
import type { Address, Hex, LocalAccount } from "viem"
|
|
10
|
+
import type { Address, CustomSource, Hex, LocalAccount } from "viem"
|
|
11
11
|
import type { PartialBy } from "viem/types/utils"
|
|
12
12
|
import type { VALIDATOR_TYPE } from "../constants.js"
|
|
13
13
|
export type ZeroDevPaymasterRpcSchema<entryPoint extends EntryPoint> = [
|
|
@@ -134,6 +134,10 @@ export type KernelValidator<
|
|
|
134
134
|
userOperation: UserOperation<GetEntryPointVersion<entryPoint>>,
|
|
135
135
|
pluginEnableSignature?: Hex
|
|
136
136
|
): Promise<Hex>
|
|
137
|
+
getMultiUserOpDummySignature?(
|
|
138
|
+
userOperation: UserOperation<GetEntryPointVersion<entryPoint>>,
|
|
139
|
+
numOfUserOps: number
|
|
140
|
+
): Promise<Hex>
|
|
137
141
|
signUserOperation: (
|
|
138
142
|
userOperation: UserOperation<GetEntryPointVersion<entryPoint>>,
|
|
139
143
|
pluginEnableSignature?: Hex
|
|
@@ -151,12 +155,20 @@ export type ValidatorInitData = {
|
|
|
151
155
|
|
|
152
156
|
export type KernelPluginManager<entryPoint extends EntryPoint> =
|
|
153
157
|
KernelValidator<entryPoint> & {
|
|
158
|
+
sudoValidator?: KernelValidator<entryPoint>
|
|
159
|
+
activeValidator: KernelValidator<entryPoint>
|
|
154
160
|
getPluginEnableSignature(accountAddress: Address): Promise<Hex>
|
|
155
161
|
getValidatorInitData(): Promise<ValidatorInitData>
|
|
156
162
|
getAction(): Action
|
|
157
163
|
getValidityData(): PluginValidityData
|
|
158
164
|
getIdentifier(isSudo?: boolean): Hex
|
|
159
165
|
encodeModuleInstallCallData: (accountAddress: Address) => Promise<Hex>
|
|
166
|
+
getPluginsEnableTypedData: (
|
|
167
|
+
accountAddress: Address
|
|
168
|
+
) => Promise<Parameters<CustomSource["signTypedData"]>[0]>
|
|
169
|
+
signUserOperationWithActiveValidator: (
|
|
170
|
+
userOperation: UserOperation<GetEntryPointVersion<entryPoint>>
|
|
171
|
+
) => Promise<Hex>
|
|
160
172
|
}
|
|
161
173
|
|
|
162
174
|
export type PluginInstallData<entryPoint extends EntryPoint> =
|