@charterlabs/rhinestone-sdk 0.2.6 → 0.2.7-dev.1
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.map +1 -1
- package/dist/src/accounts/index.js +9 -8
- package/dist/src/accounts/index.test.js +3 -3
- package/dist/src/accounts/json-rpc/index.d.ts +5 -0
- package/dist/src/accounts/json-rpc/index.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.js +16 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.test.js +16 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +4 -0
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.js +14 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.test.js +15 -0
- package/dist/src/accounts/kernel.test.js +8 -8
- package/dist/src/accounts/nexus.d.ts +1 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +43 -73
- package/dist/src/accounts/nexus.test.js +12 -12
- package/dist/src/accounts/safe.test.js +8 -8
- package/dist/src/accounts/signing/common.d.ts +10 -6
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +29 -9
- package/dist/src/accounts/signing/message.d.ts +2 -2
- package/dist/src/accounts/signing/message.d.ts.map +1 -1
- package/dist/src/accounts/signing/message.js +7 -9
- package/dist/src/accounts/signing/passkeys.d.ts +29 -0
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -0
- package/dist/src/accounts/signing/passkeys.js +90 -0
- package/dist/src/accounts/signing/passkeys.test.d.ts +2 -0
- package/dist/src/accounts/signing/passkeys.test.d.ts.map +1 -0
- package/dist/src/accounts/signing/passkeys.test.js +73 -0
- package/dist/src/accounts/signing/typedData.d.ts +2 -2
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
- package/dist/src/accounts/signing/typedData.js +7 -9
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +1 -1
- package/dist/src/accounts/startale.test.js +8 -8
- package/dist/src/accounts/utils.d.ts +3 -3
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +3 -40
- package/dist/src/actions/index.d.ts +45 -1
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +168 -6
- package/dist/src/actions/index.test.js +16 -16
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +3 -6
- package/dist/src/execution/utils.d.ts +1 -1
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +12 -14
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -3
- package/dist/src/modules/index.d.ts +2 -17
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +4 -49
- package/dist/src/modules/index.test.js +2 -22
- package/dist/src/modules/omni-account.d.ts +2 -1
- package/dist/src/modules/omni-account.d.ts.map +1 -1
- package/dist/src/modules/omni-account.js +3 -1
- package/dist/src/modules/validators/core.d.ts +2 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +45 -43
- package/dist/src/modules/validators/core.test.js +6 -6
- package/dist/src/modules/validators/smart-sessions.test.js +4 -4
- package/dist/src/modules/validators/webauthn-contract.d.ts.map +1 -1
- package/dist/src/orchestrator/client.d.ts +2 -2
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.d.ts +2 -1
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +3 -1
- package/dist/src/orchestrator/index.d.ts +1 -1
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.d.ts +1 -23
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +22 -24
- package/dist/src/orchestrator/registry.test.js +4 -4
- package/dist/src/orchestrator/types.d.ts +1 -6
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/types.d.ts +10 -4
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src/orchestrator/registry.json +0 -365
|
@@ -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('0xea6d13ac0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003240984b2f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e98000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
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('0x4b6a1419000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003240984b2f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e98000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
26
26
|
});
|
|
27
27
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
28
28
|
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, startale_1.getDeployArgs)({
|
|
@@ -31,15 +31,15 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
31
31
|
},
|
|
32
32
|
owners: {
|
|
33
33
|
type: 'passkey',
|
|
34
|
-
|
|
34
|
+
accounts: [consts_1.passkeyAccount],
|
|
35
35
|
},
|
|
36
36
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
37
37
|
});
|
|
38
38
|
(0, vitest_1.expect)(factory).toEqual('0x0000003B3E7b530b4f981aE80d9350392Defef90');
|
|
39
|
-
(0, vitest_1.expect)(factoryData).toEqual('
|
|
39
|
+
(0, vitest_1.expect)(factoryData).toEqual('0xea6d13ac0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003440984b2f700000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000578c4cb0e472a5462da43c495c3f33000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
40
40
|
(0, vitest_1.expect)(salt).toEqual('0x0000000000000000000000000000000000000000000000000000000000000000');
|
|
41
41
|
(0, vitest_1.expect)(implementation).toEqual('0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a');
|
|
42
|
-
(0, vitest_1.expect)(initializationCallData).toEqual('
|
|
42
|
+
(0, vitest_1.expect)(initializationCallData).toEqual('0x4b6a1419000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003440984b2f700000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000578c4cb0e472a5462da43c495c3f33000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
(0, vitest_1.describe)('Get Address', () => {
|
|
@@ -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('0x614ea8885429c480a83deddd2e050d411da36d4b');
|
|
58
58
|
});
|
|
59
59
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
60
60
|
const address = (0, startale_1.getAddress)({
|
|
@@ -63,11 +63,11 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
63
63
|
},
|
|
64
64
|
owners: {
|
|
65
65
|
type: 'passkey',
|
|
66
|
-
|
|
66
|
+
accounts: [consts_1.passkeyAccount],
|
|
67
67
|
},
|
|
68
68
|
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
69
69
|
});
|
|
70
|
-
(0, vitest_1.expect)(address).toEqual('
|
|
70
|
+
(0, vitest_1.expect)(address).toEqual('0x4d78f6b273d07f2fd24433ebc7a90d89f0d061ae');
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
(0, vitest_1.describe)('Get Install Data', () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Address,
|
|
2
|
-
import type {
|
|
1
|
+
import type { Address, Client, Hex } from 'viem';
|
|
2
|
+
import type { RhinestoneAccountConfig } from '../types';
|
|
3
|
+
import { createTransport } from './json-rpc';
|
|
3
4
|
type CallType = 'call' | 'delegatecall' | 'batchcall';
|
|
4
5
|
interface ValidatorConfig {
|
|
5
6
|
address: Address;
|
|
@@ -27,7 +28,6 @@ interface GetAccountNonceParams {
|
|
|
27
28
|
declare function encode7579Calls<callType extends CallType>({ mode, callData, }: EncodeCallDataParams<callType>): Hex;
|
|
28
29
|
declare function getAccountNonce(client: Client, args: GetAccountNonceParams): Promise<bigint>;
|
|
29
30
|
declare function getBundlerClient(config: RhinestoneAccountConfig, client: Client): import("viem/account-abstraction").BundlerClient<import("viem").HttpTransport<undefined, false>, undefined, undefined, Client, undefined>;
|
|
30
|
-
declare function createTransport(chain: Chain, provider?: ProviderConfig): Transport;
|
|
31
31
|
export { encode7579Calls, getAccountNonce, getBundlerClient, createTransport };
|
|
32
32
|
export type { ValidatorConfig };
|
|
33
33
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../accounts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../accounts/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAgBhD,OAAO,KAAK,EAGV,uBAAuB,EACxB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,KAAK,QAAQ,GAAG,MAAM,GAAG,cAAc,GAAG,WAAW,CAAA;AAErD,UAAU,eAAe;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,UAAU,aAAa,CAAC,QAAQ,SAAS,QAAQ;IAC/C,IAAI,EAAE,QAAQ,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,GAAG,CAAA;IACd,OAAO,CAAC,EAAE,GAAG,CAAA;CACd;AAED,UAAU,oBAAoB,CAAC,QAAQ,SAAS,QAAQ;IACtD,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;IAC7B,QAAQ,EAAE,SAAS;QACjB,EAAE,EAAE,OAAO,CAAA;QACX,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,EAAE,GAAG,GAAG,SAAS,CAAA;KACvB,EAAE,CAAA;CACJ;AAED,UAAU,qBAAqB;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAkDD,iBAAS,eAAe,CAAC,QAAQ,SAAS,QAAQ,EAAE,EAClD,IAAI,EACJ,QAAQ,GACT,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,GAAG,CAuFtC;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAmCjB;AAED,iBAAS,gBAAgB,CAAC,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,6IA2CxE;AAyBD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAA;AAC9E,YAAY,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTransport = void 0;
|
|
3
4
|
exports.encode7579Calls = encode7579Calls;
|
|
4
5
|
exports.getAccountNonce = getAccountNonce;
|
|
5
6
|
exports.getBundlerClient = getBundlerClient;
|
|
6
|
-
exports.createTransport = createTransport;
|
|
7
7
|
const viem_1 = require("viem");
|
|
8
8
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
9
9
|
const actions_1 = require("viem/actions");
|
|
10
|
-
const chains_1 = require("viem/chains");
|
|
11
10
|
const utils_1 = require("viem/utils");
|
|
11
|
+
const json_rpc_1 = require("./json-rpc");
|
|
12
|
+
Object.defineProperty(exports, "createTransport", { enumerable: true, get: function () { return json_rpc_1.createTransport; } });
|
|
12
13
|
function parseCallType(callType) {
|
|
13
14
|
switch (callType) {
|
|
14
15
|
case 'call':
|
|
@@ -198,41 +199,3 @@ async function getGasPriceEstimate(bundlerUrl) {
|
|
|
198
199
|
maxPriorityFeePerGas: BigInt(json.result.fast.maxPriorityFeePerGas),
|
|
199
200
|
};
|
|
200
201
|
}
|
|
201
|
-
function createTransport(chain, provider) {
|
|
202
|
-
if (!provider) {
|
|
203
|
-
return (0, viem_1.http)();
|
|
204
|
-
}
|
|
205
|
-
switch (provider.type) {
|
|
206
|
-
case 'alchemy': {
|
|
207
|
-
const alchemyNetwork = getAlchemyNetworkName(chain.id);
|
|
208
|
-
const jsonRpcEndpoint = `https://${alchemyNetwork}.g.alchemy.com/v2/${provider.apiKey}`;
|
|
209
|
-
return (0, viem_1.http)(jsonRpcEndpoint);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
function getAlchemyNetworkName(chainId) {
|
|
214
|
-
switch (chainId) {
|
|
215
|
-
case chains_1.mainnet.id:
|
|
216
|
-
return 'eth-mainnet';
|
|
217
|
-
case chains_1.sepolia.id:
|
|
218
|
-
return 'eth-sepolia';
|
|
219
|
-
case chains_1.polygon.id:
|
|
220
|
-
return 'polygon-mainnet';
|
|
221
|
-
case chains_1.optimism.id:
|
|
222
|
-
return 'opt-mainnet';
|
|
223
|
-
case chains_1.optimismSepolia.id:
|
|
224
|
-
return 'opt-sepolia';
|
|
225
|
-
case chains_1.arbitrum.id:
|
|
226
|
-
return 'arb-mainnet';
|
|
227
|
-
case chains_1.arbitrumSepolia.id:
|
|
228
|
-
return 'arb-sepolia';
|
|
229
|
-
case chains_1.base.id:
|
|
230
|
-
return 'base-mainnet';
|
|
231
|
-
case chains_1.baseSepolia.id:
|
|
232
|
-
return 'base-sepolia';
|
|
233
|
-
case chains_1.zksync.id:
|
|
234
|
-
return 'zksync-mainnet';
|
|
235
|
-
case chains_1.soneium.id:
|
|
236
|
-
return 'soneium-mainnet';
|
|
237
|
-
}
|
|
238
|
-
}
|
|
@@ -20,6 +20,7 @@ declare function setUpRecovery({ rhinestoneAccount, guardians, threshold, }: {
|
|
|
20
20
|
* @param chain Chain to recover ownership on
|
|
21
21
|
* @param provider Provider to use for the recovery
|
|
22
22
|
* @returns Calls to recover ownership
|
|
23
|
+
* @deprecated Use `recoverEcdsaOwnership` or `recoverPasskeyOwnership` instead
|
|
23
24
|
*/
|
|
24
25
|
declare function recover(address: Address, newOwners: OwnerSet, chain: Chain, provider?: ProviderConfig): Promise<Call[]>;
|
|
25
26
|
/**
|
|
@@ -79,6 +80,49 @@ declare function removeOwner(prevOwner: Address, ownerToRemove: Address): Call;
|
|
|
79
80
|
* @returns Call to change the threshold
|
|
80
81
|
*/
|
|
81
82
|
declare function changeThreshold(newThreshold: number): Call;
|
|
83
|
+
/**
|
|
84
|
+
* Add a passkey owner
|
|
85
|
+
* @param pubKeyX Public key X
|
|
86
|
+
* @param pubKeyY Public key Y
|
|
87
|
+
* @param requireUserVerification Whether to require user verification
|
|
88
|
+
* @returns Call to add the passkey owner
|
|
89
|
+
*/
|
|
90
|
+
declare function addPasskeyOwner(pubKeyX: bigint, pubKeyY: bigint, requireUserVerification: boolean): Call;
|
|
91
|
+
/**
|
|
92
|
+
* Remove a passkey owner
|
|
93
|
+
* @param pubKeyX Public key X
|
|
94
|
+
* @param pubKeyY Public key Y
|
|
95
|
+
* @returns Call to remove the passkey owner
|
|
96
|
+
*/
|
|
97
|
+
declare function removePasskeyOwner(pubKeyX: bigint, pubKeyY: bigint): Call;
|
|
98
|
+
/**
|
|
99
|
+
* Change an account's signer threshold (passkey)
|
|
100
|
+
* @param newThreshold New threshold
|
|
101
|
+
* @returns Call to change the threshold
|
|
102
|
+
*/
|
|
103
|
+
declare function changePasskeyThreshold(newThreshold: number): Call;
|
|
104
|
+
/**
|
|
105
|
+
* Recover an account's ownership (ECDSA)
|
|
106
|
+
* @param address Account address
|
|
107
|
+
* @param newOwners New owners
|
|
108
|
+
* @param chain Chain to recover ownership on
|
|
109
|
+
* @param provider Provider to use for the recovery
|
|
110
|
+
* @returns Calls to recover ownership
|
|
111
|
+
*/
|
|
112
|
+
declare function recoverEcdsaOwnership(address: Address, newOwners: OwnableValidatorConfig, chain: Chain, provider?: ProviderConfig): Promise<Call[]>;
|
|
113
|
+
/**
|
|
114
|
+
* Recover an account's ownership (Passkey)
|
|
115
|
+
* @param address Account address
|
|
116
|
+
* @param oldCredentials Old credentials to be replaced (with pubKeyX, pubKeyY)
|
|
117
|
+
* @param newOwners New passkey owners
|
|
118
|
+
* @param chain Chain to recover ownership on
|
|
119
|
+
* @param provider Provider to use for the recovery
|
|
120
|
+
* @returns Calls to recover ownership
|
|
121
|
+
*/
|
|
122
|
+
declare function recoverPasskeyOwnership(address: Address, oldCredentials: {
|
|
123
|
+
pubKeyX: bigint;
|
|
124
|
+
pubKeyY: bigint;
|
|
125
|
+
}[], newOwners: WebauthnValidatorConfig, chain: Chain, provider?: ProviderConfig): Promise<Call[]>;
|
|
82
126
|
/**
|
|
83
127
|
* Enable multi-factor authentication
|
|
84
128
|
* @param rhinestoneAccount Account to enable multi-factor authentication on
|
|
@@ -119,5 +163,5 @@ declare function setSubValidator(id: Hex | number, validator: OwnableValidatorCo
|
|
|
119
163
|
* @returns Call to remove the sub-validator
|
|
120
164
|
*/
|
|
121
165
|
declare function removeSubValidator(id: Hex | number, validator: OwnableValidatorConfig | WebauthnValidatorConfig): Call;
|
|
122
|
-
export { enableEcdsa, enablePasskeys, disableEcdsa, disablePasskeys, addOwner, removeOwner, changeThreshold, recover, setUpRecovery, encodeSmartSessionSignature, enableMultiFactor, disableMultiFactor, changeMultiFactorThreshold, setSubValidator, removeSubValidator, };
|
|
166
|
+
export { enableEcdsa, enablePasskeys, disableEcdsa, disablePasskeys, addOwner, removeOwner, changeThreshold, addPasskeyOwner, removePasskeyOwner, changePasskeyThreshold, recover, recoverEcdsaOwnership, recoverPasskeyOwnership, setUpRecovery, encodeSmartSessionSignature, enableMultiFactor, disableMultiFactor, changeMultiFactorThreshold, setSubValidator, removeSubValidator, };
|
|
123
167
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAGV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAA;AAM3C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAGV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAA;AAM3C,OAAO,EASL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EACV,IAAI,EACJ,sBAAsB,EACtB,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,uBAAuB,EACxB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAA;AAE7D;;;;;;GAMG;AACH,iBAAS,aAAa,CAAC,EACrB,iBAAiB,EACjB,SAAS,EACT,SAAa,GACd,EAAE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S,kBAAkB,CACzB,EAAE,EAAE,GAAG,GAAG,MAAM,EAChB,SAAS,EAAE,sBAAsB,GAAG,uBAAuB,GAC1D,IAAI,CA2BN;AAED,OAAO,EACL,WAAW,EACX,cAAc,EACd,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,WAAW,EACX,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,OAAO,EACP,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,eAAe,EACf,kBAAkB,GACnB,CAAA"}
|
|
@@ -8,7 +8,12 @@ exports.disablePasskeys = disablePasskeys;
|
|
|
8
8
|
exports.addOwner = addOwner;
|
|
9
9
|
exports.removeOwner = removeOwner;
|
|
10
10
|
exports.changeThreshold = changeThreshold;
|
|
11
|
+
exports.addPasskeyOwner = addPasskeyOwner;
|
|
12
|
+
exports.removePasskeyOwner = removePasskeyOwner;
|
|
13
|
+
exports.changePasskeyThreshold = changePasskeyThreshold;
|
|
11
14
|
exports.recover = recover;
|
|
15
|
+
exports.recoverEcdsaOwnership = recoverEcdsaOwnership;
|
|
16
|
+
exports.recoverPasskeyOwnership = recoverPasskeyOwnership;
|
|
12
17
|
exports.setUpRecovery = setUpRecovery;
|
|
13
18
|
exports.enableMultiFactor = enableMultiFactor;
|
|
14
19
|
exports.disableMultiFactor = disableMultiFactor;
|
|
@@ -40,6 +45,7 @@ function setUpRecovery({ rhinestoneAccount, guardians, threshold = 1, }) {
|
|
|
40
45
|
* @param chain Chain to recover ownership on
|
|
41
46
|
* @param provider Provider to use for the recovery
|
|
42
47
|
* @returns Calls to recover ownership
|
|
48
|
+
* @deprecated Use `recoverEcdsaOwnership` or `recoverPasskeyOwnership` instead
|
|
43
49
|
*/
|
|
44
50
|
async function recover(address, newOwners, chain, provider) {
|
|
45
51
|
switch (newOwners.type) {
|
|
@@ -74,7 +80,7 @@ function enableEcdsa({ rhinestoneAccount, owners, threshold = 1, }) {
|
|
|
74
80
|
* @returns Calls to enable passkeys authentication
|
|
75
81
|
*/
|
|
76
82
|
function enablePasskeys({ rhinestoneAccount, pubKey, authenticatorId, }) {
|
|
77
|
-
const module = (0, core_1.getWebAuthnValidator)({ pubKey, authenticatorId });
|
|
83
|
+
const module = (0, core_1.getWebAuthnValidator)(1, [{ pubKey, authenticatorId }]);
|
|
78
84
|
const calls = (0, accounts_1.getModuleInstallationCalls)(rhinestoneAccount.config, module);
|
|
79
85
|
return calls;
|
|
80
86
|
}
|
|
@@ -94,11 +100,13 @@ function disableEcdsa({ rhinestoneAccount, }) {
|
|
|
94
100
|
* @returns Calls to disable passkeys authentication
|
|
95
101
|
*/
|
|
96
102
|
function disablePasskeys({ rhinestoneAccount, }) {
|
|
97
|
-
const module = (0, core_1.getWebAuthnValidator)(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
const module = (0, core_1.getWebAuthnValidator)(1, [
|
|
104
|
+
{
|
|
105
|
+
// Mocked values
|
|
106
|
+
pubKey: '0x580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d1',
|
|
107
|
+
authenticatorId: '0x',
|
|
108
|
+
},
|
|
109
|
+
]);
|
|
102
110
|
const calls = (0, accounts_1.getModuleUninstallationCalls)(rhinestoneAccount.config, module);
|
|
103
111
|
return calls;
|
|
104
112
|
}
|
|
@@ -180,6 +188,93 @@ function changeThreshold(newThreshold) {
|
|
|
180
188
|
}),
|
|
181
189
|
};
|
|
182
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Add a passkey owner
|
|
193
|
+
* @param pubKeyX Public key X
|
|
194
|
+
* @param pubKeyY Public key Y
|
|
195
|
+
* @param requireUserVerification Whether to require user verification
|
|
196
|
+
* @returns Call to add the passkey owner
|
|
197
|
+
*/
|
|
198
|
+
function addPasskeyOwner(pubKeyX, pubKeyY, requireUserVerification) {
|
|
199
|
+
return {
|
|
200
|
+
to: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
201
|
+
value: 0n,
|
|
202
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
203
|
+
abi: [
|
|
204
|
+
{
|
|
205
|
+
inputs: [
|
|
206
|
+
{ name: 'pubKeyX', type: 'uint256' },
|
|
207
|
+
{ name: 'pubKeyY', type: 'uint256' },
|
|
208
|
+
{
|
|
209
|
+
name: 'requireUserVerification',
|
|
210
|
+
type: 'bool',
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
name: 'addCredential',
|
|
214
|
+
outputs: [],
|
|
215
|
+
stateMutability: 'nonpayable',
|
|
216
|
+
type: 'function',
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
functionName: 'addCredential',
|
|
220
|
+
args: [pubKeyX, pubKeyY, requireUserVerification],
|
|
221
|
+
}),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Remove a passkey owner
|
|
226
|
+
* @param pubKeyX Public key X
|
|
227
|
+
* @param pubKeyY Public key Y
|
|
228
|
+
* @returns Call to remove the passkey owner
|
|
229
|
+
*/
|
|
230
|
+
function removePasskeyOwner(pubKeyX, pubKeyY) {
|
|
231
|
+
return {
|
|
232
|
+
to: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
233
|
+
value: 0n,
|
|
234
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
235
|
+
abi: [
|
|
236
|
+
{
|
|
237
|
+
inputs: [
|
|
238
|
+
{ name: 'pubKeyX', type: 'uint256' },
|
|
239
|
+
{ name: 'pubKeyY', type: 'uint256' },
|
|
240
|
+
],
|
|
241
|
+
name: 'removeCredential',
|
|
242
|
+
outputs: [],
|
|
243
|
+
stateMutability: 'nonpayable',
|
|
244
|
+
type: 'function',
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
functionName: 'removeCredential',
|
|
248
|
+
args: [pubKeyX, pubKeyY],
|
|
249
|
+
}),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Change an account's signer threshold (passkey)
|
|
254
|
+
* @param newThreshold New threshold
|
|
255
|
+
* @returns Call to change the threshold
|
|
256
|
+
*/
|
|
257
|
+
function changePasskeyThreshold(newThreshold) {
|
|
258
|
+
return {
|
|
259
|
+
to: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
260
|
+
value: 0n,
|
|
261
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
262
|
+
abi: [
|
|
263
|
+
{
|
|
264
|
+
inputs: [
|
|
265
|
+
{ internalType: 'uint256', name: '_threshold', type: 'uint256' },
|
|
266
|
+
],
|
|
267
|
+
name: 'setThreshold',
|
|
268
|
+
outputs: [],
|
|
269
|
+
stateMutability: 'nonpayable',
|
|
270
|
+
type: 'function',
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
functionName: 'setThreshold',
|
|
274
|
+
args: [BigInt(newThreshold)],
|
|
275
|
+
}),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
183
278
|
/**
|
|
184
279
|
* Recover an account's ownership (ECDSA)
|
|
185
280
|
* @param address Account address
|
|
@@ -278,6 +373,73 @@ async function recoverEcdsaOwnership(address, newOwners, chain, provider) {
|
|
|
278
373
|
}
|
|
279
374
|
return calls;
|
|
280
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Recover an account's ownership (Passkey)
|
|
378
|
+
* @param address Account address
|
|
379
|
+
* @param oldCredentials Old credentials to be replaced (with pubKeyX, pubKeyY)
|
|
380
|
+
* @param newOwners New passkey owners
|
|
381
|
+
* @param chain Chain to recover ownership on
|
|
382
|
+
* @param provider Provider to use for the recovery
|
|
383
|
+
* @returns Calls to recover ownership
|
|
384
|
+
*/
|
|
385
|
+
async function recoverPasskeyOwnership(address, oldCredentials, newOwners, chain, provider) {
|
|
386
|
+
const publicClient = (0, viem_1.createPublicClient)({
|
|
387
|
+
chain,
|
|
388
|
+
transport: (0, utils_1.createTransport)(chain, provider),
|
|
389
|
+
});
|
|
390
|
+
const existingThreshold = await publicClient.readContract({
|
|
391
|
+
address: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
|
|
392
|
+
abi: [
|
|
393
|
+
{
|
|
394
|
+
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
|
|
395
|
+
name: 'threshold',
|
|
396
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
397
|
+
stateMutability: 'view',
|
|
398
|
+
type: 'function',
|
|
399
|
+
},
|
|
400
|
+
],
|
|
401
|
+
functionName: 'threshold',
|
|
402
|
+
args: [address],
|
|
403
|
+
});
|
|
404
|
+
const calls = [];
|
|
405
|
+
// Convert new owners config to credentials and threshold
|
|
406
|
+
const newCredentials = newOwners.accounts.map((account) => {
|
|
407
|
+
const publicKey = account.publicKey;
|
|
408
|
+
// Parse the public key hex string to extract x and y coordinates
|
|
409
|
+
const publicKeyBytes = publicKey.startsWith('0x')
|
|
410
|
+
? publicKey.slice(2)
|
|
411
|
+
: publicKey;
|
|
412
|
+
// The public key is 64 bytes: 32 bytes for x, 32 bytes for y
|
|
413
|
+
const x = BigInt(`0x${publicKeyBytes.slice(0, 64)}`);
|
|
414
|
+
const y = BigInt(`0x${publicKeyBytes.slice(64, 128)}`);
|
|
415
|
+
return {
|
|
416
|
+
pubKeyX: x,
|
|
417
|
+
pubKeyY: y,
|
|
418
|
+
requireUV: false, // Default to false for now
|
|
419
|
+
};
|
|
420
|
+
});
|
|
421
|
+
const newThreshold = newOwners.threshold ?? 1;
|
|
422
|
+
// Check if threshold needs to be updated
|
|
423
|
+
if (Number(existingThreshold) !== newThreshold) {
|
|
424
|
+
calls.push(changePasskeyThreshold(newThreshold));
|
|
425
|
+
}
|
|
426
|
+
// Compare existing and new credentials to determine what to add/remove
|
|
427
|
+
const existingCredentialKeys = oldCredentials.map((cred) => `${cred.pubKeyX.toString()}-${cred.pubKeyY.toString()}`);
|
|
428
|
+
const newCredentialKeys = newCredentials.map((cred) => `${cred.pubKeyX.toString()}-${cred.pubKeyY.toString()}`);
|
|
429
|
+
// Find credentials to add (new ones not in existing)
|
|
430
|
+
const credentialsToAdd = newCredentials.filter((cred) => !existingCredentialKeys.includes(`${cred.pubKeyX.toString()}-${cred.pubKeyY.toString()}`));
|
|
431
|
+
// Find credentials to remove (existing ones not in new)
|
|
432
|
+
const credentialsToRemove = oldCredentials.filter((cred) => !newCredentialKeys.includes(`${cred.pubKeyX.toString()}-${cred.pubKeyY.toString()}`));
|
|
433
|
+
// Remove old credentials first (important for security in recovery scenarios)
|
|
434
|
+
for (const credential of credentialsToRemove) {
|
|
435
|
+
calls.push(removePasskeyOwner(credential.pubKeyX, credential.pubKeyY));
|
|
436
|
+
}
|
|
437
|
+
// Then add new credentials
|
|
438
|
+
for (const credential of credentialsToAdd) {
|
|
439
|
+
calls.push(addPasskeyOwner(credential.pubKeyX, credential.pubKeyY, credential.requireUV));
|
|
440
|
+
}
|
|
441
|
+
return calls;
|
|
442
|
+
}
|
|
281
443
|
/**
|
|
282
444
|
* Enable multi-factor authentication
|
|
283
445
|
* @param rhinestoneAccount Account to enable multi-factor authentication on
|
|
@@ -10,7 +10,7 @@ const MOCK_OWNER_A = '0xd1aefebdceefc094f1805b241fa5e6db63a9181a';
|
|
|
10
10
|
const MOCK_OWNER_B = '0xeddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817';
|
|
11
11
|
const MOCK_OWNER_C = '0xb31e76f19defe76edc4b7eceeb4b0a2d6ddaca39';
|
|
12
12
|
const MOCK_ACCOUNT_ADDRESS = '0x1234567890123456789012345678901234567890';
|
|
13
|
-
const accountAddress = '
|
|
13
|
+
const accountAddress = '0x36c03e7d593f7b2c6b06fc18b5f4e9a4a29c99b0';
|
|
14
14
|
// Mock viem
|
|
15
15
|
vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
16
16
|
const actual = await importOriginal();
|
|
@@ -37,7 +37,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
37
37
|
{
|
|
38
38
|
to: accountAddress,
|
|
39
39
|
value: 0n,
|
|
40
|
-
data: '
|
|
40
|
+
data: '0x9517e29f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e9800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a',
|
|
41
41
|
},
|
|
42
42
|
]);
|
|
43
43
|
});
|
|
@@ -49,7 +49,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
49
49
|
{
|
|
50
50
|
to: accountAddress,
|
|
51
51
|
value: 0n,
|
|
52
|
-
data: '
|
|
52
|
+
data: '0x9517e29f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e98000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a000000000000000000000000eddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817',
|
|
53
53
|
},
|
|
54
54
|
]);
|
|
55
55
|
});
|
|
@@ -62,7 +62,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
62
62
|
{
|
|
63
63
|
to: accountAddress,
|
|
64
64
|
value: 0n,
|
|
65
|
-
data: '
|
|
65
|
+
data: '0x9517e29f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e98000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000b31e76f19defe76edc4b7eceeb4b0a2d6ddaca39000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a000000000000000000000000eddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817',
|
|
66
66
|
},
|
|
67
67
|
]);
|
|
68
68
|
});
|
|
@@ -84,7 +84,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
84
84
|
{
|
|
85
85
|
to: accountAddress,
|
|
86
86
|
value: 0n,
|
|
87
|
-
data: '
|
|
87
|
+
data: '0x9517e29f00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000578c4cb0e472a5462da43c495c3f33000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d10000000000000000000000000000000000000000000000000000000000000000',
|
|
88
88
|
},
|
|
89
89
|
]);
|
|
90
90
|
});
|
|
@@ -104,7 +104,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
104
104
|
{
|
|
105
105
|
to: accountAddress,
|
|
106
106
|
value: 0n,
|
|
107
|
-
data: '
|
|
107
|
+
data: '0xa71763a80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e9800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000',
|
|
108
108
|
},
|
|
109
109
|
]);
|
|
110
110
|
});
|
|
@@ -132,7 +132,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
132
132
|
(0, vitest_1.describe)('Add Owner', () => {
|
|
133
133
|
(0, vitest_1.test)('', () => {
|
|
134
134
|
(0, vitest_1.expect)((0, _1.addOwner)(MOCK_OWNER_A)).toEqual({
|
|
135
|
-
to: '
|
|
135
|
+
to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
|
|
136
136
|
value: 0n,
|
|
137
137
|
data: '0x7065cb48000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a',
|
|
138
138
|
});
|
|
@@ -141,7 +141,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
141
141
|
(0, vitest_1.describe)('Remove Owner', () => {
|
|
142
142
|
(0, vitest_1.test)('', () => {
|
|
143
143
|
(0, vitest_1.expect)((0, _1.removeOwner)(MOCK_OWNER_A, MOCK_OWNER_B)).toEqual({
|
|
144
|
-
to: '
|
|
144
|
+
to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
|
|
145
145
|
value: 0n,
|
|
146
146
|
data: '0xfbe5ce0a000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a000000000000000000000000eddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817',
|
|
147
147
|
});
|
|
@@ -150,7 +150,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
150
150
|
(0, vitest_1.describe)('Set Threshold', () => {
|
|
151
151
|
(0, vitest_1.test)('', () => {
|
|
152
152
|
(0, vitest_1.expect)((0, _1.changeThreshold)(1)).toEqual({
|
|
153
|
-
to: '
|
|
153
|
+
to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
|
|
154
154
|
value: 0n,
|
|
155
155
|
data: '0x960bfe040000000000000000000000000000000000000000000000000000000000000001',
|
|
156
156
|
});
|
|
@@ -216,12 +216,12 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
216
216
|
(0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
|
|
217
217
|
(0, vitest_1.expect)(result).toEqual([
|
|
218
218
|
{
|
|
219
|
-
to: '
|
|
219
|
+
to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
|
|
220
220
|
value: 0n,
|
|
221
221
|
data: '0x7065cb480000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7',
|
|
222
222
|
},
|
|
223
223
|
{
|
|
224
|
-
to: '
|
|
224
|
+
to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
|
|
225
225
|
value: 0n,
|
|
226
226
|
data: '0xfbe5ce0a0000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
|
|
227
227
|
},
|
|
@@ -249,12 +249,12 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
249
249
|
(0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
|
|
250
250
|
(0, vitest_1.expect)(result).toEqual([
|
|
251
251
|
{
|
|
252
|
-
to: '
|
|
252
|
+
to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
|
|
253
253
|
value: 0n,
|
|
254
254
|
data: '0x7065cb48000000000000000000000000c5587d912c862252599b61926adaef316ba06da0',
|
|
255
255
|
},
|
|
256
256
|
{
|
|
257
|
-
to: '
|
|
257
|
+
to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
|
|
258
258
|
value: 0n,
|
|
259
259
|
data: '0xfbe5ce0a000000000000000000000000c5587d912c862252599b61926adaef316ba06da0000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
|
|
260
260
|
},
|
|
@@ -282,17 +282,17 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
282
282
|
(0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
|
|
283
283
|
(0, vitest_1.expect)(result).toEqual([
|
|
284
284
|
{
|
|
285
|
-
to: '
|
|
285
|
+
to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
|
|
286
286
|
value: 0n,
|
|
287
287
|
data: '0x7065cb48000000000000000000000000c5587d912c862252599b61926adaef316ba06da0',
|
|
288
288
|
},
|
|
289
289
|
{
|
|
290
|
-
to: '
|
|
290
|
+
to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
|
|
291
291
|
value: 0n,
|
|
292
292
|
data: '0xfbe5ce0a000000000000000000000000c5587d912c862252599b61926adaef316ba06da0000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
|
|
293
293
|
},
|
|
294
294
|
{
|
|
295
|
-
to: '
|
|
295
|
+
to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
|
|
296
296
|
value: 0n,
|
|
297
297
|
data: '0xfbe5ce0a0000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000c27b7578151c5ef713c62c65db09763d57ac3596',
|
|
298
298
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAmC,MAAM,MAAM,CAAA;AAKhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAQrD,OAAO,KAAK,EAEV,uBAAuB,EAGvB,WAAW,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,0CAA0C,EAC1C,0CAA0C,EAC3C,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAa5D,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,8BA2BzB;AAyID,iBAAe,gBAAgB,CAC7B,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,iBAAiB,EACzB,uBAAuB,EAAE,OAAO;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAmC,MAAM,MAAM,CAAA;AAKhF,OAAO,KAAK,EAAE,cAAc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