@rhinestone/sdk 2.0.0-beta.3 → 2.0.0-beta.31
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 +2 -9
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +5 -11
- package/dist/src/accounts/hca.d.ts +25 -0
- package/dist/src/accounts/hca.d.ts.map +1 -0
- package/dist/src/accounts/hca.js +145 -0
- package/dist/src/accounts/index.d.ts +9 -9
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +112 -41
- package/dist/src/accounts/kernel.d.ts +1 -2
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +1 -8
- package/dist/src/accounts/nexus.d.ts +3 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +33 -8
- package/dist/src/accounts/safe.d.ts +1 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +3 -9
- package/dist/src/accounts/signing/common.d.ts +1 -4
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +7 -11
- package/dist/src/accounts/signing/message.d.ts.map +1 -1
- package/dist/src/accounts/signing/message.js +1 -4
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
- package/dist/src/accounts/signing/typedData.js +1 -4
- package/dist/src/accounts/startale.d.ts +1 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +2 -5
- package/dist/src/actions/ecdsa.js +5 -5
- package/dist/src/actions/index.js +2 -2
- package/dist/src/actions/mfa.js +2 -2
- package/dist/src/actions/passkeys.js +2 -2
- package/dist/src/actions/smart-sessions.d.ts +29 -5
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +38 -10
- package/dist/src/errors/index.d.ts +4 -4
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +6 -6
- package/dist/src/execution/error.d.ts +8 -21
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +7 -21
- package/dist/src/execution/index.d.ts +17 -17
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +22 -41
- package/dist/src/execution/utils.d.ts +15 -11
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +279 -75
- package/dist/src/index.d.ts +236 -37
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +60 -115
- package/dist/src/jwt-server/jcs.d.ts +1 -1
- package/dist/src/jwt-server/jcs.js +4 -2
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +0 -5
- package/dist/src/modules/read.d.ts +3 -2
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +33 -4
- package/dist/src/modules/validators/core.d.ts +5 -5
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +45 -34
- package/dist/src/modules/validators/cross-chain-permits.d.ts +11 -0
- package/dist/src/modules/validators/cross-chain-permits.d.ts.map +1 -0
- package/dist/src/modules/validators/cross-chain-permits.js +76 -0
- package/dist/src/modules/validators/permissions.d.ts +1 -0
- package/dist/src/modules/validators/permissions.d.ts.map +1 -1
- package/dist/src/modules/validators/permissions.js +162 -17
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts +22 -0
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -0
- package/dist/src/modules/validators/policies/claim/arbiters.js +57 -0
- package/dist/src/modules/validators/smart-sessions.d.ts +38 -9
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +509 -92
- package/dist/src/orchestrator/caip2.d.ts +9 -3
- package/dist/src/orchestrator/caip2.d.ts.map +1 -1
- package/dist/src/orchestrator/caip2.js +40 -5
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +44 -21
- package/dist/src/orchestrator/consts.d.ts +1 -1
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +1 -1
- package/dist/src/orchestrator/destinations.d.ts +24 -0
- package/dist/src/orchestrator/destinations.d.ts.map +1 -0
- package/dist/src/orchestrator/destinations.js +55 -0
- package/dist/src/orchestrator/error.d.ts +87 -4
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +237 -3
- package/dist/src/orchestrator/index.d.ts +6 -5
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +4 -3
- package/dist/src/orchestrator/registry.d.ts +2 -1
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +13 -0
- package/dist/src/orchestrator/types.d.ts +114 -28
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.js +1 -5
- package/dist/src/smart-sessions/index.d.ts +5 -0
- package/dist/src/smart-sessions/index.d.ts.map +1 -0
- package/dist/src/smart-sessions/index.js +6 -0
- package/dist/src/types.d.ts +298 -29
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +59 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +59 -0
- package/package.json +4 -8
- package/dist/src/actions/recovery.d.ts +0 -33
- package/dist/src/actions/recovery.d.ts.map +0 -1
- package/dist/src/actions/recovery.js +0 -189
|
@@ -22,13 +22,6 @@ declare class Eip7702AccountMustHaveEoaError extends AccountError {
|
|
|
22
22
|
traceId?: string;
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
declare class ExistingEip7702AccountsNotSupportedError extends AccountError {
|
|
26
|
-
constructor(params?: {
|
|
27
|
-
context?: any;
|
|
28
|
-
errorType?: string;
|
|
29
|
-
traceId?: string;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
25
|
declare class EoaAccountMustHaveAccountError extends AccountError {
|
|
33
26
|
constructor(params?: {
|
|
34
27
|
context?: any;
|
|
@@ -43,7 +36,7 @@ declare class FactoryArgsNotAvailableError extends AccountError {
|
|
|
43
36
|
traceId?: string;
|
|
44
37
|
});
|
|
45
38
|
}
|
|
46
|
-
declare class
|
|
39
|
+
declare class DefaultValidatorAlreadyInitializedError extends AccountError {
|
|
47
40
|
constructor(params?: {
|
|
48
41
|
context?: any;
|
|
49
42
|
errorType?: string;
|
|
@@ -110,5 +103,5 @@ declare class Eip712DomainNotAvailableError extends AccountError {
|
|
|
110
103
|
constructor(message: string);
|
|
111
104
|
}
|
|
112
105
|
declare function isAccountError(error: Error): error is AccountError;
|
|
113
|
-
export { isAccountError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError,
|
|
106
|
+
export { isAccountError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError, FactoryArgsNotAvailableError, DefaultValidatorAlreadyInitializedError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, AccountConfigurationNotSupportedError, WalletClientNoConnectedAccountError, ModuleInstallationNotSupportedError, EoaSigningNotSupportedError, EoaSigningMethodNotConfiguredError, OwnersFieldRequiredError, };
|
|
114
107
|
//# 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,C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@ -31,14 +31,6 @@ class Eip7702AccountMustHaveEoaError extends AccountError {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
class ExistingEip7702AccountsNotSupportedError extends AccountError {
|
|
35
|
-
constructor(params) {
|
|
36
|
-
super({
|
|
37
|
-
message: 'Existing EIP-7702 accounts are not yet supported',
|
|
38
|
-
...params,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
34
|
class EoaAccountMustHaveAccountError extends AccountError {
|
|
43
35
|
constructor(params) {
|
|
44
36
|
super({
|
|
@@ -55,10 +47,10 @@ class FactoryArgsNotAvailableError extends AccountError {
|
|
|
55
47
|
});
|
|
56
48
|
}
|
|
57
49
|
}
|
|
58
|
-
class
|
|
50
|
+
class DefaultValidatorAlreadyInitializedError extends AccountError {
|
|
59
51
|
constructor(params) {
|
|
60
52
|
super({
|
|
61
|
-
message: '
|
|
53
|
+
message: 'ECDSA is already enabled on this account. Use `addOwner` / `removeOwner` / `changeThreshold` to manage owners instead of `enable`.',
|
|
62
54
|
...params,
|
|
63
55
|
});
|
|
64
56
|
}
|
|
@@ -149,8 +141,10 @@ function getAccountName(account) {
|
|
|
149
141
|
return 'Nexus';
|
|
150
142
|
case 'startale':
|
|
151
143
|
return 'Startale';
|
|
144
|
+
case 'hca':
|
|
145
|
+
return 'HCA';
|
|
152
146
|
case 'eoa':
|
|
153
147
|
return 'EOA';
|
|
154
148
|
}
|
|
155
149
|
}
|
|
156
|
-
export { isAccountError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError,
|
|
150
|
+
export { isAccountError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError, FactoryArgsNotAvailableError, DefaultValidatorAlreadyInitializedError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, AccountConfigurationNotSupportedError, WalletClientNoConnectedAccountError, ModuleInstallationNotSupportedError, EoaSigningNotSupportedError, EoaSigningMethodNotConfiguredError, OwnersFieldRequiredError, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Address, Chain, Hex, PublicClient } from 'viem';
|
|
2
|
+
import type { Module } from '../modules/common.js';
|
|
3
|
+
import { ENS_HCA_MODULE } from '../modules/validators/core.js';
|
|
4
|
+
import type { OwnerSet, RhinestoneAccountConfig } from '../types.js';
|
|
5
|
+
import type { ValidatorConfig } from './utils.js';
|
|
6
|
+
declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
7
|
+
factory: `0x${string}`;
|
|
8
|
+
factoryData: `0x${string}`;
|
|
9
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
10
|
+
implementation: `0x${string}`;
|
|
11
|
+
initializationCallData: `0x${string}`;
|
|
12
|
+
} | null;
|
|
13
|
+
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
14
|
+
declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
|
|
15
|
+
name: string;
|
|
16
|
+
version: string;
|
|
17
|
+
chainId: number;
|
|
18
|
+
verifyingContract: `0x${string}`;
|
|
19
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
20
|
+
};
|
|
21
|
+
declare function getInstallData(module: Module): `0x${string}`;
|
|
22
|
+
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
23
|
+
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
24
|
+
export { ENS_HCA_MODULE, getEip712Domain, getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, };
|
|
25
|
+
//# sourceMappingURL=hca.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hca.d.ts","sourceRoot":"","sources":["../../../accounts/hca.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAa7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAqB,MAAM,4BAA4B,CAAA;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAUjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAc9C,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;SAiFrD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBAalD;AAmDD,iBAAS,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK;;;;;;EAarE;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,iBAErC;AAED,iBAAe,aAAa,CAC1B,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,eAAe,EAC1B,kBAAkB,GAAE,CAAC,SAAS,EAAE,GAAG,KAAK,GAA8B,0BAQvE;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,oKAUlC;AAED,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,GAChB,CAAA"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { concat, decodeAbiParameters, decodeFunctionData, encodeFunctionData, encodePacked, keccak256, pad, parseAbi, slice, zeroHash, } from 'viem';
|
|
2
|
+
import { ENS_HCA_MODULE, getOwnerValidator } from '../modules/validators/core.js';
|
|
3
|
+
import { AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, } from './error.js';
|
|
4
|
+
import { getInstallData as getNexusInstallData, getSmartAccount as getNexusSmartAccount, packSignature as packNexusSignature, } from './nexus.js';
|
|
5
|
+
const HCA_IMPLEMENTATION_ADDRESS = '0x7c2cC1e499a87ab480Df154e05164cD56D05d570';
|
|
6
|
+
const HCA_FACTORY_ADDRESS = '0x358680728dedb552adaa9f5eb5d4395b291cf943';
|
|
7
|
+
// HCA inherits Nexus's EIP-712 domain (verified on-chain via eip712Domain()).
|
|
8
|
+
const HCA_VERSION = '1.2.0';
|
|
9
|
+
// Solady CREATE3 proxy bytecode hash
|
|
10
|
+
const CREATE3_PROXY_HASH = '0x21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f';
|
|
11
|
+
function getDeployArgs(config) {
|
|
12
|
+
// HCA accounts are locked to their initial configuration and block module
|
|
13
|
+
// installation, so sessions and extra modules can never be installed.
|
|
14
|
+
// Reject them on every path (including externally-provided initData)
|
|
15
|
+
// rather than silently dropping them.
|
|
16
|
+
if (config.experimental_sessions?.enabled ||
|
|
17
|
+
(config.modules && config.modules.length > 0)) {
|
|
18
|
+
throw new AccountConfigurationNotSupportedError('HCA accounts cannot install sessions or additional modules', 'hca');
|
|
19
|
+
}
|
|
20
|
+
if (config.owners && config.owners.type !== 'ens') {
|
|
21
|
+
throw new AccountConfigurationNotSupportedError('HCA accounts require ENS owners', 'hca');
|
|
22
|
+
}
|
|
23
|
+
if (config.initData) {
|
|
24
|
+
if (!('factory' in config.initData)) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const { factory, factoryData } = config.initData;
|
|
28
|
+
try {
|
|
29
|
+
const decoded = decodeFunctionData({
|
|
30
|
+
abi: parseAbi(['function createAccount(bytes)']),
|
|
31
|
+
data: factoryData,
|
|
32
|
+
});
|
|
33
|
+
const moduleInitData = decoded.args[0];
|
|
34
|
+
const initializationCallData = encodeFunctionData({
|
|
35
|
+
abi: parseAbi(['function initializeAccount(bytes)']),
|
|
36
|
+
functionName: 'initializeAccount',
|
|
37
|
+
args: [moduleInitData],
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
factory,
|
|
41
|
+
factoryData,
|
|
42
|
+
salt: zeroHash,
|
|
43
|
+
implementation: HCA_IMPLEMENTATION_ADDRESS,
|
|
44
|
+
initializationCallData,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!config.owners) {
|
|
52
|
+
throw new AccountConfigurationNotSupportedError('HCA accounts require ENS owners', 'hca');
|
|
53
|
+
}
|
|
54
|
+
const ownerValidator = getOwnerValidator(config);
|
|
55
|
+
const moduleInitData = ownerValidator.initData;
|
|
56
|
+
// Factory takes module initData directly: abi.encode(threshold, owners[])
|
|
57
|
+
// It internally calls module.getOwnerFromInitData(initData) to derive the CREATE3 salt,
|
|
58
|
+
// then deploys the proxy with the stored implementation
|
|
59
|
+
const factoryData = encodeFunctionData({
|
|
60
|
+
abi: parseAbi(['function createAccount(bytes)']),
|
|
61
|
+
functionName: 'createAccount',
|
|
62
|
+
args: [moduleInitData],
|
|
63
|
+
});
|
|
64
|
+
const initializationCallData = encodeFunctionData({
|
|
65
|
+
abi: parseAbi(['function initializeAccount(bytes)']),
|
|
66
|
+
functionName: 'initializeAccount',
|
|
67
|
+
args: [moduleInitData],
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
factory: HCA_FACTORY_ADDRESS,
|
|
71
|
+
factoryData,
|
|
72
|
+
salt: zeroHash,
|
|
73
|
+
implementation: HCA_IMPLEMENTATION_ADDRESS,
|
|
74
|
+
initializationCallData,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function getAddress(config) {
|
|
78
|
+
const deployArgs = getDeployArgs(config);
|
|
79
|
+
if (!deployArgs) {
|
|
80
|
+
if (config.initData?.address) {
|
|
81
|
+
return config.initData.address;
|
|
82
|
+
}
|
|
83
|
+
throw new Error('Cannot derive address: deploy args not available');
|
|
84
|
+
}
|
|
85
|
+
// Always derive deterministically from the factory data so a mismatched
|
|
86
|
+
// initData.address is caught by checkAddress instead of being trusted.
|
|
87
|
+
const primaryOwner = getPrimaryOwnerFromFactoryData(deployArgs.factoryData);
|
|
88
|
+
return predictCreate3Address(deployArgs.factory, primaryOwner);
|
|
89
|
+
}
|
|
90
|
+
// The factory derives the CREATE3 salt from getOwnerFromInitData(initData),
|
|
91
|
+
// which returns owners[0] of the validator init data. getOwnerValidator sorts
|
|
92
|
+
// owners by lowercased address, so owners[0] is the salt owner the factory uses.
|
|
93
|
+
function getPrimaryOwnerFromFactoryData(factoryData) {
|
|
94
|
+
const { args } = decodeFunctionData({
|
|
95
|
+
abi: parseAbi(['function createAccount(bytes)']),
|
|
96
|
+
data: factoryData,
|
|
97
|
+
});
|
|
98
|
+
const [, owners] = decodeAbiParameters([
|
|
99
|
+
{ type: 'uint256' },
|
|
100
|
+
{
|
|
101
|
+
type: 'tuple[]',
|
|
102
|
+
components: [
|
|
103
|
+
{ name: 'addr', type: 'address' },
|
|
104
|
+
{ name: 'expiration', type: 'uint48' },
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
], args[0]);
|
|
108
|
+
return owners[0].addr;
|
|
109
|
+
}
|
|
110
|
+
// Solady CREATE3 address derivation:
|
|
111
|
+
// 1. salt = bytes32(bytes20(primaryOwner)) — right-padded
|
|
112
|
+
// 2. proxy = CREATE2(factory, salt, CREATE3_PROXY_HASH)
|
|
113
|
+
// 3. account = CREATE(proxy, nonce=1) = keccak256(0xd694 ++ proxy ++ 0x01)
|
|
114
|
+
function predictCreate3Address(factory, primaryOwner) {
|
|
115
|
+
// salt = bytes32(bytes20(owner)) — address right-padded to 32 bytes
|
|
116
|
+
const salt = pad(primaryOwner, { size: 32, dir: 'right' });
|
|
117
|
+
// CREATE2: proxy address
|
|
118
|
+
const proxyHash = keccak256(encodePacked(['bytes1', 'address', 'bytes32', 'bytes32'], ['0xff', factory, salt, CREATE3_PROXY_HASH]));
|
|
119
|
+
const proxyAddress = slice(proxyHash, 12, 32);
|
|
120
|
+
// CREATE with nonce 1: RLP([proxy, 1]) = 0xd694 ++ proxy ++ 0x01
|
|
121
|
+
const accountHash = keccak256(concat(['0xd694', proxyAddress, '0x01']));
|
|
122
|
+
return slice(accountHash, 12, 32);
|
|
123
|
+
}
|
|
124
|
+
function getEip712Domain(config, chain) {
|
|
125
|
+
if (config.initData) {
|
|
126
|
+
throw new Eip712DomainNotAvailableError('Existing HCA accounts are not yet supported');
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
name: 'Nexus',
|
|
130
|
+
version: HCA_VERSION,
|
|
131
|
+
chainId: chain.id,
|
|
132
|
+
verifyingContract: getAddress(config),
|
|
133
|
+
salt: zeroHash,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function getInstallData(module) {
|
|
137
|
+
return getNexusInstallData(module);
|
|
138
|
+
}
|
|
139
|
+
async function packSignature(signature, validator, transformSignature = (signature) => signature) {
|
|
140
|
+
return packNexusSignature(signature, validator, transformSignature, ENS_HCA_MODULE);
|
|
141
|
+
}
|
|
142
|
+
async function getSmartAccount(client, address, owners, validatorAddress, sign) {
|
|
143
|
+
return getNexusSmartAccount(client, address, owners, validatorAddress, sign, ENS_HCA_MODULE);
|
|
144
|
+
}
|
|
145
|
+
export { ENS_HCA_MODULE, getEip712Domain, getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { type Chain, type HashTypedDataParameters, type Hex, type PublicClient, type TypedData } from 'viem';
|
|
2
|
-
import type
|
|
1
|
+
import { type Address, type Chain, type HashTypedDataParameters, type Hex, type PublicClient, type TypedData } from 'viem';
|
|
2
|
+
import { type Module } from '../modules/common.js';
|
|
3
3
|
import type { ResolvedSessionSignerSet } from '../modules/validators/smart-sessions.js';
|
|
4
|
-
import type { AccountProviderConfig, Call,
|
|
5
|
-
import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError,
|
|
4
|
+
import type { AccountProviderConfig, Call, RhinestoneConfig, SignerSet } from '../types.js';
|
|
5
|
+
import { AccountConfigurationNotSupportedError, AccountError, DefaultValidatorAlreadyInitializedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, FactoryArgsNotAvailableError, isAccountError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, WalletClientNoConnectedAccountError } from './error.js';
|
|
6
6
|
import { type ValidatorConfig } from './utils.js';
|
|
7
7
|
type InternalSignerSet = SignerSet | ResolvedSessionSignerSet;
|
|
8
8
|
declare function getInitCode(config: RhinestoneConfig): {
|
|
9
|
-
address:
|
|
9
|
+
address: Address;
|
|
10
10
|
} | {
|
|
11
11
|
factory: `0x${string}`;
|
|
12
12
|
factoryData: `0x${string}`;
|
|
13
13
|
} | undefined;
|
|
14
14
|
declare function getV0InitCode(config: RhinestoneConfig): {
|
|
15
|
-
address:
|
|
15
|
+
address: Address;
|
|
16
16
|
} | {
|
|
17
17
|
factory: `0x${string}`;
|
|
18
18
|
factoryData: `0x${string}`;
|
|
@@ -30,7 +30,8 @@ declare function getEip712Domain(config: RhinestoneConfig, chain: Chain): {
|
|
|
30
30
|
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
31
31
|
};
|
|
32
32
|
declare function getModuleInstallationCalls(config: RhinestoneConfig, module: Module): Call[];
|
|
33
|
-
declare function
|
|
33
|
+
declare function getValidatorInstallationCalls(config: RhinestoneConfig, chain: Chain, module: Module): Promise<Call[]>;
|
|
34
|
+
declare function getModuleUninstallationCalls(config: RhinestoneConfig, chain: Chain, module: Module): Promise<Call[]>;
|
|
34
35
|
declare function getAddress(config: RhinestoneConfig): `0x${string}`;
|
|
35
36
|
declare function checkAddress(config: RhinestoneConfig): boolean;
|
|
36
37
|
declare function getEip1271Signature(config: RhinestoneConfig, signers: InternalSignerSet | undefined, chain: Chain, validator: ValidatorConfig, hash: Hex, transformSignature?: (signature: Hex) => Hex): Promise<Hex>;
|
|
@@ -44,8 +45,7 @@ declare function deploy(config: RhinestoneConfig, chain: Chain, params?: {
|
|
|
44
45
|
declare function setup(config: RhinestoneConfig, chain: Chain): Promise<boolean>;
|
|
45
46
|
declare function toErc6492Signature(config: RhinestoneConfig, signature: Hex, chain: Chain): Promise<Hex>;
|
|
46
47
|
declare function getSmartAccount(config: RhinestoneConfig, client: PublicClient, chain: Chain): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">> | undefined>;
|
|
47
|
-
declare function getGuardianSmartAccount(config: RhinestoneConfig, client: PublicClient, chain: Chain, guardians: OwnerSet): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">> | undefined>;
|
|
48
48
|
declare function is7702(config: RhinestoneConfig): boolean;
|
|
49
49
|
declare function getAccountProvider(config: RhinestoneConfig): AccountProviderConfig;
|
|
50
|
-
export { getEip712Domain, getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, checkAddress, getAccountProvider, getInitCode, getV0InitCode, signEip7702InitData, getEip7702InitCall, is7702, isDeployed, deploy, setup, toErc6492Signature, getSmartAccount,
|
|
50
|
+
export { getEip712Domain, getModuleInstallationCalls, getValidatorInstallationCalls, getModuleUninstallationCalls, getAddress, checkAddress, getAccountProvider, getInitCode, getV0InitCode, signEip7702InitData, getEip7702InitCall, is7702, isDeployed, deploy, setup, toErc6492Signature, getSmartAccount, getEip1271Signature, getEmissarySignature, getTypedDataPackedSignature, isAccountError, AccountError, AccountConfigurationNotSupportedError, DefaultValidatorAlreadyInitializedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, FactoryArgsNotAvailableError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, WalletClientNoConnectedAccountError, };
|
|
51
51
|
//# 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;AASb,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAKV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAER,KAAK,YAAY,EAEjB,KAAK,SAAS,EAEf,MAAM,MAAM,CAAA;AASb,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAMzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAA;AACpF,OAAO,KAAK,EACV,qBAAqB,EACrB,IAAI,EACJ,gBAAgB,EAChB,SAAS,EACV,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,uCAAuC,EACvC,6BAA6B,EAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,8BAA8B,EAC9B,kCAAkC,EAClC,2BAA2B,EAC3B,4BAA4B,EAC5B,cAAc,EACd,mCAAmC,EACnC,wBAAwB,EACxB,kCAAkC,EAClC,mCAAmC,EACpC,MAAM,SAAS,CAAA;AAk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K,gLAmEb;AAED,iBAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAGjD;AAED,iBAAS,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,qBAAqB,CAO3E;AAED,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,6BAA6B,EAC7B,4BAA4B,EAC5B,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,MAAM,EACN,KAAK,EACL,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,EAE3B,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,uCAAuC,EACvC,6BAA6B,EAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,8BAA8B,EAC9B,kCAAkC,EAClC,2BAA2B,EAC3B,4BAA4B,EAC5B,mCAAmC,EACnC,wBAAwB,EACxB,kCAAkC,EAClC,mCAAmC,GACpC,CAAA"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { concat, createPublicClient, encodeAbiParameters, encodeFunctionData, hashTypedData, size, zeroAddress, } from 'viem';
|
|
2
2
|
import { sendTransactionInternal, sendUserOperationInternal, waitForExecution, } from '../execution/index.js';
|
|
3
3
|
import { getIntentExecutor, getSetup } from '../modules/index.js';
|
|
4
|
+
import { MODULE_TYPE_ID_VALIDATOR } from '../modules/common.js';
|
|
5
|
+
import { getValidators as getValidatorsInternal, isValidatorInitialized, } from '../modules/read.js';
|
|
4
6
|
import { getOwnerValidator } from '../modules/validators/index.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { getAddress as getKernelAddress, getDeployArgs as getKernelDeployArgs, getEip712Domain as getKernelEip712Domain,
|
|
8
|
-
import { getAddress as getNexusAddress, getDefaultValidatorAddress as getNexusDefaultValidatorAddress, getDeployArgs as getNexusDeployArgs, getEip712Domain as getNexusEip712Domain, getEip7702InitCall as getNexusEip7702InitCall,
|
|
9
|
-
import { getAddress as getSafeAddress, getDeployArgs as getSafeDeployArgs, getEip712Domain as getSafeEip712Domain,
|
|
7
|
+
import { AccountConfigurationNotSupportedError, AccountError, DefaultValidatorAlreadyInitializedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, FactoryArgsNotAvailableError, isAccountError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, WalletClientNoConnectedAccountError, } from './error.js';
|
|
8
|
+
import { getAddress as getHcaAddress, getDeployArgs as getHcaDeployArgs, getEip712Domain as getHcaEip712Domain, getSmartAccount as getHcaSmartAccount, packSignature as packHcaSignature, } from './hca.js';
|
|
9
|
+
import { getAddress as getKernelAddress, getDeployArgs as getKernelDeployArgs, getEip712Domain as getKernelEip712Domain, getInstallData as getKernelInstallData, getSmartAccount as getKernelSmartAccount, packSignature as packKernelSignature, wrapMessageHash as wrapKernelMessageHash, } from './kernel.js';
|
|
10
|
+
import { getAddress as getNexusAddress, getDefaultValidatorAddress as getNexusDefaultValidatorAddress, getDefaultValidatorInitData as getNexusDefaultValidatorInitData, getDeployArgs as getNexusDeployArgs, getEip712Domain as getNexusEip712Domain, getEip7702InitCall as getNexusEip7702InitCall, getInstallData as getNexusInstallData, getSmartAccount as getNexusSmartAccount, isDefaultValidatorConfigured as isNexusDefaultValidatorConfigured, packSignature as packNexusSignature, signEip7702InitData as signNexusEip7702InitData, } from './nexus.js';
|
|
11
|
+
import { getAddress as getSafeAddress, getDeployArgs as getSafeDeployArgs, getEip712Domain as getSafeEip712Domain, getInstallData as getSafeInstallData, getSmartAccount as getSafeSmartAccount, getV0DeployArgs as getSafeV0DeployArgs, packSignature as packSafeSignature, } from './safe.js';
|
|
10
12
|
import { convertOwnerSetToSignerSet } from './signing/common.js';
|
|
11
13
|
import { sign as signMessage } from './signing/message.js';
|
|
12
14
|
import { sign as signTypedData } from './signing/typedData.js';
|
|
13
|
-
import { getAddress as getStartaleAddress, getDeployArgs as getStartaleDeployArgs, getEip712Domain as getStartaleEip712Domain,
|
|
15
|
+
import { getAddress as getStartaleAddress, getDeployArgs as getStartaleDeployArgs, getEip712Domain as getStartaleEip712Domain, getInstallData as getStartaleInstallData, getSmartAccount as getStartaleSmartAccount, packSignature as packStartaleSignature, } from './startale.js';
|
|
14
16
|
import { createTransport, getBundlerClient, } from './utils.js';
|
|
15
17
|
function getDeployArgs(config) {
|
|
16
18
|
const account = getAccountProvider(config);
|
|
@@ -27,6 +29,9 @@ function getDeployArgs(config) {
|
|
|
27
29
|
case 'startale': {
|
|
28
30
|
return getStartaleDeployArgs(config);
|
|
29
31
|
}
|
|
32
|
+
case 'hca': {
|
|
33
|
+
return getHcaDeployArgs(config);
|
|
34
|
+
}
|
|
30
35
|
case 'eoa': {
|
|
31
36
|
throw new Error('EOA accounts do not have deploy args');
|
|
32
37
|
}
|
|
@@ -102,7 +107,8 @@ async function signEip7702InitData(config) {
|
|
|
102
107
|
}
|
|
103
108
|
case 'safe':
|
|
104
109
|
case 'kernel':
|
|
105
|
-
case 'startale':
|
|
110
|
+
case 'startale':
|
|
111
|
+
case 'hca': {
|
|
106
112
|
throw new Eip7702NotSupportedForAccountError(account.type);
|
|
107
113
|
}
|
|
108
114
|
default: {
|
|
@@ -118,7 +124,8 @@ function getEip7702InitCall(config, signature) {
|
|
|
118
124
|
}
|
|
119
125
|
case 'safe':
|
|
120
126
|
case 'kernel':
|
|
121
|
-
case 'startale':
|
|
127
|
+
case 'startale':
|
|
128
|
+
case 'hca': {
|
|
122
129
|
throw new Eip7702NotSupportedForAccountError(account.type);
|
|
123
130
|
}
|
|
124
131
|
default: {
|
|
@@ -141,6 +148,9 @@ function getEip712Domain(config, chain) {
|
|
|
141
148
|
case 'startale': {
|
|
142
149
|
return getStartaleEip712Domain(config, chain);
|
|
143
150
|
}
|
|
151
|
+
case 'hca': {
|
|
152
|
+
return getHcaEip712Domain(config, chain);
|
|
153
|
+
}
|
|
144
154
|
case 'eoa': {
|
|
145
155
|
throw new Eip712DomainNotAvailableError('EOA accounts do not have an EIP-712 domain');
|
|
146
156
|
}
|
|
@@ -166,6 +176,9 @@ function getModuleInstallationCalls(config, module) {
|
|
|
166
176
|
case 'startale': {
|
|
167
177
|
return [getStartaleInstallData(module)];
|
|
168
178
|
}
|
|
179
|
+
case 'hca': {
|
|
180
|
+
throw new ModuleInstallationNotSupportedError(account.type);
|
|
181
|
+
}
|
|
169
182
|
case 'eoa': {
|
|
170
183
|
throw new ModuleInstallationNotSupportedError(account.type);
|
|
171
184
|
}
|
|
@@ -178,8 +191,44 @@ function getModuleInstallationCalls(config, module) {
|
|
|
178
191
|
data,
|
|
179
192
|
}));
|
|
180
193
|
}
|
|
181
|
-
|
|
194
|
+
// Like `getModuleInstallationCalls`, but aware of the Nexus default validator.
|
|
195
|
+
// On Nexus the OwnableValidator is the hardwired default validator: it can't be
|
|
196
|
+
// added via `installModule` (reverts `DefaultValidatorAlreadyInstalled`), and
|
|
197
|
+
// passkey-bootstrapped accounts never initialize it, so `addOwner` reverts with
|
|
198
|
+
// `NotInitialized`. For that case we initialize it directly via `onInstall`.
|
|
199
|
+
async function getValidatorInstallationCalls(config, chain, module) {
|
|
200
|
+
const account = getAccountProvider(config);
|
|
201
|
+
if (account.type === 'nexus') {
|
|
202
|
+
const defaultValidatorAddress = getNexusDefaultValidatorAddress(account.version);
|
|
203
|
+
if (module.address.toLowerCase() === defaultValidatorAddress.toLowerCase()) {
|
|
204
|
+
// Treat the validator as initialized if the account's deployment will
|
|
205
|
+
// initialize it (config check, covers not-yet-deployed accounts) or if
|
|
206
|
+
// it is already initialized on-chain (covers accounts where ECDSA was
|
|
207
|
+
// enabled separately after deployment).
|
|
208
|
+
const initialized = isNexusDefaultValidatorConfigured(config) ||
|
|
209
|
+
(await isValidatorInitialized(getAddress(config), chain, defaultValidatorAddress, config.provider));
|
|
210
|
+
if (initialized) {
|
|
211
|
+
throw new DefaultValidatorAlreadyInitializedError();
|
|
212
|
+
}
|
|
213
|
+
return [
|
|
214
|
+
{
|
|
215
|
+
to: defaultValidatorAddress,
|
|
216
|
+
value: 0n,
|
|
217
|
+
data: getNexusDefaultValidatorInitData(module),
|
|
218
|
+
},
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return getModuleInstallationCalls(config, module);
|
|
223
|
+
}
|
|
224
|
+
// SentinelList head pointer used by ERC-7579 module managers (Nexus, Safe7579,
|
|
225
|
+
// Startale). Validator/executor uninstall on these accounts decodes the
|
|
226
|
+
// `deInitData` slot as `(address prev, bytes moduleDeInit)`, where `prev`
|
|
227
|
+
// identifies the preceding linked-list entry to repair on removal.
|
|
228
|
+
const SENTINEL_LIST_HEAD = '0x0000000000000000000000000000000000000001';
|
|
229
|
+
async function getModuleUninstallationCalls(config, chain, module) {
|
|
182
230
|
const address = getAddress(config);
|
|
231
|
+
const onChainDeInitData = await resolveOnChainDeInitData(config, chain, address, module);
|
|
183
232
|
const data = encodeFunctionData({
|
|
184
233
|
abi: [
|
|
185
234
|
{
|
|
@@ -204,10 +253,46 @@ function getModuleUninstallationCalls(config, module) {
|
|
|
204
253
|
},
|
|
205
254
|
],
|
|
206
255
|
functionName: 'uninstallModule',
|
|
207
|
-
args: [module.type, module.address,
|
|
256
|
+
args: [module.type, module.address, onChainDeInitData],
|
|
208
257
|
});
|
|
209
258
|
return [{ to: address, data, value: 0n }];
|
|
210
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Build the value the account expects in `uninstallModule`'s third argument.
|
|
262
|
+
*
|
|
263
|
+
* `Module.deInitData` carries module-level bytes (mirroring `Module.initData`,
|
|
264
|
+
* what the module's `onUninstall` sees). ERC-7579 accounts that store
|
|
265
|
+
* validators / executors in a SentinelList — Nexus, Safe7579, Startale —
|
|
266
|
+
* require an account-level wrapper `abi.encode(prev, moduleDeInit)` so they
|
|
267
|
+
* can pop the entry from the linked list. Kernel uses different storage and
|
|
268
|
+
* treats this slot as raw module bytes, so we pass `module.deInitData` through
|
|
269
|
+
* unchanged.
|
|
270
|
+
*
|
|
271
|
+
* Scope: validator type only — there are no public actions to disable
|
|
272
|
+
* executor modules today.
|
|
273
|
+
*/
|
|
274
|
+
async function resolveOnChainDeInitData(config, chain, account, module) {
|
|
275
|
+
if (module.type !== MODULE_TYPE_ID_VALIDATOR) {
|
|
276
|
+
return module.deInitData;
|
|
277
|
+
}
|
|
278
|
+
const accountType = getAccountProvider(config).type;
|
|
279
|
+
if (accountType !== 'nexus' &&
|
|
280
|
+
accountType !== 'safe' &&
|
|
281
|
+
accountType !== 'startale') {
|
|
282
|
+
return module.deInitData;
|
|
283
|
+
}
|
|
284
|
+
const validators = await getValidatorsInternal(accountType, account, chain, config.provider);
|
|
285
|
+
const targetLower = module.address.toLowerCase();
|
|
286
|
+
const index = validators.findIndex((v) => v.toLowerCase() === targetLower);
|
|
287
|
+
if (index === -1) {
|
|
288
|
+
// Not installed; pass through unchanged. The account's `uninstallModule`
|
|
289
|
+
// will surface a `ModuleNotInstalled` revert with the original module
|
|
290
|
+
// address, which is more useful than a silent abi.decode mismatch.
|
|
291
|
+
return module.deInitData;
|
|
292
|
+
}
|
|
293
|
+
const prev = index === 0 ? SENTINEL_LIST_HEAD : validators[index - 1];
|
|
294
|
+
return encodeAbiParameters([{ type: 'address' }, { type: 'bytes' }], [prev, module.deInitData]);
|
|
295
|
+
}
|
|
211
296
|
function getAddress(config) {
|
|
212
297
|
if (is7702(config)) {
|
|
213
298
|
if (!config.eoa) {
|
|
@@ -229,6 +314,9 @@ function getAddress(config) {
|
|
|
229
314
|
case 'startale': {
|
|
230
315
|
return getStartaleAddress(config);
|
|
231
316
|
}
|
|
317
|
+
case 'hca': {
|
|
318
|
+
return getHcaAddress(config);
|
|
319
|
+
}
|
|
232
320
|
case 'eoa': {
|
|
233
321
|
if (!config.eoa) {
|
|
234
322
|
throw new AccountError({
|
|
@@ -276,6 +364,10 @@ async function getEip1271Signature(config, signers, chain, validator, hash, tran
|
|
|
276
364
|
const signature = await signFn(hash);
|
|
277
365
|
return packStartaleSignature(signature, validator, transformSignature);
|
|
278
366
|
}
|
|
367
|
+
case 'hca': {
|
|
368
|
+
const signature = await signFn(hash);
|
|
369
|
+
return packHcaSignature(signature, validator, transformSignature);
|
|
370
|
+
}
|
|
279
371
|
default: {
|
|
280
372
|
throw new Error(`Unsupported account type: ${account.type}`);
|
|
281
373
|
}
|
|
@@ -321,6 +413,10 @@ async function getTypedDataPackedSignature(config, signers, chain, validator, pa
|
|
|
321
413
|
const signature = await signFn(parameters);
|
|
322
414
|
return packStartaleSignature(signature, validator, transformSignature);
|
|
323
415
|
}
|
|
416
|
+
case 'hca': {
|
|
417
|
+
const signature = await signFn(parameters);
|
|
418
|
+
return packHcaSignature(signature, validator, transformSignature);
|
|
419
|
+
}
|
|
324
420
|
default: {
|
|
325
421
|
throw new Error(`Unsupported account type: ${account.type}`);
|
|
326
422
|
}
|
|
@@ -377,7 +473,8 @@ async function deploy(config, chain, params) {
|
|
|
377
473
|
// Useful for existing (already deployed) accounts
|
|
378
474
|
async function setup(config, chain) {
|
|
379
475
|
const account = getAccountProvider(config);
|
|
380
|
-
|
|
476
|
+
// HCA accounts are locked and cannot install modules, so there is nothing to set up.
|
|
477
|
+
if (account.type === 'eoa' || account.type === 'hca') {
|
|
381
478
|
return false;
|
|
382
479
|
}
|
|
383
480
|
const modules = getSetup(config);
|
|
@@ -541,34 +638,8 @@ async function getSmartAccount(config, client, chain) {
|
|
|
541
638
|
case 'startale': {
|
|
542
639
|
return getStartaleSmartAccount(client, address, config.owners, ownerValidator.address, signFn);
|
|
543
640
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
async function getGuardianSmartAccount(config, client, chain, guardians) {
|
|
547
|
-
const address = getAddress(config);
|
|
548
|
-
const accounts = guardians.type === 'ecdsa' ? guardians.accounts : [];
|
|
549
|
-
const socialRecoveryValidator = getSocialRecoveryValidator(accounts);
|
|
550
|
-
if (!socialRecoveryValidator) {
|
|
551
|
-
throw new Error('Social recovery is not available');
|
|
552
|
-
}
|
|
553
|
-
const signers = {
|
|
554
|
-
type: 'guardians',
|
|
555
|
-
guardians: accounts,
|
|
556
|
-
};
|
|
557
|
-
const signFn = (hash) => signMessage(signers, chain, address, hash, true);
|
|
558
|
-
const account = getAccountProvider(config);
|
|
559
|
-
switch (account.type) {
|
|
560
|
-
case 'safe': {
|
|
561
|
-
return getSafeGuardianSmartAccount(client, address, guardians, socialRecoveryValidator.address, signFn);
|
|
562
|
-
}
|
|
563
|
-
case 'nexus': {
|
|
564
|
-
const defaultValidatorAddress = getNexusDefaultValidatorAddress(account.version);
|
|
565
|
-
return getNexusGuardianSmartAccount(client, address, guardians, socialRecoveryValidator.address, signFn, defaultValidatorAddress);
|
|
566
|
-
}
|
|
567
|
-
case 'kernel': {
|
|
568
|
-
return getKernelGuardianSmartAccount(client, address, guardians, socialRecoveryValidator.address, signFn);
|
|
569
|
-
}
|
|
570
|
-
case 'startale': {
|
|
571
|
-
return getStartaleGuardianSmartAccount(client, address, guardians, socialRecoveryValidator.address, signFn);
|
|
641
|
+
case 'hca': {
|
|
642
|
+
return getHcaSmartAccount(client, address, config.owners, ownerValidator.address, signFn);
|
|
572
643
|
}
|
|
573
644
|
}
|
|
574
645
|
}
|
|
@@ -584,6 +655,6 @@ function getAccountProvider(config) {
|
|
|
584
655
|
type: 'nexus',
|
|
585
656
|
};
|
|
586
657
|
}
|
|
587
|
-
export { getEip712Domain, getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, checkAddress, getAccountProvider, getInitCode, getV0InitCode, signEip7702InitData, getEip7702InitCall, is7702, isDeployed, deploy, setup, toErc6492Signature, getSmartAccount,
|
|
658
|
+
export { getEip712Domain, getModuleInstallationCalls, getValidatorInstallationCalls, getModuleUninstallationCalls, getAddress, checkAddress, getAccountProvider, getInitCode, getV0InitCode, signEip7702InitData, getEip7702InitCall, is7702, isDeployed, deploy, setup, toErc6492Signature, getSmartAccount, getEip1271Signature, getEmissarySignature, getTypedDataPackedSignature,
|
|
588
659
|
// Errors
|
|
589
|
-
isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError,
|
|
660
|
+
isAccountError, AccountError, AccountConfigurationNotSupportedError, DefaultValidatorAlreadyInitializedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, FactoryArgsNotAvailableError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, WalletClientNoConnectedAccountError, };
|
|
@@ -22,6 +22,5 @@ declare function getInstallData(module: Module): Hex[];
|
|
|
22
22
|
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
23
23
|
declare function wrapMessageHash(messageHash: Hex, accountAddress: Hex): Hex;
|
|
24
24
|
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
25
|
-
|
|
26
|
-
export { getEip712Domain, getInstallData, getAddress, getDeployArgs, getSmartAccount, getGuardianSmartAccount, packSignature, wrapMessageHash, };
|
|
25
|
+
export { getEip712Domain, getInstallData, getAddress, getDeployArgs, getSmartAccount, packSignature, wrapMessageHash, };
|
|
27
26
|
//# 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,OAA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AACb,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAKL,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EAAiB,QAAQ,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAKhF,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAgBhF,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;SAmFrD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBAalD;AAED,iBAAS,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK;;;;;;EAarE;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;AA+ED,OAAO,EACL,eAAe,EACf,cAAc,EACd,UAAU,EACV,aAAa,EACb,eAAe,EACf,aAAa,EACb,eAAe,GAChB,CAAA"}
|
|
@@ -194,13 +194,6 @@ async function getSmartAccount(client, address, owners, validatorAddress, sign)
|
|
|
194
194
|
return getMockSignature(owners);
|
|
195
195
|
}, sign);
|
|
196
196
|
}
|
|
197
|
-
async function getGuardianSmartAccount(client, address, guardians, validatorAddress, sign) {
|
|
198
|
-
return await getBaseSmartAccount(address, client, validatorAddress, 'validator', async () => {
|
|
199
|
-
return getMockSignature(guardians);
|
|
200
|
-
}, async (hash) => {
|
|
201
|
-
return await sign(hash);
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
197
|
async function getBaseSmartAccount(address, client, validatorAddress, validatorType, getStubSignature, signUserOperation) {
|
|
205
198
|
return await toSmartAccount({
|
|
206
199
|
client,
|
|
@@ -269,4 +262,4 @@ async function getBaseSmartAccount(address, client, validatorAddress, validatorT
|
|
|
269
262
|
},
|
|
270
263
|
});
|
|
271
264
|
}
|
|
272
|
-
export { getEip712Domain, getInstallData, getAddress, getDeployArgs, getSmartAccount,
|
|
265
|
+
export { getEip712Domain, getInstallData, getAddress, getDeployArgs, getSmartAccount, packSignature, wrapMessageHash, };
|