permissionless 0.2.20 → 0.2.22
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/CHANGELOG.md +13 -0
- package/_cjs/accounts/index.js +3 -1
- package/_cjs/accounts/index.js.map +1 -1
- package/_cjs/accounts/kernel/toEcdsaKernelSmartAccount.js +4 -287
- package/_cjs/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/kernel/toKernelSmartAccount.js +363 -0
- package/_cjs/accounts/kernel/toKernelSmartAccount.js.map +1 -0
- package/_cjs/accounts/kernel/utils/isWebAuthnAccount.js +8 -0
- package/_cjs/accounts/kernel/utils/isWebAuthnAccount.js.map +1 -0
- package/_cjs/accounts/kernel/utils/signMessage.js +41 -0
- package/_cjs/accounts/kernel/utils/signMessage.js.map +1 -1
- package/_cjs/accounts/kernel/utils/signTypedData.js +13 -1
- package/_cjs/accounts/kernel/utils/signTypedData.js.map +1 -1
- package/_cjs/actions/erc7579/installModule.js.map +1 -1
- package/_cjs/actions/erc7579/installModules.js.map +1 -1
- package/_cjs/actions/erc7579/uninstallModule.js.map +1 -1
- package/_cjs/actions/erc7579/uninstallModules.js.map +1 -1
- package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +12 -0
- package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
- package/_cjs/utils/encodeInstallModule.js.map +1 -1
- package/_cjs/vitest.config.js +3 -1
- package/_cjs/vitest.config.js.map +1 -1
- package/_esm/accounts/index.js +2 -1
- package/_esm/accounts/index.js.map +1 -1
- package/_esm/accounts/kernel/toEcdsaKernelSmartAccount.js +6 -333
- package/_esm/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/kernel/toKernelSmartAccount.js +408 -0
- package/_esm/accounts/kernel/toKernelSmartAccount.js.map +1 -0
- package/_esm/accounts/kernel/utils/isWebAuthnAccount.js +4 -0
- package/_esm/accounts/kernel/utils/isWebAuthnAccount.js.map +1 -0
- package/_esm/accounts/kernel/utils/signMessage.js +49 -1
- package/_esm/accounts/kernel/utils/signMessage.js.map +1 -1
- package/_esm/accounts/kernel/utils/signTypedData.js +13 -1
- package/_esm/accounts/kernel/utils/signTypedData.js.map +1 -1
- package/_esm/actions/erc7579/installModule.js.map +1 -1
- package/_esm/actions/erc7579/installModules.js.map +1 -1
- package/_esm/actions/erc7579/uninstallModule.js.map +1 -1
- package/_esm/actions/erc7579/uninstallModules.js.map +1 -1
- package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +12 -0
- package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
- package/_esm/utils/encodeInstallModule.js.map +1 -1
- package/_esm/vitest.config.js +3 -1
- package/_esm/vitest.config.js.map +1 -1
- package/_types/accounts/index.d.ts +3 -2
- package/_types/accounts/index.d.ts.map +1 -1
- package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts +9 -46
- package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/kernel/toKernelSmartAccount.d.ts +50 -0
- package/_types/accounts/kernel/toKernelSmartAccount.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/encodeCallData.d.ts +1 -1
- package/_types/accounts/kernel/utils/encodeCallData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/getNonceKey.d.ts +1 -1
- package/_types/accounts/kernel/utils/getNonceKey.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/isKernelV2.d.ts +1 -1
- package/_types/accounts/kernel/utils/isKernelV2.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/isWebAuthnAccount.d.ts +4 -0
- package/_types/accounts/kernel/utils/isWebAuthnAccount.d.ts.map +1 -0
- package/_types/accounts/kernel/utils/signMessage.d.ts +2 -1
- package/_types/accounts/kernel/utils/signMessage.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/signTypedData.d.ts +2 -1
- package/_types/accounts/kernel/utils/signTypedData.d.ts.map +1 -1
- package/_types/accounts/kernel/utils/wrapMessageHash.d.ts +1 -1
- package/_types/accounts/kernel/utils/wrapMessageHash.d.ts.map +1 -1
- package/_types/actions/erc7579/installModule.d.ts +2 -2
- package/_types/actions/erc7579/installModule.d.ts.map +1 -1
- package/_types/actions/erc7579/installModules.d.ts +2 -2
- package/_types/actions/erc7579/installModules.d.ts.map +1 -1
- package/_types/actions/erc7579/uninstallModule.d.ts +2 -2
- package/_types/actions/erc7579/uninstallModule.d.ts.map +1 -1
- package/_types/actions/erc7579/uninstallModules.d.ts +2 -2
- package/_types/actions/erc7579/uninstallModules.d.ts.map +1 -1
- package/_types/actions/erc7579.d.ts +4 -4
- package/_types/actions/erc7579.d.ts.map +1 -1
- package/_types/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.d.ts.map +1 -1
- package/_types/utils/encodeInstallModule.d.ts +3 -3
- package/_types/utils/encodeInstallModule.d.ts.map +1 -1
- package/_types/vitest.config.d.ts.map +1 -1
- package/accounts/index.ts +14 -3
- package/accounts/kernel/toEcdsaKernelSmartAccount.ts +32 -513
- package/accounts/kernel/toKernelSmartAccount.ts +645 -0
- package/accounts/kernel/utils/encodeCallData.ts +1 -1
- package/accounts/kernel/utils/getNonceKey.ts +1 -1
- package/accounts/kernel/utils/isKernelV2.ts +1 -1
- package/accounts/kernel/utils/isWebAuthnAccount.ts +8 -0
- package/accounts/kernel/utils/signMessage.ts +55 -1
- package/accounts/kernel/utils/signTypedData.ts +19 -2
- package/accounts/kernel/utils/wrapMessageHash.ts +1 -1
- package/actions/erc7579/installModule.ts +9 -4
- package/actions/erc7579/installModules.ts +9 -4
- package/actions/erc7579/uninstallModule.ts +9 -4
- package/actions/erc7579/uninstallModules.ts +9 -4
- package/actions/erc7579.ts +8 -8
- package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +24 -0
- package/package.json +3 -2
- package/utils/encodeInstallModule.ts +37 -34
- package/vitest.config.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# permissionless
|
|
2
2
|
|
|
3
|
+
## 0.2.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fb7be6286b2023b20ff9951d5c602eaa2f589e3f: Added toKernelSmartAccount with passkeys support
|
|
8
|
+
- fb7be6286b2023b20ff9951d5c602eaa2f589e3f: Depricated toEcdsaKernelSmartAccount
|
|
9
|
+
|
|
10
|
+
## 0.2.21
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 41e3a2b8258b1770a3d81fba1c949fe194965c47: Fixed use of getPaymasterData twice in prepareUserOperationForErc20Paymaster
|
|
15
|
+
|
|
3
16
|
## 0.2.20
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/_cjs/accounts/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toThirdwebSmartAccount = exports.toBiconomySmartAccount = exports.toNexusSmartAccount = exports.toEcdsaKernelSmartAccount = exports.toSafeSmartAccount = exports.toTrustSmartAccount = exports.toLightSmartAccount = exports.toSimpleSmartAccount = void 0;
|
|
3
|
+
exports.toThirdwebSmartAccount = exports.toBiconomySmartAccount = exports.toNexusSmartAccount = exports.toKernelSmartAccount = exports.toEcdsaKernelSmartAccount = exports.toSafeSmartAccount = exports.toTrustSmartAccount = exports.toLightSmartAccount = exports.toSimpleSmartAccount = void 0;
|
|
4
4
|
const toSimpleSmartAccount_js_1 = require("./simple/toSimpleSmartAccount.js");
|
|
5
5
|
Object.defineProperty(exports, "toSimpleSmartAccount", { enumerable: true, get: function () { return toSimpleSmartAccount_js_1.toSimpleSmartAccount; } });
|
|
6
6
|
const toLightSmartAccount_js_1 = require("./light/toLightSmartAccount.js");
|
|
@@ -11,6 +11,8 @@ const toSafeSmartAccount_js_1 = require("./safe/toSafeSmartAccount.js");
|
|
|
11
11
|
Object.defineProperty(exports, "toSafeSmartAccount", { enumerable: true, get: function () { return toSafeSmartAccount_js_1.toSafeSmartAccount; } });
|
|
12
12
|
const toEcdsaKernelSmartAccount_js_1 = require("./kernel/toEcdsaKernelSmartAccount.js");
|
|
13
13
|
Object.defineProperty(exports, "toEcdsaKernelSmartAccount", { enumerable: true, get: function () { return toEcdsaKernelSmartAccount_js_1.toEcdsaKernelSmartAccount; } });
|
|
14
|
+
const toKernelSmartAccount_js_1 = require("./kernel/toKernelSmartAccount.js");
|
|
15
|
+
Object.defineProperty(exports, "toKernelSmartAccount", { enumerable: true, get: function () { return toKernelSmartAccount_js_1.toKernelSmartAccount; } });
|
|
14
16
|
const toBiconomySmartAccount_js_1 = require("./biconomy/toBiconomySmartAccount.js");
|
|
15
17
|
Object.defineProperty(exports, "toBiconomySmartAccount", { enumerable: true, get: function () { return toBiconomySmartAccount_js_1.toBiconomySmartAccount; } });
|
|
16
18
|
const toNexusSmartAccount_js_1 = require("./nexus/toNexusSmartAccount.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../accounts/index.ts"],"names":[],"mappings":";;;AAAA,8EAKyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../accounts/index.ts"],"names":[],"mappings":";;;AAAA,8EAKyC;AAiErC,qGAlEA,8CAAoB,OAkEA;AA/DxB,2EAMuC;AA8DnC,oGA/DA,4CAAmB,OA+DA;AA5DvB,2EAKuC;AA2DnC,oGA5DA,4CAAmB,OA4DA;AAzDvB,wEAMqC;AAwDjC,mGAzDA,0CAAkB,OAyDA;AAtDtB,wFAK8C;AAqD1C,0GAtDA,wDAAyB,OAsDA;AAnD7B,8EAMyC;AAkDrC,qGAnDA,8CAAoB,OAmDA;AAhDxB,oFAK6C;AAmDzC,uGApDA,kDAAsB,OAoDA;AAjD1B,2EAKuC;AAwCnC,oGAzCA,4CAAmB,OAyCA;AAtCvB,oFAK6C;AAyCzC,uGA1CA,kDAAsB,OA0CA"}
|
|
@@ -1,294 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEcdsaRootIdentifierForKernelV3 = exports.KERNEL_VERSION_TO_ADDRESSES_MAP = void 0;
|
|
4
3
|
exports.toEcdsaKernelSmartAccount = toEcdsaKernelSmartAccount;
|
|
5
|
-
const
|
|
6
|
-
const account_abstraction_1 = require("viem/account-abstraction");
|
|
7
|
-
const actions_1 = require("viem/actions");
|
|
8
|
-
const utils_1 = require("viem/utils");
|
|
9
|
-
const getAccountNonce_js_1 = require("../../actions/public/getAccountNonce.js");
|
|
10
|
-
const getSenderAddress_js_1 = require("../../actions/public/getSenderAddress.js");
|
|
11
|
-
const toOwner_js_1 = require("../../utils/toOwner.js");
|
|
12
|
-
const KernelAccountAbi_js_1 = require("./abi/KernelAccountAbi.js");
|
|
13
|
-
const KernelV3AccountAbi_js_1 = require("./abi/KernelV3AccountAbi.js");
|
|
14
|
-
const KernelV3MetaFactoryAbi_js_1 = require("./abi/KernelV3MetaFactoryAbi.js");
|
|
15
|
-
const constants_js_1 = require("./constants.js");
|
|
16
|
-
const encodeCallData_js_1 = require("./utils/encodeCallData.js");
|
|
17
|
-
const getNonceKey_js_1 = require("./utils/getNonceKey.js");
|
|
18
|
-
const isKernelV2_js_1 = require("./utils/isKernelV2.js");
|
|
19
|
-
const signMessage_js_1 = require("./utils/signMessage.js");
|
|
20
|
-
const signTypedData_js_1 = require("./utils/signTypedData.js");
|
|
21
|
-
const createAccountAbi = [
|
|
22
|
-
{
|
|
23
|
-
inputs: [
|
|
24
|
-
{
|
|
25
|
-
internalType: "address",
|
|
26
|
-
name: "_implementation",
|
|
27
|
-
type: "address"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
internalType: "bytes",
|
|
31
|
-
name: "_data",
|
|
32
|
-
type: "bytes"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
internalType: "uint256",
|
|
36
|
-
name: "_index",
|
|
37
|
-
type: "uint256"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
name: "createAccount",
|
|
41
|
-
outputs: [
|
|
42
|
-
{
|
|
43
|
-
internalType: "address",
|
|
44
|
-
name: "proxy",
|
|
45
|
-
type: "address"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
stateMutability: "payable",
|
|
49
|
-
type: "function"
|
|
50
|
-
}
|
|
51
|
-
];
|
|
52
|
-
exports.KERNEL_VERSION_TO_ADDRESSES_MAP = {
|
|
53
|
-
"0.2.1": {
|
|
54
|
-
ECDSA_VALIDATOR: "0xd9AB5096a832b9ce79914329DAEE236f8Eea0390",
|
|
55
|
-
ACCOUNT_LOGIC: "0xf048AD83CB2dfd6037A43902a2A5Be04e53cd2Eb",
|
|
56
|
-
FACTORY_ADDRESS: "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3"
|
|
57
|
-
},
|
|
58
|
-
"0.2.2": {
|
|
59
|
-
ECDSA_VALIDATOR: "0xd9AB5096a832b9ce79914329DAEE236f8Eea0390",
|
|
60
|
-
ACCOUNT_LOGIC: "0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5",
|
|
61
|
-
FACTORY_ADDRESS: "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3"
|
|
62
|
-
},
|
|
63
|
-
"0.2.3": {
|
|
64
|
-
ECDSA_VALIDATOR: "0xd9AB5096a832b9ce79914329DAEE236f8Eea0390",
|
|
65
|
-
ACCOUNT_LOGIC: "0xD3F582F6B4814E989Ee8E96bc3175320B5A540ab",
|
|
66
|
-
FACTORY_ADDRESS: "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3"
|
|
67
|
-
},
|
|
68
|
-
"0.2.4": {
|
|
69
|
-
ECDSA_VALIDATOR: "0xd9AB5096a832b9ce79914329DAEE236f8Eea0390",
|
|
70
|
-
ACCOUNT_LOGIC: "0xd3082872F8B06073A021b4602e022d5A070d7cfC",
|
|
71
|
-
FACTORY_ADDRESS: "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3"
|
|
72
|
-
},
|
|
73
|
-
"0.3.0-beta": {
|
|
74
|
-
ECDSA_VALIDATOR: "0x8104e3Ad430EA6d354d013A6789fDFc71E671c43",
|
|
75
|
-
ACCOUNT_LOGIC: "0x94F097E1ebEB4ecA3AAE54cabb08905B239A7D27",
|
|
76
|
-
FACTORY_ADDRESS: "0x6723b44Abeec4E71eBE3232BD5B455805baDD22f",
|
|
77
|
-
META_FACTORY_ADDRESS: "0xd703aaE79538628d27099B8c4f621bE4CCd142d5"
|
|
78
|
-
},
|
|
79
|
-
"0.3.1": {
|
|
80
|
-
ECDSA_VALIDATOR: "0x845ADb2C711129d4f3966735eD98a9F09fC4cE57",
|
|
81
|
-
ACCOUNT_LOGIC: "0xBAC849bB641841b44E965fB01A4Bf5F074f84b4D",
|
|
82
|
-
FACTORY_ADDRESS: "0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419",
|
|
83
|
-
META_FACTORY_ADDRESS: "0xd703aaE79538628d27099B8c4f621bE4CCd142d5"
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const getDefaultKernelVersion = (entryPointVersion, version) => {
|
|
87
|
-
if (version) {
|
|
88
|
-
return version;
|
|
89
|
-
}
|
|
90
|
-
return (entryPointVersion === "0.6" ? "0.2.2" : "0.3.0-beta");
|
|
91
|
-
};
|
|
92
|
-
const getDefaultAddresses = ({ ecdsaValidatorAddress: _ecdsaValidatorAddress, accountLogicAddress: _accountLogicAddress, factoryAddress: _factoryAddress, metaFactoryAddress: _metaFactoryAddress, kernelVersion }) => {
|
|
93
|
-
const addresses = exports.KERNEL_VERSION_TO_ADDRESSES_MAP[kernelVersion];
|
|
94
|
-
const ecdsaValidatorAddress = _ecdsaValidatorAddress ?? addresses.ECDSA_VALIDATOR;
|
|
95
|
-
const accountLogicAddress = _accountLogicAddress ?? addresses.ACCOUNT_LOGIC;
|
|
96
|
-
const factoryAddress = _factoryAddress ?? addresses.FACTORY_ADDRESS;
|
|
97
|
-
const metaFactoryAddress = _metaFactoryAddress ?? addresses?.META_FACTORY_ADDRESS ?? viem_1.zeroAddress;
|
|
98
|
-
return {
|
|
99
|
-
ecdsaValidatorAddress,
|
|
100
|
-
accountLogicAddress,
|
|
101
|
-
factoryAddress,
|
|
102
|
-
metaFactoryAddress
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
const getEcdsaRootIdentifierForKernelV3 = (validatorAddress) => {
|
|
106
|
-
return (0, viem_1.concatHex)([constants_js_1.VALIDATOR_TYPE.VALIDATOR, validatorAddress]);
|
|
107
|
-
};
|
|
108
|
-
exports.getEcdsaRootIdentifierForKernelV3 = getEcdsaRootIdentifierForKernelV3;
|
|
109
|
-
const getInitializationData = ({ entryPoint: { version: entryPointVersion }, kernelVersion, owner, ecdsaValidatorAddress }) => {
|
|
110
|
-
if (entryPointVersion === "0.6") {
|
|
111
|
-
return (0, viem_1.encodeFunctionData)({
|
|
112
|
-
abi: KernelAccountAbi_js_1.KernelInitAbi,
|
|
113
|
-
functionName: "initialize",
|
|
114
|
-
args: [ecdsaValidatorAddress, owner]
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
if (kernelVersion === "0.3.0-beta") {
|
|
118
|
-
return (0, viem_1.encodeFunctionData)({
|
|
119
|
-
abi: KernelV3AccountAbi_js_1.KernelV3InitAbi,
|
|
120
|
-
functionName: "initialize",
|
|
121
|
-
args: [
|
|
122
|
-
(0, exports.getEcdsaRootIdentifierForKernelV3)(ecdsaValidatorAddress),
|
|
123
|
-
viem_1.zeroAddress,
|
|
124
|
-
owner,
|
|
125
|
-
"0x"
|
|
126
|
-
]
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
return (0, viem_1.encodeFunctionData)({
|
|
130
|
-
abi: KernelV3AccountAbi_js_1.KernelV3_1AccountAbi,
|
|
131
|
-
functionName: "initialize",
|
|
132
|
-
args: [
|
|
133
|
-
(0, exports.getEcdsaRootIdentifierForKernelV3)(ecdsaValidatorAddress),
|
|
134
|
-
viem_1.zeroAddress,
|
|
135
|
-
owner,
|
|
136
|
-
"0x",
|
|
137
|
-
[]
|
|
138
|
-
]
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
const getAccountInitCode = async ({ entryPointVersion, kernelVersion, owner, index, factoryAddress, accountLogicAddress, ecdsaValidatorAddress }) => {
|
|
142
|
-
const initializationData = getInitializationData({
|
|
143
|
-
entryPoint: { version: entryPointVersion },
|
|
144
|
-
kernelVersion,
|
|
145
|
-
ecdsaValidatorAddress,
|
|
146
|
-
owner
|
|
147
|
-
});
|
|
148
|
-
if (entryPointVersion === "0.6") {
|
|
149
|
-
return (0, viem_1.encodeFunctionData)({
|
|
150
|
-
abi: createAccountAbi,
|
|
151
|
-
functionName: "createAccount",
|
|
152
|
-
args: [accountLogicAddress, initializationData, index]
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
return (0, viem_1.encodeFunctionData)({
|
|
156
|
-
abi: KernelV3MetaFactoryAbi_js_1.KernelV3MetaFactoryDeployWithFactoryAbi,
|
|
157
|
-
functionName: "deployWithFactory",
|
|
158
|
-
args: [factoryAddress, initializationData, (0, viem_1.toHex)(index, { size: 32 })]
|
|
159
|
-
});
|
|
160
|
-
};
|
|
4
|
+
const toKernelSmartAccount_js_1 = require("./toKernelSmartAccount.js");
|
|
161
5
|
async function toEcdsaKernelSmartAccount(parameters) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
address: parameters.entryPoint?.address ?? account_abstraction_1.entryPoint07Address,
|
|
166
|
-
abi: (parameters.entryPoint?.version ?? "0.7") === "0.6"
|
|
167
|
-
? account_abstraction_1.entryPoint06Abi
|
|
168
|
-
: account_abstraction_1.entryPoint07Abi,
|
|
169
|
-
version: parameters.entryPoint?.version ?? "0.7"
|
|
170
|
-
};
|
|
171
|
-
const kernelVersion = getDefaultKernelVersion(entryPoint.version, version);
|
|
172
|
-
const { accountLogicAddress, ecdsaValidatorAddress, factoryAddress, metaFactoryAddress } = getDefaultAddresses({
|
|
173
|
-
ecdsaValidatorAddress: _ecdsaValidatorAddress,
|
|
174
|
-
accountLogicAddress: _accountLogicAddress,
|
|
175
|
-
factoryAddress: _factoryAddress,
|
|
176
|
-
metaFactoryAddress: _metaFactoryAddress,
|
|
177
|
-
kernelVersion
|
|
178
|
-
});
|
|
179
|
-
const generateInitCode = () => getAccountInitCode({
|
|
180
|
-
entryPointVersion: entryPoint.version,
|
|
181
|
-
kernelVersion,
|
|
182
|
-
owner: localOwner.address,
|
|
183
|
-
index,
|
|
184
|
-
factoryAddress,
|
|
185
|
-
accountLogicAddress,
|
|
186
|
-
ecdsaValidatorAddress
|
|
187
|
-
});
|
|
188
|
-
let accountAddress = address;
|
|
189
|
-
let chainId;
|
|
190
|
-
const getMemoizedChainId = async () => {
|
|
191
|
-
if (chainId)
|
|
192
|
-
return chainId;
|
|
193
|
-
chainId = client.chain
|
|
194
|
-
? client.chain.id
|
|
195
|
-
: await (0, utils_1.getAction)(client, actions_1.getChainId, "getChainId")({});
|
|
196
|
-
return chainId;
|
|
197
|
-
};
|
|
198
|
-
const getFactoryArgs = async () => {
|
|
199
|
-
return {
|
|
200
|
-
factory: entryPoint.version === "0.6"
|
|
201
|
-
? factoryAddress
|
|
202
|
-
: metaFactoryAddress,
|
|
203
|
-
factoryData: await generateInitCode()
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
return (0, account_abstraction_1.toSmartAccount)({
|
|
207
|
-
client,
|
|
208
|
-
entryPoint,
|
|
209
|
-
getFactoryArgs,
|
|
210
|
-
async getAddress() {
|
|
211
|
-
if (accountAddress)
|
|
212
|
-
return accountAddress;
|
|
213
|
-
const { factory, factoryData } = await getFactoryArgs();
|
|
214
|
-
accountAddress = await (0, getSenderAddress_js_1.getSenderAddress)(client, {
|
|
215
|
-
factory,
|
|
216
|
-
factoryData,
|
|
217
|
-
entryPointAddress: entryPoint.address
|
|
218
|
-
});
|
|
219
|
-
return accountAddress;
|
|
220
|
-
},
|
|
221
|
-
async encodeCalls(calls) {
|
|
222
|
-
return (0, encodeCallData_js_1.encodeCallData)({ calls, kernelVersion });
|
|
223
|
-
},
|
|
224
|
-
async getNonce(_args) {
|
|
225
|
-
return (0, getAccountNonce_js_1.getAccountNonce)(client, {
|
|
226
|
-
address: await this.getAddress(),
|
|
227
|
-
entryPointAddress: entryPoint.address,
|
|
228
|
-
key: (0, getNonceKey_js_1.getNonceKeyWithEncoding)(kernelVersion, ecdsaValidatorAddress, parameters.nonceKey ?? 0n)
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
async getStubSignature() {
|
|
232
|
-
if ((0, isKernelV2_js_1.isKernelV2)(kernelVersion)) {
|
|
233
|
-
return (0, viem_1.concatHex)([constants_js_1.ROOT_MODE_KERNEL_V2, constants_js_1.DUMMY_ECDSA_SIGNATURE]);
|
|
234
|
-
}
|
|
235
|
-
return constants_js_1.DUMMY_ECDSA_SIGNATURE;
|
|
236
|
-
},
|
|
237
|
-
async sign({ hash }) {
|
|
238
|
-
return this.signMessage({ message: hash });
|
|
239
|
-
},
|
|
240
|
-
async signMessage({ message }) {
|
|
241
|
-
const signature = await (0, signMessage_js_1.signMessage)({
|
|
242
|
-
owner: localOwner,
|
|
243
|
-
message,
|
|
244
|
-
accountAddress: await this.getAddress(),
|
|
245
|
-
kernelVersion,
|
|
246
|
-
chainId: await getMemoizedChainId()
|
|
247
|
-
});
|
|
248
|
-
if ((0, isKernelV2_js_1.isKernelV2)(kernelVersion)) {
|
|
249
|
-
return signature;
|
|
250
|
-
}
|
|
251
|
-
return (0, viem_1.concatHex)([
|
|
252
|
-
(0, exports.getEcdsaRootIdentifierForKernelV3)(ecdsaValidatorAddress),
|
|
253
|
-
signature
|
|
254
|
-
]);
|
|
255
|
-
},
|
|
256
|
-
async signTypedData(typedData) {
|
|
257
|
-
const signature = await (0, signTypedData_js_1.signTypedData)({
|
|
258
|
-
owner: localOwner,
|
|
259
|
-
chainId: await getMemoizedChainId(),
|
|
260
|
-
...typedData,
|
|
261
|
-
accountAddress: await this.getAddress(),
|
|
262
|
-
kernelVersion
|
|
263
|
-
});
|
|
264
|
-
if ((0, isKernelV2_js_1.isKernelV2)(kernelVersion)) {
|
|
265
|
-
return signature;
|
|
266
|
-
}
|
|
267
|
-
return (0, viem_1.concatHex)([
|
|
268
|
-
(0, exports.getEcdsaRootIdentifierForKernelV3)(ecdsaValidatorAddress),
|
|
269
|
-
signature
|
|
270
|
-
]);
|
|
271
|
-
},
|
|
272
|
-
async signUserOperation(parameters) {
|
|
273
|
-
const { chainId = await getMemoizedChainId(), ...userOperation } = parameters;
|
|
274
|
-
const hash = (0, account_abstraction_1.getUserOperationHash)({
|
|
275
|
-
userOperation: {
|
|
276
|
-
...userOperation,
|
|
277
|
-
sender: userOperation.sender ?? (await this.getAddress()),
|
|
278
|
-
signature: "0x"
|
|
279
|
-
},
|
|
280
|
-
entryPointAddress: entryPoint.address,
|
|
281
|
-
entryPointVersion: entryPoint.version,
|
|
282
|
-
chainId: chainId
|
|
283
|
-
});
|
|
284
|
-
const signature = await localOwner.signMessage({
|
|
285
|
-
message: { raw: hash }
|
|
286
|
-
});
|
|
287
|
-
if ((0, isKernelV2_js_1.isKernelV2)(kernelVersion)) {
|
|
288
|
-
return (0, viem_1.concatHex)(["0x00000000", signature]);
|
|
289
|
-
}
|
|
290
|
-
return signature;
|
|
291
|
-
}
|
|
6
|
+
return (0, toKernelSmartAccount_js_1.toKernelSmartAccount)({
|
|
7
|
+
...parameters,
|
|
8
|
+
validatorAddress: parameters.validatorAddress ?? parameters.ecdsaValidatorAddress
|
|
292
9
|
});
|
|
293
10
|
}
|
|
294
11
|
//# sourceMappingURL=toEcdsaKernelSmartAccount.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toEcdsaKernelSmartAccount.js","sourceRoot":"","sources":["../../../accounts/kernel/toEcdsaKernelSmartAccount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toEcdsaKernelSmartAccount.js","sourceRoot":"","sources":["../../../accounts/kernel/toEcdsaKernelSmartAccount.ts"],"names":[],"mappings":";;AAyCA,8DAoBC;AAnDD,uEAMkC;AAyB3B,KAAK,UAAU,yBAAyB,CAS3C,UAIC;IAED,OAAO,IAAA,8CAAoB,EAAC;QACxB,GAAG,UAAU;QACb,gBAAgB,EACZ,UAAU,CAAC,gBAAgB,IAAI,UAAU,CAAC,qBAAqB;KACtE,CAAC,CAAA;AACN,CAAC"}
|