@rhinestone/sdk 1.0.0-alpha.11 → 1.0.0-alpha.12
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/dist/src/accounts/index.d.ts +8 -6
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +69 -134
- package/dist/src/accounts/index.test.js +2 -2
- package/dist/src/accounts/kernel.d.ts +3 -2
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +3 -5
- package/dist/src/accounts/kernel.test.js +5 -10
- package/dist/src/accounts/nexus.d.ts +2 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +5 -6
- package/dist/src/accounts/nexus.test.js +11 -12
- package/dist/src/accounts/safe.d.ts +2 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +3 -5
- package/dist/src/accounts/safe.test.js +4 -5
- package/dist/src/accounts/signing/common.d.ts +23 -0
- package/dist/src/accounts/signing/common.d.ts.map +1 -0
- package/dist/src/accounts/signing/common.js +113 -0
- package/dist/src/accounts/signing/message.d.ts +5 -0
- package/dist/src/accounts/signing/message.d.ts.map +1 -0
- package/dist/src/accounts/signing/message.js +51 -0
- package/dist/src/accounts/signing/typedData.d.ts +5 -0
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -0
- package/dist/src/accounts/signing/typedData.js +39 -0
- package/dist/src/accounts/startale.d.ts +2 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +3 -3
- package/dist/src/accounts/startale.test.js +4 -5
- package/dist/src/actions/index.d.ts +84 -0
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +92 -0
- package/dist/src/actions/index.test.js +15 -15
- package/dist/src/actions/smart-session.d.ts +6 -0
- package/dist/src/actions/smart-session.d.ts.map +1 -1
- package/dist/src/actions/smart-session.js +6 -0
- package/dist/src/execution/compact.d.ts +128 -1
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +91 -0
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +2 -3
- package/dist/src/execution/utils.d.ts +6 -5
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +35 -6
- package/dist/src/index.d.ts +5 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +75 -11
- package/dist/src/modules/index.test.js +1 -1
- package/dist/src/modules/validators/core.js +1 -1
- package/dist/src/modules/validators/core.test.js +3 -3
- package/dist/src/modules/validators/smart-sessions.js +3 -3
- package/dist/src/modules/validators/smart-sessions.test.js +4 -4
- package/dist/src/orchestrator/index.d.ts +1 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -3
- package/dist/src/orchestrator/utils.d.ts +1 -3
- package/dist/src/orchestrator/utils.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.js +0 -102
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Chain, type Hex, type PublicClient } from 'viem';
|
|
1
|
+
import { type Chain, type HashTypedDataParameters, type Hex, type PublicClient, type TypedData } from 'viem';
|
|
2
2
|
import type { Module } from '../modules/common';
|
|
3
3
|
import type { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
4
4
|
import type { AccountProviderConfig, Call, OwnerSet, RhinestoneAccountConfig, Session, SignerSet } from '../types';
|
|
@@ -17,11 +17,13 @@ declare function getModuleInstallationCalls(config: RhinestoneAccountConfig, mod
|
|
|
17
17
|
declare function getModuleUninstallationCalls(config: RhinestoneAccountConfig, module: Module): Call[];
|
|
18
18
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
19
19
|
declare function getPackedSignature(config: RhinestoneAccountConfig, signers: SignerSet | undefined, chain: Chain, validator: ValidatorConfig, hash: Hex, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
20
|
-
declare function
|
|
20
|
+
declare function getTypedDataPackedSignature<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(config: RhinestoneAccountConfig, signers: SignerSet | undefined, chain: Chain, validator: ValidatorConfig, parameters: HashTypedDataParameters<typedData, primaryType>, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
21
|
+
declare function isDeployed(config: RhinestoneAccountConfig, chain: Chain): Promise<boolean>;
|
|
21
22
|
declare function deploy(config: RhinestoneAccountConfig, chain: Chain, session?: Session): Promise<void>;
|
|
22
|
-
declare function
|
|
23
|
-
declare function
|
|
24
|
-
declare function
|
|
23
|
+
declare function toErc6492Signature(config: RhinestoneAccountConfig, signature: Hex, chain: Chain): Promise<Hex>;
|
|
24
|
+
declare function getSmartAccount(config: RhinestoneAccountConfig, client: PublicClient, chain: Chain): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
25
|
+
declare function getSmartSessionSmartAccount(config: RhinestoneAccountConfig, client: PublicClient, chain: Chain, session: Session, enableData: EnableSessionData | null): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
26
|
+
declare function getGuardianSmartAccount(config: RhinestoneAccountConfig, client: PublicClient, chain: Chain, guardians: OwnerSet): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
25
27
|
declare function getAccountProvider(config: RhinestoneAccountConfig): AccountProviderConfig;
|
|
26
|
-
export { getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, getAccountProvider, getInitCode, signEip7702InitData, getEip7702InitCall, isDeployed, deploy, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, };
|
|
28
|
+
export { getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, getAccountProvider, getInitCode, signEip7702InitData, getEip7702InitCall, isDeployed, deploy, toErc6492Signature, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, getTypedDataPackedSignature, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, };
|
|
27
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EAKV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAER,KAAK,YAAY,EAEjB,KAAK,SAAS,EAEf,MAAM,MAAM,CAAA;AAGb,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAM/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EACV,qBAAqB,EACrB,IAAI,EACJ,QAAQ,EACR,uBAAuB,EACvB,OAAO,EACP,SAAS,EACV,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,YAAY,EACZ,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,4BAA4B,EAC5B,cAAc,EACd,kCAAkC,EAClC,qCAAqC,EACrC,4BAA4B,EAC7B,MAAM,SAAS,CAAA;AA2ChB,OAAO,EAAmB,KAAK,eAAe,EA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,KAAK,EACZ,OAAO,CAAC,EAAE,OAAO,iBAMlB;AAyBD,iBAAe,kBAAkB,CAC/B,MAAM,EAAE,uBAAuB,EAC/B,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,GAAG,CAAC,CAwBd;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,oKA6Cb;AAED,iBAAe,2BAA2B,CACxC,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,iBAAiB,GAAG,IAAI,oKAyDrC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,QAAQ,oKAqDpB;AAMD,iBAAS,kBAAkB,CACzB,MAAM,EAAE,uBAAuB,GAC9B,qBAAqB,CAOvB;AAED,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,kBAAkB,EAClB,eAAe,EACf,2BAA2B,EAC3B,uBAAuB,EACvB,kBAAkB,EAClB,2BAA2B,EAE3B,cAAc,EACd,YAAY,EACZ,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,GACnC,CAAA"}
|
|
@@ -10,14 +10,15 @@ exports.signEip7702InitData = signEip7702InitData;
|
|
|
10
10
|
exports.getEip7702InitCall = getEip7702InitCall;
|
|
11
11
|
exports.isDeployed = isDeployed;
|
|
12
12
|
exports.deploy = deploy;
|
|
13
|
+
exports.toErc6492Signature = toErc6492Signature;
|
|
13
14
|
exports.getSmartAccount = getSmartAccount;
|
|
14
15
|
exports.getSmartSessionSmartAccount = getSmartSessionSmartAccount;
|
|
15
16
|
exports.getGuardianSmartAccount = getGuardianSmartAccount;
|
|
16
17
|
exports.getPackedSignature = getPackedSignature;
|
|
18
|
+
exports.getTypedDataPackedSignature = getTypedDataPackedSignature;
|
|
17
19
|
const viem_1 = require("viem");
|
|
18
20
|
const execution_1 = require("../execution");
|
|
19
21
|
const smart_session_1 = require("../execution/smart-session");
|
|
20
|
-
const modules_1 = require("../modules");
|
|
21
22
|
const validators_1 = require("../modules/validators");
|
|
22
23
|
const core_1 = require("../modules/validators/core");
|
|
23
24
|
const error_1 = require("./error");
|
|
@@ -33,6 +34,9 @@ Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: tru
|
|
|
33
34
|
const kernel_1 = require("./kernel");
|
|
34
35
|
const nexus_1 = require("./nexus");
|
|
35
36
|
const safe_1 = require("./safe");
|
|
37
|
+
const common_1 = require("./signing/common");
|
|
38
|
+
const message_1 = require("./signing/message");
|
|
39
|
+
const typedData_1 = require("./signing/typedData");
|
|
36
40
|
const startale_1 = require("./startale");
|
|
37
41
|
const utils_1 = require("./utils");
|
|
38
42
|
function getDeployArgs(config) {
|
|
@@ -178,26 +182,56 @@ function getAddress(config) {
|
|
|
178
182
|
}
|
|
179
183
|
// Signs and packs a signature to be EIP-1271 compatible
|
|
180
184
|
async function getPackedSignature(config, signers, chain, validator, hash, transformSignature = (signature) => signature) {
|
|
181
|
-
signers = signers ?? convertOwnerSetToSignerSet(config.owners);
|
|
182
|
-
const signFn = (hash) => sign(signers, chain, hash);
|
|
185
|
+
signers = signers ?? (0, common_1.convertOwnerSetToSignerSet)(config.owners);
|
|
186
|
+
const signFn = (hash) => (0, message_1.sign)(signers, chain, hash);
|
|
183
187
|
const account = getAccountProvider(config);
|
|
184
188
|
const address = getAddress(config);
|
|
185
189
|
switch (account.type) {
|
|
186
190
|
case 'safe': {
|
|
187
|
-
|
|
191
|
+
const signature = await signFn(hash);
|
|
192
|
+
return (0, safe_1.packSignature)(signature, validator, transformSignature);
|
|
188
193
|
}
|
|
189
194
|
case 'nexus': {
|
|
190
|
-
|
|
195
|
+
const signature = await signFn(hash);
|
|
196
|
+
return (0, nexus_1.packSignature)(signature, validator, transformSignature);
|
|
191
197
|
}
|
|
192
198
|
case 'kernel': {
|
|
193
|
-
|
|
199
|
+
const signature = await signFn((0, kernel_1.wrapMessageHash)(hash, address));
|
|
200
|
+
return (0, kernel_1.packSignature)(signature, validator, transformSignature);
|
|
194
201
|
}
|
|
195
202
|
case 'startale': {
|
|
196
|
-
|
|
203
|
+
const signature = await signFn(hash);
|
|
204
|
+
return (0, startale_1.packSignature)(signature, validator, transformSignature);
|
|
197
205
|
}
|
|
198
206
|
}
|
|
199
207
|
}
|
|
200
|
-
|
|
208
|
+
// Signs and packs a signature to be EIP-1271 compatible
|
|
209
|
+
async function getTypedDataPackedSignature(config, signers, chain, validator, parameters, transformSignature = (signature) => signature) {
|
|
210
|
+
signers = signers ?? (0, common_1.convertOwnerSetToSignerSet)(config.owners);
|
|
211
|
+
const signFn = (parameters) => (0, typedData_1.sign)(signers, chain, parameters);
|
|
212
|
+
const account = getAccountProvider(config);
|
|
213
|
+
switch (account.type) {
|
|
214
|
+
case 'safe': {
|
|
215
|
+
const signature = await signFn(parameters);
|
|
216
|
+
return (0, safe_1.packSignature)(signature, validator, transformSignature);
|
|
217
|
+
}
|
|
218
|
+
case 'nexus': {
|
|
219
|
+
const signature = await signFn(parameters);
|
|
220
|
+
return (0, nexus_1.packSignature)(signature, validator, transformSignature);
|
|
221
|
+
}
|
|
222
|
+
case 'kernel': {
|
|
223
|
+
const address = getAddress(config);
|
|
224
|
+
const signMessageFn = (hash) => (0, message_1.sign)(signers, chain, hash);
|
|
225
|
+
const signature = await signMessageFn((0, kernel_1.wrapMessageHash)((0, viem_1.hashTypedData)(parameters), address));
|
|
226
|
+
return (0, kernel_1.packSignature)(signature, validator, transformSignature);
|
|
227
|
+
}
|
|
228
|
+
case 'startale': {
|
|
229
|
+
const signature = await signFn(parameters);
|
|
230
|
+
return (0, startale_1.packSignature)(signature, validator, transformSignature);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
async function isDeployed(config, chain) {
|
|
201
235
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
202
236
|
chain: chain,
|
|
203
237
|
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
@@ -232,7 +266,7 @@ async function deployWithIntent(chain, config) {
|
|
|
232
266
|
// Already deployed
|
|
233
267
|
return;
|
|
234
268
|
}
|
|
235
|
-
await (0, execution_1.sendTransaction)(config, {
|
|
269
|
+
const result = await (0, execution_1.sendTransaction)(config, {
|
|
236
270
|
targetChain: chain,
|
|
237
271
|
calls: [
|
|
238
272
|
{
|
|
@@ -241,13 +275,35 @@ async function deployWithIntent(chain, config) {
|
|
|
241
275
|
},
|
|
242
276
|
],
|
|
243
277
|
});
|
|
278
|
+
await (0, execution_1.waitForExecution)(config, result, true);
|
|
279
|
+
}
|
|
280
|
+
async function toErc6492Signature(config, signature, chain) {
|
|
281
|
+
const deployed = await isDeployed(config, chain);
|
|
282
|
+
if (deployed) {
|
|
283
|
+
return signature;
|
|
284
|
+
}
|
|
285
|
+
// Account is not deployed, use ERC-6492
|
|
286
|
+
const initCode = getInitCode(config);
|
|
287
|
+
if (!initCode) {
|
|
288
|
+
throw new error_1.FactoryArgsNotAvailableError();
|
|
289
|
+
}
|
|
290
|
+
const { factory, factoryData } = initCode;
|
|
291
|
+
const magicBytes = '0x6492649264926492649264926492649264926492649264926492649264926492';
|
|
292
|
+
return (0, viem_1.concat)([
|
|
293
|
+
(0, viem_1.encodeAbiParameters)([
|
|
294
|
+
{ name: 'create2Factory', type: 'address' },
|
|
295
|
+
{ name: 'factoryCalldata', type: 'bytes' },
|
|
296
|
+
{ name: 'originalERC1271Signature', type: 'bytes' },
|
|
297
|
+
], [factory, factoryData, signature]),
|
|
298
|
+
magicBytes,
|
|
299
|
+
]);
|
|
244
300
|
}
|
|
245
301
|
async function getSmartAccount(config, client, chain) {
|
|
246
302
|
const account = getAccountProvider(config);
|
|
247
303
|
const address = getAddress(config);
|
|
248
304
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
249
|
-
const signers = convertOwnerSetToSignerSet(config.owners);
|
|
250
|
-
const signFn = (hash) => sign(signers, chain, hash);
|
|
305
|
+
const signers = (0, common_1.convertOwnerSetToSignerSet)(config.owners);
|
|
306
|
+
const signFn = (hash) => (0, message_1.sign)(signers, chain, hash);
|
|
251
307
|
switch (account.type) {
|
|
252
308
|
case 'safe': {
|
|
253
309
|
return (0, safe_1.getSmartAccount)(client, address, config.owners, ownerValidator.address, signFn);
|
|
@@ -274,7 +330,7 @@ async function getSmartSessionSmartAccount(config, client, chain, session, enabl
|
|
|
274
330
|
session,
|
|
275
331
|
enableData: enableData || undefined,
|
|
276
332
|
};
|
|
277
|
-
const signFn = (hash) => sign(signers, chain, hash);
|
|
333
|
+
const signFn = (hash) => (0, message_1.sign)(signers, chain, hash);
|
|
278
334
|
const account = getAccountProvider(config);
|
|
279
335
|
switch (account.type) {
|
|
280
336
|
case 'safe': {
|
|
@@ -302,7 +358,7 @@ async function getGuardianSmartAccount(config, client, chain, guardians) {
|
|
|
302
358
|
type: 'guardians',
|
|
303
359
|
guardians: accounts,
|
|
304
360
|
};
|
|
305
|
-
const signFn = (hash) => sign(signers, chain, hash);
|
|
361
|
+
const signFn = (hash) => (0, message_1.sign)(signers, chain, hash);
|
|
306
362
|
const account = getAccountProvider(config);
|
|
307
363
|
switch (account.type) {
|
|
308
364
|
case 'safe': {
|
|
@@ -319,85 +375,6 @@ async function getGuardianSmartAccount(config, client, chain, guardians) {
|
|
|
319
375
|
}
|
|
320
376
|
}
|
|
321
377
|
}
|
|
322
|
-
async function sign(signers, chain, hash) {
|
|
323
|
-
switch (signers.type) {
|
|
324
|
-
case 'owner': {
|
|
325
|
-
switch (signers.kind) {
|
|
326
|
-
case 'ecdsa': {
|
|
327
|
-
const signatures = await Promise.all(signers.accounts.map((account) => signEcdsa(account, hash)));
|
|
328
|
-
return (0, viem_1.concat)(signatures);
|
|
329
|
-
}
|
|
330
|
-
case 'passkey': {
|
|
331
|
-
return await signPasskey(signers.account, chain, hash);
|
|
332
|
-
}
|
|
333
|
-
case 'multi-factor': {
|
|
334
|
-
const signatures = await Promise.all(signers.validators.map(async (validator) => {
|
|
335
|
-
if (validator === null) {
|
|
336
|
-
return '0x';
|
|
337
|
-
}
|
|
338
|
-
const validatorSigners = convertOwnerSetToSignerSet(validator);
|
|
339
|
-
return sign(validatorSigners, chain, hash);
|
|
340
|
-
}));
|
|
341
|
-
const data = (0, viem_1.encodeAbiParameters)([
|
|
342
|
-
{
|
|
343
|
-
components: [
|
|
344
|
-
{
|
|
345
|
-
internalType: 'bytes32',
|
|
346
|
-
name: 'packedValidatorAndId',
|
|
347
|
-
type: 'bytes32',
|
|
348
|
-
},
|
|
349
|
-
{ internalType: 'bytes', name: 'data', type: 'bytes' },
|
|
350
|
-
],
|
|
351
|
-
name: 'validators',
|
|
352
|
-
type: 'tuple[]',
|
|
353
|
-
},
|
|
354
|
-
], [
|
|
355
|
-
signers.validators.map((validator, index) => {
|
|
356
|
-
const validatorModule = (0, core_1.getValidator)(validator);
|
|
357
|
-
return {
|
|
358
|
-
packedValidatorAndId: (0, viem_1.concat)([
|
|
359
|
-
(0, viem_1.pad)((0, viem_1.toHex)(validator.id), {
|
|
360
|
-
size: 12,
|
|
361
|
-
}),
|
|
362
|
-
validatorModule.address,
|
|
363
|
-
]),
|
|
364
|
-
data: signatures[index],
|
|
365
|
-
};
|
|
366
|
-
}),
|
|
367
|
-
]);
|
|
368
|
-
return data;
|
|
369
|
-
}
|
|
370
|
-
default: {
|
|
371
|
-
throw new Error('Unsupported owner kind');
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
case 'session': {
|
|
376
|
-
const sessionSigners = convertOwnerSetToSignerSet(signers.session.owners);
|
|
377
|
-
return sign(sessionSigners, chain, hash);
|
|
378
|
-
}
|
|
379
|
-
case 'guardians': {
|
|
380
|
-
const signatures = await Promise.all(signers.guardians.map((account) => signEcdsa(account, hash)));
|
|
381
|
-
return (0, viem_1.concat)(signatures);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
async function signEcdsa(account, hash) {
|
|
386
|
-
if (!account.signMessage) {
|
|
387
|
-
throw new error_1.SigningNotSupportedForAccountError();
|
|
388
|
-
}
|
|
389
|
-
return await account.signMessage({ message: { raw: hash } });
|
|
390
|
-
}
|
|
391
|
-
async function signPasskey(account, chain, hash) {
|
|
392
|
-
const { webauthn, signature } = await account.sign({ hash });
|
|
393
|
-
const usePrecompiled = (0, modules_1.isRip7212SupportedNetwork)(chain);
|
|
394
|
-
const encodedSignature = (0, modules_1.getWebauthnValidatorSignature)({
|
|
395
|
-
webauthn,
|
|
396
|
-
signature,
|
|
397
|
-
usePrecompiled,
|
|
398
|
-
});
|
|
399
|
-
return encodedSignature;
|
|
400
|
-
}
|
|
401
378
|
function is7702(config) {
|
|
402
379
|
return config.eoa !== undefined;
|
|
403
380
|
}
|
|
@@ -409,45 +386,3 @@ function getAccountProvider(config) {
|
|
|
409
386
|
type: 'nexus',
|
|
410
387
|
};
|
|
411
388
|
}
|
|
412
|
-
function convertOwnerSetToSignerSet(owners) {
|
|
413
|
-
switch (owners.type) {
|
|
414
|
-
case 'ecdsa': {
|
|
415
|
-
return {
|
|
416
|
-
type: 'owner',
|
|
417
|
-
kind: 'ecdsa',
|
|
418
|
-
accounts: owners.accounts,
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
case 'passkey': {
|
|
422
|
-
return {
|
|
423
|
-
type: 'owner',
|
|
424
|
-
kind: 'passkey',
|
|
425
|
-
account: owners.account,
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
case 'multi-factor': {
|
|
429
|
-
return {
|
|
430
|
-
type: 'owner',
|
|
431
|
-
kind: 'multi-factor',
|
|
432
|
-
validators: owners.validators.map((validator, index) => {
|
|
433
|
-
switch (validator.type) {
|
|
434
|
-
case 'ecdsa': {
|
|
435
|
-
return {
|
|
436
|
-
type: 'ecdsa',
|
|
437
|
-
id: index,
|
|
438
|
-
accounts: validator.accounts,
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
case 'passkey': {
|
|
442
|
-
return {
|
|
443
|
-
type: 'passkey',
|
|
444
|
-
id: index,
|
|
445
|
-
account: validator.account,
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}),
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
@@ -14,7 +14,7 @@ const _1 = require(".");
|
|
|
14
14
|
},
|
|
15
15
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
16
16
|
});
|
|
17
|
-
(0, vitest_1.expect)(address).toEqual('
|
|
17
|
+
(0, vitest_1.expect)(address).toEqual('0x7fbe9b0796484c06c94968b910a4cf488fd1719b');
|
|
18
18
|
});
|
|
19
19
|
(0, vitest_1.test)('Safe, passkey owner with a session', () => {
|
|
20
20
|
const address = (0, _1.getAddress)({
|
|
@@ -24,7 +24,7 @@ const _1 = require(".");
|
|
|
24
24
|
},
|
|
25
25
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
26
26
|
});
|
|
27
|
-
(0, vitest_1.expect)(address).toEqual('
|
|
27
|
+
(0, vitest_1.expect)(address).toEqual('0x82a8a51443c2b8608001bdc4ff5bb31f69e8ed14');
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
(0, vitest_1.describe)('Sign', () => {
|
|
@@ -13,9 +13,10 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
|
13
13
|
};
|
|
14
14
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
15
15
|
declare function getInstallData(module: Module): Hex[];
|
|
16
|
-
declare function
|
|
16
|
+
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
17
|
+
declare function wrapMessageHash(messageHash: Hex, accountAddress: Hex): Hex;
|
|
17
18
|
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
18
19
|
declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, enableData: EnableSessionData | null, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
19
20
|
declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
20
|
-
export { getInstallData, getAddress, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount,
|
|
21
|
+
export { getInstallData, getAddress, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, packSignature, wrapMessageHash, };
|
|
21
22
|
//# sourceMappingURL=kernel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../accounts/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EAQZ,KAAK,GAAG,EAER,KAAK,YAAY,EAMlB,MAAM,MAAM,CAAA;AACb,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAKL,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAA;AAQ1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM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AAY,EACpB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,QAAQ,EAChB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAYlC;AAED,iBAAe,sBAAsB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,OAAO,EACzB,UAAU,EAAE,iBAAiB,GAAG,IAAI,EACpC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEA0ClC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAclC;AA+ED,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,eAAe,GAChB,CAAA"}
|
|
@@ -6,7 +6,8 @@ exports.getDeployArgs = getDeployArgs;
|
|
|
6
6
|
exports.getSmartAccount = getSmartAccount;
|
|
7
7
|
exports.getSessionSmartAccount = getSessionSmartAccount;
|
|
8
8
|
exports.getGuardianSmartAccount = getGuardianSmartAccount;
|
|
9
|
-
exports.
|
|
9
|
+
exports.packSignature = packSignature;
|
|
10
|
+
exports.wrapMessageHash = wrapMessageHash;
|
|
10
11
|
const viem_1 = require("viem");
|
|
11
12
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
12
13
|
const modules_1 = require("../modules");
|
|
@@ -126,11 +127,8 @@ function getInstallData(module) {
|
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
|
-
async function
|
|
130
|
+
async function packSignature(signature, validator, transformSignature = (signature) => signature) {
|
|
130
131
|
const vId = validator.isRoot ? '0x00' : (0, viem_1.concat)(['0x01', validator.address]);
|
|
131
|
-
const signature = validator.isRoot
|
|
132
|
-
? await signFn(wrapMessageHash(hash, accountAddress))
|
|
133
|
-
: await signFn(hash);
|
|
134
132
|
const magicValueSigReplayable = (0, viem_1.keccak256)((0, viem_1.toHex)('kernel.replayable.signature'));
|
|
135
133
|
const packedSig = (0, viem_1.concat)([
|
|
136
134
|
vId,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const viem_1 = require("viem");
|
|
4
3
|
const vitest_1 = require("vitest");
|
|
5
4
|
const consts_1 = require("../../test/consts");
|
|
6
5
|
const common_1 = require("../modules/common");
|
|
@@ -17,10 +16,10 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
17
16
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
18
17
|
});
|
|
19
18
|
(0, vitest_1.expect)(factory).toEqual('0xd703aae79538628d27099b8c4f621be4ccd142d5');
|
|
20
|
-
(0, vitest_1.expect)(factoryData).toEqual('
|
|
19
|
+
(0, vitest_1.expect)(factoryData).toEqual('0xc5265d5d0000000000000000000000002577507b78c2008ff367261cb6285d44ba5ef2e90000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003243c3b752b0120C008719Ba9D8aA14C7d07D122cd5E965aA8da50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da09948693600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001249517e29f000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000094000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
21
20
|
(0, vitest_1.expect)(salt).toEqual('0x0000000000000000000000000000000000000000000000000000000000000000');
|
|
22
21
|
(0, vitest_1.expect)(implementation).toEqual('0xd6CEDDe84be40893d153Be9d467CD6aD37875b28');
|
|
23
|
-
(0, vitest_1.expect)(initializationCallData).toEqual('
|
|
22
|
+
(0, vitest_1.expect)(initializationCallData).toEqual('0x3c3b752b0120C008719Ba9D8aA14C7d07D122cd5E965aA8da50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da09948693600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001249517e29f000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
24
23
|
});
|
|
25
24
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
26
25
|
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, kernel_1.getDeployArgs)({
|
|
@@ -46,7 +45,7 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
46
45
|
},
|
|
47
46
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
48
47
|
});
|
|
49
|
-
(0, vitest_1.expect)(address).toEqual('
|
|
48
|
+
(0, vitest_1.expect)(address).toEqual('0x43bb2f5505a463c57C9688678cC9DB8d10729747');
|
|
50
49
|
});
|
|
51
50
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
52
51
|
const address = (0, kernel_1.getAddress)({
|
|
@@ -77,25 +76,21 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
77
76
|
(0, vitest_1.describe)('Get Packed Signature', () => {
|
|
78
77
|
(0, vitest_1.describe)('Mock signature', () => {
|
|
79
78
|
(0, vitest_1.test)('Root validator', async () => {
|
|
80
|
-
const hash = (0, viem_1.keccak256)('0xabcd');
|
|
81
79
|
const mockSignature = '0x1234';
|
|
82
|
-
const accountAddress = '0xa80ed905adbd7cba128aaf64a1fa33a530b9b0aa';
|
|
83
80
|
const validator = {
|
|
84
81
|
address: '0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb4',
|
|
85
82
|
isRoot: true,
|
|
86
83
|
};
|
|
87
|
-
const signature = await (0, kernel_1.
|
|
84
|
+
const signature = await (0, kernel_1.packSignature)(mockSignature, validator);
|
|
88
85
|
(0, vitest_1.expect)(signature).toEqual('0x000555ad2729e8da1777a4e5020806f8bf7601c3db6bfe402f410a34958363a95a1234');
|
|
89
86
|
});
|
|
90
87
|
(0, vitest_1.test)('Non-root validator', async () => {
|
|
91
|
-
const hash = (0, viem_1.keccak256)('0xabcd');
|
|
92
88
|
const mockSignature = '0x1234';
|
|
93
|
-
const accountAddress = '0xa80ed905adbd7cba128aaf64a1fa33a530b9b0aa';
|
|
94
89
|
const validator = {
|
|
95
90
|
address: '0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb4',
|
|
96
91
|
isRoot: false,
|
|
97
92
|
};
|
|
98
|
-
const signature = await (0, kernel_1.
|
|
93
|
+
const signature = await (0, kernel_1.packSignature)(mockSignature, validator);
|
|
99
94
|
(0, vitest_1.expect)(signature).toEqual('0x01e35b75e5ec3c04e9cefa8e581fbee859f56edeb40555ad2729e8da1777a4e5020806f8bf7601c3db6bfe402f410a34958363a95a1234');
|
|
100
95
|
});
|
|
101
96
|
});
|
|
@@ -14,7 +14,7 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
|
14
14
|
};
|
|
15
15
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
16
16
|
declare function getInstallData(module: Module): `0x${string}`;
|
|
17
|
-
declare function
|
|
17
|
+
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex, defaultValidatorAddress?: Address): Promise<`0x${string}`>;
|
|
18
18
|
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>, defaultValidatorAddress?: Address): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
19
19
|
declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, enableData: EnableSessionData | null, sign: (hash: Hex) => Promise<Hex>, defaultValidatorAddress?: Address): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
20
20
|
declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>, defaultValidatorAddress?: Address): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
@@ -23,5 +23,5 @@ declare function getEip7702InitCall(config: RhinestoneAccountConfig, signature:
|
|
|
23
23
|
initData: `0x${string}`;
|
|
24
24
|
contract: `0x${string}`;
|
|
25
25
|
}>;
|
|
26
|
-
export { getInstallData, getAddress,
|
|
26
|
+
export { getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, signEip7702InitData, getEip7702InitCall, };
|
|
27
27
|
//# sourceMappingURL=nexus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nexus.d.ts","sourceRoot":"","sources":["../../../accounts/nexus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAYpE,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAS/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAE1E,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAchF,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;;EAmErD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBA4BlD;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,iBA2BrC;AAED,iBAAe,
|
|
1
|
+
{"version":3,"file":"nexus.d.ts","sourceRoot":"","sources":["../../../accounts/nexus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,O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CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,EACjC,uBAAuB,GAAE,OAAyC,iEAcnE;AAqFD,iBAAe,mBAAmB,CAChC,MAAM,EAAE,uBAAuB,EAC/B,GAAG,EAAE,OAAO,0BA0Bb;AAED,iBAAe,kBAAkB,CAC/B,MAAM,EAAE,uBAAuB,EAC/B,SAAS,EAAE,GAAG;;;GAuCf;AAED,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,GACnB,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInstallData = getInstallData;
|
|
4
4
|
exports.getAddress = getAddress;
|
|
5
|
-
exports.
|
|
5
|
+
exports.packSignature = packSignature;
|
|
6
6
|
exports.getDeployArgs = getDeployArgs;
|
|
7
7
|
exports.getSmartAccount = getSmartAccount;
|
|
8
8
|
exports.getSessionSmartAccount = getSessionSmartAccount;
|
|
@@ -17,9 +17,9 @@ const core_1 = require("../modules/validators/core");
|
|
|
17
17
|
const error_1 = require("./error");
|
|
18
18
|
const utils_1 = require("./utils");
|
|
19
19
|
const NEXUS_DEFAULT_VALIDATOR_ADDRESS = core_1.OWNABLE_VALIDATOR_ADDRESS;
|
|
20
|
-
const NEXUS_IMPLEMENTATION_ADDRESS = '
|
|
21
|
-
const NEXUS_FACTORY_ADDRESS = '
|
|
22
|
-
const NEXUS_BOOTSTRAP_ADDRESS = '
|
|
20
|
+
const NEXUS_IMPLEMENTATION_ADDRESS = '0x55cc6609fDb3620ABeABf4dB020abfc469494778';
|
|
21
|
+
const NEXUS_FACTORY_ADDRESS = '0xFF4454d15707a6f6BF01540796040f9E1646322C';
|
|
22
|
+
const NEXUS_BOOTSTRAP_ADDRESS = '0x40E89A87C56A340c9257350dEDf4B89a3FcCCcD3';
|
|
23
23
|
const NEXUS_CREATION_CODE = '0x60806040526102aa803803806100148161018c565b92833981016040828203126101885781516001600160a01b03811692909190838303610188576020810151906001600160401b03821161018857019281601f8501121561018857835161006e610069826101c5565b61018c565b9481865260208601936020838301011161018857815f926020809301865e8601015260017f90b772c2cb8a51aa7a8a65fc23543c6d022d5b3f8e2b92eed79fba7eef8293005d823b15610176577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916821790557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b5f80a282511561015e575f8091610146945190845af43d15610156573d91610137610069846101c5565b9283523d5f602085013e6101e0565b505b604051606b908161023f8239f35b6060916101e0565b50505034156101485763b398979f60e01b5f5260045ffd5b634c9c8ce360e01b5f5260045260245ffd5b5f80fd5b6040519190601f01601f191682016001600160401b038111838210176101b157604052565b634e487b7160e01b5f52604160045260245ffd5b6001600160401b0381116101b157601f01601f191660200190565b9061020457508051156101f557805190602001fd5b63d6bda27560e01b5f5260045ffd5b81511580610235575b610215575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b1561020d56fe60806040523615605c575f8073ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5416368280378136915af43d5f803e156058573d5ff35b3d5ffd5b00fea164736f6c634300081b000a';
|
|
24
24
|
function getDeployArgs(config) {
|
|
25
25
|
const salt = (0, viem_1.keccak256)('0x');
|
|
@@ -125,8 +125,7 @@ function getInstallData(module) {
|
|
|
125
125
|
args: [module.type, module.address, module.initData],
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
async function
|
|
129
|
-
const signature = await signFn(hash);
|
|
128
|
+
async function packSignature(signature, validator, transformSignature = (signature) => signature, defaultValidatorAddress = NEXUS_DEFAULT_VALIDATOR_ADDRESS) {
|
|
130
129
|
const validatorAddress = validator.address === defaultValidatorAddress
|
|
131
130
|
? viem_1.zeroAddress
|
|
132
131
|
: validator.address;
|