@zerodev/sdk 5.2.0-alpha-0 → 5.2.0-alpha-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/README.md +3 -0
- package/_cjs/accounts/index.js +9 -2
- package/_cjs/accounts/index.js.map +1 -1
- package/_cjs/accounts/kernel/abi/EIP1271Abi.js +37 -0
- package/_cjs/accounts/kernel/abi/EIP1271Abi.js.map +1 -0
- package/_cjs/accounts/kernel/abi/SafeCreateCallAbi.js +9 -0
- package/_cjs/accounts/kernel/abi/SafeCreateCallAbi.js.map +1 -0
- package/_cjs/accounts/kernel/createKernelAccount.js +123 -360
- package/_cjs/accounts/kernel/createKernelAccount.js.map +1 -1
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeCallData.js +26 -0
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeCallData.js.map +1 -0
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.js +16 -0
- package/_cjs/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.js.map +1 -0
- package/_cjs/accounts/kernel/utils/account/ep0_7/encodeCallData.js +30 -0
- package/_cjs/accounts/kernel/utils/account/ep0_7/encodeCallData.js.map +1 -0
- package/_cjs/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.js +18 -0
- package/_cjs/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.js.map +1 -0
- package/_cjs/accounts/kernel/utils/common/accountMetadata.js +46 -0
- package/_cjs/accounts/kernel/utils/common/accountMetadata.js.map +1 -0
- package/_cjs/accounts/kernel/utils/common/eip712WrapHash.js +28 -0
- package/_cjs/accounts/kernel/utils/common/eip712WrapHash.js.map +1 -0
- package/_cjs/accounts/kernel/utils/common/encodeSafeCreateCall.js +14 -0
- package/_cjs/accounts/kernel/utils/common/encodeSafeCreateCall.js.map +1 -0
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js +22 -0
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js.map +1 -0
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js +14 -0
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js.map +1 -0
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js +14 -0
- package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js.map +1 -0
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js +42 -0
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js.map +1 -0
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteCall.js +29 -0
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteCall.js.map +1 -0
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteDelegateCall.js +13 -0
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteDelegateCall.js.map +1 -0
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteSingleCall.js +13 -0
- package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteSingleCall.js.map +1 -0
- package/_cjs/accounts/kernel/utils/ep0_7/hashKernelSignatureWrapper.js +9 -0
- package/_cjs/accounts/kernel/utils/ep0_7/hashKernelSignatureWrapper.js.map +1 -0
- package/_cjs/accounts/kernel/utils/types.js +3 -0
- package/_cjs/accounts/kernel/utils/types.js.map +1 -0
- package/_cjs/accounts/kernel/v1/createKernelV1Account.js +1 -2
- package/_cjs/accounts/kernel/v1/createKernelV1Account.js.map +1 -1
- package/_cjs/accounts/kernel/v2/abi/KernelAccountV2Abi.js +377 -0
- package/_cjs/accounts/kernel/v2/abi/KernelAccountV2Abi.js.map +1 -0
- package/_cjs/accounts/kernel/v2/abi/KernelFactoryV2Abi.js +115 -0
- package/_cjs/accounts/kernel/v2/abi/KernelFactoryV2Abi.js.map +1 -0
- package/_cjs/accounts/kernel/v2/createKernelV2Account.js +226 -0
- package/_cjs/accounts/kernel/v2/createKernelV2Account.js.map +1 -0
- package/_cjs/accounts/utils/multisend.js.map +1 -0
- package/_cjs/accounts/utils/toKernelPluginManager.js +4 -4
- package/_cjs/accounts/utils/toKernelPluginManager.js.map +1 -1
- package/_cjs/constants.js +2 -1
- package/_cjs/constants.js.map +1 -1
- package/_cjs/index.js +3 -2
- package/_cjs/index.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/index.js +5 -1
- package/_esm/accounts/index.js.map +1 -1
- package/_esm/accounts/kernel/abi/EIP1271Abi.js +34 -0
- package/_esm/accounts/kernel/abi/EIP1271Abi.js.map +1 -0
- package/_esm/accounts/kernel/abi/SafeCreateCallAbi.js +6 -0
- package/_esm/accounts/kernel/abi/SafeCreateCallAbi.js.map +1 -0
- package/_esm/accounts/kernel/createKernelAccount.js +136 -380
- package/_esm/accounts/kernel/createKernelAccount.js.map +1 -1
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeCallData.js +23 -0
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeCallData.js.map +1 -0
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.js +13 -0
- package/_esm/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.js.map +1 -0
- package/_esm/accounts/kernel/utils/account/ep0_7/encodeCallData.js +28 -0
- package/_esm/accounts/kernel/utils/account/ep0_7/encodeCallData.js.map +1 -0
- package/_esm/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.js +15 -0
- package/_esm/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.js.map +1 -0
- package/_esm/accounts/kernel/utils/common/accountMetadata.js +42 -0
- package/_esm/accounts/kernel/utils/common/accountMetadata.js.map +1 -0
- package/_esm/accounts/kernel/utils/common/eip712WrapHash.js +24 -0
- package/_esm/accounts/kernel/utils/common/eip712WrapHash.js.map +1 -0
- package/_esm/accounts/kernel/utils/common/encodeSafeCreateCall.js +10 -0
- package/_esm/accounts/kernel/utils/common/encodeSafeCreateCall.js.map +1 -0
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js +18 -0
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js.map +1 -0
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js +10 -0
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js.map +1 -0
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js +10 -0
- package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js.map +1 -0
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js +38 -0
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js.map +1 -0
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteCall.js +25 -0
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteCall.js.map +1 -0
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteDelegateCall.js +9 -0
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteDelegateCall.js.map +1 -0
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteSingleCall.js +9 -0
- package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteSingleCall.js.map +1 -0
- package/_esm/accounts/kernel/utils/ep0_7/hashKernelSignatureWrapper.js +5 -0
- package/_esm/accounts/kernel/utils/ep0_7/hashKernelSignatureWrapper.js.map +1 -0
- package/_esm/accounts/kernel/utils/types.js +2 -0
- package/_esm/accounts/kernel/utils/types.js.map +1 -0
- package/_esm/accounts/kernel/v1/createKernelV1Account.js +1 -2
- package/_esm/accounts/kernel/v1/createKernelV1Account.js.map +1 -1
- package/_esm/accounts/kernel/v2/abi/KernelAccountV2Abi.js +374 -0
- package/_esm/accounts/kernel/v2/abi/KernelAccountV2Abi.js.map +1 -0
- package/_esm/accounts/kernel/v2/abi/KernelFactoryV2Abi.js +112 -0
- package/_esm/accounts/kernel/v2/abi/KernelFactoryV2Abi.js.map +1 -0
- package/_esm/accounts/kernel/v2/createKernelV2Account.js +264 -0
- package/_esm/accounts/kernel/v2/createKernelV2Account.js.map +1 -0
- package/_esm/accounts/{kernel/v1 → utils}/multisend.js +1 -1
- package/_esm/accounts/utils/multisend.js.map +1 -0
- package/_esm/accounts/utils/toKernelPluginManager.js +4 -4
- package/_esm/accounts/utils/toKernelPluginManager.js.map +1 -1
- package/_esm/constants.js +3 -0
- package/_esm/constants.js.map +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/types/kernel.js.map +1 -1
- package/_esm/utils.js +1 -1
- package/_esm/utils.js.map +1 -1
- package/_types/accounts/index.d.ts +5 -1
- package/_types/accounts/index.d.ts.map +1 -1
- package/_types/accounts/kernel/abi/EIP1271Abi.d.ts +54 -0
- package/_types/accounts/kernel/abi/EIP1271Abi.d.ts.map +1 -0
- package/_types/accounts/kernel/abi/SafeCreateCallAbi.d.ts +35 -0
- package/_types/accounts/kernel/abi/SafeCreateCallAbi.d.ts.map +1 -0
- package/_types/accounts/kernel/createKernelAccount.d.ts +0 -54
- package/_types/accounts/kernel/createKernelAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/account/ep0_6/encodeCallData.d.ts +4 -0
- package/_types/accounts/kernel/utils/account/ep0_6/encodeCallData.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.d.ts +3 -0
- package/_types/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/account/ep0_7/encodeCallData.d.ts +4 -0
- package/_types/accounts/kernel/utils/account/ep0_7/encodeCallData.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.d.ts +3 -0
- package/_types/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/common/accountMetadata.d.ts +10 -0
- package/_types/accounts/kernel/utils/common/accountMetadata.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/common/eip712WrapHash.d.ts +4 -0
- package/_types/accounts/kernel/utils/common/eip712WrapHash.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/common/encodeSafeCreateCall.d.ts +2 -0
- package/_types/accounts/kernel/utils/common/encodeSafeCreateCall.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.d.ts +3 -0
- package/_types/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.d.ts +3 -0
- package/_types/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.d.ts +3 -0
- package/_types/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.d.ts +4 -0
- package/_types/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/ep0_7/encodeExecuteCall.d.ts +16 -0
- package/_types/accounts/kernel/utils/ep0_7/encodeExecuteCall.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/ep0_7/encodeExecuteDelegateCall.d.ts +4 -0
- package/_types/accounts/kernel/utils/ep0_7/encodeExecuteDelegateCall.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/ep0_7/encodeExecuteSingleCall.d.ts +4 -0
- package/_types/accounts/kernel/utils/ep0_7/encodeExecuteSingleCall.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/ep0_7/hashKernelSignatureWrapper.d.ts +3 -0
- package/_types/accounts/kernel/utils/ep0_7/hashKernelSignatureWrapper.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/types.d.ts +8 -0
- package/_types/accounts/kernel/utils/types.d.ts.map +1 -0
- package/_types/accounts/kernel/v1/createKernelV1Account.d.ts.map +1 -1
- package/_types/accounts/kernel/v2/abi/KernelAccountV2Abi.d.ts +447 -0
- package/_types/accounts/kernel/v2/abi/KernelAccountV2Abi.d.ts.map +1 -0
- package/_types/accounts/kernel/v2/abi/KernelFactoryV2Abi.d.ts +109 -0
- package/_types/accounts/kernel/v2/abi/KernelFactoryV2Abi.d.ts.map +1 -0
- package/_types/accounts/kernel/v2/createKernelV2Account.d.ts +33 -0
- package/_types/accounts/kernel/v2/createKernelV2Account.d.ts.map +1 -0
- package/_types/accounts/{kernel/v1 → utils}/multisend.d.ts +1 -1
- package/_types/accounts/utils/multisend.d.ts.map +1 -0
- package/_types/accounts/utils/toKernelPluginManager.d.ts +1 -1
- package/_types/accounts/utils/toKernelPluginManager.d.ts.map +1 -1
- package/_types/constants.d.ts +1 -0
- package/_types/constants.d.ts.map +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/types/index.d.ts +1 -0
- package/_types/types/index.d.ts.map +1 -1
- package/_types/types/kernel.d.ts +1 -0
- package/_types/types/kernel.d.ts.map +1 -1
- package/_types/utils.d.ts +4 -1
- package/_types/utils.d.ts.map +1 -1
- package/accounts/index.ts +5 -2
- package/accounts/kernel/abi/EIP1271Abi.ts +33 -0
- package/accounts/kernel/abi/SafeCreateCallAbi.ts +6 -0
- package/accounts/kernel/createKernelAccount.ts +164 -511
- package/accounts/kernel/utils/account/ep0_6/encodeCallData.ts +32 -0
- package/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.ts +18 -0
- package/accounts/kernel/utils/account/ep0_7/encodeCallData.ts +40 -0
- package/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.ts +20 -0
- package/accounts/kernel/utils/common/accountMetadata.ts +62 -0
- package/accounts/kernel/utils/common/eip712WrapHash.ts +48 -0
- package/accounts/kernel/utils/common/encodeSafeCreateCall.ts +14 -0
- package/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.ts +19 -0
- package/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.ts +11 -0
- package/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.ts +11 -0
- package/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.ts +51 -0
- package/accounts/kernel/utils/ep0_7/encodeExecuteCall.ts +38 -0
- package/accounts/kernel/utils/ep0_7/encodeExecuteDelegateCall.ts +16 -0
- package/accounts/kernel/utils/ep0_7/encodeExecuteSingleCall.ts +16 -0
- package/accounts/kernel/utils/ep0_7/hashKernelSignatureWrapper.ts +11 -0
- package/accounts/kernel/utils/types.ts +8 -0
- package/accounts/kernel/v1/createKernelV1Account.ts +2 -3
- package/accounts/kernel/v2/abi/KernelAccountV2Abi.ts +373 -0
- package/accounts/kernel/v2/abi/KernelFactoryV2Abi.ts +111 -0
- package/accounts/kernel/v2/createKernelV2Account.ts +409 -0
- package/accounts/{kernel/v1 → utils}/multisend.ts +1 -1
- package/accounts/utils/toKernelPluginManager.ts +6 -7
- package/constants.ts +5 -0
- package/index.ts +2 -1
- package/package.json +1 -1
- package/types/index.ts +2 -0
- package/types/kernel.ts +1 -0
- package/utils.ts +7 -1
- package/_cjs/accounts/kernel/v1/multisend.js.map +0 -1
- package/_esm/accounts/kernel/v1/multisend.js.map +0 -1
- package/_types/accounts/kernel/v1/multisend.d.ts.map +0 -1
- /package/_cjs/accounts/{kernel/v1 → utils}/multisend.js +0 -0
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
} from "permissionless"
|
|
7
7
|
import {
|
|
8
8
|
SignTransactionNotSupportedBySmartAccount,
|
|
9
|
-
type SmartAccount
|
|
9
|
+
type SmartAccount,
|
|
10
|
+
toSmartAccount
|
|
10
11
|
} from "permissionless/accounts"
|
|
11
12
|
import type {
|
|
12
13
|
ENTRYPOINT_ADDRESS_V06_TYPE,
|
|
@@ -17,55 +18,37 @@ import {
|
|
|
17
18
|
type Address,
|
|
18
19
|
type Chain,
|
|
19
20
|
type Client,
|
|
20
|
-
type EncodeDeployDataParameters,
|
|
21
|
-
type Hash,
|
|
22
21
|
type Hex,
|
|
23
22
|
type Transport,
|
|
24
23
|
type TypedDataDefinition,
|
|
25
24
|
concatHex,
|
|
26
|
-
decodeFunctionResult,
|
|
27
|
-
encodeAbiParameters,
|
|
28
|
-
encodeDeployData,
|
|
29
25
|
encodeFunctionData,
|
|
30
26
|
getTypesForEIP712Domain,
|
|
31
27
|
hashMessage,
|
|
32
28
|
hashTypedData,
|
|
33
|
-
keccak256,
|
|
34
29
|
pad,
|
|
35
|
-
parseAbi,
|
|
36
|
-
parseAbiParameters,
|
|
37
|
-
publicActions,
|
|
38
|
-
stringToHex,
|
|
39
30
|
validateTypedData,
|
|
40
31
|
zeroAddress
|
|
41
32
|
} from "viem"
|
|
42
|
-
import { toAccount } from "viem/accounts"
|
|
43
|
-
import { CALL_TYPE, EXEC_TYPE, KERNEL_NAME } from "../../constants.js"
|
|
44
33
|
import type {
|
|
45
34
|
KernelEncodeCallDataArgs,
|
|
46
35
|
KernelPluginManager,
|
|
47
36
|
KernelPluginManagerParams
|
|
48
37
|
} from "../../types/kernel.js"
|
|
49
|
-
import {
|
|
50
|
-
KERNEL_FEATURES,
|
|
51
|
-
getExecMode,
|
|
52
|
-
getKernelVersion,
|
|
53
|
-
hasKernelFeature
|
|
54
|
-
} from "../../utils.js"
|
|
55
|
-
import {
|
|
56
|
-
getKernelImplementationAddress,
|
|
57
|
-
wrapSignatureWith6492
|
|
58
|
-
} from "../utils/6492.js"
|
|
38
|
+
import { KERNEL_FEATURES, hasKernelFeature } from "../../utils.js"
|
|
59
39
|
import { parseFactoryAddressAndCallDataFromAccountInitCode } from "../utils/index.js"
|
|
60
40
|
import {
|
|
61
41
|
isKernelPluginManager,
|
|
62
42
|
toKernelPluginManager
|
|
63
43
|
} from "../utils/toKernelPluginManager.js"
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} from "./
|
|
44
|
+
import { KernelInitAbi } from "./abi/KernelAccountAbi.js"
|
|
45
|
+
import { KernelV3InitAbi } from "./abi/kernel_v_3_0_0/KernelAccountAbi.js"
|
|
46
|
+
import { encodeCallData as encodeCallDataEpV06 } from "./utils/account/ep0_6/encodeCallData.js"
|
|
47
|
+
import { encodeDeployCallData as encodeDeployCallDataV06 } from "./utils/account/ep0_6/encodeDeployCallData.js"
|
|
48
|
+
import { encodeCallData as encodeCallDataEpV07 } from "./utils/account/ep0_7/encodeCallData.js"
|
|
49
|
+
import { encodeDeployCallData as encodeDeployCallDataV07 } from "./utils/account/ep0_7/encodeDeployCallData.js"
|
|
50
|
+
import { accountMetadata } from "./utils/common/accountMetadata.js"
|
|
51
|
+
import { eip712WrapHash } from "./utils/common/eip712WrapHash.js"
|
|
69
52
|
|
|
70
53
|
export type KernelSmartAccount<
|
|
71
54
|
entryPoint extends EntryPoint,
|
|
@@ -73,7 +56,6 @@ export type KernelSmartAccount<
|
|
|
73
56
|
chain extends Chain | undefined = Chain | undefined
|
|
74
57
|
> = SmartAccount<entryPoint, "kernelSmartAccount", transport, chain> & {
|
|
75
58
|
kernelPluginManager: KernelPluginManager<entryPoint>
|
|
76
|
-
generateInitCode: () => Promise<Hex>
|
|
77
59
|
encodeCallData: (args: KernelEncodeCallDataArgs) => Promise<Hex>
|
|
78
60
|
}
|
|
79
61
|
|
|
@@ -123,48 +105,6 @@ const createAccountAbi = [
|
|
|
123
105
|
}
|
|
124
106
|
] as const
|
|
125
107
|
|
|
126
|
-
// Safe's library for create and create2: https://github.com/safe-global/safe-contracts/blob/0acdd35a203299585438f53885df630f9d486a86/contracts/libraries/CreateCall.sol
|
|
127
|
-
// Address was found here: https://github.com/safe-global/safe-deployments/blob/926ec6bbe2ebcac3aa2c2c6c0aff74aa590cbc6a/src/assets/v1.4.1/create_call.json
|
|
128
|
-
const createCallAddress = "0x9b35Af71d77eaf8d7e40252370304687390A1A52"
|
|
129
|
-
|
|
130
|
-
const createCallAbi = parseAbi([
|
|
131
|
-
"function performCreate(uint256 value, bytes memory deploymentData) public returns (address newContract)",
|
|
132
|
-
"function performCreate2(uint256 value, bytes memory deploymentData, bytes32 salt) public returns (address newContract)"
|
|
133
|
-
])
|
|
134
|
-
|
|
135
|
-
export const EIP1271ABI = [
|
|
136
|
-
{
|
|
137
|
-
type: "function",
|
|
138
|
-
name: "eip712Domain",
|
|
139
|
-
inputs: [],
|
|
140
|
-
outputs: [
|
|
141
|
-
{ name: "fields", type: "bytes1", internalType: "bytes1" },
|
|
142
|
-
{ name: "name", type: "string", internalType: "string" },
|
|
143
|
-
{ name: "version", type: "string", internalType: "string" },
|
|
144
|
-
{ name: "chainId", type: "uint256", internalType: "uint256" },
|
|
145
|
-
{
|
|
146
|
-
name: "verifyingContract",
|
|
147
|
-
type: "address",
|
|
148
|
-
internalType: "address"
|
|
149
|
-
},
|
|
150
|
-
{ name: "salt", type: "bytes32", internalType: "bytes32" },
|
|
151
|
-
{ name: "extensions", type: "uint256[]", internalType: "uint256[]" }
|
|
152
|
-
],
|
|
153
|
-
stateMutability: "view"
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
type: "function",
|
|
157
|
-
name: "isValidSignature",
|
|
158
|
-
inputs: [
|
|
159
|
-
{ name: "data", type: "bytes32", internalType: "bytes32" },
|
|
160
|
-
{ name: "signature", type: "bytes", internalType: "bytes" }
|
|
161
|
-
],
|
|
162
|
-
outputs: [
|
|
163
|
-
{ name: "magicValue", type: "bytes4", internalType: "bytes4" }
|
|
164
|
-
],
|
|
165
|
-
stateMutability: "view"
|
|
166
|
-
}
|
|
167
|
-
] as const
|
|
168
108
|
/**
|
|
169
109
|
* Default addresses for kernel smart account
|
|
170
110
|
*/
|
|
@@ -364,146 +304,91 @@ export async function createKernelAccount<
|
|
|
364
304
|
accountAddress
|
|
365
305
|
)
|
|
366
306
|
|
|
367
|
-
|
|
368
|
-
|
|
307
|
+
return {
|
|
308
|
+
kernelPluginManager,
|
|
309
|
+
...toSmartAccount({
|
|
310
|
+
address: accountAddress,
|
|
311
|
+
publicKey: accountAddress,
|
|
312
|
+
source: "kernelSmartAccount",
|
|
369
313
|
client,
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
)
|
|
376
|
-
if (
|
|
377
|
-
!hasKernelFeature(
|
|
378
|
-
KERNEL_FEATURES.ERC1271_SIG_WRAPPER,
|
|
379
|
-
kernelVersion
|
|
380
|
-
)
|
|
381
|
-
) {
|
|
382
|
-
return kernelPluginManager.signMessage({
|
|
383
|
-
message: {
|
|
384
|
-
raw: messageHash
|
|
314
|
+
entryPoint: entryPointAddress,
|
|
315
|
+
// Encode the deploy call data
|
|
316
|
+
async encodeDeployCallData(_tx) {
|
|
317
|
+
if (entryPointVersion === "v0.6") {
|
|
318
|
+
return encodeDeployCallDataV06(_tx)
|
|
385
319
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
to
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
320
|
+
return encodeDeployCallDataV07(_tx)
|
|
321
|
+
},
|
|
322
|
+
async encodeCallData(_tx) {
|
|
323
|
+
const tx = _tx as KernelEncodeCallDataArgs
|
|
324
|
+
if (
|
|
325
|
+
!Array.isArray(tx) &&
|
|
326
|
+
tx.callType === "call" &&
|
|
327
|
+
tx.to.toLowerCase() === accountAddress.toLowerCase()
|
|
328
|
+
) {
|
|
329
|
+
return tx.data
|
|
330
|
+
}
|
|
331
|
+
if (entryPointVersion === "v0.6") {
|
|
332
|
+
return encodeCallDataEpV06(tx)
|
|
333
|
+
}
|
|
334
|
+
return encodeCallDataEpV07(tx)
|
|
335
|
+
},
|
|
336
|
+
async getFactory() {
|
|
337
|
+
if (smartAccountDeployed) return undefined
|
|
402
338
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
if (domain !== "0x") {
|
|
408
|
-
const decoded = decodeFunctionResult({
|
|
409
|
-
abi: [...EIP1271ABI],
|
|
410
|
-
functionName: "eip712Domain",
|
|
411
|
-
data: domain
|
|
412
|
-
})
|
|
413
|
-
|
|
414
|
-
name = decoded[1]
|
|
415
|
-
version = decoded[2]
|
|
416
|
-
chainId = decoded[3]
|
|
417
|
-
} else {
|
|
418
|
-
name = KERNEL_NAME
|
|
419
|
-
version = kernelVersion
|
|
420
|
-
chainId = client.chain
|
|
421
|
-
? BigInt(client.chain.id)
|
|
422
|
-
: BigInt(await client.extend(publicActions).getChainId())
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
const encoded = encodeAbiParameters(
|
|
426
|
-
[
|
|
427
|
-
{ type: "bytes32" },
|
|
428
|
-
{ type: "bytes32" },
|
|
429
|
-
{ type: "bytes32" },
|
|
430
|
-
{ type: "uint256" },
|
|
431
|
-
{ type: "address" }
|
|
432
|
-
],
|
|
433
|
-
[
|
|
434
|
-
keccak256(
|
|
435
|
-
stringToHex(
|
|
436
|
-
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
|
|
437
|
-
)
|
|
438
|
-
),
|
|
439
|
-
keccak256(stringToHex(name)),
|
|
440
|
-
keccak256(stringToHex(version)),
|
|
441
|
-
BigInt(chainId),
|
|
442
|
-
accountAddress
|
|
443
|
-
]
|
|
444
|
-
)
|
|
445
|
-
|
|
446
|
-
const domainSeparator = keccak256(encoded)
|
|
447
|
-
|
|
448
|
-
let finalMessageHash = messageHash
|
|
449
|
-
if (
|
|
450
|
-
hasKernelFeature(
|
|
451
|
-
KERNEL_FEATURES.ERC1271_SIG_WRAPPER_WITH_WRAPPED_HASH,
|
|
452
|
-
kernelVersion
|
|
453
|
-
)
|
|
454
|
-
) {
|
|
455
|
-
finalMessageHash = keccak256(
|
|
456
|
-
encodeAbiParameters(
|
|
457
|
-
[{ type: "bytes32" }, { type: "bytes32" }],
|
|
458
|
-
[
|
|
459
|
-
keccak256(stringToHex("Kernel(bytes32 hash)")),
|
|
460
|
-
messageHash
|
|
461
|
-
]
|
|
339
|
+
smartAccountDeployed = await isSmartAccountDeployed(
|
|
340
|
+
client,
|
|
341
|
+
accountAddress
|
|
462
342
|
)
|
|
463
|
-
)
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const digest = keccak256(
|
|
467
|
-
concatHex(["0x1901", domainSeparator, finalMessageHash])
|
|
468
|
-
)
|
|
469
|
-
return kernelPluginManager.signMessage({
|
|
470
|
-
message: {
|
|
471
|
-
raw: digest
|
|
472
|
-
}
|
|
473
|
-
})
|
|
474
|
-
}
|
|
475
343
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
accountAddress
|
|
488
|
-
)
|
|
489
|
-
const kernelVersion = getKernelVersion(
|
|
490
|
-
entryPointAddress,
|
|
491
|
-
kernelImplAddr
|
|
492
|
-
)
|
|
493
|
-
if (
|
|
494
|
-
!hasKernelFeature(
|
|
495
|
-
KERNEL_FEATURES.ERC1271_WITH_VALIDATOR,
|
|
496
|
-
kernelVersion
|
|
344
|
+
if (smartAccountDeployed) return undefined
|
|
345
|
+
|
|
346
|
+
return factoryAddress
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
async getFactoryData() {
|
|
350
|
+
if (smartAccountDeployed) return undefined
|
|
351
|
+
|
|
352
|
+
smartAccountDeployed = await isSmartAccountDeployed(
|
|
353
|
+
client,
|
|
354
|
+
accountAddress
|
|
497
355
|
)
|
|
498
|
-
) {
|
|
499
|
-
return create6492Signature(isDeployed, signature)
|
|
500
|
-
}
|
|
501
356
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
357
|
+
if (smartAccountDeployed) return undefined
|
|
358
|
+
|
|
359
|
+
return parseFactoryAddressAndCallDataFromAccountInitCode(
|
|
360
|
+
await generateInitCode()
|
|
361
|
+
)[1]
|
|
362
|
+
},
|
|
363
|
+
async signMessage({ message }) {
|
|
364
|
+
const messageHash = hashMessage(message)
|
|
365
|
+
const { name, chainId, version } = await accountMetadata(
|
|
366
|
+
client,
|
|
367
|
+
accountAddress,
|
|
368
|
+
entryPointAddress
|
|
369
|
+
)
|
|
370
|
+
const wrappedMessageHash = await eip712WrapHash(messageHash, {
|
|
371
|
+
name,
|
|
372
|
+
chainId: Number(chainId),
|
|
373
|
+
version,
|
|
374
|
+
verifyingContract: accountAddress
|
|
375
|
+
})
|
|
376
|
+
const signature = await kernelPluginManager.signMessage({
|
|
377
|
+
message: { raw: wrappedMessageHash }
|
|
378
|
+
})
|
|
379
|
+
|
|
380
|
+
if (
|
|
381
|
+
!hasKernelFeature(
|
|
382
|
+
KERNEL_FEATURES.ERC1271_WITH_VALIDATOR,
|
|
383
|
+
version
|
|
384
|
+
)
|
|
385
|
+
) {
|
|
386
|
+
return signature
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const validatorInitData =
|
|
390
|
+
await kernelPluginManager.getValidatorInitData()
|
|
391
|
+
return concatHex([
|
|
507
392
|
pad(
|
|
508
393
|
concatHex(["0x1", validatorInitData.validatorAddress]),
|
|
509
394
|
{
|
|
@@ -513,54 +398,54 @@ export async function createKernelAccount<
|
|
|
513
398
|
),
|
|
514
399
|
signature
|
|
515
400
|
])
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
entryPointAddress,
|
|
528
|
-
kernelImplAddr
|
|
529
|
-
)
|
|
530
|
-
const types = {
|
|
531
|
-
EIP712Domain: getTypesForEIP712Domain({
|
|
532
|
-
domain: typedData.domain
|
|
533
|
-
}),
|
|
534
|
-
...typedData.types
|
|
535
|
-
}
|
|
401
|
+
},
|
|
402
|
+
async signTransaction(_, __) {
|
|
403
|
+
throw new SignTransactionNotSupportedBySmartAccount()
|
|
404
|
+
},
|
|
405
|
+
async signTypedData(typedData) {
|
|
406
|
+
const types = {
|
|
407
|
+
EIP712Domain: getTypesForEIP712Domain({
|
|
408
|
+
domain: typedData.domain
|
|
409
|
+
}),
|
|
410
|
+
...typedData.types
|
|
411
|
+
}
|
|
536
412
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
!hasKernelFeature(
|
|
553
|
-
KERNEL_FEATURES.ERC1271_WITH_VALIDATOR,
|
|
554
|
-
kernelVersion
|
|
413
|
+
// Need to do a runtime validation check on addresses, byte ranges, integer ranges, etc
|
|
414
|
+
// as we can't statically check this with TypeScript.
|
|
415
|
+
validateTypedData({
|
|
416
|
+
domain: typedData.domain,
|
|
417
|
+
message: typedData.message,
|
|
418
|
+
primaryType: typedData.primaryType,
|
|
419
|
+
types: types
|
|
420
|
+
} as TypedDataDefinition)
|
|
421
|
+
|
|
422
|
+
const typedHash = hashTypedData(typedData)
|
|
423
|
+
|
|
424
|
+
const { name, chainId, version } = await accountMetadata(
|
|
425
|
+
client,
|
|
426
|
+
accountAddress,
|
|
427
|
+
entryPointAddress
|
|
555
428
|
)
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
429
|
+
const wrappedMessageHash = await eip712WrapHash(typedHash, {
|
|
430
|
+
name,
|
|
431
|
+
chainId: Number(chainId),
|
|
432
|
+
version,
|
|
433
|
+
verifyingContract: accountAddress
|
|
434
|
+
})
|
|
435
|
+
const signature = await kernelPluginManager.signMessage({
|
|
436
|
+
message: { raw: wrappedMessageHash }
|
|
437
|
+
})
|
|
438
|
+
if (
|
|
439
|
+
!hasKernelFeature(
|
|
440
|
+
KERNEL_FEATURES.ERC1271_WITH_VALIDATOR,
|
|
441
|
+
version
|
|
442
|
+
)
|
|
443
|
+
) {
|
|
444
|
+
return signature
|
|
445
|
+
}
|
|
446
|
+
const validatorInitData =
|
|
447
|
+
await kernelPluginManager.getValidatorInitData()
|
|
448
|
+
return concatHex([
|
|
564
449
|
pad(
|
|
565
450
|
// [TODO] - Make the Validator type dynamic to support permission validators
|
|
566
451
|
concatHex(["0x1", validatorInitData.validatorAddress]),
|
|
@@ -571,272 +456,40 @@ export async function createKernelAccount<
|
|
|
571
456
|
),
|
|
572
457
|
signature
|
|
573
458
|
])
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
return signature
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
const [factoryAddress, factoryCalldata] =
|
|
587
|
-
parseFactoryAddressAndCallDataFromAccountInitCode(
|
|
588
|
-
await generateInitCode()
|
|
589
|
-
)
|
|
590
|
-
|
|
591
|
-
return wrapSignatureWith6492({
|
|
592
|
-
factoryAddress,
|
|
593
|
-
factoryCalldata,
|
|
594
|
-
signature
|
|
595
|
-
})
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
return {
|
|
599
|
-
...account,
|
|
600
|
-
client: client,
|
|
601
|
-
publicKey: accountAddress,
|
|
602
|
-
entryPoint: entryPointAddress,
|
|
603
|
-
source: "kernelSmartAccount",
|
|
604
|
-
kernelPluginManager,
|
|
605
|
-
generateInitCode,
|
|
606
|
-
|
|
607
|
-
async getFactory() {
|
|
608
|
-
if (smartAccountDeployed) return undefined
|
|
609
|
-
|
|
610
|
-
smartAccountDeployed = await isSmartAccountDeployed(
|
|
611
|
-
client,
|
|
612
|
-
accountAddress
|
|
613
|
-
)
|
|
614
|
-
|
|
615
|
-
if (smartAccountDeployed) return undefined
|
|
616
|
-
|
|
617
|
-
return factoryAddress
|
|
618
|
-
},
|
|
619
|
-
|
|
620
|
-
async getFactoryData() {
|
|
621
|
-
if (smartAccountDeployed) return undefined
|
|
622
|
-
|
|
623
|
-
smartAccountDeployed = await isSmartAccountDeployed(
|
|
624
|
-
client,
|
|
625
|
-
accountAddress
|
|
626
|
-
)
|
|
627
|
-
|
|
628
|
-
if (smartAccountDeployed) return undefined
|
|
629
|
-
|
|
630
|
-
return parseFactoryAddressAndCallDataFromAccountInitCode(
|
|
631
|
-
await generateInitCode()
|
|
632
|
-
)[1]
|
|
633
|
-
},
|
|
634
|
-
|
|
635
|
-
// Get the nonce of the smart account
|
|
636
|
-
async getNonce() {
|
|
637
|
-
const key = await kernelPluginManager.getNonceKey(accountAddress)
|
|
638
|
-
return getAccountNonce(client, {
|
|
639
|
-
sender: accountAddress,
|
|
640
|
-
entryPoint: entryPointAddress,
|
|
641
|
-
key
|
|
642
|
-
})
|
|
643
|
-
},
|
|
644
|
-
|
|
645
|
-
// Sign a user operation
|
|
646
|
-
async signUserOperation(userOperation) {
|
|
647
|
-
return kernelPluginManager.signUserOperation(userOperation)
|
|
648
|
-
},
|
|
649
|
-
|
|
650
|
-
// Encode the init code
|
|
651
|
-
async getInitCode() {
|
|
652
|
-
if (smartAccountDeployed) return "0x"
|
|
653
|
-
|
|
654
|
-
smartAccountDeployed = await isSmartAccountDeployed(
|
|
655
|
-
client,
|
|
656
|
-
accountAddress
|
|
657
|
-
)
|
|
658
|
-
|
|
659
|
-
if (smartAccountDeployed) return "0x"
|
|
660
|
-
return generateInitCode()
|
|
661
|
-
},
|
|
662
|
-
|
|
663
|
-
// [TODO] - CLeanup the encoding functions
|
|
664
|
-
|
|
665
|
-
// Encode the deploy call data
|
|
666
|
-
async encodeDeployCallData(_tx) {
|
|
667
|
-
if (entryPointVersion === "v0.6") {
|
|
668
|
-
return encodeFunctionData({
|
|
669
|
-
abi: KernelExecuteAbi,
|
|
670
|
-
functionName: "executeDelegateCall",
|
|
671
|
-
args: [
|
|
672
|
-
createCallAddress,
|
|
673
|
-
encodeFunctionData({
|
|
674
|
-
abi: createCallAbi,
|
|
675
|
-
functionName: "performCreate",
|
|
676
|
-
args: [
|
|
677
|
-
0n,
|
|
678
|
-
encodeDeployData({
|
|
679
|
-
abi: _tx.abi,
|
|
680
|
-
bytecode: _tx.bytecode,
|
|
681
|
-
args: _tx.args
|
|
682
|
-
} as EncodeDeployDataParameters)
|
|
683
|
-
]
|
|
684
|
-
})
|
|
685
|
-
]
|
|
459
|
+
},
|
|
460
|
+
// Get the nonce of the smart account
|
|
461
|
+
async getNonce() {
|
|
462
|
+
const key =
|
|
463
|
+
await kernelPluginManager.getNonceKey(accountAddress)
|
|
464
|
+
return getAccountNonce(client, {
|
|
465
|
+
sender: accountAddress,
|
|
466
|
+
entryPoint: entryPointAddress,
|
|
467
|
+
key
|
|
686
468
|
})
|
|
687
|
-
}
|
|
469
|
+
},
|
|
688
470
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
getExecMode(CALL_TYPE.DELEGATE_CALL, EXEC_TYPE.DEFAULT),
|
|
694
|
-
encodeAbiParameters(
|
|
695
|
-
parseAbiParameters("address to, bytes data"),
|
|
696
|
-
[
|
|
697
|
-
createCallAddress,
|
|
698
|
-
encodeFunctionData({
|
|
699
|
-
abi: createCallAbi,
|
|
700
|
-
functionName: "performCreate",
|
|
701
|
-
args: [
|
|
702
|
-
0n,
|
|
703
|
-
encodeDeployData({
|
|
704
|
-
abi: _tx.abi,
|
|
705
|
-
bytecode: _tx.bytecode,
|
|
706
|
-
args: _tx.args
|
|
707
|
-
} as EncodeDeployDataParameters)
|
|
708
|
-
]
|
|
709
|
-
})
|
|
710
|
-
]
|
|
711
|
-
)
|
|
712
|
-
]
|
|
713
|
-
})
|
|
714
|
-
},
|
|
715
|
-
|
|
716
|
-
// Encode a call
|
|
717
|
-
async encodeCallData(_tx) {
|
|
718
|
-
const tx = _tx as KernelEncodeCallDataArgs
|
|
719
|
-
if (Array.isArray(tx)) {
|
|
720
|
-
// Encode a batched call
|
|
721
|
-
if (entryPointVersion === "v0.6") {
|
|
722
|
-
return encodeFunctionData({
|
|
723
|
-
abi: KernelExecuteAbi,
|
|
724
|
-
functionName: "executeBatch",
|
|
725
|
-
args: [
|
|
726
|
-
tx.map((txn) => {
|
|
727
|
-
if (txn.callType === "delegatecall") {
|
|
728
|
-
throw new Error("Cannot batch delegatecall")
|
|
729
|
-
}
|
|
730
|
-
return {
|
|
731
|
-
to: txn.to,
|
|
732
|
-
value: txn.value,
|
|
733
|
-
data: txn.data
|
|
734
|
-
}
|
|
735
|
-
})
|
|
736
|
-
]
|
|
737
|
-
})
|
|
738
|
-
}
|
|
739
|
-
return encodeFunctionData({
|
|
740
|
-
abi: KernelV3ExecuteAbi,
|
|
741
|
-
functionName: "execute",
|
|
742
|
-
args: [
|
|
743
|
-
getExecMode(CALL_TYPE.BATCH, EXEC_TYPE.DEFAULT),
|
|
744
|
-
encodeAbiParameters(
|
|
745
|
-
[
|
|
746
|
-
{
|
|
747
|
-
name: "executionBatch",
|
|
748
|
-
type: "tuple[]",
|
|
749
|
-
components: [
|
|
750
|
-
{
|
|
751
|
-
name: "target",
|
|
752
|
-
type: "address"
|
|
753
|
-
},
|
|
754
|
-
{
|
|
755
|
-
name: "value",
|
|
756
|
-
type: "uint256"
|
|
757
|
-
},
|
|
758
|
-
{
|
|
759
|
-
name: "callData",
|
|
760
|
-
type: "bytes"
|
|
761
|
-
}
|
|
762
|
-
]
|
|
763
|
-
}
|
|
764
|
-
],
|
|
765
|
-
[
|
|
766
|
-
tx.map((txn) => {
|
|
767
|
-
if (txn.callType === "delegatecall") {
|
|
768
|
-
throw new Error(
|
|
769
|
-
"Cannot batch delegatecall"
|
|
770
|
-
)
|
|
771
|
-
}
|
|
772
|
-
return {
|
|
773
|
-
target: txn.to,
|
|
774
|
-
value: txn.value,
|
|
775
|
-
callData: txn.data
|
|
776
|
-
}
|
|
777
|
-
})
|
|
778
|
-
]
|
|
779
|
-
)
|
|
780
|
-
]
|
|
781
|
-
})
|
|
782
|
-
}
|
|
471
|
+
// Sign a user operation
|
|
472
|
+
async signUserOperation(userOperation) {
|
|
473
|
+
return kernelPluginManager.signUserOperation(userOperation)
|
|
474
|
+
},
|
|
783
475
|
|
|
784
|
-
//
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
}
|
|
789
|
-
if (entryPointVersion === "v0.6") {
|
|
790
|
-
return encodeFunctionData({
|
|
791
|
-
abi: KernelExecuteAbi,
|
|
792
|
-
functionName: "execute",
|
|
793
|
-
args: [tx.to, tx.value, tx.data, 0]
|
|
794
|
-
})
|
|
795
|
-
}
|
|
796
|
-
return encodeFunctionData({
|
|
797
|
-
abi: KernelV3ExecuteAbi,
|
|
798
|
-
functionName: "execute",
|
|
799
|
-
args: [
|
|
800
|
-
getExecMode(CALL_TYPE.SINGLE, EXEC_TYPE.DEFAULT),
|
|
801
|
-
encodeAbiParameters(
|
|
802
|
-
parseAbiParameters(
|
|
803
|
-
"address target, uint256 value, bytes calldata callData"
|
|
804
|
-
),
|
|
805
|
-
[tx.to, tx.value, tx.data]
|
|
806
|
-
)
|
|
807
|
-
]
|
|
808
|
-
})
|
|
809
|
-
}
|
|
476
|
+
// Get simple dummy signature
|
|
477
|
+
async getDummySignature(userOperation) {
|
|
478
|
+
return kernelPluginManager.getDummySignature(userOperation)
|
|
479
|
+
},
|
|
810
480
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
abi: KernelExecuteAbi,
|
|
815
|
-
functionName: "executeDelegateCall",
|
|
816
|
-
args: [tx.to, tx.data]
|
|
817
|
-
})
|
|
818
|
-
}
|
|
819
|
-
return encodeFunctionData({
|
|
820
|
-
abi: KernelV3ExecuteAbi,
|
|
821
|
-
functionName: "execute",
|
|
822
|
-
args: [
|
|
823
|
-
getExecMode(CALL_TYPE.DELEGATE_CALL, EXEC_TYPE.DEFAULT),
|
|
824
|
-
encodeAbiParameters(
|
|
825
|
-
parseAbiParameters(
|
|
826
|
-
"address target, bytes calldata callData"
|
|
827
|
-
),
|
|
828
|
-
[tx.to, tx.data]
|
|
829
|
-
)
|
|
830
|
-
]
|
|
831
|
-
})
|
|
832
|
-
}
|
|
481
|
+
// Encode the init code
|
|
482
|
+
async getInitCode() {
|
|
483
|
+
if (smartAccountDeployed) return "0x"
|
|
833
484
|
|
|
834
|
-
|
|
835
|
-
|
|
485
|
+
smartAccountDeployed = await isSmartAccountDeployed(
|
|
486
|
+
client,
|
|
487
|
+
accountAddress
|
|
488
|
+
)
|
|
836
489
|
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
}
|
|
490
|
+
if (smartAccountDeployed) return "0x"
|
|
491
|
+
return generateInitCode()
|
|
492
|
+
}
|
|
493
|
+
})
|
|
841
494
|
}
|
|
842
495
|
}
|