@rhinestone/sdk 1.0.0-alpha.1 → 1.0.0-alpha.11
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.map +1 -1
- package/dist/src/accounts/error.js +2 -0
- package/dist/src/accounts/index.d.ts +15 -8
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +204 -164
- package/dist/src/accounts/index.test.js +2 -2
- package/dist/src/accounts/kernel.d.ts +7 -9
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +0 -9
- package/dist/src/accounts/kernel.test.js +6 -6
- package/dist/src/accounts/nexus.d.ts +14 -13
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +91 -88
- package/dist/src/accounts/nexus.test.js +10 -10
- package/dist/src/accounts/safe.d.ts +4 -6
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +20 -30
- package/dist/src/accounts/safe.test.js +6 -6
- package/dist/src/accounts/startale.d.ts +20 -0
- package/dist/src/accounts/startale.d.ts.map +1 -0
- package/dist/src/accounts/startale.js +100 -0
- package/dist/src/accounts/startale.test.d.ts +2 -0
- package/dist/src/accounts/startale.test.d.ts.map +1 -0
- package/dist/src/accounts/startale.test.js +97 -0
- package/dist/src/accounts/utils.d.ts +4 -3
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +44 -0
- package/dist/src/actions/index.d.ts +17 -7
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +108 -15
- package/dist/src/actions/index.test.js +35 -17
- package/dist/src/actions/smart-session.d.ts +2 -2
- package/dist/src/actions/smart-session.d.ts.map +1 -1
- package/dist/src/execution/compact.d.ts +6 -3
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +44 -1
- package/dist/src/execution/error.d.ts +2 -9
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +4 -13
- package/dist/src/execution/index.d.ts +2 -3
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +34 -49
- package/dist/src/execution/smart-session.d.ts +1 -1
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +12 -17
- package/dist/src/execution/utils.d.ts +13 -11
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +150 -84
- package/dist/src/index.d.ts +14 -14
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +24 -20
- package/dist/src/modules/index.d.ts +3 -7
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +1 -10
- package/dist/src/modules/index.test.js +2 -2
- package/dist/src/modules/omni-account.d.ts +1 -4
- package/dist/src/modules/omni-account.d.ts.map +1 -1
- package/dist/src/modules/omni-account.js +2 -8
- package/dist/src/modules/read.d.ts +5 -6
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +6 -37
- package/dist/src/modules/validators/core.d.ts +6 -7
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +83 -8
- package/dist/src/modules/validators/core.test.js +4 -4
- package/dist/src/modules/validators/smart-sessions.d.ts +3 -3
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +7 -6
- package/dist/src/modules/validators/smart-sessions.test.js +4 -4
- package/dist/src/orchestrator/client.d.ts +1 -0
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +136 -94
- package/dist/src/orchestrator/consts.d.ts +3 -3
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +4 -4
- package/dist/src/orchestrator/index.d.ts +2 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -7
- package/dist/src/orchestrator/registry.d.ts +31 -12
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +57 -380
- package/dist/src/orchestrator/registry.json +365 -0
- package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
- package/dist/src/orchestrator/registry.test.js +137 -0
- package/dist/src/orchestrator/types.d.ts +81 -14
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.js +2 -2
- package/dist/src/types.d.ts +42 -21
- package/dist/src/types.d.ts.map +1 -1
- package/dist/test/consts.d.ts +2 -2
- package/dist/test/consts.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src/actions/registry.d.ts +0 -7
- package/dist/src/actions/registry.d.ts.map +0 -1
- package/dist/src/actions/registry.js +0 -7
- package/dist/src/actions/registry.test.d.ts.map +0 -1
- package/dist/src/actions/registry.test.js +0 -25
- package/dist/src/modules/registry.d.ts +0 -13
- package/dist/src/modules/registry.d.ts.map +0 -1
- package/dist/src/modules/registry.js +0 -67
- /package/dist/src/{actions → orchestrator}/registry.test.d.ts +0 -0
|
@@ -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,CAAC,EAAE,MAAM,CAAA;KACjB;I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C,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,4BAA6B,SAAQ,YAAY;gBACzC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,kCAAmC,SAAQ,YAAY;gBAC/C,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,qCAAsC,SAAQ,YAAY;gBAClD,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,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,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,qCAAqC,EACrC,kCAAkC,GACnC,CAAA"}
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { type Chain, type Hex, type PublicClient } from 'viem';
|
|
2
|
-
import { Module } from '../modules/common';
|
|
3
|
-
import { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
4
|
-
import type { AccountProviderConfig, Call, OwnerSet, RhinestoneAccountConfig, Session } from '../types';
|
|
2
|
+
import type { Module } from '../modules/common';
|
|
3
|
+
import type { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
4
|
+
import type { AccountProviderConfig, Call, OwnerSet, RhinestoneAccountConfig, Session, SignerSet } from '../types';
|
|
5
5
|
import { AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, SmartSessionsNotEnabledError } from './error';
|
|
6
|
-
import { ValidatorConfig } from './utils';
|
|
6
|
+
import { type ValidatorConfig } from './utils';
|
|
7
|
+
declare function getInitCode(config: RhinestoneAccountConfig): {
|
|
8
|
+
factory: `0x${string}`;
|
|
9
|
+
factoryData: `0x${string}`;
|
|
10
|
+
} | undefined;
|
|
11
|
+
declare function signEip7702InitData(config: RhinestoneAccountConfig): Promise<`0x${string}`>;
|
|
12
|
+
declare function getEip7702InitCall(config: RhinestoneAccountConfig, signature: Hex): Promise<{
|
|
13
|
+
initData: `0x${string}`;
|
|
14
|
+
contract: `0x${string}`;
|
|
15
|
+
}>;
|
|
7
16
|
declare function getModuleInstallationCalls(config: RhinestoneAccountConfig, module: Module): Call[];
|
|
8
17
|
declare function getModuleUninstallationCalls(config: RhinestoneAccountConfig, module: Module): Call[];
|
|
9
18
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
10
|
-
declare function getPackedSignature(config: RhinestoneAccountConfig,
|
|
19
|
+
declare function getPackedSignature(config: RhinestoneAccountConfig, signers: SignerSet | undefined, chain: Chain, validator: ValidatorConfig, hash: Hex, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
11
20
|
declare function isDeployed(chain: Chain, config: RhinestoneAccountConfig): Promise<boolean>;
|
|
12
21
|
declare function deploy(config: RhinestoneAccountConfig, chain: Chain, session?: Session): Promise<void>;
|
|
13
|
-
declare function deploySource(chain: Chain, config: RhinestoneAccountConfig): Promise<void>;
|
|
14
|
-
declare function deployTarget(chain: Chain, config: RhinestoneAccountConfig, asUserOp: boolean): Promise<void>;
|
|
15
22
|
declare function getSmartAccount(config: RhinestoneAccountConfig, client: PublicClient, chain: Chain): Promise<import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
16
23
|
declare function getSmartSessionSmartAccount(config: RhinestoneAccountConfig, client: PublicClient, chain: Chain, session: Session, enableData: EnableSessionData | null): Promise<import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
17
24
|
declare function getGuardianSmartAccount(config: RhinestoneAccountConfig, client: PublicClient, chain: Chain, guardians: OwnerSet): Promise<import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
18
25
|
declare function getAccountProvider(config: RhinestoneAccountConfig): AccountProviderConfig;
|
|
19
|
-
export { getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, getAccountProvider,
|
|
26
|
+
export { getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, getAccountProvider, getInitCode, signEip7702InitData, getEip7702InitCall, isDeployed, deploy, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, };
|
|
20
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,EAKV,KAAK,GAAG,
|
|
1
|
+
{"version":3,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S,EAAE,GAAG,KAAK,GAA8B,0BAoCvE;AAED,iBAAe,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,uBAAuB,oBAiBtE;AAED,iBAAe,MAAM,CACnB,MAAM,EAAE,uBAAuB,EAC/B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,OAAO,iBAMlB;AAwBD,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,sJA6Cb;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,sJAyDrC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,QAAQ,sJAqDpB;AAoGD,iBAAS,kBAAkB,CACzB,MAAM,EAAE,uBAAuB,GAC9B,qBAAqB,CAOvB;AA6CD,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,eAAe,EACf,2BAA2B,EAC3B,uBAAuB,EACvB,kBAAkB,EAElB,cAAc,EACd,YAAY,EACZ,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,GACnC,CAAA"}
|
|
@@ -5,15 +5,17 @@ exports.getModuleInstallationCalls = getModuleInstallationCalls;
|
|
|
5
5
|
exports.getModuleUninstallationCalls = getModuleUninstallationCalls;
|
|
6
6
|
exports.getAddress = getAddress;
|
|
7
7
|
exports.getAccountProvider = getAccountProvider;
|
|
8
|
+
exports.getInitCode = getInitCode;
|
|
9
|
+
exports.signEip7702InitData = signEip7702InitData;
|
|
10
|
+
exports.getEip7702InitCall = getEip7702InitCall;
|
|
8
11
|
exports.isDeployed = isDeployed;
|
|
9
12
|
exports.deploy = deploy;
|
|
10
|
-
exports.deploySource = deploySource;
|
|
11
|
-
exports.deployTarget = deployTarget;
|
|
12
13
|
exports.getSmartAccount = getSmartAccount;
|
|
13
14
|
exports.getSmartSessionSmartAccount = getSmartSessionSmartAccount;
|
|
14
15
|
exports.getGuardianSmartAccount = getGuardianSmartAccount;
|
|
15
16
|
exports.getPackedSignature = getPackedSignature;
|
|
16
17
|
const viem_1 = require("viem");
|
|
18
|
+
const execution_1 = require("../execution");
|
|
17
19
|
const smart_session_1 = require("../execution/smart-session");
|
|
18
20
|
const modules_1 = require("../modules");
|
|
19
21
|
const validators_1 = require("../modules/validators");
|
|
@@ -31,6 +33,7 @@ Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: tru
|
|
|
31
33
|
const kernel_1 = require("./kernel");
|
|
32
34
|
const nexus_1 = require("./nexus");
|
|
33
35
|
const safe_1 = require("./safe");
|
|
36
|
+
const startale_1 = require("./startale");
|
|
34
37
|
const utils_1 = require("./utils");
|
|
35
38
|
function getDeployArgs(config) {
|
|
36
39
|
const account = getAccountProvider(config);
|
|
@@ -44,6 +47,54 @@ function getDeployArgs(config) {
|
|
|
44
47
|
case 'kernel': {
|
|
45
48
|
return (0, kernel_1.getDeployArgs)(config);
|
|
46
49
|
}
|
|
50
|
+
case 'startale': {
|
|
51
|
+
return (0, startale_1.getDeployArgs)(config);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function getInitCode(config) {
|
|
56
|
+
if (is7702(config)) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const { factory, factoryData } = getDeployArgs(config);
|
|
61
|
+
if (!factory || !factoryData) {
|
|
62
|
+
throw new error_1.FactoryArgsNotAvailableError();
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
factory,
|
|
66
|
+
factoryData,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function signEip7702InitData(config) {
|
|
71
|
+
const eoa = config.eoa;
|
|
72
|
+
if (!eoa) {
|
|
73
|
+
throw new error_1.Eip7702AccountMustHaveEoaError();
|
|
74
|
+
}
|
|
75
|
+
const account = getAccountProvider(config);
|
|
76
|
+
switch (account.type) {
|
|
77
|
+
case 'nexus': {
|
|
78
|
+
return await (0, nexus_1.signEip7702InitData)(config, eoa);
|
|
79
|
+
}
|
|
80
|
+
case 'safe':
|
|
81
|
+
case 'kernel':
|
|
82
|
+
case 'startale': {
|
|
83
|
+
throw new Error(`7702 is not supported for account type ${account.type}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async function getEip7702InitCall(config, signature) {
|
|
88
|
+
const account = getAccountProvider(config);
|
|
89
|
+
switch (account.type) {
|
|
90
|
+
case 'nexus': {
|
|
91
|
+
return await (0, nexus_1.getEip7702InitCall)(config, signature);
|
|
92
|
+
}
|
|
93
|
+
case 'safe':
|
|
94
|
+
case 'kernel':
|
|
95
|
+
case 'startale': {
|
|
96
|
+
throw new Error(`7702 is not supported for account type ${account.type}`);
|
|
97
|
+
}
|
|
47
98
|
}
|
|
48
99
|
}
|
|
49
100
|
function getModuleInstallationCalls(config, module) {
|
|
@@ -60,11 +111,15 @@ function getModuleInstallationCalls(config, module) {
|
|
|
60
111
|
case 'kernel': {
|
|
61
112
|
return (0, kernel_1.getInstallData)(module);
|
|
62
113
|
}
|
|
114
|
+
case 'startale': {
|
|
115
|
+
return [(0, startale_1.getInstallData)(module)];
|
|
116
|
+
}
|
|
63
117
|
}
|
|
64
118
|
}
|
|
65
119
|
const installData = getInstallData();
|
|
66
120
|
return installData.map((data) => ({
|
|
67
121
|
to: address,
|
|
122
|
+
value: 0n,
|
|
68
123
|
data,
|
|
69
124
|
}));
|
|
70
125
|
}
|
|
@@ -96,7 +151,7 @@ function getModuleUninstallationCalls(config, module) {
|
|
|
96
151
|
functionName: 'uninstallModule',
|
|
97
152
|
args: [module.type, module.address, module.deInitData],
|
|
98
153
|
});
|
|
99
|
-
return [{ to: address, data }];
|
|
154
|
+
return [{ to: address, data, value: 0n }];
|
|
100
155
|
}
|
|
101
156
|
function getAddress(config) {
|
|
102
157
|
if (is7702(config)) {
|
|
@@ -116,11 +171,15 @@ function getAddress(config) {
|
|
|
116
171
|
case 'kernel': {
|
|
117
172
|
return (0, kernel_1.getAddress)(config);
|
|
118
173
|
}
|
|
174
|
+
case 'startale': {
|
|
175
|
+
return (0, startale_1.getAddress)(config);
|
|
176
|
+
}
|
|
119
177
|
}
|
|
120
178
|
}
|
|
121
|
-
// Signs and packs a signature to be EIP-1271
|
|
122
|
-
async function getPackedSignature(config,
|
|
123
|
-
|
|
179
|
+
// Signs and packs a signature to be EIP-1271 compatible
|
|
180
|
+
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);
|
|
124
183
|
const account = getAccountProvider(config);
|
|
125
184
|
const address = getAddress(config);
|
|
126
185
|
switch (account.type) {
|
|
@@ -133,12 +192,15 @@ async function getPackedSignature(config, owners, chain, validator, hash, transf
|
|
|
133
192
|
case 'kernel': {
|
|
134
193
|
return (0, kernel_1.getPackedSignature)(signFn, hash, validator, address, transformSignature);
|
|
135
194
|
}
|
|
195
|
+
case 'startale': {
|
|
196
|
+
return (0, startale_1.getPackedSignature)(signFn, hash, validator, transformSignature);
|
|
197
|
+
}
|
|
136
198
|
}
|
|
137
199
|
}
|
|
138
200
|
async function isDeployed(chain, config) {
|
|
139
201
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
140
202
|
chain: chain,
|
|
141
|
-
transport: (0,
|
|
203
|
+
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
142
204
|
});
|
|
143
205
|
const address = getAddress(config);
|
|
144
206
|
const code = await publicClient.getCode({
|
|
@@ -154,141 +216,38 @@ async function isDeployed(chain, config) {
|
|
|
154
216
|
return (0, viem_1.size)(code) > 0;
|
|
155
217
|
}
|
|
156
218
|
async function deploy(config, chain, session) {
|
|
157
|
-
await
|
|
219
|
+
await deployWithIntent(chain, config);
|
|
158
220
|
if (session) {
|
|
159
221
|
await (0, smart_session_1.enableSmartSession)(chain, config, session);
|
|
160
222
|
}
|
|
161
223
|
}
|
|
162
|
-
async function
|
|
163
|
-
if (is7702(config)) {
|
|
164
|
-
return deploy7702Self(chain, config);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
return deployStandalone(chain, config);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
async function deployTarget(chain, config, asUserOp) {
|
|
171
|
-
if (is7702(config)) {
|
|
172
|
-
return deploy7702WithBundler(chain, config);
|
|
173
|
-
}
|
|
174
|
-
if (asUserOp) {
|
|
175
|
-
return deployStandalone(chain, config);
|
|
176
|
-
}
|
|
177
|
-
// No need to deploy manually for the intent flow
|
|
178
|
-
}
|
|
179
|
-
async function deployStandalone(chain, config) {
|
|
180
|
-
const deployer = config.deployerAccount;
|
|
181
|
-
if (deployer) {
|
|
182
|
-
return deployStandaloneWithEoa(chain, config, deployer);
|
|
183
|
-
}
|
|
184
|
-
return deployStandaloneWithBundler(chain, config);
|
|
185
|
-
}
|
|
186
|
-
async function deploy7702Self(chain, config) {
|
|
187
|
-
if (!config.eoa) {
|
|
188
|
-
throw new error_1.Eip7702AccountMustHaveEoaError();
|
|
189
|
-
}
|
|
190
|
-
const account = getAccountProvider(config);
|
|
191
|
-
const { implementation, initializationCallData } = getDeployArgs(config);
|
|
192
|
-
if (!initializationCallData) {
|
|
193
|
-
throw new Error(`Initialization call data not available for ${account.type}`);
|
|
194
|
-
}
|
|
224
|
+
async function deployWithIntent(chain, config) {
|
|
195
225
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
196
226
|
chain,
|
|
197
|
-
transport: (0,
|
|
198
|
-
});
|
|
199
|
-
const accountClient = (0, viem_1.createWalletClient)({
|
|
200
|
-
account: config.eoa,
|
|
201
|
-
chain,
|
|
202
|
-
transport: (0, viem_1.http)(),
|
|
203
|
-
});
|
|
204
|
-
const authorization = await accountClient.signAuthorization({
|
|
205
|
-
contractAddress: implementation,
|
|
206
|
-
executor: 'self',
|
|
207
|
-
});
|
|
208
|
-
const hash = await accountClient.sendTransaction({
|
|
209
|
-
chain,
|
|
210
|
-
authorizationList: [authorization],
|
|
211
|
-
to: config.eoa.address,
|
|
212
|
-
data: initializationCallData,
|
|
213
|
-
});
|
|
214
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
215
|
-
}
|
|
216
|
-
async function deployStandaloneWithEoa(chain, config, deployer) {
|
|
217
|
-
const { factory, factoryData } = getDeployArgs(config);
|
|
218
|
-
const publicClient = (0, viem_1.createPublicClient)({
|
|
219
|
-
chain: chain,
|
|
220
|
-
transport: (0, viem_1.http)(),
|
|
221
|
-
});
|
|
222
|
-
const client = (0, viem_1.createWalletClient)({
|
|
223
|
-
account: deployer,
|
|
224
|
-
chain: chain,
|
|
225
|
-
transport: (0, viem_1.http)(),
|
|
226
|
-
});
|
|
227
|
-
const tx = await client.sendTransaction({
|
|
228
|
-
to: factory,
|
|
229
|
-
data: factoryData,
|
|
227
|
+
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
230
228
|
});
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
const smartAccount = await getSmartAccount(config, publicClient, chain);
|
|
240
|
-
const { factory, factoryData } = getDeployArgs(config);
|
|
241
|
-
const opHash = await bundlerClient.sendUserOperation({
|
|
242
|
-
account: smartAccount,
|
|
243
|
-
factory,
|
|
244
|
-
factoryData,
|
|
229
|
+
const address = getAddress(config);
|
|
230
|
+
const code = await publicClient.getCode({ address });
|
|
231
|
+
if (code) {
|
|
232
|
+
// Already deployed
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
await (0, execution_1.sendTransaction)(config, {
|
|
236
|
+
targetChain: chain,
|
|
245
237
|
calls: [
|
|
246
238
|
{
|
|
247
|
-
to: viem_1.
|
|
248
|
-
value: 0n,
|
|
239
|
+
to: viem_1.zeroAddress,
|
|
249
240
|
data: '0x',
|
|
250
241
|
},
|
|
251
242
|
],
|
|
252
243
|
});
|
|
253
|
-
await bundlerClient.waitForUserOperationReceipt({
|
|
254
|
-
hash: opHash,
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
async function deploy7702WithBundler(chain, config) {
|
|
258
|
-
if (!config.eoa) {
|
|
259
|
-
throw new error_1.Eip7702AccountMustHaveEoaError();
|
|
260
|
-
}
|
|
261
|
-
const { implementation } = getDeployArgs(config);
|
|
262
|
-
const publicClient = (0, viem_1.createPublicClient)({
|
|
263
|
-
chain,
|
|
264
|
-
transport: (0, viem_1.http)(),
|
|
265
|
-
});
|
|
266
|
-
const accountClient = (0, viem_1.createWalletClient)({
|
|
267
|
-
account: config.eoa,
|
|
268
|
-
chain,
|
|
269
|
-
transport: (0, viem_1.http)(),
|
|
270
|
-
});
|
|
271
|
-
const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
|
|
272
|
-
const authorization = await accountClient.signAuthorization({
|
|
273
|
-
contractAddress: implementation,
|
|
274
|
-
});
|
|
275
|
-
// Init the account
|
|
276
|
-
const smartAccount = await get7702SmartAccount(config, publicClient);
|
|
277
|
-
const initCalls = await get7702InitCalls(config);
|
|
278
|
-
const opHash = await bundlerClient.sendUserOperation({
|
|
279
|
-
account: smartAccount,
|
|
280
|
-
calls: initCalls,
|
|
281
|
-
authorization,
|
|
282
|
-
});
|
|
283
|
-
await bundlerClient.waitForUserOperationReceipt({
|
|
284
|
-
hash: opHash,
|
|
285
|
-
});
|
|
286
244
|
}
|
|
287
245
|
async function getSmartAccount(config, client, chain) {
|
|
288
246
|
const account = getAccountProvider(config);
|
|
289
247
|
const address = getAddress(config);
|
|
290
248
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
291
|
-
const
|
|
249
|
+
const signers = convertOwnerSetToSignerSet(config.owners);
|
|
250
|
+
const signFn = (hash) => sign(signers, chain, hash);
|
|
292
251
|
switch (account.type) {
|
|
293
252
|
case 'safe': {
|
|
294
253
|
return (0, safe_1.getSmartAccount)(client, address, config.owners, ownerValidator.address, signFn);
|
|
@@ -299,6 +258,9 @@ async function getSmartAccount(config, client, chain) {
|
|
|
299
258
|
case 'kernel': {
|
|
300
259
|
return (0, kernel_1.getSmartAccount)(client, address, config.owners, ownerValidator.address, signFn);
|
|
301
260
|
}
|
|
261
|
+
case 'startale': {
|
|
262
|
+
return (0, startale_1.getSmartAccount)(client, address, config.owners, ownerValidator.address, signFn);
|
|
263
|
+
}
|
|
302
264
|
}
|
|
303
265
|
}
|
|
304
266
|
async function getSmartSessionSmartAccount(config, client, chain, session, enableData) {
|
|
@@ -307,7 +269,12 @@ async function getSmartSessionSmartAccount(config, client, chain, session, enabl
|
|
|
307
269
|
if (!smartSessionValidator) {
|
|
308
270
|
throw new error_1.SmartSessionsNotEnabledError();
|
|
309
271
|
}
|
|
310
|
-
const
|
|
272
|
+
const signers = {
|
|
273
|
+
type: 'session',
|
|
274
|
+
session,
|
|
275
|
+
enableData: enableData || undefined,
|
|
276
|
+
};
|
|
277
|
+
const signFn = (hash) => sign(signers, chain, hash);
|
|
311
278
|
const account = getAccountProvider(config);
|
|
312
279
|
switch (account.type) {
|
|
313
280
|
case 'safe': {
|
|
@@ -319,6 +286,9 @@ async function getSmartSessionSmartAccount(config, client, chain, session, enabl
|
|
|
319
286
|
case 'kernel': {
|
|
320
287
|
return (0, kernel_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
|
|
321
288
|
}
|
|
289
|
+
case 'startale': {
|
|
290
|
+
return (0, startale_1.getSessionSmartAccount)(client, address, session, smartSessionValidator.address, enableData, signFn);
|
|
291
|
+
}
|
|
322
292
|
}
|
|
323
293
|
}
|
|
324
294
|
async function getGuardianSmartAccount(config, client, chain, guardians) {
|
|
@@ -328,7 +298,11 @@ async function getGuardianSmartAccount(config, client, chain, guardians) {
|
|
|
328
298
|
if (!socialRecoveryValidator) {
|
|
329
299
|
throw new Error('Social recovery is not available');
|
|
330
300
|
}
|
|
331
|
-
const
|
|
301
|
+
const signers = {
|
|
302
|
+
type: 'guardians',
|
|
303
|
+
guardians: accounts,
|
|
304
|
+
};
|
|
305
|
+
const signFn = (hash) => sign(signers, chain, hash);
|
|
332
306
|
const account = getAccountProvider(config);
|
|
333
307
|
switch (account.type) {
|
|
334
308
|
case 'safe': {
|
|
@@ -340,16 +314,71 @@ async function getGuardianSmartAccount(config, client, chain, guardians) {
|
|
|
340
314
|
case 'kernel': {
|
|
341
315
|
return (0, kernel_1.getGuardianSmartAccount)(client, address, guardians, socialRecoveryValidator.address, signFn);
|
|
342
316
|
}
|
|
317
|
+
case 'startale': {
|
|
318
|
+
return (0, startale_1.getGuardianSmartAccount)(client, address, guardians, socialRecoveryValidator.address, signFn);
|
|
319
|
+
}
|
|
343
320
|
}
|
|
344
321
|
}
|
|
345
|
-
async function sign(
|
|
346
|
-
switch (
|
|
347
|
-
case '
|
|
348
|
-
|
|
349
|
-
|
|
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
|
+
}
|
|
350
374
|
}
|
|
351
|
-
case '
|
|
352
|
-
|
|
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);
|
|
353
382
|
}
|
|
354
383
|
}
|
|
355
384
|
}
|
|
@@ -369,37 +398,6 @@ async function signPasskey(account, chain, hash) {
|
|
|
369
398
|
});
|
|
370
399
|
return encodedSignature;
|
|
371
400
|
}
|
|
372
|
-
async function get7702SmartAccount(config, client) {
|
|
373
|
-
if (!config.eoa) {
|
|
374
|
-
throw new error_1.Eip7702AccountMustHaveEoaError();
|
|
375
|
-
}
|
|
376
|
-
const account = getAccountProvider(config);
|
|
377
|
-
switch (account.type) {
|
|
378
|
-
case 'safe': {
|
|
379
|
-
return (0, safe_1.get7702SmartAccount)();
|
|
380
|
-
}
|
|
381
|
-
case 'nexus': {
|
|
382
|
-
return (0, nexus_1.get7702SmartAccount)(config.eoa, client);
|
|
383
|
-
}
|
|
384
|
-
case 'kernel': {
|
|
385
|
-
return (0, kernel_1.get7702SmartAccount)();
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
async function get7702InitCalls(config) {
|
|
390
|
-
const account = getAccountProvider(config);
|
|
391
|
-
switch (account.type) {
|
|
392
|
-
case 'safe': {
|
|
393
|
-
return (0, safe_1.get7702InitCalls)();
|
|
394
|
-
}
|
|
395
|
-
case 'nexus': {
|
|
396
|
-
return (0, nexus_1.get7702InitCalls)(config);
|
|
397
|
-
}
|
|
398
|
-
case 'kernel': {
|
|
399
|
-
return (0, kernel_1.get7702InitCalls)();
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
401
|
function is7702(config) {
|
|
404
402
|
return config.eoa !== undefined;
|
|
405
403
|
}
|
|
@@ -411,3 +409,45 @@ function getAccountProvider(config) {
|
|
|
411
409
|
type: 'nexus',
|
|
412
410
|
};
|
|
413
411
|
}
|
|
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('0xa32fa78416f6c68ce4f75f702e07849a269feffb');
|
|
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('0xfbda4e576b2a300cd1b7e8748c9a7577ab3a503e');
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
(0, vitest_1.describe)('Sign', () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Abi, Address, Hex, PublicClient } from 'viem';
|
|
2
|
-
import { SmartAccount, SmartAccountImplementation } from 'viem/account-abstraction';
|
|
3
|
-
import { Module } from '../modules/common';
|
|
4
|
-
import { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
5
|
-
import { OwnerSet, RhinestoneAccountConfig, Session } from '../types';
|
|
6
|
-
import { ValidatorConfig } from './utils';
|
|
1
|
+
import { type Abi, type Address, type Hex, type PublicClient } from 'viem';
|
|
2
|
+
import { type SmartAccount, type SmartAccountImplementation } from 'viem/account-abstraction';
|
|
3
|
+
import { type Module } from '../modules/common';
|
|
4
|
+
import type { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
5
|
+
import type { OwnerSet, RhinestoneAccountConfig, Session } from '../types';
|
|
6
|
+
import { type ValidatorConfig } from './utils';
|
|
7
7
|
declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
8
8
|
factory: `0x${string}`;
|
|
9
9
|
factoryData: `0x${string}`;
|
|
@@ -13,11 +13,9 @@ 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 get7702InitCalls(): never;
|
|
17
|
-
declare function get7702SmartAccount(): never;
|
|
18
16
|
declare function getPackedSignature(signFn: (message: Hex) => Promise<Hex>, hash: Hex, validator: ValidatorConfig, accountAddress: Address, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
19
17
|
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
20
18
|
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">>>;
|
|
21
19
|
declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
22
|
-
export { getInstallData, getAddress, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount,
|
|
20
|
+
export { getInstallData, getAddress, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, };
|
|
23
21
|
//# sourceMappingURL=kernel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../accounts/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,
|
|
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,UAAU,CAAA;AAC1E,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAgBhF,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;EA4CrD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBASlD;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,CAsE7C;AAED,iBAAe,kBAAkB,CAC/B,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,EACtC,IAAI,EAAE,GAAG,EACT,SAAS,EAAE,eAAe,EAC1B,cAAc,EAAE,OAAO,EACvB,kBAAkB,GAAE,CAAC,SAAS,EAAE,GAAG,KAAK,GAA8B,0BAevE;AAwBD,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,kBAAkB,GACnB,CAAA"}
|
|
@@ -6,15 +6,12 @@ exports.getDeployArgs = getDeployArgs;
|
|
|
6
6
|
exports.getSmartAccount = getSmartAccount;
|
|
7
7
|
exports.getSessionSmartAccount = getSessionSmartAccount;
|
|
8
8
|
exports.getGuardianSmartAccount = getGuardianSmartAccount;
|
|
9
|
-
exports.get7702InitCalls = get7702InitCalls;
|
|
10
|
-
exports.get7702SmartAccount = get7702SmartAccount;
|
|
11
9
|
exports.getPackedSignature = getPackedSignature;
|
|
12
10
|
const viem_1 = require("viem");
|
|
13
11
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
14
12
|
const modules_1 = require("../modules");
|
|
15
13
|
const common_1 = require("../modules/common");
|
|
16
14
|
const validators_1 = require("../modules/validators");
|
|
17
|
-
const error_1 = require("./error");
|
|
18
15
|
const utils_1 = require("./utils");
|
|
19
16
|
const KERNEL_META_FACTORY_ADDRESS = '0xd703aae79538628d27099b8c4f621be4ccd142d5';
|
|
20
17
|
const KERNEL_IMPLEMENTATION_ADDRESS = '0xd6CEDDe84be40893d153Be9d467CD6aD37875b28';
|
|
@@ -129,12 +126,6 @@ function getInstallData(module) {
|
|
|
129
126
|
}
|
|
130
127
|
}
|
|
131
128
|
}
|
|
132
|
-
function get7702InitCalls() {
|
|
133
|
-
throw new error_1.Eip7702NotSupportedForAccountError('kernel');
|
|
134
|
-
}
|
|
135
|
-
function get7702SmartAccount() {
|
|
136
|
-
throw new error_1.Eip7702NotSupportedForAccountError('kernel');
|
|
137
|
-
}
|
|
138
129
|
async function getPackedSignature(signFn, hash, validator, accountAddress, transformSignature = (signature) => signature) {
|
|
139
130
|
const vId = validator.isRoot ? '0x00' : (0, viem_1.concat)(['0x01', validator.address]);
|
|
140
131
|
const signature = validator.isRoot
|