@charterlabs/rhinestone-sdk 0.2.8 → 0.2.9
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 +4 -1
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +9 -1
- package/dist/src/accounts/index.d.ts +9 -2
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +26 -1
- package/dist/src/accounts/json-rpc/index.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/index.js +4 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.test.js +33 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +2 -1
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/providers.js +8 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.test.js +43 -0
- package/dist/src/accounts/kernel.d.ts +9 -2
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +13 -0
- package/dist/src/accounts/nexus.d.ts +9 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +15 -1
- package/dist/src/accounts/passport.d.ts +4 -4
- package/dist/src/accounts/passport.d.ts.map +1 -1
- package/dist/src/accounts/safe.d.ts +9 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +15 -0
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +26 -5
- package/dist/src/accounts/signing/message.js +1 -1
- package/dist/src/accounts/startale.d.ts +9 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +15 -0
- package/dist/src/accounts/walletClient.d.ts +27 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -1
- package/dist/src/accounts/walletClient.js +77 -0
- package/dist/src/actions/smart-sessions.d.ts +2 -11
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +0 -10
- package/dist/src/errors/index.d.ts +3 -3
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +3 -1
- package/dist/src/execution/index.d.ts +8 -3
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +27 -7
- package/dist/src/execution/singleChainOps.d.ts +28 -0
- package/dist/src/execution/singleChainOps.d.ts.map +1 -0
- package/dist/src/execution/{multiChainOps.js → singleChainOps.js} +7 -14
- package/dist/src/execution/smart-session.d.ts +5 -7
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +113 -228
- package/dist/src/execution/utils.d.ts +2 -2
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +81 -22
- package/dist/src/index.d.ts +14 -16
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +15 -6
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +1 -1
- package/dist/src/modules/validators/core.d.ts +5 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +39 -2
- package/dist/src/modules/validators/smart-sessions.d.ts +6 -6
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +23 -12
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +13 -1
- package/dist/src/orchestrator/error.d.ts +27 -1
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +10 -1
- package/dist/src/orchestrator/index.d.ts +6 -6
- 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 +6 -2
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +16 -64
- package/dist/src/orchestrator/registry.test.js +24 -24
- package/dist/src/orchestrator/types.d.ts +37 -23
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.js +9 -5
- package/dist/src/types.d.ts +30 -7
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/src/execution/multiChainOps.d.ts +0 -40
- package/dist/src/execution/multiChainOps.d.ts.map +0 -1
- package/dist/src/execution/smart-session.test.d.ts +0 -2
- package/dist/src/execution/smart-session.test.d.ts.map +0 -1
- package/dist/src/execution/smart-session.test.js +0 -34
|
@@ -99,6 +99,9 @@ declare class OwnersFieldRequiredError extends AccountError {
|
|
|
99
99
|
traceId?: string;
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
+
declare class Eip712DomainNotAvailableError extends AccountError {
|
|
103
|
+
constructor(message: string);
|
|
104
|
+
}
|
|
102
105
|
declare function isAccountError(error: Error): error is AccountError;
|
|
103
|
-
export { isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, AccountConfigurationNotSupportedError, WalletClientNoConnectedAccountError, ModuleInstallationNotSupportedError, EoaSigningNotSupportedError, EoaSigningMethodNotConfiguredError, OwnersFieldRequiredError, };
|
|
106
|
+
export { isAccountError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, AccountConfigurationNotSupportedError, WalletClientNoConnectedAccountError, ModuleInstallationNotSupportedError, EoaSigningNotSupportedError, EoaSigningMethodNotConfiguredError, OwnersFieldRequiredError, };
|
|
104
107
|
//# sourceMappingURL=error.d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;gBAC1C,OAAO,EAAE,MAAM;CAK5B;AAED,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,YAAY,CAE3D;AAiBD,OAAO,EACL,cAAc,EACd,YAAY,EACZ,6BAA6B,EAC7B,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,kCAAkC,EAClC,qCAAqC,EACrC,mCAAmC,EACnC,mCAAmC,EACnC,2BAA2B,EAC3B,kCAAkC,EAClC,wBAAwB,GACzB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OwnersFieldRequiredError = exports.EoaSigningMethodNotConfiguredError = exports.EoaSigningNotSupportedError = exports.ModuleInstallationNotSupportedError = exports.WalletClientNoConnectedAccountError = exports.AccountConfigurationNotSupportedError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = void 0;
|
|
3
|
+
exports.OwnersFieldRequiredError = exports.EoaSigningMethodNotConfiguredError = exports.EoaSigningNotSupportedError = exports.ModuleInstallationNotSupportedError = exports.WalletClientNoConnectedAccountError = exports.AccountConfigurationNotSupportedError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.Eip712DomainNotAvailableError = exports.AccountError = void 0;
|
|
4
4
|
exports.isAccountError = isAccountError;
|
|
5
5
|
class AccountError extends Error {
|
|
6
6
|
_message;
|
|
@@ -138,6 +138,14 @@ class OwnersFieldRequiredError extends AccountError {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
exports.OwnersFieldRequiredError = OwnersFieldRequiredError;
|
|
141
|
+
class Eip712DomainNotAvailableError extends AccountError {
|
|
142
|
+
constructor(message) {
|
|
143
|
+
super({
|
|
144
|
+
message,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.Eip712DomainNotAvailableError = Eip712DomainNotAvailableError;
|
|
141
149
|
function isAccountError(error) {
|
|
142
150
|
return error instanceof AccountError;
|
|
143
151
|
}
|
|
@@ -2,7 +2,7 @@ import { type Account, type Chain, type HashTypedDataParameters, type Hex, type
|
|
|
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, RhinestoneConfig, Session, SignerSet } from '../types';
|
|
5
|
-
import { AccountConfigurationNotSupportedError, AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from './error';
|
|
5
|
+
import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from './error';
|
|
6
6
|
import { type ValidatorConfig } from './utils';
|
|
7
7
|
declare function getInitCode(config: RhinestoneConfig): {
|
|
8
8
|
address: import("viem").Address;
|
|
@@ -18,6 +18,13 @@ declare function getEip7702InitCall(config: RhinestoneConfig, signature: Hex): P
|
|
|
18
18
|
initData: `0x${string}`;
|
|
19
19
|
contract: `0x${string}`;
|
|
20
20
|
}>;
|
|
21
|
+
declare function getEip712Domain(config: RhinestoneConfig, chain: Chain): {
|
|
22
|
+
name: string;
|
|
23
|
+
version: string;
|
|
24
|
+
chainId: number;
|
|
25
|
+
verifyingContract: `0x${string}`;
|
|
26
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
27
|
+
};
|
|
21
28
|
declare function getModuleInstallationCalls(config: RhinestoneConfig, module: Module): Call[];
|
|
22
29
|
declare function getModuleUninstallationCalls(config: RhinestoneConfig, module: Module): Call[];
|
|
23
30
|
declare function getAddress(config: RhinestoneConfig): `0x${string}`;
|
|
@@ -37,5 +44,5 @@ declare function getSmartSessionSmartAccount(config: RhinestoneConfig, client: P
|
|
|
37
44
|
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>;
|
|
38
45
|
declare function is7702(config: RhinestoneConfig): boolean;
|
|
39
46
|
declare function getAccountProvider(config: RhinestoneConfig): AccountProviderConfig;
|
|
40
|
-
export { getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, checkAddress, getAccountProvider, getInitCode, signEip7702InitData, getEip7702InitCall, is7702, isDeployed, deploy, setup, toErc6492Signature, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, getTypedDataPackedSignature, deployStandaloneWithEoa, isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError, };
|
|
47
|
+
export { getEip712Domain, getModuleInstallationCalls, getModuleUninstallationCalls, getAddress, checkAddress, getAccountProvider, getInitCode, signEip7702InitData, getEip7702InitCall, is7702, isDeployed, deploy, setup, toErc6492Signature, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, getTypedDataPackedSignature, deployStandaloneWithEoa, isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaSigningMethodNotConfiguredError, EoaSigningNotSupportedError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, ModuleInstallationNotSupportedError, OwnersFieldRequiredError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError, };
|
|
41
48
|
//# 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,OAAO,EACZ,KAAK,KAAK,EAMV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAER,KAAK,YAAY,EAEjB,KAAK,SAAS,EAGf,MAAM,MAAM,CAAA;AAWb,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAM/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EACV,qBAAqB,EACrB,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,SAAS,EACV,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,8BAA8B,EAC9B,kCAAkC,EAClC,kCAAkC,EAClC,2BAA2B,EAC3B,wCAAwC,EACxC,4BAA4B,EAC5B,cAAc,EACd,mCAAmC,EACnC,wBAAwB,EACxB,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,EACpC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d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|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WalletClientNoConnectedAccountError = exports.SmartSessionsNotEnabledError = exports.SigningNotSupportedForAccountError = exports.OwnersFieldRequiredError = exports.ModuleInstallationNotSupportedError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.EoaSigningNotSupportedError = exports.EoaSigningMethodNotConfiguredError = exports.Eip7702NotSupportedForAccountError = exports.Eip7702AccountMustHaveEoaError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
|
|
3
|
+
exports.WalletClientNoConnectedAccountError = exports.SmartSessionsNotEnabledError = exports.SigningNotSupportedForAccountError = exports.OwnersFieldRequiredError = exports.ModuleInstallationNotSupportedError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.EoaSigningNotSupportedError = exports.EoaSigningMethodNotConfiguredError = exports.Eip7702NotSupportedForAccountError = exports.Eip7702AccountMustHaveEoaError = exports.Eip712DomainNotAvailableError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
|
|
4
|
+
exports.getEip712Domain = getEip712Domain;
|
|
4
5
|
exports.getModuleInstallationCalls = getModuleInstallationCalls;
|
|
5
6
|
exports.getModuleUninstallationCalls = getModuleUninstallationCalls;
|
|
6
7
|
exports.getAddress = getAddress;
|
|
@@ -29,6 +30,7 @@ const core_1 = require("../modules/validators/core");
|
|
|
29
30
|
const error_1 = require("./error");
|
|
30
31
|
Object.defineProperty(exports, "AccountConfigurationNotSupportedError", { enumerable: true, get: function () { return error_1.AccountConfigurationNotSupportedError; } });
|
|
31
32
|
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return error_1.AccountError; } });
|
|
33
|
+
Object.defineProperty(exports, "Eip712DomainNotAvailableError", { enumerable: true, get: function () { return error_1.Eip712DomainNotAvailableError; } });
|
|
32
34
|
Object.defineProperty(exports, "Eip7702AccountMustHaveEoaError", { enumerable: true, get: function () { return error_1.Eip7702AccountMustHaveEoaError; } });
|
|
33
35
|
Object.defineProperty(exports, "Eip7702NotSupportedForAccountError", { enumerable: true, get: function () { return error_1.Eip7702NotSupportedForAccountError; } });
|
|
34
36
|
Object.defineProperty(exports, "EoaSigningMethodNotConfiguredError", { enumerable: true, get: function () { return error_1.EoaSigningMethodNotConfiguredError; } });
|
|
@@ -141,6 +143,29 @@ async function getEip7702InitCall(config, signature) {
|
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
}
|
|
146
|
+
function getEip712Domain(config, chain) {
|
|
147
|
+
const account = getAccountProvider(config);
|
|
148
|
+
switch (account.type) {
|
|
149
|
+
case 'nexus': {
|
|
150
|
+
return (0, nexus_1.getEip712Domain)(config, chain);
|
|
151
|
+
}
|
|
152
|
+
case 'safe': {
|
|
153
|
+
return (0, safe_1.getEip712Domain)(config, chain);
|
|
154
|
+
}
|
|
155
|
+
case 'kernel': {
|
|
156
|
+
return (0, kernel_1.getEip712Domain)(config, chain);
|
|
157
|
+
}
|
|
158
|
+
case 'startale': {
|
|
159
|
+
return (0, startale_1.getEip712Domain)(config, chain);
|
|
160
|
+
}
|
|
161
|
+
case 'eoa': {
|
|
162
|
+
throw new error_1.Eip712DomainNotAvailableError('EOA accounts do not have an EIP-712 domain');
|
|
163
|
+
}
|
|
164
|
+
default: {
|
|
165
|
+
throw new error_1.Eip712DomainNotAvailableError(`Account type ${account.type} not yet supported`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
144
169
|
function getModuleInstallationCalls(config, module) {
|
|
145
170
|
const address = getAddress(config);
|
|
146
171
|
function getInstallData() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAQ,KAAK,SAAS,EAAE,MAAM,MAAM,CAAA;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,iBAAS,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAQ,KAAK,SAAS,EAAE,MAAM,MAAM,CAAA;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,iBAAS,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAkB3E;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -12,5 +12,9 @@ function createTransport(chain, provider) {
|
|
|
12
12
|
const alchemyUrl = (0, providers_1.getAlchemyUrl)(chain.id, provider.apiKey);
|
|
13
13
|
return (0, viem_1.http)(alchemyUrl);
|
|
14
14
|
}
|
|
15
|
+
case 'custom': {
|
|
16
|
+
const customUrl = (0, providers_1.getCustomUrl)(chain.id, provider.urls);
|
|
17
|
+
return (0, viem_1.http)(customUrl);
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const chains_1 = require("viem/chains");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
(0, vitest_1.describe)('JSON-RPC', () => {
|
|
7
|
+
(0, vitest_1.describe)('createTransport', () => {
|
|
8
|
+
(0, vitest_1.test)('Alchemy', () => {
|
|
9
|
+
const transport = (0, index_1.createTransport)(chains_1.base, {
|
|
10
|
+
type: 'alchemy',
|
|
11
|
+
apiKey: '123',
|
|
12
|
+
});
|
|
13
|
+
(0, vitest_1.expect)(transport).toBeDefined();
|
|
14
|
+
});
|
|
15
|
+
(0, vitest_1.test)('Custom', () => {
|
|
16
|
+
const transport = (0, index_1.createTransport)(chains_1.mainnet, {
|
|
17
|
+
type: 'custom',
|
|
18
|
+
urls: {
|
|
19
|
+
[chains_1.mainnet.id]: 'https://my-rpc.example.com',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
(0, vitest_1.expect)(transport).toBeDefined();
|
|
23
|
+
});
|
|
24
|
+
(0, vitest_1.test)('Custom throws error when URL not configured for chain', () => {
|
|
25
|
+
(0, vitest_1.expect)(() => (0, index_1.createTransport)(chains_1.mainnet, {
|
|
26
|
+
type: 'custom',
|
|
27
|
+
urls: {
|
|
28
|
+
[chains_1.base.id]: 'https://my-rpc.example.com',
|
|
29
|
+
},
|
|
30
|
+
})).toThrow('No custom provider URL configured for chain 1');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SupportedChain } from '../../orchestrator';
|
|
2
2
|
declare function getAlchemyUrl(chainId: SupportedChain, apiKey: string): string;
|
|
3
|
-
|
|
3
|
+
declare function getCustomUrl(chainId: number, urls: Record<number, string>): string;
|
|
4
|
+
export { getAlchemyUrl, getCustomUrl };
|
|
4
5
|
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/providers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,iBAAS,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAetE;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/providers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,iBAAS,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAetE;AAED,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAM3E;AAED,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.getAlchemyUrl = getAlchemyUrl;
|
|
37
|
+
exports.getCustomUrl = getCustomUrl;
|
|
37
38
|
const sharedConfigs = __importStar(require("@rhinestone/shared-configs"));
|
|
38
39
|
function getAlchemyUrl(chainId, apiKey) {
|
|
39
40
|
const providers = sharedConfigs.providerRegistry ||
|
|
@@ -50,3 +51,10 @@ function getAlchemyUrl(chainId, apiKey) {
|
|
|
50
51
|
.split('${ALCHEMY_API_KEY}')
|
|
51
52
|
.join(apiKey);
|
|
52
53
|
}
|
|
54
|
+
function getCustomUrl(chainId, urls) {
|
|
55
|
+
const url = urls[chainId];
|
|
56
|
+
if (!url) {
|
|
57
|
+
throw new Error(`No custom provider URL configured for chain ${chainId}`);
|
|
58
|
+
}
|
|
59
|
+
return url;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.test.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/providers.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const chains_1 = require("viem/chains");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
const providers_1 = require("./providers");
|
|
6
|
+
(0, vitest_1.describe)('Providers', () => {
|
|
7
|
+
(0, vitest_1.describe)('Alchemy', () => {
|
|
8
|
+
(0, vitest_1.test)('Network', () => {
|
|
9
|
+
const mockApiKey = '123';
|
|
10
|
+
(0, vitest_1.expect)((0, providers_1.getAlchemyUrl)(chains_1.arbitrum.id, mockApiKey)).toBe('https://arb-mainnet.g.alchemy.com/v2/123');
|
|
11
|
+
(0, vitest_1.expect)((0, providers_1.getAlchemyUrl)(chains_1.sepolia.id, mockApiKey)).toBe('https://eth-sepolia.g.alchemy.com/v2/123');
|
|
12
|
+
(0, vitest_1.expect)((0, providers_1.getAlchemyUrl)(chains_1.polygon.id, mockApiKey)).toBe('https://polygon-mainnet.g.alchemy.com/v2/123');
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
(0, vitest_1.describe)('Custom', () => {
|
|
16
|
+
(0, vitest_1.test)('Returns URL for configured chain', () => {
|
|
17
|
+
const urls = {
|
|
18
|
+
[chains_1.arbitrum.id]: 'https://my-rpc.example.com/mainnet',
|
|
19
|
+
[chains_1.sepolia.id]: 'https://my-rpc.example.com/sepolia',
|
|
20
|
+
};
|
|
21
|
+
(0, vitest_1.expect)((0, providers_1.getCustomUrl)(chains_1.arbitrum.id, urls)).toBe('https://my-rpc.example.com/mainnet');
|
|
22
|
+
(0, vitest_1.expect)((0, providers_1.getCustomUrl)(chains_1.sepolia.id, urls)).toBe('https://my-rpc.example.com/sepolia');
|
|
23
|
+
});
|
|
24
|
+
(0, vitest_1.test)('Throws error when chain not configured', () => {
|
|
25
|
+
const urls = {
|
|
26
|
+
[chains_1.arbitrum.id]: 'https://my-rpc.example.com/mainnet',
|
|
27
|
+
};
|
|
28
|
+
(0, vitest_1.expect)(() => (0, providers_1.getCustomUrl)(chains_1.sepolia.id, urls)).toThrow('No custom provider URL configured for chain 11155111');
|
|
29
|
+
});
|
|
30
|
+
(0, vitest_1.test)('Accepts HTTP URLs', () => {
|
|
31
|
+
const urls = {
|
|
32
|
+
[chains_1.arbitrum.id]: 'http://localhost:8545',
|
|
33
|
+
};
|
|
34
|
+
(0, vitest_1.expect)((0, providers_1.getCustomUrl)(chains_1.arbitrum.id, urls)).toBe('http://localhost:8545');
|
|
35
|
+
});
|
|
36
|
+
(0, vitest_1.test)('Accepts HTTPS URLs', () => {
|
|
37
|
+
const urls = {
|
|
38
|
+
[chains_1.arbitrum.id]: 'https://my-rpc.example.com',
|
|
39
|
+
};
|
|
40
|
+
(0, vitest_1.expect)((0, providers_1.getCustomUrl)(chains_1.arbitrum.id, urls)).toBe('https://my-rpc.example.com');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Abi, type Address, type Hex, type PublicClient } from 'viem';
|
|
1
|
+
import { type Abi, type Address, type Chain, type Hex, type PublicClient } from 'viem';
|
|
2
2
|
import { type SmartAccount, type SmartAccountImplementation } from 'viem/account-abstraction';
|
|
3
3
|
import { type Module } from '../modules/common';
|
|
4
4
|
import type { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
@@ -12,11 +12,18 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
|
12
12
|
salt: `0x${string}`;
|
|
13
13
|
};
|
|
14
14
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
15
|
+
declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
chainId: number;
|
|
19
|
+
verifyingContract: `0x${string}`;
|
|
20
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
21
|
+
};
|
|
15
22
|
declare function getInstallData(module: Module): Hex[];
|
|
16
23
|
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
17
24
|
declare function wrapMessageHash(messageHash: Hex, accountAddress: Hex): Hex;
|
|
18
25
|
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
19
26
|
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">>>;
|
|
20
27
|
declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
21
|
-
export { getInstallData, getAddress, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, packSignature, wrapMessageHash, };
|
|
28
|
+
export { getEip712Domain, getInstallData, getAddress, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, packSignature, wrapMessageHash, };
|
|
22
29
|
//# sourceMappingURL=kernel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../accounts/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../accounts/kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,KAAK,EASV,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,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,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAclC;AA+ED,OAAO,EACL,eAAe,EACf,cAAc,EACd,UAAU,EACV,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,eAAe,GAChB,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEip712Domain = getEip712Domain;
|
|
3
4
|
exports.getInstallData = getInstallData;
|
|
4
5
|
exports.getAddress = getAddress;
|
|
5
6
|
exports.getDeployArgs = getDeployArgs;
|
|
@@ -97,6 +98,18 @@ function getAddress(config) {
|
|
|
97
98
|
salt: actualSalt,
|
|
98
99
|
});
|
|
99
100
|
}
|
|
101
|
+
function getEip712Domain(config, chain) {
|
|
102
|
+
if (config.initData) {
|
|
103
|
+
throw new error_1.Eip712DomainNotAvailableError('Existing Kernel accounts are not yet supported');
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
name: 'Kernel',
|
|
107
|
+
version: KERNEL_VERSION,
|
|
108
|
+
chainId: chain.id,
|
|
109
|
+
verifyingContract: getAddress(config),
|
|
110
|
+
salt: viem_1.zeroHash,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
100
113
|
function getInstallData(module) {
|
|
101
114
|
const HOOK_INSTALLED_ADDRESS = '0x0000000000000000000000000000000000000001';
|
|
102
115
|
switch (module.type) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Abi, Account, Address, Hex, PublicClient } from 'viem';
|
|
1
|
+
import type { Abi, Account, Address, Chain, Hex, PublicClient } from 'viem';
|
|
2
2
|
import { type SmartAccount, type SmartAccountImplementation } from 'viem/account-abstraction';
|
|
3
3
|
import type { Module } from '../modules/common';
|
|
4
4
|
import type { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
@@ -13,6 +13,13 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
|
13
13
|
initializationCallData: `0x${string}`;
|
|
14
14
|
};
|
|
15
15
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
16
|
+
declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
|
|
17
|
+
name: string;
|
|
18
|
+
version: string;
|
|
19
|
+
chainId: number;
|
|
20
|
+
verifyingContract: `0x${string}`;
|
|
21
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
22
|
+
};
|
|
16
23
|
declare function getInstallData(module: Module): `0x${string}`;
|
|
17
24
|
declare function getDefaultValidatorAddress(version: '1.0.2' | '1.2.0' | 'rhinestone-1.0.0-beta' | 'rhinestone-1.0.0' | undefined): Address;
|
|
18
25
|
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex, defaultValidatorAddress?: Address): Promise<`0x${string}`>;
|
|
@@ -24,5 +31,5 @@ declare function getEip7702InitCall(config: RhinestoneAccountConfig, signature:
|
|
|
24
31
|
initData: `0x${string}`;
|
|
25
32
|
contract: `0x${string}`;
|
|
26
33
|
}>;
|
|
27
|
-
export { getInstallData, getAddress, getDefaultValidatorAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, signEip7702InitData, getEip7702InitCall, };
|
|
34
|
+
export { getEip712Domain, getInstallData, getAddress, getDefaultValidatorAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, signEip7702InitData, getEip7702InitCall, };
|
|
28
35
|
//# sourceMappingURL=nexus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nexus.d.ts","sourceRoot":"","sources":["../../../accounts/nexus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"nexus.d.ts","sourceRoot":"","sources":["../../../accounts/nex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,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,EACjC,uBAAuB,GAAE,OAAyC,iEAwCnE;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,EACjC,uBAAuB,GAAE,OAAyC,iEAcnE;AAqFD,iBAAe,mBAAmB,CAChC,MAAM,EAAE,uBAAuB,EAC/B,GAAG,EAAE,OAAO,0BA0Bb;AAED,iBAAe,kBAAkB,CAC/B,MAAM,EAAE,uBAAuB,EAC/B,SAAS,EAAE,GAAG;;;GAuCf;AAED,OAAO,EACL,eAAe,EACf,cAAc,EACd,UAAU,EACV,0BAA0B,EAC1B,aAAa,EACb,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,GACnB,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEip712Domain = getEip712Domain;
|
|
3
4
|
exports.getInstallData = getInstallData;
|
|
4
5
|
exports.getAddress = getAddress;
|
|
5
6
|
exports.getDefaultValidatorAddress = getDefaultValidatorAddress;
|
|
@@ -18,6 +19,7 @@ const core_1 = require("../modules/validators/core");
|
|
|
18
19
|
const error_1 = require("./error");
|
|
19
20
|
const utils_1 = require("./utils");
|
|
20
21
|
const NEXUS_DEFAULT_VALIDATOR_ADDRESS = core_1.OWNABLE_VALIDATOR_ADDRESS;
|
|
22
|
+
const NEXUS_VERSION = '1.2.0';
|
|
21
23
|
const NEXUS_IMPLEMENTATION_ADDRESS = '0x000000000032dDC454C3BDcba80484Ad5A798705';
|
|
22
24
|
const NEXUS_FACTORY_ADDRESS = '0x0000000000679A258c64d2F20F310e12B64b7375';
|
|
23
25
|
const NEXUS_BOOTSTRAP_ADDRESS = '0x00000000006eFb61D8c9546FF1B500de3f244EA7';
|
|
@@ -176,6 +178,18 @@ function getAddress(config) {
|
|
|
176
178
|
});
|
|
177
179
|
return address;
|
|
178
180
|
}
|
|
181
|
+
function getEip712Domain(config, chain) {
|
|
182
|
+
if (config.initData) {
|
|
183
|
+
throw new error_1.Eip712DomainNotAvailableError('Existing Nexus accounts are not yet supported');
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
name: 'Nexus',
|
|
187
|
+
version: NEXUS_VERSION,
|
|
188
|
+
chainId: chain.id,
|
|
189
|
+
verifyingContract: getAddress(config),
|
|
190
|
+
salt: viem_1.zeroHash,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
179
193
|
function getInstallData(module) {
|
|
180
194
|
return (0, viem_1.encodeFunctionData)({
|
|
181
195
|
abi: [
|
|
@@ -334,7 +348,7 @@ async function signEip7702InitData(config, eoa) {
|
|
|
334
348
|
const signature = await eoa.signTypedData({
|
|
335
349
|
domain: {
|
|
336
350
|
name: 'Nexus',
|
|
337
|
-
version:
|
|
351
|
+
version: NEXUS_VERSION,
|
|
338
352
|
},
|
|
339
353
|
types: {
|
|
340
354
|
Initialize: [
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { 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';
|
|
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
5
|
import type { RhinestoneAccountConfig, Session } from '../types';
|
|
6
|
-
import { ValidatorConfig } from './utils';
|
|
6
|
+
import { type ValidatorConfig } from './utils';
|
|
7
7
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
8
8
|
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
9
9
|
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">>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passport.d.ts","sourceRoot":"","sources":["../../../accounts/passport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAW,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAWpE,OAAO,EAIL,YAAY,
|
|
1
|
+
{"version":3,"file":"passport.d.ts","sourceRoot":"","sources":["../../../accounts/passport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAW,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAWpE,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAK/C,OAAO,EACL,KAAK,iBAAiB,EAIvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAWhF,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBAsBlD;AAED,iBAAe,aAAa,CAC1B,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,eAAe,EAC1B,kBAAkB,GAAE,CAAC,SAAS,EAAE,GAAG,KAAK,GAA8B,0BAQvE;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,iEAuClC;AAmHD,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,iBA2BrC;AAED,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,sBAAsB,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Abi, type Address, type Hex, type PublicClient } from 'viem';
|
|
1
|
+
import { type Abi, type Address, type Chain, type Hex, type PublicClient } from 'viem';
|
|
2
2
|
import { type SmartAccount, type SmartAccountImplementation } from 'viem/account-abstraction';
|
|
3
3
|
import type { Module } from '../modules/common';
|
|
4
4
|
import type { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
@@ -12,10 +12,17 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
|
12
12
|
initializationCallData: null;
|
|
13
13
|
};
|
|
14
14
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
15
|
+
declare function getEip712Domain(config: RhinestoneAccountConfig, chain: Chain): {
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
chainId: number;
|
|
19
|
+
verifyingContract: `0x${string}`;
|
|
20
|
+
salt: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
21
|
+
};
|
|
15
22
|
declare function getInstallData(module: Module): `0x${string}`;
|
|
16
23
|
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
17
24
|
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
18
25
|
declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, enableData: EnableSessionData | null, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
19
26
|
declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
20
|
-
export { getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
|
|
27
|
+
export { getEip712Domain, getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
|
|
21
28
|
//# sourceMappingURL=safe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../../accounts/safe.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../../accounts/safe.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,KAAK,EAOV,KAAK,GAAG,EAER,KAAK,YAAY,EAKlB,MAAM,MAAM,CAAA;AACb,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAQ/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,C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
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEip712Domain = getEip712Domain;
|
|
3
4
|
exports.getInstallData = getInstallData;
|
|
4
5
|
exports.getAddress = getAddress;
|
|
5
6
|
exports.packSignature = packSignature;
|
|
@@ -111,6 +112,18 @@ function getAddress(config) {
|
|
|
111
112
|
});
|
|
112
113
|
return address;
|
|
113
114
|
}
|
|
115
|
+
function getEip712Domain(config, chain) {
|
|
116
|
+
if (config.initData) {
|
|
117
|
+
throw new error_1.Eip712DomainNotAvailableError('Existing Safe-7579 accounts are not yet supported');
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
name: 'rhinestone safe7579',
|
|
121
|
+
version: 'v1.0.0',
|
|
122
|
+
chainId: chain.id,
|
|
123
|
+
verifyingContract: getAddress(config),
|
|
124
|
+
salt: viem_1.zeroHash,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
114
127
|
function getInstallData(module) {
|
|
115
128
|
return (0, viem_1.encodeFunctionData)({
|
|
116
129
|
abi: [
|
|
@@ -240,6 +253,7 @@ function getOwners(config) {
|
|
|
240
253
|
const ownerSet = config.owners;
|
|
241
254
|
switch (ownerSet.type) {
|
|
242
255
|
case 'ecdsa':
|
|
256
|
+
case 'ens':
|
|
243
257
|
return ownerSet.accounts.map((account) => account.address);
|
|
244
258
|
case 'passkey':
|
|
245
259
|
return [NO_SAFE_OWNER_ADDRESS];
|
|
@@ -254,6 +268,7 @@ function getThreshold(config) {
|
|
|
254
268
|
const ownerSet = config.owners;
|
|
255
269
|
switch (ownerSet.type) {
|
|
256
270
|
case 'ecdsa':
|
|
271
|
+
case 'ens':
|
|
257
272
|
return ownerSet.threshold ? BigInt(ownerSet.threshold) : 1n;
|
|
258
273
|
case 'passkey':
|
|
259
274
|
return 1n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/common.ts"],"names":[],"mappings":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CAAC,CA8Dd;AAED,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,KAAK,gBAAgB,GACtB,CAAA"}
|
|
@@ -16,7 +16,15 @@ function convertOwnerSetToSignerSet(owners) {
|
|
|
16
16
|
type: 'owner',
|
|
17
17
|
kind: 'ecdsa',
|
|
18
18
|
accounts: owners.accounts,
|
|
19
|
-
module: owners.module,
|
|
19
|
+
module: owners.module ?? core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
case 'ens': {
|
|
23
|
+
return {
|
|
24
|
+
type: 'owner',
|
|
25
|
+
kind: 'ecdsa',
|
|
26
|
+
accounts: owners.accounts,
|
|
27
|
+
module: owners.module ?? core_1.ENS_VALIDATOR_ADDRESS,
|
|
20
28
|
};
|
|
21
29
|
}
|
|
22
30
|
case 'passkey': {
|
|
@@ -38,7 +46,15 @@ function convertOwnerSetToSignerSet(owners) {
|
|
|
38
46
|
type: validator.type,
|
|
39
47
|
id: index,
|
|
40
48
|
accounts: validator.accounts,
|
|
41
|
-
module: validator.module,
|
|
49
|
+
module: validator.module ?? core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
case 'ens': {
|
|
53
|
+
return {
|
|
54
|
+
type: 'ecdsa',
|
|
55
|
+
id: index,
|
|
56
|
+
accounts: validator.accounts,
|
|
57
|
+
module: validator.module ?? core_1.ENS_VALIDATOR_ADDRESS,
|
|
42
58
|
};
|
|
43
59
|
}
|
|
44
60
|
case 'passkey': {
|
|
@@ -49,6 +65,9 @@ function convertOwnerSetToSignerSet(owners) {
|
|
|
49
65
|
module: validator.module,
|
|
50
66
|
};
|
|
51
67
|
}
|
|
68
|
+
default: {
|
|
69
|
+
throw new Error(`Unsupported validator type: ${validator.type}`);
|
|
70
|
+
}
|
|
52
71
|
}
|
|
53
72
|
}),
|
|
54
73
|
};
|
|
@@ -104,10 +123,12 @@ async function signWithOwners(signers, chain, address, params, signingFunctions,
|
|
|
104
123
|
switch (signers.kind) {
|
|
105
124
|
case 'ecdsa': {
|
|
106
125
|
// Ownable validator uses `v` value to determine which validation mode to use
|
|
126
|
+
// ENS validator (based on Ownable) also uses the same signature format
|
|
107
127
|
// This is not needed for UserOps
|
|
108
|
-
const
|
|
109
|
-
signers.module?.toLowerCase() === core_1.OWNABLE_VALIDATOR_ADDRESS
|
|
110
|
-
|
|
128
|
+
const isOwnableOrENS = !signers.module ||
|
|
129
|
+
signers.module?.toLowerCase() === core_1.OWNABLE_VALIDATOR_ADDRESS ||
|
|
130
|
+
signers.module?.toLowerCase() === core_1.ENS_VALIDATOR_ADDRESS;
|
|
131
|
+
const updateV = isOwnableOrENS && !isUserOpHash;
|
|
111
132
|
const signatures = await Promise.all(signers.accounts.map((account) => signingFunctions.signEcdsa(account, params, updateV)));
|
|
112
133
|
return (0, viem_1.concat)(signatures);
|
|
113
134
|
}
|