@rhinestone/sdk 1.0.41-alpha.0 → 1.0.41

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.
Files changed (208) hide show
  1. package/dist/src/accounts/error.d.ts +114 -0
  2. package/dist/src/accounts/error.d.ts.map +1 -0
  3. package/dist/src/accounts/error.js +174 -0
  4. package/dist/src/accounts/index.d.ts +50 -0
  5. package/dist/src/accounts/index.d.ts.map +1 -0
  6. package/dist/src/accounts/index.js +669 -0
  7. package/dist/src/accounts/index.test.d.ts +2 -0
  8. package/dist/src/accounts/index.test.d.ts.map +1 -0
  9. package/dist/src/accounts/index.test.js +33 -0
  10. package/dist/src/accounts/json-rpc/index.d.ts +5 -0
  11. package/dist/src/accounts/json-rpc/index.d.ts.map +1 -0
  12. package/dist/src/accounts/json-rpc/index.js +20 -0
  13. package/dist/src/accounts/json-rpc/index.test.d.ts +2 -0
  14. package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
  15. package/dist/src/accounts/json-rpc/index.test.js +33 -0
  16. package/dist/src/accounts/json-rpc/providers.d.ts +5 -0
  17. package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
  18. package/dist/src/accounts/json-rpc/providers.js +22 -0
  19. package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
  20. package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
  21. package/dist/src/accounts/json-rpc/providers.test.js +43 -0
  22. package/dist/src/accounts/kernel.d.ts +29 -0
  23. package/dist/src/accounts/kernel.d.ts.map +1 -0
  24. package/dist/src/accounts/kernel.js +297 -0
  25. package/dist/src/accounts/kernel.test.d.ts +2 -0
  26. package/dist/src/accounts/kernel.test.d.ts.map +1 -0
  27. package/dist/src/accounts/kernel.test.js +132 -0
  28. package/dist/src/accounts/nexus.d.ts +35 -0
  29. package/dist/src/accounts/nexus.d.ts.map +1 -0
  30. package/dist/src/accounts/nexus.js +471 -0
  31. package/dist/src/accounts/nexus.test.d.ts +2 -0
  32. package/dist/src/accounts/nexus.test.d.ts.map +1 -0
  33. package/dist/src/accounts/nexus.test.js +118 -0
  34. package/dist/src/accounts/passport.d.ts +12 -0
  35. package/dist/src/accounts/passport.d.ts.map +1 -0
  36. package/dist/src/accounts/passport.js +173 -0
  37. package/dist/src/accounts/safe.d.ts +35 -0
  38. package/dist/src/accounts/safe.d.ts.map +1 -0
  39. package/dist/src/accounts/safe.js +365 -0
  40. package/dist/src/accounts/safe.test.d.ts +2 -0
  41. package/dist/src/accounts/safe.test.d.ts.map +1 -0
  42. package/dist/src/accounts/safe.test.js +118 -0
  43. package/dist/src/accounts/signing/common.d.ts +27 -0
  44. package/dist/src/accounts/signing/common.d.ts.map +1 -0
  45. package/dist/src/accounts/signing/common.js +183 -0
  46. package/dist/src/accounts/signing/message.d.ts +5 -0
  47. package/dist/src/accounts/signing/message.d.ts.map +1 -0
  48. package/dist/src/accounts/signing/message.js +47 -0
  49. package/dist/src/accounts/signing/passkeys.d.ts +36 -0
  50. package/dist/src/accounts/signing/passkeys.d.ts.map +1 -0
  51. package/dist/src/accounts/signing/passkeys.js +125 -0
  52. package/dist/src/accounts/signing/passkeys.test.d.ts +2 -0
  53. package/dist/src/accounts/signing/passkeys.test.d.ts.map +1 -0
  54. package/dist/src/accounts/signing/passkeys.test.js +88 -0
  55. package/dist/src/accounts/signing/typedData.d.ts +5 -0
  56. package/dist/src/accounts/signing/typedData.d.ts.map +1 -0
  57. package/dist/src/accounts/signing/typedData.js +35 -0
  58. package/dist/src/accounts/startale.d.ts +27 -0
  59. package/dist/src/accounts/startale.d.ts.map +1 -0
  60. package/dist/src/accounts/startale.js +116 -0
  61. package/dist/src/accounts/startale.test.d.ts +2 -0
  62. package/dist/src/accounts/startale.test.d.ts.map +1 -0
  63. package/dist/src/accounts/startale.test.js +92 -0
  64. package/dist/src/accounts/utils.d.ts +33 -0
  65. package/dist/src/accounts/utils.d.ts.map +1 -0
  66. package/dist/src/accounts/utils.js +208 -0
  67. package/dist/src/accounts/utils.test.d.ts +2 -0
  68. package/dist/src/accounts/utils.test.d.ts.map +1 -0
  69. package/dist/src/accounts/utils.test.js +49 -0
  70. package/dist/src/accounts/walletClient.d.ts +34 -0
  71. package/dist/src/accounts/walletClient.d.ts.map +1 -0
  72. package/dist/src/accounts/walletClient.js +121 -0
  73. package/dist/src/actions/compact.d.ts +13 -0
  74. package/dist/src/actions/compact.d.ts.map +1 -0
  75. package/dist/src/actions/compact.js +210 -0
  76. package/dist/src/actions/deployment.d.ts +19 -0
  77. package/dist/src/actions/deployment.d.ts.map +1 -0
  78. package/dist/src/actions/deployment.js +78 -0
  79. package/dist/src/actions/ecdsa.d.ts +35 -0
  80. package/dist/src/actions/ecdsa.d.ts.map +1 -0
  81. package/dist/src/actions/ecdsa.js +114 -0
  82. package/dist/src/actions/ecdsa.test.d.ts +2 -0
  83. package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
  84. package/dist/src/actions/ecdsa.test.js +99 -0
  85. package/dist/src/actions/index.d.ts +17 -0
  86. package/dist/src/actions/index.d.ts.map +1 -0
  87. package/dist/src/actions/index.js +53 -0
  88. package/dist/src/actions/mfa.d.ts +37 -0
  89. package/dist/src/actions/mfa.d.ts.map +1 -0
  90. package/dist/src/actions/mfa.js +133 -0
  91. package/dist/src/actions/passkeys.d.ts +37 -0
  92. package/dist/src/actions/passkeys.d.ts.map +1 -0
  93. package/dist/src/actions/passkeys.js +129 -0
  94. package/dist/src/actions/passkeys.test.d.ts +2 -0
  95. package/dist/src/actions/passkeys.test.d.ts.map +1 -0
  96. package/dist/src/actions/passkeys.test.js +54 -0
  97. package/dist/src/actions/recovery.d.ts +33 -0
  98. package/dist/src/actions/recovery.d.ts.map +1 -0
  99. package/dist/src/actions/recovery.js +193 -0
  100. package/dist/src/actions/recovery.test.d.ts +2 -0
  101. package/dist/src/actions/recovery.test.d.ts.map +1 -0
  102. package/dist/src/actions/recovery.test.js +168 -0
  103. package/dist/src/actions/smart-sessions.d.ts +14 -0
  104. package/dist/src/actions/smart-sessions.d.ts.map +1 -0
  105. package/dist/src/actions/smart-sessions.js +16 -0
  106. package/dist/src/errors/index.d.ts +5 -0
  107. package/dist/src/errors/index.d.ts.map +1 -0
  108. package/dist/src/errors/index.js +53 -0
  109. package/dist/src/execution/compact.d.ts +151 -0
  110. package/dist/src/execution/compact.d.ts.map +1 -0
  111. package/dist/src/execution/compact.js +122 -0
  112. package/dist/src/execution/error.d.ts +61 -0
  113. package/dist/src/execution/error.d.ts.map +1 -0
  114. package/dist/src/execution/error.js +87 -0
  115. package/dist/src/execution/index.d.ts +41 -0
  116. package/dist/src/execution/index.d.ts.map +1 -0
  117. package/dist/src/execution/index.js +233 -0
  118. package/dist/src/execution/permit2.d.ts +148 -0
  119. package/dist/src/execution/permit2.d.ts.map +1 -0
  120. package/dist/src/execution/permit2.js +291 -0
  121. package/dist/src/execution/singleChainOps.d.ts +28 -0
  122. package/dist/src/execution/singleChainOps.d.ts.map +1 -0
  123. package/dist/src/execution/singleChainOps.js +32 -0
  124. package/dist/src/execution/smart-session.d.ts +13 -0
  125. package/dist/src/execution/smart-session.d.ts.map +1 -0
  126. package/dist/src/execution/smart-session.js +178 -0
  127. package/dist/src/execution/types.d.ts +36 -0
  128. package/dist/src/execution/types.d.ts.map +1 -0
  129. package/dist/src/execution/types.js +2 -0
  130. package/dist/src/execution/utils.d.ts +83 -0
  131. package/dist/src/execution/utils.d.ts.map +1 -0
  132. package/dist/src/execution/utils.js +705 -0
  133. package/dist/src/index.d.ts +74 -0
  134. package/dist/src/index.d.ts.map +1 -0
  135. package/dist/src/index.js +317 -0
  136. package/dist/src/modules/abi/smart-sessions.d.ts +104 -0
  137. package/dist/src/modules/abi/smart-sessions.d.ts.map +1 -0
  138. package/dist/src/modules/abi/smart-sessions.js +131 -0
  139. package/dist/src/modules/chain-abstraction.d.ts +5 -0
  140. package/dist/src/modules/chain-abstraction.d.ts.map +1 -0
  141. package/dist/src/modules/chain-abstraction.js +7 -0
  142. package/dist/src/modules/common.d.ts +30 -0
  143. package/dist/src/modules/common.d.ts.map +1 -0
  144. package/dist/src/modules/common.js +42 -0
  145. package/dist/src/modules/index.d.ts +10 -0
  146. package/dist/src/modules/index.d.ts.map +1 -0
  147. package/dist/src/modules/index.js +94 -0
  148. package/dist/src/modules/index.test.d.ts +2 -0
  149. package/dist/src/modules/index.test.d.ts.map +1 -0
  150. package/dist/src/modules/index.test.js +81 -0
  151. package/dist/src/modules/legacy.d.ts +10 -0
  152. package/dist/src/modules/legacy.d.ts.map +1 -0
  153. package/dist/src/modules/legacy.js +65 -0
  154. package/dist/src/modules/read.d.ts +9 -0
  155. package/dist/src/modules/read.d.ts.map +1 -0
  156. package/dist/src/modules/read.js +125 -0
  157. package/dist/src/modules/validators/core.d.ts +29 -0
  158. package/dist/src/modules/validators/core.d.ts.map +1 -0
  159. package/dist/src/modules/validators/core.js +278 -0
  160. package/dist/src/modules/validators/core.test.d.ts +2 -0
  161. package/dist/src/modules/validators/core.test.d.ts.map +1 -0
  162. package/dist/src/modules/validators/core.test.js +101 -0
  163. package/dist/src/modules/validators/index.d.ts +4 -0
  164. package/dist/src/modules/validators/index.d.ts.map +1 -0
  165. package/dist/src/modules/validators/index.js +15 -0
  166. package/dist/src/modules/validators/smart-sessions.d.ts +96 -0
  167. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -0
  168. package/dist/src/modules/validators/smart-sessions.js +497 -0
  169. package/dist/src/modules/validators/smart-sessions.test.d.ts +2 -0
  170. package/dist/src/modules/validators/smart-sessions.test.d.ts.map +1 -0
  171. package/dist/src/modules/validators/smart-sessions.test.js +219 -0
  172. package/dist/src/orchestrator/client.d.ts +27 -0
  173. package/dist/src/orchestrator/client.d.ts.map +1 -0
  174. package/dist/src/orchestrator/client.js +354 -0
  175. package/dist/src/orchestrator/consts.d.ts +5 -0
  176. package/dist/src/orchestrator/consts.d.ts.map +1 -0
  177. package/dist/src/orchestrator/consts.js +9 -0
  178. package/dist/src/orchestrator/error.d.ts +232 -0
  179. package/dist/src/orchestrator/error.d.ts.map +1 -0
  180. package/dist/src/orchestrator/error.js +268 -0
  181. package/dist/src/orchestrator/index.d.ts +10 -0
  182. package/dist/src/orchestrator/index.d.ts.map +1 -0
  183. package/dist/src/orchestrator/index.js +57 -0
  184. package/dist/src/orchestrator/registry.d.ts +22 -0
  185. package/dist/src/orchestrator/registry.d.ts.map +1 -0
  186. package/dist/src/orchestrator/registry.js +121 -0
  187. package/dist/src/orchestrator/registry.test.d.ts +2 -0
  188. package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
  189. package/dist/src/orchestrator/registry.test.js +150 -0
  190. package/dist/src/orchestrator/types.d.ts +295 -0
  191. package/dist/src/orchestrator/types.d.ts.map +1 -0
  192. package/dist/src/orchestrator/types.js +17 -0
  193. package/dist/src/orchestrator/utils.d.ts +3 -0
  194. package/dist/src/orchestrator/utils.d.ts.map +1 -0
  195. package/dist/src/orchestrator/utils.js +24 -0
  196. package/dist/src/types.d.ts +284 -0
  197. package/dist/src/types.d.ts.map +1 -0
  198. package/dist/src/types.js +2 -0
  199. package/dist/src/utils/index.d.ts +26 -0
  200. package/dist/src/utils/index.d.ts.map +1 -0
  201. package/dist/src/utils/index.js +63 -0
  202. package/dist/test/consts.d.ts +10 -0
  203. package/dist/test/consts.d.ts.map +1 -0
  204. package/dist/test/consts.js +22 -0
  205. package/dist/test/utils/utils.d.ts +5 -0
  206. package/dist/test/utils/utils.d.ts.map +1 -0
  207. package/dist/test/utils/utils.js +20 -0
  208. package/package.json +1 -1
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const chains_1 = require("viem/chains");
4
+ const vitest_1 = require("vitest");
5
+ const consts_1 = require("../../test/consts");
6
+ const __1 = require("..");
7
+ const utils_1 = require("../execution/utils");
8
+ const ecdsa_1 = require("./ecdsa");
9
+ const MOCK_OWNER_A = '0xd1aefebdceefc094f1805b241fa5e6db63a9181a';
10
+ const MOCK_OWNER_B = '0xeddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817';
11
+ const MOCK_OWNER_C = '0xb31e76f19defe76edc4b7eceeb4b0a2d6ddaca39';
12
+ const accountAddress = '0x36C03e7D593F7B2C6b06fC18B5f4E9a4A29C99b0';
13
+ (0, vitest_1.describe)('ECDSA Actions', () => {
14
+ (0, vitest_1.describe)('Install Ownable Validator', async () => {
15
+ const rhinestone = new __1.RhinestoneSDK();
16
+ const rhinestoneAccount = await rhinestone.createAccount({
17
+ owners: {
18
+ type: 'ecdsa',
19
+ accounts: [consts_1.accountA],
20
+ },
21
+ });
22
+ (0, vitest_1.test)('1/1 Owners', async () => {
23
+ const calls = await (0, utils_1.resolveCallInputs)([(0, ecdsa_1.enable)([MOCK_OWNER_A])], rhinestoneAccount.config, chains_1.base, accountAddress);
24
+ (0, vitest_1.expect)(calls).toEqual([
25
+ {
26
+ to: accountAddress,
27
+ value: 0n,
28
+ data: '0x9517e29f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e9800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a',
29
+ },
30
+ ]);
31
+ });
32
+ (0, vitest_1.test)('1/N Owners', async () => {
33
+ const calls = await (0, utils_1.resolveCallInputs)([(0, ecdsa_1.enable)([MOCK_OWNER_A, MOCK_OWNER_B])], rhinestoneAccount.config, chains_1.base, accountAddress);
34
+ (0, vitest_1.expect)(calls).toEqual([
35
+ {
36
+ to: accountAddress,
37
+ value: 0n,
38
+ data: '0x9517e29f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e98000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a000000000000000000000000eddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817',
39
+ },
40
+ ]);
41
+ });
42
+ (0, vitest_1.test)('M/N Owners', async () => {
43
+ const calls = await (0, utils_1.resolveCallInputs)([(0, ecdsa_1.enable)([MOCK_OWNER_A, MOCK_OWNER_B, MOCK_OWNER_C], 2)], rhinestoneAccount.config, chains_1.base, accountAddress);
44
+ (0, vitest_1.expect)(calls).toEqual([
45
+ {
46
+ to: accountAddress,
47
+ value: 0n,
48
+ data: '0x9517e29f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e98000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000b31e76f19defe76edc4b7eceeb4b0a2d6ddaca39000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a000000000000000000000000eddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817',
49
+ },
50
+ ]);
51
+ });
52
+ });
53
+ (0, vitest_1.describe)('Uninstall Ownable Validator', async () => {
54
+ const rhinestone = new __1.RhinestoneSDK();
55
+ const rhinestoneAccount = await rhinestone.createAccount({
56
+ owners: {
57
+ type: 'ecdsa',
58
+ accounts: [consts_1.accountA],
59
+ },
60
+ });
61
+ (0, vitest_1.test)('', async () => {
62
+ const calls = await (0, utils_1.resolveCallInputs)([(0, ecdsa_1.disable)()], rhinestoneAccount.config, chains_1.base, accountAddress);
63
+ (0, vitest_1.expect)(calls).toEqual([
64
+ {
65
+ to: accountAddress,
66
+ value: 0n,
67
+ data: '0xa71763a80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000013fdb5234e4e3162a810f54d9f7e9800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000',
68
+ },
69
+ ]);
70
+ });
71
+ });
72
+ (0, vitest_1.describe)('Add Owner', () => {
73
+ (0, vitest_1.test)('', () => {
74
+ (0, vitest_1.expect)((0, ecdsa_1.addOwner)(MOCK_OWNER_A)).toEqual({
75
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
76
+ value: 0n,
77
+ data: '0x7065cb48000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a',
78
+ });
79
+ });
80
+ });
81
+ (0, vitest_1.describe)('Remove Owner', () => {
82
+ (0, vitest_1.test)('', () => {
83
+ (0, vitest_1.expect)((0, ecdsa_1.removeOwner)(MOCK_OWNER_A, MOCK_OWNER_B)).toEqual({
84
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
85
+ value: 0n,
86
+ data: '0xfbe5ce0a000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a000000000000000000000000eddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817',
87
+ });
88
+ });
89
+ });
90
+ (0, vitest_1.describe)('Set Threshold', () => {
91
+ (0, vitest_1.test)('', () => {
92
+ (0, vitest_1.expect)((0, ecdsa_1.changeThreshold)(1)).toEqual({
93
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
94
+ value: 0n,
95
+ data: '0x960bfe040000000000000000000000000000000000000000000000000000000000000001',
96
+ });
97
+ });
98
+ });
99
+ });
@@ -0,0 +1,17 @@
1
+ import type { RhinestoneAccount } from '../index';
2
+ import type { LazyCallInput, ModuleInput } from '../types';
3
+ /**
4
+ * Install a custom module
5
+ * @param module Module to install
6
+ * @returns Calls to install the module
7
+ */
8
+ declare function installModule(module: ModuleInput): LazyCallInput;
9
+ /**
10
+ * Uninstall a custom module
11
+ * @param module Module to uninstall
12
+ * @returns Calls to uninstall the module
13
+ */
14
+ declare function uninstallModule(module: ModuleInput): LazyCallInput;
15
+ declare function deploy(account: RhinestoneAccount): LazyCallInput;
16
+ export { installModule, uninstallModule, deploy };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../actions/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE1D;;;;GAIG;AACH,iBAAS,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAOzD;AAED;;;;GAIG;AACH,iBAAS,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAO3D;AAYD,iBAAS,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAUzD;AAED,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,EAAE,CAAA"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.installModule = installModule;
4
+ exports.uninstallModule = uninstallModule;
5
+ exports.deploy = deploy;
6
+ const accounts_1 = require("../accounts");
7
+ const common_1 = require("../modules/common");
8
+ /**
9
+ * Install a custom module
10
+ * @param module Module to install
11
+ * @returns Calls to install the module
12
+ */
13
+ function installModule(module) {
14
+ const moduleData = getModule(module);
15
+ return {
16
+ async resolve({ config }) {
17
+ return (0, accounts_1.getModuleInstallationCalls)(config, moduleData);
18
+ },
19
+ };
20
+ }
21
+ /**
22
+ * Uninstall a custom module
23
+ * @param module Module to uninstall
24
+ * @returns Calls to uninstall the module
25
+ */
26
+ function uninstallModule(module) {
27
+ const moduleData = getModule(module);
28
+ return {
29
+ async resolve({ config }) {
30
+ return (0, accounts_1.getModuleUninstallationCalls)(config, moduleData);
31
+ },
32
+ };
33
+ }
34
+ function getModule(module) {
35
+ return {
36
+ type: (0, common_1.toModuleTypeId)(module.type),
37
+ address: module.address,
38
+ initData: module.initData ?? '0x',
39
+ deInitData: module.deInitData ?? '0x',
40
+ additionalContext: module.additionalContext ?? '0x',
41
+ };
42
+ }
43
+ function deploy(account) {
44
+ const initData = account.getInitData();
45
+ return {
46
+ async resolve() {
47
+ return {
48
+ to: initData.factory,
49
+ data: initData.factoryData,
50
+ };
51
+ },
52
+ };
53
+ }
@@ -0,0 +1,37 @@
1
+ import { type Hex } from 'viem';
2
+ import type { CalldataInput, LazyCallInput, OwnableValidatorConfig, WebauthnValidatorConfig } from '../types';
3
+ /**
4
+ * Enable multi-factor authentication
5
+ * @param validators List of validators to use
6
+ * @param threshold Threshold for the validators
7
+ * @returns Calls to enable multi-factor authentication
8
+ */
9
+ declare function enable(validators: (OwnableValidatorConfig | WebauthnValidatorConfig | null)[], threshold?: number): LazyCallInput;
10
+ /**
11
+ * Change the multi-factor threshold
12
+ * @param newThreshold New threshold
13
+ * @returns Call to change the threshold
14
+ */
15
+ declare function changeThreshold(newThreshold: number): CalldataInput;
16
+ /**
17
+ * Disable multi-factor authentication
18
+ * @param rhinestoneAccount Account to disable multi-factor authentication on
19
+ * @returns Calls to disable multi-factor authentication
20
+ */
21
+ declare function disable(): LazyCallInput;
22
+ /**
23
+ * Set a sub-validator (multi-factor)
24
+ * @param id Validator ID
25
+ * @param validator Validator module
26
+ * @returns Call to set the sub-validator
27
+ */
28
+ declare function setSubValidator(id: Hex | number, validator: OwnableValidatorConfig | WebauthnValidatorConfig): CalldataInput;
29
+ /**
30
+ * Remove a sub-validator (multi-factor)
31
+ * @param id Validator ID
32
+ * @param validator Validator module
33
+ * @returns Call to remove the sub-validator
34
+ */
35
+ declare function removeSubValidator(id: Hex | number, validator: OwnableValidatorConfig | WebauthnValidatorConfig): CalldataInput;
36
+ export { enable, changeThreshold, disable, setSubValidator, removeSubValidator };
37
+ //# sourceMappingURL=mfa.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfa.d.ts","sourceRoot":"","sources":["../../../actions/mfa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,GAAG,EAAiB,MAAM,MAAM,CAAA;AAUlE,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,UAAU,CAAA;AAEjB;;;;;GAKG;AACH,iBAAS,MAAM,CACb,UAAU,EAAE,CAAC,sBAAsB,GAAG,uBAAuB,GAAG,IAAI,CAAC,EAAE,EACvE,SAAS,SAAI,GACZ,aAAa,CAOf;AAED;;;;GAIG;AACH,iBAAS,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAkB5D;AAED;;;;GAIG;AACH,iBAAS,OAAO,IAAI,aAAa,CAOhC;AAED;;;;;GAKG;AACH,iBAAS,eAAe,CACtB,EAAE,EAAE,GAAG,GAAG,MAAM,EAChB,SAAS,EAAE,sBAAsB,GAAG,uBAAuB,GAC1D,aAAa,CA+Bf;AAED;;;;;GAKG;AACH,iBAAS,kBAAkB,CACzB,EAAE,EAAE,GAAG,GAAG,MAAM,EAChB,SAAS,EAAE,sBAAsB,GAAG,uBAAuB,GAC1D,aAAa,CA2Bf;AAED,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAA"}
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enable = enable;
4
+ exports.changeThreshold = changeThreshold;
5
+ exports.disable = disable;
6
+ exports.setSubValidator = setSubValidator;
7
+ exports.removeSubValidator = removeSubValidator;
8
+ const viem_1 = require("viem");
9
+ const accounts_1 = require("../accounts");
10
+ const core_1 = require("../modules/validators/core");
11
+ /**
12
+ * Enable multi-factor authentication
13
+ * @param validators List of validators to use
14
+ * @param threshold Threshold for the validators
15
+ * @returns Calls to enable multi-factor authentication
16
+ */
17
+ function enable(validators, threshold = 1) {
18
+ const module = (0, core_1.getMultiFactorValidator)(threshold, validators);
19
+ return {
20
+ async resolve({ config }) {
21
+ return (0, accounts_1.getModuleInstallationCalls)(config, module);
22
+ },
23
+ };
24
+ }
25
+ /**
26
+ * Change the multi-factor threshold
27
+ * @param newThreshold New threshold
28
+ * @returns Call to change the threshold
29
+ */
30
+ function changeThreshold(newThreshold) {
31
+ return {
32
+ to: core_1.MULTI_FACTOR_VALIDATOR_ADDRESS,
33
+ value: 0n,
34
+ data: (0, viem_1.encodeFunctionData)({
35
+ abi: [
36
+ {
37
+ inputs: [{ internalType: 'uint8', name: 'threshold', type: 'uint8' }],
38
+ name: 'setThreshold',
39
+ outputs: [],
40
+ stateMutability: 'nonpayable',
41
+ type: 'function',
42
+ },
43
+ ],
44
+ functionName: 'setThreshold',
45
+ args: [newThreshold],
46
+ }),
47
+ };
48
+ }
49
+ /**
50
+ * Disable multi-factor authentication
51
+ * @param rhinestoneAccount Account to disable multi-factor authentication on
52
+ * @returns Calls to disable multi-factor authentication
53
+ */
54
+ function disable() {
55
+ const module = (0, core_1.getMultiFactorValidator)(1, []);
56
+ return {
57
+ async resolve({ config }) {
58
+ return (0, accounts_1.getModuleUninstallationCalls)(config, module);
59
+ },
60
+ };
61
+ }
62
+ /**
63
+ * Set a sub-validator (multi-factor)
64
+ * @param id Validator ID
65
+ * @param validator Validator module
66
+ * @returns Call to set the sub-validator
67
+ */
68
+ function setSubValidator(id, validator) {
69
+ const validatorId = (0, viem_1.padHex)((0, viem_1.toHex)(id), { size: 12 });
70
+ const validatorModule = (0, core_1.getValidator)(validator);
71
+ return {
72
+ to: core_1.MULTI_FACTOR_VALIDATOR_ADDRESS,
73
+ value: 0n,
74
+ data: (0, viem_1.encodeFunctionData)({
75
+ abi: [
76
+ {
77
+ type: 'function',
78
+ name: 'setValidator',
79
+ inputs: [
80
+ {
81
+ type: 'address',
82
+ name: 'validatorAddress',
83
+ },
84
+ {
85
+ type: 'bytes12',
86
+ name: 'validatorId',
87
+ },
88
+ {
89
+ type: 'bytes',
90
+ name: 'newValidatorData',
91
+ },
92
+ ],
93
+ },
94
+ ],
95
+ functionName: 'setValidator',
96
+ args: [validatorModule.address, validatorId, validatorModule.initData],
97
+ }),
98
+ };
99
+ }
100
+ /**
101
+ * Remove a sub-validator (multi-factor)
102
+ * @param id Validator ID
103
+ * @param validator Validator module
104
+ * @returns Call to remove the sub-validator
105
+ */
106
+ function removeSubValidator(id, validator) {
107
+ const validatorId = (0, viem_1.padHex)((0, viem_1.toHex)(id), { size: 12 });
108
+ const validatorModule = (0, core_1.getValidator)(validator);
109
+ return {
110
+ to: core_1.MULTI_FACTOR_VALIDATOR_ADDRESS,
111
+ value: 0n,
112
+ data: (0, viem_1.encodeFunctionData)({
113
+ abi: [
114
+ {
115
+ type: 'function',
116
+ name: 'removeValidator',
117
+ inputs: [
118
+ {
119
+ type: 'address',
120
+ name: 'validatorAddress',
121
+ },
122
+ {
123
+ type: 'bytes12',
124
+ name: 'validatorId',
125
+ },
126
+ ],
127
+ },
128
+ ],
129
+ functionName: 'removeValidator',
130
+ args: [validatorModule.address, validatorId],
131
+ }),
132
+ };
133
+ }
@@ -0,0 +1,37 @@
1
+ import { type WebauthnCredential } from '../modules/validators/core';
2
+ import type { CalldataInput, LazyCallInput } from '../types';
3
+ /**
4
+ * Enable passkeys authentication
5
+ * @param pubKey Public key for the passkey
6
+ * @param authenticatorId Authenticator ID for the passkey
7
+ * @returns Calls to enable passkeys authentication
8
+ */
9
+ declare function enable(credential: WebauthnCredential): LazyCallInput;
10
+ /**
11
+ * Disable passkeys (WebAuthn) authentication
12
+ * @returns Calls to disable passkeys authentication
13
+ */
14
+ declare function disable(): LazyCallInput;
15
+ /**
16
+ * Add a passkey owner
17
+ * @param pubKeyX Public key X
18
+ * @param pubKeyY Public key Y
19
+ * @param requireUserVerification Whether to require user verification
20
+ * @returns Call to add the passkey owner
21
+ */
22
+ declare function addOwner(pubKeyX: bigint, pubKeyY: bigint, requireUserVerification: boolean): CalldataInput;
23
+ /**
24
+ * Remove a passkey owner
25
+ * @param pubKeyX Public key X
26
+ * @param pubKeyY Public key Y
27
+ * @returns Call to remove the passkey owner
28
+ */
29
+ declare function removeOwner(pubKeyX: bigint, pubKeyY: bigint): CalldataInput;
30
+ /**
31
+ * Change an account's signer threshold (passkey)
32
+ * @param newThreshold New threshold
33
+ * @returns Call to change the threshold
34
+ */
35
+ declare function changeThreshold(newThreshold: number): CalldataInput;
36
+ export { addOwner, removeOwner, changeThreshold, disable, enable };
37
+ //# sourceMappingURL=passkeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkeys.d.ts","sourceRoot":"","sources":["../../../actions/passkeys.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE5D;;;;;GAKG;AACH,iBAAS,MAAM,CAAC,UAAU,EAAE,kBAAkB,GAAG,aAAa,CAO7D;AAED;;;GAGG;AACH,iBAAS,OAAO,IAAI,aAAa,CAchC;AAED;;;;;;GAMG;AACH,iBAAS,QAAQ,CACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,uBAAuB,EAAE,OAAO,GAC/B,aAAa,CAyBf;AAED;;;;;GAKG;AACH,iBAAS,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAqBpE;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,129 @@
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 passkeys authentication
13
+ * @param pubKey Public key for the passkey
14
+ * @param authenticatorId Authenticator ID for the passkey
15
+ * @returns Calls to enable passkeys authentication
16
+ */
17
+ function enable(credential) {
18
+ const module = (0, core_1.getWebAuthnValidator)(1, [credential]);
19
+ return {
20
+ async resolve({ config }) {
21
+ return (0, accounts_1.getModuleInstallationCalls)(config, module);
22
+ },
23
+ };
24
+ }
25
+ /**
26
+ * Disable passkeys (WebAuthn) authentication
27
+ * @returns Calls to disable passkeys authentication
28
+ */
29
+ function disable() {
30
+ const module = (0, core_1.getWebAuthnValidator)(1, [
31
+ {
32
+ // Mocked values
33
+ pubKey: '0x580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d1',
34
+ authenticatorId: '0x',
35
+ },
36
+ ]);
37
+ return {
38
+ async resolve({ config }) {
39
+ return (0, accounts_1.getModuleUninstallationCalls)(config, module);
40
+ },
41
+ };
42
+ }
43
+ /**
44
+ * Add a passkey owner
45
+ * @param pubKeyX Public key X
46
+ * @param pubKeyY Public key Y
47
+ * @param requireUserVerification Whether to require user verification
48
+ * @returns Call to add the passkey owner
49
+ */
50
+ function addOwner(pubKeyX, pubKeyY, requireUserVerification) {
51
+ return {
52
+ to: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
53
+ value: 0n,
54
+ data: (0, viem_1.encodeFunctionData)({
55
+ abi: [
56
+ {
57
+ inputs: [
58
+ { name: 'pubKeyX', type: 'uint256' },
59
+ { name: 'pubKeyY', type: 'uint256' },
60
+ {
61
+ name: 'requireUserVerification',
62
+ type: 'bool',
63
+ },
64
+ ],
65
+ name: 'addCredential',
66
+ outputs: [],
67
+ stateMutability: 'nonpayable',
68
+ type: 'function',
69
+ },
70
+ ],
71
+ functionName: 'addCredential',
72
+ args: [pubKeyX, pubKeyY, requireUserVerification],
73
+ }),
74
+ };
75
+ }
76
+ /**
77
+ * Remove a passkey owner
78
+ * @param pubKeyX Public key X
79
+ * @param pubKeyY Public key Y
80
+ * @returns Call to remove the passkey owner
81
+ */
82
+ function removeOwner(pubKeyX, pubKeyY) {
83
+ return {
84
+ to: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
85
+ value: 0n,
86
+ data: (0, viem_1.encodeFunctionData)({
87
+ abi: [
88
+ {
89
+ inputs: [
90
+ { name: 'pubKeyX', type: 'uint256' },
91
+ { name: 'pubKeyY', type: 'uint256' },
92
+ ],
93
+ name: 'removeCredential',
94
+ outputs: [],
95
+ stateMutability: 'nonpayable',
96
+ type: 'function',
97
+ },
98
+ ],
99
+ functionName: 'removeCredential',
100
+ args: [pubKeyX, pubKeyY],
101
+ }),
102
+ };
103
+ }
104
+ /**
105
+ * Change an account's signer threshold (passkey)
106
+ * @param newThreshold New threshold
107
+ * @returns Call to change the threshold
108
+ */
109
+ function changeThreshold(newThreshold) {
110
+ return {
111
+ to: core_1.WEBAUTHN_VALIDATOR_ADDRESS,
112
+ value: 0n,
113
+ data: (0, viem_1.encodeFunctionData)({
114
+ abi: [
115
+ {
116
+ inputs: [
117
+ { internalType: 'uint256', name: '_threshold', type: 'uint256' },
118
+ ],
119
+ name: 'setThreshold',
120
+ outputs: [],
121
+ stateMutability: 'nonpayable',
122
+ type: 'function',
123
+ },
124
+ ],
125
+ functionName: 'setThreshold',
126
+ args: [BigInt(newThreshold)],
127
+ }),
128
+ };
129
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=passkeys.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkeys.test.d.ts","sourceRoot":"","sources":["../../../actions/passkeys.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const chains_1 = require("viem/chains");
4
+ const vitest_1 = require("vitest");
5
+ const consts_1 = require("../../test/consts");
6
+ const __1 = require("..");
7
+ const utils_1 = require("../execution/utils");
8
+ const passkeys_1 = require("./passkeys");
9
+ const accountAddress = '0x36C03e7D593F7B2C6b06fC18B5f4E9a4A29C99b0';
10
+ (0, vitest_1.describe)('Passkeys Actions', () => {
11
+ (0, vitest_1.describe)('Install WebAuthn Validator', async () => {
12
+ const rhinestone = new __1.RhinestoneSDK();
13
+ const rhinestoneAccount = await rhinestone.createAccount({
14
+ owners: {
15
+ type: 'ecdsa',
16
+ accounts: [consts_1.accountA],
17
+ },
18
+ });
19
+ (0, vitest_1.test)('', async () => {
20
+ const calls = await (0, utils_1.resolveCallInputs)([
21
+ (0, passkeys_1.enable)({
22
+ pubKey: consts_1.passkeyAccount.publicKey,
23
+ authenticatorId: consts_1.passkeyAccount.id,
24
+ }),
25
+ ], rhinestoneAccount.config, chains_1.base, accountAddress);
26
+ (0, vitest_1.expect)(calls).toEqual([
27
+ {
28
+ to: accountAddress,
29
+ value: 0n,
30
+ data: '0x9517e29f00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000578c4cb0e472a5462da43c495c3f33000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d10000000000000000000000000000000000000000000000000000000000000000',
31
+ },
32
+ ]);
33
+ });
34
+ });
35
+ (0, vitest_1.describe)('Uninstall WebAuthn Validator', async () => {
36
+ const rhinestone = new __1.RhinestoneSDK();
37
+ const rhinestoneAccount = await rhinestone.createAccount({
38
+ owners: {
39
+ type: 'ecdsa',
40
+ accounts: [consts_1.accountA],
41
+ },
42
+ });
43
+ (0, vitest_1.test)('', async () => {
44
+ const calls = await (0, utils_1.resolveCallInputs)([(0, passkeys_1.disable)()], rhinestoneAccount.config, chains_1.base, accountAddress);
45
+ (0, vitest_1.expect)(calls).toEqual([
46
+ {
47
+ to: accountAddress,
48
+ value: 0n,
49
+ data: '0xa71763a800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000578c4cb0e472a5462da43c495c3f3300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000',
50
+ },
51
+ ]);
52
+ });
53
+ });
54
+ });
@@ -0,0 +1,33 @@
1
+ import { type Account, type Address, type Chain } from 'viem';
2
+ import type { CalldataInput, LazyCallInput, OwnableValidatorConfig, RhinestoneConfig, WebauthnValidatorConfig } from '../types';
3
+ /**
4
+ * Set up social recovery
5
+ * @param guardians Guardians to use for recovery
6
+ * @param threshold Threshold for the guardians
7
+ * @returns Calls to set up social recovery
8
+ */
9
+ declare function enable(guardians: Account[], threshold?: number): LazyCallInput;
10
+ /**
11
+ * Recover an account's ownership (ECDSA)
12
+ * @param address Account address
13
+ * @param newOwners New owners
14
+ * @param chain Chain to recover ownership on
15
+ * @param provider Provider to use for the recovery
16
+ * @returns Calls to recover ownership
17
+ */
18
+ declare function recoverEcdsaOwnership(address: Address, newOwners: OwnableValidatorConfig, chain: Chain, config: RhinestoneConfig): Promise<CalldataInput[]>;
19
+ /**
20
+ * Recover an account's ownership (Passkey)
21
+ * @param address Account address
22
+ * @param oldCredentials Old credentials to be replaced (with pubKeyX, pubKeyY)
23
+ * @param newOwners New passkey owners
24
+ * @param chain Chain to recover ownership on
25
+ * @param provider Provider to use for the recovery
26
+ * @returns Calls to recover ownership
27
+ */
28
+ declare function recoverPasskeyOwnership(address: Address, oldCredentials: {
29
+ pubKeyX: bigint;
30
+ pubKeyY: bigint;
31
+ }[], newOwners: WebauthnValidatorConfig, chain: Chain, config: RhinestoneConfig): Promise<CalldataInput[]>;
32
+ export { enable, recoverEcdsaOwnership, recoverPasskeyOwnership };
33
+ //# sourceMappingURL=recovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../../../actions/recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,KAAK,EAEX,MAAM,MAAM,CAAA;AASb,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,UAAU,CAAA;AAQjB;;;;;GAKG;AACH,iBAAS,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,SAAS,SAAI,GAAG,aAAa,CAOlE;AAED;;;;;;;GAOG;AACH,iBAAe,qBAAqB,CAClC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,sBAAsB,EACjC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,aAAa,EAAE,CAAC,CAwG1B;AAED;;;;;;;;GAQG;AACH,iBAAe,uBAAuB,CACpC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,EACtD,SAAS,EAAE,uBAAuB,EAClC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,aAAa,EAAE,CAAC,CA0F1B;AAED,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,CAAA"}