@zerodev/sdk 5.2.0-alpha-1 → 5.2.0-alpha-3
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 +124 -378
- 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 +19 -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 +135 -398
- 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 +19 -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 +2 -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 +176 -541
- 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 +21 -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 +2 -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
package/README.md
ADDED
package/_cjs/accounts/index.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addressToEmptyAccount = exports.
|
|
3
|
+
exports.addressToEmptyAccount = exports.EIP1271Abi = exports.KernelFactoryV2Abi = exports.KernelAccountV2Abi = exports.createKernelV2Account = exports.createKernelV1Account = exports.KERNEL_ADDRESSES = exports.createKernelAccount = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var createKernelAccount_js_1 = require("./kernel/createKernelAccount.js");
|
|
6
6
|
Object.defineProperty(exports, "createKernelAccount", { enumerable: true, get: function () { return createKernelAccount_js_1.createKernelAccount; } });
|
|
7
7
|
Object.defineProperty(exports, "KERNEL_ADDRESSES", { enumerable: true, get: function () { return createKernelAccount_js_1.KERNEL_ADDRESSES; } });
|
|
8
|
-
Object.defineProperty(exports, "EIP1271ABI", { enumerable: true, get: function () { return createKernelAccount_js_1.EIP1271ABI; } });
|
|
9
8
|
var createKernelV1Account_js_1 = require("./kernel/v1/createKernelV1Account.js");
|
|
10
9
|
Object.defineProperty(exports, "createKernelV1Account", { enumerable: true, get: function () { return createKernelV1Account_js_1.createKernelV1Account; } });
|
|
10
|
+
var createKernelV2Account_js_1 = require("./kernel/v2/createKernelV2Account.js");
|
|
11
|
+
Object.defineProperty(exports, "createKernelV2Account", { enumerable: true, get: function () { return createKernelV2Account_js_1.createKernelV2Account; } });
|
|
12
|
+
var KernelAccountV2Abi_js_1 = require("./kernel/v2/abi/KernelAccountV2Abi.js");
|
|
13
|
+
Object.defineProperty(exports, "KernelAccountV2Abi", { enumerable: true, get: function () { return KernelAccountV2Abi_js_1.KernelAccountV2Abi; } });
|
|
14
|
+
var KernelFactoryV2Abi_js_1 = require("./kernel/v2/abi/KernelFactoryV2Abi.js");
|
|
15
|
+
Object.defineProperty(exports, "KernelFactoryV2Abi", { enumerable: true, get: function () { return KernelFactoryV2Abi_js_1.KernelFactoryV2Abi; } });
|
|
16
|
+
var EIP1271Abi_js_1 = require("./kernel/abi/EIP1271Abi.js");
|
|
17
|
+
Object.defineProperty(exports, "EIP1271Abi", { enumerable: true, get: function () { return EIP1271Abi_js_1.EIP1271Abi; } });
|
|
11
18
|
var addressToEmptyAccount_js_1 = require("./addressToEmptyAccount.js");
|
|
12
19
|
Object.defineProperty(exports, "addressToEmptyAccount", { enumerable: true, get: function () { return addressToEmptyAccount_js_1.addressToEmptyAccount; } });
|
|
13
20
|
tslib_1.__exportStar(require("./utils/index.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../accounts/index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../accounts/index.ts"],"names":[],"mappings":";;;;AAAA,0EAIwC;AAHpC,6HAAA,mBAAmB,OAAA;AAEnB,0HAAA,gBAAgB,OAAA;AAEpB,iFAA4E;AAAnE,iIAAA,qBAAqB,OAAA;AAC9B,iFAA4E;AAAnE,iIAAA,qBAAqB,OAAA;AAC9B,+EAA0E;AAAjE,2HAAA,kBAAkB,OAAA;AAC3B,+EAA0E;AAAjE,2HAAA,kBAAkB,OAAA;AAC3B,4DAAuD;AAA9C,2GAAA,UAAU,OAAA;AACnB,uEAAkE;AAAzD,iIAAA,qBAAqB,OAAA;AAC9B,2DAAgC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EIP1271Abi = void 0;
|
|
4
|
+
exports.EIP1271Abi = [
|
|
5
|
+
{
|
|
6
|
+
type: "function",
|
|
7
|
+
name: "eip712Domain",
|
|
8
|
+
inputs: [],
|
|
9
|
+
outputs: [
|
|
10
|
+
{ name: "fields", type: "bytes1", internalType: "bytes1" },
|
|
11
|
+
{ name: "name", type: "string", internalType: "string" },
|
|
12
|
+
{ name: "version", type: "string", internalType: "string" },
|
|
13
|
+
{ name: "chainId", type: "uint256", internalType: "uint256" },
|
|
14
|
+
{
|
|
15
|
+
name: "verifyingContract",
|
|
16
|
+
type: "address",
|
|
17
|
+
internalType: "address"
|
|
18
|
+
},
|
|
19
|
+
{ name: "salt", type: "bytes32", internalType: "bytes32" },
|
|
20
|
+
{ name: "extensions", type: "uint256[]", internalType: "uint256[]" }
|
|
21
|
+
],
|
|
22
|
+
stateMutability: "view"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: "function",
|
|
26
|
+
name: "isValidSignature",
|
|
27
|
+
inputs: [
|
|
28
|
+
{ name: "data", type: "bytes32", internalType: "bytes32" },
|
|
29
|
+
{ name: "signature", type: "bytes", internalType: "bytes" }
|
|
30
|
+
],
|
|
31
|
+
outputs: [
|
|
32
|
+
{ name: "magicValue", type: "bytes4", internalType: "bytes4" }
|
|
33
|
+
],
|
|
34
|
+
stateMutability: "view"
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
//# sourceMappingURL=EIP1271Abi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EIP1271Abi.js","sourceRoot":"","sources":["../../../../accounts/kernel/abi/EIP1271Abi.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB;QACI,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,EAAE;QACV,OAAO,EAAE;YACL,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE;YAC1D,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE;YACxD,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE;YAC3D,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE;YAC7D;gBACI,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,SAAS;gBACf,YAAY,EAAE,SAAS;aAC1B;YACD,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE;YAC1D,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE;SACvE;QACD,eAAe,EAAE,MAAM;KAC1B;IACD;QACI,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE;YACJ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE;YAC1D,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE;SAC9D;QACD,OAAO,EAAE;YACL,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE;SACjE;QACD,eAAe,EAAE,MAAM;KAC1B;CACK,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SafeCreateCallAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
exports.SafeCreateCallAbi = (0, viem_1.parseAbi)([
|
|
6
|
+
"function performCreate(uint256 value, bytes memory deploymentData) public returns (address newContract)",
|
|
7
|
+
"function performCreate2(uint256 value, bytes memory deploymentData, bytes32 salt) public returns (address newContract)"
|
|
8
|
+
]);
|
|
9
|
+
//# sourceMappingURL=SafeCreateCallAbi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SafeCreateCallAbi.js","sourceRoot":"","sources":["../../../../accounts/kernel/abi/SafeCreateCallAbi.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAElB,QAAA,iBAAiB,GAAG,IAAA,eAAQ,EAAC;IACtC,yGAAyG;IACzG,wHAAwH;CAC3H,CAAC,CAAA"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createKernelAccount = exports.KERNEL_ADDRESSES =
|
|
3
|
+
exports.createKernelAccount = exports.KERNEL_ADDRESSES = void 0;
|
|
4
4
|
const permissionless_1 = require("permissionless");
|
|
5
5
|
const accounts_1 = require("permissionless/accounts");
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
|
-
const accounts_2 = require("viem/accounts");
|
|
8
|
-
const constants_js_1 = require("../../constants.js");
|
|
9
7
|
const utils_js_1 = require("../../utils.js");
|
|
10
|
-
const _6492_js_1 = require("../utils/6492.js");
|
|
11
8
|
const index_js_1 = require("../utils/index.js");
|
|
12
9
|
const toKernelPluginManager_js_1 = require("../utils/toKernelPluginManager.js");
|
|
13
10
|
const KernelAccountAbi_js_1 = require("./abi/KernelAccountAbi.js");
|
|
14
11
|
const KernelAccountAbi_js_2 = require("./abi/kernel_v_3_0_0/KernelAccountAbi.js");
|
|
12
|
+
const encodeCallData_js_1 = require("./utils/account/ep0_6/encodeCallData.js");
|
|
13
|
+
const encodeDeployCallData_js_1 = require("./utils/account/ep0_6/encodeDeployCallData.js");
|
|
14
|
+
const encodeCallData_js_2 = require("./utils/account/ep0_7/encodeCallData.js");
|
|
15
|
+
const encodeDeployCallData_js_2 = require("./utils/account/ep0_7/encodeDeployCallData.js");
|
|
16
|
+
const accountMetadata_js_1 = require("./utils/common/accountMetadata.js");
|
|
17
|
+
const eip712WrapHash_js_1 = require("./utils/common/eip712WrapHash.js");
|
|
15
18
|
const createAccountAbi = [
|
|
16
19
|
{
|
|
17
20
|
inputs: [
|
|
@@ -43,52 +46,15 @@ const createAccountAbi = [
|
|
|
43
46
|
type: "function"
|
|
44
47
|
}
|
|
45
48
|
];
|
|
46
|
-
const createCallAddress = "0x9b35Af71d77eaf8d7e40252370304687390A1A52";
|
|
47
|
-
const createCallAbi = (0, viem_1.parseAbi)([
|
|
48
|
-
"function performCreate(uint256 value, bytes memory deploymentData) public returns (address newContract)",
|
|
49
|
-
"function performCreate2(uint256 value, bytes memory deploymentData, bytes32 salt) public returns (address newContract)"
|
|
50
|
-
]);
|
|
51
|
-
exports.EIP1271ABI = [
|
|
52
|
-
{
|
|
53
|
-
type: "function",
|
|
54
|
-
name: "eip712Domain",
|
|
55
|
-
inputs: [],
|
|
56
|
-
outputs: [
|
|
57
|
-
{ name: "fields", type: "bytes1", internalType: "bytes1" },
|
|
58
|
-
{ name: "name", type: "string", internalType: "string" },
|
|
59
|
-
{ name: "version", type: "string", internalType: "string" },
|
|
60
|
-
{ name: "chainId", type: "uint256", internalType: "uint256" },
|
|
61
|
-
{
|
|
62
|
-
name: "verifyingContract",
|
|
63
|
-
type: "address",
|
|
64
|
-
internalType: "address"
|
|
65
|
-
},
|
|
66
|
-
{ name: "salt", type: "bytes32", internalType: "bytes32" },
|
|
67
|
-
{ name: "extensions", type: "uint256[]", internalType: "uint256[]" }
|
|
68
|
-
],
|
|
69
|
-
stateMutability: "view"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
type: "function",
|
|
73
|
-
name: "isValidSignature",
|
|
74
|
-
inputs: [
|
|
75
|
-
{ name: "data", type: "bytes32", internalType: "bytes32" },
|
|
76
|
-
{ name: "signature", type: "bytes", internalType: "bytes" }
|
|
77
|
-
],
|
|
78
|
-
outputs: [
|
|
79
|
-
{ name: "magicValue", type: "bytes4", internalType: "bytes4" }
|
|
80
|
-
],
|
|
81
|
-
stateMutability: "view"
|
|
82
|
-
}
|
|
83
|
-
];
|
|
84
49
|
exports.KERNEL_ADDRESSES = {
|
|
85
50
|
ACCOUNT_LOGIC_V0_6: "0xd3082872F8B06073A021b4602e022d5A070d7cfC",
|
|
86
51
|
ACCOUNT_LOGIC_V0_7: "0x079D5D8A3275A230AF743cB59c341Ff74B82488D",
|
|
87
52
|
FACTORY_ADDRESS: "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3",
|
|
88
53
|
ENTRYPOINT_V0_6: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
|
|
89
54
|
};
|
|
90
|
-
const getKernelInitData = ({
|
|
55
|
+
const getKernelInitData = async ({ entryPoint: entryPointAddress, kernelPluginManager }) => {
|
|
91
56
|
const entryPointVersion = (0, permissionless_1.getEntryPointVersion)(entryPointAddress);
|
|
57
|
+
const { enableData, validatorAddress } = await kernelPluginManager.getValidatorInitData();
|
|
92
58
|
if (entryPointVersion === "v0.6") {
|
|
93
59
|
return (0, viem_1.encodeFunctionData)({
|
|
94
60
|
abi: KernelAccountAbi_js_1.KernelInitAbi,
|
|
@@ -100,21 +66,17 @@ const getKernelInitData = ({ validatorAddress, enableData, entryPoint: entryPoin
|
|
|
100
66
|
abi: KernelAccountAbi_js_2.KernelV3InitAbi,
|
|
101
67
|
functionName: "initialize",
|
|
102
68
|
args: [
|
|
103
|
-
|
|
104
|
-
size: 21,
|
|
105
|
-
dir: "left"
|
|
106
|
-
}),
|
|
69
|
+
kernelPluginManager.getValidationId(true),
|
|
107
70
|
viem_1.zeroAddress,
|
|
108
71
|
enableData,
|
|
109
72
|
"0x"
|
|
110
73
|
]
|
|
111
74
|
});
|
|
112
75
|
};
|
|
113
|
-
const getAccountInitCode = async ({ index, factoryAddress, accountLogicAddress,
|
|
114
|
-
const initialisationData = getKernelInitData({
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
entryPoint: entryPointAddress
|
|
76
|
+
const getAccountInitCode = async ({ index, factoryAddress, accountLogicAddress, entryPoint: entryPointAddress, kernelPluginManager }) => {
|
|
77
|
+
const initialisationData = await getKernelInitData({
|
|
78
|
+
entryPoint: entryPointAddress,
|
|
79
|
+
kernelPluginManager
|
|
118
80
|
});
|
|
119
81
|
return (0, viem_1.concatHex)([
|
|
120
82
|
factoryAddress,
|
|
@@ -156,14 +118,12 @@ async function createKernelAccount(client, { plugins, entryPoint: entryPointAddr
|
|
|
156
118
|
entryPoint: entryPointAddress
|
|
157
119
|
});
|
|
158
120
|
const generateInitCode = async () => {
|
|
159
|
-
const validatorInitData = await kernelPluginManager.getValidatorInitData();
|
|
160
121
|
return getAccountInitCode({
|
|
161
122
|
index,
|
|
162
123
|
factoryAddress,
|
|
163
124
|
accountLogicAddress,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
entryPoint: entryPointAddress
|
|
125
|
+
entryPoint: entryPointAddress,
|
|
126
|
+
kernelPluginManager
|
|
167
127
|
});
|
|
168
128
|
};
|
|
169
129
|
const accountAddress = deployedAccountAddress ??
|
|
@@ -175,340 +135,126 @@ async function createKernelAccount(client, { plugins, entryPoint: entryPointAddr
|
|
|
175
135
|
if (!accountAddress)
|
|
176
136
|
throw new Error("Account address not found");
|
|
177
137
|
let smartAccountDeployed = await (0, permissionless_1.isSmartAccountDeployed)(client, accountAddress);
|
|
178
|
-
const signHashedMessage = async (messageHash) => {
|
|
179
|
-
const kernelImplAddr = await (0, _6492_js_1.getKernelImplementationAddress)(client, accountAddress);
|
|
180
|
-
const kernelVersion = (0, utils_js_1.getKernelVersion)(entryPointAddress, kernelImplAddr);
|
|
181
|
-
if (!(0, utils_js_1.hasKernelFeature)(utils_js_1.KERNEL_FEATURES.ERC1271_SIG_WRAPPER, kernelVersion)) {
|
|
182
|
-
return kernelPluginManager.signMessage({
|
|
183
|
-
message: {
|
|
184
|
-
raw: messageHash
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
const domain = await client.request({
|
|
189
|
-
method: "eth_call",
|
|
190
|
-
params: [
|
|
191
|
-
{
|
|
192
|
-
to: accountAddress,
|
|
193
|
-
data: (0, viem_1.encodeFunctionData)({
|
|
194
|
-
abi: exports.EIP1271ABI,
|
|
195
|
-
functionName: "eip712Domain"
|
|
196
|
-
})
|
|
197
|
-
},
|
|
198
|
-
"latest"
|
|
199
|
-
]
|
|
200
|
-
});
|
|
201
|
-
let name;
|
|
202
|
-
let version;
|
|
203
|
-
let chainId;
|
|
204
|
-
if (domain !== "0x") {
|
|
205
|
-
const decoded = (0, viem_1.decodeFunctionResult)({
|
|
206
|
-
abi: [...exports.EIP1271ABI],
|
|
207
|
-
functionName: "eip712Domain",
|
|
208
|
-
data: domain
|
|
209
|
-
});
|
|
210
|
-
name = decoded[1];
|
|
211
|
-
version = decoded[2];
|
|
212
|
-
chainId = decoded[3];
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
name = constants_js_1.KERNEL_NAME;
|
|
216
|
-
version = kernelVersion;
|
|
217
|
-
chainId = client.chain
|
|
218
|
-
? BigInt(client.chain.id)
|
|
219
|
-
: BigInt(await client.extend(viem_1.publicActions).getChainId());
|
|
220
|
-
}
|
|
221
|
-
const encoded = (0, viem_1.encodeAbiParameters)([
|
|
222
|
-
{ type: "bytes32" },
|
|
223
|
-
{ type: "bytes32" },
|
|
224
|
-
{ type: "bytes32" },
|
|
225
|
-
{ type: "uint256" },
|
|
226
|
-
{ type: "address" }
|
|
227
|
-
], [
|
|
228
|
-
(0, viem_1.keccak256)((0, viem_1.stringToHex)("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")),
|
|
229
|
-
(0, viem_1.keccak256)((0, viem_1.stringToHex)(name)),
|
|
230
|
-
(0, viem_1.keccak256)((0, viem_1.stringToHex)(version)),
|
|
231
|
-
BigInt(chainId),
|
|
232
|
-
accountAddress
|
|
233
|
-
]);
|
|
234
|
-
const domainSeparator = (0, viem_1.keccak256)(encoded);
|
|
235
|
-
let finalMessageHash = messageHash;
|
|
236
|
-
if ((0, utils_js_1.hasKernelFeature)(utils_js_1.KERNEL_FEATURES.ERC1271_SIG_WRAPPER_WITH_WRAPPED_HASH, kernelVersion)) {
|
|
237
|
-
finalMessageHash = (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "bytes32" }, { type: "bytes32" }], [
|
|
238
|
-
(0, viem_1.keccak256)((0, viem_1.stringToHex)("Kernel(bytes32 hash)")),
|
|
239
|
-
messageHash
|
|
240
|
-
]));
|
|
241
|
-
}
|
|
242
|
-
const digest = (0, viem_1.keccak256)((0, viem_1.concatHex)(["0x1901", domainSeparator, finalMessageHash]));
|
|
243
|
-
return kernelPluginManager.signMessage({
|
|
244
|
-
message: {
|
|
245
|
-
raw: digest
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
};
|
|
249
|
-
const account = (0, accounts_2.toAccount)({
|
|
250
|
-
address: accountAddress,
|
|
251
|
-
async signMessage({ message }) {
|
|
252
|
-
const messageHash = (0, viem_1.hashMessage)(message);
|
|
253
|
-
const [isDeployed, signature] = await Promise.all([
|
|
254
|
-
(0, permissionless_1.isSmartAccountDeployed)(client, accountAddress),
|
|
255
|
-
signHashedMessage(messageHash)
|
|
256
|
-
]);
|
|
257
|
-
const kernelImplAddr = await (0, _6492_js_1.getKernelImplementationAddress)(client, accountAddress);
|
|
258
|
-
const kernelVersion = (0, utils_js_1.getKernelVersion)(entryPointAddress, kernelImplAddr);
|
|
259
|
-
if (!(0, utils_js_1.hasKernelFeature)(utils_js_1.KERNEL_FEATURES.ERC1271_WITH_VALIDATOR, kernelVersion)) {
|
|
260
|
-
return create6492Signature(isDeployed, signature);
|
|
261
|
-
}
|
|
262
|
-
const validatorInitData = await kernelPluginManager.getValidatorInitData();
|
|
263
|
-
return create6492Signature(isDeployed, (0, viem_1.concatHex)([
|
|
264
|
-
(0, viem_1.pad)((0, viem_1.concatHex)(["0x1", validatorInitData.validatorAddress]), {
|
|
265
|
-
size: 21,
|
|
266
|
-
dir: "left"
|
|
267
|
-
}),
|
|
268
|
-
signature
|
|
269
|
-
]));
|
|
270
|
-
},
|
|
271
|
-
async signTransaction(_, __) {
|
|
272
|
-
throw new accounts_1.SignTransactionNotSupportedBySmartAccount();
|
|
273
|
-
},
|
|
274
|
-
async signTypedData(typedData) {
|
|
275
|
-
const kernelImplAddr = await (0, _6492_js_1.getKernelImplementationAddress)(client, accountAddress);
|
|
276
|
-
const kernelVersion = (0, utils_js_1.getKernelVersion)(entryPointAddress, kernelImplAddr);
|
|
277
|
-
const types = {
|
|
278
|
-
EIP712Domain: (0, viem_1.getTypesForEIP712Domain)({
|
|
279
|
-
domain: typedData.domain
|
|
280
|
-
}),
|
|
281
|
-
...typedData.types
|
|
282
|
-
};
|
|
283
|
-
(0, viem_1.validateTypedData)({
|
|
284
|
-
domain: typedData.domain,
|
|
285
|
-
message: typedData.message,
|
|
286
|
-
primaryType: typedData.primaryType,
|
|
287
|
-
types: types
|
|
288
|
-
});
|
|
289
|
-
const typedHash = (0, viem_1.hashTypedData)(typedData);
|
|
290
|
-
const [isDeployed, signature] = await Promise.all([
|
|
291
|
-
(0, permissionless_1.isSmartAccountDeployed)(client, accountAddress),
|
|
292
|
-
signHashedMessage(typedHash)
|
|
293
|
-
]);
|
|
294
|
-
if (!(0, utils_js_1.hasKernelFeature)(utils_js_1.KERNEL_FEATURES.ERC1271_WITH_VALIDATOR, kernelVersion)) {
|
|
295
|
-
return create6492Signature(isDeployed, signature);
|
|
296
|
-
}
|
|
297
|
-
const validatorInitData = await kernelPluginManager.getValidatorInitData();
|
|
298
|
-
return create6492Signature(isDeployed, (0, viem_1.concatHex)([
|
|
299
|
-
(0, viem_1.pad)((0, viem_1.concatHex)(["0x1", validatorInitData.validatorAddress]), {
|
|
300
|
-
size: 21,
|
|
301
|
-
dir: "left"
|
|
302
|
-
}),
|
|
303
|
-
signature
|
|
304
|
-
]));
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
const create6492Signature = async (isDeployed, signature) => {
|
|
308
|
-
if (isDeployed) {
|
|
309
|
-
return signature;
|
|
310
|
-
}
|
|
311
|
-
const [factoryAddress, factoryCalldata] = (0, index_js_1.parseFactoryAddressAndCallDataFromAccountInitCode)(await generateInitCode());
|
|
312
|
-
return (0, _6492_js_1.wrapSignatureWith6492)({
|
|
313
|
-
factoryAddress,
|
|
314
|
-
factoryCalldata,
|
|
315
|
-
signature
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
138
|
return {
|
|
319
|
-
...account,
|
|
320
|
-
client: client,
|
|
321
|
-
publicKey: accountAddress,
|
|
322
|
-
entryPoint: entryPointAddress,
|
|
323
|
-
source: "kernelSmartAccount",
|
|
324
139
|
kernelPluginManager,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
return factoryAddress;
|
|
333
|
-
},
|
|
334
|
-
async getFactoryData() {
|
|
335
|
-
if (smartAccountDeployed)
|
|
336
|
-
return undefined;
|
|
337
|
-
smartAccountDeployed = await (0, permissionless_1.isSmartAccountDeployed)(client, accountAddress);
|
|
338
|
-
if (smartAccountDeployed)
|
|
339
|
-
return undefined;
|
|
340
|
-
return (0, index_js_1.parseFactoryAddressAndCallDataFromAccountInitCode)(await generateInitCode())[1];
|
|
341
|
-
},
|
|
342
|
-
async getNonce() {
|
|
343
|
-
const key = await kernelPluginManager.getNonceKey(accountAddress);
|
|
344
|
-
return (0, permissionless_1.getAccountNonce)(client, {
|
|
345
|
-
sender: accountAddress,
|
|
346
|
-
entryPoint: entryPointAddress,
|
|
347
|
-
key
|
|
348
|
-
});
|
|
349
|
-
},
|
|
350
|
-
async signUserOperation(userOperation) {
|
|
351
|
-
return kernelPluginManager.signUserOperation(userOperation);
|
|
352
|
-
},
|
|
353
|
-
async getInitCode() {
|
|
354
|
-
if (smartAccountDeployed)
|
|
355
|
-
return "0x";
|
|
356
|
-
smartAccountDeployed = await (0, permissionless_1.isSmartAccountDeployed)(client, accountAddress);
|
|
357
|
-
if (smartAccountDeployed)
|
|
358
|
-
return "0x";
|
|
359
|
-
return generateInitCode();
|
|
360
|
-
},
|
|
361
|
-
async encodeDeployCallData(_tx) {
|
|
362
|
-
if (entryPointVersion === "v0.6") {
|
|
363
|
-
return (0, viem_1.encodeFunctionData)({
|
|
364
|
-
abi: KernelAccountAbi_js_1.KernelExecuteAbi,
|
|
365
|
-
functionName: "executeDelegateCall",
|
|
366
|
-
args: [
|
|
367
|
-
createCallAddress,
|
|
368
|
-
(0, viem_1.encodeFunctionData)({
|
|
369
|
-
abi: createCallAbi,
|
|
370
|
-
functionName: "performCreate",
|
|
371
|
-
args: [
|
|
372
|
-
0n,
|
|
373
|
-
(0, viem_1.encodeDeployData)({
|
|
374
|
-
abi: _tx.abi,
|
|
375
|
-
bytecode: _tx.bytecode,
|
|
376
|
-
args: _tx.args
|
|
377
|
-
})
|
|
378
|
-
]
|
|
379
|
-
})
|
|
380
|
-
]
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
return (0, viem_1.encodeFunctionData)({
|
|
384
|
-
abi: KernelAccountAbi_js_2.KernelV3ExecuteAbi,
|
|
385
|
-
functionName: "execute",
|
|
386
|
-
args: [
|
|
387
|
-
(0, utils_js_1.getExecMode)(constants_js_1.CALL_TYPE.DELEGATE_CALL, constants_js_1.EXEC_TYPE.DEFAULT),
|
|
388
|
-
(0, viem_1.concatHex)([
|
|
389
|
-
createCallAddress,
|
|
390
|
-
(0, viem_1.encodeFunctionData)({
|
|
391
|
-
abi: createCallAbi,
|
|
392
|
-
functionName: "performCreate",
|
|
393
|
-
args: [
|
|
394
|
-
0n,
|
|
395
|
-
(0, viem_1.encodeDeployData)({
|
|
396
|
-
abi: _tx.abi,
|
|
397
|
-
bytecode: _tx.bytecode,
|
|
398
|
-
args: _tx.args
|
|
399
|
-
})
|
|
400
|
-
]
|
|
401
|
-
})
|
|
402
|
-
])
|
|
403
|
-
]
|
|
404
|
-
});
|
|
405
|
-
},
|
|
406
|
-
async encodeCallData(_tx) {
|
|
407
|
-
const tx = _tx;
|
|
408
|
-
if (Array.isArray(tx)) {
|
|
140
|
+
...(0, accounts_1.toSmartAccount)({
|
|
141
|
+
address: accountAddress,
|
|
142
|
+
publicKey: accountAddress,
|
|
143
|
+
source: "kernelSmartAccount",
|
|
144
|
+
client,
|
|
145
|
+
entryPoint: entryPointAddress,
|
|
146
|
+
async encodeDeployCallData(_tx) {
|
|
409
147
|
if (entryPointVersion === "v0.6") {
|
|
410
|
-
return (0,
|
|
411
|
-
abi: KernelAccountAbi_js_1.KernelExecuteAbi,
|
|
412
|
-
functionName: "executeBatch",
|
|
413
|
-
args: [
|
|
414
|
-
tx.map((txn) => {
|
|
415
|
-
if (txn.callType === "delegatecall") {
|
|
416
|
-
throw new Error("Cannot batch delegatecall");
|
|
417
|
-
}
|
|
418
|
-
return {
|
|
419
|
-
to: txn.to,
|
|
420
|
-
value: txn.value,
|
|
421
|
-
data: txn.data
|
|
422
|
-
};
|
|
423
|
-
})
|
|
424
|
-
]
|
|
425
|
-
});
|
|
148
|
+
return (0, encodeDeployCallData_js_1.encodeDeployCallData)(_tx);
|
|
426
149
|
}
|
|
427
|
-
return (0,
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
name: "executionBatch",
|
|
435
|
-
type: "tuple[]",
|
|
436
|
-
components: [
|
|
437
|
-
{
|
|
438
|
-
name: "target",
|
|
439
|
-
type: "address"
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
name: "value",
|
|
443
|
-
type: "uint256"
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
name: "callData",
|
|
447
|
-
type: "bytes"
|
|
448
|
-
}
|
|
449
|
-
]
|
|
450
|
-
}
|
|
451
|
-
], [
|
|
452
|
-
tx.map((txn) => {
|
|
453
|
-
if (txn.callType === "delegatecall") {
|
|
454
|
-
throw new Error("Cannot batch delegatecall");
|
|
455
|
-
}
|
|
456
|
-
return {
|
|
457
|
-
target: txn.to,
|
|
458
|
-
value: txn.value,
|
|
459
|
-
callData: txn.data
|
|
460
|
-
};
|
|
461
|
-
})
|
|
462
|
-
])
|
|
463
|
-
]
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
if (!tx.callType || tx.callType === "call") {
|
|
467
|
-
if (tx.to.toLowerCase() === accountAddress.toLowerCase()) {
|
|
150
|
+
return (0, encodeDeployCallData_js_2.encodeDeployCallData)(_tx);
|
|
151
|
+
},
|
|
152
|
+
async encodeCallData(_tx) {
|
|
153
|
+
const tx = _tx;
|
|
154
|
+
if (!Array.isArray(tx) &&
|
|
155
|
+
tx.callType === "call" &&
|
|
156
|
+
tx.to.toLowerCase() === accountAddress.toLowerCase()) {
|
|
468
157
|
return tx.data;
|
|
469
158
|
}
|
|
470
159
|
if (entryPointVersion === "v0.6") {
|
|
471
|
-
return (0,
|
|
472
|
-
abi: KernelAccountAbi_js_1.KernelExecuteAbi,
|
|
473
|
-
functionName: "execute",
|
|
474
|
-
args: [tx.to, tx.value, tx.data, 0]
|
|
475
|
-
});
|
|
160
|
+
return (0, encodeCallData_js_1.encodeCallData)(tx);
|
|
476
161
|
}
|
|
477
|
-
return (0,
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
162
|
+
return (0, encodeCallData_js_2.encodeCallData)(tx);
|
|
163
|
+
},
|
|
164
|
+
async getFactory() {
|
|
165
|
+
if (smartAccountDeployed)
|
|
166
|
+
return undefined;
|
|
167
|
+
smartAccountDeployed = await (0, permissionless_1.isSmartAccountDeployed)(client, accountAddress);
|
|
168
|
+
if (smartAccountDeployed)
|
|
169
|
+
return undefined;
|
|
170
|
+
return factoryAddress;
|
|
171
|
+
},
|
|
172
|
+
async getFactoryData() {
|
|
173
|
+
if (smartAccountDeployed)
|
|
174
|
+
return undefined;
|
|
175
|
+
smartAccountDeployed = await (0, permissionless_1.isSmartAccountDeployed)(client, accountAddress);
|
|
176
|
+
if (smartAccountDeployed)
|
|
177
|
+
return undefined;
|
|
178
|
+
return (0, index_js_1.parseFactoryAddressAndCallDataFromAccountInitCode)(await generateInitCode())[1];
|
|
179
|
+
},
|
|
180
|
+
async signMessage({ message }) {
|
|
181
|
+
const messageHash = (0, viem_1.hashMessage)(message);
|
|
182
|
+
const { name, chainId, version } = await (0, accountMetadata_js_1.accountMetadata)(client, accountAddress, entryPointAddress);
|
|
183
|
+
const wrappedMessageHash = await (0, eip712WrapHash_js_1.eip712WrapHash)(messageHash, {
|
|
184
|
+
name,
|
|
185
|
+
chainId: Number(chainId),
|
|
186
|
+
version,
|
|
187
|
+
verifyingContract: accountAddress
|
|
488
188
|
});
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
functionName: "executeDelegateCall",
|
|
495
|
-
args: [tx.to, tx.data]
|
|
496
|
-
});
|
|
189
|
+
const signature = await kernelPluginManager.signMessage({
|
|
190
|
+
message: { raw: wrappedMessageHash }
|
|
191
|
+
});
|
|
192
|
+
if (!(0, utils_js_1.hasKernelFeature)(utils_js_1.KERNEL_FEATURES.ERC1271_WITH_VALIDATOR, version)) {
|
|
193
|
+
return signature;
|
|
497
194
|
}
|
|
498
|
-
return (0, viem_1.
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
195
|
+
return (0, viem_1.concatHex)([
|
|
196
|
+
kernelPluginManager.getValidationId(),
|
|
197
|
+
signature
|
|
198
|
+
]);
|
|
199
|
+
},
|
|
200
|
+
async signTransaction(_, __) {
|
|
201
|
+
throw new accounts_1.SignTransactionNotSupportedBySmartAccount();
|
|
202
|
+
},
|
|
203
|
+
async signTypedData(typedData) {
|
|
204
|
+
const types = {
|
|
205
|
+
EIP712Domain: (0, viem_1.getTypesForEIP712Domain)({
|
|
206
|
+
domain: typedData.domain
|
|
207
|
+
}),
|
|
208
|
+
...typedData.types
|
|
209
|
+
};
|
|
210
|
+
(0, viem_1.validateTypedData)({
|
|
211
|
+
domain: typedData.domain,
|
|
212
|
+
message: typedData.message,
|
|
213
|
+
primaryType: typedData.primaryType,
|
|
214
|
+
types: types
|
|
505
215
|
});
|
|
216
|
+
const typedHash = (0, viem_1.hashTypedData)(typedData);
|
|
217
|
+
const { name, chainId, version } = await (0, accountMetadata_js_1.accountMetadata)(client, accountAddress, entryPointAddress);
|
|
218
|
+
const wrappedMessageHash = await (0, eip712WrapHash_js_1.eip712WrapHash)(typedHash, {
|
|
219
|
+
name,
|
|
220
|
+
chainId: Number(chainId),
|
|
221
|
+
version,
|
|
222
|
+
verifyingContract: accountAddress
|
|
223
|
+
});
|
|
224
|
+
const signature = await kernelPluginManager.signMessage({
|
|
225
|
+
message: { raw: wrappedMessageHash }
|
|
226
|
+
});
|
|
227
|
+
if (!(0, utils_js_1.hasKernelFeature)(utils_js_1.KERNEL_FEATURES.ERC1271_WITH_VALIDATOR, version)) {
|
|
228
|
+
return signature;
|
|
229
|
+
}
|
|
230
|
+
return (0, viem_1.concatHex)([
|
|
231
|
+
kernelPluginManager.getValidationId(),
|
|
232
|
+
signature
|
|
233
|
+
]);
|
|
234
|
+
},
|
|
235
|
+
async getNonce() {
|
|
236
|
+
const key = await kernelPluginManager.getNonceKey(accountAddress);
|
|
237
|
+
return (0, permissionless_1.getAccountNonce)(client, {
|
|
238
|
+
sender: accountAddress,
|
|
239
|
+
entryPoint: entryPointAddress,
|
|
240
|
+
key
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
async signUserOperation(userOperation) {
|
|
244
|
+
return kernelPluginManager.signUserOperation(userOperation);
|
|
245
|
+
},
|
|
246
|
+
async getDummySignature(userOperation) {
|
|
247
|
+
return kernelPluginManager.getDummySignature(userOperation);
|
|
248
|
+
},
|
|
249
|
+
async getInitCode() {
|
|
250
|
+
if (smartAccountDeployed)
|
|
251
|
+
return "0x";
|
|
252
|
+
smartAccountDeployed = await (0, permissionless_1.isSmartAccountDeployed)(client, accountAddress);
|
|
253
|
+
if (smartAccountDeployed)
|
|
254
|
+
return "0x";
|
|
255
|
+
return generateInitCode();
|
|
506
256
|
}
|
|
507
|
-
|
|
508
|
-
},
|
|
509
|
-
async getDummySignature(userOperation) {
|
|
510
|
-
return kernelPluginManager.getDummySignature(userOperation);
|
|
511
|
-
}
|
|
257
|
+
})
|
|
512
258
|
};
|
|
513
259
|
}
|
|
514
260
|
exports.createKernelAccount = createKernelAccount;
|