@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
|
@@ -16,8 +16,8 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
16
16
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
17
17
|
});
|
|
18
18
|
(0, vitest_1.expect)(factory).toEqual('0x4e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67');
|
|
19
|
-
(0, vitest_1.expect)(factoryData).toEqual('
|
|
20
|
-
(0, vitest_1.expect)(salt).toEqual('
|
|
19
|
+
(0, vitest_1.expect)(factoryData).toEqual('0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000444b63e800d0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000075798463024bda64d83c94a64bc7d7eab41300ef00000000000000000000000000000000000000000000000000000000000001600000000000000000000000007579f2ad53b01c3d8779fe17928e0d48885b00030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb700000000000000000000000000000000000000000000000000000000000002a447cbbdca0000000000000000000000007579f2ad53b01c3d8779fe17928e0d48885b00030000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000e9e6e96bcaa3c113187cdb7e38aed90000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da09948693600000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
20
|
+
(0, vitest_1.expect)(salt).toEqual('0xcd22c6be130453e1c7a5617c2792d41dd1d8a3ce4024819179507b20de8201f5');
|
|
21
21
|
(0, vitest_1.expect)(implementation).toEqual('0x29fcb43b46531bca003ddc8fcb67ffe91900c762');
|
|
22
22
|
(0, vitest_1.expect)(initializationCallData).toEqual(null);
|
|
23
23
|
});
|
|
@@ -30,8 +30,8 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
30
30
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
31
31
|
});
|
|
32
32
|
(0, vitest_1.expect)(factory).toEqual('0x4e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67');
|
|
33
|
-
(0, vitest_1.expect)(factoryData).toEqual('
|
|
34
|
-
(0, vitest_1.expect)(salt).toEqual('
|
|
33
|
+
(0, vitest_1.expect)(factoryData).toEqual('0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c7620000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e4b63e800d0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000075798463024bda64d83c94a64bc7d7eab41300ef00000000000000000000000000000000000000000000000000000000000001400000000000000000000000007579f2ad53b01c3d8779fe17928e0d48885b00030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000babe99e62d8bcbd3acf5ccbcfcd4f64fe75e5e72000000000000000000000000000000000000000000000000000000000000026447cbbdca0000000000000000000000007579f2ad53b01c3d8779fe17928e0d48885b00030000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000578c4cb0e472a5462da43c495c3f33000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a00000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
34
|
+
(0, vitest_1.expect)(salt).toEqual('0x1774a1bf788cc08a2f87e82e78226fd1484c5dfc9d8ae3041cf96f478e470214');
|
|
35
35
|
(0, vitest_1.expect)(implementation).toEqual('0x29fcb43b46531bca003ddc8fcb67ffe91900c762');
|
|
36
36
|
(0, vitest_1.expect)(initializationCallData).toEqual(null);
|
|
37
37
|
});
|
|
@@ -45,7 +45,7 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
45
45
|
},
|
|
46
46
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
47
47
|
});
|
|
48
|
-
(0, vitest_1.expect)(address).toEqual('
|
|
48
|
+
(0, vitest_1.expect)(address).toEqual('0xd1f90bf932b56145800b608d9dd15c653270f042');
|
|
49
49
|
});
|
|
50
50
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
51
51
|
const address = (0, safe_1.getAddress)({
|
|
@@ -55,7 +55,7 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
55
55
|
},
|
|
56
56
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
57
57
|
});
|
|
58
|
-
(0, vitest_1.expect)(address).toEqual('
|
|
58
|
+
(0, vitest_1.expect)(address).toEqual('0xa4a75e55097539ef474613c56d2e70942af42e52');
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
61
|
(0, vitest_1.describe)('Get Install Data', () => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Address, Hex, PublicClient } from 'viem';
|
|
2
|
+
import type { Module } from '../modules/common';
|
|
3
|
+
import type { EnableSessionData } from '../modules/validators/smart-sessions';
|
|
4
|
+
import type { OwnerSet, RhinestoneAccountConfig, Session } from '../types';
|
|
5
|
+
import type { ValidatorConfig } from './utils';
|
|
6
|
+
declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
7
|
+
factory: `0x${string}`;
|
|
8
|
+
factoryData: `0x${string}`;
|
|
9
|
+
salt: `0x${string}`;
|
|
10
|
+
implementation: `0x${string}`;
|
|
11
|
+
initializationCallData: `0x${string}`;
|
|
12
|
+
};
|
|
13
|
+
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
14
|
+
declare function getInstallData(module: Module): `0x${string}`;
|
|
15
|
+
declare function getPackedSignature(signFn: (message: Hex) => Promise<Hex>, hash: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
16
|
+
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">>>;
|
|
17
|
+
declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, enableData: EnableSessionData | null, sign: (hash: Hex) => Promise<Hex>): Promise<import("viem/_types/account-abstraction").SmartAccount<import("viem/_types/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
18
|
+
declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: 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">>>;
|
|
19
|
+
export { getInstallData, getAddress, getPackedSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
|
|
20
|
+
//# sourceMappingURL=startale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAUlC;AAED,OAAO,EACL,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,GACxB,CAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInstallData = getInstallData;
|
|
4
|
+
exports.getAddress = getAddress;
|
|
5
|
+
exports.getPackedSignature = getPackedSignature;
|
|
6
|
+
exports.getDeployArgs = getDeployArgs;
|
|
7
|
+
exports.getSmartAccount = getSmartAccount;
|
|
8
|
+
exports.getSessionSmartAccount = getSessionSmartAccount;
|
|
9
|
+
exports.getGuardianSmartAccount = getGuardianSmartAccount;
|
|
10
|
+
const viem_1 = require("viem");
|
|
11
|
+
const modules_1 = require("../modules");
|
|
12
|
+
const nexus_1 = require("./nexus");
|
|
13
|
+
const K1_DEFAULT_VALIDATOR_ADDRESS = '0x00000072f286204bb934ed49d8969e86f7dec7b1';
|
|
14
|
+
const IMPLEMENTATION_ADDRESS = '0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a';
|
|
15
|
+
const FACTORY_ADDRESS = '0x0000003B3E7b530b4f981aE80d9350392Defef90';
|
|
16
|
+
const BOOTSTRAP_ADDRESS = '0x000000552A5fAe3Db7a8F3917C435448F49BA6a9';
|
|
17
|
+
const CREATION_CODE = '0x608060405261029d803803806100148161018c565b92833981016040828203126101885781516001600160a01b03811692909190838303610188576020810151906001600160401b03821161018857019281601f8501121561018857835161006e610069826101c5565b61018c565b9481865260208601936020838301011161018857815f926020809301865e8601015260017f754fd8b321c4649cb777ae6fdce7e89e9cceaa31a4f639795c7807eb7f1a27005d823b15610176577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916821790557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b5f80a282511561015e575f8091610146945190845af43d15610156573d91610137610069846101c5565b9283523d5f602085013e6101e0565b505b604051605e908161023f8239f35b6060916101e0565b50505034156101485763b398979f60e01b5f5260045ffd5b634c9c8ce360e01b5f5260045260245ffd5b5f80fd5b6040519190601f01601f191682016001600160401b038111838210176101b157604052565b634e487b7160e01b5f52604160045260245ffd5b6001600160401b0381116101b157601f01601f191660200190565b9061020457508051156101f557805190602001fd5b63d6bda27560e01b5f5260045ffd5b81511580610235575b610215575090565b639996b31560e01b5f9081526001600160a01b0391909116600452602490fd5b50803b1561020d56fe60806040523615605c575f8073ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5416368280378136915af43d5f803e156058573d5ff35b3d5ffd5b00';
|
|
18
|
+
function getDeployArgs(config) {
|
|
19
|
+
const salt = viem_1.zeroHash;
|
|
20
|
+
const moduleSetup = (0, modules_1.getSetup)(config);
|
|
21
|
+
const initData = (0, viem_1.encodeAbiParameters)([{ type: 'address' }, { type: 'bytes' }], [
|
|
22
|
+
BOOTSTRAP_ADDRESS,
|
|
23
|
+
(0, viem_1.encodeFunctionData)({
|
|
24
|
+
abi: (0, viem_1.parseAbi)([
|
|
25
|
+
'struct BootstrapConfig {address module;bytes initData;}',
|
|
26
|
+
'struct BootstrapPreValidationHookConfig {uint256 hookType;address module;bytes data;}',
|
|
27
|
+
'function init(BootstrapConfig[] calldata validators,BootstrapConfig[] calldata executors,BootstrapConfig calldata hook,BootstrapConfig[] calldata fallbacks,BootstrapPreValidationHookConfig[] calldata preValidationHooks) external',
|
|
28
|
+
]),
|
|
29
|
+
functionName: 'init',
|
|
30
|
+
args: [
|
|
31
|
+
moduleSetup.validators.map((v) => ({
|
|
32
|
+
module: v.address,
|
|
33
|
+
initData: v.initData,
|
|
34
|
+
})),
|
|
35
|
+
moduleSetup.executors.map((e) => ({
|
|
36
|
+
module: e.address,
|
|
37
|
+
initData: e.initData,
|
|
38
|
+
})),
|
|
39
|
+
{
|
|
40
|
+
module: viem_1.zeroAddress,
|
|
41
|
+
initData: '0x',
|
|
42
|
+
},
|
|
43
|
+
moduleSetup.fallbacks.map((f) => ({
|
|
44
|
+
module: f.address,
|
|
45
|
+
initData: f.initData,
|
|
46
|
+
})),
|
|
47
|
+
[],
|
|
48
|
+
],
|
|
49
|
+
}),
|
|
50
|
+
]);
|
|
51
|
+
const factoryData = (0, viem_1.encodeFunctionData)({
|
|
52
|
+
abi: (0, viem_1.parseAbi)(['function createAccount(bytes,bytes32)']),
|
|
53
|
+
functionName: 'createAccount',
|
|
54
|
+
args: [initData, salt],
|
|
55
|
+
});
|
|
56
|
+
const initializationCallData = (0, viem_1.encodeFunctionData)({
|
|
57
|
+
abi: (0, viem_1.parseAbi)(['function initializeAccount(bytes)']),
|
|
58
|
+
functionName: 'initializeAccount',
|
|
59
|
+
args: [initData],
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
factory: FACTORY_ADDRESS,
|
|
63
|
+
factoryData,
|
|
64
|
+
salt,
|
|
65
|
+
implementation: IMPLEMENTATION_ADDRESS,
|
|
66
|
+
initializationCallData,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function getAddress(config) {
|
|
70
|
+
const { factory, salt, initializationCallData } = getDeployArgs(config);
|
|
71
|
+
const accountInitData = (0, viem_1.encodeAbiParameters)([
|
|
72
|
+
{
|
|
73
|
+
name: 'address',
|
|
74
|
+
type: 'address',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'calldata',
|
|
78
|
+
type: 'bytes',
|
|
79
|
+
},
|
|
80
|
+
], [IMPLEMENTATION_ADDRESS, initializationCallData]);
|
|
81
|
+
const hashedInitcode = (0, viem_1.keccak256)((0, viem_1.concat)([CREATION_CODE, accountInitData]));
|
|
82
|
+
const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(['bytes1', 'address', 'bytes32', 'bytes'], ['0xff', factory, salt, hashedInitcode]));
|
|
83
|
+
const address = (0, viem_1.slice)(hash, 12, 32);
|
|
84
|
+
return address;
|
|
85
|
+
}
|
|
86
|
+
function getInstallData(module) {
|
|
87
|
+
return (0, nexus_1.getInstallData)(module);
|
|
88
|
+
}
|
|
89
|
+
async function getPackedSignature(signFn, hash, validator, transformSignature = (signature) => signature) {
|
|
90
|
+
return (0, nexus_1.getPackedSignature)(signFn, hash, validator, transformSignature, K1_DEFAULT_VALIDATOR_ADDRESS);
|
|
91
|
+
}
|
|
92
|
+
async function getSmartAccount(client, address, owners, validatorAddress, sign) {
|
|
93
|
+
return (0, nexus_1.getSmartAccount)(client, address, owners, validatorAddress, sign, K1_DEFAULT_VALIDATOR_ADDRESS);
|
|
94
|
+
}
|
|
95
|
+
async function getSessionSmartAccount(client, address, session, validatorAddress, enableData, sign) {
|
|
96
|
+
return (0, nexus_1.getSessionSmartAccount)(client, address, session, validatorAddress, enableData, sign, K1_DEFAULT_VALIDATOR_ADDRESS);
|
|
97
|
+
}
|
|
98
|
+
async function getGuardianSmartAccount(client, address, guardians, validatorAddress, sign) {
|
|
99
|
+
return (0, nexus_1.getGuardianSmartAccount)(client, address, guardians, validatorAddress, sign, K1_DEFAULT_VALIDATOR_ADDRESS);
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startale.test.d.ts","sourceRoot":"","sources":["../../../accounts/startale.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const consts_1 = require("../../test/consts");
|
|
5
|
+
const common_1 = require("../modules/common");
|
|
6
|
+
const startale_1 = require("./startale");
|
|
7
|
+
const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
8
|
+
(0, vitest_1.describe)('Accounts: Startale', () => {
|
|
9
|
+
(0, vitest_1.describe)('Deploy Args', () => {
|
|
10
|
+
(0, vitest_1.test)('ECDSA owners', () => {
|
|
11
|
+
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, startale_1.getDeployArgs)({
|
|
12
|
+
account: {
|
|
13
|
+
type: 'startale',
|
|
14
|
+
},
|
|
15
|
+
owners: {
|
|
16
|
+
type: 'ecdsa',
|
|
17
|
+
accounts: [consts_1.accountA, consts_1.accountB],
|
|
18
|
+
},
|
|
19
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
20
|
+
});
|
|
21
|
+
(0, vitest_1.expect)(factory).toEqual('0x0000003B3E7b530b4f981aE80d9350392Defef90');
|
|
22
|
+
(0, vitest_1.expect)(factoryData).toEqual('0xea6d13ac0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003240984b2f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000e9e6e96bcaa3c113187cdb7e38aed9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
23
|
+
(0, vitest_1.expect)(salt).toEqual('0x0000000000000000000000000000000000000000000000000000000000000000');
|
|
24
|
+
(0, vitest_1.expect)(implementation).toEqual('0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a');
|
|
25
|
+
(0, vitest_1.expect)(initializationCallData).toEqual('0x4b6a1419000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003240984b2f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000e9e6e96bcaa3c113187cdb7e38aed9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
26
|
+
});
|
|
27
|
+
(0, vitest_1.test)('Passkey owner', () => {
|
|
28
|
+
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, startale_1.getDeployArgs)({
|
|
29
|
+
account: {
|
|
30
|
+
type: 'startale',
|
|
31
|
+
},
|
|
32
|
+
owners: {
|
|
33
|
+
type: 'passkey',
|
|
34
|
+
account: consts_1.passkeyAccount,
|
|
35
|
+
},
|
|
36
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
37
|
+
});
|
|
38
|
+
(0, vitest_1.expect)(factory).toEqual('0x0000003B3E7b530b4f981aE80d9350392Defef90');
|
|
39
|
+
(0, vitest_1.expect)(factoryData).toEqual('0xea6d13ac000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002e40984b2f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000578c4cb0e472a5462da43c495c3f3300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
40
|
+
(0, vitest_1.expect)(salt).toEqual('0x0000000000000000000000000000000000000000000000000000000000000000');
|
|
41
|
+
(0, vitest_1.expect)(implementation).toEqual('0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a');
|
|
42
|
+
(0, vitest_1.expect)(initializationCallData).toEqual('0x4b6a141900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002e40984b2f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000578c4cb0e472a5462da43c495c3f3300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
(0, vitest_1.describe)('Get Address', () => {
|
|
46
|
+
(0, vitest_1.test)('ECDSA owners', () => {
|
|
47
|
+
const address = (0, startale_1.getAddress)({
|
|
48
|
+
account: {
|
|
49
|
+
type: 'startale',
|
|
50
|
+
},
|
|
51
|
+
owners: {
|
|
52
|
+
type: 'ecdsa',
|
|
53
|
+
accounts: [consts_1.accountA, consts_1.accountB],
|
|
54
|
+
},
|
|
55
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
56
|
+
});
|
|
57
|
+
(0, vitest_1.expect)(address).toEqual('0x387fb3ba7b2ebe1771144456d357c04207f3bd17');
|
|
58
|
+
});
|
|
59
|
+
(0, vitest_1.test)('Passkey owner', () => {
|
|
60
|
+
const address = (0, startale_1.getAddress)({
|
|
61
|
+
account: {
|
|
62
|
+
type: 'startale',
|
|
63
|
+
},
|
|
64
|
+
owners: {
|
|
65
|
+
type: 'passkey',
|
|
66
|
+
account: consts_1.passkeyAccount,
|
|
67
|
+
},
|
|
68
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
69
|
+
});
|
|
70
|
+
(0, vitest_1.expect)(address).toEqual('0x08759d60a42860ddd3b3dd903165a08aa0312813');
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
(0, vitest_1.describe)('Get Install Data', () => {
|
|
74
|
+
(0, vitest_1.test)('Module', () => {
|
|
75
|
+
const installData = (0, startale_1.getInstallData)({
|
|
76
|
+
address: MOCK_MODULE_ADDRESS,
|
|
77
|
+
initData: '0xabcd',
|
|
78
|
+
type: common_1.MODULE_TYPE_ID_VALIDATOR,
|
|
79
|
+
deInitData: '0x0000',
|
|
80
|
+
additionalContext: '0x0000',
|
|
81
|
+
});
|
|
82
|
+
(0, vitest_1.expect)(installData).toEqual('0x9517e29f000000000000000000000000000000000000000000000000000000000000000100000000000000000000000028de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002abcd000000000000000000000000000000000000000000000000000000000000');
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
(0, vitest_1.describe)('Get Packed Signature', () => {
|
|
86
|
+
(0, vitest_1.test)('Mock signature', async () => {
|
|
87
|
+
const hash = '0xabcd';
|
|
88
|
+
const mockSignature = '0x1234';
|
|
89
|
+
const validator = {
|
|
90
|
+
address: '0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb4',
|
|
91
|
+
isRoot: true,
|
|
92
|
+
};
|
|
93
|
+
const signature = await (0, startale_1.getPackedSignature)(async (_) => mockSignature, hash, validator);
|
|
94
|
+
(0, vitest_1.expect)(signature).toEqual('0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb41234');
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Address, Client, Hex } from 'viem';
|
|
2
|
-
import type { RhinestoneAccountConfig } from '../types';
|
|
1
|
+
import type { Address, Chain, Client, Hex, Transport } from 'viem';
|
|
2
|
+
import type { ProviderConfig, RhinestoneAccountConfig } from '../types';
|
|
3
3
|
type CallType = 'call' | 'delegatecall' | 'batchcall';
|
|
4
4
|
interface ValidatorConfig {
|
|
5
5
|
address: Address;
|
|
@@ -27,6 +27,7 @@ interface GetAccountNonceParams {
|
|
|
27
27
|
declare function encode7579Calls<callType extends CallType>({ mode, callData, }: EncodeCallDataParams<callType>): Hex;
|
|
28
28
|
declare function getAccountNonce(client: Client, args: GetAccountNonceParams): Promise<bigint>;
|
|
29
29
|
declare function getBundlerClient(config: RhinestoneAccountConfig, client: Client): import("viem/account-abstraction").BundlerClient<import("viem").HttpTransport<undefined, false>, undefined, undefined, Client, undefined>;
|
|
30
|
-
|
|
30
|
+
declare function createTransport(chain: Chain, provider?: ProviderConfig): Transport;
|
|
31
|
+
export { encode7579Calls, getAccountNonce, getBundlerClient, createTransport };
|
|
31
32
|
export type { ValidatorConfig };
|
|
32
33
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../accounts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../accounts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AA8BlE,OAAO,KAAK,EAGV,cAAc,EACd,uBAAuB,EACxB,MAAM,UAAU,CAAA;AAEjB,KAAK,QAAQ,GAAG,MAAM,GAAG,cAAc,GAAG,WAAW,CAAA;AAErD,UAAU,eAAe;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,UAAU,aAAa,CAAC,QAAQ,SAAS,QAAQ;IAC/C,IAAI,EAAE,QAAQ,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,GAAG,CAAA;IACd,OAAO,CAAC,EAAE,GAAG,CAAA;CACd;AAED,UAAU,oBAAoB,CAAC,QAAQ,SAAS,QAAQ;IACtD,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IAC7B,QAAQ,EAAE,SAAS;QACjB,EAAE,EAAE,OAAO,CAAA;QACX,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,EAAE,GAAG,GAAG,SAAS,CAAA;KACvB,EAAE,CAAA;CACJ;AAED,UAAU,qBAAqB;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAkDD,iBAAS,eAAe,CAAC,QAAQ,SAAS,QAAQ,EAAE,EAClD,IAAI,EACJ,QAAQ,GACT,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,GAAG,CAuFtC;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAmCjB;AAED,iBAAS,gBAAgB,CAAC,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,6IA2CxE;AAyBD,iBAAS,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAY3E;AA6BD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAA;AAC9E,YAAY,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.encode7579Calls = encode7579Calls;
|
|
4
4
|
exports.getAccountNonce = getAccountNonce;
|
|
5
5
|
exports.getBundlerClient = getBundlerClient;
|
|
6
|
+
exports.createTransport = createTransport;
|
|
6
7
|
const viem_1 = require("viem");
|
|
7
8
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
8
9
|
const actions_1 = require("viem/actions");
|
|
10
|
+
const chains_1 = require("viem/chains");
|
|
9
11
|
const utils_1 = require("viem/utils");
|
|
10
12
|
function parseCallType(callType) {
|
|
11
13
|
switch (callType) {
|
|
@@ -140,12 +142,16 @@ function getBundlerClient(config, client) {
|
|
|
140
142
|
switch (config.type) {
|
|
141
143
|
case 'pimlico':
|
|
142
144
|
return `https://api.pimlico.io/v2/${chainId}/rpc?apikey=${config.apiKey}`;
|
|
145
|
+
case 'biconomy':
|
|
146
|
+
return `https://bundler.biconomy.io/api/v3/${chainId}/${config.apiKey}`;
|
|
143
147
|
}
|
|
144
148
|
}
|
|
145
149
|
function getPaymasterEndpoint(config, chainId) {
|
|
146
150
|
switch (config.type) {
|
|
147
151
|
case 'pimlico':
|
|
148
152
|
return `https://api.pimlico.io/v2/${chainId}/rpc?apikey=${config.apiKey}`;
|
|
153
|
+
case 'biconomy':
|
|
154
|
+
return `https://paymaster.biconomy.io/api/v2/${chainId}/${config.apiKey}`;
|
|
149
155
|
}
|
|
150
156
|
}
|
|
151
157
|
const { bundler, paymaster } = config;
|
|
@@ -192,3 +198,41 @@ async function getGasPriceEstimate(bundlerUrl) {
|
|
|
192
198
|
maxPriorityFeePerGas: BigInt(json.result.fast.maxPriorityFeePerGas),
|
|
193
199
|
};
|
|
194
200
|
}
|
|
201
|
+
function createTransport(chain, provider) {
|
|
202
|
+
if (!provider) {
|
|
203
|
+
return (0, viem_1.http)();
|
|
204
|
+
}
|
|
205
|
+
switch (provider.type) {
|
|
206
|
+
case 'alchemy': {
|
|
207
|
+
const alchemyNetwork = getAlchemyNetworkName(chain.id);
|
|
208
|
+
const jsonRpcEndpoint = `https://${alchemyNetwork}.g.alchemy.com/v2/${provider.apiKey}`;
|
|
209
|
+
return (0, viem_1.http)(jsonRpcEndpoint);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function getAlchemyNetworkName(chainId) {
|
|
214
|
+
switch (chainId) {
|
|
215
|
+
case chains_1.mainnet.id:
|
|
216
|
+
return 'eth-mainnet';
|
|
217
|
+
case chains_1.sepolia.id:
|
|
218
|
+
return 'eth-sepolia';
|
|
219
|
+
case chains_1.polygon.id:
|
|
220
|
+
return 'polygon-mainnet';
|
|
221
|
+
case chains_1.optimism.id:
|
|
222
|
+
return 'opt-mainnet';
|
|
223
|
+
case chains_1.optimismSepolia.id:
|
|
224
|
+
return 'opt-sepolia';
|
|
225
|
+
case chains_1.arbitrum.id:
|
|
226
|
+
return 'arb-mainnet';
|
|
227
|
+
case chains_1.arbitrumSepolia.id:
|
|
228
|
+
return 'arb-sepolia';
|
|
229
|
+
case chains_1.base.id:
|
|
230
|
+
return 'base-mainnet';
|
|
231
|
+
case chains_1.baseSepolia.id:
|
|
232
|
+
return 'base-sepolia';
|
|
233
|
+
case chains_1.zksync.id:
|
|
234
|
+
return 'zksync-mainnet';
|
|
235
|
+
case chains_1.soneium.id:
|
|
236
|
+
return 'soneium-mainnet';
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Address, Chain } from 'viem';
|
|
2
|
-
import { RhinestoneAccount } from '..';
|
|
3
|
-
import { WebauthnCredential } from '../modules/validators/core';
|
|
4
|
-
import { Call, OwnerSet, Recovery } from '../types';
|
|
5
|
-
import { trustAttester } from './registry';
|
|
1
|
+
import { type Address, type Chain, type Hex } from 'viem';
|
|
2
|
+
import type { RhinestoneAccount } from '..';
|
|
3
|
+
import { type WebauthnCredential } from '../modules/validators/core';
|
|
4
|
+
import type { Call, OwnableValidatorConfig, OwnerSet, ProviderConfig, Recovery, WebauthnValidatorConfig } from '../types';
|
|
6
5
|
import { encodeSmartSessionSignature } from './smart-session';
|
|
7
6
|
declare function setUpRecovery({ rhinestoneAccount, guardians, threshold, }: {
|
|
8
7
|
rhinestoneAccount: RhinestoneAccount;
|
|
9
8
|
} & Recovery): Call[];
|
|
10
|
-
declare function recover(address: Address, newOwners: OwnerSet, chain: Chain): Promise<Call[]>;
|
|
9
|
+
declare function recover(address: Address, newOwners: OwnerSet, chain: Chain, provider?: ProviderConfig): Promise<Call[]>;
|
|
11
10
|
declare function enableEcdsa({ rhinestoneAccount, owners, threshold, }: {
|
|
12
11
|
rhinestoneAccount: RhinestoneAccount;
|
|
13
12
|
owners: Address[];
|
|
@@ -25,5 +24,16 @@ declare function disablePasskeys({ rhinestoneAccount, }: {
|
|
|
25
24
|
declare function addOwner(owner: Address): Call;
|
|
26
25
|
declare function removeOwner(prevOwner: Address, ownerToRemove: Address): Call;
|
|
27
26
|
declare function changeThreshold(newThreshold: number): Call;
|
|
28
|
-
|
|
27
|
+
declare function enableMultiFactor({ rhinestoneAccount, validators, threshold, }: {
|
|
28
|
+
rhinestoneAccount: RhinestoneAccount;
|
|
29
|
+
validators: (OwnableValidatorConfig | WebauthnValidatorConfig | null)[];
|
|
30
|
+
threshold?: number;
|
|
31
|
+
}): Call[];
|
|
32
|
+
declare function disableMultiFactor({ rhinestoneAccount, }: {
|
|
33
|
+
rhinestoneAccount: RhinestoneAccount;
|
|
34
|
+
}): Call[];
|
|
35
|
+
declare function changeMultiFactorThreshold(newThreshold: number): Call;
|
|
36
|
+
declare function setSubValidator(id: Hex | number, validator: OwnableValidatorConfig | WebauthnValidatorConfig): Call;
|
|
37
|
+
declare function removeSubValidator(id: Hex | number, validator: OwnableValidatorConfig | WebauthnValidatorConfig): Call;
|
|
38
|
+
export { enableEcdsa, enablePasskeys, disableEcdsa, disablePasskeys, addOwner, removeOwner, changeThreshold, recover, setUpRecovery, encodeSmartSessionSignature, enableMultiFactor, disableMultiFactor, changeMultiFactorThreshold, setSubValidator, removeSubValidator, };
|
|
29
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAGV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAA;AAM3C,OAAO,EAQL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EACV,IAAI,EACJ,sBAAsB,EACtB,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,uBAAuB,EACxB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAA;AAE7D,iBAAS,aAAa,CAAC,EACrB,i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