@rhinestone/sdk 1.0.0-alpha.10 → 1.0.0-alpha.12
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 +8 -6
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +69 -134
- package/dist/src/accounts/index.test.js +2 -2
- package/dist/src/accounts/kernel.d.ts +3 -2
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +3 -5
- package/dist/src/accounts/kernel.test.js +5 -10
- package/dist/src/accounts/nexus.d.ts +2 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +5 -6
- package/dist/src/accounts/nexus.test.js +11 -12
- package/dist/src/accounts/safe.d.ts +2 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +3 -5
- package/dist/src/accounts/safe.test.js +4 -5
- package/dist/src/accounts/signing/common.d.ts +23 -0
- package/dist/src/accounts/signing/common.d.ts.map +1 -0
- package/dist/src/accounts/signing/common.js +113 -0
- package/dist/src/accounts/signing/message.d.ts +5 -0
- package/dist/src/accounts/signing/message.d.ts.map +1 -0
- package/dist/src/accounts/signing/message.js +51 -0
- package/dist/src/accounts/signing/typedData.d.ts +5 -0
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -0
- package/dist/src/accounts/signing/typedData.js +39 -0
- package/dist/src/accounts/startale.d.ts +2 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +3 -3
- package/dist/src/accounts/startale.test.js +4 -5
- package/dist/src/actions/index.d.ts +84 -0
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +92 -0
- package/dist/src/actions/index.test.js +15 -15
- package/dist/src/actions/smart-session.d.ts +6 -0
- package/dist/src/actions/smart-session.d.ts.map +1 -1
- package/dist/src/actions/smart-session.js +6 -0
- package/dist/src/execution/compact.d.ts +128 -1
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +91 -0
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +7 -8
- package/dist/src/execution/utils.d.ts +7 -6
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +48 -9
- package/dist/src/index.d.ts +5 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +75 -11
- package/dist/src/modules/index.test.js +1 -1
- package/dist/src/modules/validators/core.js +1 -1
- package/dist/src/modules/validators/core.test.js +3 -3
- package/dist/src/modules/validators/smart-sessions.js +3 -3
- package/dist/src/modules/validators/smart-sessions.test.js +4 -4
- package/dist/src/orchestrator/index.d.ts +1 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -3
- package/dist/src/orchestrator/types.d.ts +12 -0
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.d.ts +1 -3
- package/dist/src/orchestrator/utils.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.js +0 -102
- package/dist/src/types.d.ts +1 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -15,11 +15,11 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
15
15
|
},
|
|
16
16
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
17
17
|
});
|
|
18
|
-
(0, vitest_1.expect)(factory).toEqual('
|
|
19
|
-
(0, vitest_1.expect)(factoryData).toEqual('
|
|
18
|
+
(0, vitest_1.expect)(factory).toEqual('0xFF4454d15707a6f6BF01540796040f9E1646322C');
|
|
19
|
+
(0, vitest_1.expect)(factoryData).toEqual('0xea6d13ac0000000000000000000000000000000000000000000000000000000000000040c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470000000000000000000000000000000000000000000000000000000000000036000000000000000000000000040e89a87c56a340c9257350dedf4b89a3fccccd3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002e441bede0300000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da09948693600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
20
20
|
(0, vitest_1.expect)(salt).toEqual('0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470');
|
|
21
|
-
(0, vitest_1.expect)(implementation).toEqual('
|
|
22
|
-
(0, vitest_1.expect)(initializationCallData).toEqual('
|
|
21
|
+
(0, vitest_1.expect)(implementation).toEqual('0x55cc6609fDb3620ABeABf4dB020abfc469494778');
|
|
22
|
+
(0, vitest_1.expect)(initializationCallData).toEqual('0x4b6a14190000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000036000000000000000000000000040e89a87c56a340c9257350dedf4b89a3fccccd3000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002e441bede0300000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da09948693600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
23
23
|
});
|
|
24
24
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
25
25
|
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, nexus_1.getDeployArgs)({
|
|
@@ -29,11 +29,11 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
29
29
|
},
|
|
30
30
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
31
31
|
});
|
|
32
|
-
(0, vitest_1.expect)(factory).toEqual('
|
|
33
|
-
(0, vitest_1.expect)(factoryData).toEqual('
|
|
32
|
+
(0, vitest_1.expect)(factory).toEqual('0xFF4454d15707a6f6BF01540796040f9E1646322C');
|
|
33
|
+
(0, vitest_1.expect)(factoryData).toEqual('0xea6d13ac0000000000000000000000000000000000000000000000000000000000000040c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000040e89a87c56a340c9257350dedf4b89a3fccccd30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000032441bede0300000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000578c4cb0e472a5462da43c495c3f3300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
34
34
|
(0, vitest_1.expect)(salt).toEqual('0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470');
|
|
35
|
-
(0, vitest_1.expect)(implementation).toEqual('
|
|
36
|
-
(0, vitest_1.expect)(initializationCallData).toEqual('
|
|
35
|
+
(0, vitest_1.expect)(implementation).toEqual('0x55cc6609fDb3620ABeABf4dB020abfc469494778');
|
|
36
|
+
(0, vitest_1.expect)(initializationCallData).toEqual('0x4b6a1419000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000040e89a87c56a340c9257350dedf4b89a3fccccd30000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000032441bede0300000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000578c4cb0e472a5462da43c495c3f3300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000060580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
(0, vitest_1.describe)('Get Address', () => {
|
|
@@ -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('0x7fbe9b0796484c06c94968b910a4cf488fd1719b');
|
|
49
49
|
});
|
|
50
50
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
51
51
|
const address = (0, nexus_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('0x82a8a51443c2b8608001bdc4ff5bb31f69e8ed14');
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
61
|
(0, vitest_1.describe)('Get Install Data', () => {
|
|
@@ -72,13 +72,12 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
72
72
|
});
|
|
73
73
|
(0, vitest_1.describe)('Get Packed Signature', () => {
|
|
74
74
|
(0, vitest_1.test)('Mock signature', async () => {
|
|
75
|
-
const hash = '0xabcd';
|
|
76
75
|
const mockSignature = '0x1234';
|
|
77
76
|
const validator = {
|
|
78
77
|
address: '0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb4',
|
|
79
78
|
isRoot: true,
|
|
80
79
|
};
|
|
81
|
-
const signature = await (0, nexus_1.
|
|
80
|
+
const signature = await (0, nexus_1.packSignature)(mockSignature, validator);
|
|
82
81
|
(0, vitest_1.expect)(signature).toEqual('0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb41234');
|
|
83
82
|
});
|
|
84
83
|
});
|
|
@@ -13,9 +13,9 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
|
13
13
|
};
|
|
14
14
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
15
15
|
declare function getInstallData(module: Module): `0x${string}`;
|
|
16
|
-
declare function
|
|
16
|
+
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
17
17
|
declare function getSmartAccount(client: PublicClient, address: Address, owners: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
18
18
|
declare function getSessionSmartAccount(client: PublicClient, address: Address, session: Session, validatorAddress: Address, enableData: EnableSessionData | null, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
19
19
|
declare function getGuardianSmartAccount(client: PublicClient, address: Address, guardians: OwnerSet, validatorAddress: Address, sign: (hash: Hex) => Promise<Hex>): Promise<SmartAccount<SmartAccountImplementation<Abi, "0.7">>>;
|
|
20
|
-
export { getInstallData, getAddress,
|
|
20
|
+
export { getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
|
|
21
21
|
//# 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,EAIlB,MAAM,MAAM,CAAA;AACb,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAA;AAGjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAQ/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC1E,OAAO,EAAoC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAchF,iBAAS,aAAa,CAAC,MAAM,EAAE,uBAAuB;;;;;;EAiErD;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,uBAAuB,iBAalD;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,MAAM,iBA2BrC;AAED,iBAAe,
|
|
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AAG,CAAC,iEAyClC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,iEAalC;AAkGD,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,GACxB,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInstallData = getInstallData;
|
|
4
4
|
exports.getAddress = getAddress;
|
|
5
|
-
exports.
|
|
5
|
+
exports.packSignature = packSignature;
|
|
6
6
|
exports.getDeployArgs = getDeployArgs;
|
|
7
7
|
exports.getSmartAccount = getSmartAccount;
|
|
8
8
|
exports.getSessionSmartAccount = getSessionSmartAccount;
|
|
@@ -113,10 +113,8 @@ function getInstallData(module) {
|
|
|
113
113
|
args: [module.type, module.address, module.initData],
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
async function
|
|
117
|
-
|
|
118
|
-
const packedSig = (0, viem_1.encodePacked)(['address', 'bytes'], [validator.address, transformSignature(signature)]);
|
|
119
|
-
return packedSig;
|
|
116
|
+
async function packSignature(signature, validator, transformSignature = (signature) => signature) {
|
|
117
|
+
return (0, viem_1.encodePacked)(['address', 'bytes'], [validator.address, transformSignature(signature)]);
|
|
120
118
|
}
|
|
121
119
|
async function getSmartAccount(client, address, owners, validatorAddress, sign) {
|
|
122
120
|
return getBaseSmartAccount(address, client, validatorAddress, async () => {
|
|
@@ -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('0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000444b63e800d0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000075798463024bda64d83c94a64bc7d7eab41300ef00000000000000000000000000000000000000000000000000000000000001600000000000000000000000007579f2ad53b01c3d8779fe17928e0d48885b00030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb700000000000000000000000000000000000000000000000000000000000002a447cbbdca0000000000000000000000007579f2ad53b01c3d8779fe17928e0d48885b000300000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016000000000000000000000000020c008719ba9d8aa14c7d07d122cd5e965aa8da50000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da09948693600000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
20
|
+
(0, vitest_1.expect)(salt).toEqual('0x9e6e52d7f64d3d3653e1725f46b188819f7b17d204b24d8d599dacb646f42969');
|
|
21
21
|
(0, vitest_1.expect)(implementation).toEqual('0x29fcb43b46531bca003ddc8fcb67ffe91900c762');
|
|
22
22
|
(0, vitest_1.expect)(initializationCallData).toEqual(null);
|
|
23
23
|
});
|
|
@@ -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('0x45fbf165cd6600f5f989601aa6ccbd2ec8baa136');
|
|
49
49
|
});
|
|
50
50
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
51
51
|
const address = (0, safe_1.getAddress)({
|
|
@@ -72,13 +72,12 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
72
72
|
});
|
|
73
73
|
(0, vitest_1.describe)('Get Packed Signature', () => {
|
|
74
74
|
(0, vitest_1.test)('Mock signature', async () => {
|
|
75
|
-
const hash = '0xabcd';
|
|
76
75
|
const mockSignature = '0x1234';
|
|
77
76
|
const validator = {
|
|
78
77
|
address: '0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb4',
|
|
79
78
|
isRoot: true,
|
|
80
79
|
};
|
|
81
|
-
const signature = await (0, safe_1.
|
|
80
|
+
const signature = await (0, safe_1.packSignature)(mockSignature, validator);
|
|
82
81
|
(0, vitest_1.expect)(signature).toEqual('0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb41234');
|
|
83
82
|
});
|
|
84
83
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Account, type Chain, type Hex } from 'viem';
|
|
2
|
+
import type { WebAuthnAccount } from 'viem/_types/account-abstraction';
|
|
3
|
+
import type { OwnerSet, SignerSet } from '../../types';
|
|
4
|
+
declare function convertOwnerSetToSignerSet(owners: OwnerSet): SignerSet;
|
|
5
|
+
type SigningFunctions<T> = {
|
|
6
|
+
signEcdsa: (account: Account, params: T) => Promise<Hex>;
|
|
7
|
+
signPasskey: (account: WebAuthnAccount, chain: Chain, params: T) => Promise<Hex>;
|
|
8
|
+
};
|
|
9
|
+
declare function signWithMultiFactorAuth<T>(signers: SignerSet & {
|
|
10
|
+
type: 'owner';
|
|
11
|
+
kind: 'multi-factor';
|
|
12
|
+
}, chain: Chain, params: T, signMain: (signers: SignerSet, chain: Chain, params: T) => Promise<Hex>): Promise<Hex>;
|
|
13
|
+
declare function signWithSession<T>(signers: SignerSet & {
|
|
14
|
+
type: 'session';
|
|
15
|
+
}, chain: Chain, params: T, signMain: (signers: SignerSet, chain: Chain, params: T) => Promise<Hex>): Promise<Hex>;
|
|
16
|
+
declare function signWithGuardians<T>(signers: SignerSet & {
|
|
17
|
+
type: 'guardians';
|
|
18
|
+
}, params: T, signingFunctions: SigningFunctions<T>): Promise<Hex>;
|
|
19
|
+
declare function signWithOwners<T>(signers: SignerSet & {
|
|
20
|
+
type: 'owner';
|
|
21
|
+
}, chain: Chain, params: T, signingFunctions: SigningFunctions<T>, signMain: (signers: SignerSet, chain: Chain, params: T) => Promise<Hex>): Promise<Hex>;
|
|
22
|
+
export { convertOwnerSetToSignerSet, signWithMultiFactorAuth, signWithSession, signWithGuardians, signWithOwners, type SigningFunctions, };
|
|
23
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/common.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,K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I,EAAE,WAAW,CAAA;CAAE,EAC1C,MAAM,EAAE,CAAC,EACT,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,GACpC,OAAO,CAAC,GAAG,CAAC,CAOd;AAED,iBAAe,cAAc,CAAC,CAAC,EAC7B,OAAO,EAAE,SAAS,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,EACtC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,CAAC,EACT,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACrC,QAAQ,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,GACtE,OAAO,CAAC,GAAG,CAAC,CAoBd;AAED,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,KAAK,gBAAgB,GACtB,CAAA"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertOwnerSetToSignerSet = convertOwnerSetToSignerSet;
|
|
4
|
+
exports.signWithMultiFactorAuth = signWithMultiFactorAuth;
|
|
5
|
+
exports.signWithSession = signWithSession;
|
|
6
|
+
exports.signWithGuardians = signWithGuardians;
|
|
7
|
+
exports.signWithOwners = signWithOwners;
|
|
8
|
+
const viem_1 = require("viem");
|
|
9
|
+
const core_1 = require("../../modules/validators/core");
|
|
10
|
+
function convertOwnerSetToSignerSet(owners) {
|
|
11
|
+
switch (owners.type) {
|
|
12
|
+
case 'ecdsa': {
|
|
13
|
+
return {
|
|
14
|
+
type: 'owner',
|
|
15
|
+
kind: 'ecdsa',
|
|
16
|
+
accounts: owners.accounts,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
case 'passkey': {
|
|
20
|
+
return {
|
|
21
|
+
type: 'owner',
|
|
22
|
+
kind: 'passkey',
|
|
23
|
+
account: owners.account,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
case 'multi-factor': {
|
|
27
|
+
return {
|
|
28
|
+
type: 'owner',
|
|
29
|
+
kind: 'multi-factor',
|
|
30
|
+
validators: owners.validators.map((validator, index) => {
|
|
31
|
+
switch (validator.type) {
|
|
32
|
+
case 'ecdsa': {
|
|
33
|
+
return {
|
|
34
|
+
type: 'ecdsa',
|
|
35
|
+
id: index,
|
|
36
|
+
accounts: validator.accounts,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
case 'passkey': {
|
|
40
|
+
return {
|
|
41
|
+
type: 'passkey',
|
|
42
|
+
id: index,
|
|
43
|
+
account: validator.account,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function signWithMultiFactorAuth(signers, chain, params, signMain) {
|
|
53
|
+
const signatures = await Promise.all(signers.validators.map(async (validator) => {
|
|
54
|
+
if (validator === null) {
|
|
55
|
+
return '0x';
|
|
56
|
+
}
|
|
57
|
+
const validatorSigners = convertOwnerSetToSignerSet(validator);
|
|
58
|
+
return signMain(validatorSigners, chain, params);
|
|
59
|
+
}));
|
|
60
|
+
const data = (0, viem_1.encodeAbiParameters)([
|
|
61
|
+
{
|
|
62
|
+
components: [
|
|
63
|
+
{
|
|
64
|
+
internalType: 'bytes32',
|
|
65
|
+
name: 'packedValidatorAndId',
|
|
66
|
+
type: 'bytes32',
|
|
67
|
+
},
|
|
68
|
+
{ internalType: 'bytes', name: 'data', type: 'bytes' },
|
|
69
|
+
],
|
|
70
|
+
name: 'validators',
|
|
71
|
+
type: 'tuple[]',
|
|
72
|
+
},
|
|
73
|
+
], [
|
|
74
|
+
signers.validators.map((validator, index) => {
|
|
75
|
+
const validatorModule = (0, core_1.getValidator)(validator);
|
|
76
|
+
return {
|
|
77
|
+
packedValidatorAndId: (0, viem_1.concat)([
|
|
78
|
+
(0, viem_1.pad)((0, viem_1.toHex)(validator.id), {
|
|
79
|
+
size: 12,
|
|
80
|
+
}),
|
|
81
|
+
validatorModule.address,
|
|
82
|
+
]),
|
|
83
|
+
data: signatures[index],
|
|
84
|
+
};
|
|
85
|
+
}),
|
|
86
|
+
]);
|
|
87
|
+
return data;
|
|
88
|
+
}
|
|
89
|
+
async function signWithSession(signers, chain, params, signMain) {
|
|
90
|
+
const sessionSigners = convertOwnerSetToSignerSet(signers.session.owners);
|
|
91
|
+
return signMain(sessionSigners, chain, params);
|
|
92
|
+
}
|
|
93
|
+
async function signWithGuardians(signers, params, signingFunctions) {
|
|
94
|
+
const signatures = await Promise.all(signers.guardians.map((account) => signingFunctions.signEcdsa(account, params)));
|
|
95
|
+
return (0, viem_1.concat)(signatures);
|
|
96
|
+
}
|
|
97
|
+
async function signWithOwners(signers, chain, params, signingFunctions, signMain) {
|
|
98
|
+
switch (signers.kind) {
|
|
99
|
+
case 'ecdsa': {
|
|
100
|
+
const signatures = await Promise.all(signers.accounts.map((account) => signingFunctions.signEcdsa(account, params)));
|
|
101
|
+
return (0, viem_1.concat)(signatures);
|
|
102
|
+
}
|
|
103
|
+
case 'passkey': {
|
|
104
|
+
return await signingFunctions.signPasskey(signers.account, chain, params);
|
|
105
|
+
}
|
|
106
|
+
case 'multi-factor': {
|
|
107
|
+
return signWithMultiFactorAuth(signers, chain, params, signMain);
|
|
108
|
+
}
|
|
109
|
+
default: {
|
|
110
|
+
throw new Error('Unsupported owner kind');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,EAEV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAMb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAS5C,iBAAe,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAiB7E;AA+BD,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sign = sign;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const modules_1 = require("../../modules");
|
|
6
|
+
const error_1 = require("../error");
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
async function sign(signers, chain, hash) {
|
|
9
|
+
const signingFunctions = {
|
|
10
|
+
signEcdsa: (account, hash) => signEcdsa(account, hash),
|
|
11
|
+
signPasskey: (account, chain, hash) => signPasskey(account, chain, hash),
|
|
12
|
+
};
|
|
13
|
+
switch (signers.type) {
|
|
14
|
+
case 'owner': {
|
|
15
|
+
return (0, common_1.signWithOwners)(signers, chain, hash, signingFunctions, sign);
|
|
16
|
+
}
|
|
17
|
+
case 'session': {
|
|
18
|
+
return (0, common_1.signWithSession)(signers, chain, hash, sign);
|
|
19
|
+
}
|
|
20
|
+
case 'guardians': {
|
|
21
|
+
return (0, common_1.signWithGuardians)(signers, hash, signingFunctions);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function signEcdsa(account, hash) {
|
|
26
|
+
if (!account.signMessage) {
|
|
27
|
+
throw new error_1.SigningNotSupportedForAccountError();
|
|
28
|
+
}
|
|
29
|
+
const originalSignature = await account.signMessage({
|
|
30
|
+
message: { raw: hash },
|
|
31
|
+
});
|
|
32
|
+
// Manually tweak the `v` value to trigger the message prefixing onchain
|
|
33
|
+
// https://github.com/rhinestonewtf/checknsignatures/blob/main/src/CheckNSignatures.sol#L53-L61
|
|
34
|
+
const { r, s, v } = (0, viem_1.parseSignature)(originalSignature);
|
|
35
|
+
if (!v) {
|
|
36
|
+
throw new Error('Invalid signature');
|
|
37
|
+
}
|
|
38
|
+
const newV = v + 4n;
|
|
39
|
+
const newSignature = (0, viem_1.concat)([r, s, (0, viem_1.toHex)(newV)]);
|
|
40
|
+
return newSignature;
|
|
41
|
+
}
|
|
42
|
+
async function signPasskey(account, chain, hash) {
|
|
43
|
+
const { webauthn, signature } = await account.sign({ hash });
|
|
44
|
+
const usePrecompiled = (0, modules_1.isRip7212SupportedNetwork)(chain);
|
|
45
|
+
const encodedSignature = (0, modules_1.getWebauthnValidatorSignature)({
|
|
46
|
+
webauthn,
|
|
47
|
+
signature,
|
|
48
|
+
usePrecompiled,
|
|
49
|
+
});
|
|
50
|
+
return encodedSignature;
|
|
51
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Chain, HashTypedDataParameters, Hex, TypedData } from 'viem';
|
|
2
|
+
import type { SignerSet } from '../../types';
|
|
3
|
+
declare function sign<typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(signers: SignerSet, chain: Chain, parameters: HashTypedDataParameters<typedData, primaryType>): Promise<Hex>;
|
|
4
|
+
export { sign };
|
|
5
|
+
//# sourceMappingURL=typedData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typedData.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/typedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,KAAK,EACL,uBAAuB,EACvB,GAAG,EACH,SAAS,EACV,MAAM,MAAM,CAAA;AAMb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAS5C,iBAAe,IAAI,CACjB,SAAS,SAAS,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACjE,WAAW,SAAS,MAAM,SAAS,GAAG,cAAc,GAAG,MAAM,SAAS,EAEtE,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,uBAAuB,CAAC,SAAS,EAAE,WAAW,CAAC,GAC1D,OAAO,CAAC,GAAG,CAAC,CAoBd;AAiCD,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sign = sign;
|
|
4
|
+
const modules_1 = require("../../modules");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
async function sign(signers, chain, parameters) {
|
|
8
|
+
const signingFunctions = {
|
|
9
|
+
signEcdsa: (account, params) => signEcdsa(account, params),
|
|
10
|
+
signPasskey: (account, chain, params) => signPasskey(account, chain, params),
|
|
11
|
+
};
|
|
12
|
+
switch (signers.type) {
|
|
13
|
+
case 'owner': {
|
|
14
|
+
return (0, common_1.signWithOwners)(signers, chain, parameters, signingFunctions, sign);
|
|
15
|
+
}
|
|
16
|
+
case 'session': {
|
|
17
|
+
return (0, common_1.signWithSession)(signers, chain, parameters, sign);
|
|
18
|
+
}
|
|
19
|
+
case 'guardians': {
|
|
20
|
+
return (0, common_1.signWithGuardians)(signers, parameters, signingFunctions);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function signEcdsa(account, parameters) {
|
|
25
|
+
if (!account.signTypedData) {
|
|
26
|
+
throw new error_1.SigningNotSupportedForAccountError();
|
|
27
|
+
}
|
|
28
|
+
return await account.signTypedData(parameters);
|
|
29
|
+
}
|
|
30
|
+
async function signPasskey(account, chain, parameters) {
|
|
31
|
+
const { webauthn, signature } = await account.signTypedData(parameters);
|
|
32
|
+
const usePrecompiled = (0, modules_1.isRip7212SupportedNetwork)(chain);
|
|
33
|
+
const encodedSignature = (0, modules_1.getWebauthnValidatorSignature)({
|
|
34
|
+
webauthn,
|
|
35
|
+
signature,
|
|
36
|
+
usePrecompiled,
|
|
37
|
+
});
|
|
38
|
+
return encodedSignature;
|
|
39
|
+
}
|
|
@@ -12,9 +12,9 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
|
12
12
|
};
|
|
13
13
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
14
14
|
declare function getInstallData(module: Module): `0x${string}`;
|
|
15
|
-
declare function
|
|
15
|
+
declare function packSignature(signature: Hex, validator: ValidatorConfig, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
16
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
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
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,
|
|
19
|
+
export { getInstallData, getAddress, packSignature, getDeployArgs, getSmartAccount, getSessionSmartAccount, getGuardianSmartAccount, };
|
|
20
20
|
//# sourceMappingURL=startale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startale.d.ts","sourceRoot":"","sources":["../../../accounts/startale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAatD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO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,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAUlC;AAED,iBAAe,sBAAsB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,OAAO,EACzB,UAAU,EAAE,iBAAiB,GAAG,IAAI,EACpC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAWlC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,gBAAgB,EAAE,OAAO,EACzB,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,oKAUlC;AAED,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,uBAAuB,GACxB,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInstallData = getInstallData;
|
|
4
4
|
exports.getAddress = getAddress;
|
|
5
|
-
exports.
|
|
5
|
+
exports.packSignature = packSignature;
|
|
6
6
|
exports.getDeployArgs = getDeployArgs;
|
|
7
7
|
exports.getSmartAccount = getSmartAccount;
|
|
8
8
|
exports.getSessionSmartAccount = getSessionSmartAccount;
|
|
@@ -86,8 +86,8 @@ function getAddress(config) {
|
|
|
86
86
|
function getInstallData(module) {
|
|
87
87
|
return (0, nexus_1.getInstallData)(module);
|
|
88
88
|
}
|
|
89
|
-
async function
|
|
90
|
-
return (0, nexus_1.
|
|
89
|
+
async function packSignature(signature, validator, transformSignature = (signature) => signature) {
|
|
90
|
+
return (0, nexus_1.packSignature)(signature, validator, transformSignature, K1_DEFAULT_VALIDATOR_ADDRESS);
|
|
91
91
|
}
|
|
92
92
|
async function getSmartAccount(client, address, owners, validatorAddress, sign) {
|
|
93
93
|
return (0, nexus_1.getSmartAccount)(client, address, owners, validatorAddress, sign, K1_DEFAULT_VALIDATOR_ADDRESS);
|
|
@@ -19,10 +19,10 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
19
19
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
20
20
|
});
|
|
21
21
|
(0, vitest_1.expect)(factory).toEqual('0x0000003B3E7b530b4f981aE80d9350392Defef90');
|
|
22
|
-
(0, vitest_1.expect)(factoryData).toEqual('
|
|
22
|
+
(0, vitest_1.expect)(factoryData).toEqual('0xea6d13ac0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003240984b2f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000020c008719ba9d8aa14c7d07d122cd5e965aa8da5000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
23
23
|
(0, vitest_1.expect)(salt).toEqual('0x0000000000000000000000000000000000000000000000000000000000000000');
|
|
24
24
|
(0, vitest_1.expect)(implementation).toEqual('0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a');
|
|
25
|
-
(0, vitest_1.expect)(initializationCallData).toEqual('
|
|
25
|
+
(0, vitest_1.expect)(initializationCallData).toEqual('0x4b6a1419000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003240984b2f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000020c008719ba9d8aa14c7d07d122cd5e965aa8da5000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
26
26
|
});
|
|
27
27
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
28
28
|
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, startale_1.getDeployArgs)({
|
|
@@ -54,7 +54,7 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
54
54
|
},
|
|
55
55
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
56
56
|
});
|
|
57
|
-
(0, vitest_1.expect)(address).toEqual('
|
|
57
|
+
(0, vitest_1.expect)(address).toEqual('0xf7782b971b6d4c38f99cbb1420993c244f957ed0');
|
|
58
58
|
});
|
|
59
59
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
60
60
|
const address = (0, startale_1.getAddress)({
|
|
@@ -84,13 +84,12 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
84
84
|
});
|
|
85
85
|
(0, vitest_1.describe)('Get Packed Signature', () => {
|
|
86
86
|
(0, vitest_1.test)('Mock signature', async () => {
|
|
87
|
-
const hash = '0xabcd';
|
|
88
87
|
const mockSignature = '0x1234';
|
|
89
88
|
const validator = {
|
|
90
89
|
address: '0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb4',
|
|
91
90
|
isRoot: true,
|
|
92
91
|
};
|
|
93
|
-
const signature = await (0, startale_1.
|
|
92
|
+
const signature = await (0, startale_1.packSignature)(mockSignature, validator);
|
|
94
93
|
(0, vitest_1.expect)(signature).toEqual('0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb41234');
|
|
95
94
|
});
|
|
96
95
|
});
|