@rhinestone/sdk 0.10.3 → 0.11.0
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/index.d.ts +3 -3
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +46 -4
- package/dist/src/accounts/kernel.d.ts +19 -0
- package/dist/src/accounts/kernel.d.ts.map +1 -0
- package/dist/src/accounts/kernel.js +221 -0
- package/dist/src/accounts/kernel.test.d.ts +2 -0
- package/dist/src/accounts/kernel.test.d.ts.map +1 -0
- package/dist/src/accounts/kernel.test.js +86 -0
- package/dist/src/accounts/nexus.d.ts +4 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +22 -10
- package/dist/src/accounts/nexus.test.js +36 -4
- package/dist/src/accounts/safe.d.ts +4 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +14 -2
- package/dist/src/accounts/safe.test.js +36 -4
- package/dist/src/accounts/utils.d.ts +5 -0
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +4 -4
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +7 -2
- package/dist/src/execution/utils.d.ts +4 -3
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +25 -39
- package/dist/src/modules/index.d.ts +2 -1
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +4 -1
- package/dist/src/modules/registry.d.ts +9 -0
- package/dist/src/modules/registry.d.ts.map +1 -0
- package/dist/src/modules/registry.js +60 -0
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ const nexus_1 = require("./nexus");
|
|
|
6
6
|
(0, vitest_1.describe)('Accounts: Nexus', () => {
|
|
7
7
|
(0, vitest_1.describe)('Deploy Args', () => {
|
|
8
8
|
(0, vitest_1.test)('ECDSA owners', () => {
|
|
9
|
-
const { factory, factoryData, salt,
|
|
9
|
+
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, nexus_1.getDeployArgs)({
|
|
10
10
|
owners: {
|
|
11
11
|
type: 'ecdsa',
|
|
12
12
|
accounts: [consts_1.accountA, consts_1.accountB],
|
|
@@ -16,12 +16,11 @@ const nexus_1 = require("./nexus");
|
|
|
16
16
|
(0, vitest_1.expect)(factory).toEqual('0x000000001D1D5004a02bAfAb9de2D6CE5b7B13de');
|
|
17
17
|
(0, vitest_1.expect)(factoryData).toEqual('0xea6d13ac0000000000000000000000000000000000000000000000000000000000000040c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000d3254452a909e4eed47455af7e27c28900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000604544d586000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000002483da3a338895199e5e538530213157e931bf06000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000043ff16d5776c7f0f65ec485c17ca04000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6ed8be424d673c63eeff8b926742000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000803a5be8cb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000069e2a187aeffb852bf3ccdc95151b2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000333034e9f539ce08819e12c1b8cb29084d0000000000000000000000006d0515e8e499468dce9583626f0ca15b887f9d0300000000000000000000000000000000000000000000000000000000');
|
|
18
18
|
(0, vitest_1.expect)(salt).toEqual('0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470');
|
|
19
|
-
(0, vitest_1.expect)(hashedInitcode).toEqual('0xcd60747eeb90129e87a740c20bf9191f526ec53fcf693fe4415f0264a5e5d8ab');
|
|
20
19
|
(0, vitest_1.expect)(implementation).toEqual('0x000000004f43c49e93c970e84001853a70923b03');
|
|
21
20
|
(0, vitest_1.expect)(initializationCallData).toEqual('0x4b6a14190000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000068000000000000000000000000000000000d3254452a909e4eed47455af7e27c28900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000604544d586000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005200000000000000000000000000000000000000000000000000000000000000540000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000002483da3a338895199e5e538530213157e931bf06000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000043ff16d5776c7f0f65ec485c17ca04000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6ed8be424d673c63eeff8b926742000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000803a5be8cb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000069e2a187aeffb852bf3ccdc95151b2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000333034e9f539ce08819e12c1b8cb29084d0000000000000000000000006d0515e8e499468dce9583626f0ca15b887f9d0300000000000000000000000000000000000000000000000000000000');
|
|
22
21
|
});
|
|
23
22
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
24
|
-
const { factory, factoryData, salt,
|
|
23
|
+
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, nexus_1.getDeployArgs)({
|
|
25
24
|
owners: {
|
|
26
25
|
type: 'passkey',
|
|
27
26
|
account: consts_1.passkeyAccount,
|
|
@@ -31,9 +30,42 @@ const nexus_1 = require("./nexus");
|
|
|
31
30
|
(0, vitest_1.expect)(factory).toEqual('0x000000001D1D5004a02bAfAb9de2D6CE5b7B13de');
|
|
32
31
|
(0, vitest_1.expect)(factoryData).toEqual('0xea6d13ac0000000000000000000000000000000000000000000000000000000000000040c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000d3254452a909e4eed47455af7e27c289000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000005c4544d586000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000002f167e55d42584f65e2e30a748f41ee75a31141400000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000043ff16d5776c7f0f65ec485c17ca04000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6ed8be424d673c63eeff8b926742000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000803a5be8cb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000069e2a187aeffb852bf3ccdc95151b2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000333034e9f539ce08819e12c1b8cb29084d0000000000000000000000006d0515e8e499468dce9583626f0ca15b887f9d0300000000000000000000000000000000000000000000000000000000');
|
|
33
32
|
(0, vitest_1.expect)(salt).toEqual('0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470');
|
|
34
|
-
(0, vitest_1.expect)(hashedInitcode).toEqual('0xc0700773a0a837600ad91013a852ad85ebb16205dcb7513d7c89f78c9adfec34');
|
|
35
33
|
(0, vitest_1.expect)(implementation).toEqual('0x000000004f43c49e93c970e84001853a70923b03');
|
|
36
34
|
(0, vitest_1.expect)(initializationCallData).toEqual('0x4b6a14190000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000d3254452a909e4eed47455af7e27c289000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000005c4544d586000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000002f167e55d42584f65e2e30a748f41ee75a31141400000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000043ff16d5776c7f0f65ec485c17ca04000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6ed8be424d673c63eeff8b926742000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000803a5be8cb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000069e2a187aeffb852bf3ccdc95151b2000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000333034e9f539ce08819e12c1b8cb29084d0000000000000000000000006d0515e8e499468dce9583626f0ca15b887f9d0300000000000000000000000000000000000000000000000000000000');
|
|
37
35
|
});
|
|
38
36
|
});
|
|
37
|
+
(0, vitest_1.describe)('Get Address', () => {
|
|
38
|
+
(0, vitest_1.test)('ECDSA owners', () => {
|
|
39
|
+
const address = (0, nexus_1.getAddress)({
|
|
40
|
+
owners: {
|
|
41
|
+
type: 'ecdsa',
|
|
42
|
+
accounts: [consts_1.accountA, consts_1.accountB],
|
|
43
|
+
},
|
|
44
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
45
|
+
});
|
|
46
|
+
(0, vitest_1.expect)(address).toEqual('0xd8f8c35df8af22ad9c18dc96bc708c68827500e6');
|
|
47
|
+
});
|
|
48
|
+
(0, vitest_1.test)('Passkey owner', () => {
|
|
49
|
+
const address = (0, nexus_1.getAddress)({
|
|
50
|
+
owners: {
|
|
51
|
+
type: 'passkey',
|
|
52
|
+
account: consts_1.passkeyAccount,
|
|
53
|
+
},
|
|
54
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
55
|
+
});
|
|
56
|
+
(0, vitest_1.expect)(address).toEqual('0x75851281e7af9b9ebaf42abacce566d2a26c0cd7');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
(0, vitest_1.describe)('Get Packed Signature', () => {
|
|
60
|
+
(0, vitest_1.test)('Mock signature', async () => {
|
|
61
|
+
const hash = '0xabcd';
|
|
62
|
+
const mockSignature = '0x1234';
|
|
63
|
+
const validator = {
|
|
64
|
+
address: '0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb4',
|
|
65
|
+
isRoot: true,
|
|
66
|
+
};
|
|
67
|
+
const signature = await (0, nexus_1.getPackedSignature)(async (_) => mockSignature, hash, validator);
|
|
68
|
+
(0, vitest_1.expect)(signature).toEqual('0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb41234');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
39
71
|
});
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { type Abi, type Address, type Hex, type PublicClient } from 'viem';
|
|
2
2
|
import { type SmartAccount, type SmartAccountImplementation } from 'viem/account-abstraction';
|
|
3
3
|
import type { OwnerSet, RhinestoneAccountConfig, Session } from '../types';
|
|
4
|
+
import { ValidatorConfig } from './utils';
|
|
4
5
|
declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
5
6
|
factory: `0x${string}`;
|
|
6
7
|
factoryData: `0x${string}`;
|
|
7
8
|
salt: `0x${string}`;
|
|
8
|
-
hashedInitcode: `0x${string}`;
|
|
9
9
|
implementation: `0x${string}`;
|
|
10
10
|
initializationCallData: null;
|
|
11
11
|
};
|
|
12
|
+
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
13
|
+
declare function getPackedSignature(signFn: (message: Hex) => Promise<Hex>, hash: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
12
14
|
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
13
15
|
declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
14
16
|
declare function get7702SmartAccount(): never;
|
|
15
17
|
declare function get7702InitCalls(): never;
|
|
16
|
-
export { getDeployArgs, getSmartAccount, getSessionSmartAccount, get7702InitCalls, get7702SmartAccount, };
|
|
18
|
+
export { getAddress, getPackedSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, get7702InitCalls, get7702SmartAccount, };
|
|
17
19
|
//# 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,EAIZ,KAAK,GAAG,EAER,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../../accounts/safe.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EAIZ,KAAK,GAAG,EAER,KAAK,YAAY,EAIlB,MAAM,MAAM,CAAA;AACb,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AASjC,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAE1E,OAAO,EAAoC,eAAe,EAAE,MAAM,SAAS,CAAA;AAc3E,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;EAsErD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBAalD;AAED,iBAAe,kBAAkB,CAC/B,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,EACtC,IAAI,EAAE,GAAG,EACT,SAAS,EAAE,eAAe,EAC1B,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,iEAWlC;AAED,iBAAe,sBAAsB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAuBlC;AA0ED,iBAAS,mBAAmB,IAAI,KAAK,CAEpC;AAED,iBAAS,gBAAgB,IAAI,KAAK,CAEjC;AAsBD,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,GACpB,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAddress = getAddress;
|
|
4
|
+
exports.getPackedSignature = getPackedSignature;
|
|
3
5
|
exports.getDeployArgs = getDeployArgs;
|
|
4
6
|
exports.getSmartAccount = getSmartAccount;
|
|
5
7
|
exports.getSessionSmartAccount = getSessionSmartAccount;
|
|
@@ -72,17 +74,27 @@ function getDeployArgs(config) {
|
|
|
72
74
|
args: [SAFE_SINGLETON_ADDRESS, initData, saltNonce],
|
|
73
75
|
});
|
|
74
76
|
const salt = (0, viem_1.keccak256)((0, viem_1.encodePacked)(['bytes32', 'uint256'], [(0, viem_1.keccak256)(initData), saltNonce]));
|
|
75
|
-
const hashedInitcode = '0xe298282cefe913ab5d282047161268a8222e4bd4ed106300c547894bbefd31ee';
|
|
76
77
|
return {
|
|
77
78
|
factory: SAFE_PROXY_FACTORY_ADDRESS,
|
|
78
79
|
factoryData,
|
|
79
80
|
salt,
|
|
80
|
-
hashedInitcode,
|
|
81
81
|
implementation: SAFE_SINGLETON_ADDRESS,
|
|
82
82
|
initializationCallData: null,
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
function getAddress(config) {
|
|
87
|
+
const hashedInitcode = '0xe298282cefe913ab5d282047161268a8222e4bd4ed106300c547894bbefd31ee';
|
|
88
|
+
const { factory, salt } = getDeployArgs(config);
|
|
89
|
+
const hash = (0, viem_1.keccak256)((0, viem_1.encodePacked)(['bytes1', 'address', 'bytes32', 'bytes'], ['0xff', factory, salt, hashedInitcode]));
|
|
90
|
+
const address = (0, viem_1.slice)(hash, 12, 32);
|
|
91
|
+
return address;
|
|
92
|
+
}
|
|
93
|
+
async function getPackedSignature(signFn, hash, validator, transformSignature = (signature) => signature) {
|
|
94
|
+
const signature = await signFn(hash);
|
|
95
|
+
const packedSig = (0, viem_1.encodePacked)(['address', 'bytes'], [validator.address, transformSignature(signature)]);
|
|
96
|
+
return packedSig;
|
|
97
|
+
}
|
|
86
98
|
async function getSmartAccount(client, address, owners, validatorAddress, sign) {
|
|
87
99
|
return getBaseSmartAccount(address, client, validatorAddress, async () => {
|
|
88
100
|
return (0, validators_1.getMockSignature)(owners);
|
|
@@ -6,7 +6,7 @@ const safe_1 = require("./safe");
|
|
|
6
6
|
(0, vitest_1.describe)('Accounts: Safe', () => {
|
|
7
7
|
(0, vitest_1.describe)('Deploy Args', () => {
|
|
8
8
|
(0, vitest_1.test)('ECDSA owners', () => {
|
|
9
|
-
const { factory, factoryData, salt,
|
|
9
|
+
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, safe_1.getDeployArgs)({
|
|
10
10
|
owners: {
|
|
11
11
|
type: 'ecdsa',
|
|
12
12
|
accounts: [consts_1.accountA, consts_1.accountB],
|
|
@@ -16,12 +16,11 @@ const safe_1 = require("./safe");
|
|
|
16
16
|
(0, vitest_1.expect)(factory).toEqual('0x4e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67');
|
|
17
17
|
(0, vitest_1.expect)(factoryData).toEqual('0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000704b63e800d000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007579011ab74c46090561ea277ba79d510c6c00ff00000000000000000000000000000000000000000000000000000000000001600000000000000000000000007579ee8307284f293b1927136486880611f200020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb70000000000000000000000000000000000000000000000000000000000000564d78343d90000000000000000000000007579ee8307284f293b1927136486880611f2000200000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000004e000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000002483da3a338895199e5e538530213157e931bf06000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000043ff16d5776c7f0f65ec485c17ca04000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6ed8be424d673c63eeff8b926742000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000803a5be8cb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000333034e9f539ce08819e12c1b8cb29084d0000000000000000000000006d0515e8e499468dce9583626f0ca15b887f9d030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
18
18
|
(0, vitest_1.expect)(salt).toEqual('0x90fef481a644e27fec02dc6b8365bf9a7354b19d9aa4f749b4a706cc0b11af99');
|
|
19
|
-
(0, vitest_1.expect)(hashedInitcode).toEqual('0xe298282cefe913ab5d282047161268a8222e4bd4ed106300c547894bbefd31ee');
|
|
20
19
|
(0, vitest_1.expect)(implementation).toEqual('0x29fcb43b46531bca003ddc8fcb67ffe91900c762');
|
|
21
20
|
(0, vitest_1.expect)(initializationCallData).toEqual(null);
|
|
22
21
|
});
|
|
23
22
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
24
|
-
const { factory, factoryData, salt,
|
|
23
|
+
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, safe_1.getDeployArgs)({
|
|
25
24
|
owners: {
|
|
26
25
|
type: 'passkey',
|
|
27
26
|
account: consts_1.passkeyAccount,
|
|
@@ -31,9 +30,42 @@ const safe_1 = require("./safe");
|
|
|
31
30
|
(0, vitest_1.expect)(factory).toEqual('0x4e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67');
|
|
32
31
|
(0, vitest_1.expect)(factoryData).toEqual('0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c7620000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006a4b63e800d000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007579011ab74c46090561ea277ba79d510c6c00ff00000000000000000000000000000000000000000000000000000000000001400000000000000000000000007579ee8307284f293b1927136486880611f200020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000babe99e62d8bcbd3acf5ccbcfcd4f64fe75e5e720000000000000000000000000000000000000000000000000000000000000524d78343d90000000000000000000000007579ee8307284f293b1927136486880611f2000200000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000002f167e55d42584f65e2e30a748f41ee75a31141400000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000043ff16d5776c7f0f65ec485c17ca04000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6ed8be424d673c63eeff8b926742000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000e5a37279a001301a837a91b5de1d5e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000803a5be8cb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000333034e9f539ce08819e12c1b8cb29084d0000000000000000000000006d0515e8e499468dce9583626f0ca15b887f9d030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
33
32
|
(0, vitest_1.expect)(salt).toEqual('0xdbd211aaf7a8d731e9c157757bd788e574950b04aa1a9ccc031dbb7f47db21e6');
|
|
34
|
-
(0, vitest_1.expect)(hashedInitcode).toEqual('0xe298282cefe913ab5d282047161268a8222e4bd4ed106300c547894bbefd31ee');
|
|
35
33
|
(0, vitest_1.expect)(implementation).toEqual('0x29fcb43b46531bca003ddc8fcb67ffe91900c762');
|
|
36
34
|
(0, vitest_1.expect)(initializationCallData).toEqual(null);
|
|
37
35
|
});
|
|
38
36
|
});
|
|
37
|
+
(0, vitest_1.describe)('Get Address', () => {
|
|
38
|
+
(0, vitest_1.test)('ECDSA owners', () => {
|
|
39
|
+
const address = (0, safe_1.getAddress)({
|
|
40
|
+
owners: {
|
|
41
|
+
type: 'ecdsa',
|
|
42
|
+
accounts: [consts_1.accountA, consts_1.accountB],
|
|
43
|
+
},
|
|
44
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
45
|
+
});
|
|
46
|
+
(0, vitest_1.expect)(address).toEqual('0x32f9effe4a9f057cb0571430c66c04eb43b35407');
|
|
47
|
+
});
|
|
48
|
+
(0, vitest_1.test)('Passkey owner', () => {
|
|
49
|
+
const address = (0, safe_1.getAddress)({
|
|
50
|
+
owners: {
|
|
51
|
+
type: 'passkey',
|
|
52
|
+
account: consts_1.passkeyAccount,
|
|
53
|
+
},
|
|
54
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
55
|
+
});
|
|
56
|
+
(0, vitest_1.expect)(address).toEqual('0x033e622d8626b225cad07bcab182d1a09f514f70');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
(0, vitest_1.describe)('Get Packed Signature', () => {
|
|
60
|
+
(0, vitest_1.test)('Mock signature', async () => {
|
|
61
|
+
const hash = '0xabcd';
|
|
62
|
+
const mockSignature = '0x1234';
|
|
63
|
+
const validator = {
|
|
64
|
+
address: '0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb4',
|
|
65
|
+
isRoot: true,
|
|
66
|
+
};
|
|
67
|
+
const signature = await (0, safe_1.getPackedSignature)(async (_) => mockSignature, hash, validator);
|
|
68
|
+
(0, vitest_1.expect)(signature).toEqual('0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb41234');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
39
71
|
});
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Address, Client, Hex } from 'viem';
|
|
2
2
|
import type { RhinestoneAccountConfig } from '../types';
|
|
3
3
|
type CallType = 'call' | 'delegatecall' | 'batchcall';
|
|
4
|
+
interface ValidatorConfig {
|
|
5
|
+
address: Address;
|
|
6
|
+
isRoot: boolean;
|
|
7
|
+
}
|
|
4
8
|
interface ExecutionMode<callType extends CallType> {
|
|
5
9
|
type: callType;
|
|
6
10
|
revertOnError?: boolean;
|
|
@@ -24,4 +28,5 @@ declare function encode7579Calls<callType extends CallType>({ mode, callData, }:
|
|
|
24
28
|
declare function getAccountNonce(client: Client, args: GetAccountNonceParams): Promise<bigint>;
|
|
25
29
|
declare function getBundlerClient(config: RhinestoneAccountConfig, client: Client): import("viem/account-abstraction").BundlerClient<import("viem").HttpTransport<undefined, false>, undefined, undefined, Client, undefined>;
|
|
26
30
|
export { encode7579Calls, getAccountNonce, getBundlerClient };
|
|
31
|
+
export type { ValidatorConfig };
|
|
27
32
|
//# 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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E,CAAA;AAC7D,YAAY,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIX,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIX,MAAM,MAAM,CAAA;AAWb,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAYnD,OAAO,KAAK,EAEV,uBAAuB,EAIvB,WAAW,EACZ,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAc5D,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,8BAyBzB;AA2KD,iBAAe,gBAAgB,CAC7B,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,iBAAiB,EACzB,uBAAuB,EAAE,OAAO;;;;;;;;;;;;kBAwCjC;AAED,iBAAe,qBAAqB,CAClC,MAAM,EAAE,uBAAuB,EAC/B,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,OAAO,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,iBAAe,YAAY,CACzB,MAAM,EAAE,uBAAuB,EAC/B,UAAU,EAAE,OAAO,yDAMpB;AAED,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,GACb,CAAA;AACD,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -78,13 +78,13 @@ async function sendTransactionAsUserOp(config, sourceChain, targetChain, calls,
|
|
|
78
78
|
await (0, accounts_1.deployTarget)(targetChain, config, true);
|
|
79
79
|
await (0, smart_session_1.enableSmartSession)(targetChain, config, withSession);
|
|
80
80
|
const userOp = await (0, utils_2.getUserOp)(config, targetChain, withSession, orderPath, calls, tokenRequests, accountAddress);
|
|
81
|
-
const
|
|
82
|
-
return await (0, utils_2.submitUserOp)(config, sourceChain, targetChain, userOp, orderPath,
|
|
81
|
+
const signature = await (0, utils_2.signUserOp)(config, sourceChain, targetChain, accountAddress, withSession, userOp, orderPath);
|
|
82
|
+
return await (0, utils_2.submitUserOp)(config, sourceChain, targetChain, userOp, orderPath, signature);
|
|
83
83
|
}
|
|
84
84
|
async function sendTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress) {
|
|
85
85
|
const { orderPath, hash: orderBundleHash } = await (0, utils_2.prepareTransactionAsIntent)(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress);
|
|
86
|
-
const
|
|
87
|
-
return await (0, utils_2.submitIntentInternal)(config, sourceChain, targetChain, orderPath,
|
|
86
|
+
const signature = await (0, utils_2.signIntent)(config, sourceChain, targetChain, orderBundleHash);
|
|
87
|
+
return await (0, utils_2.submitIntentInternal)(config, sourceChain, targetChain, orderPath, signature, true);
|
|
88
88
|
}
|
|
89
89
|
async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
90
90
|
const validStatuses = new Set([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-session.d.ts","sourceRoot":"","sources":["../../../execution/smart-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"smart-session.d.ts","sourceRoot":"","sources":["../../../execution/smart-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAYb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEhE,iBAAe,kBAAkB,CAC/B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,OAAO,iBAiCjB;AAED,iBAAe,WAAW,CACxB,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,OAAO;;;;;GAiExB;AAED,iBAAS,mBAAmB,CAC1B,SAAS,EAAE,GAAG,EACd,kBAAkB,EAAE,GAAG,EACvB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,OAAO,iBAkBrB;AAED,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -6,6 +6,7 @@ exports.getSessionSignature = getSessionSignature;
|
|
|
6
6
|
const viem_1 = require("viem");
|
|
7
7
|
const accounts_1 = require("../accounts");
|
|
8
8
|
const utils_1 = require("../accounts/utils");
|
|
9
|
+
const modules_1 = require("../modules");
|
|
9
10
|
const validators_1 = require("../modules/validators");
|
|
10
11
|
const utils_2 = require("../orchestrator/utils");
|
|
11
12
|
async function enableSmartSession(chain, config, session) {
|
|
@@ -18,12 +19,16 @@ async function enableSmartSession(chain, config, session) {
|
|
|
18
19
|
if (isEnabled) {
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
22
|
+
const enableSessionCall = await (0, validators_1.getEnableSessionCall)(chain, session);
|
|
23
|
+
const trustedAttesters = await (0, modules_1.getTrustedAttesters)(publicClient, address);
|
|
24
|
+
const trustAttesterCall = trustedAttesters.length === 0 ? (0, modules_1.getTrustAttesterCall)(config) : undefined;
|
|
21
25
|
const smartAccount = await (0, accounts_1.getSmartAccount)(config, publicClient, chain);
|
|
22
26
|
const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
|
|
23
|
-
const enableSessionCall = await (0, validators_1.getEnableSessionCall)(chain, session);
|
|
24
27
|
const opHash = await bundlerClient.sendUserOperation({
|
|
25
28
|
account: smartAccount,
|
|
26
|
-
calls:
|
|
29
|
+
calls: trustAttesterCall
|
|
30
|
+
? [trustAttesterCall, enableSessionCall]
|
|
31
|
+
: [enableSessionCall],
|
|
27
32
|
});
|
|
28
33
|
await bundlerClient.waitForUserOperationReceipt({
|
|
29
34
|
hash: opHash,
|
|
@@ -29,8 +29,9 @@ declare function prepareTransaction(config: RhinestoneAccountConfig, transaction
|
|
|
29
29
|
declare function signTransaction(config: RhinestoneAccountConfig, preparedTransaction: PreparedTransactionData): Promise<SignedTransactionData>;
|
|
30
30
|
declare function submitTransaction(config: RhinestoneAccountConfig, signedTransaction: SignedTransactionData): Promise<TransactionResult>;
|
|
31
31
|
declare function prepareTransactionAsIntent(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, calls: Call[], gasLimit: bigint | undefined, tokenRequests: TokenRequest[], accountAddress: Address): Promise<BundleData>;
|
|
32
|
+
declare function signIntent(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, bundleHash: Hex): Promise<`0x${string}`>;
|
|
32
33
|
declare function signUserOp(config: RhinestoneAccountConfig, sourceChain: Chain, targetChain: Chain, accountAddress: Address, withSession: Session, userOp: UserOperation, orderPath: OrderPath): Promise<`0x${string}`>;
|
|
33
|
-
declare function submitUserOp(config: RhinestoneAccountConfig, sourceChain: Chain, targetChain: Chain, userOp: UserOperation, orderPath: OrderPath,
|
|
34
|
+
declare function submitUserOp(config: RhinestoneAccountConfig, sourceChain: Chain, targetChain: Chain, userOp: UserOperation, orderPath: OrderPath, signature: Hex): Promise<TransactionResult>;
|
|
34
35
|
declare function getOrchestratorByChain(chainId: number, apiKey: string): import("../orchestrator").Orchestrator;
|
|
35
36
|
declare function getUserOpOrderPath(sourceChain: Chain, targetChain: Chain, tokenRequests: TokenRequest[], accountAddress: Address, gasLimit: bigint | undefined, rhinestoneApiKey: string): Promise<OrderPath>;
|
|
36
37
|
declare function getUserOp(config: RhinestoneAccountConfig, targetChain: Chain, withSession: Session, orderPath: OrderPath, calls: Call[], tokenRequests: TokenRequest[], accountAddress: Address): Promise<{
|
|
@@ -60,7 +61,7 @@ declare function getUserOp(config: RhinestoneAccountConfig, targetChain: Chain,
|
|
|
60
61
|
paymasterData: UserOperation["paymasterData"];
|
|
61
62
|
signature: UserOperation["signature"];
|
|
62
63
|
}>;
|
|
63
|
-
declare function submitIntentInternal(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, orderPath: OrderPath,
|
|
64
|
-
export { prepareTransaction, signTransaction, submitTransaction, getOrchestratorByChain, getUserOpOrderPath, getUserOp, signUserOp, submitUserOp, prepareTransactionAsIntent, submitIntentInternal, };
|
|
64
|
+
declare function submitIntentInternal(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, orderPath: OrderPath, signature: Hex, deploy: boolean): Promise<TransactionResult>;
|
|
65
|
+
export { prepareTransaction, signTransaction, submitTransaction, getOrchestratorByChain, getUserOpOrderPath, getUserOp, signIntent, signUserOp, submitUserOp, prepareTransactionAsIntent, submitIntentInternal, };
|
|
65
66
|
export type { BundleData, TransactionResult, PreparedTransactionData, SignedTransactionData, };
|
|
66
67
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAGL,GAAG,EAMJ,MAAM,MAAM,CAAA;AACb,OAAO,EAGL,aAAa,EACd,MAAM,0BAA0B,CAAA;AA2BjC,OAAO,EAEL,SAAS,EAGV,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,IAAI,EACJ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,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,0BAA0B,EAC1B,oBAAoB,GACrB,CAAA;AACD,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
|
|
@@ -6,6 +6,7 @@ exports.submitTransaction = submitTransaction;
|
|
|
6
6
|
exports.getOrchestratorByChain = getOrchestratorByChain;
|
|
7
7
|
exports.getUserOpOrderPath = getUserOpOrderPath;
|
|
8
8
|
exports.getUserOp = getUserOp;
|
|
9
|
+
exports.signIntent = signIntent;
|
|
9
10
|
exports.signUserOp = signUserOp;
|
|
10
11
|
exports.submitUserOp = submitUserOp;
|
|
11
12
|
exports.prepareTransactionAsIntent = prepareTransactionAsIntent;
|
|
@@ -154,10 +155,18 @@ async function prepareTransactionAsIntent(config, sourceChain, targetChain, call
|
|
|
154
155
|
};
|
|
155
156
|
}
|
|
156
157
|
async function signIntent(config, sourceChain, targetChain, bundleHash) {
|
|
157
|
-
const
|
|
158
|
+
const validatorModule = (0, validators_1.getOwnerValidator)(config);
|
|
159
|
+
const signature = await (0, accounts_1.getPackedSignature)(config, config.owners, sourceChain || targetChain, {
|
|
160
|
+
address: validatorModule.address,
|
|
161
|
+
isRoot: true,
|
|
162
|
+
}, bundleHash);
|
|
158
163
|
return signature;
|
|
159
164
|
}
|
|
160
165
|
async function signUserOp(config, sourceChain, targetChain, accountAddress, withSession, userOp, orderPath) {
|
|
166
|
+
const smartSessionValidator = (0, validators_1.getSmartSessionValidator)(config);
|
|
167
|
+
if (!smartSessionValidator) {
|
|
168
|
+
throw new Error('Smart session validator not available');
|
|
169
|
+
}
|
|
161
170
|
const targetPublicClient = (0, viem_1.createPublicClient)({
|
|
162
171
|
chain: targetChain,
|
|
163
172
|
transport: (0, viem_1.http)(),
|
|
@@ -172,20 +181,19 @@ async function signUserOp(config, sourceChain, targetChain, accountAddress, with
|
|
|
172
181
|
});
|
|
173
182
|
orderPath[0].orderBundle.segments[0].witness.userOpHash = userOpHash;
|
|
174
183
|
const { hash, appDomainSeparator, contentsType, structHash } = await (0, smart_session_1.hashErc7739)(sourceChain, orderPath, accountAddress);
|
|
175
|
-
const signature = await (0, accounts_1.
|
|
176
|
-
|
|
177
|
-
|
|
184
|
+
const signature = await (0, accounts_1.getPackedSignature)(config, withSession.owners, targetChain, {
|
|
185
|
+
address: smartSessionValidator.address,
|
|
186
|
+
isRoot: false,
|
|
187
|
+
}, hash, (signature) => {
|
|
188
|
+
return (0, smart_session_1.getSessionSignature)(signature, appDomainSeparator, structHash, contentsType, withSession);
|
|
189
|
+
});
|
|
190
|
+
return signature;
|
|
178
191
|
}
|
|
179
|
-
async function submitUserOp(config, sourceChain, targetChain, userOp, orderPath,
|
|
180
|
-
const smartSessionValidator = (0, validators_1.getSmartSessionValidator)(config);
|
|
181
|
-
if (!smartSessionValidator) {
|
|
182
|
-
throw new Error('Smart session validator not available');
|
|
183
|
-
}
|
|
184
|
-
const packedSig = (0, viem_1.encodePacked)(['address', 'bytes'], [smartSessionValidator.address, sessionSignature]);
|
|
192
|
+
async function submitUserOp(config, sourceChain, targetChain, userOp, orderPath, signature) {
|
|
185
193
|
const signedOrderBundle = {
|
|
186
194
|
...orderPath[0].orderBundle,
|
|
187
|
-
originSignatures: Array(orderPath[0].orderBundle.segments.length).fill(
|
|
188
|
-
targetSignature:
|
|
195
|
+
originSignatures: Array(orderPath[0].orderBundle.segments.length).fill(signature),
|
|
196
|
+
targetSignature: signature,
|
|
189
197
|
};
|
|
190
198
|
const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
|
|
191
199
|
const bundleResults = await orchestrator.postSignedOrderBundle([
|
|
@@ -201,28 +209,8 @@ async function submitUserOp(config, sourceChain, targetChain, userOp, orderPath,
|
|
|
201
209
|
targetChain: targetChain.id,
|
|
202
210
|
};
|
|
203
211
|
}
|
|
204
|
-
async function submitIntent(config, sourceChain, targetChain, orderPath,
|
|
205
|
-
|
|
206
|
-
const packedSig = (0, viem_1.encodePacked)(['address', 'bytes'], [validatorModule.address, bundleSignature]);
|
|
207
|
-
const signedOrderBundle = {
|
|
208
|
-
...orderPath[0].orderBundle,
|
|
209
|
-
originSignatures: Array(orderPath[0].orderBundle.segments.length).fill(packedSig),
|
|
210
|
-
targetSignature: packedSig,
|
|
211
|
-
};
|
|
212
|
-
const initCode = (0, accounts_1.getBundleInitCode)(config);
|
|
213
|
-
const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
|
|
214
|
-
const bundleResults = await orchestrator.postSignedOrderBundle([
|
|
215
|
-
{
|
|
216
|
-
signedOrderBundle,
|
|
217
|
-
initCode,
|
|
218
|
-
},
|
|
219
|
-
]);
|
|
220
|
-
return {
|
|
221
|
-
type: 'bundle',
|
|
222
|
-
id: bundleResults[0].bundleId,
|
|
223
|
-
sourceChain: sourceChain?.id,
|
|
224
|
-
targetChain: targetChain.id,
|
|
225
|
-
};
|
|
212
|
+
async function submitIntent(config, sourceChain, targetChain, orderPath, signature) {
|
|
213
|
+
return submitIntentInternal(config, sourceChain, targetChain, orderPath, signature, false);
|
|
226
214
|
}
|
|
227
215
|
function getOrchestratorByChain(chainId, apiKey) {
|
|
228
216
|
const orchestratorUrl = (0, registry_1.isTestnet)(chainId)
|
|
@@ -280,13 +268,11 @@ async function getUserOp(config, targetChain, withSession, orderPath, calls, tok
|
|
|
280
268
|
],
|
|
281
269
|
});
|
|
282
270
|
}
|
|
283
|
-
async function submitIntentInternal(config, sourceChain, targetChain, orderPath,
|
|
284
|
-
const validatorModule = (0, validators_1.getOwnerValidator)(config);
|
|
285
|
-
const packedSig = (0, viem_1.encodePacked)(['address', 'bytes'], [validatorModule.address, bundleSignature]);
|
|
271
|
+
async function submitIntentInternal(config, sourceChain, targetChain, orderPath, signature, deploy) {
|
|
286
272
|
const signedOrderBundle = {
|
|
287
273
|
...orderPath[0].orderBundle,
|
|
288
|
-
originSignatures: Array(orderPath[0].orderBundle.segments.length).fill(
|
|
289
|
-
targetSignature:
|
|
274
|
+
originSignatures: Array(orderPath[0].orderBundle.segments.length).fill(signature),
|
|
275
|
+
targetSignature: signature,
|
|
290
276
|
};
|
|
291
277
|
if (deploy) {
|
|
292
278
|
await (0, accounts_1.deployTarget)(targetChain, config, false);
|
|
@@ -2,6 +2,7 @@ import { type Address, type Chain, type Hex } from 'viem';
|
|
|
2
2
|
import type { RhinestoneAccountConfig } from '../types';
|
|
3
3
|
import { type Module } from './common';
|
|
4
4
|
import { HOOK_ADDRESS } from './omni-account';
|
|
5
|
+
import { getTrustAttesterCall, getTrustedAttesters } from './registry';
|
|
5
6
|
import { getOwnerValidator } from './validators';
|
|
6
7
|
interface WebAuthnData {
|
|
7
8
|
authenticatorData: Hex;
|
|
@@ -29,5 +30,5 @@ interface ModeleSetup {
|
|
|
29
30
|
declare function getSetup(config: RhinestoneAccountConfig): ModeleSetup;
|
|
30
31
|
declare function getWebauthnValidatorSignature({ webauthn, signature, usePrecompiled, }: WebauthnValidatorSignature): `0x${string}`;
|
|
31
32
|
declare function isRip7212SupportedNetwork(chain: Chain): boolean;
|
|
32
|
-
export { HOOK_ADDRESS, getSetup, getOwnerValidator, getWebauthnValidatorSignature, isRip7212SupportedNetwork, };
|
|
33
|
+
export { HOOK_ADDRESS, getSetup, getTrustAttesterCall, getTrustedAttesters, getOwnerValidator, getWebauthnValidatorSignature, isRip7212SupportedNetwork, };
|
|
33
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,KAAK,EAEV,KAAK,GAAG,EAET,MAAM,MAAM,CAAA;AAYb,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAEvD,OAAO,EAGL,KA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,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOwnerValidator = exports.HOOK_ADDRESS = void 0;
|
|
3
|
+
exports.getOwnerValidator = exports.getTrustedAttesters = exports.getTrustAttesterCall = exports.HOOK_ADDRESS = void 0;
|
|
4
4
|
exports.getSetup = getSetup;
|
|
5
5
|
exports.getWebauthnValidatorSignature = getWebauthnValidatorSignature;
|
|
6
6
|
exports.isRip7212SupportedNetwork = isRip7212SupportedNetwork;
|
|
@@ -9,6 +9,9 @@ const chains_1 = require("viem/chains");
|
|
|
9
9
|
const common_1 = require("./common");
|
|
10
10
|
const omni_account_1 = require("./omni-account");
|
|
11
11
|
Object.defineProperty(exports, "HOOK_ADDRESS", { enumerable: true, get: function () { return omni_account_1.HOOK_ADDRESS; } });
|
|
12
|
+
const registry_1 = require("./registry");
|
|
13
|
+
Object.defineProperty(exports, "getTrustAttesterCall", { enumerable: true, get: function () { return registry_1.getTrustAttesterCall; } });
|
|
14
|
+
Object.defineProperty(exports, "getTrustedAttesters", { enumerable: true, get: function () { return registry_1.getTrustedAttesters; } });
|
|
12
15
|
const validators_1 = require("./validators");
|
|
13
16
|
Object.defineProperty(exports, "getOwnerValidator", { enumerable: true, get: function () { return validators_1.getOwnerValidator; } });
|
|
14
17
|
const SMART_SESSION_COMPATIBILITY_FALLBACK_ADDRESS = '0x12cae64c42f362e7d5a847c2d33388373f629177';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Address, PublicClient } from 'viem';
|
|
2
|
+
import { RhinestoneAccountConfig } from '../types';
|
|
3
|
+
declare function getTrustAttesterCall(config: RhinestoneAccountConfig): {
|
|
4
|
+
to: `0x${string}`;
|
|
5
|
+
data: `0x${string}`;
|
|
6
|
+
};
|
|
7
|
+
declare function getTrustedAttesters(client: PublicClient, account: Address): Promise<readonly Address[]>;
|
|
8
|
+
export { getTrustAttesterCall, getTrustedAttesters };
|
|
9
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../modules/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAsB,YAAY,EAAE,MAAM,MAAM,CAAA;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAIlD,iBAAS,oBAAoB,CAAC,MAAM,EAAE,uBAAuB;;;EA0B5D;AAED,iBAAe,mBAAmB,CAChC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAyB7B;AAED,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTrustAttesterCall = getTrustAttesterCall;
|
|
4
|
+
exports.getTrustedAttesters = getTrustedAttesters;
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
const omni_account_1 = require("./omni-account");
|
|
8
|
+
function getTrustAttesterCall(config) {
|
|
9
|
+
const moduleSetup = (0, _1.getSetup)(config);
|
|
10
|
+
return {
|
|
11
|
+
to: omni_account_1.RHINESTONE_MODULE_REGISTRY_ADDRESS,
|
|
12
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
13
|
+
abi: [
|
|
14
|
+
{
|
|
15
|
+
name: 'trustAttesters',
|
|
16
|
+
type: 'function',
|
|
17
|
+
inputs: [
|
|
18
|
+
{
|
|
19
|
+
name: 'threshold',
|
|
20
|
+
type: 'uint8',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'attesters',
|
|
24
|
+
type: 'address[]',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
outputs: [],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
functionName: 'trustAttesters',
|
|
31
|
+
args: [moduleSetup.threshold, moduleSetup.attesters],
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async function getTrustedAttesters(client, account) {
|
|
36
|
+
return await client.readContract({
|
|
37
|
+
address: omni_account_1.RHINESTONE_MODULE_REGISTRY_ADDRESS,
|
|
38
|
+
abi: [
|
|
39
|
+
{
|
|
40
|
+
type: 'function',
|
|
41
|
+
stateMutability: 'view',
|
|
42
|
+
name: 'findTrustedAttesters',
|
|
43
|
+
inputs: [
|
|
44
|
+
{
|
|
45
|
+
type: 'address',
|
|
46
|
+
name: 'smartAccount',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
outputs: [
|
|
50
|
+
{
|
|
51
|
+
type: 'address[]',
|
|
52
|
+
name: 'attesters',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
functionName: 'findTrustedAttesters',
|
|
58
|
+
args: [account],
|
|
59
|
+
});
|
|
60
|
+
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Account, Address, Chain, Hex } from 'viem';
|
|
2
2
|
import type { WebAuthnAccount } from 'viem/account-abstraction';
|
|
3
3
|
interface AccountProviderConfig {
|
|
4
|
-
type: 'safe' | 'nexus';
|
|
4
|
+
type: 'safe' | 'nexus' | 'kernel';
|
|
5
5
|
}
|
|
6
6
|
interface OwnableValidatorConfig {
|
|
7
7
|
type: 'ecdsa';
|