@zerodev/sdk 5.2.1-alpha-10 → 5.2.2
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 +14 -7
- package/_cjs/accounts/kernel/createKernelAccount.js.map +1 -1
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js +27 -0
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js.map +1 -0
- package/_cjs/accounts/kernel/utils/account/ep0_7/getKernelV3Nonce.js +2 -2
- package/_cjs/accounts/kernel/utils/account/ep0_7/getKernelV3Nonce.js.map +1 -1
- package/_cjs/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.js.map +1 -1
- package/_cjs/accounts/kernel/utils/plugins/ep0_7/isPluginInitialized.js +2 -2
- package/_cjs/accounts/kernel/utils/plugins/ep0_7/isPluginInitialized.js.map +1 -1
- package/_cjs/accounts/kernel/v1/createKernelV1Account.js +3 -0
- package/_cjs/accounts/kernel/v1/createKernelV1Account.js.map +1 -1
- package/_cjs/accounts/kernel/v2/createKernelV2Account.js +3 -0
- package/_cjs/accounts/kernel/v2/createKernelV2Account.js.map +1 -1
- package/_cjs/accounts/utils/6492.js +2 -2
- package/_cjs/accounts/utils/6492.js.map +1 -1
- package/_cjs/accounts/utils/toKernelPluginManager.js +20 -0
- package/_cjs/accounts/utils/toKernelPluginManager.js.map +1 -1
- package/_cjs/actions/account-client/signUserOperation.js +2 -1
- package/_cjs/actions/account-client/signUserOperation.js.map +1 -1
- package/_cjs/constants.js +2 -1
- package/_cjs/constants.js.map +1 -1
- package/_cjs/types/kernel.js.map +1 -1
- package/_cjs/utils.js +1 -1
- package/_cjs/utils.js.map +1 -1
- package/_esm/accounts/kernel/createKernelAccount.js +14 -7
- package/_esm/accounts/kernel/createKernelAccount.js.map +1 -1
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js +23 -0
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js.map +1 -0
- package/_esm/accounts/kernel/utils/account/ep0_7/getKernelV3Nonce.js +2 -2
- package/_esm/accounts/kernel/utils/account/ep0_7/getKernelV3Nonce.js.map +1 -1
- package/_esm/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.js.map +1 -1
- package/_esm/accounts/kernel/utils/plugins/ep0_7/isPluginInitialized.js +2 -2
- package/_esm/accounts/kernel/utils/plugins/ep0_7/isPluginInitialized.js.map +1 -1
- package/_esm/accounts/kernel/v1/createKernelV1Account.js +3 -0
- package/_esm/accounts/kernel/v1/createKernelV1Account.js.map +1 -1
- package/_esm/accounts/kernel/v2/createKernelV2Account.js +4 -0
- package/_esm/accounts/kernel/v2/createKernelV2Account.js.map +1 -1
- package/_esm/accounts/utils/6492.js +2 -2
- package/_esm/accounts/utils/6492.js.map +1 -1
- package/_esm/accounts/utils/toKernelPluginManager.js +20 -0
- package/_esm/accounts/utils/toKernelPluginManager.js.map +1 -1
- package/_esm/actions/account-client/signUserOperation.js +3 -2
- package/_esm/actions/account-client/signUserOperation.js.map +1 -1
- package/_esm/constants.js +2 -1
- package/_esm/constants.js.map +1 -1
- package/_esm/types/kernel.js.map +1 -1
- package/_esm/utils.js +2 -1
- package/_esm/utils.js.map +1 -1
- package/_types/accounts/kernel/createKernelAccount.d.ts +1 -0
- package/_types/accounts/kernel/createKernelAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.d.ts +14 -0
- package/_types/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/account/ep0_7/getKernelV3Nonce.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/plugins/ep0_7/isPluginInitialized.d.ts.map +1 -1
- package/_types/accounts/kernel/v1/createKernelV1Account.d.ts.map +1 -1
- package/_types/accounts/kernel/v2/createKernelV2Account.d.ts +3 -9
- package/_types/accounts/kernel/v2/createKernelV2Account.d.ts.map +1 -1
- package/_types/accounts/utils/6492.d.ts.map +1 -1
- package/_types/accounts/utils/toKernelPluginManager.d.ts.map +1 -1
- package/_types/actions/account-client/signUserOperation.d.ts.map +1 -1
- package/_types/clients/kernelAccountClient.d.ts +14 -10
- package/_types/clients/kernelAccountClient.d.ts.map +1 -1
- package/_types/clients/paymasterClient.d.ts +4 -0
- package/_types/clients/paymasterClient.d.ts.map +1 -1
- package/_types/constants.d.ts.map +1 -1
- package/_types/types/kernel.d.ts +10 -1
- package/_types/types/kernel.d.ts.map +1 -1
- package/_types/utils.d.ts.map +1 -1
- package/accounts/kernel/createKernelAccount.ts +16 -6
- package/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.ts +35 -0
- package/accounts/kernel/utils/account/ep0_7/getKernelV3Nonce.ts +3 -2
- package/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.ts +0 -1
- package/accounts/kernel/utils/plugins/ep0_7/isPluginInitialized.ts +3 -2
- package/accounts/kernel/v1/createKernelV1Account.ts +3 -0
- package/accounts/kernel/v2/createKernelV2Account.ts +7 -15
- package/accounts/utils/6492.ts +3 -2
- package/accounts/utils/toKernelPluginManager.ts +19 -0
- package/actions/account-client/signUserOperation.ts +3 -2
- package/constants.ts +3 -1
- package/package.json +3 -3
- package/types/kernel.ts +18 -1
- package/utils.ts +2 -1
package/_types/types/kernel.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EntryPoint } from "permissionless/types";
|
|
1
|
+
import type { ENTRYPOINT_ADDRESS_V06_TYPE, EntryPoint } from "permissionless/types";
|
|
2
2
|
import type { GetEntryPointVersion } from "permissionless/types/entrypoint";
|
|
3
3
|
import type { UserOperation, UserOperationWithBigIntAsHex } from "permissionless/types/userOperation";
|
|
4
4
|
import { type Address, type Hex, type LocalAccount } from "viem";
|
|
@@ -110,7 +110,16 @@ export type KernelPluginManager<entryPoint extends EntryPoint> = KernelValidator
|
|
|
110
110
|
getAction(): Action;
|
|
111
111
|
getValidityData(): PluginValidityData;
|
|
112
112
|
getIdentifier(isSudo?: boolean): Hex;
|
|
113
|
+
encodeModuleInstallCallData: (accountAddress: Address) => Promise<Hex>;
|
|
113
114
|
};
|
|
115
|
+
export type PluginInstallData<entryPoint extends EntryPoint> = entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE ? {
|
|
116
|
+
selector: Hex;
|
|
117
|
+
executor: Address;
|
|
118
|
+
validator: Address;
|
|
119
|
+
validUntil: number;
|
|
120
|
+
validAfter: number;
|
|
121
|
+
enableData: Hex;
|
|
122
|
+
} : never;
|
|
114
123
|
export type KernelPluginManagerParams<entryPoint extends EntryPoint> = {
|
|
115
124
|
sudo?: KernelValidator<entryPoint>;
|
|
116
125
|
regular?: KernelValidator<entryPoint>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../types/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../types/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,2BAA2B,EAC3B,UAAU,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,KAAK,EACR,aAAa,EACb,4BAA4B,EAC/B,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAA;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,MAAM,MAAM,yBAAyB,CAAC,UAAU,SAAS,UAAU,IAAI;IACnE;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AE,OAAO,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,GAAG,CAAA;IACT,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAA;CACjC,EAAE,CAAA;AAET,MAAM,MAAM,SAAS,GAAG;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,GAAG,CAAA;CAChB,CAAA"}
|
package/_types/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAEjE,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,GAAG,EASX,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,EACH,SAAS,EACT,SAAS,EAGZ,MAAM,gBAAgB,CAAA;AAEvB,eAAO,MAAM,gBAAgB,8EAEZ,OAAO,KACrB,MAQF,CAAA;AAED,oBAAY,eAAe;IACvB,mBAAmB,wBAAwB;IAC3C,sBAAsB,2BAA2B;IACjD,qCAAqC,0CAA0C;CAClF;AAQD,eAAO,MAAM,gBAAgB,YAChB,eAAe,WACf,MAAM,KAChB,OAMF,CAAA;AAED,eAAO,MAAM,4BAA4B,WAC7B,uBAAuB,UAAU,CAAC;cAK5B,OAAO;mBACF,MAAM;MAE1B,QAAQ;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,CAmBnD,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,GAAG,KAAG,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAEjE,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,GAAG,EASX,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,EACH,SAAS,EACT,SAAS,EAGZ,MAAM,gBAAgB,CAAA;AAEvB,eAAO,MAAM,gBAAgB,8EAEZ,OAAO,KACrB,MAQF,CAAA;AAED,oBAAY,eAAe;IACvB,mBAAmB,wBAAwB;IAC3C,sBAAsB,2BAA2B;IACjD,qCAAqC,0CAA0C;CAClF;AAQD,eAAO,MAAM,gBAAgB,YAChB,eAAe,WACf,MAAM,KAChB,OAMF,CAAA;AAED,eAAO,MAAM,4BAA4B,WAC7B,uBAAuB,UAAU,CAAC;cAK5B,OAAO;mBACF,MAAM;MAE1B,QAAQ;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,CAmBnD,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,GAAG,KAAG,GAcxC,CAAA;AAED,eAAO,MAAM,WAAW;cAIV,SAAS;cACT,SAAS;MACnB,GAQH,CAAA"}
|
|
@@ -60,6 +60,7 @@ export type KernelSmartAccount<
|
|
|
60
60
|
getNonce: (customNonceKey?: bigint) => Promise<bigint>
|
|
61
61
|
generateInitCode: () => Promise<Hex>
|
|
62
62
|
encodeCallData: (args: KernelEncodeCallDataArgs) => Promise<Hex>
|
|
63
|
+
encodeModuleInstallCallData: () => Promise<Hex>
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
export type CreateKernelAccountParameters<entryPoint extends EntryPoint> = {
|
|
@@ -267,21 +268,23 @@ export async function createKernelAccount<
|
|
|
267
268
|
plugins,
|
|
268
269
|
entryPoint: entryPointAddress,
|
|
269
270
|
index = 0n,
|
|
270
|
-
factoryAddress
|
|
271
|
-
accountLogicAddress
|
|
271
|
+
factoryAddress,
|
|
272
|
+
accountLogicAddress,
|
|
272
273
|
factoryStakerAddress = KERNEL_ADDRESSES.FACTORY_STAKER,
|
|
273
274
|
deployedAccountAddress
|
|
274
275
|
}: CreateKernelAccountParameters<entryPoint>
|
|
275
276
|
): Promise<KernelSmartAccount<entryPoint, TTransport, TChain>> {
|
|
276
277
|
const entryPointVersion = getEntryPointVersion(entryPointAddress)
|
|
277
278
|
accountLogicAddress =
|
|
278
|
-
|
|
279
|
+
accountLogicAddress ??
|
|
280
|
+
(entryPointVersion === "v0.6"
|
|
279
281
|
? KERNEL_ADDRESSES.ACCOUNT_LOGIC_V0_6
|
|
280
|
-
: KERNEL_ADDRESSES.ACCOUNT_LOGIC_V0_7
|
|
282
|
+
: KERNEL_ADDRESSES.ACCOUNT_LOGIC_V0_7)
|
|
281
283
|
factoryAddress =
|
|
282
|
-
|
|
284
|
+
factoryAddress ??
|
|
285
|
+
(entryPointVersion === "v0.6"
|
|
283
286
|
? KERNEL_ADDRESSES.FACTORY_ADDRESS_V0_6
|
|
284
|
-
: KERNEL_ADDRESSES.FACTORY_ADDRESS_V0_7
|
|
287
|
+
: KERNEL_ADDRESSES.FACTORY_ADDRESS_V0_7)
|
|
285
288
|
|
|
286
289
|
const kernelPluginManager = isKernelPluginManager<entryPoint>(plugins)
|
|
287
290
|
? plugins
|
|
@@ -294,6 +297,8 @@ export async function createKernelAccount<
|
|
|
294
297
|
})
|
|
295
298
|
// Helper to generate the init code for the smart account
|
|
296
299
|
const generateInitCode = async () => {
|
|
300
|
+
if (!accountLogicAddress || !factoryAddress)
|
|
301
|
+
throw new Error("Missing account logic address or factory address")
|
|
297
302
|
return getAccountInitCode<entryPoint>({
|
|
298
303
|
index,
|
|
299
304
|
factoryAddress,
|
|
@@ -323,6 +328,11 @@ export async function createKernelAccount<
|
|
|
323
328
|
return {
|
|
324
329
|
kernelPluginManager,
|
|
325
330
|
generateInitCode,
|
|
331
|
+
encodeModuleInstallCallData: async () => {
|
|
332
|
+
return await kernelPluginManager.encodeModuleInstallCallData(
|
|
333
|
+
accountAddress
|
|
334
|
+
)
|
|
335
|
+
},
|
|
326
336
|
...toSmartAccount({
|
|
327
337
|
address: accountAddress,
|
|
328
338
|
publicKey: accountAddress,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ENTRYPOINT_ADDRESS_V06_TYPE } from "permissionless/types/entrypoint"
|
|
2
|
+
import { type Address, type Hex, encodeFunctionData } from "viem"
|
|
3
|
+
import type { PluginInstallData } from "../../../../../types/kernel.js"
|
|
4
|
+
import { KernelAccountAbi } from "../../../abi/KernelAccountAbi.js"
|
|
5
|
+
import { encodeCallData } from "./encodeCallData.js"
|
|
6
|
+
|
|
7
|
+
export const encodeModuleInstallCallData = async ({
|
|
8
|
+
accountAddress,
|
|
9
|
+
enableData,
|
|
10
|
+
executor,
|
|
11
|
+
selector,
|
|
12
|
+
validAfter,
|
|
13
|
+
validUntil,
|
|
14
|
+
validator
|
|
15
|
+
}: {
|
|
16
|
+
accountAddress: Address
|
|
17
|
+
} & PluginInstallData<ENTRYPOINT_ADDRESS_V06_TYPE>): Promise<Hex> => {
|
|
18
|
+
return encodeCallData({
|
|
19
|
+
to: accountAddress,
|
|
20
|
+
value: 0n,
|
|
21
|
+
data: encodeFunctionData({
|
|
22
|
+
abi: KernelAccountAbi,
|
|
23
|
+
functionName: "setExecution",
|
|
24
|
+
args: [
|
|
25
|
+
selector,
|
|
26
|
+
executor,
|
|
27
|
+
validator,
|
|
28
|
+
validUntil,
|
|
29
|
+
validAfter,
|
|
30
|
+
enableData
|
|
31
|
+
]
|
|
32
|
+
}),
|
|
33
|
+
callType: "call"
|
|
34
|
+
})
|
|
35
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getAction } from "permissionless"
|
|
2
1
|
import type { Address, Client } from "viem"
|
|
3
2
|
import { readContract } from "viem/actions"
|
|
3
|
+
import { getAction } from "viem/utils"
|
|
4
4
|
import { KernelV3AccountAbi } from "../../../abi/kernel_v_3_0_0/KernelAccountAbi.js"
|
|
5
5
|
|
|
6
6
|
export const getKernelV3Nonce = async (
|
|
@@ -10,7 +10,8 @@ export const getKernelV3Nonce = async (
|
|
|
10
10
|
try {
|
|
11
11
|
const nonce = await getAction(
|
|
12
12
|
client,
|
|
13
|
-
readContract
|
|
13
|
+
readContract,
|
|
14
|
+
"sendTransaction"
|
|
14
15
|
)({
|
|
15
16
|
abi: KernelV3AccountAbi,
|
|
16
17
|
address: accountAddress,
|
|
@@ -34,7 +34,6 @@ export const getPluginsEnableTypedData = async <
|
|
|
34
34
|
accountAddress: Address
|
|
35
35
|
chainId: number
|
|
36
36
|
kernelVersion: string
|
|
37
|
-
// { action, validator }: Kernel2_0_plugins
|
|
38
37
|
} & Kernel2_0_plugins<entryPoint> &
|
|
39
38
|
PluginValidityData): Promise<
|
|
40
39
|
Parameters<CustomSource["signTypedData"]>[0]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getAction } from "permissionless"
|
|
2
1
|
import type { Address, Client } from "viem"
|
|
3
2
|
import { readContract } from "viem/actions"
|
|
3
|
+
import { getAction } from "viem/utils"
|
|
4
4
|
import { KernelModuleIsInitializedAbi } from "../../../abi/kernel_v_3_0_0/KernelModuleAbi.js"
|
|
5
5
|
|
|
6
6
|
export const isPluginInitialized = async (
|
|
@@ -11,7 +11,8 @@ export const isPluginInitialized = async (
|
|
|
11
11
|
try {
|
|
12
12
|
return await getAction(
|
|
13
13
|
client,
|
|
14
|
-
readContract
|
|
14
|
+
readContract,
|
|
15
|
+
"readContract"
|
|
15
16
|
)({
|
|
16
17
|
abi: KernelModuleIsInitializedAbi,
|
|
17
18
|
address: pluginAddress,
|
|
@@ -213,6 +213,9 @@ export async function createKernelV1Account<
|
|
|
213
213
|
return {
|
|
214
214
|
...account,
|
|
215
215
|
generateInitCode,
|
|
216
|
+
encodeModuleInstallCallData: async () => {
|
|
217
|
+
throw new Error("Not implemented")
|
|
218
|
+
},
|
|
216
219
|
client: client,
|
|
217
220
|
publicKey: accountAddress,
|
|
218
221
|
entryPoint: entryPointAddress,
|
|
@@ -4,10 +4,7 @@ import {
|
|
|
4
4
|
getSenderAddress,
|
|
5
5
|
isSmartAccountDeployed
|
|
6
6
|
} from "permissionless"
|
|
7
|
-
import {
|
|
8
|
-
SignTransactionNotSupportedBySmartAccount,
|
|
9
|
-
type SmartAccount
|
|
10
|
-
} from "permissionless/accounts"
|
|
7
|
+
import { SignTransactionNotSupportedBySmartAccount } from "permissionless/accounts"
|
|
11
8
|
import type {
|
|
12
9
|
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
13
10
|
EntryPoint
|
|
@@ -47,20 +44,10 @@ import {
|
|
|
47
44
|
isKernelPluginManager,
|
|
48
45
|
toKernelPluginManager
|
|
49
46
|
} from "../../utils/toKernelPluginManager.js"
|
|
47
|
+
import { type KernelSmartAccount } from "../createKernelAccount.js"
|
|
50
48
|
import { KernelAccountV2Abi } from "./abi/KernelAccountV2Abi.js"
|
|
51
49
|
import { KernelFactoryV2Abi } from "./abi/KernelFactoryV2Abi.js"
|
|
52
50
|
|
|
53
|
-
export type KernelSmartAccount<
|
|
54
|
-
entryPoint extends EntryPoint,
|
|
55
|
-
transport extends Transport = Transport,
|
|
56
|
-
chain extends Chain | undefined = Chain | undefined
|
|
57
|
-
> = SmartAccount<entryPoint, "kernelSmartAccount", transport, chain> & {
|
|
58
|
-
kernelPluginManager: KernelPluginManager<entryPoint>
|
|
59
|
-
getNonce: (customNonceKey?: bigint) => Promise<bigint>
|
|
60
|
-
generateInitCode: () => Promise<Hex>
|
|
61
|
-
encodeCallData: (args: KernelEncodeCallDataArgs) => Promise<Hex>
|
|
62
|
-
}
|
|
63
|
-
|
|
64
51
|
// Safe's library for create and create2: https://github.com/safe-global/safe-contracts/blob/0acdd35a203299585438f53885df630f9d486a86/contracts/libraries/CreateCall.sol
|
|
65
52
|
// Address was found here: https://github.com/safe-global/safe-deployments/blob/926ec6bbe2ebcac3aa2c2c6c0aff74aa590cbc6a/src/assets/v1.4.1/create_call.json
|
|
66
53
|
const createCallAddress = "0x9b35Af71d77eaf8d7e40252370304687390A1A52"
|
|
@@ -289,6 +276,11 @@ export async function createKernelV2Account<
|
|
|
289
276
|
source: "kernelSmartAccount",
|
|
290
277
|
kernelPluginManager,
|
|
291
278
|
generateInitCode,
|
|
279
|
+
encodeModuleInstallCallData: async () => {
|
|
280
|
+
return await kernelPluginManager.encodeModuleInstallCallData(
|
|
281
|
+
accountAddress
|
|
282
|
+
)
|
|
283
|
+
},
|
|
292
284
|
async getFactory() {
|
|
293
285
|
if (smartAccountDeployed) return undefined
|
|
294
286
|
|
package/accounts/utils/6492.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// copied from: https://github.com/alchemyplatform/aa-sdk/blob/266c9757cd721ef0bd97d04c0b592a329f8a9da5/packages/core/src/signer/utils.ts
|
|
2
2
|
|
|
3
|
-
import { getAction } from "permissionless"
|
|
4
3
|
import {
|
|
5
4
|
type Address,
|
|
6
5
|
type Chain,
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
parseAbiParameters
|
|
15
14
|
} from "viem"
|
|
16
15
|
import { getStorageAt } from "viem/actions"
|
|
16
|
+
import { getAction } from "viem/utils"
|
|
17
17
|
|
|
18
18
|
export type SignWith6492Params = {
|
|
19
19
|
factoryAddress: Address
|
|
@@ -85,7 +85,8 @@ export const getKernelImplementationAddress = async <
|
|
|
85
85
|
try {
|
|
86
86
|
const strgAddr = await getAction(
|
|
87
87
|
client,
|
|
88
|
-
getStorageAt
|
|
88
|
+
getStorageAt,
|
|
89
|
+
"getStorageAt"
|
|
89
90
|
)({
|
|
90
91
|
address: accountAddress,
|
|
91
92
|
slot: "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
zeroAddress
|
|
16
16
|
} from "viem"
|
|
17
17
|
import { getChainId } from "viem/actions"
|
|
18
|
+
import { encodeModuleInstallCallData as encodeModuleInstallCallDataEpV06 } from "../../accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js"
|
|
18
19
|
import { VALIDATOR_MODE, VALIDATOR_TYPE } from "../../constants.js"
|
|
19
20
|
import {
|
|
20
21
|
type KernelPluginManager,
|
|
@@ -193,6 +194,24 @@ export async function toKernelPluginManager<
|
|
|
193
194
|
return {
|
|
194
195
|
...activeValidator,
|
|
195
196
|
getIdentifier,
|
|
197
|
+
encodeModuleInstallCallData: async (accountAddress: Address) => {
|
|
198
|
+
if (!action) {
|
|
199
|
+
throw new Error("Action data must be set")
|
|
200
|
+
}
|
|
201
|
+
if (!regular) throw new Error("regular validator not set")
|
|
202
|
+
if (entryPointVersion === "v0.6") {
|
|
203
|
+
return await encodeModuleInstallCallDataEpV06({
|
|
204
|
+
accountAddress,
|
|
205
|
+
selector: action.selector,
|
|
206
|
+
executor: action.address,
|
|
207
|
+
validator: regular?.address,
|
|
208
|
+
validUntil,
|
|
209
|
+
validAfter,
|
|
210
|
+
enableData: await regular.getEnableData(accountAddress)
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
throw new Error("EntryPoint v0.7 not supported yet")
|
|
214
|
+
},
|
|
196
215
|
signUserOperation: async (userOperation) => {
|
|
197
216
|
const userOpSig =
|
|
198
217
|
await activeValidator.signUserOperation(userOperation)
|
|
@@ -13,10 +13,10 @@ import type {
|
|
|
13
13
|
} from "permissionless/types"
|
|
14
14
|
import {
|
|
15
15
|
AccountOrClientNotFoundError,
|
|
16
|
-
getAction,
|
|
17
16
|
parseAccount
|
|
18
17
|
} from "permissionless/utils"
|
|
19
18
|
import type { Chain, Client, Transport } from "viem"
|
|
19
|
+
import { getAction } from "viem/utils"
|
|
20
20
|
|
|
21
21
|
export type SignUserOperationParameters<
|
|
22
22
|
entryPoint extends EntryPoint,
|
|
@@ -60,7 +60,8 @@ export async function signUserOperation<
|
|
|
60
60
|
|
|
61
61
|
const userOperation = await getAction(
|
|
62
62
|
client,
|
|
63
|
-
prepareUserOperationRequest<entryPoint, TTransport, TChain, TAccount
|
|
63
|
+
prepareUserOperationRequest<entryPoint, TTransport, TChain, TAccount>,
|
|
64
|
+
"prepareUserOperationRequest"
|
|
64
65
|
)(args)
|
|
65
66
|
|
|
66
67
|
userOperation.signature = await account.signUserOperation(
|
package/constants.ts
CHANGED
|
@@ -43,5 +43,7 @@ export const safeCreateCallAddress =
|
|
|
43
43
|
"0x9b35Af71d77eaf8d7e40252370304687390A1A52"
|
|
44
44
|
export const KernelFactoryToInitCodeHashMap: { [key: Address]: Hex } = {
|
|
45
45
|
"0x5de4839a76cf55d0c90e2061ef4386d962E15ae3":
|
|
46
|
-
"0xee9d8350bd899dd261db689aafd87eb8a30f085adbaff48152399438ff4eed73"
|
|
46
|
+
"0xee9d8350bd899dd261db689aafd87eb8a30f085adbaff48152399438ff4eed73",
|
|
47
|
+
"0x6723b44Abeec4E71eBE3232BD5B455805baDD22f":
|
|
48
|
+
"0x6fe6e6ea30eddce942b9618033ab8429f9ddac594053bec8a6744fffc71976e2"
|
|
47
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zerodev/sdk",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
4
4
|
"author": "ZeroDev",
|
|
5
5
|
"main": "./_cjs/index.js",
|
|
6
6
|
"module": "./_esm/index.js",
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
|
-
"viem": "^2.
|
|
94
|
-
"permissionless": "^0.1.
|
|
93
|
+
"viem": "^2.9.17",
|
|
94
|
+
"permissionless": "^0.1.17"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"semver": "^7.6.0"
|
package/types/kernel.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
3
|
+
EntryPoint
|
|
4
|
+
} from "permissionless/types"
|
|
2
5
|
import type { GetEntryPointVersion } from "permissionless/types/entrypoint"
|
|
3
6
|
import type {
|
|
4
7
|
UserOperation,
|
|
@@ -151,8 +154,22 @@ export type KernelPluginManager<entryPoint extends EntryPoint> =
|
|
|
151
154
|
getAction(): Action
|
|
152
155
|
getValidityData(): PluginValidityData
|
|
153
156
|
getIdentifier(isSudo?: boolean): Hex
|
|
157
|
+
encodeModuleInstallCallData: (accountAddress: Address) => Promise<Hex>
|
|
154
158
|
}
|
|
155
159
|
|
|
160
|
+
export type PluginInstallData<entryPoint extends EntryPoint> =
|
|
161
|
+
entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
|
|
162
|
+
? {
|
|
163
|
+
selector: Hex
|
|
164
|
+
executor: Address
|
|
165
|
+
validator: Address
|
|
166
|
+
validUntil: number
|
|
167
|
+
validAfter: number
|
|
168
|
+
enableData: Hex
|
|
169
|
+
}
|
|
170
|
+
: // TODO: Add support for EP v0.7
|
|
171
|
+
never
|
|
172
|
+
|
|
156
173
|
export type KernelPluginManagerParams<entryPoint extends EntryPoint> = {
|
|
157
174
|
sudo?: KernelValidator<entryPoint>
|
|
158
175
|
regular?: KernelValidator<entryPoint>
|
package/utils.ts
CHANGED
|
@@ -98,7 +98,8 @@ export const fixSignedData = (sig: Hex): Hex => {
|
|
|
98
98
|
|
|
99
99
|
let { r, s, v } = hexToSignature(signature)
|
|
100
100
|
if (v === 0n || v === 1n) v += 27n
|
|
101
|
-
|
|
101
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
102
|
+
const joined = signatureToHex({ r, s, v: v! })
|
|
102
103
|
return joined
|
|
103
104
|
}
|
|
104
105
|
|