@startale-scs/aa-sdk 0.0.0-dev.20260331120000

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 (677) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -0
  3. package/dist/_cjs/account/decorators/getFactoryData.js +36 -0
  4. package/dist/_cjs/account/decorators/getFactoryData.js.map +1 -0
  5. package/dist/_cjs/account/decorators/getStartaleAccountAddress.js +18 -0
  6. package/dist/_cjs/account/decorators/getStartaleAccountAddress.js.map +1 -0
  7. package/dist/_cjs/account/decorators/index.js +6 -0
  8. package/dist/_cjs/account/decorators/index.js.map +1 -0
  9. package/dist/_cjs/account/index.js +6 -0
  10. package/dist/_cjs/account/index.js.map +1 -0
  11. package/dist/_cjs/account/toStartaleSmartAccount.js +311 -0
  12. package/dist/_cjs/account/toStartaleSmartAccount.js.map +1 -0
  13. package/dist/_cjs/account/utils/AccountNotFound.js +18 -0
  14. package/dist/_cjs/account/utils/AccountNotFound.js.map +1 -0
  15. package/dist/_cjs/account/utils/Constants.js +128 -0
  16. package/dist/_cjs/account/utils/Constants.js.map +1 -0
  17. package/dist/_cjs/account/utils/Helpers.js +39 -0
  18. package/dist/_cjs/account/utils/Helpers.js.map +1 -0
  19. package/dist/_cjs/account/utils/Logger.js +35 -0
  20. package/dist/_cjs/account/utils/Logger.js.map +1 -0
  21. package/dist/_cjs/account/utils/Types.js +3 -0
  22. package/dist/_cjs/account/utils/Types.js.map +1 -0
  23. package/dist/_cjs/account/utils/Utils.js +258 -0
  24. package/dist/_cjs/account/utils/Utils.js.map +1 -0
  25. package/dist/_cjs/account/utils/addressToEmptyAccount.js +24 -0
  26. package/dist/_cjs/account/utils/addressToEmptyAccount.js.map +1 -0
  27. package/dist/_cjs/account/utils/contractSimulation.js +27 -0
  28. package/dist/_cjs/account/utils/contractSimulation.js.map +1 -0
  29. package/dist/_cjs/account/utils/deepHexlify.js +26 -0
  30. package/dist/_cjs/account/utils/deepHexlify.js.map +1 -0
  31. package/dist/_cjs/account/utils/eip7702Utils.js +21 -0
  32. package/dist/_cjs/account/utils/eip7702Utils.js.map +1 -0
  33. package/dist/_cjs/account/utils/fromBundlerClient.js +45 -0
  34. package/dist/_cjs/account/utils/fromBundlerClient.js.map +1 -0
  35. package/dist/_cjs/account/utils/getAAError.js +37 -0
  36. package/dist/_cjs/account/utils/getAAError.js.map +1 -0
  37. package/dist/_cjs/account/utils/getChain.js +66 -0
  38. package/dist/_cjs/account/utils/getChain.js.map +1 -0
  39. package/dist/_cjs/account/utils/getVersion.js +46 -0
  40. package/dist/_cjs/account/utils/getVersion.js.map +1 -0
  41. package/dist/_cjs/account/utils/index.js +28 -0
  42. package/dist/_cjs/account/utils/index.js.map +1 -0
  43. package/dist/_cjs/account/utils/parseErrorMessage.js +79 -0
  44. package/dist/_cjs/account/utils/parseErrorMessage.js.map +1 -0
  45. package/dist/_cjs/account/utils/tenderlySimulation.js +52 -0
  46. package/dist/_cjs/account/utils/tenderlySimulation.js.map +1 -0
  47. package/dist/_cjs/account/utils/toInitData.js +13 -0
  48. package/dist/_cjs/account/utils/toInitData.js.map +1 -0
  49. package/dist/_cjs/account/utils/toInstallData.js +15 -0
  50. package/dist/_cjs/account/utils/toInstallData.js.map +1 -0
  51. package/dist/_cjs/account/utils/toSigner.js +81 -0
  52. package/dist/_cjs/account/utils/toSigner.js.map +1 -0
  53. package/dist/_cjs/clients/createHttpClient.js +46 -0
  54. package/dist/_cjs/clients/createHttpClient.js.map +1 -0
  55. package/dist/_cjs/clients/createSCSBundlerClient.js +85 -0
  56. package/dist/_cjs/clients/createSCSBundlerClient.js.map +1 -0
  57. package/dist/_cjs/clients/createSCSPaymasterClient.js +48 -0
  58. package/dist/_cjs/clients/createSCSPaymasterClient.js.map +1 -0
  59. package/dist/_cjs/clients/decorators/bundler/getGasFeeValues.js +49 -0
  60. package/dist/_cjs/clients/decorators/bundler/getGasFeeValues.js.map +1 -0
  61. package/dist/_cjs/clients/decorators/bundler/index.js +11 -0
  62. package/dist/_cjs/clients/decorators/bundler/index.js.map +1 -0
  63. package/dist/_cjs/clients/decorators/bundler/waitForUserOperationReceipt.js +11 -0
  64. package/dist/_cjs/clients/decorators/bundler/waitForUserOperationReceipt.js.map +1 -0
  65. package/dist/_cjs/clients/decorators/erc7579/accountId.js +65 -0
  66. package/dist/_cjs/clients/decorators/erc7579/accountId.js.map +1 -0
  67. package/dist/_cjs/clients/decorators/erc7579/getActiveHook.js +43 -0
  68. package/dist/_cjs/clients/decorators/erc7579/getActiveHook.js.map +1 -0
  69. package/dist/_cjs/clients/decorators/erc7579/getFallbackBySelector.js +56 -0
  70. package/dist/_cjs/clients/decorators/erc7579/getFallbackBySelector.js.map +1 -0
  71. package/dist/_cjs/clients/decorators/erc7579/getInstalledExecutors.js +63 -0
  72. package/dist/_cjs/clients/decorators/erc7579/getInstalledExecutors.js.map +1 -0
  73. package/dist/_cjs/clients/decorators/erc7579/getInstalledValidators.js +61 -0
  74. package/dist/_cjs/clients/decorators/erc7579/getInstalledValidators.js.map +1 -0
  75. package/dist/_cjs/clients/decorators/erc7579/getPreviousModule.js +37 -0
  76. package/dist/_cjs/clients/decorators/erc7579/getPreviousModule.js.map +1 -0
  77. package/dist/_cjs/clients/decorators/erc7579/index.js +64 -0
  78. package/dist/_cjs/clients/decorators/erc7579/index.js.map +1 -0
  79. package/dist/_cjs/clients/decorators/erc7579/installModule.js +73 -0
  80. package/dist/_cjs/clients/decorators/erc7579/installModule.js.map +1 -0
  81. package/dist/_cjs/clients/decorators/erc7579/installModules.js +25 -0
  82. package/dist/_cjs/clients/decorators/erc7579/installModules.js.map +1 -0
  83. package/dist/_cjs/clients/decorators/erc7579/isModuleInstalled.js +90 -0
  84. package/dist/_cjs/clients/decorators/erc7579/isModuleInstalled.js.map +1 -0
  85. package/dist/_cjs/clients/decorators/erc7579/supportsExecutionMode.js +102 -0
  86. package/dist/_cjs/clients/decorators/erc7579/supportsExecutionMode.js.map +1 -0
  87. package/dist/_cjs/clients/decorators/erc7579/supportsModule.js +90 -0
  88. package/dist/_cjs/clients/decorators/erc7579/supportsModule.js.map +1 -0
  89. package/dist/_cjs/clients/decorators/erc7579/uninstallFallback.js +61 -0
  90. package/dist/_cjs/clients/decorators/erc7579/uninstallFallback.js.map +1 -0
  91. package/dist/_cjs/clients/decorators/erc7579/uninstallModule.js +79 -0
  92. package/dist/_cjs/clients/decorators/erc7579/uninstallModule.js.map +1 -0
  93. package/dist/_cjs/clients/decorators/erc7579/uninstallModules.js +26 -0
  94. package/dist/_cjs/clients/decorators/erc7579/uninstallModules.js.map +1 -0
  95. package/dist/_cjs/clients/decorators/index.js +8 -0
  96. package/dist/_cjs/clients/decorators/index.js.map +1 -0
  97. package/dist/_cjs/clients/decorators/smartAccount/debugUserOperation.js +75 -0
  98. package/dist/_cjs/clients/decorators/smartAccount/debugUserOperation.js.map +1 -0
  99. package/dist/_cjs/clients/decorators/smartAccount/index.js +32 -0
  100. package/dist/_cjs/clients/decorators/smartAccount/index.js.map +1 -0
  101. package/dist/_cjs/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.js +32 -0
  102. package/dist/_cjs/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.js.map +1 -0
  103. package/dist/_cjs/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.js +35 -0
  104. package/dist/_cjs/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.js.map +1 -0
  105. package/dist/_cjs/clients/decorators/smartAccount/sendTokenPaymasterUserOp.js +21 -0
  106. package/dist/_cjs/clients/decorators/smartAccount/sendTokenPaymasterUserOp.js.map +1 -0
  107. package/dist/_cjs/clients/decorators/smartAccount/sendTransaction.js +41 -0
  108. package/dist/_cjs/clients/decorators/smartAccount/sendTransaction.js.map +1 -0
  109. package/dist/_cjs/clients/decorators/smartAccount/signMessage.js +14 -0
  110. package/dist/_cjs/clients/decorators/smartAccount/signMessage.js.map +1 -0
  111. package/dist/_cjs/clients/decorators/smartAccount/signTypedData.js +31 -0
  112. package/dist/_cjs/clients/decorators/smartAccount/signTypedData.js.map +1 -0
  113. package/dist/_cjs/clients/decorators/smartAccount/upgradeSmartAccount.js +61 -0
  114. package/dist/_cjs/clients/decorators/smartAccount/upgradeSmartAccount.js.map +1 -0
  115. package/dist/_cjs/clients/decorators/smartAccount/waitForTransactionReceipt.js +17 -0
  116. package/dist/_cjs/clients/decorators/smartAccount/waitForTransactionReceipt.js.map +1 -0
  117. package/dist/_cjs/clients/decorators/smartAccount/writeContract.js +20 -0
  118. package/dist/_cjs/clients/decorators/smartAccount/writeContract.js.map +1 -0
  119. package/dist/_cjs/clients/decorators/tokenPaymaster/getSupportedTokens.js +25 -0
  120. package/dist/_cjs/clients/decorators/tokenPaymaster/getSupportedTokens.js.map +1 -0
  121. package/dist/_cjs/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.js +71 -0
  122. package/dist/_cjs/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.js.map +1 -0
  123. package/dist/_cjs/clients/decorators/tokenPaymaster/index.js +11 -0
  124. package/dist/_cjs/clients/decorators/tokenPaymaster/index.js.map +1 -0
  125. package/dist/_cjs/clients/index.js +8 -0
  126. package/dist/_cjs/clients/index.js.map +1 -0
  127. package/dist/_cjs/constants/abi/AccountFactory.js +337 -0
  128. package/dist/_cjs/constants/abi/AccountFactory.js.map +1 -0
  129. package/dist/_cjs/constants/abi/AccountImplementationAbi.js +1179 -0
  130. package/dist/_cjs/constants/abi/AccountImplementationAbi.js.map +1 -0
  131. package/dist/_cjs/constants/abi/BootstrapAbi.js +730 -0
  132. package/dist/_cjs/constants/abi/BootstrapAbi.js.map +1 -0
  133. package/dist/_cjs/constants/abi/ComposabilityAbi.js +274 -0
  134. package/dist/_cjs/constants/abi/ComposabilityAbi.js.map +1 -0
  135. package/dist/_cjs/constants/abi/EIP1271Abi.js +31 -0
  136. package/dist/_cjs/constants/abi/EIP1271Abi.js.map +1 -0
  137. package/dist/_cjs/constants/abi/ERC7484RegistryAbi.js +17 -0
  138. package/dist/_cjs/constants/abi/ERC7484RegistryAbi.js.map +1 -0
  139. package/dist/_cjs/constants/abi/EntryPointABI.js +661 -0
  140. package/dist/_cjs/constants/abi/EntryPointABI.js.map +1 -0
  141. package/dist/_cjs/constants/abi/SmartSessionAbi.js +1472 -0
  142. package/dist/_cjs/constants/abi/SmartSessionAbi.js.map +1 -0
  143. package/dist/_cjs/constants/abi/TokenWithPermitAbi.js +622 -0
  144. package/dist/_cjs/constants/abi/TokenWithPermitAbi.js.map +1 -0
  145. package/dist/_cjs/constants/abi/UniActionPolicyAbi.js +62 -0
  146. package/dist/_cjs/constants/abi/UniActionPolicyAbi.js.map +1 -0
  147. package/dist/_cjs/constants/abi/UniswapSwapRouterAbi.js +486 -0
  148. package/dist/_cjs/constants/abi/UniswapSwapRouterAbi.js.map +1 -0
  149. package/dist/_cjs/constants/abi/index.js +14 -0
  150. package/dist/_cjs/constants/abi/index.js.map +1 -0
  151. package/dist/_cjs/constants/index.js +64 -0
  152. package/dist/_cjs/constants/index.js.map +1 -0
  153. package/dist/_cjs/index.js +13 -0
  154. package/dist/_cjs/index.js.map +1 -0
  155. package/dist/_cjs/modules/index.js +8 -0
  156. package/dist/_cjs/modules/index.js.map +1 -0
  157. package/dist/_cjs/modules/toEmptyExecutor.js +10 -0
  158. package/dist/_cjs/modules/toEmptyExecutor.js.map +1 -0
  159. package/dist/_cjs/modules/toEmptyHook.js +10 -0
  160. package/dist/_cjs/modules/toEmptyHook.js.map +1 -0
  161. package/dist/_cjs/modules/utils/Helpers.js +59 -0
  162. package/dist/_cjs/modules/utils/Helpers.js.map +1 -0
  163. package/dist/_cjs/modules/utils/Types.js +15 -0
  164. package/dist/_cjs/modules/utils/Types.js.map +1 -0
  165. package/dist/_cjs/modules/utils/Uid.js +14 -0
  166. package/dist/_cjs/modules/utils/Uid.js.map +1 -0
  167. package/dist/_cjs/modules/utils/composabilityCalls.js +117 -0
  168. package/dist/_cjs/modules/utils/composabilityCalls.js.map +1 -0
  169. package/dist/_cjs/modules/utils/index.js +9 -0
  170. package/dist/_cjs/modules/utils/index.js.map +1 -0
  171. package/dist/_cjs/modules/utils/runtimeAbiEncoding.js +276 -0
  172. package/dist/_cjs/modules/utils/runtimeAbiEncoding.js.map +1 -0
  173. package/dist/_cjs/modules/utils/toModule.js +39 -0
  174. package/dist/_cjs/modules/utils/toModule.js.map +1 -0
  175. package/dist/_cjs/modules/validators/default/index.js +5 -0
  176. package/dist/_cjs/modules/validators/default/index.js.map +1 -0
  177. package/dist/_cjs/modules/validators/default/toDefaultModule.js +18 -0
  178. package/dist/_cjs/modules/validators/default/toDefaultModule.js.map +1 -0
  179. package/dist/_cjs/modules/validators/index.js +9 -0
  180. package/dist/_cjs/modules/validators/index.js.map +1 -0
  181. package/dist/_cjs/modules/validators/ownable/decorators/addOwner.js +48 -0
  182. package/dist/_cjs/modules/validators/ownable/decorators/addOwner.js.map +1 -0
  183. package/dist/_cjs/modules/validators/ownable/decorators/getAddOwnerTx.js +42 -0
  184. package/dist/_cjs/modules/validators/ownable/decorators/getAddOwnerTx.js.map +1 -0
  185. package/dist/_cjs/modules/validators/ownable/decorators/getOwners.js +28 -0
  186. package/dist/_cjs/modules/validators/ownable/decorators/getOwners.js.map +1 -0
  187. package/dist/_cjs/modules/validators/ownable/decorators/getRemoveOwnerTx.js +42 -0
  188. package/dist/_cjs/modules/validators/ownable/decorators/getRemoveOwnerTx.js.map +1 -0
  189. package/dist/_cjs/modules/validators/ownable/decorators/getSetThresholdTx.js +32 -0
  190. package/dist/_cjs/modules/validators/ownable/decorators/getSetThresholdTx.js.map +1 -0
  191. package/dist/_cjs/modules/validators/ownable/decorators/getThreshold.js +28 -0
  192. package/dist/_cjs/modules/validators/ownable/decorators/getThreshold.js.map +1 -0
  193. package/dist/_cjs/modules/validators/ownable/decorators/index.js +70 -0
  194. package/dist/_cjs/modules/validators/ownable/decorators/index.js.map +1 -0
  195. package/dist/_cjs/modules/validators/ownable/decorators/multiSign.js +25 -0
  196. package/dist/_cjs/modules/validators/ownable/decorators/multiSign.js.map +1 -0
  197. package/dist/_cjs/modules/validators/ownable/decorators/prepareForMultiSign.js +22 -0
  198. package/dist/_cjs/modules/validators/ownable/decorators/prepareForMultiSign.js.map +1 -0
  199. package/dist/_cjs/modules/validators/ownable/decorators/removeOwner.js +47 -0
  200. package/dist/_cjs/modules/validators/ownable/decorators/removeOwner.js.map +1 -0
  201. package/dist/_cjs/modules/validators/ownable/decorators/setThreshold.js +39 -0
  202. package/dist/_cjs/modules/validators/ownable/decorators/setThreshold.js.map +1 -0
  203. package/dist/_cjs/modules/validators/ownable/index.js +6 -0
  204. package/dist/_cjs/modules/validators/ownable/index.js.map +1 -0
  205. package/dist/_cjs/modules/validators/ownable/toOwnableModule.js +16 -0
  206. package/dist/_cjs/modules/validators/ownable/toOwnableModule.js.map +1 -0
  207. package/dist/_cjs/modules/validators/smartSessionsValidator/Helpers.js +132 -0
  208. package/dist/_cjs/modules/validators/smartSessionsValidator/Helpers.js.map +1 -0
  209. package/dist/_cjs/modules/validators/smartSessionsValidator/Types.js +13 -0
  210. package/dist/_cjs/modules/validators/smartSessionsValidator/Types.js.map +1 -0
  211. package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/grantPermission.js +38 -0
  212. package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/grantPermission.js.map +1 -0
  213. package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/index.js +30 -0
  214. package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/index.js.map +1 -0
  215. package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/preparePermission.js +152 -0
  216. package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/preparePermission.js.map +1 -0
  217. package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/revokeSession.js +42 -0
  218. package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/revokeSession.js.map +1 -0
  219. package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/usePermission.js +16 -0
  220. package/dist/_cjs/modules/validators/smartSessionsValidator/decorators/usePermission.js.map +1 -0
  221. package/dist/_cjs/modules/validators/smartSessionsValidator/index.js +8 -0
  222. package/dist/_cjs/modules/validators/smartSessionsValidator/index.js.map +1 -0
  223. package/dist/_cjs/modules/validators/smartSessionsValidator/toSmartSessionsValidator.js +49 -0
  224. package/dist/_cjs/modules/validators/smartSessionsValidator/toSmartSessionsValidator.js.map +1 -0
  225. package/dist/_cjs/modules/validators/toValidator.js +21 -0
  226. package/dist/_cjs/modules/validators/toValidator.js.map +1 -0
  227. package/dist/_cjs/package.json +1 -0
  228. package/dist/_esm/account/decorators/getFactoryData.js +31 -0
  229. package/dist/_esm/account/decorators/getFactoryData.js.map +1 -0
  230. package/dist/_esm/account/decorators/getStartaleAccountAddress.js +31 -0
  231. package/dist/_esm/account/decorators/getStartaleAccountAddress.js.map +1 -0
  232. package/dist/_esm/account/decorators/index.js +3 -0
  233. package/dist/_esm/account/decorators/index.js.map +1 -0
  234. package/dist/_esm/account/index.js +3 -0
  235. package/dist/_esm/account/index.js.map +1 -0
  236. package/dist/_esm/account/toStartaleSmartAccount.js +403 -0
  237. package/dist/_esm/account/toStartaleSmartAccount.js.map +1 -0
  238. package/dist/_esm/account/utils/AccountNotFound.js +17 -0
  239. package/dist/_esm/account/utils/AccountNotFound.js.map +1 -0
  240. package/dist/_esm/account/utils/Constants.js +129 -0
  241. package/dist/_esm/account/utils/Constants.js.map +1 -0
  242. package/dist/_esm/account/utils/Helpers.js +45 -0
  243. package/dist/_esm/account/utils/Helpers.js.map +1 -0
  244. package/dist/_esm/account/utils/Logger.js +50 -0
  245. package/dist/_esm/account/utils/Logger.js.map +1 -0
  246. package/dist/_esm/account/utils/Types.js +2 -0
  247. package/dist/_esm/account/utils/Types.js.map +1 -0
  248. package/dist/_esm/account/utils/Utils.js +319 -0
  249. package/dist/_esm/account/utils/Utils.js.map +1 -0
  250. package/dist/_esm/account/utils/addressToEmptyAccount.js +21 -0
  251. package/dist/_esm/account/utils/addressToEmptyAccount.js.map +1 -0
  252. package/dist/_esm/account/utils/contractSimulation.js +48 -0
  253. package/dist/_esm/account/utils/contractSimulation.js.map +1 -0
  254. package/dist/_esm/account/utils/deepHexlify.js +63 -0
  255. package/dist/_esm/account/utils/deepHexlify.js.map +1 -0
  256. package/dist/_esm/account/utils/eip7702Utils.js +16 -0
  257. package/dist/_esm/account/utils/eip7702Utils.js.map +1 -0
  258. package/dist/_esm/account/utils/fromBundlerClient.js +67 -0
  259. package/dist/_esm/account/utils/fromBundlerClient.js.map +1 -0
  260. package/dist/_esm/account/utils/getAAError.js +34 -0
  261. package/dist/_esm/account/utils/getAAError.js.map +1 -0
  262. package/dist/_esm/account/utils/getChain.js +117 -0
  263. package/dist/_esm/account/utils/getChain.js.map +1 -0
  264. package/dist/_esm/account/utils/getVersion.js +163 -0
  265. package/dist/_esm/account/utils/getVersion.js.map +1 -0
  266. package/dist/_esm/account/utils/index.js +20 -0
  267. package/dist/_esm/account/utils/index.js.map +1 -0
  268. package/dist/_esm/account/utils/parseErrorMessage.js +89 -0
  269. package/dist/_esm/account/utils/parseErrorMessage.js.map +1 -0
  270. package/dist/_esm/account/utils/tenderlySimulation.js +47 -0
  271. package/dist/_esm/account/utils/tenderlySimulation.js.map +1 -0
  272. package/dist/_esm/account/utils/toInitData.js +14 -0
  273. package/dist/_esm/account/utils/toInitData.js.map +1 -0
  274. package/dist/_esm/account/utils/toInstallData.js +16 -0
  275. package/dist/_esm/account/utils/toInstallData.js.map +1 -0
  276. package/dist/_esm/account/utils/toSigner.js +91 -0
  277. package/dist/_esm/account/utils/toSigner.js.map +1 -0
  278. package/dist/_esm/clients/createHttpClient.js +47 -0
  279. package/dist/_esm/clients/createHttpClient.js.map +1 -0
  280. package/dist/_esm/clients/createSCSBundlerClient.js +96 -0
  281. package/dist/_esm/clients/createSCSBundlerClient.js.map +1 -0
  282. package/dist/_esm/clients/createSCSPaymasterClient.js +85 -0
  283. package/dist/_esm/clients/createSCSPaymasterClient.js.map +1 -0
  284. package/dist/_esm/clients/decorators/bundler/getGasFeeValues.js +77 -0
  285. package/dist/_esm/clients/decorators/bundler/getGasFeeValues.js.map +1 -0
  286. package/dist/_esm/clients/decorators/bundler/index.js +7 -0
  287. package/dist/_esm/clients/decorators/bundler/index.js.map +1 -0
  288. package/dist/_esm/clients/decorators/bundler/waitForUserOperationReceipt.js +8 -0
  289. package/dist/_esm/clients/decorators/bundler/waitForUserOperationReceipt.js.map +1 -0
  290. package/dist/_esm/clients/decorators/erc7579/accountId.js +77 -0
  291. package/dist/_esm/clients/decorators/erc7579/accountId.js.map +1 -0
  292. package/dist/_esm/clients/decorators/erc7579/getActiveHook.js +52 -0
  293. package/dist/_esm/clients/decorators/erc7579/getActiveHook.js.map +1 -0
  294. package/dist/_esm/clients/decorators/erc7579/getFallbackBySelector.js +67 -0
  295. package/dist/_esm/clients/decorators/erc7579/getFallbackBySelector.js.map +1 -0
  296. package/dist/_esm/clients/decorators/erc7579/getInstalledExecutors.js +74 -0
  297. package/dist/_esm/clients/decorators/erc7579/getInstalledExecutors.js.map +1 -0
  298. package/dist/_esm/clients/decorators/erc7579/getInstalledValidators.js +72 -0
  299. package/dist/_esm/clients/decorators/erc7579/getInstalledValidators.js.map +1 -0
  300. package/dist/_esm/clients/decorators/erc7579/getPreviousModule.js +54 -0
  301. package/dist/_esm/clients/decorators/erc7579/getPreviousModule.js.map +1 -0
  302. package/dist/_esm/clients/decorators/erc7579/index.js +48 -0
  303. package/dist/_esm/clients/decorators/erc7579/index.js.map +1 -0
  304. package/dist/_esm/clients/decorators/erc7579/installModule.js +115 -0
  305. package/dist/_esm/clients/decorators/erc7579/installModule.js.map +1 -0
  306. package/dist/_esm/clients/decorators/erc7579/installModules.js +41 -0
  307. package/dist/_esm/clients/decorators/erc7579/installModules.js.map +1 -0
  308. package/dist/_esm/clients/decorators/erc7579/isModuleInstalled.js +106 -0
  309. package/dist/_esm/clients/decorators/erc7579/isModuleInstalled.js.map +1 -0
  310. package/dist/_esm/clients/decorators/erc7579/supportsExecutionMode.js +120 -0
  311. package/dist/_esm/clients/decorators/erc7579/supportsExecutionMode.js.map +1 -0
  312. package/dist/_esm/clients/decorators/erc7579/supportsModule.js +108 -0
  313. package/dist/_esm/clients/decorators/erc7579/supportsModule.js.map +1 -0
  314. package/dist/_esm/clients/decorators/erc7579/uninstallFallback.js +76 -0
  315. package/dist/_esm/clients/decorators/erc7579/uninstallFallback.js.map +1 -0
  316. package/dist/_esm/clients/decorators/erc7579/uninstallModule.js +94 -0
  317. package/dist/_esm/clients/decorators/erc7579/uninstallModule.js.map +1 -0
  318. package/dist/_esm/clients/decorators/erc7579/uninstallModules.js +42 -0
  319. package/dist/_esm/clients/decorators/erc7579/uninstallModules.js.map +1 -0
  320. package/dist/_esm/clients/decorators/index.js +5 -0
  321. package/dist/_esm/clients/decorators/index.js.map +1 -0
  322. package/dist/_esm/clients/decorators/smartAccount/debugUserOperation.js +105 -0
  323. package/dist/_esm/clients/decorators/smartAccount/debugUserOperation.js.map +1 -0
  324. package/dist/_esm/clients/decorators/smartAccount/index.js +28 -0
  325. package/dist/_esm/clients/decorators/smartAccount/index.js.map +1 -0
  326. package/dist/_esm/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.js +60 -0
  327. package/dist/_esm/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.js.map +1 -0
  328. package/dist/_esm/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.js +36 -0
  329. package/dist/_esm/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.js.map +1 -0
  330. package/dist/_esm/clients/decorators/smartAccount/sendTokenPaymasterUserOp.js +43 -0
  331. package/dist/_esm/clients/decorators/smartAccount/sendTokenPaymasterUserOp.js.map +1 -0
  332. package/dist/_esm/clients/decorators/smartAccount/sendTransaction.js +57 -0
  333. package/dist/_esm/clients/decorators/smartAccount/sendTransaction.js.map +1 -0
  334. package/dist/_esm/clients/decorators/smartAccount/signMessage.js +30 -0
  335. package/dist/_esm/clients/decorators/smartAccount/signMessage.js.map +1 -0
  336. package/dist/_esm/clients/decorators/smartAccount/signTypedData.js +82 -0
  337. package/dist/_esm/clients/decorators/smartAccount/signTypedData.js.map +1 -0
  338. package/dist/_esm/clients/decorators/smartAccount/upgradeSmartAccount.js +75 -0
  339. package/dist/_esm/clients/decorators/smartAccount/upgradeSmartAccount.js.map +1 -0
  340. package/dist/_esm/clients/decorators/smartAccount/waitForTransactionReceipt.js +14 -0
  341. package/dist/_esm/clients/decorators/smartAccount/waitForTransactionReceipt.js.map +1 -0
  342. package/dist/_esm/clients/decorators/smartAccount/writeContract.js +40 -0
  343. package/dist/_esm/clients/decorators/smartAccount/writeContract.js.map +1 -0
  344. package/dist/_esm/clients/decorators/tokenPaymaster/getSupportedTokens.js +35 -0
  345. package/dist/_esm/clients/decorators/tokenPaymaster/getSupportedTokens.js.map +1 -0
  346. package/dist/_esm/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.js +120 -0
  347. package/dist/_esm/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.js.map +1 -0
  348. package/dist/_esm/clients/decorators/tokenPaymaster/index.js +63 -0
  349. package/dist/_esm/clients/decorators/tokenPaymaster/index.js.map +1 -0
  350. package/dist/_esm/clients/index.js +5 -0
  351. package/dist/_esm/clients/index.js.map +1 -0
  352. package/dist/_esm/constants/abi/AccountFactory.js +334 -0
  353. package/dist/_esm/constants/abi/AccountFactory.js.map +1 -0
  354. package/dist/_esm/constants/abi/AccountImplementationAbi.js +1176 -0
  355. package/dist/_esm/constants/abi/AccountImplementationAbi.js.map +1 -0
  356. package/dist/_esm/constants/abi/BootstrapAbi.js +727 -0
  357. package/dist/_esm/constants/abi/BootstrapAbi.js.map +1 -0
  358. package/dist/_esm/constants/abi/ComposabilityAbi.js +271 -0
  359. package/dist/_esm/constants/abi/ComposabilityAbi.js.map +1 -0
  360. package/dist/_esm/constants/abi/EIP1271Abi.js +28 -0
  361. package/dist/_esm/constants/abi/EIP1271Abi.js.map +1 -0
  362. package/dist/_esm/constants/abi/ERC7484RegistryAbi.js +14 -0
  363. package/dist/_esm/constants/abi/ERC7484RegistryAbi.js.map +1 -0
  364. package/dist/_esm/constants/abi/EntryPointABI.js +658 -0
  365. package/dist/_esm/constants/abi/EntryPointABI.js.map +1 -0
  366. package/dist/_esm/constants/abi/SmartSessionAbi.js +1469 -0
  367. package/dist/_esm/constants/abi/SmartSessionAbi.js.map +1 -0
  368. package/dist/_esm/constants/abi/TokenWithPermitAbi.js +619 -0
  369. package/dist/_esm/constants/abi/TokenWithPermitAbi.js.map +1 -0
  370. package/dist/_esm/constants/abi/UniActionPolicyAbi.js +59 -0
  371. package/dist/_esm/constants/abi/UniActionPolicyAbi.js.map +1 -0
  372. package/dist/_esm/constants/abi/UniswapSwapRouterAbi.js +483 -0
  373. package/dist/_esm/constants/abi/UniswapSwapRouterAbi.js.map +1 -0
  374. package/dist/_esm/constants/abi/index.js +11 -0
  375. package/dist/_esm/constants/abi/index.js.map +1 -0
  376. package/dist/_esm/constants/index.js +38 -0
  377. package/dist/_esm/constants/index.js.map +1 -0
  378. package/dist/_esm/index.js +12 -0
  379. package/dist/_esm/index.js.map +1 -0
  380. package/dist/_esm/modules/index.js +6 -0
  381. package/dist/_esm/modules/index.js.map +1 -0
  382. package/dist/_esm/modules/toEmptyExecutor.js +6 -0
  383. package/dist/_esm/modules/toEmptyExecutor.js.map +1 -0
  384. package/dist/_esm/modules/toEmptyHook.js +6 -0
  385. package/dist/_esm/modules/toEmptyHook.js.map +1 -0
  386. package/dist/_esm/modules/utils/Helpers.js +81 -0
  387. package/dist/_esm/modules/utils/Helpers.js.map +1 -0
  388. package/dist/_esm/modules/utils/Types.js +12 -0
  389. package/dist/_esm/modules/utils/Types.js.map +1 -0
  390. package/dist/_esm/modules/utils/Uid.js +11 -0
  391. package/dist/_esm/modules/utils/Uid.js.map +1 -0
  392. package/dist/_esm/modules/utils/composabilityCalls.js +127 -0
  393. package/dist/_esm/modules/utils/composabilityCalls.js.map +1 -0
  394. package/dist/_esm/modules/utils/index.js +6 -0
  395. package/dist/_esm/modules/utils/index.js.map +1 -0
  396. package/dist/_esm/modules/utils/runtimeAbiEncoding.js +365 -0
  397. package/dist/_esm/modules/utils/runtimeAbiEncoding.js.map +1 -0
  398. package/dist/_esm/modules/utils/toModule.js +61 -0
  399. package/dist/_esm/modules/utils/toModule.js.map +1 -0
  400. package/dist/_esm/modules/validators/default/index.js +2 -0
  401. package/dist/_esm/modules/validators/default/index.js.map +1 -0
  402. package/dist/_esm/modules/validators/default/toDefaultModule.js +14 -0
  403. package/dist/_esm/modules/validators/default/toDefaultModule.js.map +1 -0
  404. package/dist/_esm/modules/validators/index.js +6 -0
  405. package/dist/_esm/modules/validators/index.js.map +1 -0
  406. package/dist/_esm/modules/validators/ownable/decorators/addOwner.js +56 -0
  407. package/dist/_esm/modules/validators/ownable/decorators/addOwner.js.map +1 -0
  408. package/dist/_esm/modules/validators/ownable/decorators/getAddOwnerTx.js +50 -0
  409. package/dist/_esm/modules/validators/ownable/decorators/getAddOwnerTx.js.map +1 -0
  410. package/dist/_esm/modules/validators/ownable/decorators/getOwners.js +38 -0
  411. package/dist/_esm/modules/validators/ownable/decorators/getOwners.js.map +1 -0
  412. package/dist/_esm/modules/validators/ownable/decorators/getRemoveOwnerTx.js +50 -0
  413. package/dist/_esm/modules/validators/ownable/decorators/getRemoveOwnerTx.js.map +1 -0
  414. package/dist/_esm/modules/validators/ownable/decorators/getSetThresholdTx.js +48 -0
  415. package/dist/_esm/modules/validators/ownable/decorators/getSetThresholdTx.js.map +1 -0
  416. package/dist/_esm/modules/validators/ownable/decorators/getThreshold.js +54 -0
  417. package/dist/_esm/modules/validators/ownable/decorators/getThreshold.js.map +1 -0
  418. package/dist/_esm/modules/validators/ownable/decorators/index.js +57 -0
  419. package/dist/_esm/modules/validators/ownable/decorators/index.js.map +1 -0
  420. package/dist/_esm/modules/validators/ownable/decorators/multiSign.js +22 -0
  421. package/dist/_esm/modules/validators/ownable/decorators/multiSign.js.map +1 -0
  422. package/dist/_esm/modules/validators/ownable/decorators/prepareForMultiSign.js +21 -0
  423. package/dist/_esm/modules/validators/ownable/decorators/prepareForMultiSign.js.map +1 -0
  424. package/dist/_esm/modules/validators/ownable/decorators/removeOwner.js +66 -0
  425. package/dist/_esm/modules/validators/ownable/decorators/removeOwner.js.map +1 -0
  426. package/dist/_esm/modules/validators/ownable/decorators/setThreshold.js +62 -0
  427. package/dist/_esm/modules/validators/ownable/decorators/setThreshold.js.map +1 -0
  428. package/dist/_esm/modules/validators/ownable/index.js +3 -0
  429. package/dist/_esm/modules/validators/ownable/index.js.map +1 -0
  430. package/dist/_esm/modules/validators/ownable/toOwnableModule.js +38 -0
  431. package/dist/_esm/modules/validators/ownable/toOwnableModule.js.map +1 -0
  432. package/dist/_esm/modules/validators/smartSessionsValidator/Helpers.js +181 -0
  433. package/dist/_esm/modules/validators/smartSessionsValidator/Helpers.js.map +1 -0
  434. package/dist/_esm/modules/validators/smartSessionsValidator/Types.js +13 -0
  435. package/dist/_esm/modules/validators/smartSessionsValidator/Types.js.map +1 -0
  436. package/dist/_esm/modules/validators/smartSessionsValidator/decorators/grantPermission.js +80 -0
  437. package/dist/_esm/modules/validators/smartSessionsValidator/decorators/grantPermission.js.map +1 -0
  438. package/dist/_esm/modules/validators/smartSessionsValidator/decorators/index.js +37 -0
  439. package/dist/_esm/modules/validators/smartSessionsValidator/decorators/index.js.map +1 -0
  440. package/dist/_esm/modules/validators/smartSessionsValidator/decorators/preparePermission.js +214 -0
  441. package/dist/_esm/modules/validators/smartSessionsValidator/decorators/preparePermission.js.map +1 -0
  442. package/dist/_esm/modules/validators/smartSessionsValidator/decorators/revokeSession.js +67 -0
  443. package/dist/_esm/modules/validators/smartSessionsValidator/decorators/revokeSession.js.map +1 -0
  444. package/dist/_esm/modules/validators/smartSessionsValidator/decorators/usePermission.js +47 -0
  445. package/dist/_esm/modules/validators/smartSessionsValidator/decorators/usePermission.js.map +1 -0
  446. package/dist/_esm/modules/validators/smartSessionsValidator/index.js +5 -0
  447. package/dist/_esm/modules/validators/smartSessionsValidator/index.js.map +1 -0
  448. package/dist/_esm/modules/validators/smartSessionsValidator/toSmartSessionsValidator.js +82 -0
  449. package/dist/_esm/modules/validators/smartSessionsValidator/toSmartSessionsValidator.js.map +1 -0
  450. package/dist/_esm/modules/validators/toValidator.js +17 -0
  451. package/dist/_esm/modules/validators/toValidator.js.map +1 -0
  452. package/dist/_esm/package.json +1 -0
  453. package/dist/_types/account/decorators/getFactoryData.d.ts +25 -0
  454. package/dist/_types/account/decorators/getFactoryData.d.ts.map +1 -0
  455. package/dist/_types/account/decorators/getStartaleAccountAddress.d.ts +33 -0
  456. package/dist/_types/account/decorators/getStartaleAccountAddress.d.ts.map +1 -0
  457. package/dist/_types/account/decorators/index.d.ts +3 -0
  458. package/dist/_types/account/decorators/index.d.ts.map +1 -0
  459. package/dist/_types/account/index.d.ts +3 -0
  460. package/dist/_types/account/index.d.ts.map +1 -0
  461. package/dist/_types/account/toStartaleSmartAccount.d.ts +120 -0
  462. package/dist/_types/account/toStartaleSmartAccount.d.ts.map +1 -0
  463. package/dist/_types/account/utils/AccountNotFound.d.ts +10 -0
  464. package/dist/_types/account/utils/AccountNotFound.d.ts.map +1 -0
  465. package/dist/_types/account/utils/Constants.d.ts +73 -0
  466. package/dist/_types/account/utils/Constants.d.ts.map +1 -0
  467. package/dist/_types/account/utils/Helpers.d.ts +21 -0
  468. package/dist/_types/account/utils/Helpers.d.ts.map +1 -0
  469. package/dist/_types/account/utils/Logger.d.ts +20 -0
  470. package/dist/_types/account/utils/Logger.d.ts.map +1 -0
  471. package/dist/_types/account/utils/Types.d.ts +94 -0
  472. package/dist/_types/account/utils/Types.d.ts.map +1 -0
  473. package/dist/_types/account/utils/Utils.d.ts +129 -0
  474. package/dist/_types/account/utils/Utils.d.ts.map +1 -0
  475. package/dist/_types/account/utils/addressToEmptyAccount.d.ts +4 -0
  476. package/dist/_types/account/utils/addressToEmptyAccount.d.ts.map +1 -0
  477. package/dist/_types/account/utils/contractSimulation.d.ts +801 -0
  478. package/dist/_types/account/utils/contractSimulation.d.ts.map +1 -0
  479. package/dist/_types/account/utils/deepHexlify.d.ts +41 -0
  480. package/dist/_types/account/utils/deepHexlify.d.ts.map +1 -0
  481. package/dist/_types/account/utils/eip7702Utils.d.ts +4 -0
  482. package/dist/_types/account/utils/eip7702Utils.d.ts.map +1 -0
  483. package/dist/_types/account/utils/fromBundlerClient.d.ts +50 -0
  484. package/dist/_types/account/utils/fromBundlerClient.d.ts.map +1 -0
  485. package/dist/_types/account/utils/getAAError.d.ts +17 -0
  486. package/dist/_types/account/utils/getAAError.d.ts.map +1 -0
  487. package/dist/_types/account/utils/getChain.d.ts +64 -0
  488. package/dist/_types/account/utils/getChain.d.ts.map +1 -0
  489. package/dist/_types/account/utils/getVersion.d.ts +135 -0
  490. package/dist/_types/account/utils/getVersion.d.ts.map +1 -0
  491. package/dist/_types/account/utils/index.d.ts +20 -0
  492. package/dist/_types/account/utils/index.d.ts.map +1 -0
  493. package/dist/_types/account/utils/parseErrorMessage.d.ts +2 -0
  494. package/dist/_types/account/utils/parseErrorMessage.d.ts.map +1 -0
  495. package/dist/_types/account/utils/tenderlySimulation.d.ts +13 -0
  496. package/dist/_types/account/utils/tenderlySimulation.d.ts.map +1 -0
  497. package/dist/_types/account/utils/toInitData.d.ts +12 -0
  498. package/dist/_types/account/utils/toInitData.d.ts.map +1 -0
  499. package/dist/_types/account/utils/toInstallData.d.ts +8 -0
  500. package/dist/_types/account/utils/toInstallData.d.ts.map +1 -0
  501. package/dist/_types/account/utils/toSigner.d.ts +26 -0
  502. package/dist/_types/account/utils/toSigner.d.ts.map +1 -0
  503. package/dist/_types/clients/createHttpClient.d.ts +44 -0
  504. package/dist/_types/clients/createHttpClient.d.ts.map +1 -0
  505. package/dist/_types/clients/createSCSBundlerClient.d.ts +66 -0
  506. package/dist/_types/clients/createSCSBundlerClient.d.ts.map +1 -0
  507. package/dist/_types/clients/createSCSPaymasterClient.d.ts +70 -0
  508. package/dist/_types/clients/createSCSPaymasterClient.d.ts.map +1 -0
  509. package/dist/_types/clients/decorators/bundler/getGasFeeValues.d.ts +51 -0
  510. package/dist/_types/clients/decorators/bundler/getGasFeeValues.d.ts.map +1 -0
  511. package/dist/_types/clients/decorators/bundler/index.d.ts +43 -0
  512. package/dist/_types/clients/decorators/bundler/index.d.ts.map +1 -0
  513. package/dist/_types/clients/decorators/bundler/waitForUserOperationReceipt.d.ts +5 -0
  514. package/dist/_types/clients/decorators/bundler/waitForUserOperationReceipt.d.ts.map +1 -0
  515. package/dist/_types/clients/decorators/erc7579/accountId.d.ts +21 -0
  516. package/dist/_types/clients/decorators/erc7579/accountId.d.ts.map +1 -0
  517. package/dist/_types/clients/decorators/erc7579/getActiveHook.d.ts +35 -0
  518. package/dist/_types/clients/decorators/erc7579/getActiveHook.d.ts.map +1 -0
  519. package/dist/_types/clients/decorators/erc7579/getFallbackBySelector.d.ts +43 -0
  520. package/dist/_types/clients/decorators/erc7579/getFallbackBySelector.d.ts.map +1 -0
  521. package/dist/_types/clients/decorators/erc7579/getInstalledExecutors.d.ts +52 -0
  522. package/dist/_types/clients/decorators/erc7579/getInstalledExecutors.d.ts.map +1 -0
  523. package/dist/_types/clients/decorators/erc7579/getInstalledValidators.d.ts +52 -0
  524. package/dist/_types/clients/decorators/erc7579/getInstalledValidators.d.ts.map +1 -0
  525. package/dist/_types/clients/decorators/erc7579/getPreviousModule.d.ts +32 -0
  526. package/dist/_types/clients/decorators/erc7579/getPreviousModule.d.ts.map +1 -0
  527. package/dist/_types/clients/decorators/erc7579/index.d.ts +165 -0
  528. package/dist/_types/clients/decorators/erc7579/index.d.ts.map +1 -0
  529. package/dist/_types/clients/decorators/erc7579/installModule.d.ts +36 -0
  530. package/dist/_types/clients/decorators/erc7579/installModule.d.ts.map +1 -0
  531. package/dist/_types/clients/decorators/erc7579/installModules.d.ts +36 -0
  532. package/dist/_types/clients/decorators/erc7579/installModules.d.ts.map +1 -0
  533. package/dist/_types/clients/decorators/erc7579/isModuleInstalled.d.ts +54 -0
  534. package/dist/_types/clients/decorators/erc7579/isModuleInstalled.d.ts.map +1 -0
  535. package/dist/_types/clients/decorators/erc7579/supportsExecutionMode.d.ts +54 -0
  536. package/dist/_types/clients/decorators/erc7579/supportsExecutionMode.d.ts.map +1 -0
  537. package/dist/_types/clients/decorators/erc7579/supportsModule.d.ts +48 -0
  538. package/dist/_types/clients/decorators/erc7579/supportsModule.d.ts.map +1 -0
  539. package/dist/_types/clients/decorators/erc7579/uninstallFallback.d.ts +35 -0
  540. package/dist/_types/clients/decorators/erc7579/uninstallFallback.d.ts.map +1 -0
  541. package/dist/_types/clients/decorators/erc7579/uninstallModule.d.ts +35 -0
  542. package/dist/_types/clients/decorators/erc7579/uninstallModule.d.ts.map +1 -0
  543. package/dist/_types/clients/decorators/erc7579/uninstallModules.d.ts +32 -0
  544. package/dist/_types/clients/decorators/erc7579/uninstallModules.d.ts.map +1 -0
  545. package/dist/_types/clients/decorators/index.d.ts +5 -0
  546. package/dist/_types/clients/decorators/index.d.ts.map +1 -0
  547. package/dist/_types/clients/decorators/smartAccount/debugUserOperation.d.ts +35 -0
  548. package/dist/_types/clients/decorators/smartAccount/debugUserOperation.d.ts.map +1 -0
  549. package/dist/_types/clients/decorators/smartAccount/index.d.ts +315 -0
  550. package/dist/_types/clients/decorators/smartAccount/index.d.ts.map +1 -0
  551. package/dist/_types/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.d.ts +52 -0
  552. package/dist/_types/clients/decorators/smartAccount/prepareTokenPaymasterUserOp.d.ts.map +1 -0
  553. package/dist/_types/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.d.ts +16 -0
  554. package/dist/_types/clients/decorators/smartAccount/prepareUserOperationWithoutSignature.d.ts.map +1 -0
  555. package/dist/_types/clients/decorators/smartAccount/sendTokenPaymasterUserOp.d.ts +36 -0
  556. package/dist/_types/clients/decorators/smartAccount/sendTokenPaymasterUserOp.d.ts.map +1 -0
  557. package/dist/_types/clients/decorators/smartAccount/sendTransaction.d.ts +23 -0
  558. package/dist/_types/clients/decorators/smartAccount/sendTransaction.d.ts.map +1 -0
  559. package/dist/_types/clients/decorators/smartAccount/signMessage.d.ts +23 -0
  560. package/dist/_types/clients/decorators/smartAccount/signMessage.d.ts.map +1 -0
  561. package/dist/_types/clients/decorators/smartAccount/signTypedData.d.ts +60 -0
  562. package/dist/_types/clients/decorators/smartAccount/signTypedData.d.ts.map +1 -0
  563. package/dist/_types/clients/decorators/smartAccount/upgradeSmartAccount.d.ts +40 -0
  564. package/dist/_types/clients/decorators/smartAccount/upgradeSmartAccount.d.ts.map +1 -0
  565. package/dist/_types/clients/decorators/smartAccount/waitForTransactionReceipt.d.ts +6 -0
  566. package/dist/_types/clients/decorators/smartAccount/waitForTransactionReceipt.d.ts.map +1 -0
  567. package/dist/_types/clients/decorators/smartAccount/writeContract.d.ts +27 -0
  568. package/dist/_types/clients/decorators/smartAccount/writeContract.d.ts.map +1 -0
  569. package/dist/_types/clients/decorators/tokenPaymaster/getSupportedTokens.d.ts +16 -0
  570. package/dist/_types/clients/decorators/tokenPaymaster/getSupportedTokens.d.ts.map +1 -0
  571. package/dist/_types/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.d.ts +93 -0
  572. package/dist/_types/clients/decorators/tokenPaymaster/getTokenPaymasterQuotes.d.ts.map +1 -0
  573. package/dist/_types/clients/decorators/tokenPaymaster/index.d.ts +65 -0
  574. package/dist/_types/clients/decorators/tokenPaymaster/index.d.ts.map +1 -0
  575. package/dist/_types/clients/index.d.ts +5 -0
  576. package/dist/_types/clients/index.d.ts.map +1 -0
  577. package/dist/_types/constants/abi/AccountFactory.d.ts +259 -0
  578. package/dist/_types/constants/abi/AccountFactory.d.ts.map +1 -0
  579. package/dist/_types/constants/abi/AccountImplementationAbi.d.ts +903 -0
  580. package/dist/_types/constants/abi/AccountImplementationAbi.d.ts.map +1 -0
  581. package/dist/_types/constants/abi/BootstrapAbi.d.ts +554 -0
  582. package/dist/_types/constants/abi/BootstrapAbi.d.ts.map +1 -0
  583. package/dist/_types/constants/abi/ComposabilityAbi.d.ts +67 -0
  584. package/dist/_types/constants/abi/ComposabilityAbi.d.ts.map +1 -0
  585. package/dist/_types/constants/abi/EIP1271Abi.d.ts +54 -0
  586. package/dist/_types/constants/abi/EIP1271Abi.d.ts.map +1 -0
  587. package/dist/_types/constants/abi/ERC7484RegistryAbi.d.ts +16 -0
  588. package/dist/_types/constants/abi/ERC7484RegistryAbi.d.ts.map +1 -0
  589. package/dist/_types/constants/abi/EntryPointABI.d.ts +776 -0
  590. package/dist/_types/constants/abi/EntryPointABI.d.ts.map +1 -0
  591. package/dist/_types/constants/abi/SmartSessionAbi.d.ts +90 -0
  592. package/dist/_types/constants/abi/SmartSessionAbi.d.ts.map +1 -0
  593. package/dist/_types/constants/abi/TokenWithPermitAbi.d.ts +477 -0
  594. package/dist/_types/constants/abi/TokenWithPermitAbi.d.ts.map +1 -0
  595. package/dist/_types/constants/abi/UniActionPolicyAbi.d.ts +33 -0
  596. package/dist/_types/constants/abi/UniActionPolicyAbi.d.ts.map +1 -0
  597. package/dist/_types/constants/abi/UniswapSwapRouterAbi.d.ts +821 -0
  598. package/dist/_types/constants/abi/UniswapSwapRouterAbi.d.ts.map +1 -0
  599. package/dist/_types/constants/abi/index.d.ts +11 -0
  600. package/dist/_types/constants/abi/index.d.ts.map +1 -0
  601. package/dist/_types/constants/index.d.ts +20 -0
  602. package/dist/_types/constants/index.d.ts.map +1 -0
  603. package/dist/_types/index.d.ts +7 -0
  604. package/dist/_types/index.d.ts.map +1 -0
  605. package/dist/_types/modules/index.d.ts +6 -0
  606. package/dist/_types/modules/index.d.ts.map +1 -0
  607. package/dist/_types/modules/toEmptyExecutor.d.ts +3 -0
  608. package/dist/_types/modules/toEmptyExecutor.d.ts.map +1 -0
  609. package/dist/_types/modules/toEmptyHook.d.ts +3 -0
  610. package/dist/_types/modules/toEmptyHook.d.ts.map +1 -0
  611. package/dist/_types/modules/utils/Helpers.d.ts +48 -0
  612. package/dist/_types/modules/utils/Helpers.d.ts.map +1 -0
  613. package/dist/_types/modules/utils/Types.d.ts +103 -0
  614. package/dist/_types/modules/utils/Types.d.ts.map +1 -0
  615. package/dist/_types/modules/utils/Uid.d.ts +2 -0
  616. package/dist/_types/modules/utils/Uid.d.ts.map +1 -0
  617. package/dist/_types/modules/utils/composabilityCalls.d.ts +63 -0
  618. package/dist/_types/modules/utils/composabilityCalls.d.ts.map +1 -0
  619. package/dist/_types/modules/utils/index.d.ts +6 -0
  620. package/dist/_types/modules/utils/index.d.ts.map +1 -0
  621. package/dist/_types/modules/utils/runtimeAbiEncoding.d.ts +18 -0
  622. package/dist/_types/modules/utils/runtimeAbiEncoding.d.ts.map +1 -0
  623. package/dist/_types/modules/utils/toModule.d.ts +28 -0
  624. package/dist/_types/modules/utils/toModule.d.ts.map +1 -0
  625. package/dist/_types/modules/validators/default/index.d.ts +2 -0
  626. package/dist/_types/modules/validators/default/index.d.ts.map +1 -0
  627. package/dist/_types/modules/validators/default/toDefaultModule.d.ts +3 -0
  628. package/dist/_types/modules/validators/default/toDefaultModule.d.ts.map +1 -0
  629. package/dist/_types/modules/validators/index.d.ts +6 -0
  630. package/dist/_types/modules/validators/index.d.ts.map +1 -0
  631. package/dist/_types/modules/validators/ownable/decorators/addOwner.d.ts +36 -0
  632. package/dist/_types/modules/validators/ownable/decorators/addOwner.d.ts.map +1 -0
  633. package/dist/_types/modules/validators/ownable/decorators/getAddOwnerTx.d.ts +30 -0
  634. package/dist/_types/modules/validators/ownable/decorators/getAddOwnerTx.d.ts.map +1 -0
  635. package/dist/_types/modules/validators/ownable/decorators/getOwners.d.ts +25 -0
  636. package/dist/_types/modules/validators/ownable/decorators/getOwners.d.ts.map +1 -0
  637. package/dist/_types/modules/validators/ownable/decorators/getRemoveOwnerTx.d.ts +30 -0
  638. package/dist/_types/modules/validators/ownable/decorators/getRemoveOwnerTx.d.ts.map +1 -0
  639. package/dist/_types/modules/validators/ownable/decorators/getSetThresholdTx.d.ts +39 -0
  640. package/dist/_types/modules/validators/ownable/decorators/getSetThresholdTx.d.ts.map +1 -0
  641. package/dist/_types/modules/validators/ownable/decorators/getThreshold.d.ts +40 -0
  642. package/dist/_types/modules/validators/ownable/decorators/getThreshold.d.ts.map +1 -0
  643. package/dist/_types/modules/validators/ownable/decorators/index.d.ts +37 -0
  644. package/dist/_types/modules/validators/ownable/decorators/index.d.ts.map +1 -0
  645. package/dist/_types/modules/validators/ownable/decorators/multiSign.d.ts +11 -0
  646. package/dist/_types/modules/validators/ownable/decorators/multiSign.d.ts.map +1 -0
  647. package/dist/_types/modules/validators/ownable/decorators/prepareForMultiSign.d.ts +25 -0
  648. package/dist/_types/modules/validators/ownable/decorators/prepareForMultiSign.d.ts.map +1 -0
  649. package/dist/_types/modules/validators/ownable/decorators/removeOwner.d.ts +47 -0
  650. package/dist/_types/modules/validators/ownable/decorators/removeOwner.d.ts.map +1 -0
  651. package/dist/_types/modules/validators/ownable/decorators/setThreshold.d.ts +51 -0
  652. package/dist/_types/modules/validators/ownable/decorators/setThreshold.d.ts.map +1 -0
  653. package/dist/_types/modules/validators/ownable/index.d.ts +3 -0
  654. package/dist/_types/modules/validators/ownable/index.d.ts.map +1 -0
  655. package/dist/_types/modules/validators/ownable/toOwnableModule.d.ts +44 -0
  656. package/dist/_types/modules/validators/ownable/toOwnableModule.d.ts.map +1 -0
  657. package/dist/_types/modules/validators/smartSessionsValidator/Helpers.d.ts +98 -0
  658. package/dist/_types/modules/validators/smartSessionsValidator/Helpers.d.ts.map +1 -0
  659. package/dist/_types/modules/validators/smartSessionsValidator/Types.d.ts +262 -0
  660. package/dist/_types/modules/validators/smartSessionsValidator/Types.d.ts.map +1 -0
  661. package/dist/_types/modules/validators/smartSessionsValidator/decorators/grantPermission.d.ts +73 -0
  662. package/dist/_types/modules/validators/smartSessionsValidator/decorators/grantPermission.d.ts.map +1 -0
  663. package/dist/_types/modules/validators/smartSessionsValidator/decorators/index.d.ts +79 -0
  664. package/dist/_types/modules/validators/smartSessionsValidator/decorators/index.d.ts.map +1 -0
  665. package/dist/_types/modules/validators/smartSessionsValidator/decorators/preparePermission.d.ts +81 -0
  666. package/dist/_types/modules/validators/smartSessionsValidator/decorators/preparePermission.d.ts.map +1 -0
  667. package/dist/_types/modules/validators/smartSessionsValidator/decorators/revokeSession.d.ts +55 -0
  668. package/dist/_types/modules/validators/smartSessionsValidator/decorators/revokeSession.d.ts.map +1 -0
  669. package/dist/_types/modules/validators/smartSessionsValidator/decorators/usePermission.d.ts +63 -0
  670. package/dist/_types/modules/validators/smartSessionsValidator/decorators/usePermission.d.ts.map +1 -0
  671. package/dist/_types/modules/validators/smartSessionsValidator/index.d.ts +5 -0
  672. package/dist/_types/modules/validators/smartSessionsValidator/index.d.ts.map +1 -0
  673. package/dist/_types/modules/validators/smartSessionsValidator/toSmartSessionsValidator.d.ts +65 -0
  674. package/dist/_types/modules/validators/smartSessionsValidator/toSmartSessionsValidator.d.ts.map +1 -0
  675. package/dist/_types/modules/validators/toValidator.d.ts +45 -0
  676. package/dist/_types/modules/validators/toValidator.d.ts.map +1 -0
  677. package/package.json +134 -0
@@ -0,0 +1,181 @@
1
+ import { getAddress, toBytes, toFunctionSelector, toHex } from "viem";
2
+ import { OWNABLE_VALIDATOR_ADDRESS, REGISTRY_ADDRESS, encodeValidationData } from "../../../constants/index.js";
3
+ import { ERC7484RegistryAbi } from "../../../constants/abi/index.js";
4
+ import { parseReferenceValue } from "../../utils/Helpers.js";
5
+ import { ONE_YEAR_FROM_NOW_IN_SECONDS } from "./decorators/preparePermission.js";
6
+ export const MAX_RULES = 16;
7
+ export const DUMMY_SIGNATURE = "0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b";
8
+ /**
9
+ * Generates a random salt as a hexadecimal string.
10
+ *
11
+ * @returns A 32-byte hexadecimal string prefixed with '0x'.
12
+ */
13
+ export const generateSalt = () => {
14
+ const randomBytes = new Uint8Array(32);
15
+ crypto.getRandomValues(randomBytes);
16
+ return `0x${Array.from(randomBytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
17
+ };
18
+ /**
19
+ * Creates an ActionConfig object from rules and a value limit.
20
+ *
21
+ * @param rules - An array of Rule objects.
22
+ * @param valueLimit - The maximum value allowed for the action.
23
+ * @returns An ActionConfig object.
24
+ */
25
+ export const createActionConfig = (rules, valueLimit = 0n) => ({
26
+ paramRules: {
27
+ length: rules.length,
28
+ rules: rules
29
+ },
30
+ valueLimitPerUse: valueLimit
31
+ });
32
+ /**
33
+ * Applies default values to a CreateSessionDataParams object.
34
+ *
35
+ * @param sessionInfo - The CreateSessionDataParams object to apply defaults to.
36
+ * @returns A FullCreateSessionDataParams object with default values applied.
37
+ */
38
+ export const applyDefaults = (sessionInfo) => {
39
+ const sessionKeyData = sessionInfo.sessionKeyData ?? toHex(toBytes(sessionInfo.sessionPublicKey));
40
+ const sessionPublicKey = sessionInfo.sessionPublicKey ?? sessionKeyData;
41
+ return {
42
+ ...sessionInfo,
43
+ sessionKeyData,
44
+ sessionPublicKey,
45
+ sessionValidUntil: sessionInfo.sessionValidUntil ?? ONE_YEAR_FROM_NOW_IN_SECONDS,
46
+ sessionValidAfter: sessionInfo.sessionValidAfter ?? 0,
47
+ sessionValidator: sessionInfo.sessionValidator ?? OWNABLE_VALIDATOR_ADDRESS,
48
+ sessionValidatorInitData: sessionInfo.sessionValidatorInitData ??
49
+ encodeValidationData({
50
+ threshold: 1,
51
+ owners: [getAddress(sessionPublicKey)]
52
+ })
53
+ };
54
+ };
55
+ /**
56
+ * Creates an ActionData object.
57
+ *
58
+ * @param contractAddress - The address of the contract.
59
+ * @param functionSelector - The function selector or AbiFunction.
60
+ * @param policies - An array of PolicyData objects.
61
+ * @returns An ActionData object.
62
+ */
63
+ export const createActionData = (contractAddress, functionSelector, policies) => {
64
+ return {
65
+ actionTarget: contractAddress,
66
+ actionTargetSelector: (typeof functionSelector === "string"
67
+ ? functionSelector
68
+ : functionSelector.name),
69
+ actionPolicies: policies
70
+ };
71
+ };
72
+ /**
73
+ * Converts an ActionConfig to a RawActionConfig.
74
+ *
75
+ * @param config - The ActionConfig to convert.
76
+ * @returns A ActionConfigFromUpstream object.
77
+ */
78
+ export const toActionConfig = (config) => {
79
+ // Ensure we always have 16 rules, filling with default values if necessary
80
+ const filledRules = [...config.paramRules.rules];
81
+ // Fill the rest with default ParamRule if the length is less than 16
82
+ while (filledRules.length < MAX_RULES) {
83
+ filledRules.push({
84
+ condition: 0, // Default condition (EQUAL)
85
+ offsetIndex: 0, // Default offset
86
+ isLimited: false, // Default isLimited flag
87
+ ref: "0x0000000000000000000000000000000000000000000000000000000000000000", // Default bytes32 ref
88
+ usage: {
89
+ limit: BigInt(0), // Default limit
90
+ used: BigInt(0) // Default used
91
+ }
92
+ });
93
+ }
94
+ return {
95
+ valueLimitPerUse: BigInt(config.valueLimitPerUse),
96
+ paramRules: {
97
+ length: BigInt(config.paramRules.length),
98
+ rules: filledRules
99
+ .map((rule) => {
100
+ const parsedRef = parseReferenceValue(rule.ref);
101
+ return {
102
+ condition: rule.condition,
103
+ offset: rule.offsetIndex * 32,
104
+ isLimited: rule.isLimited,
105
+ ref: parsedRef,
106
+ usage: rule.usage
107
+ };
108
+ })
109
+ .concat(Array(MAX_RULES - filledRules.length).fill({
110
+ condition: 0,
111
+ offset: 0,
112
+ isLimited: false,
113
+ ref: "0x0000000000000000000000000000000000000000000000000000000000000000",
114
+ usage: { limit: 0n, used: 0n }
115
+ }))
116
+ }
117
+ };
118
+ };
119
+ /**
120
+ * Stringifies an object, explicitly tagging BigInt values.
121
+ *
122
+ * @param obj - The object to be stringified.
123
+ * @returns A string representing the stringified object with tagged BigInts.
124
+ */
125
+ export function stringify(obj) {
126
+ return JSON.stringify(obj, (_, value) => typeof value === "bigint"
127
+ ? { __type: "bigint", value: value.toString() }
128
+ : value);
129
+ }
130
+ /**
131
+ * Parses a string representation back into an object, correctly handling tagged BigInt values.
132
+ *
133
+ * @param data - The string representing the stringified object.
134
+ * @returns The parsed object with BigInt values restored.
135
+ */
136
+ export function parse(data) {
137
+ return JSON.parse(data, (_, value) => {
138
+ if (value && typeof value === "object" && value.__type === "bigint") {
139
+ return BigInt(value.value);
140
+ }
141
+ return value;
142
+ });
143
+ }
144
+ // Todo
145
+ // 1. find trusted attesters. why not just here instead of part of read decorators?
146
+ // 2. get trusteAttesters calldata. or returning the whole "Action"/Execution
147
+ /**
148
+ * Retrieves the list of trusted attesters for a given account from the registry.
149
+ *
150
+ * This function queries the registry contract to find all attesters that are trusted
151
+ * by the specified account.
152
+ *
153
+ * @param params - The parameters object
154
+ * @param params.account - The account to check trusted attesters for
155
+ * @param params.client - The public client used to interact with the blockchain
156
+ * @returns A promise that resolves to an array of addresses representing the trusted attesters
157
+ * @throws Will log error and return empty array if registry query fails
158
+ */
159
+ export const getTrustedAttesters = async ({ accountAddress, client }) => {
160
+ try {
161
+ const attesters = (await client.readContract({
162
+ address: REGISTRY_ADDRESS,
163
+ abi: ERC7484RegistryAbi,
164
+ functionName: "findTrustedAttesters",
165
+ args: [accountAddress]
166
+ }));
167
+ return attesters;
168
+ }
169
+ catch (err) {
170
+ console.error(err);
171
+ return [];
172
+ }
173
+ };
174
+ export const abiToPoliciesInfo = ({ abi, ...actionPolicyInfo }) => (abi ?? [])
175
+ .filter((item) => item.type === "function")
176
+ .map((func) => ({
177
+ ...actionPolicyInfo,
178
+ functionSelector: toFunctionSelector(func),
179
+ rules: [] // Rules should not be available here because they should be custom per method, not used in a loop
180
+ }));
181
+ //# sourceMappingURL=Helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Helpers.js","sourceRoot":"","sources":["../../../../../src/sdk/modules/validators/smartSessionsValidator/Helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,UAAU,EACV,OAAO,EACP,kBAAkB,EAClB,KAAK,EACN,M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AkB,CAAC,IAAI,CAAC;IAC1C,KAAK,EAAE,EAAE,CAAC,kGAAkG;CAC7G,CAAC,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Enum representing different parameter conditions for rules.
3
+ */
4
+ export var ParamCondition;
5
+ (function (ParamCondition) {
6
+ ParamCondition[ParamCondition["EQUAL"] = 0] = "EQUAL";
7
+ ParamCondition[ParamCondition["GREATER_THAN"] = 1] = "GREATER_THAN";
8
+ ParamCondition[ParamCondition["LESS_THAN"] = 2] = "LESS_THAN";
9
+ ParamCondition[ParamCondition["GREATER_THAN_OR_EQUAL"] = 3] = "GREATER_THAN_OR_EQUAL";
10
+ ParamCondition[ParamCondition["LESS_THAN_OR_EQUAL"] = 4] = "LESS_THAN_OR_EQUAL";
11
+ ParamCondition[ParamCondition["NOT_EQUAL"] = 5] = "NOT_EQUAL";
12
+ })(ParamCondition || (ParamCondition = {}));
13
+ //# sourceMappingURL=Types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Types.js","sourceRoot":"","sources":["../../../../../src/sdk/modules/validators/smartSessionsValidator/Types.ts"],"names":[],"mappings":"AAsLA;;GAEG;AACH,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,qDAAS,CAAA;IACT,mEAAgB,CAAA;IAChB,6DAAa,CAAA;IACb,qFAAyB,CAAA;IACzB,+EAAsB,CAAA;IACtB,6DAAa,CAAA;AACf,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB"}
@@ -0,0 +1,80 @@
1
+ import { sendUserOperation } from "viem/account-abstraction";
2
+ import { getAction, parseAccount } from "viem/utils";
3
+ import { AccountNotFoundError } from "../../../../account/utils/AccountNotFound.js";
4
+ import { preparePermission } from "./preparePermission.js";
5
+ /**
6
+ * Adds multiple sessions to the SmartSessionValidator module of a given smart account.
7
+ *
8
+ * This function prepares and sends a user operation to create multiple sessions
9
+ * for the specified modular smart account. Each session can have its own policies
10
+ * and permissions.
11
+ *
12
+ * @template TModularSmartAccount - Type of the modular smart account, extending ModularSmartAccount or undefined.
13
+ * @param client - The client used to interact with the blockchain.
14
+ * @param parameters - Parameters including the smart account, required session specific policies info, and optional gas settings.
15
+ * @returns A promise that resolves to an object containing the user operation hash and an array of permission IDs.
16
+ *
17
+ * @throws {AccountNotFoundError} If the account is not found.
18
+ * @throws {Error} If there's an error getting the enable sessions action.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * import { grantPermission } from '@startale-scs/aa-sdk'
23
+ *
24
+ * const result = await grantPermission(startaleClient, {
25
+ * sessionRequestedInfo: [
26
+ * {
27
+ * sessionKeyData: '0x...',
28
+ * actionPoliciesInfo: [
29
+ * {
30
+ * contractAddress: '0x...',
31
+ * functionSelector: '0x...',
32
+ * rules: [...],
33
+ * valueLimit: 1000000000000000000n
34
+ * }
35
+ * ],
36
+ * sessionValidUntil: 1234567890
37
+ * }
38
+ * ]
39
+ * });
40
+ * console.log(result.userOpHash); // '0x...'
41
+ * console.log(result.permissionIds); // ['0x...', '0x...']
42
+ * ```
43
+ *
44
+ * @remarks
45
+ * - Ensure that the client has sufficient gas to cover the transaction.
46
+ * - The number of sessions created is determined by the length of the `sessionRequestedInfo` array.
47
+ * - Each session's policies and permissions are determined by the `actionPoliciesInfo` provided.
48
+ */
49
+ export async function grantPermission(client, parameters) {
50
+ const { account: account_ = client.account, maxFeePerGas, maxPriorityFeePerGas, nonce, calls: calls_ } = parameters;
51
+ if (!account_) {
52
+ throw new AccountNotFoundError({
53
+ docsPath: "/startale-client/methods#sendtransaction"
54
+ });
55
+ }
56
+ const account = parseAccount(account_);
57
+ if (!account || !account.address) {
58
+ throw new Error("Account not found");
59
+ }
60
+ const preparedPermission = await getAction(client, preparePermission, "preparePermission")(parameters);
61
+ const userOpHash = await getAction(client, sendUserOperation, "sendUserOperation")({
62
+ calls: [
63
+ {
64
+ // If smart session address gets updated, review to get this right
65
+ to: preparedPermission.action.target,
66
+ data: preparedPermission.action.callData
67
+ },
68
+ ...(calls_ || [])
69
+ ],
70
+ maxFeePerGas,
71
+ maxPriorityFeePerGas,
72
+ nonce,
73
+ account
74
+ });
75
+ return {
76
+ userOpHash,
77
+ ...preparedPermission
78
+ };
79
+ }
80
+ //# sourceMappingURL=grantPermission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grantPermission.js","sourceRoot":"","sources":["../../../../../../src/sdk/modules/validators/smartSessionsValidator/decorators/grantPermission.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAIhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AA4BvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAGnC,MAAkE,EAClE,UAA2D;IAE3D,MAAM,EACJ,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,KAAK,EAAE,MAAM,EACd,GAAG,UAAU,CAAA;IAEd,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,oBAAoB,CAAC;YAC7B,QAAQ,EAAE,0CAA0C;SACrD,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAwB,CAAA;IAC7D,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACtC,CAAC;IAED,MAAM,kBAAkB,GAAG,MAAM,SAAS,CACxC,MAAM,EACN,iBAAiB,EACjB,mBAAmB,CACpB,CAAC,UAAU,CAAC,CAAA;IAEb,MAAM,UAAU,GAAG,MAAM,SAAS,CAChC,MAAM,EACN,iBAAiB,EACjB,mBAAmB,CACpB,CAAC;QACA,KAAK,EAAE;YACL;gBACE,kEAAkE;gBAClE,EAAE,EAAE,kBAAkB,CAAC,MAAM,CAAC,MAAM;gBACpC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,QAAQ;aACzC;YACD,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC;SAClB;QACD,YAAY;QACZ,oBAAoB;QACpB,KAAK;QACL,OAAO;KACR,CAAC,CAAA;IAEF,OAAO;QACL,UAAU;QACV,GAAG,kBAAkB;KACtB,CAAA;AACH,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { grantPermission } from "./grantPermission.js";
2
+ import { revokeSession } from "./revokeSession.js";
3
+ import { preparePermission } from "./preparePermission.js";
4
+ import { usePermission } from "./usePermission.js";
5
+ /**
6
+ * Creates actions for managing smart session creation.
7
+ *
8
+ * @param _ - Unused parameter (placeholder for potential future use).
9
+ * @returns A function that takes a client and returns SmartSessionCreateActions.
10
+ */
11
+ export function smartSessionCreateActions(_) {
12
+ return (client) => {
13
+ return {
14
+ grantPermission: (args) => grantPermission(client, args),
15
+ preparePermission: (args) => preparePermission(client, args),
16
+ revokeSession: (args) => revokeSession(client, args)
17
+ };
18
+ };
19
+ }
20
+ /**
21
+ * Creates actions for using smart sessions.
22
+ *
23
+ * @param smartSessionsModule - The smart sessions module to be set on the client's account.
24
+ * @returns A function that takes a client and returns SmartSessionUseActions.
25
+ */
26
+ export function smartSessionUseActions(smartSessionsModule) {
27
+ return (client) => {
28
+ client?.account?.setModule(smartSessionsModule);
29
+ return {
30
+ usePermission: (args) => usePermission(client, args)
31
+ };
32
+ };
33
+ }
34
+ export * from "./usePermission.js";
35
+ export * from "./grantPermission.js";
36
+ export * from "./revokeSession.js";
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/sdk/modules/validators/smartSessionsValidator/decorators/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAEL,aAAa,EACd,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAEL,iBAAiB,EAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAgC,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAoE7E;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,CAAS;IACjD,OAAO,CACL,MAAkE,EACjB,EAAE;QACnD,OAAO;YACL,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC;YACxD,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC;YAC5D,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC;SACrD,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,mBAAuC;IAEvC,OAAO,CACL,MAAkE,EACpB,EAAE;QAChD,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAA;QAC/C,OAAO;YACL,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC;SACrD,CAAA;IACH,CAAC,CAAA;AACH,CAAC;AAED,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,214 @@
1
+ import { getTimeFramePolicy, getUniversalActionPolicy } from "@rhinestone/module-sdk";
2
+ import { getPermissionId } from "@rhinestone/module-sdk";
3
+ import { encodeFunctionData, encodePacked, parseAccount } from "viem/utils";
4
+ import { ERROR_MESSAGES } from "../../../../account/index.js";
5
+ import { AccountNotFoundError } from "../../../../account/utils/AccountNotFound.js";
6
+ import { encodeValidationData, getSpendingLimitsPolicy, getSudoPolicy, getUsageLimitPolicy, getValueLimitPolicy, TIME_FRAME_POLICY_ADDRESS, VALUE_LIMIT_POLICY_ADDRESS, USAGE_LIMIT_POLICY_ADDRESS, SPENDING_LIMITS_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, SMART_SESSIONS_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, UNIVERSAL_ACTION_POLICY_ADDRESS } from "../../../../constants/index.js";
7
+ import { SmartSessionAbi } from "../../../../constants/abi/SmartSessionAbi.js";
8
+ import { abiToPoliciesInfo, applyDefaults, createActionConfig, createActionData, generateSalt, toActionConfig } from "../Helpers.js";
9
+ // Date.now() returns milliseconds, so we need to convert it to seconds // 60 * 60 * 24 * 365 is in seconds
10
+ export const ONE_YEAR_FROM_NOW_IN_SECONDS = Math.floor(new Date().getTime() / 1000.0) + 60 * 60 * 24 * 365;
11
+ /**
12
+ * Generates the action data for creating sessions in the SmartSessionValidator.
13
+ *
14
+ * @param sessionRequestedInfo - Array of session data parameters.
15
+ * @param client - The public client for blockchain interactions.
16
+ * @returns A promise that resolves to the action data and permission IDs, or an Error.
17
+ */
18
+ export const getPermissionAction = async ({ chainId, sessionRequestedInfo, withPaymaster = false }) => {
19
+ const sessions = [];
20
+ const permissionIds = [];
21
+ const resolvedPolicyInfo2ActionData = (actionPolicyInfo) => {
22
+ const policyData = [];
23
+ // creating time frame policy here..
24
+ // Note: can do packing fix and address update in upstream also
25
+ const timeFramePolicy = getTimeFramePolicy({
26
+ validUntil: actionPolicyInfo.validUntil ?? ONE_YEAR_FROM_NOW_IN_SECONDS,
27
+ validAfter: actionPolicyInfo.validAfter ?? 0
28
+ });
29
+ timeFramePolicy.address = TIME_FRAME_POLICY_ADDRESS;
30
+ timeFramePolicy.policy = TIME_FRAME_POLICY_ADDRESS;
31
+ timeFramePolicy.initData = encodePacked(['uint48', 'uint48'], [actionPolicyInfo.validUntil ?? ONE_YEAR_FROM_NOW_IN_SECONDS, actionPolicyInfo.validAfter ?? 0]);
32
+ policyData.push(timeFramePolicy);
33
+ const hasValidRules = actionPolicyInfo?.rules && actionPolicyInfo?.rules?.length > 0;
34
+ if (hasValidRules) {
35
+ const actionConfig = createActionConfig(actionPolicyInfo.rules ?? [], actionPolicyInfo.valueLimit);
36
+ // create uni action policy here..
37
+ const uniActionPolicyInfo = getUniversalActionPolicy(toActionConfig(actionConfig));
38
+ uniActionPolicyInfo.address = UNIVERSAL_ACTION_POLICY_ADDRESS;
39
+ uniActionPolicyInfo.policy = UNIVERSAL_ACTION_POLICY_ADDRESS;
40
+ policyData.push(uniActionPolicyInfo);
41
+ }
42
+ // create sudo policy here..
43
+ if (actionPolicyInfo.sudo || !hasValidRules) {
44
+ const sudoPolicy = getSudoPolicy();
45
+ sudoPolicy.address = SUDO_POLICY_ADDRESS;
46
+ sudoPolicy.policy = SUDO_POLICY_ADDRESS;
47
+ policyData.push(sudoPolicy);
48
+ }
49
+ // create value limit policy here..
50
+ if (actionPolicyInfo.valueLimit) {
51
+ const valueLimitPolicy = getValueLimitPolicy({
52
+ limit: actionPolicyInfo.valueLimit
53
+ });
54
+ valueLimitPolicy.address = VALUE_LIMIT_POLICY_ADDRESS;
55
+ valueLimitPolicy.policy = VALUE_LIMIT_POLICY_ADDRESS;
56
+ policyData.push(valueLimitPolicy);
57
+ }
58
+ // create usage limit policy here..
59
+ if (actionPolicyInfo.usageLimit) {
60
+ const usageLimitPolicy = getUsageLimitPolicy({
61
+ limit: actionPolicyInfo.usageLimit
62
+ });
63
+ usageLimitPolicy.address = USAGE_LIMIT_POLICY_ADDRESS;
64
+ usageLimitPolicy.policy = USAGE_LIMIT_POLICY_ADDRESS;
65
+ policyData.push(usageLimitPolicy);
66
+ }
67
+ // create token spending limit policy here..
68
+ if (actionPolicyInfo.tokenLimits?.length) {
69
+ const spendingLimitPolicy = getSpendingLimitsPolicy(actionPolicyInfo.tokenLimits);
70
+ spendingLimitPolicy.address = SPENDING_LIMITS_POLICY_ADDRESS;
71
+ spendingLimitPolicy.policy = SPENDING_LIMITS_POLICY_ADDRESS;
72
+ policyData.push(spendingLimitPolicy);
73
+ }
74
+ // Create ActionData
75
+ const actionPolicy = createActionData(actionPolicyInfo.contractAddress, actionPolicyInfo.functionSelector, policyData);
76
+ return actionPolicy;
77
+ };
78
+ // Start populating the session for each param provided
79
+ for (const sessionInfo of sessionRequestedInfo) {
80
+ const actionPolicies = [];
81
+ for (const actionPolicyInfo of sessionInfo.actionPoliciesInfo ?? []) {
82
+ if (actionPolicyInfo.abi) {
83
+ // Resolve the abi to multiple function selectors...
84
+ const resolvedPolicyInfos = abiToPoliciesInfo(actionPolicyInfo);
85
+ const actionPolicies_ = resolvedPolicyInfos.map(resolvedPolicyInfo2ActionData);
86
+ actionPolicies.push(...actionPolicies_);
87
+ }
88
+ else {
89
+ const actionPolicy = resolvedPolicyInfo2ActionData(actionPolicyInfo);
90
+ actionPolicies.push(actionPolicy);
91
+ }
92
+ }
93
+ const timeFramePolicy = getTimeFramePolicy({
94
+ validUntil: sessionInfo.sessionValidUntil ?? ONE_YEAR_FROM_NOW_IN_SECONDS,
95
+ validAfter: sessionInfo.sessionValidAfter ?? 0
96
+ });
97
+ timeFramePolicy.address = TIME_FRAME_POLICY_ADDRESS;
98
+ timeFramePolicy.policy = TIME_FRAME_POLICY_ADDRESS;
99
+ timeFramePolicy.initData = encodePacked(['uint48', 'uint48'], [sessionInfo.sessionValidUntil ?? ONE_YEAR_FROM_NOW_IN_SECONDS, sessionInfo.sessionValidAfter ?? 0]);
100
+ // Review
101
+ const userOpPolicies = withPaymaster ? [timeFramePolicy] : [timeFramePolicy];
102
+ // Maybe if there is no validUntil and validAfter, then we can use sudo policy here
103
+ // const userOpPolicies = withPaymaster ? [getSudoPolicy()] : []
104
+ const session = {
105
+ chainId: BigInt(chainId),
106
+ permitERC4337Paymaster: withPaymaster,
107
+ sessionValidator: OWNABLE_VALIDATOR_ADDRESS,
108
+ sessionValidatorInitData: encodeValidationData({
109
+ threshold: 1,
110
+ owners: [sessionInfo.sessionKeyData]
111
+ }),
112
+ salt: sessionInfo.salt ?? generateSalt(),
113
+ userOpPolicies,
114
+ actions: actionPolicies,
115
+ erc7739Policies: {
116
+ allowedERC7739Content: [],
117
+ erc1271Policies: []
118
+ }
119
+ };
120
+ const permissionId = getPermissionId({
121
+ session
122
+ });
123
+ // push permissionId to the array
124
+ permissionIds.push(permissionId);
125
+ // Push to sessions array
126
+ sessions.push(session);
127
+ }
128
+ const preparePermissionData = encodeFunctionData({
129
+ abi: SmartSessionAbi,
130
+ functionName: "enableSessions",
131
+ args: [sessions]
132
+ });
133
+ return {
134
+ action: {
135
+ target: SMART_SESSIONS_ADDRESS,
136
+ value: BigInt(0),
137
+ callData: preparePermissionData
138
+ },
139
+ permissionIds: permissionIds,
140
+ sessions
141
+ };
142
+ };
143
+ /**
144
+ * Adds multiple sessions to the SmartSessionValidator module of a given smart account.
145
+ *
146
+ * This function prepares and sends a user operation to create multiple sessions
147
+ * for the specified modular smart account. Each session can have its own policies
148
+ * and permissions.
149
+ *
150
+ * @template TModularSmartAccount - Type of the modular smart account, extending ModularSmartAccount or undefined.
151
+ * @param client - The client used to interact with the blockchain.
152
+ * @param parameters - Parameters including the smart account, required session specific policies info, and optional gas settings.
153
+ * @returns A promise that resolves to an object containing the user operation hash and an array of permission IDs.
154
+ *
155
+ * @throws {AccountNotFoundError} If the account is not found.
156
+ * @throws {Error} If there's an error getting the enable sessions action.
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * import { preparePermission } from '@startale-scs/aa-sdk'
161
+ *
162
+ * const result = await preparePermission(startaleClient, {
163
+ * sessionRequestedInfo: [
164
+ * {
165
+ * sessionKeyData: '0x...',
166
+ * actionPoliciesInfo: [
167
+ * {
168
+ * contractAddress: '0x...',
169
+ * functionSelector: '0x...',
170
+ * rules: [...],
171
+ * valueLimit: 1000000000000000000n
172
+ * }
173
+ * ],
174
+ * sessionValidUntil: 1234567890
175
+ * }
176
+ * ]
177
+ * });
178
+ * console.log(result.userOpHash); // '0x...'
179
+ * console.log(result.permissionIds); // ['0x...', '0x...']
180
+ * ```
181
+ *
182
+ * @remarks
183
+ * - Ensure that the client has sufficient gas to cover the transaction.
184
+ * - The number of sessions created is determined by the length of the `sessionRequestedInfo` array.
185
+ * - Each session's policies and permissions are determined by the `actionPoliciesInfo` provided.
186
+ */
187
+ export async function preparePermission(client, parameters) {
188
+ const { publicClient: publicClient_ = client.account?.client, account: account_ = client.account, sessionRequestedInfo } = parameters;
189
+ if (!account_) {
190
+ throw new AccountNotFoundError({
191
+ docsPath: "/startale-client/methods#sendtransaction"
192
+ });
193
+ }
194
+ const account = parseAccount(account_);
195
+ if (!account || !account.address) {
196
+ throw new Error("Account not found");
197
+ }
198
+ const withPaymaster = !!client?.paymaster;
199
+ const chainId = publicClient_?.chain?.id;
200
+ if (!chainId) {
201
+ throw new Error(ERROR_MESSAGES.CHAIN_NOT_FOUND);
202
+ }
203
+ const defaultedSessionRequestedInfo = sessionRequestedInfo.map(applyDefaults);
204
+ const actionResponse = await getPermissionAction({
205
+ chainId,
206
+ sessionRequestedInfo: defaultedSessionRequestedInfo,
207
+ withPaymaster
208
+ });
209
+ if (actionResponse instanceof Error) {
210
+ throw actionResponse;
211
+ }
212
+ return actionResponse;
213
+ }
214
+ //# sourceMappingURL=preparePermission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preparePermission.js","sourceRoot":"","sources":["../../../../../../src/sdk/modules/validators/smartSessionsValidator/decorators/preparePermission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,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AAC;QACb,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,CAAA;IACjD,CAAC;IAED,MAAM,6BAA6B,GAAG,oBAAoB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IAE7E,MAAM,cAAc,GAAG,MAAM,mBAAmB,CAAC;QAC/C,OAAO;QACP,oBAAoB,EAAE,6BAA6B;QACnD,aAAa;KACd,CAAC,CAAA;IAEF,IAAI,cAAc,YAAY,KAAK,EAAE,CAAC;QACpC,MAAM,cAAc,CAAA;IACtB,CAAC;IAED,OAAO,cAAc,CAAA;AACvB,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { sendUserOperation } from "viem/account-abstraction";
2
+ import { getAction, parseAccount } from "viem/utils";
3
+ import { AccountNotFoundError } from "../../../../account/utils/AccountNotFound.js";
4
+ import { getRemoveSessionAction } from "@rhinestone/module-sdk";
5
+ /**
6
+ * Revokes a particular session by permissionId in the SmartSessionValidator module of a given smart account.
7
+ *
8
+ * This function prepares and sends a user operation to revoke a particular session by permissionId
9
+ * for the specified modular smart account.
10
+ *
11
+ * @template TModularSmartAccount - Type of the modular smart account, extending ModularSmartAccount or undefined.
12
+ * @param client - The client used to interact with the blockchain.
13
+ * @param parameters - Parameters including the smart account, permissionId, and optional gas settings.
14
+ * @returns A promise that resolves to an object containing the user operation hash.
15
+ *
16
+ * @throws {AccountNotFoundError} If the account is not found.
17
+ * @throws {Error} If there's an error getting the remove session action.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { revokeSession } from '@startale-scs/aa-sdk'
22
+ *
23
+ * const result = await revokeSession(startaleClient, {
24
+ * permissionId: '0x...',
25
+ * });
26
+ * console.log(result.userOpHash); // '0x...'
27
+ * ```
28
+ *
29
+ * @remarks
30
+ * - Ensure that the client has sufficient gas to cover the transaction.
31
+ * - The session is revoked by the permissionId.
32
+ */
33
+ export async function revokeSession(client, parameters) {
34
+ const { account: account_ = client.account, maxFeePerGas, maxPriorityFeePerGas, nonce, calls: calls_ } = parameters;
35
+ if (!account_) {
36
+ throw new AccountNotFoundError({
37
+ docsPath: "/startale-client/methods#sendtransaction"
38
+ });
39
+ }
40
+ const account = parseAccount(account_);
41
+ if (!account || !account.address) {
42
+ throw new AccountNotFoundError({
43
+ docsPath: "/startale-client/methods#parseaccount"
44
+ });
45
+ }
46
+ const action = getRemoveSessionAction({
47
+ permissionId: parameters.permissionId
48
+ });
49
+ const userOpHash = await getAction(client, sendUserOperation, "sendUserOperation")({
50
+ calls: [
51
+ {
52
+ to: action.target,
53
+ value: BigInt(action.value.toString()),
54
+ data: action.callData
55
+ },
56
+ ...(calls_ || [])
57
+ ],
58
+ maxFeePerGas,
59
+ maxPriorityFeePerGas,
60
+ nonce,
61
+ account
62
+ });
63
+ return {
64
+ userOpHash,
65
+ };
66
+ }
67
+ //# sourceMappingURL=revokeSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revokeSession.js","sourceRoot":"","sources":["../../../../../../src/sdk/modules/validators/smartSessionsValidator/decorators/revokeSession.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAIhF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AA0B/D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAGjC,MAAkE,EAClE,UAAyD;IAEzD,MAAM,EACJ,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC,OAAO,EAClC,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,KAAK,EAAE,MAAM,EACd,GAAG,UAAU,CAAA;IAEd,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,oBAAoB,CAAC;YAC7B,QAAQ,EAAE,0CAA0C;SACrD,C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