@rhinestone/sdk 1.0.0-alpha.25 → 1.0.0-alpha.27
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/error.d.ts +12 -5
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +19 -10
- package/dist/src/accounts/index.d.ts +11 -4
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +119 -40
- package/dist/src/accounts/index.test.js +2 -2
- package/dist/src/accounts/kernel.d.ts +1 -1
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +29 -1
- package/dist/src/accounts/kernel.test.js +37 -4
- package/dist/src/accounts/nexus.d.ts +4 -3
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +82 -14
- package/dist/src/accounts/nexus.test.js +35 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +79 -55
- package/dist/src/accounts/safe.test.js +35 -2
- package/dist/src/accounts/signing/common.d.ts +1 -1
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +14 -13
- package/dist/src/accounts/signing/message.js +3 -3
- package/dist/src/accounts/signing/passkeys.d.ts +8 -1
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -1
- package/dist/src/accounts/signing/passkeys.js +35 -0
- package/dist/src/accounts/signing/passkeys.test.js +15 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -1
- package/dist/src/accounts/walletClient.js +2 -1
- package/dist/src/actions/index.d.ts +30 -2
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +37 -6
- package/dist/src/actions/index.test.js +11 -11
- package/dist/src/execution/error.d.ts +8 -1
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +10 -1
- package/dist/src/execution/index.d.ts +12 -3
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +25 -17
- package/dist/src/execution/utils.d.ts +1 -1
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +24 -6
- package/dist/src/index.d.ts +6 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +19 -3
- package/dist/src/modules/common.d.ts +10 -4
- package/dist/src/modules/common.d.ts.map +1 -1
- package/dist/src/modules/common.js +22 -1
- package/dist/src/modules/index.d.ts +2 -1
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +16 -13
- package/dist/src/modules/index.test.js +8 -7
- package/dist/src/modules/validators/core.d.ts +4 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +24 -14
- package/dist/src/modules/validators/core.test.js +4 -4
- package/dist/src/orchestrator/client.js +6 -6
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +11 -10
- package/dist/src/orchestrator/registry.test.js +4 -4
- package/dist/src/types.d.ts +30 -20
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src/accounts/custom.d.ts +0 -18
- package/dist/src/accounts/custom.d.ts.map +0 -1
- package/dist/src/accounts/custom.js +0 -121
- package/dist/src/accounts/custom.test.d.ts +0 -2
- package/dist/src/accounts/custom.test.d.ts.map +0 -1
- package/dist/src/accounts/custom.test.js +0 -64
|
@@ -50,20 +50,27 @@ declare class SigningNotSupportedForAccountError extends AccountError {
|
|
|
50
50
|
traceId?: string;
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
declare class
|
|
54
|
-
constructor(params?: {
|
|
53
|
+
declare class Eip7702NotSupportedForAccountError extends AccountError {
|
|
54
|
+
constructor(account: AccountType, params?: {
|
|
55
55
|
context?: any;
|
|
56
56
|
errorType?: string;
|
|
57
57
|
traceId?: string;
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
declare class
|
|
61
|
-
constructor(account: AccountType, params?: {
|
|
60
|
+
declare class AccountConfigurationNotSupportedError extends AccountError {
|
|
61
|
+
constructor(message: string, account: AccountType, params?: {
|
|
62
|
+
context?: any;
|
|
63
|
+
errorType?: string;
|
|
64
|
+
traceId?: string;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
declare class WalletClientNoConnectedAccountError extends AccountError {
|
|
68
|
+
constructor(params?: {
|
|
62
69
|
context?: any;
|
|
63
70
|
errorType?: string;
|
|
64
71
|
traceId?: string;
|
|
65
72
|
});
|
|
66
73
|
}
|
|
67
74
|
declare function isAccountError(error: Error): error is AccountError;
|
|
68
|
-
export { isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError,
|
|
75
|
+
export { isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, AccountConfigurationNotSupportedError, WalletClientNoConnectedAccountError, };
|
|
69
76
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../accounts/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,cAAM,YAAa,SAAQ,KAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;gBAErB,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO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AAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,kCAAmC,SAAQ,YAAY;gBAEzD,OAAO,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAQnE;AAED,cAAM,qCAAsC,SAAQ,YAAY;gBAE5D,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAOJ;AAED,cAAM,mCAAoC,SAAQ,YAAY;gBAChD,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAOF;AAED,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,YAAY,CAE3D;AAeD,OAAO,EACL,cAAc,EACd,YAAY,EACZ,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,kCAAkC,EAClC,qCAAqC,EACrC,mCAAmC,GACpC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.WalletClientNoConnectedAccountError = exports.AccountConfigurationNotSupportedError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = void 0;
|
|
4
4
|
exports.isAccountError = isAccountError;
|
|
5
5
|
class AccountError extends Error {
|
|
6
6
|
_message;
|
|
@@ -73,15 +73,6 @@ class SigningNotSupportedForAccountError extends AccountError {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
exports.SigningNotSupportedForAccountError = SigningNotSupportedForAccountError;
|
|
76
|
-
class SignMessageNotSupportedByAccountError extends AccountError {
|
|
77
|
-
constructor(params) {
|
|
78
|
-
super({
|
|
79
|
-
message: 'Sign message not supported by account',
|
|
80
|
-
...params,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.SignMessageNotSupportedByAccountError = SignMessageNotSupportedByAccountError;
|
|
85
76
|
class Eip7702NotSupportedForAccountError extends AccountError {
|
|
86
77
|
constructor(account, params) {
|
|
87
78
|
const accountName = getAccountName(account);
|
|
@@ -92,6 +83,24 @@ class Eip7702NotSupportedForAccountError extends AccountError {
|
|
|
92
83
|
}
|
|
93
84
|
}
|
|
94
85
|
exports.Eip7702NotSupportedForAccountError = Eip7702NotSupportedForAccountError;
|
|
86
|
+
class AccountConfigurationNotSupportedError extends AccountError {
|
|
87
|
+
constructor(message, account, params) {
|
|
88
|
+
super({
|
|
89
|
+
message: `Account configuration for ${getAccountName(account)} account is not supported: ${message}`,
|
|
90
|
+
...params,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.AccountConfigurationNotSupportedError = AccountConfigurationNotSupportedError;
|
|
95
|
+
class WalletClientNoConnectedAccountError extends AccountError {
|
|
96
|
+
constructor(params) {
|
|
97
|
+
super({
|
|
98
|
+
message: 'WalletClient is missing a default account. Ensure the wallet is connected and the client has an account.',
|
|
99
|
+
...params,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.WalletClientNoConnectedAccountError = WalletClientNoConnectedAccountError;
|
|
95
104
|
function isAccountError(error) {
|
|
96
105
|
return error instanceof AccountError;
|
|
97
106
|
}
|
|
@@ -2,9 +2,14 @@ import { type Chain, type HashTypedDataParameters, type Hex, type PublicClient,
|
|
|
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';
|
|
5
|
-
import { AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError,
|
|
5
|
+
import { AccountConfigurationNotSupportedError, AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from './error';
|
|
6
6
|
import { type ValidatorConfig } from './utils';
|
|
7
7
|
declare function getInitCode(config: RhinestoneAccountConfig): {
|
|
8
|
+
address: import("viem").Address;
|
|
9
|
+
factory: import("viem").Address;
|
|
10
|
+
factoryData: Hex;
|
|
11
|
+
intentExecutorInstalled: boolean;
|
|
12
|
+
} | {
|
|
8
13
|
factory: `0x${string}`;
|
|
9
14
|
factoryData: `0x${string}`;
|
|
10
15
|
} | undefined;
|
|
@@ -16,14 +21,16 @@ declare function getEip7702InitCall(config: RhinestoneAccountConfig, signature:
|
|
|
16
21
|
declare function getModuleInstallationCalls(config: RhinestoneAccountConfig, module: Module): Call[];
|
|
17
22
|
declare function getModuleUninstallationCalls(config: RhinestoneAccountConfig, module: Module): Call[];
|
|
18
23
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
24
|
+
declare function checkAddress(config: RhinestoneAccountConfig): boolean;
|
|
19
25
|
declare function getPackedSignature(config: RhinestoneAccountConfig, signers: SignerSet | undefined, chain: Chain, validator: ValidatorConfig, hash: Hex, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
20
26
|
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
27
|
declare function isDeployed(config: RhinestoneAccountConfig, chain: Chain): Promise<boolean>;
|
|
22
|
-
declare function deploy(config: RhinestoneAccountConfig, chain: Chain, session?: Session): Promise<
|
|
28
|
+
declare function deploy(config: RhinestoneAccountConfig, chain: Chain, session?: Session): Promise<boolean>;
|
|
29
|
+
declare function setup(config: RhinestoneAccountConfig, chain: Chain): Promise<boolean>;
|
|
23
30
|
declare function toErc6492Signature(config: RhinestoneAccountConfig, signature: Hex, chain: Chain): Promise<Hex>;
|
|
24
31
|
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
32
|
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"
|
|
33
|
+
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">>>;
|
|
27
34
|
declare function getAccountProvider(config: RhinestoneAccountConfig): AccountProviderConfig;
|
|
28
|
-
export { getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, getAccountProvider, getInitCode, signEip7702InitData, getEip7702InitCall, isDeployed, deploy, toErc6492Signature, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, getTypedDataPackedSignature, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError,
|
|
35
|
+
export { getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, checkAddress, getAccountProvider, getInitCode, signEip7702InitData, getEip7702InitCall, isDeployed, deploy, setup, toErc6492Signature, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, getTypedDataPackedSignature, isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError, };
|
|
29
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAQb,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAM/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CA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,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,eAAe,EACf,2BAA2B,EAC3B,uBAAuB,EACvB,kBAAkB,EAClB,2BAA2B,EAE3B,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,GACpC,CAAA"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.WalletClientNoConnectedAccountError = exports.SmartSessionsNotEnabledError = exports.SigningNotSupportedForAccountError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702NotSupportedForAccountError = exports.Eip7702AccountMustHaveEoaError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
|
|
4
4
|
exports.getModuleInstallationCalls = getModuleInstallationCalls;
|
|
5
5
|
exports.getModuleUninstallationCalls = getModuleUninstallationCalls;
|
|
6
6
|
exports.getAddress = getAddress;
|
|
7
|
+
exports.checkAddress = checkAddress;
|
|
7
8
|
exports.getAccountProvider = getAccountProvider;
|
|
8
9
|
exports.getInitCode = getInitCode;
|
|
9
10
|
exports.signEip7702InitData = signEip7702InitData;
|
|
10
11
|
exports.getEip7702InitCall = getEip7702InitCall;
|
|
11
12
|
exports.isDeployed = isDeployed;
|
|
12
13
|
exports.deploy = deploy;
|
|
14
|
+
exports.setup = setup;
|
|
13
15
|
exports.toErc6492Signature = toErc6492Signature;
|
|
14
16
|
exports.getSmartAccount = getSmartAccount;
|
|
15
17
|
exports.getSmartSessionSmartAccount = getSmartSessionSmartAccount;
|
|
@@ -19,10 +21,11 @@ exports.getTypedDataPackedSignature = getTypedDataPackedSignature;
|
|
|
19
21
|
const viem_1 = require("viem");
|
|
20
22
|
const execution_1 = require("../execution");
|
|
21
23
|
const smart_session_1 = require("../execution/smart-session");
|
|
24
|
+
const modules_1 = require("../modules");
|
|
22
25
|
const validators_1 = require("../modules/validators");
|
|
23
26
|
const core_1 = require("../modules/validators/core");
|
|
24
|
-
const custom_1 = require("./custom");
|
|
25
27
|
const error_1 = require("./error");
|
|
28
|
+
Object.defineProperty(exports, "AccountConfigurationNotSupportedError", { enumerable: true, get: function () { return error_1.AccountConfigurationNotSupportedError; } });
|
|
26
29
|
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return error_1.AccountError; } });
|
|
27
30
|
Object.defineProperty(exports, "Eip7702AccountMustHaveEoaError", { enumerable: true, get: function () { return error_1.Eip7702AccountMustHaveEoaError; } });
|
|
28
31
|
Object.defineProperty(exports, "Eip7702NotSupportedForAccountError", { enumerable: true, get: function () { return error_1.Eip7702NotSupportedForAccountError; } });
|
|
@@ -30,8 +33,8 @@ Object.defineProperty(exports, "ExistingEip7702AccountsNotSupportedError", { enu
|
|
|
30
33
|
Object.defineProperty(exports, "FactoryArgsNotAvailableError", { enumerable: true, get: function () { return error_1.FactoryArgsNotAvailableError; } });
|
|
31
34
|
Object.defineProperty(exports, "isAccountError", { enumerable: true, get: function () { return error_1.isAccountError; } });
|
|
32
35
|
Object.defineProperty(exports, "SigningNotSupportedForAccountError", { enumerable: true, get: function () { return error_1.SigningNotSupportedForAccountError; } });
|
|
33
|
-
Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumerable: true, get: function () { return error_1.SignMessageNotSupportedByAccountError; } });
|
|
34
36
|
Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return error_1.SmartSessionsNotEnabledError; } });
|
|
37
|
+
Object.defineProperty(exports, "WalletClientNoConnectedAccountError", { enumerable: true, get: function () { return error_1.WalletClientNoConnectedAccountError; } });
|
|
35
38
|
const kernel_1 = require("./kernel");
|
|
36
39
|
const nexus_1 = require("./nexus");
|
|
37
40
|
const safe_1 = require("./safe");
|
|
@@ -55,15 +58,15 @@ function getDeployArgs(config) {
|
|
|
55
58
|
case 'startale': {
|
|
56
59
|
return (0, startale_1.getDeployArgs)(config);
|
|
57
60
|
}
|
|
58
|
-
case 'custom': {
|
|
59
|
-
return (0, custom_1.getDeployArgs)(config);
|
|
60
|
-
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
function getInitCode(config) {
|
|
64
64
|
if (is7702(config)) {
|
|
65
65
|
return undefined;
|
|
66
66
|
}
|
|
67
|
+
else if (config.initData) {
|
|
68
|
+
return config.initData;
|
|
69
|
+
}
|
|
67
70
|
else {
|
|
68
71
|
const { factory, factoryData } = getDeployArgs(config);
|
|
69
72
|
if (!factory || !factoryData) {
|
|
@@ -88,10 +91,7 @@ async function signEip7702InitData(config) {
|
|
|
88
91
|
case 'safe':
|
|
89
92
|
case 'kernel':
|
|
90
93
|
case 'startale': {
|
|
91
|
-
throw new
|
|
92
|
-
}
|
|
93
|
-
case 'custom': {
|
|
94
|
-
throw new Error('7702 is not supported for custom account');
|
|
94
|
+
throw new error_1.Eip7702NotSupportedForAccountError(account.type);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -104,10 +104,7 @@ async function getEip7702InitCall(config, signature) {
|
|
|
104
104
|
case 'safe':
|
|
105
105
|
case 'kernel':
|
|
106
106
|
case 'startale': {
|
|
107
|
-
throw new
|
|
108
|
-
}
|
|
109
|
-
case 'custom': {
|
|
110
|
-
throw new Error('7702 is not supported for custom account');
|
|
107
|
+
throw new error_1.Eip7702NotSupportedForAccountError(account.type);
|
|
111
108
|
}
|
|
112
109
|
}
|
|
113
110
|
}
|
|
@@ -128,9 +125,6 @@ function getModuleInstallationCalls(config, module) {
|
|
|
128
125
|
case 'startale': {
|
|
129
126
|
return [(0, startale_1.getInstallData)(module)];
|
|
130
127
|
}
|
|
131
|
-
case 'custom': {
|
|
132
|
-
return (0, custom_1.getInstallData)(config, module);
|
|
133
|
-
}
|
|
134
128
|
}
|
|
135
129
|
}
|
|
136
130
|
const installData = getInstallData();
|
|
@@ -191,11 +185,14 @@ function getAddress(config) {
|
|
|
191
185
|
case 'startale': {
|
|
192
186
|
return (0, startale_1.getAddress)(config);
|
|
193
187
|
}
|
|
194
|
-
case 'custom': {
|
|
195
|
-
return (0, custom_1.getAddress)(config);
|
|
196
|
-
}
|
|
197
188
|
}
|
|
198
189
|
}
|
|
190
|
+
function checkAddress(config) {
|
|
191
|
+
if (!config.initData) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
return (config.initData.address.toLowerCase() === getAddress(config).toLowerCase());
|
|
195
|
+
}
|
|
199
196
|
// Signs and packs a signature to be EIP-1271 compatible
|
|
200
197
|
async function getPackedSignature(config, signers, chain, validator, hash, transformSignature = (signature) => signature) {
|
|
201
198
|
signers = signers ?? (0, common_1.convertOwnerSetToSignerSet)(config.owners);
|
|
@@ -209,7 +206,8 @@ async function getPackedSignature(config, signers, chain, validator, hash, trans
|
|
|
209
206
|
}
|
|
210
207
|
case 'nexus': {
|
|
211
208
|
const signature = await signFn(hash);
|
|
212
|
-
|
|
209
|
+
const defaultValidatorAddress = (0, nexus_1.getDefaultValidatorAddress)(account.version);
|
|
210
|
+
return (0, nexus_1.packSignature)(signature, validator, transformSignature, defaultValidatorAddress);
|
|
213
211
|
}
|
|
214
212
|
case 'kernel': {
|
|
215
213
|
const signature = await signFn((0, kernel_1.wrapMessageHash)(hash, address));
|
|
@@ -219,10 +217,6 @@ async function getPackedSignature(config, signers, chain, validator, hash, trans
|
|
|
219
217
|
const signature = await signFn(hash);
|
|
220
218
|
return (0, startale_1.packSignature)(signature, validator, transformSignature);
|
|
221
219
|
}
|
|
222
|
-
case 'custom': {
|
|
223
|
-
const signature = await signFn(hash);
|
|
224
|
-
return (0, custom_1.getPackedSignature)(config, signature, validator, transformSignature);
|
|
225
|
-
}
|
|
226
220
|
}
|
|
227
221
|
}
|
|
228
222
|
// Signs and packs a signature to be EIP-1271 compatible
|
|
@@ -236,13 +230,10 @@ async function getTypedDataPackedSignature(config, signers, chain, validator, pa
|
|
|
236
230
|
const signature = await signFn(parameters);
|
|
237
231
|
return (0, safe_1.packSignature)(signature, validator, transformSignature);
|
|
238
232
|
}
|
|
239
|
-
case 'custom': {
|
|
240
|
-
const signature = await signFn(parameters);
|
|
241
|
-
return (0, custom_1.getPackedSignature)(config, signature, validator, transformSignature);
|
|
242
|
-
}
|
|
243
233
|
case 'nexus': {
|
|
244
234
|
const signature = await signFn(parameters);
|
|
245
|
-
|
|
235
|
+
const defaultValidatorAddress = (0, nexus_1.getDefaultValidatorAddress)(account.version);
|
|
236
|
+
return (0, nexus_1.packSignature)(signature, validator, transformSignature, defaultValidatorAddress);
|
|
246
237
|
}
|
|
247
238
|
case 'kernel': {
|
|
248
239
|
const address = getAddress(config);
|
|
@@ -275,10 +266,77 @@ async function isDeployed(config, chain) {
|
|
|
275
266
|
return (0, viem_1.size)(code) > 0;
|
|
276
267
|
}
|
|
277
268
|
async function deploy(config, chain, session) {
|
|
278
|
-
await
|
|
269
|
+
const deployed = await isDeployed(config, chain);
|
|
270
|
+
if (deployed) {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
const asUserOp = config.initData && !config.initData.intentExecutorInstalled;
|
|
274
|
+
if (asUserOp) {
|
|
275
|
+
await deployWithBundler(chain, config);
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
await deployWithIntent(chain, config);
|
|
279
|
+
}
|
|
279
280
|
if (session) {
|
|
280
281
|
await (0, smart_session_1.enableSmartSession)(chain, config, session);
|
|
281
282
|
}
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
// Installs the missing modules
|
|
286
|
+
// Checks if the provided modules are already installed
|
|
287
|
+
// Useful for existing (already deployed) accounts
|
|
288
|
+
async function setup(config, chain) {
|
|
289
|
+
const modules = (0, modules_1.getSetup)(config);
|
|
290
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
291
|
+
chain,
|
|
292
|
+
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
293
|
+
});
|
|
294
|
+
const address = getAddress(config);
|
|
295
|
+
const allModules = [
|
|
296
|
+
...modules.validators,
|
|
297
|
+
...modules.executors,
|
|
298
|
+
...modules.fallbacks,
|
|
299
|
+
...modules.hooks,
|
|
300
|
+
];
|
|
301
|
+
// Check if the modules are already installed
|
|
302
|
+
const installedResults = await publicClient.multicall({
|
|
303
|
+
contracts: allModules.map((module) => ({
|
|
304
|
+
address: address,
|
|
305
|
+
abi: [
|
|
306
|
+
{
|
|
307
|
+
type: 'function',
|
|
308
|
+
name: 'isModuleInstalled',
|
|
309
|
+
inputs: [
|
|
310
|
+
{ type: 'uint256', name: 'moduleTypeId' },
|
|
311
|
+
{ type: 'address', name: 'module' },
|
|
312
|
+
{ type: 'bytes', name: 'additionalContext' },
|
|
313
|
+
],
|
|
314
|
+
outputs: [{ type: 'bool', name: 'isInstalled' }],
|
|
315
|
+
stateMutability: 'view',
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
functionName: 'isModuleInstalled',
|
|
319
|
+
args: [module.type, module.address, module.additionalContext],
|
|
320
|
+
})),
|
|
321
|
+
});
|
|
322
|
+
const isInstalled = installedResults.map((result) => result.result);
|
|
323
|
+
const modulesToInstall = allModules.filter((_, index) => !isInstalled[index]);
|
|
324
|
+
if (modulesToInstall.length === 0) {
|
|
325
|
+
// Nothing to install
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
const calls = [];
|
|
329
|
+
for (const module of modulesToInstall) {
|
|
330
|
+
calls.push(...getModuleInstallationCalls(config, module));
|
|
331
|
+
}
|
|
332
|
+
// Select the transaction infra layer based on the intent executor status
|
|
333
|
+
const intentExecutor = (0, modules_1.getIntentExecutor)(config);
|
|
334
|
+
const hasIntentExecutor = modulesToInstall.every((module) => module.address !== intentExecutor.address);
|
|
335
|
+
const result = await (0, execution_1.sendTransactionInternal)(config, [chain], chain, calls, {
|
|
336
|
+
asUserOp: !hasIntentExecutor,
|
|
337
|
+
});
|
|
338
|
+
await (0, execution_1.waitForExecution)(config, result, true);
|
|
339
|
+
return true;
|
|
282
340
|
}
|
|
283
341
|
async function deployWithIntent(chain, config) {
|
|
284
342
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
@@ -302,6 +360,30 @@ async function deployWithIntent(chain, config) {
|
|
|
302
360
|
});
|
|
303
361
|
await (0, execution_1.waitForExecution)(config, result, true);
|
|
304
362
|
}
|
|
363
|
+
async function deployWithBundler(chain, config) {
|
|
364
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
365
|
+
chain,
|
|
366
|
+
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
367
|
+
});
|
|
368
|
+
const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
|
|
369
|
+
const smartAccount = await getSmartAccount(config, publicClient, chain);
|
|
370
|
+
const { factory, factoryData } = getDeployArgs(config);
|
|
371
|
+
const opHash = await bundlerClient.sendUserOperation({
|
|
372
|
+
account: smartAccount,
|
|
373
|
+
factory,
|
|
374
|
+
factoryData,
|
|
375
|
+
calls: [
|
|
376
|
+
{
|
|
377
|
+
to: viem_1.zeroAddress,
|
|
378
|
+
value: 0n,
|
|
379
|
+
data: '0x',
|
|
380
|
+
},
|
|
381
|
+
],
|
|
382
|
+
});
|
|
383
|
+
await bundlerClient.waitForUserOperationReceipt({
|
|
384
|
+
hash: opHash,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
305
387
|
async function toErc6492Signature(config, signature, chain) {
|
|
306
388
|
const deployed = await isDeployed(config, chain);
|
|
307
389
|
if (deployed) {
|
|
@@ -334,7 +416,8 @@ async function getSmartAccount(config, client, chain) {
|
|
|
334
416
|
return (0, safe_1.getSmartAccount)(client, address, config.owners, ownerValidator.address, signFn);
|
|
335
417
|
}
|
|
336
418
|
case 'nexus': {
|
|
337
|
-
|
|
419
|
+
const defaultValidatorAddress = (0, nexus_1.getDefaultValidatorAddress)(account.version);
|
|
420
|
+
return (0, nexus_1.getSmartAccount)(client, address, config.owners, ownerValidator.address, signFn, defaultValidatorAddress);
|
|
338
421
|
}
|
|
339
422
|
case 'kernel': {
|
|
340
423
|
return (0, kernel_1.getSmartAccount)(client, address, config.owners, ownerValidator.address, signFn);
|
|
@@ -342,9 +425,6 @@ async function getSmartAccount(config, client, chain) {
|
|
|
342
425
|
case 'startale': {
|
|
343
426
|
return (0, startale_1.getSmartAccount)(client, address, config.owners, ownerValidator.address, signFn);
|
|
344
427
|
}
|
|
345
|
-
case 'custom': {
|
|
346
|
-
return (0, custom_1.getSmartAccount)(config, client, address, ownerValidator.address, signFn);
|
|
347
|
-
}
|
|
348
428
|
}
|
|
349
429
|
}
|
|
350
430
|
async function getSmartSessionSmartAccount(config, client, chain, session, enableData) {
|
|
@@ -365,7 +445,8 @@ async function getSmartSessionSmartAccount(config, client, chain, session, enabl
|
|
|
365
445
|
return (0, safe_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
|
|
366
446
|
}
|
|
367
447
|
case 'nexus': {
|
|
368
|
-
|
|
448
|
+
const defaultValidatorAddress = (0, nexus_1.getDefaultValidatorAddress)(account.version);
|
|
449
|
+
return (0, nexus_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn, defaultValidatorAddress);
|
|
369
450
|
}
|
|
370
451
|
case 'kernel': {
|
|
371
452
|
return (0, kernel_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
|
|
@@ -373,9 +454,6 @@ async function getSmartSessionSmartAccount(config, client, chain, session, enabl
|
|
|
373
454
|
case 'startale': {
|
|
374
455
|
return (0, startale_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
|
|
375
456
|
}
|
|
376
|
-
case 'custom': {
|
|
377
|
-
return (0, custom_1.getSessionSmartAccount)(config, client, address, session, smartSessionValidator.address, enableData);
|
|
378
|
-
}
|
|
379
457
|
}
|
|
380
458
|
}
|
|
381
459
|
async function getGuardianSmartAccount(config, client, chain, guardians) {
|
|
@@ -396,7 +474,8 @@ async function getGuardianSmartAccount(config, client, chain, guardians) {
|
|
|
396
474
|
return (0, safe_1.getGuardianSmartAccount)(client, address, guardians, socialRecoveryValidator.address, signFn);
|
|
397
475
|
}
|
|
398
476
|
case 'nexus': {
|
|
399
|
-
|
|
477
|
+
const defaultValidatorAddress = (0, nexus_1.getDefaultValidatorAddress)(account.version);
|
|
478
|
+
return (0, nexus_1.getGuardianSmartAccount)(client, address, guardians, socialRecoveryValidator.address, signFn, defaultValidatorAddress);
|
|
400
479
|
}
|
|
401
480
|
case 'kernel': {
|
|
402
481
|
return (0, kernel_1.getGuardianSmartAccount)(client, address, guardians, socialRecoveryValidator.address, signFn);
|
|
@@ -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('0x0681de31e060b384F0b08A3bAC99E9bDFf302474');
|
|
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('0x894b88C04B4DE6AbDdcE81E8bdc91927E37d6ceD');
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
(0, vitest_1.describe)('Sign', () => {
|
|
@@ -7,9 +7,9 @@ import { type ValidatorConfig } from './utils';
|
|
|
7
7
|
declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
8
8
|
factory: `0x${string}`;
|
|
9
9
|
factoryData: `0x${string}`;
|
|
10
|
-
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
11
10
|
implementation: `0x${string}`;
|
|
12
11
|
initializationCallData: `0x${string}`;
|
|
12
|
+
salt: `0x${string}`;
|
|
13
13
|
};
|
|
14
14
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
15
15
|
declare function getInstallData(module: Module): Hex[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../accounts/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../accounts/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EASZ,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,UAAU,CAAA;AAE1E,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAgBhF,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;EA+ErD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBASlD;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,CAsE7C;AAED,iBAAe,aAAa,CAC1B,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,eAAe,EAC1B,kBAAkB,GAAE,CAAC,SAAS,EAAE,GAAG,KAAK,GAA8B,0BAYvE;AAED,iBAAS,eAAe,CAAC,WAAW,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,GAAG,GAAG,CAoBnE;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,YAAY,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"}
|
|
@@ -13,13 +13,41 @@ const account_abstraction_1 = require("viem/account-abstraction");
|
|
|
13
13
|
const modules_1 = require("../modules");
|
|
14
14
|
const common_1 = require("../modules/common");
|
|
15
15
|
const validators_1 = require("../modules/validators");
|
|
16
|
+
const error_1 = require("./error");
|
|
16
17
|
const utils_1 = require("./utils");
|
|
17
18
|
const KERNEL_META_FACTORY_ADDRESS = '0xd703aae79538628d27099b8c4f621be4ccd142d5';
|
|
18
19
|
const KERNEL_IMPLEMENTATION_ADDRESS = '0xd6CEDDe84be40893d153Be9d467CD6aD37875b28';
|
|
19
|
-
const KERNEL_FACTORY_ADDRESS = '
|
|
20
|
+
const KERNEL_FACTORY_ADDRESS = '0x2577507b78c2008Ff367261CB6285d44ba5eF2E9';
|
|
20
21
|
const KERNEL_BYTECODE = '0x603d3d8160223d3973d6cedde84be40893d153be9d467cd6ad37875b2860095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3';
|
|
21
22
|
const KERNEL_VERSION = '0.3.3';
|
|
22
23
|
function getDeployArgs(config) {
|
|
24
|
+
if (config.initData) {
|
|
25
|
+
const factoryData = (0, viem_1.decodeFunctionData)({
|
|
26
|
+
abi: (0, viem_1.parseAbi)([
|
|
27
|
+
'function deployWithFactory(address factory,bytes createData,bytes32 salt)',
|
|
28
|
+
]),
|
|
29
|
+
data: config.initData.factoryData,
|
|
30
|
+
});
|
|
31
|
+
if (factoryData.functionName !== 'deployWithFactory') {
|
|
32
|
+
throw new error_1.AccountConfigurationNotSupportedError('Invalid factory data', 'kernel');
|
|
33
|
+
}
|
|
34
|
+
const factory = factoryData.args[0];
|
|
35
|
+
const createData = factoryData.args[1];
|
|
36
|
+
const salt = factoryData.args[2];
|
|
37
|
+
const implementation = factory === KERNEL_FACTORY_ADDRESS
|
|
38
|
+
? KERNEL_IMPLEMENTATION_ADDRESS
|
|
39
|
+
: viem_1.zeroAddress;
|
|
40
|
+
if (implementation === viem_1.zeroAddress) {
|
|
41
|
+
throw new error_1.AccountConfigurationNotSupportedError('Unsupported Kernel implementation', 'kernel');
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
factory: config.initData.factory,
|
|
45
|
+
factoryData: config.initData.factoryData,
|
|
46
|
+
implementation,
|
|
47
|
+
initializationCallData: createData,
|
|
48
|
+
salt,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
23
51
|
const salt = viem_1.zeroHash;
|
|
24
52
|
const moduleSetup = (0, modules_1.getSetup)(config);
|
|
25
53
|
const rootValidator = (0, viem_1.concat)(['0x01', moduleSetup.validators[0].address]);
|