@rhinestone/sdk 1.0.0-alpha.9 → 1.0.0-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/accounts/error.d.ts +38 -3
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +55 -7
- package/dist/src/accounts/index.d.ts +30 -15
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +284 -140
- package/dist/src/accounts/index.test.js +3 -5
- 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.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.d.ts +4 -3
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +32 -6
- package/dist/src/accounts/kernel.test.js +41 -19
- package/dist/src/accounts/nexus.d.ts +11 -4
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +182 -25
- package/dist/src/accounts/nexus.test.js +44 -18
- 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 +88 -58
- package/dist/src/accounts/safe.test.js +40 -14
- package/dist/src/accounts/signing/common.d.ts +27 -0
- package/dist/src/accounts/signing/common.d.ts.map +1 -0
- package/dist/src/accounts/signing/common.js +145 -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 +47 -0
- package/dist/src/accounts/signing/passkeys.d.ts +36 -0
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -0
- package/dist/src/accounts/signing/passkeys.js +125 -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 +88 -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 +35 -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 +9 -14
- package/dist/src/accounts/utils.d.ts +4 -4
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +3 -40
- package/dist/src/accounts/walletClient.d.ts +7 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -0
- package/dist/src/accounts/walletClient.js +38 -0
- package/dist/src/actions/compact.d.ts +13 -0
- package/dist/src/actions/compact.d.ts.map +1 -0
- package/dist/src/actions/compact.js +210 -0
- package/dist/src/actions/ecdsa.d.ts +35 -0
- package/dist/src/actions/ecdsa.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.js +114 -0
- package/dist/src/actions/ecdsa.test.d.ts +2 -0
- package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.test.js +99 -0
- package/dist/src/actions/index.d.ts +23 -38
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +29 -294
- package/dist/src/actions/mfa.d.ts +37 -0
- package/dist/src/actions/mfa.d.ts.map +1 -0
- package/dist/src/actions/mfa.js +133 -0
- package/dist/src/actions/passkeys.d.ts +37 -0
- package/dist/src/actions/passkeys.d.ts.map +1 -0
- package/dist/src/actions/passkeys.js +129 -0
- package/dist/src/actions/passkeys.test.d.ts +2 -0
- package/dist/src/actions/passkeys.test.d.ts.map +1 -0
- package/dist/src/actions/passkeys.test.js +54 -0
- package/dist/src/actions/recovery.d.ts +33 -0
- package/dist/src/actions/recovery.d.ts.map +1 -0
- package/dist/src/actions/recovery.js +193 -0
- package/dist/src/actions/recovery.test.d.ts +2 -0
- package/dist/src/actions/recovery.test.d.ts.map +1 -0
- package/dist/src/actions/recovery.test.js +168 -0
- 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/errors/index.d.ts +5 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/errors/index.js +35 -0
- package/dist/src/execution/compact.d.ts +150 -7
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +112 -95
- package/dist/src/execution/error.d.ts +2 -9
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +4 -13
- package/dist/src/execution/index.d.ts +34 -22
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +62 -42
- package/dist/src/execution/permit2.d.ts +148 -0
- package/dist/src/execution/permit2.d.ts.map +1 -0
- package/dist/src/execution/permit2.js +282 -0
- package/dist/src/execution/smart-session.d.ts +3 -3
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/types.d.ts +35 -0
- package/dist/src/execution/types.d.ts.map +1 -0
- package/dist/src/execution/types.js +2 -0
- package/dist/src/execution/utils.d.ts +36 -27
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +357 -103
- package/dist/src/index.d.ts +41 -22
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +199 -65
- package/dist/src/modules/common.d.ts +10 -4
- package/dist/src/modules/common.d.ts.map +1 -1
- package/dist/src/modules/common.js +22 -1
- package/dist/src/modules/index.d.ts +4 -18
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +15 -63
- package/dist/src/modules/index.test.js +9 -26
- 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/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +4 -0
- package/dist/src/modules/validators/core.d.ts +5 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +64 -41
- package/dist/src/modules/validators/core.test.js +7 -7
- package/dist/src/modules/validators/smart-sessions.js +3 -3
- package/dist/src/modules/validators/smart-sessions.test.js +4 -7
- package/dist/src/orchestrator/client.d.ts +4 -4
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +30 -15
- package/dist/src/orchestrator/index.d.ts +2 -3
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -3
- 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 +37 -33
- package/dist/src/orchestrator/registry.test.js +7 -7
- package/dist/src/orchestrator/types.d.ts +97 -29
- 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 +74 -10
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +72 -1
- package/dist/src/actions/index.test.d.ts.map +0 -1
- package/dist/src/actions/index.test.js +0 -302
- package/dist/src/orchestrator/registry.json +0 -365
- /package/dist/src/{actions → accounts/json-rpc}/index.test.d.ts +0 -0
|
@@ -16,13 +16,12 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
16
16
|
type: 'ecdsa',
|
|
17
17
|
accounts: [consts_1.accountA, consts_1.accountB],
|
|
18
18
|
},
|
|
19
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
20
19
|
});
|
|
21
20
|
(0, vitest_1.expect)(factory).toEqual('0x0000003B3E7b530b4f981aE80d9350392Defef90');
|
|
22
|
-
(0, vitest_1.expect)(factoryData).toEqual('
|
|
21
|
+
(0, vitest_1.expect)(factoryData).toEqual('0xea6d13ac0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003240984b2f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e98000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
23
22
|
(0, vitest_1.expect)(salt).toEqual('0x0000000000000000000000000000000000000000000000000000000000000000');
|
|
24
23
|
(0, vitest_1.expect)(implementation).toEqual('0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a');
|
|
25
|
-
(0, vitest_1.expect)(initializationCallData).toEqual('
|
|
24
|
+
(0, vitest_1.expect)(initializationCallData).toEqual('0x4b6a1419000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003a0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003240984b2f700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e98000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da0994869360000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
26
25
|
});
|
|
27
26
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
28
27
|
const { factory, factoryData, salt, implementation, initializationCallData, } = (0, startale_1.getDeployArgs)({
|
|
@@ -31,15 +30,14 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
31
30
|
},
|
|
32
31
|
owners: {
|
|
33
32
|
type: 'passkey',
|
|
34
|
-
|
|
33
|
+
accounts: [consts_1.passkeyAccount],
|
|
35
34
|
},
|
|
36
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
37
35
|
});
|
|
38
36
|
(0, vitest_1.expect)(factory).toEqual('0x0000003B3E7b530b4f981aE80d9350392Defef90');
|
|
39
|
-
(0, vitest_1.expect)(factoryData).toEqual('
|
|
37
|
+
(0, vitest_1.expect)(factoryData).toEqual('0xea6d13ac0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003440984b2f700000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000578c4cb0e472a5462da43c495c3f33000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
40
38
|
(0, vitest_1.expect)(salt).toEqual('0x0000000000000000000000000000000000000000000000000000000000000000');
|
|
41
39
|
(0, vitest_1.expect)(implementation).toEqual('0x000000b8f5f723a680d3d7ee624fe0bc84a6e05a');
|
|
42
|
-
(0, vitest_1.expect)(initializationCallData).toEqual('
|
|
40
|
+
(0, vitest_1.expect)(initializationCallData).toEqual('0x4b6a1419000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000552a5fae3db7a8f3917c435448f49ba6a9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003440984b2f700000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000578c4cb0e472a5462da43c495c3f33000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000005ad9ce1f5035fd62ca96cef16adaaf000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000');
|
|
43
41
|
});
|
|
44
42
|
});
|
|
45
43
|
(0, vitest_1.describe)('Get Address', () => {
|
|
@@ -52,9 +50,8 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
52
50
|
type: 'ecdsa',
|
|
53
51
|
accounts: [consts_1.accountA, consts_1.accountB],
|
|
54
52
|
},
|
|
55
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
56
53
|
});
|
|
57
|
-
(0, vitest_1.expect)(address).toEqual('
|
|
54
|
+
(0, vitest_1.expect)(address).toEqual('0x614ea8885429c480a83deddd2e050d411da36d4b');
|
|
58
55
|
});
|
|
59
56
|
(0, vitest_1.test)('Passkey owner', () => {
|
|
60
57
|
const address = (0, startale_1.getAddress)({
|
|
@@ -63,11 +60,10 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
63
60
|
},
|
|
64
61
|
owners: {
|
|
65
62
|
type: 'passkey',
|
|
66
|
-
|
|
63
|
+
accounts: [consts_1.passkeyAccount],
|
|
67
64
|
},
|
|
68
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
69
65
|
});
|
|
70
|
-
(0, vitest_1.expect)(address).toEqual('
|
|
66
|
+
(0, vitest_1.expect)(address).toEqual('0x4d78f6b273d07f2fd24433ebc7a90d89f0d061ae');
|
|
71
67
|
});
|
|
72
68
|
});
|
|
73
69
|
(0, vitest_1.describe)('Get Install Data', () => {
|
|
@@ -84,13 +80,12 @@ const MOCK_MODULE_ADDRESS = '0x28de6501fa86f2e6cd0b33c3aabdaeb4a1b93f3f';
|
|
|
84
80
|
});
|
|
85
81
|
(0, vitest_1.describe)('Get Packed Signature', () => {
|
|
86
82
|
(0, vitest_1.test)('Mock signature', async () => {
|
|
87
|
-
const hash = '0xabcd';
|
|
88
83
|
const mockSignature = '0x1234';
|
|
89
84
|
const validator = {
|
|
90
85
|
address: '0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb4',
|
|
91
86
|
isRoot: true,
|
|
92
87
|
};
|
|
93
|
-
const signature = await (0, startale_1.
|
|
88
|
+
const signature = await (0, startale_1.packSignature)(mockSignature, validator);
|
|
94
89
|
(0, vitest_1.expect)(signature).toEqual('0xe35b75e5ec3c04e9cefa8e581fbee859f56edeb41234');
|
|
95
90
|
});
|
|
96
91
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Address,
|
|
2
|
-
import type {
|
|
1
|
+
import type { Address, Client, Hex } from 'viem';
|
|
2
|
+
import type { RhinestoneConfig } from '../types';
|
|
3
|
+
import { createTransport } from './json-rpc';
|
|
3
4
|
type CallType = 'call' | 'delegatecall' | 'batchcall';
|
|
4
5
|
interface ValidatorConfig {
|
|
5
6
|
address: Address;
|
|
@@ -26,8 +27,7 @@ interface GetAccountNonceParams {
|
|
|
26
27
|
}
|
|
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
|
-
declare function getBundlerClient(config:
|
|
30
|
-
declare function createTransport(chain: Chain, provider?: ProviderConfig): Transport;
|
|
30
|
+
declare function getBundlerClient(config: RhinestoneConfig, client: Client): import("viem/account-abstraction").BundlerClient<import("viem").HttpTransport<undefined, false>, undefined, undefined, Client, undefined>;
|
|
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,EAAkC,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChF,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,gBAAgB,EAAE,MAAM,EAAE,MAAM,6IA2CjE;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
|
-
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Account, WalletClient } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Adapts a Viem/Wagmi WalletClient into an Account-like signer that the SDK can consume.
|
|
4
|
+
* Ensures address is set and routes sign methods through the provided client.
|
|
5
|
+
*/
|
|
6
|
+
export declare function walletClientToAccount(walletClient: WalletClient): Account;
|
|
7
|
+
//# sourceMappingURL=walletClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walletClient.d.ts","sourceRoot":"","sources":["../../../accounts/walletClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAMP,YAAY,EACb,MAAM,MAAM,CAAA;AAGb;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CA2CzE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.walletClientToAccount = walletClientToAccount;
|
|
4
|
+
const error_1 = require("./error");
|
|
5
|
+
/**
|
|
6
|
+
* Adapts a Viem/Wagmi WalletClient into an Account-like signer that the SDK can consume.
|
|
7
|
+
* Ensures address is set and routes sign methods through the provided client.
|
|
8
|
+
*/
|
|
9
|
+
function walletClientToAccount(walletClient) {
|
|
10
|
+
const address = walletClient.account?.address;
|
|
11
|
+
if (!address) {
|
|
12
|
+
throw new error_1.WalletClientNoConnectedAccountError();
|
|
13
|
+
}
|
|
14
|
+
const account = {
|
|
15
|
+
address,
|
|
16
|
+
// EIP-191 message signing
|
|
17
|
+
async signMessage({ message, }) {
|
|
18
|
+
return walletClient.signMessage({ account: address, message });
|
|
19
|
+
},
|
|
20
|
+
// EIP-712 typed data signing
|
|
21
|
+
async signTypedData(parameters) {
|
|
22
|
+
const def = parameters;
|
|
23
|
+
const signature = walletClient.signTypedData({
|
|
24
|
+
account: address,
|
|
25
|
+
...def,
|
|
26
|
+
});
|
|
27
|
+
return signature;
|
|
28
|
+
},
|
|
29
|
+
// Raw transaction signing (not currently used by the SDK paths, but provided for completeness)
|
|
30
|
+
async signTransaction(transaction) {
|
|
31
|
+
return walletClient.signTransaction({
|
|
32
|
+
account: address,
|
|
33
|
+
...transaction,
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
return account;
|
|
38
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
import type { CalldataInput, LazyCallInput } from '../types';
|
|
3
|
+
declare function depositEther(value: bigint): LazyCallInput;
|
|
4
|
+
declare function enableEtherWithdrawal(): CalldataInput;
|
|
5
|
+
declare function disableEtherWithdrawal(): CalldataInput;
|
|
6
|
+
declare function withdrawEther(value: bigint): LazyCallInput;
|
|
7
|
+
declare function depositErc20(tokenAddress: Address, amount: bigint): LazyCallInput;
|
|
8
|
+
declare function enableErc20Withdrawal(tokenAddress: Address): CalldataInput;
|
|
9
|
+
declare function disableErc20Withdrawal(tokenAddress: Address): CalldataInput;
|
|
10
|
+
declare function withdrawErc20(tokenAddress: Address, amount: bigint): LazyCallInput;
|
|
11
|
+
declare function approveErc20(tokenAddress: Address, amount: bigint): CalldataInput;
|
|
12
|
+
export { depositEther, enableEtherWithdrawal, disableEtherWithdrawal, withdrawEther, depositErc20, enableErc20Withdrawal, disableErc20Withdrawal, withdrawErc20, approveErc20, };
|
|
13
|
+
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../actions/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAMb,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAkB5D,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CA2BlD;AAED,iBAAS,qBAAqB,IAAI,aAAa,CAG9C;AAED,iBAAS,sBAAsB,IAAI,aAAa,CAG/C;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAOnD;AAED,iBAAS,YAAY,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CA6B1E;AAED,iBAAS,qBAAqB,CAAC,YAAY,EAAE,OAAO,GAAG,aAAa,CAGnE;AAED,iBAAS,sBAAsB,CAAC,YAAY,EAAE,OAAO,GAAG,aAAa,CAGpE;AAED,iBAAS,aAAa,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAO3E;AAsED,iBAAS,YAAY,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAU1E;AAoCD,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,YAAY,GACb,CAAA"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.depositEther = depositEther;
|
|
4
|
+
exports.enableEtherWithdrawal = enableEtherWithdrawal;
|
|
5
|
+
exports.disableEtherWithdrawal = disableEtherWithdrawal;
|
|
6
|
+
exports.withdrawEther = withdrawEther;
|
|
7
|
+
exports.depositErc20 = depositErc20;
|
|
8
|
+
exports.enableErc20Withdrawal = enableErc20Withdrawal;
|
|
9
|
+
exports.disableErc20Withdrawal = disableErc20Withdrawal;
|
|
10
|
+
exports.withdrawErc20 = withdrawErc20;
|
|
11
|
+
exports.approveErc20 = approveErc20;
|
|
12
|
+
const viem_1 = require("viem");
|
|
13
|
+
const compact_1 = require("../execution/compact");
|
|
14
|
+
const ALLOCATOR_ADDRESS = '0xd93ed1dd9f1f0b523e4d77233809dc2ee22928c6';
|
|
15
|
+
const DEFAULT_RESET_PERIOD = 6;
|
|
16
|
+
const DEFAULT_SCOPE = 0;
|
|
17
|
+
function depositEther(value) {
|
|
18
|
+
return {
|
|
19
|
+
async resolve({ accountAddress }) {
|
|
20
|
+
return {
|
|
21
|
+
to: compact_1.COMPACT_ADDRESS,
|
|
22
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
23
|
+
abi: [
|
|
24
|
+
{
|
|
25
|
+
type: 'function',
|
|
26
|
+
name: 'depositNative',
|
|
27
|
+
inputs: [
|
|
28
|
+
{ name: 'lockTag', type: 'bytes12', internalType: 'bytes12' },
|
|
29
|
+
{ name: 'recipient', type: 'address', internalType: 'address' },
|
|
30
|
+
],
|
|
31
|
+
outputs: [
|
|
32
|
+
{ name: 'id', type: 'uint256', internalType: 'uint256' },
|
|
33
|
+
],
|
|
34
|
+
stateMutability: 'payable',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
functionName: 'depositNative',
|
|
38
|
+
args: [lockTag(), accountAddress],
|
|
39
|
+
}),
|
|
40
|
+
value,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function enableEtherWithdrawal() {
|
|
46
|
+
const id = (0, viem_1.concat)([lockTag(), viem_1.zeroAddress]);
|
|
47
|
+
return enableForcedWithdrawal(BigInt(id));
|
|
48
|
+
}
|
|
49
|
+
function disableEtherWithdrawal() {
|
|
50
|
+
const id = (0, viem_1.concat)([lockTag(), viem_1.zeroAddress]);
|
|
51
|
+
return disableForcedWithdrawal(BigInt(id));
|
|
52
|
+
}
|
|
53
|
+
function withdrawEther(value) {
|
|
54
|
+
return {
|
|
55
|
+
async resolve({ accountAddress }) {
|
|
56
|
+
const id = (0, viem_1.concat)([lockTag(), viem_1.zeroAddress]);
|
|
57
|
+
return forcedWithdrawal(BigInt(id), accountAddress, value);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function depositErc20(tokenAddress, amount) {
|
|
62
|
+
return {
|
|
63
|
+
async resolve({ accountAddress }) {
|
|
64
|
+
return {
|
|
65
|
+
to: compact_1.COMPACT_ADDRESS,
|
|
66
|
+
value: 0n,
|
|
67
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
68
|
+
abi: [
|
|
69
|
+
{
|
|
70
|
+
type: 'function',
|
|
71
|
+
name: 'depositERC20',
|
|
72
|
+
inputs: [
|
|
73
|
+
{ name: 'token', type: 'address', internalType: 'address' },
|
|
74
|
+
{ name: 'lockTag', type: 'bytes12', internalType: 'bytes12' },
|
|
75
|
+
{ name: 'amount', type: 'uint256', internalType: 'uint256' },
|
|
76
|
+
{ name: 'recipient', type: 'address', internalType: 'address' },
|
|
77
|
+
],
|
|
78
|
+
outputs: [
|
|
79
|
+
{ name: 'id', type: 'uint256', internalType: 'uint256' },
|
|
80
|
+
],
|
|
81
|
+
stateMutability: 'nonpayable',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
functionName: 'depositERC20',
|
|
85
|
+
args: [tokenAddress, lockTag(), amount, accountAddress],
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function enableErc20Withdrawal(tokenAddress) {
|
|
92
|
+
const id = (0, viem_1.concat)([lockTag(), tokenAddress]);
|
|
93
|
+
return enableForcedWithdrawal(BigInt(id));
|
|
94
|
+
}
|
|
95
|
+
function disableErc20Withdrawal(tokenAddress) {
|
|
96
|
+
const id = (0, viem_1.concat)([lockTag(), tokenAddress]);
|
|
97
|
+
return disableForcedWithdrawal(BigInt(id));
|
|
98
|
+
}
|
|
99
|
+
function withdrawErc20(tokenAddress, amount) {
|
|
100
|
+
return {
|
|
101
|
+
async resolve({ accountAddress }) {
|
|
102
|
+
const id = (0, viem_1.concat)([lockTag(), tokenAddress]);
|
|
103
|
+
return forcedWithdrawal(BigInt(id), accountAddress, amount);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function enableForcedWithdrawal(id) {
|
|
108
|
+
return {
|
|
109
|
+
to: compact_1.COMPACT_ADDRESS,
|
|
110
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
111
|
+
abi: [
|
|
112
|
+
{
|
|
113
|
+
type: 'function',
|
|
114
|
+
name: 'enableForcedWithdrawal',
|
|
115
|
+
inputs: [{ name: 'id', type: 'uint256', internalType: 'uint256' }],
|
|
116
|
+
outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
|
|
117
|
+
stateMutability: 'nonpayable',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
functionName: 'enableForcedWithdrawal',
|
|
121
|
+
args: [id],
|
|
122
|
+
}),
|
|
123
|
+
value: 0n,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function disableForcedWithdrawal(id) {
|
|
127
|
+
return {
|
|
128
|
+
to: compact_1.COMPACT_ADDRESS,
|
|
129
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
130
|
+
abi: [
|
|
131
|
+
{
|
|
132
|
+
type: 'function',
|
|
133
|
+
name: 'disableForcedWithdrawal',
|
|
134
|
+
inputs: [{ name: 'id', type: 'uint256', internalType: 'uint256' }],
|
|
135
|
+
outputs: [{ name: '', type: 'uint256', internalType: 'uint256' }],
|
|
136
|
+
stateMutability: 'nonpayable',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
functionName: 'disableForcedWithdrawal',
|
|
140
|
+
args: [id],
|
|
141
|
+
}),
|
|
142
|
+
value: 0n,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function forcedWithdrawal(id, recipient, amount) {
|
|
146
|
+
return {
|
|
147
|
+
to: compact_1.COMPACT_ADDRESS,
|
|
148
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
149
|
+
abi: [
|
|
150
|
+
{
|
|
151
|
+
type: 'function',
|
|
152
|
+
name: 'forcedWithdrawal',
|
|
153
|
+
inputs: [
|
|
154
|
+
{ name: 'id', type: 'uint256', internalType: 'uint256' },
|
|
155
|
+
{ name: 'recipient', type: 'address', internalType: 'address' },
|
|
156
|
+
{ name: 'amount', type: 'uint256', internalType: 'uint256' },
|
|
157
|
+
],
|
|
158
|
+
outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
|
|
159
|
+
stateMutability: 'nonpayable',
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
functionName: 'forcedWithdrawal',
|
|
163
|
+
args: [id, recipient, amount],
|
|
164
|
+
}),
|
|
165
|
+
value: 0n,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function approveErc20(tokenAddress, amount) {
|
|
169
|
+
return {
|
|
170
|
+
to: tokenAddress,
|
|
171
|
+
value: 0n,
|
|
172
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
173
|
+
abi: viem_1.erc20Abi,
|
|
174
|
+
functionName: 'approve',
|
|
175
|
+
args: [compact_1.COMPACT_ADDRESS, amount],
|
|
176
|
+
}),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function toCompactFlag(allocator) {
|
|
180
|
+
const addrBytes = Buffer.from(allocator.slice(2), 'hex');
|
|
181
|
+
let leadingZeroNibbles = 0;
|
|
182
|
+
for (const byte of addrBytes) {
|
|
183
|
+
if (byte === 0) {
|
|
184
|
+
leadingZeroNibbles += 2;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
if (byte >> 4 === 0)
|
|
188
|
+
leadingZeroNibbles += 1;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (leadingZeroNibbles >= 18)
|
|
193
|
+
return 15;
|
|
194
|
+
if (leadingZeroNibbles >= 4)
|
|
195
|
+
return leadingZeroNibbles - 3;
|
|
196
|
+
return 0;
|
|
197
|
+
}
|
|
198
|
+
function usingAllocatorId(allocator = ALLOCATOR_ADDRESS) {
|
|
199
|
+
const compactFlag = BigInt(toCompactFlag(allocator));
|
|
200
|
+
const last88Bits = BigInt(`0x${allocator.slice(-22)}`); // Extract last 88 bits (11 bytes * 2 hex chars per byte)
|
|
201
|
+
return (compactFlag << 88n) | last88Bits;
|
|
202
|
+
}
|
|
203
|
+
function lockTag() {
|
|
204
|
+
const allocatorId = usingAllocatorId(ALLOCATOR_ADDRESS);
|
|
205
|
+
const tagBig = (BigInt(DEFAULT_SCOPE) << 255n) |
|
|
206
|
+
(BigInt(DEFAULT_RESET_PERIOD) << 252n) |
|
|
207
|
+
(allocatorId << 160n);
|
|
208
|
+
const hex = tagBig.toString(16).slice(0, 24);
|
|
209
|
+
return `0x${hex}`;
|
|
210
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
import type { CalldataInput, LazyCallInput } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Enable ECDSA authentication
|
|
5
|
+
* @param owners Owners to use for authentication
|
|
6
|
+
* @param threshold Threshold for the owners
|
|
7
|
+
* @returns Calls to enable ECDSA authentication
|
|
8
|
+
*/
|
|
9
|
+
declare function enable(owners: Address[], threshold?: number): LazyCallInput;
|
|
10
|
+
/**
|
|
11
|
+
* Disable ECDSA authentication
|
|
12
|
+
* @returns Calls to disable ECDSA authentication
|
|
13
|
+
*/
|
|
14
|
+
declare function disable(): LazyCallInput;
|
|
15
|
+
/**
|
|
16
|
+
* Add an ECDSA owner
|
|
17
|
+
* @param owner Owner address
|
|
18
|
+
* @returns Call to add the owner
|
|
19
|
+
*/
|
|
20
|
+
declare function addOwner(owner: Address): CalldataInput;
|
|
21
|
+
/**
|
|
22
|
+
* Remove an ECDSA owner
|
|
23
|
+
* @param prevOwner Previous owner address
|
|
24
|
+
* @param ownerToRemove Owner to remove
|
|
25
|
+
* @returns Call to remove the owner
|
|
26
|
+
*/
|
|
27
|
+
declare function removeOwner(prevOwner: Address, ownerToRemove: Address): CalldataInput;
|
|
28
|
+
/**
|
|
29
|
+
* Change an account's signer threshold (ECDSA)
|
|
30
|
+
* @param newThreshold New threshold
|
|
31
|
+
* @returns Call to change the threshold
|
|
32
|
+
*/
|
|
33
|
+
declare function changeThreshold(newThreshold: number): CalldataInput;
|
|
34
|
+
export { addOwner, removeOwner, changeThreshold, disable, enable };
|
|
35
|
+
//# sourceMappingURL=ecdsa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecdsa.d.ts","sourceRoot":"","sources":["../../../actions/ecdsa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAsB,MAAM,MAAM,CAAA;AASvD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE5D;;;;;GAKG;AACH,iBAAS,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,SAAS,SAAI,GAAG,aAAa,CAO/D;AAED;;;GAGG;AACH,iBAAS,OAAO,IAAI,aAAa,CAOhC;AAED;;;;GAIG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAkB/C;AAED;;;;;GAKG;AACH,iBAAS,WAAW,CAClB,SAAS,EAAE,OAAO,EAClB,aAAa,EAAE,OAAO,GACrB,aAAa,CAqBf;AAED;;;;GAIG;AACH,iBAAS,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAoB5D;AAED,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addOwner = addOwner;
|
|
4
|
+
exports.removeOwner = removeOwner;
|
|
5
|
+
exports.changeThreshold = changeThreshold;
|
|
6
|
+
exports.disable = disable;
|
|
7
|
+
exports.enable = enable;
|
|
8
|
+
const viem_1 = require("viem");
|
|
9
|
+
const accounts_1 = require("../accounts");
|
|
10
|
+
const core_1 = require("../modules/validators/core");
|
|
11
|
+
/**
|
|
12
|
+
* Enable ECDSA authentication
|
|
13
|
+
* @param owners Owners to use for authentication
|
|
14
|
+
* @param threshold Threshold for the owners
|
|
15
|
+
* @returns Calls to enable ECDSA authentication
|
|
16
|
+
*/
|
|
17
|
+
function enable(owners, threshold = 1) {
|
|
18
|
+
const module = (0, core_1.getOwnableValidator)(threshold, owners);
|
|
19
|
+
return {
|
|
20
|
+
async resolve({ config }) {
|
|
21
|
+
return (0, accounts_1.getModuleInstallationCalls)(config, module);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Disable ECDSA authentication
|
|
27
|
+
* @returns Calls to disable ECDSA authentication
|
|
28
|
+
*/
|
|
29
|
+
function disable() {
|
|
30
|
+
const module = (0, core_1.getOwnableValidator)(1, []);
|
|
31
|
+
return {
|
|
32
|
+
async resolve({ config }) {
|
|
33
|
+
return (0, accounts_1.getModuleUninstallationCalls)(config, module);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Add an ECDSA owner
|
|
39
|
+
* @param owner Owner address
|
|
40
|
+
* @returns Call to add the owner
|
|
41
|
+
*/
|
|
42
|
+
function addOwner(owner) {
|
|
43
|
+
return {
|
|
44
|
+
to: core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
45
|
+
value: 0n,
|
|
46
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
47
|
+
abi: [
|
|
48
|
+
{
|
|
49
|
+
inputs: [{ internalType: 'address', name: 'owner', type: 'address' }],
|
|
50
|
+
name: 'addOwner',
|
|
51
|
+
outputs: [],
|
|
52
|
+
stateMutability: 'nonpayable',
|
|
53
|
+
type: 'function',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
functionName: 'addOwner',
|
|
57
|
+
args: [owner],
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Remove an ECDSA owner
|
|
63
|
+
* @param prevOwner Previous owner address
|
|
64
|
+
* @param ownerToRemove Owner to remove
|
|
65
|
+
* @returns Call to remove the owner
|
|
66
|
+
*/
|
|
67
|
+
function removeOwner(prevOwner, ownerToRemove) {
|
|
68
|
+
return {
|
|
69
|
+
to: core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
70
|
+
value: 0n,
|
|
71
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
72
|
+
abi: [
|
|
73
|
+
{
|
|
74
|
+
inputs: [
|
|
75
|
+
{ internalType: 'address', name: 'prevOwner', type: 'address' },
|
|
76
|
+
{ internalType: 'address', name: 'owner', type: 'address' },
|
|
77
|
+
],
|
|
78
|
+
name: 'removeOwner',
|
|
79
|
+
outputs: [],
|
|
80
|
+
stateMutability: 'nonpayable',
|
|
81
|
+
type: 'function',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
functionName: 'removeOwner',
|
|
85
|
+
args: [prevOwner, ownerToRemove],
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Change an account's signer threshold (ECDSA)
|
|
91
|
+
* @param newThreshold New threshold
|
|
92
|
+
* @returns Call to change the threshold
|
|
93
|
+
*/
|
|
94
|
+
function changeThreshold(newThreshold) {
|
|
95
|
+
return {
|
|
96
|
+
to: core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
97
|
+
value: 0n,
|
|
98
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
99
|
+
abi: [
|
|
100
|
+
{
|
|
101
|
+
inputs: [
|
|
102
|
+
{ internalType: 'uint256', name: '_threshold', type: 'uint256' },
|
|
103
|
+
],
|
|
104
|
+
name: 'setThreshold',
|
|
105
|
+
outputs: [],
|
|
106
|
+
stateMutability: 'nonpayable',
|
|
107
|
+
type: 'function',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
functionName: 'setThreshold',
|
|
111
|
+
args: [BigInt(newThreshold)],
|
|
112
|
+
}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecdsa.test.d.ts","sourceRoot":"","sources":["../../../actions/ecdsa.test.ts"],"names":[],"mappings":""}
|