@charterlabs/rhinestone-sdk 0.1.0 → 0.1.2

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 (194) hide show
  1. package/README.md +74 -181
  2. package/dist/src/accounts/error.d.ts +69 -0
  3. package/dist/src/accounts/error.d.ts.map +1 -0
  4. package/dist/src/accounts/error.js +109 -0
  5. package/dist/{accounts → src/accounts}/index.d.ts +14 -21
  6. package/dist/src/accounts/index.d.ts.map +1 -0
  7. package/dist/src/accounts/index.js +469 -0
  8. package/dist/src/accounts/index.test.d.ts +2 -0
  9. package/dist/src/accounts/index.test.d.ts.map +1 -0
  10. package/dist/src/accounts/index.test.js +36 -0
  11. package/dist/{accounts → src/accounts}/kernel.d.ts +7 -9
  12. package/dist/src/accounts/kernel.d.ts.map +1 -0
  13. package/dist/{accounts → src/accounts}/kernel.js +0 -8
  14. package/dist/src/accounts/kernel.test.d.ts +2 -0
  15. package/dist/src/accounts/kernel.test.d.ts.map +1 -0
  16. package/dist/src/accounts/kernel.test.js +105 -0
  17. package/dist/{accounts → src/accounts}/nexus.d.ts +14 -13
  18. package/dist/src/accounts/nexus.d.ts.map +1 -0
  19. package/dist/{accounts → src/accounts}/nexus.js +92 -88
  20. package/dist/src/accounts/nexus.test.d.ts +2 -0
  21. package/dist/src/accounts/nexus.test.d.ts.map +1 -0
  22. package/dist/src/accounts/nexus.test.js +87 -0
  23. package/dist/{accounts → src/accounts}/safe.d.ts +4 -6
  24. package/dist/src/accounts/safe.d.ts.map +1 -0
  25. package/dist/{accounts → src/accounts}/safe.js +20 -29
  26. package/dist/src/accounts/safe.test.d.ts +2 -0
  27. package/dist/src/accounts/safe.test.d.ts.map +1 -0
  28. package/dist/src/accounts/safe.test.js +87 -0
  29. package/dist/src/accounts/startale.d.ts +20 -0
  30. package/dist/src/accounts/startale.d.ts.map +1 -0
  31. package/dist/src/accounts/startale.js +100 -0
  32. package/dist/src/accounts/startale.test.d.ts +2 -0
  33. package/dist/src/accounts/startale.test.d.ts.map +1 -0
  34. package/dist/src/accounts/startale.test.js +99 -0
  35. package/dist/{accounts → src/accounts}/utils.d.ts +4 -3
  36. package/dist/src/accounts/utils.d.ts.map +1 -0
  37. package/dist/{accounts → src/accounts}/utils.js +44 -0
  38. package/dist/src/accounts/utils.test.d.ts +2 -0
  39. package/dist/src/accounts/utils.test.d.ts.map +1 -0
  40. package/dist/src/accounts/utils.test.js +49 -0
  41. package/dist/src/actions/index.d.ts +39 -0
  42. package/dist/src/actions/index.d.ts.map +1 -0
  43. package/dist/{actions → src/actions}/index.js +108 -15
  44. package/dist/src/actions/index.test.d.ts +2 -0
  45. package/dist/src/actions/index.test.d.ts.map +1 -0
  46. package/dist/src/actions/index.test.js +302 -0
  47. package/dist/{actions → src/actions}/smart-session.d.ts +2 -2
  48. package/dist/src/actions/smart-session.d.ts.map +1 -0
  49. package/dist/src/execution/compact.d.ts +8 -0
  50. package/dist/src/execution/compact.d.ts.map +1 -0
  51. package/dist/src/execution/compact.js +105 -0
  52. package/dist/src/execution/error.d.ts +54 -0
  53. package/dist/src/execution/error.d.ts.map +1 -0
  54. package/dist/src/execution/error.js +78 -0
  55. package/dist/{execution → src/execution}/index.d.ts +7 -6
  56. package/dist/src/execution/index.d.ts.map +1 -0
  57. package/dist/src/execution/index.js +150 -0
  58. package/dist/src/execution/smart-session.d.ts +15 -0
  59. package/dist/src/execution/smart-session.d.ts.map +1 -0
  60. package/dist/{execution → src/execution}/smart-session.js +16 -77
  61. package/dist/src/execution/smart-session.test.d.ts +2 -0
  62. package/dist/src/execution/smart-session.test.d.ts.map +1 -0
  63. package/dist/src/execution/smart-session.test.js +34 -0
  64. package/dist/src/execution/utils.d.ts +45 -0
  65. package/dist/src/execution/utils.d.ts.map +1 -0
  66. package/dist/src/execution/utils.js +433 -0
  67. package/dist/src/index.d.ts +41 -0
  68. package/dist/src/index.d.ts.map +1 -0
  69. package/dist/src/index.js +154 -0
  70. package/dist/src/modules/abi/smart-sessions.d.ts.map +1 -0
  71. package/dist/src/modules/common.d.ts.map +1 -0
  72. package/dist/{modules → src/modules}/index.d.ts +3 -11
  73. package/dist/src/modules/index.d.ts.map +1 -0
  74. package/dist/{modules → src/modules}/index.js +3 -45
  75. package/dist/src/modules/index.test.d.ts +2 -0
  76. package/dist/src/modules/index.test.d.ts.map +1 -0
  77. package/dist/src/modules/index.test.js +107 -0
  78. package/dist/src/modules/omni-account.d.ts +7 -0
  79. package/dist/src/modules/omni-account.d.ts.map +1 -0
  80. package/dist/src/modules/omni-account.js +11 -0
  81. package/dist/src/modules/read.d.ts +9 -0
  82. package/dist/src/modules/read.d.ts.map +1 -0
  83. package/dist/{modules → src/modules}/read.js +6 -37
  84. package/dist/{modules → src/modules}/validators/core.d.ts +6 -7
  85. package/dist/src/modules/validators/core.d.ts.map +1 -0
  86. package/dist/{modules → src/modules}/validators/core.js +83 -8
  87. package/dist/src/modules/validators/core.test.d.ts +2 -0
  88. package/dist/src/modules/validators/core.test.d.ts.map +1 -0
  89. package/dist/src/modules/validators/core.test.js +108 -0
  90. package/dist/src/modules/validators/index.d.ts +4 -0
  91. package/dist/src/modules/validators/index.d.ts.map +1 -0
  92. package/dist/{modules → src/modules}/validators/index.js +1 -3
  93. package/dist/{modules → src/modules}/validators/smart-sessions.d.ts +4 -15
  94. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -0
  95. package/dist/{modules → src/modules}/validators/smart-sessions.js +7 -61
  96. package/dist/src/modules/validators/smart-sessions.test.d.ts +2 -0
  97. package/dist/src/modules/validators/smart-sessions.test.d.ts.map +1 -0
  98. package/dist/src/modules/validators/smart-sessions.test.js +226 -0
  99. package/dist/src/orchestrator/client.d.ts +21 -0
  100. package/dist/src/orchestrator/client.d.ts.map +1 -0
  101. package/dist/src/orchestrator/client.js +284 -0
  102. package/dist/src/orchestrator/consts.d.ts +5 -0
  103. package/dist/src/orchestrator/consts.d.ts.map +1 -0
  104. package/dist/src/orchestrator/consts.js +9 -0
  105. package/dist/src/orchestrator/error.d.ts +96 -0
  106. package/dist/src/orchestrator/error.d.ts.map +1 -0
  107. package/dist/src/orchestrator/error.js +132 -0
  108. package/dist/src/orchestrator/index.d.ts +11 -0
  109. package/dist/src/orchestrator/index.d.ts.map +1 -0
  110. package/dist/src/orchestrator/index.js +42 -0
  111. package/dist/src/orchestrator/registry.d.ts +39 -0
  112. package/dist/src/orchestrator/registry.d.ts.map +1 -0
  113. package/dist/src/orchestrator/registry.js +121 -0
  114. package/dist/src/orchestrator/registry.json +365 -0
  115. package/dist/src/orchestrator/registry.test.d.ts +2 -0
  116. package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
  117. package/dist/src/orchestrator/registry.test.js +137 -0
  118. package/dist/src/orchestrator/types.d.ts +275 -0
  119. package/dist/src/orchestrator/types.d.ts.map +1 -0
  120. package/dist/src/orchestrator/types.js +19 -0
  121. package/dist/src/orchestrator/utils.d.ts +5 -0
  122. package/dist/src/orchestrator/utils.d.ts.map +1 -0
  123. package/dist/src/orchestrator/utils.js +126 -0
  124. package/dist/{types.d.ts → src/types.d.ts} +42 -21
  125. package/dist/src/types.d.ts.map +1 -0
  126. package/dist/test/consts.d.ts +10 -0
  127. package/dist/test/consts.d.ts.map +1 -0
  128. package/dist/test/consts.js +22 -0
  129. package/package.json +11 -20
  130. package/dist/accounts/index.d.ts.map +0 -1
  131. package/dist/accounts/index.js +0 -419
  132. package/dist/accounts/kernel.d.ts.map +0 -1
  133. package/dist/accounts/nexus.d.ts.map +0 -1
  134. package/dist/accounts/safe.d.ts.map +0 -1
  135. package/dist/accounts/utils.d.ts.map +0 -1
  136. package/dist/actions/index.d.ts +0 -29
  137. package/dist/actions/index.d.ts.map +0 -1
  138. package/dist/actions/registry.d.ts +0 -7
  139. package/dist/actions/registry.d.ts.map +0 -1
  140. package/dist/actions/registry.js +0 -7
  141. package/dist/actions/smart-session.d.ts.map +0 -1
  142. package/dist/execution/index.d.ts.map +0 -1
  143. package/dist/execution/index.js +0 -149
  144. package/dist/execution/smart-session.d.ts +0 -23
  145. package/dist/execution/smart-session.d.ts.map +0 -1
  146. package/dist/execution/utils.d.ts +0 -68
  147. package/dist/execution/utils.d.ts.map +0 -1
  148. package/dist/execution/utils.js +0 -482
  149. package/dist/index.d.ts +0 -38
  150. package/dist/index.d.ts.map +0 -1
  151. package/dist/index.js +0 -119
  152. package/dist/modules/abi/smart-sessions.d.ts.map +0 -1
  153. package/dist/modules/common.d.ts.map +0 -1
  154. package/dist/modules/index.d.ts.map +0 -1
  155. package/dist/modules/omni-account.d.ts +0 -9
  156. package/dist/modules/omni-account.d.ts.map +0 -1
  157. package/dist/modules/omni-account.js +0 -15
  158. package/dist/modules/read.d.ts +0 -10
  159. package/dist/modules/read.d.ts.map +0 -1
  160. package/dist/modules/registry.d.ts +0 -9
  161. package/dist/modules/registry.d.ts.map +0 -1
  162. package/dist/modules/registry.js +0 -60
  163. package/dist/modules/validators/core.d.ts.map +0 -1
  164. package/dist/modules/validators/index.d.ts +0 -4
  165. package/dist/modules/validators/index.d.ts.map +0 -1
  166. package/dist/modules/validators/smart-sessions.d.ts.map +0 -1
  167. package/dist/orchestrator/client.d.ts +0 -29
  168. package/dist/orchestrator/client.d.ts.map +0 -1
  169. package/dist/orchestrator/client.js +0 -250
  170. package/dist/orchestrator/consts.d.ts +0 -5
  171. package/dist/orchestrator/consts.d.ts.map +0 -1
  172. package/dist/orchestrator/consts.js +0 -9
  173. package/dist/orchestrator/error.d.ts +0 -18
  174. package/dist/orchestrator/error.d.ts.map +0 -1
  175. package/dist/orchestrator/error.js +0 -33
  176. package/dist/orchestrator/index.d.ts +0 -11
  177. package/dist/orchestrator/index.d.ts.map +0 -1
  178. package/dist/orchestrator/index.js +0 -40
  179. package/dist/orchestrator/registry.d.ts +0 -20
  180. package/dist/orchestrator/registry.d.ts.map +0 -1
  181. package/dist/orchestrator/registry.js +0 -444
  182. package/dist/orchestrator/types.d.ts +0 -242
  183. package/dist/orchestrator/types.d.ts.map +0 -1
  184. package/dist/orchestrator/types.js +0 -19
  185. package/dist/orchestrator/utils.d.ts +0 -29
  186. package/dist/orchestrator/utils.d.ts.map +0 -1
  187. package/dist/orchestrator/utils.js +0 -319
  188. package/dist/types.d.ts.map +0 -1
  189. /package/dist/{actions → src/actions}/smart-session.js +0 -0
  190. /package/dist/{modules → src/modules}/abi/smart-sessions.d.ts +0 -0
  191. /package/dist/{modules → src/modules}/abi/smart-sessions.js +0 -0
  192. /package/dist/{modules → src/modules}/common.d.ts +0 -0
  193. /package/dist/{modules → src/modules}/common.js +0 -0
  194. /package/dist/{types.js → src/types.js} +0 -0
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.isOrchestratorError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceChainsNotAvailableForUserOpFlowError = exports.ExecutionError = exports.IntentFailedError = exports.isExecutionError = exports.Eip7702NotSupportedForAccountError = exports.SignMessageNotSupportedByAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = exports.isAccountError = exports.setUpRecovery = exports.setSubValidator = exports.removeSubValidator = exports.removeOwner = exports.recover = exports.encodeSmartSessionSignature = exports.enablePasskeys = exports.enableMultiFactor = exports.enableEcdsa = exports.disablePasskeys = exports.disableMultiFactor = exports.disableEcdsa = exports.changeThreshold = exports.changeMultiFactorThreshold = exports.addOwner = exports.createTransport = void 0;
4
+ exports.createRhinestoneAccount = createRhinestoneAccount;
5
+ const accounts_1 = require("./accounts");
6
+ Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
7
+ Object.defineProperty(exports, "Eip7702AccountMustHaveEoaError", { enumerable: true, get: function () { return accounts_1.Eip7702AccountMustHaveEoaError; } });
8
+ Object.defineProperty(exports, "Eip7702NotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.Eip7702NotSupportedForAccountError; } });
9
+ Object.defineProperty(exports, "ExistingEip7702AccountsNotSupportedError", { enumerable: true, get: function () { return accounts_1.ExistingEip7702AccountsNotSupportedError; } });
10
+ Object.defineProperty(exports, "FactoryArgsNotAvailableError", { enumerable: true, get: function () { return accounts_1.FactoryArgsNotAvailableError; } });
11
+ Object.defineProperty(exports, "isAccountError", { enumerable: true, get: function () { return accounts_1.isAccountError; } });
12
+ Object.defineProperty(exports, "SigningNotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.SigningNotSupportedForAccountError; } });
13
+ Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumerable: true, get: function () { return accounts_1.SignMessageNotSupportedByAccountError; } });
14
+ Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
15
+ const utils_1 = require("./accounts/utils");
16
+ Object.defineProperty(exports, "createTransport", { enumerable: true, get: function () { return utils_1.createTransport; } });
17
+ const actions_1 = require("./actions");
18
+ Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
19
+ Object.defineProperty(exports, "changeMultiFactorThreshold", { enumerable: true, get: function () { return actions_1.changeMultiFactorThreshold; } });
20
+ Object.defineProperty(exports, "changeThreshold", { enumerable: true, get: function () { return actions_1.changeThreshold; } });
21
+ Object.defineProperty(exports, "disableEcdsa", { enumerable: true, get: function () { return actions_1.disableEcdsa; } });
22
+ Object.defineProperty(exports, "disableMultiFactor", { enumerable: true, get: function () { return actions_1.disableMultiFactor; } });
23
+ Object.defineProperty(exports, "disablePasskeys", { enumerable: true, get: function () { return actions_1.disablePasskeys; } });
24
+ Object.defineProperty(exports, "enableEcdsa", { enumerable: true, get: function () { return actions_1.enableEcdsa; } });
25
+ Object.defineProperty(exports, "enableMultiFactor", { enumerable: true, get: function () { return actions_1.enableMultiFactor; } });
26
+ Object.defineProperty(exports, "enablePasskeys", { enumerable: true, get: function () { return actions_1.enablePasskeys; } });
27
+ Object.defineProperty(exports, "encodeSmartSessionSignature", { enumerable: true, get: function () { return actions_1.encodeSmartSessionSignature; } });
28
+ Object.defineProperty(exports, "recover", { enumerable: true, get: function () { return actions_1.recover; } });
29
+ Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function () { return actions_1.removeOwner; } });
30
+ Object.defineProperty(exports, "removeSubValidator", { enumerable: true, get: function () { return actions_1.removeSubValidator; } });
31
+ Object.defineProperty(exports, "setSubValidator", { enumerable: true, get: function () { return actions_1.setSubValidator; } });
32
+ Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
33
+ const execution_1 = require("./execution");
34
+ Object.defineProperty(exports, "ExecutionError", { enumerable: true, get: function () { return execution_1.ExecutionError; } });
35
+ Object.defineProperty(exports, "IntentFailedError", { enumerable: true, get: function () { return execution_1.IntentFailedError; } });
36
+ Object.defineProperty(exports, "isExecutionError", { enumerable: true, get: function () { return execution_1.isExecutionError; } });
37
+ Object.defineProperty(exports, "OrderPathRequiredForIntentsError", { enumerable: true, get: function () { return execution_1.OrderPathRequiredForIntentsError; } });
38
+ Object.defineProperty(exports, "SessionChainRequiredError", { enumerable: true, get: function () { return execution_1.SessionChainRequiredError; } });
39
+ Object.defineProperty(exports, "SourceChainsNotAvailableForUserOpFlowError", { enumerable: true, get: function () { return execution_1.SourceChainsNotAvailableForUserOpFlowError; } });
40
+ Object.defineProperty(exports, "UserOperationRequiredForSmartSessionsError", { enumerable: true, get: function () { return execution_1.UserOperationRequiredForSmartSessionsError; } });
41
+ const smart_session_1 = require("./execution/smart-session");
42
+ const utils_2 = require("./execution/utils");
43
+ const modules_1 = require("./modules");
44
+ const orchestrator_1 = require("./orchestrator");
45
+ Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
46
+ Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return orchestrator_1.InsufficientBalanceError; } });
47
+ Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return orchestrator_1.IntentNotFoundError; } });
48
+ Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
49
+ Object.defineProperty(exports, "InvalidIntentSignatureError", { enumerable: true, get: function () { return orchestrator_1.InvalidIntentSignatureError; } });
50
+ Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return orchestrator_1.isOrchestratorError; } });
51
+ Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return orchestrator_1.NoPathFoundError; } });
52
+ Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return orchestrator_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
53
+ Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return orchestrator_1.OrchestratorError; } });
54
+ Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return orchestrator_1.TokenNotSupportedError; } });
55
+ Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainError; } });
56
+ Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainIdError; } });
57
+ Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedTokenError; } });
58
+ /**
59
+ * Initialize a Rhinestone account
60
+ * Note: accounts are deployed onchain only when the first transaction is sent.
61
+ * @param config Account config (e.g. implementation vendor, owner signers, smart sessions)
62
+ * @returns account
63
+ */
64
+ async function createRhinestoneAccount(config) {
65
+ function deploy(chain, session) {
66
+ return (0, accounts_1.deploy)(config, chain, session);
67
+ }
68
+ function signEip7702InitData() {
69
+ return (0, accounts_1.signEip7702InitData)(config);
70
+ }
71
+ function prepareTransaction(transaction) {
72
+ return (0, utils_2.prepareTransaction)(config, transaction);
73
+ }
74
+ function signTransaction(preparedTransaction) {
75
+ return (0, utils_2.signTransaction)(config, preparedTransaction);
76
+ }
77
+ function signAuthorizations(preparedTransaction) {
78
+ return (0, utils_2.signAuthorizations)(config, preparedTransaction);
79
+ }
80
+ function submitTransaction(signedTransaction, authorizations) {
81
+ return (0, utils_2.submitTransaction)(config, signedTransaction, authorizations ?? []);
82
+ }
83
+ /**
84
+ * Sign and send a transaction
85
+ * @param transaction Transaction to send
86
+ * @returns transaction result object (an intent ID or a UserOp hash)
87
+ */
88
+ function sendTransaction(transaction) {
89
+ return (0, execution_1.sendTransaction)(config, transaction);
90
+ }
91
+ /**
92
+ * Wait for the transaction execution onchain
93
+ * @param result transaction result object
94
+ * @param acceptsPreconfirmations whether to accept preconfirmations from relayers before the transaction lands onchain (enabled by default)
95
+ * @returns intent result or a UserOp receipt
96
+ */
97
+ function waitForExecution(result, acceptsPreconfirmations = true) {
98
+ return (0, execution_1.waitForExecution)(config, result, acceptsPreconfirmations);
99
+ }
100
+ /**
101
+ * Get account address
102
+ * @returns Address of the smart account
103
+ */
104
+ function getAddress() {
105
+ return (0, accounts_1.getAddress)(config);
106
+ }
107
+ /**
108
+ * Get account portfolio
109
+ * @param onTestnets Whether to query the testnet balances (default is `false`)
110
+ * @returns Account balances
111
+ */
112
+ function getPortfolio(onTestnets = false) {
113
+ return (0, execution_1.getPortfolio)(config, onTestnets);
114
+ }
115
+ /**
116
+ * Get the maximum spendable token amount on the target chain
117
+ * @param chain Target chain
118
+ * @param tokenAddress Token address (on the target chain)
119
+ * @param gasUnits Gas cost estimate for the transaction execution
120
+ * @returns Maximum spendable amount in absolute units
121
+ */
122
+ function getMaxSpendableAmount(chain, tokenAddress, gasUnits) {
123
+ return (0, execution_1.getMaxSpendableAmount)(config, chain, tokenAddress, gasUnits);
124
+ }
125
+ function getSessionDetails(sessions, sessionIndex, signature) {
126
+ return (0, smart_session_1.getSessionDetails)(config, sessions, sessionIndex, signature);
127
+ }
128
+ function getOwners(chain) {
129
+ const account = getAddress();
130
+ return (0, modules_1.getOwners)(account, chain, config.provider);
131
+ }
132
+ function getValidators(chain) {
133
+ const accountType = config.account?.type || 'nexus';
134
+ const account = getAddress();
135
+ return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
136
+ }
137
+ return {
138
+ config,
139
+ deploy,
140
+ signEip7702InitData,
141
+ prepareTransaction,
142
+ signTransaction,
143
+ signAuthorizations,
144
+ submitTransaction,
145
+ sendTransaction,
146
+ waitForExecution,
147
+ getAddress,
148
+ getPortfolio,
149
+ getMaxSpendableAmount,
150
+ getSessionDetails,
151
+ getOwners,
152
+ getValidators,
153
+ };
154
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/abi/smart-sessions.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8Hb,CAAA;AAEV,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../modules/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAExC,KAAK,UAAU,GACX,OAAO,wBAAwB,GAC/B,OAAO,uBAAuB,GAC9B,OAAO,uBAAuB,GAC9B,OAAO,mBAAmB,CAAA;AAE9B,UAAU,MAAM;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE,GAAG,CAAA;IACf,iBAAiB,EAAE,GAAG,CAAA;IACtB,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,QAAA,MAAM,wBAAwB,KAAK,CAAA;AACnC,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAClC,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAClC,QAAA,MAAM,mBAAmB,KAAK,CAAA;AAE9B,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,GACpB,CAAA;AACD,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,CAAA"}
@@ -1,9 +1,8 @@
1
- import { type Address, type Chain, type Hex } from 'viem';
1
+ import { type Chain, type Hex } from 'viem';
2
2
  import type { RhinestoneAccountConfig } from '../types';
3
3
  import { type Module } from './common';
4
4
  import { HOOK_ADDRESS } from './omni-account';
5
- import { areAttestersTrusted, getOwners, getValidators } from './read';
6
- import { getTrustAttesterCall, getTrustedAttesters } from './registry';
5
+ import { getOwners, getValidators } from './read';
7
6
  import { getOwnerValidator } from './validators';
8
7
  interface WebAuthnData {
9
8
  authenticatorData: Hex;
@@ -26,16 +25,9 @@ interface ModeleSetup {
26
25
  executors: Module[];
27
26
  fallbacks: Module[];
28
27
  hooks: Module[];
29
- registry: Address;
30
- attesters: Address[];
31
- threshold: number;
32
28
  }
33
29
  declare function getSetup(config: RhinestoneAccountConfig): ModeleSetup;
34
30
  declare function getWebauthnValidatorSignature(params: WebauthnValidatorSignature): Hex;
35
31
  declare function isRip7212SupportedNetwork(chain: Chain): boolean;
36
- declare function getAttesters(): {
37
- list: Address[];
38
- threshold: number;
39
- };
40
- export { HOOK_ADDRESS, getSetup, getTrustAttesterCall, getTrustedAttesters, getOwnerValidator, getWebauthnValidatorSignature, getAttesters, areAttestersTrusted, getOwners, getValidators, isRip7212SupportedNetwork, };
32
+ export { HOOK_ADDRESS, getSetup, getOwnerValidator, getWebauthnValidatorSignature, getOwners, getValidators, isRip7212SupportedNetwork, };
41
33
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,KAAK,EAEV,KAAK,GAAG,EAET,MAAM,MAAM,CAAA;AAWb,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAEvD,OAAO,EAGL,KAAK,MAAM,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,YAAY,EAA2B,MAAM,gBAAgB,CAAA;AACtE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAA4B,MAAM,cAAc,CAAA;AAM1E,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/B,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;CAC3B;AAED,UAAU,0BAA0B;IAClC,aAAa,EAAE,GAAG,EAAE,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,EAAE,YAAY,CAAA;IACtB,SAAS,EAAE,iBAAiB,GAAG,GAAG,GAAG,UAAU,CAAA;CAChD;AAED,UAAU,iBAAiB;IACzB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,iBAAS,QAAQ,CAAC,MAAM,EAAE,uBAAuB,GAAG,WAAW,CAwD9D;AAED,iBAAS,6BAA6B,CAAC,MAAM,EAAE,0BAA0B,GAAG,GAAG,CA6C9E;AAED,iBAAS,yBAAyB,CAAC,KAAK,EAAE,KAAK,WAY9C;AAaD,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,6BAA6B,EAC7B,SAAS,EACT,aAAa,EACb,yBAAyB,GAC1B,CAAA"}
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getValidators = exports.getOwners = exports.areAttestersTrusted = exports.getOwnerValidator = exports.getTrustedAttesters = exports.getTrustAttesterCall = exports.HOOK_ADDRESS = void 0;
3
+ exports.getValidators = exports.getOwners = exports.getOwnerValidator = exports.HOOK_ADDRESS = void 0;
4
4
  exports.getSetup = getSetup;
5
5
  exports.getWebauthnValidatorSignature = getWebauthnValidatorSignature;
6
- exports.getAttesters = getAttesters;
7
6
  exports.isRip7212SupportedNetwork = isRip7212SupportedNetwork;
8
7
  const viem_1 = require("viem");
9
8
  const chains_1 = require("viem/chains");
@@ -11,12 +10,8 @@ const common_1 = require("./common");
11
10
  const omni_account_1 = require("./omni-account");
12
11
  Object.defineProperty(exports, "HOOK_ADDRESS", { enumerable: true, get: function () { return omni_account_1.HOOK_ADDRESS; } });
13
12
  const read_1 = require("./read");
14
- Object.defineProperty(exports, "areAttestersTrusted", { enumerable: true, get: function () { return read_1.areAttestersTrusted; } });
15
13
  Object.defineProperty(exports, "getOwners", { enumerable: true, get: function () { return read_1.getOwners; } });
16
14
  Object.defineProperty(exports, "getValidators", { enumerable: true, get: function () { return read_1.getValidators; } });
17
- const registry_1 = require("./registry");
18
- Object.defineProperty(exports, "getTrustAttesterCall", { enumerable: true, get: function () { return registry_1.getTrustAttesterCall; } });
19
- Object.defineProperty(exports, "getTrustedAttesters", { enumerable: true, get: function () { return registry_1.getTrustedAttesters; } });
20
15
  const validators_1 = require("./validators");
21
16
  Object.defineProperty(exports, "getOwnerValidator", { enumerable: true, get: function () { return validators_1.getOwnerValidator; } });
22
17
  const core_1 = require("./validators/core");
@@ -34,40 +29,14 @@ function getSetup(config) {
34
29
  }
35
30
  const executors = [
36
31
  {
37
- address: omni_account_1.SAME_CHAIN_MODULE_ADDRESS,
32
+ address: omni_account_1.INTENT_EXECUTOR_ADDRESS,
38
33
  initData: '0x',
39
34
  deInitData: '0x',
40
35
  additionalContext: '0x',
41
36
  type: common_1.MODULE_TYPE_ID_EXECUTOR,
42
37
  },
43
- {
44
- address: omni_account_1.TARGET_MODULE_ADDRESS,
45
- initData: '0x',
46
- deInitData: '0x',
47
- additionalContext: '0x',
48
- type: common_1.MODULE_TYPE_ID_EXECUTOR,
49
- },
50
- {
51
- address: omni_account_1.HOOK_ADDRESS,
52
- initData: '0x',
53
- deInitData: '0x',
54
- additionalContext: '0x',
55
- type: common_1.MODULE_TYPE_ID_EXECUTOR,
56
- },
57
- ];
58
- const fallbacks = [
59
- {
60
- address: omni_account_1.TARGET_MODULE_ADDRESS,
61
- initData: (0, viem_1.encodeAbiParameters)([
62
- { name: 'selector', type: 'bytes4' },
63
- { name: 'flags', type: 'bytes1' },
64
- { name: 'data', type: 'bytes' },
65
- ], ['0x3a5be8cb', '0x00', '0x']),
66
- deInitData: '0x',
67
- additionalContext: '0x',
68
- type: common_1.MODULE_TYPE_ID_FALLBACK,
69
- },
70
38
  ];
39
+ const fallbacks = [];
71
40
  // Some accounts (e.g. Safe) need a fallback method to support smart sessions
72
41
  if (config.sessions) {
73
42
  if (config.account && config.account.type === 'safe') {
@@ -85,15 +54,11 @@ function getSetup(config) {
85
54
  }
86
55
  }
87
56
  const hooks = [];
88
- const attesters = getAttesters();
89
57
  return {
90
58
  validators,
91
59
  executors,
92
60
  fallbacks,
93
61
  hooks,
94
- registry: omni_account_1.RHINESTONE_MODULE_REGISTRY_ADDRESS,
95
- attesters: attesters.list,
96
- threshold: attesters.threshold,
97
62
  };
98
63
  }
99
64
  function getWebauthnValidatorSignature(params) {
@@ -142,7 +107,6 @@ function isRip7212SupportedNetwork(chain) {
142
107
  chains_1.optimism,
143
108
  chains_1.optimismSepolia,
144
109
  chains_1.polygon,
145
- chains_1.polygonAmoy,
146
110
  chains_1.base,
147
111
  chains_1.baseSepolia,
148
112
  chains_1.arbitrum,
@@ -159,9 +123,3 @@ function parseSignature(signature) {
159
123
  s: BigInt((0, viem_1.bytesToHex)(s)),
160
124
  };
161
125
  }
162
- function getAttesters() {
163
- return {
164
- list: [omni_account_1.RHINESTONE_ATTESTER_ADDRESS, omni_account_1.OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS],
165
- threshold: 1,
166
- };
167
- }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../modules/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const consts_1 = require("../../test/consts");
5
+ const index_1 = require("./index");
6
+ (0, vitest_1.describe)('Modules', () => {
7
+ (0, vitest_1.describe)('Setup', () => {
8
+ (0, vitest_1.test)('should use ownable validator for ECDSA owners', () => {
9
+ const config = {
10
+ rhinestoneApiKey: consts_1.MOCK_API_KEY,
11
+ owners: {
12
+ type: 'ecdsa',
13
+ accounts: [consts_1.accountA],
14
+ threshold: 1,
15
+ },
16
+ };
17
+ const setup = (0, index_1.getSetup)(config);
18
+ (0, vitest_1.expect)(setup.validators[0].address).toBe('0x0000000000E9E6E96Bcaa3c113187CdB7E38AED9');
19
+ (0, vitest_1.expect)(setup.validators[0].type).toBe(1n);
20
+ });
21
+ (0, vitest_1.test)('should use webauthn validator for passkey owners', () => {
22
+ const config = {
23
+ rhinestoneApiKey: consts_1.MOCK_API_KEY,
24
+ owners: {
25
+ type: 'passkey',
26
+ account: consts_1.passkeyAccount,
27
+ credentialIds: ['0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'],
28
+ },
29
+ };
30
+ const setup = (0, index_1.getSetup)(config);
31
+ (0, vitest_1.expect)(setup.validators).toHaveLength(1);
32
+ (0, vitest_1.expect)(setup.validators[0].address).toBe('0x0000000000578c4cB0e472a5462da43C495C3F33');
33
+ (0, vitest_1.expect)(setup.validators[0].type).toBe(1n);
34
+ });
35
+ (0, vitest_1.test)('should use smart session validator when sessions are enabled', () => {
36
+ const config = {
37
+ rhinestoneApiKey: consts_1.MOCK_API_KEY,
38
+ owners: {
39
+ type: 'ecdsa',
40
+ accounts: [consts_1.accountA],
41
+ threshold: 1,
42
+ },
43
+ sessions: [
44
+ {
45
+ owners: {
46
+ type: 'ecdsa',
47
+ accounts: [consts_1.accountB],
48
+ threshold: 1,
49
+ },
50
+ },
51
+ ],
52
+ };
53
+ const setup = (0, index_1.getSetup)(config);
54
+ const smartSessionValidator = setup.validators.find((validator) => validator.address === '0x00000000002b0ecfbd0496ee71e01257da0e37de');
55
+ if (!smartSessionValidator) {
56
+ return;
57
+ }
58
+ (0, vitest_1.expect)(smartSessionValidator.type).toBe(1n);
59
+ });
60
+ (0, vitest_1.test)('should use smart session compatibility fallback for safe accounts with sessions', () => {
61
+ const config = {
62
+ rhinestoneApiKey: consts_1.MOCK_API_KEY,
63
+ owners: {
64
+ type: 'ecdsa',
65
+ accounts: [consts_1.accountA],
66
+ threshold: 1,
67
+ },
68
+ sessions: [
69
+ {
70
+ owners: {
71
+ type: 'ecdsa',
72
+ accounts: [consts_1.accountB],
73
+ threshold: 1,
74
+ },
75
+ },
76
+ ],
77
+ account: {
78
+ type: 'safe',
79
+ },
80
+ };
81
+ const setup = (0, index_1.getSetup)(config);
82
+ const smartSessionFallback = setup.fallbacks.find((fallback) => fallback.address === '0x12cae64c42f362e7d5a847c2d33388373f629177');
83
+ (0, vitest_1.expect)(smartSessionFallback).toBeDefined();
84
+ if (!smartSessionFallback) {
85
+ return;
86
+ }
87
+ (0, vitest_1.expect)(smartSessionFallback.type).toBe(3n);
88
+ });
89
+ vitest_1.test.todo('using the omni account should install the necessary modules');
90
+ });
91
+ (0, vitest_1.describe)('WebAuthn Validator Signature', () => {
92
+ (0, vitest_1.test)('default', () => {
93
+ const signature = (0, index_1.getWebauthnValidatorSignature)({
94
+ credentialIds: ['0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'],
95
+ webauthn: {
96
+ authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
97
+ clientDataJSON: '{"type":"webauthn.get","challenge":"tbxXNFS9X_4Byr1cMwqKrIGB-_30a0QhZ6y7ucM0BOE","origin":"http://localhost:3000","crossOrigin":false, "other_keys_can_be_added_here":"do not compare clientDataJSON against a template. See https://goo.gl/yabPex"}',
98
+ challengeIndex: 23n,
99
+ typeIndex: 44941127272049826721201904734628716258498742255959991581049806490182030242267n,
100
+ },
101
+ signature: '0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001635bc6d0f68ff895cae8a288ecf7542a6a9cd555df784b73e1e2ea7e9104b1db15e9015d280cb19527881c625fee43fd3a405d5b0d199a8c8e6589a7381209e40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f47b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22746278584e465339585f3442797231634d77714b724947422d5f3330613051685a36793775634d30424f45222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73652c20226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d000000000000000000000000',
102
+ usePrecompiled: true,
103
+ });
104
+ (0, vitest_1.expect)(signature).toEqual('0x00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120635bc6d0f68ff895cae8a288ecf7542a6a9cd555df784b73e1e2ea7e9104b1db00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f47b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22746278584e465339585f3442797231634d77714b724947422d5f3330613051685a36793775634d30424f45222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73652c20226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d000000000000000000000000');
105
+ });
106
+ });
107
+ });
@@ -0,0 +1,7 @@
1
+ import type { Address } from 'viem';
2
+ declare const HOOK_ADDRESS: Address;
3
+ declare const TARGET_MODULE_ADDRESS: Address;
4
+ declare const SAME_CHAIN_MODULE_ADDRESS: Address;
5
+ declare const INTENT_EXECUTOR_ADDRESS: Address;
6
+ export { HOOK_ADDRESS, TARGET_MODULE_ADDRESS, SAME_CHAIN_MODULE_ADDRESS, INTENT_EXECUTOR_ADDRESS, };
7
+ //# sourceMappingURL=omni-account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"omni-account.d.ts","sourceRoot":"","sources":["../../../modules/omni-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,QAAA,MAAM,YAAY,EAAE,OAAsD,CAAA;AAC1E,QAAA,MAAM,qBAAqB,EAAE,OACiB,CAAA;AAC9C,QAAA,MAAM,yBAAyB,EAAE,OACa,CAAA;AAE9C,QAAA,MAAM,uBAAuB,EAAE,OACe,CAAA;AAE9C,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,GACxB,CAAA"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INTENT_EXECUTOR_ADDRESS = exports.SAME_CHAIN_MODULE_ADDRESS = exports.TARGET_MODULE_ADDRESS = exports.HOOK_ADDRESS = void 0;
4
+ const HOOK_ADDRESS = '0x0000000000f6Ed8Be424d673c63eeFF8b9267420';
5
+ exports.HOOK_ADDRESS = HOOK_ADDRESS;
6
+ const TARGET_MODULE_ADDRESS = '0x0000000000E5a37279A001301A837a91b5de1D5E';
7
+ exports.TARGET_MODULE_ADDRESS = TARGET_MODULE_ADDRESS;
8
+ const SAME_CHAIN_MODULE_ADDRESS = '0x000000000043ff16d5776c7F0f65Ec485C17Ca04';
9
+ exports.SAME_CHAIN_MODULE_ADDRESS = SAME_CHAIN_MODULE_ADDRESS;
10
+ const INTENT_EXECUTOR_ADDRESS = '0x00000000005aD9ce1f5035FD62CA96CEf16AdAAF';
11
+ exports.INTENT_EXECUTOR_ADDRESS = INTENT_EXECUTOR_ADDRESS;
@@ -0,0 +1,9 @@
1
+ import { type Address, type Chain } from 'viem';
2
+ import type { AccountType, ProviderConfig } from '../types';
3
+ declare function getValidators(accountType: AccountType, account: Address, chain: Chain, provider?: ProviderConfig): Promise<Address[]>;
4
+ declare function getOwners(account: Address, chain: Chain, provider?: ProviderConfig): Promise<{
5
+ accounts: Address[];
6
+ threshold: number;
7
+ } | null>;
8
+ export { getValidators, getOwners };
9
+ //# sourceMappingURL=read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../modules/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAsB,MAAM,MAAM,CAAA;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG3D,iBAAe,aAAa,CAC1B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,OAAO,EAAE,CAAC,CA8CpB;AAED,iBAAe,SAAS,CACtB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC;IACT,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,IAAI,CAAC,CAkER;AAED,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,CAAA"}
@@ -2,18 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getValidators = getValidators;
4
4
  exports.getOwners = getOwners;
5
- exports.areAttestersTrusted = areAttestersTrusted;
6
5
  const viem_1 = require("viem");
7
- const _1 = require(".");
8
- const omni_account_1 = require("./omni-account");
6
+ const utils_1 = require("../accounts/utils");
9
7
  const core_1 = require("./validators/core");
10
- async function getValidators(accountType, account, chain) {
8
+ async function getValidators(accountType, account, chain, provider) {
11
9
  const publicClient = (0, viem_1.createPublicClient)({
12
10
  chain,
13
- transport: (0, viem_1.http)(),
11
+ transport: (0, utils_1.createTransport)(chain, provider),
14
12
  });
15
13
  switch (accountType) {
16
14
  case 'safe':
15
+ case 'startale':
17
16
  case 'nexus': {
18
17
  const validators = await publicClient.readContract({
19
18
  abi: [
@@ -53,10 +52,10 @@ async function getValidators(accountType, account, chain) {
53
52
  }
54
53
  }
55
54
  }
56
- async function getOwners(account, chain) {
55
+ async function getOwners(account, chain, provider) {
57
56
  const publicClient = (0, viem_1.createPublicClient)({
58
57
  chain,
59
- transport: (0, viem_1.http)(),
58
+ transport: (0, utils_1.createTransport)(chain, provider),
60
59
  });
61
60
  const moduleAddress = core_1.OWNABLE_VALIDATOR_ADDRESS;
62
61
  const [ownerResult, thresholdResult] = await publicClient.multicall({
@@ -120,33 +119,3 @@ async function getOwners(account, chain) {
120
119
  threshold: thresholdResult.result,
121
120
  };
122
121
  }
123
- async function areAttestersTrusted(account, chain) {
124
- const { list: requiredAttesters } = (0, _1.getAttesters)();
125
- const publicClient = (0, viem_1.createPublicClient)({
126
- chain,
127
- transport: (0, viem_1.http)(),
128
- });
129
- const trustedAttesters = await publicClient.readContract({
130
- abi: [
131
- {
132
- type: 'function',
133
- name: 'findTrustedAttesters',
134
- inputs: [
135
- {
136
- type: 'address',
137
- name: 'smartAccount',
138
- },
139
- ],
140
- outputs: [
141
- {
142
- type: 'address[]',
143
- },
144
- ],
145
- },
146
- ],
147
- functionName: 'findTrustedAttesters',
148
- address: omni_account_1.RHINESTONE_MODULE_REGISTRY_ADDRESS,
149
- args: [account],
150
- });
151
- return requiredAttesters.every((attester) => trustedAttesters.includes((0, viem_1.getAddress)(attester)));
152
- }
@@ -1,5 +1,5 @@
1
- import { Account, type Address, type Hex } from 'viem';
2
- import type { OwnerSet, RhinestoneAccountConfig } from '../../types';
1
+ import { type Account, type Address, type Hex } from 'viem';
2
+ import type { OwnableValidatorConfig, OwnerSet, RhinestoneAccountConfig, WebauthnValidatorConfig } from '../../types';
3
3
  import { type Module } from '../common';
4
4
  interface PublicKey {
5
5
  prefix?: number | undefined;
@@ -12,15 +12,14 @@ interface WebauthnCredential {
12
12
  }
13
13
  declare const OWNABLE_VALIDATOR_ADDRESS: Address;
14
14
  declare const WEBAUTHN_VALIDATOR_ADDRESS: Address;
15
+ declare const MULTI_FACTOR_VALIDATOR_ADDRESS: Address;
15
16
  declare function getOwnerValidator(config: RhinestoneAccountConfig): Module;
16
17
  declare function getMockSignature(ownerSet: OwnerSet): Hex;
17
18
  declare function getValidator(owners: OwnerSet): Module;
18
- declare function getOwnableValidator({ threshold, owners, }: {
19
- threshold: number;
20
- owners: Address[];
21
- }): Module;
19
+ declare function getOwnableValidator(threshold: number, owners: Address[]): Module;
22
20
  declare function getWebAuthnValidator(webAuthnCredential: WebauthnCredential): Module;
21
+ declare function getMultiFactorValidator(threshold: number, validators: (OwnableValidatorConfig | WebauthnValidatorConfig | null)[]): Module;
23
22
  declare function getSocialRecoveryValidator(guardians: Account[], threshold?: number): Module;
24
- export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
23
+ export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getMultiFactorValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
25
24
  export type { WebauthnCredential };
26
25
  //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,KAAK,GAAG,EAKT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EACV,sBAAsB,EACtB,QAAQ,EACR,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAEjE,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,SAAS,GAAG,GAAG,GAAG,UAAU,CAAA;IACpC,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,QAAA,MAAM,yBAAyB,EAAE,OACa,CAAA;AAC9C,QAAA,MAAM,0BAA0B,EAAE,OACY,CAAA;AAG9C,QAAA,MAAM,8BAA8B,EAAE,OACQ,CAAA;AAO9C,iBAAS,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,UAEzD;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAiDjD;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,QAAQ,UAgBrC;AAED,iBAAS,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAiBzE;AAED,iBAAS,oBAAoB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,MAAM,CAgD5E;AAED,iBAAS,uBAAuB,CAC9B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,CAAC,sBAAsB,GAAG,uBAAuB,GAAG,IAAI,CAAC,EAAE,GACtE,MAAM,CAgDR;AAED,iBAAS,0BAA0B,CACjC,SAAS,EAAE,OAAO,EAAE,EACpB,SAAS,SAAI,GACZ,MAAM,CAsBR;AAeD,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,EAC9B,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,CAAA;AACD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}