@aa-sdk/core 4.0.0-alpha.9 → 4.0.0-beta.0

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 (416) hide show
  1. package/dist/esm/abis/EntryPointAbi_v7.js +1 -0
  2. package/dist/esm/abis/EntryPointAbi_v7.js.map +1 -1
  3. package/dist/esm/account/smartContractAccount.d.ts +50 -1
  4. package/dist/esm/account/smartContractAccount.js +111 -2
  5. package/dist/esm/account/smartContractAccount.js.map +1 -1
  6. package/dist/esm/actions/smartAccount/buildUserOperation.d.ts +23 -0
  7. package/dist/esm/actions/smartAccount/buildUserOperation.js +23 -0
  8. package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -1
  9. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.d.ts +39 -0
  10. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js +39 -0
  11. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
  12. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.d.ts +54 -0
  13. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js +55 -0
  14. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
  15. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +28 -0
  16. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js +28 -0
  17. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
  18. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.d.ts +22 -0
  19. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js +27 -6
  20. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
  21. package/dist/esm/actions/smartAccount/estimateUserOperationGas.d.ts +13 -0
  22. package/dist/esm/actions/smartAccount/estimateUserOperationGas.js +13 -0
  23. package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
  24. package/dist/esm/actions/smartAccount/internal/initUserOperation.d.ts +13 -0
  25. package/dist/esm/actions/smartAccount/internal/initUserOperation.js +14 -1
  26. package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
  27. package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js +2 -1
  28. package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
  29. package/dist/esm/actions/smartAccount/sendTransaction.d.ts +24 -0
  30. package/dist/esm/actions/smartAccount/sendTransaction.js +24 -0
  31. package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -1
  32. package/dist/esm/actions/smartAccount/sendTransactions.d.ts +23 -0
  33. package/dist/esm/actions/smartAccount/sendTransactions.js +23 -0
  34. package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -1
  35. package/dist/esm/actions/smartAccount/sendUserOperation.d.ts +21 -0
  36. package/dist/esm/actions/smartAccount/sendUserOperation.js +21 -0
  37. package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
  38. package/dist/esm/actions/smartAccount/types.d.ts +14 -0
  39. package/dist/esm/actions/smartAccount/types.js +1 -0
  40. package/dist/esm/actions/smartAccount/types.js.map +1 -1
  41. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.d.ts +24 -0
  42. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js +24 -0
  43. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
  44. package/dist/esm/client/bundlerClient.d.ts +21 -0
  45. package/dist/esm/client/bundlerClient.js +32 -0
  46. package/dist/esm/client/bundlerClient.js.map +1 -1
  47. package/dist/esm/client/decorators/bundlerClient.d.ts +41 -0
  48. package/dist/esm/client/decorators/bundlerClient.js +10 -0
  49. package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
  50. package/dist/esm/client/decorators/smartAccountClient.d.ts +8 -0
  51. package/dist/esm/client/decorators/smartAccountClient.js +12 -1
  52. package/dist/esm/client/decorators/smartAccountClient.js.map +1 -1
  53. package/dist/esm/client/isSmartAccountClient.d.ts +16 -0
  54. package/dist/esm/client/isSmartAccountClient.js +16 -0
  55. package/dist/esm/client/isSmartAccountClient.js.map +1 -1
  56. package/dist/esm/client/schema.d.ts +12 -0
  57. package/dist/esm/client/schema.js +14 -0
  58. package/dist/esm/client/schema.js.map +1 -1
  59. package/dist/esm/client/smartAccountClient.js +53 -0
  60. package/dist/esm/client/smartAccountClient.js.map +1 -1
  61. package/dist/esm/client/types.js +1 -0
  62. package/dist/esm/client/types.js.map +1 -1
  63. package/dist/esm/ens/utils.d.ts +45 -0
  64. package/dist/esm/ens/utils.js +49 -0
  65. package/dist/esm/ens/utils.js.map +1 -1
  66. package/dist/esm/entrypoint/index.d.ts +14 -0
  67. package/dist/esm/entrypoint/index.js +30 -0
  68. package/dist/esm/entrypoint/index.js.map +1 -1
  69. package/dist/esm/entrypoint/types.d.ts +17 -0
  70. package/dist/esm/errors/account.d.ts +87 -4
  71. package/dist/esm/errors/account.js +88 -4
  72. package/dist/esm/errors/account.js.map +1 -1
  73. package/dist/esm/errors/base.d.ts +5 -0
  74. package/dist/esm/errors/base.js +5 -0
  75. package/dist/esm/errors/base.js.map +1 -1
  76. package/dist/esm/errors/client.d.ts +24 -0
  77. package/dist/esm/errors/client.js +24 -0
  78. package/dist/esm/errors/client.js.map +1 -1
  79. package/dist/esm/errors/entrypoint.d.ts +18 -0
  80. package/dist/esm/errors/entrypoint.js +18 -0
  81. package/dist/esm/errors/entrypoint.js.map +1 -1
  82. package/dist/esm/errors/signer.d.ts +8 -0
  83. package/dist/esm/errors/signer.js +8 -0
  84. package/dist/esm/errors/signer.js.map +1 -1
  85. package/dist/esm/errors/transaction.d.ts +14 -1
  86. package/dist/esm/errors/transaction.js +14 -1
  87. package/dist/esm/errors/transaction.js.map +1 -1
  88. package/dist/esm/errors/useroperation.d.ts +25 -0
  89. package/dist/esm/errors/useroperation.js +26 -0
  90. package/dist/esm/errors/useroperation.js.map +1 -1
  91. package/dist/esm/index.d.ts +0 -1
  92. package/dist/esm/index.js +0 -1
  93. package/dist/esm/index.js.map +1 -1
  94. package/dist/esm/logger.d.ts +91 -0
  95. package/dist/esm/logger.js +91 -0
  96. package/dist/esm/logger.js.map +1 -1
  97. package/dist/esm/middleware/actions.d.ts +14 -0
  98. package/dist/esm/middleware/actions.js +7 -0
  99. package/dist/esm/middleware/actions.js.map +1 -1
  100. package/dist/esm/middleware/defaults/feeEstimator.d.ts +20 -0
  101. package/dist/esm/middleware/defaults/feeEstimator.js +28 -0
  102. package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
  103. package/dist/esm/middleware/defaults/gasEstimator.d.ts +8 -0
  104. package/dist/esm/middleware/defaults/gasEstimator.js +8 -0
  105. package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
  106. package/dist/esm/middleware/defaults/paymasterAndData.d.ts +8 -0
  107. package/dist/esm/middleware/defaults/paymasterAndData.js +8 -0
  108. package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
  109. package/dist/esm/middleware/defaults/userOpSigner.d.ts +10 -0
  110. package/dist/esm/middleware/defaults/userOpSigner.js +10 -0
  111. package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
  112. package/dist/esm/middleware/erc7677middleware.d.ts +21 -0
  113. package/dist/esm/middleware/erc7677middleware.js +23 -0
  114. package/dist/esm/middleware/erc7677middleware.js.map +1 -1
  115. package/dist/esm/middleware/noopMiddleware.d.ts +6 -0
  116. package/dist/esm/middleware/noopMiddleware.js +6 -0
  117. package/dist/esm/middleware/noopMiddleware.js.map +1 -1
  118. package/dist/esm/middleware/types.js +1 -0
  119. package/dist/esm/middleware/types.js.map +1 -1
  120. package/dist/esm/signer/local-account.d.ts +96 -1
  121. package/dist/esm/signer/local-account.js +97 -2
  122. package/dist/esm/signer/local-account.js.map +1 -1
  123. package/dist/esm/signer/schema.d.ts +14 -0
  124. package/dist/esm/signer/schema.js +14 -0
  125. package/dist/esm/signer/schema.js.map +1 -1
  126. package/dist/esm/signer/types.d.ts +12 -0
  127. package/dist/esm/signer/types.js +1 -0
  128. package/dist/esm/signer/types.js.map +1 -1
  129. package/dist/esm/signer/utils.d.ts +20 -0
  130. package/dist/esm/signer/utils.js +27 -0
  131. package/dist/esm/signer/utils.js.map +1 -1
  132. package/dist/esm/signer/wallet-client.d.ts +92 -0
  133. package/dist/esm/signer/wallet-client.js +92 -0
  134. package/dist/esm/signer/wallet-client.js.map +1 -1
  135. package/dist/esm/transport/split.d.ts +32 -0
  136. package/dist/esm/transport/split.js +32 -0
  137. package/dist/esm/transport/split.js.map +1 -1
  138. package/dist/esm/types.d.ts +17 -0
  139. package/dist/esm/types.js +1 -0
  140. package/dist/esm/types.js.map +1 -1
  141. package/dist/esm/utils/bigint.d.ts +45 -0
  142. package/dist/esm/utils/bigint.js +46 -0
  143. package/dist/esm/utils/bigint.js.map +1 -1
  144. package/dist/esm/utils/bytes.d.ts +9 -0
  145. package/dist/esm/utils/bytes.js +10 -1
  146. package/dist/esm/utils/bytes.js.map +1 -1
  147. package/dist/esm/utils/index.d.ts +86 -0
  148. package/dist/esm/utils/index.js +86 -0
  149. package/dist/esm/utils/index.js.map +1 -1
  150. package/dist/esm/utils/schema.d.ts +3 -0
  151. package/dist/esm/utils/schema.js +9 -0
  152. package/dist/esm/utils/schema.js.map +1 -1
  153. package/dist/esm/utils/stateOverride.js +2 -0
  154. package/dist/esm/utils/stateOverride.js.map +1 -1
  155. package/dist/esm/utils/types.d.ts +22 -0
  156. package/dist/esm/utils/types.js +1 -0
  157. package/dist/esm/utils/types.js.map +1 -1
  158. package/dist/esm/utils/userop.d.ts +79 -0
  159. package/dist/esm/utils/userop.js +83 -0
  160. package/dist/esm/utils/userop.js.map +1 -1
  161. package/dist/esm/version.d.ts +1 -1
  162. package/dist/esm/version.js +3 -1
  163. package/dist/esm/version.js.map +1 -1
  164. package/dist/types/account/smartContractAccount.d.ts +1 -1
  165. package/dist/types/account/smartContractAccount.d.ts.map +1 -1
  166. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
  167. package/dist/types/client/smartAccountClient.d.ts.map +1 -1
  168. package/dist/types/index.d.ts +0 -1
  169. package/dist/types/index.d.ts.map +1 -1
  170. package/dist/types/transport/split.d.ts +1 -1
  171. package/dist/types/version.d.ts +1 -1
  172. package/dist/types/version.d.ts.map +1 -1
  173. package/package.json +10 -11
  174. package/src/account/smartContractAccount.ts +3 -3
  175. package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +10 -10
  176. package/src/actions/smartAccount/internal/initUserOperation.ts +1 -1
  177. package/src/client/smartAccountClient.ts +7 -0
  178. package/src/index.ts +0 -1
  179. package/src/transport/split.ts +1 -1
  180. package/src/version.ts +1 -1
  181. package/dist/cjs/abis/EntryPointAbi_v6.d.ts +0 -1018
  182. package/dist/cjs/abis/EntryPointAbi_v6.js +0 -1313
  183. package/dist/cjs/abis/EntryPointAbi_v6.js.map +0 -1
  184. package/dist/cjs/abis/EntryPointAbi_v7.d.ts +0 -775
  185. package/dist/cjs/abis/EntryPointAbi_v7.js +0 -661
  186. package/dist/cjs/abis/EntryPointAbi_v7.js.map +0 -1
  187. package/dist/cjs/abis/SimpleAccountAbi_v6.d.ts +0 -405
  188. package/dist/cjs/abis/SimpleAccountAbi_v6.js +0 -528
  189. package/dist/cjs/abis/SimpleAccountAbi_v6.js.map +0 -1
  190. package/dist/cjs/abis/SimpleAccountAbi_v7.d.ts +0 -410
  191. package/dist/cjs/abis/SimpleAccountAbi_v7.js +0 -538
  192. package/dist/cjs/abis/SimpleAccountAbi_v7.js.map +0 -1
  193. package/dist/cjs/abis/SimpleAccountFactoryAbi.d.ts +0 -55
  194. package/dist/cjs/abis/SimpleAccountFactoryAbi.js +0 -78
  195. package/dist/cjs/abis/SimpleAccountFactoryAbi.js.map +0 -1
  196. package/dist/cjs/account/smartContractAccount.d.ts +0 -74
  197. package/dist/cjs/account/smartContractAccount.js +0 -180
  198. package/dist/cjs/account/smartContractAccount.js.map +0 -1
  199. package/dist/cjs/actions/bundler/estimateUserOperationGas.d.ts +0 -8
  200. package/dist/cjs/actions/bundler/estimateUserOperationGas.js +0 -18
  201. package/dist/cjs/actions/bundler/estimateUserOperationGas.js.map +0 -1
  202. package/dist/cjs/actions/bundler/getSupportedEntryPoints.d.ts +0 -3
  203. package/dist/cjs/actions/bundler/getSupportedEntryPoints.js +0 -11
  204. package/dist/cjs/actions/bundler/getSupportedEntryPoints.js.map +0 -1
  205. package/dist/cjs/actions/bundler/getUserOperationByHash.d.ts +0 -6
  206. package/dist/cjs/actions/bundler/getUserOperationByHash.js +0 -11
  207. package/dist/cjs/actions/bundler/getUserOperationByHash.js.map +0 -1
  208. package/dist/cjs/actions/bundler/getUserOperationReceipt.d.ts +0 -6
  209. package/dist/cjs/actions/bundler/getUserOperationReceipt.js +0 -11
  210. package/dist/cjs/actions/bundler/getUserOperationReceipt.js.map +0 -1
  211. package/dist/cjs/actions/bundler/sendRawUserOperation.d.ts +0 -7
  212. package/dist/cjs/actions/bundler/sendRawUserOperation.js +0 -11
  213. package/dist/cjs/actions/bundler/sendRawUserOperation.js.map +0 -1
  214. package/dist/cjs/actions/smartAccount/buildUserOperation.d.ts +0 -5
  215. package/dist/cjs/actions/smartAccount/buildUserOperation.js +0 -25
  216. package/dist/cjs/actions/smartAccount/buildUserOperation.js.map +0 -1
  217. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.d.ts +0 -5
  218. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js +0 -39
  219. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +0 -1
  220. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.d.ts +0 -4
  221. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js +0 -62
  222. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +0 -1
  223. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +0 -4
  224. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js +0 -34
  225. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +0 -1
  226. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.d.ts +0 -5
  227. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js +0 -64
  228. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js.map +0 -1
  229. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.d.ts +0 -5
  230. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js +0 -23
  231. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +0 -1
  232. package/dist/cjs/actions/smartAccount/getAddress.d.ts +0 -4
  233. package/dist/cjs/actions/smartAccount/getAddress.js +0 -13
  234. package/dist/cjs/actions/smartAccount/getAddress.js.map +0 -1
  235. package/dist/cjs/actions/smartAccount/internal/initUserOperation.d.ts +0 -7
  236. package/dist/cjs/actions/smartAccount/internal/initUserOperation.js +0 -42
  237. package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +0 -1
  238. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.d.ts +0 -10
  239. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js +0 -47
  240. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +0 -1
  241. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.d.ts +0 -10
  242. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js +0 -28
  243. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +0 -1
  244. package/dist/cjs/actions/smartAccount/sendTransaction.d.ts +0 -5
  245. package/dist/cjs/actions/smartAccount/sendTransaction.js +0 -35
  246. package/dist/cjs/actions/smartAccount/sendTransaction.js.map +0 -1
  247. package/dist/cjs/actions/smartAccount/sendTransactions.d.ts +0 -4
  248. package/dist/cjs/actions/smartAccount/sendTransactions.js +0 -36
  249. package/dist/cjs/actions/smartAccount/sendTransactions.js.map +0 -1
  250. package/dist/cjs/actions/smartAccount/sendUserOperation.d.ts +0 -5
  251. package/dist/cjs/actions/smartAccount/sendUserOperation.js +0 -31
  252. package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +0 -1
  253. package/dist/cjs/actions/smartAccount/signMessage.d.ts +0 -6
  254. package/dist/cjs/actions/smartAccount/signMessage.js +0 -12
  255. package/dist/cjs/actions/smartAccount/signMessage.js.map +0 -1
  256. package/dist/cjs/actions/smartAccount/signMessageWith6492.d.ts +0 -4
  257. package/dist/cjs/actions/smartAccount/signMessageWith6492.js +0 -12
  258. package/dist/cjs/actions/smartAccount/signMessageWith6492.js.map +0 -1
  259. package/dist/cjs/actions/smartAccount/signTypedData.d.ts +0 -10
  260. package/dist/cjs/actions/smartAccount/signTypedData.js +0 -12
  261. package/dist/cjs/actions/smartAccount/signTypedData.js.map +0 -1
  262. package/dist/cjs/actions/smartAccount/signTypedDataWith6492.d.ts +0 -6
  263. package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js +0 -12
  264. package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js.map +0 -1
  265. package/dist/cjs/actions/smartAccount/signUserOperation.d.ts +0 -5
  266. package/dist/cjs/actions/smartAccount/signUserOperation.js +0 -30
  267. package/dist/cjs/actions/smartAccount/signUserOperation.js.map +0 -1
  268. package/dist/cjs/actions/smartAccount/types.d.ts +0 -42
  269. package/dist/cjs/actions/smartAccount/types.js +0 -3
  270. package/dist/cjs/actions/smartAccount/types.js.map +0 -1
  271. package/dist/cjs/actions/smartAccount/upgradeAccount.d.ts +0 -4
  272. package/dist/cjs/actions/smartAccount/upgradeAccount.js +0 -38
  273. package/dist/cjs/actions/smartAccount/upgradeAccount.js.map +0 -1
  274. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.d.ts +0 -3
  275. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js +0 -36
  276. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js.map +0 -1
  277. package/dist/cjs/client/bundlerClient.d.ts +0 -10
  278. package/dist/cjs/client/bundlerClient.js +0 -51
  279. package/dist/cjs/client/bundlerClient.js.map +0 -1
  280. package/dist/cjs/client/decorators/bundlerClient.d.ts +0 -41
  281. package/dist/cjs/client/decorators/bundlerClient.js +0 -17
  282. package/dist/cjs/client/decorators/bundlerClient.js.map +0 -1
  283. package/dist/cjs/client/decorators/smartAccountClient.d.ts +0 -35
  284. package/dist/cjs/client/decorators/smartAccountClient.js +0 -43
  285. package/dist/cjs/client/decorators/smartAccountClient.js.map +0 -1
  286. package/dist/cjs/client/isSmartAccountClient.d.ts +0 -5
  287. package/dist/cjs/client/isSmartAccountClient.js +0 -18
  288. package/dist/cjs/client/isSmartAccountClient.js.map +0 -1
  289. package/dist/cjs/client/schema.d.ts +0 -767
  290. package/dist/cjs/client/schema.js +0 -63
  291. package/dist/cjs/client/schema.js.map +0 -1
  292. package/dist/cjs/client/smartAccountClient.d.ts +0 -33
  293. package/dist/cjs/client/smartAccountClient.js +0 -93
  294. package/dist/cjs/client/smartAccountClient.js.map +0 -1
  295. package/dist/cjs/client/types.d.ts +0 -21
  296. package/dist/cjs/client/types.js +0 -3
  297. package/dist/cjs/client/types.js.map +0 -1
  298. package/dist/cjs/ens/utils.d.ts +0 -6
  299. package/dist/cjs/ens/utils.js +0 -53
  300. package/dist/cjs/ens/utils.js.map +0 -1
  301. package/dist/cjs/entrypoint/0.6.d.ts +0 -1029
  302. package/dist/cjs/entrypoint/0.6.js +0 -49
  303. package/dist/cjs/entrypoint/0.6.js.map +0 -1
  304. package/dist/cjs/entrypoint/0.7.d.ts +0 -792
  305. package/dist/cjs/entrypoint/0.7.js +0 -88
  306. package/dist/cjs/entrypoint/0.7.js.map +0 -1
  307. package/dist/cjs/entrypoint/index.d.ts +0 -8
  308. package/dist/cjs/entrypoint/index.js +0 -53
  309. package/dist/cjs/entrypoint/index.js.map +0 -1
  310. package/dist/cjs/entrypoint/types.d.ts +0 -46
  311. package/dist/cjs/entrypoint/types.js +0 -3
  312. package/dist/cjs/entrypoint/types.js.map +0 -1
  313. package/dist/cjs/errors/account.d.ts +0 -47
  314. package/dist/cjs/errors/account.js +0 -140
  315. package/dist/cjs/errors/account.js.map +0 -1
  316. package/dist/cjs/errors/base.d.ts +0 -18
  317. package/dist/cjs/errors/base.js +0 -39
  318. package/dist/cjs/errors/base.js.map +0 -1
  319. package/dist/cjs/errors/client.d.ts +0 -14
  320. package/dist/cjs/errors/client.js +0 -44
  321. package/dist/cjs/errors/client.js.map +0 -1
  322. package/dist/cjs/errors/entrypoint.d.ts +0 -10
  323. package/dist/cjs/errors/entrypoint.js +0 -32
  324. package/dist/cjs/errors/entrypoint.js.map +0 -1
  325. package/dist/cjs/errors/signer.d.ts +0 -5
  326. package/dist/cjs/errors/signer.js +0 -20
  327. package/dist/cjs/errors/signer.js.map +0 -1
  328. package/dist/cjs/errors/transaction.d.ts +0 -10
  329. package/dist/cjs/errors/transaction.js +0 -29
  330. package/dist/cjs/errors/transaction.js.map +0 -1
  331. package/dist/cjs/errors/useroperation.d.ts +0 -10
  332. package/dist/cjs/errors/useroperation.js +0 -34
  333. package/dist/cjs/errors/useroperation.js.map +0 -1
  334. package/dist/cjs/index.d.ts +0 -60
  335. package/dist/cjs/index.js +0 -170
  336. package/dist/cjs/index.js.map +0 -1
  337. package/dist/cjs/logger.d.ts +0 -20
  338. package/dist/cjs/logger.js +0 -60
  339. package/dist/cjs/logger.js.map +0 -1
  340. package/dist/cjs/middleware/actions.d.ts +0 -12
  341. package/dist/cjs/middleware/actions.js +0 -21
  342. package/dist/cjs/middleware/actions.js.map +0 -1
  343. package/dist/cjs/middleware/defaults/feeEstimator.d.ts +0 -3
  344. package/dist/cjs/middleware/defaults/feeEstimator.js +0 -23
  345. package/dist/cjs/middleware/defaults/feeEstimator.js.map +0 -1
  346. package/dist/cjs/middleware/defaults/gasEstimator.d.ts +0 -3
  347. package/dist/cjs/middleware/defaults/gasEstimator.js +0 -28
  348. package/dist/cjs/middleware/defaults/gasEstimator.js.map +0 -1
  349. package/dist/cjs/middleware/defaults/paymasterAndData.d.ts +0 -2
  350. package/dist/cjs/middleware/defaults/paymasterAndData.js +0 -12
  351. package/dist/cjs/middleware/defaults/paymasterAndData.js.map +0 -1
  352. package/dist/cjs/middleware/defaults/userOpSigner.d.ts +0 -2
  353. package/dist/cjs/middleware/defaults/userOpSigner.js +0 -26
  354. package/dist/cjs/middleware/defaults/userOpSigner.js.map +0 -1
  355. package/dist/cjs/middleware/erc7677middleware.d.ts +0 -40
  356. package/dist/cjs/middleware/erc7677middleware.js +0 -77
  357. package/dist/cjs/middleware/erc7677middleware.js.map +0 -1
  358. package/dist/cjs/middleware/noopMiddleware.d.ts +0 -3
  359. package/dist/cjs/middleware/noopMiddleware.js +0 -8
  360. package/dist/cjs/middleware/noopMiddleware.js.map +0 -1
  361. package/dist/cjs/middleware/types.d.ts +0 -22
  362. package/dist/cjs/middleware/types.js +0 -3
  363. package/dist/cjs/middleware/types.js.map +0 -1
  364. package/dist/cjs/package.json +0 -1
  365. package/dist/cjs/signer/local-account.d.ts +0 -219
  366. package/dist/cjs/signer/local-account.js +0 -56
  367. package/dist/cjs/signer/local-account.js.map +0 -1
  368. package/dist/cjs/signer/schema.d.ts +0 -4
  369. package/dist/cjs/signer/schema.js +0 -16
  370. package/dist/cjs/signer/schema.js.map +0 -1
  371. package/dist/cjs/signer/types.d.ts +0 -15
  372. package/dist/cjs/signer/types.js +0 -3
  373. package/dist/cjs/signer/types.js.map +0 -1
  374. package/dist/cjs/signer/utils.d.ts +0 -7
  375. package/dist/cjs/signer/utils.js +0 -16
  376. package/dist/cjs/signer/utils.js.map +0 -1
  377. package/dist/cjs/signer/wallet-client.d.ts +0 -217
  378. package/dist/cjs/signer/wallet-client.js +0 -58
  379. package/dist/cjs/signer/wallet-client.js.map +0 -1
  380. package/dist/cjs/transport/split.d.ts +0 -9
  381. package/dist/cjs/transport/split.js +0 -26
  382. package/dist/cjs/transport/split.js.map +0 -1
  383. package/dist/cjs/types.d.ts +0 -158
  384. package/dist/cjs/types.js +0 -3
  385. package/dist/cjs/types.js.map +0 -1
  386. package/dist/cjs/utils/bigint.d.ts +0 -10
  387. package/dist/cjs/utils/bigint.js +0 -55
  388. package/dist/cjs/utils/bigint.js.map +0 -1
  389. package/dist/cjs/utils/bytes.d.ts +0 -7
  390. package/dist/cjs/utils/bytes.js +0 -11
  391. package/dist/cjs/utils/bytes.js.map +0 -1
  392. package/dist/cjs/utils/defaults.d.ts +0 -4
  393. package/dist/cjs/utils/defaults.js +0 -19
  394. package/dist/cjs/utils/defaults.js.map +0 -1
  395. package/dist/cjs/utils/index.d.ts +0 -19
  396. package/dist/cjs/utils/index.js +0 -95
  397. package/dist/cjs/utils/index.js.map +0 -1
  398. package/dist/cjs/utils/schema.d.ts +0 -25
  399. package/dist/cjs/utils/schema.js +0 -35
  400. package/dist/cjs/utils/schema.js.map +0 -1
  401. package/dist/cjs/utils/stateOverride.d.ts +0 -4
  402. package/dist/cjs/utils/stateOverride.js +0 -52
  403. package/dist/cjs/utils/stateOverride.js.map +0 -1
  404. package/dist/cjs/utils/testUtils.d.ts +0 -6
  405. package/dist/cjs/utils/testUtils.js +0 -33
  406. package/dist/cjs/utils/testUtils.js.map +0 -1
  407. package/dist/cjs/utils/types.d.ts +0 -16
  408. package/dist/cjs/utils/types.js +0 -3
  409. package/dist/cjs/utils/types.js.map +0 -1
  410. package/dist/cjs/utils/userop.d.ts +0 -49
  411. package/dist/cjs/utils/userop.js +0 -75
  412. package/dist/cjs/utils/userop.js.map +0 -1
  413. package/dist/cjs/version.d.ts +0 -1
  414. package/dist/cjs/version.js +0 -5
  415. package/dist/cjs/version.js.map +0 -1
  416. package/dist/esm/package.json +0 -1
@@ -1,18 +1,67 @@
1
1
  import * as chains from "viem/chains";
2
2
  import { mainnet } from "viem/chains";
3
3
  export const ChainsById = new Map(Object.values(chains).map((x) => [x.id, x]));
4
+ /**
5
+ * Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { convertChainIdToCoinType } from "@aa-sdk/core";
10
+ * import { sepolia } from "viem/chains";
11
+ *
12
+ * const coinType = convertChainIdToCoinType(sepolia.id);
13
+ * ```
14
+ *
15
+ * @param {number} chainId the blockchain chain ID that you want to convert to a coin type
16
+ * @returns {number} the corresponding coin type for the given chain ID
17
+ */
4
18
  export const convertChainIdToCoinType = (chainId) => {
5
19
  if (chainId === mainnet.id) {
20
+ // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)
6
21
  return 60;
7
22
  }
23
+ // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains
8
24
  return (0x80000000 | chainId) >>> 0;
9
25
  };
26
+ /**
27
+ * Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { convertChainIdToCoinType, convertCoinTypeToChainId } from "@aa-sdk/core";
32
+ * import { sepolia } from "viem/chains";
33
+ *
34
+ * const coinType = convertChainIdToCoinType(sepolia.id);
35
+ * const chainId = convertCoinTypeToChainId(coinType);
36
+ * ```
37
+ *
38
+ * @param {number} coinType the coin type to be converted to a chain ID
39
+ * @returns {number} the corresponding chain ID
40
+ */
10
41
  export const convertCoinTypeToChainId = (coinType) => {
11
42
  if (coinType === 60) {
43
+ // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)
12
44
  return mainnet.id;
13
45
  }
46
+ // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains
14
47
  return (0x7fffffff & coinType) >> 0;
15
48
  };
49
+ /**
50
+ * Converts a coin type to its corresponding blockchain chain based on a predefined mapping.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * import { convertChainIdToCoinType, convertCoinTypeToChain } from "@aa-sdk/core";
55
+ * import { sepolia } from "viem/chains";
56
+ *
57
+ * const coinType = convertChainIdToCoinType(sepolia.id);
58
+ * const chain = convertCoinTypeToChain(coinType);
59
+ * ```
60
+ *
61
+ * @param {number} coinType The numerical identifier for the coin type
62
+ * @returns {Chain} The corresponding blockchain chain
63
+ * @throws {Error} If the coin type does not map to a supported chain
64
+ */
16
65
  export const convertCoinTypeToChain = (coinType) => {
17
66
  const chainId = convertCoinTypeToChainId(coinType);
18
67
  const chain = ChainsById.get(chainId);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ens/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAc,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,UAAU,GAA8B,IAAI,GAAG,CAC1D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAC5C,CAAC;AAgBF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE;IAClE,IAAI,OAAO,KAAK,OAAO,CAAC,EAAE,EAAE,CAAC;QAE3B,OAAO,EAAE,CAAC;IACZ,CAAC;IAGD,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC,CAAC;AAiBF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAU,EAAE;IACnE,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QAEpB,OAAO,OAAO,CAAC,EAAE,CAAC;IACpB,CAAC;IAGD,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAkBF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAS,EAAE;IAChE,MAAM,OAAO,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["import * as chains from \"viem/chains\";\nimport { mainnet, type Chain } from \"viem/chains\";\n\nexport const ChainsById: Map<number, chains.Chain> = new Map(\n Object.values(chains).map((x) => [x.id, x])\n);\n\n/**\n * Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * ```\n *\n * @param {number} chainId the blockchain chain ID that you want to convert to a coin type\n * @returns {number} the corresponding coin type for the given chain ID\n */\nexport const convertChainIdToCoinType = (chainId: number): number => {\n if (chainId === mainnet.id) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return 60;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x80000000 | chainId) >>> 0;\n};\n\n/**\n * Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChainId } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chainId = convertCoinTypeToChainId(coinType);\n * ```\n *\n * @param {number} coinType the coin type to be converted to a chain ID\n * @returns {number} the corresponding chain ID\n */\nexport const convertCoinTypeToChainId = (coinType: number): number => {\n if (coinType === 60) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return mainnet.id;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x7fffffff & coinType) >> 0;\n};\n\n/**\n * Converts a coin type to its corresponding blockchain chain based on a predefined mapping.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChain } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chain = convertCoinTypeToChain(coinType);\n * ```\n *\n * @param {number} coinType The numerical identifier for the coin type\n * @returns {Chain} The corresponding blockchain chain\n * @throws {Error} If the coin type does not map to a supported chain\n */\nexport const convertCoinTypeToChain = (coinType: number): Chain => {\n const chainId = convertCoinTypeToChainId(coinType);\n const chain = ChainsById.get(chainId);\n if (!chain) {\n throw new Error(\"CoinType does not map to a supported chain\");\n }\n\n return chain;\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ens/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAc,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,UAAU,GAA8B,IAAI,GAAG,CAC1D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAC5C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE;IAClE,IAAI,OAAO,KAAK,OAAO,CAAC,EAAE,EAAE,CAAC;QAC3B,sHAAsH;QACtH,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,uLAAuL;IACvL,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAU,EAAE;IACnE,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QACpB,sHAAsH;QACtH,OAAO,OAAO,CAAC,EAAE,CAAC;IACpB,CAAC;IAED,uLAAuL;IACvL,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAS,EAAE;IAChE,MAAM,OAAO,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["import * as chains from \"viem/chains\";\nimport { mainnet, type Chain } from \"viem/chains\";\n\nexport const ChainsById: Map<number, chains.Chain> = new Map(\n Object.values(chains).map((x) => [x.id, x])\n);\n\n/**\n * Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * ```\n *\n * @param {number} chainId the blockchain chain ID that you want to convert to a coin type\n * @returns {number} the corresponding coin type for the given chain ID\n */\nexport const convertChainIdToCoinType = (chainId: number): number => {\n if (chainId === mainnet.id) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return 60;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x80000000 | chainId) >>> 0;\n};\n\n/**\n * Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChainId } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chainId = convertCoinTypeToChainId(coinType);\n * ```\n *\n * @param {number} coinType the coin type to be converted to a chain ID\n * @returns {number} the corresponding chain ID\n */\nexport const convertCoinTypeToChainId = (coinType: number): number => {\n if (coinType === 60) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return mainnet.id;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x7fffffff & coinType) >> 0;\n};\n\n/**\n * Converts a coin type to its corresponding blockchain chain based on a predefined mapping.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChain } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chain = convertCoinTypeToChain(coinType);\n * ```\n *\n * @param {number} coinType The numerical identifier for the coin type\n * @returns {Chain} The corresponding blockchain chain\n * @throws {Error} If the coin type does not map to a supported chain\n */\nexport const convertCoinTypeToChain = (coinType: number): Chain => {\n const chainId = convertCoinTypeToChainId(coinType);\n const chain = ChainsById.get(chainId);\n if (!chain) {\n throw new Error(\"CoinType does not map to a supported chain\");\n }\n\n return chain;\n};\n"]}
@@ -2,6 +2,20 @@ import { type Chain } from "viem";
2
2
  import type { DefaultEntryPointVersion, EntryPointDefRegistry, EntryPointRegistry, EntryPointVersion, GetEntryPointOptions } from "./types.js";
3
3
  export declare const defaultEntryPointVersion: DefaultEntryPointVersion;
4
4
  export declare const entryPointRegistry: EntryPointRegistry;
5
+ /**
6
+ * Checks if the given value is a valid key of the EntryPointRegistry.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { isEntryPointVersion } from "@aa-sdk/core";
11
+ *
12
+ * const valid = isEntryPointVersion("0.6.0");
13
+ * const invalid = isEntryPointVersion("0.8.0");
14
+ * ```
15
+ *
16
+ * @param {*} value The value to be checked
17
+ * @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise
18
+ */
5
19
  export declare const isEntryPointVersion: (value: any) => value is keyof EntryPointRegistry<Chain>;
6
20
  export declare function getEntryPoint<TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion, TChain extends Chain = Chain>(chain: TChain, options: GetEntryPointOptions<TEntryPointVersion>): EntryPointDefRegistry<TChain>[TEntryPointVersion];
7
21
  export declare function getEntryPoint<TEntryPointVersion extends DefaultEntryPointVersion = DefaultEntryPointVersion, TChain extends Chain = Chain>(chain: TChain, options?: GetEntryPointOptions<TEntryPointVersion>): EntryPointDefRegistry<TChain>[TEntryPointVersion];
@@ -7,9 +7,39 @@ export const entryPointRegistry = {
7
7
  "0.6.0": EntryPoint_v6,
8
8
  "0.7.0": EntryPoint_v7,
9
9
  };
10
+ /**
11
+ * Checks if the given value is a valid key of the EntryPointRegistry.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { isEntryPointVersion } from "@aa-sdk/core";
16
+ *
17
+ * const valid = isEntryPointVersion("0.6.0");
18
+ * const invalid = isEntryPointVersion("0.8.0");
19
+ * ```
20
+ *
21
+ * @param {*} value The value to be checked
22
+ * @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise
23
+ */
10
24
  export const isEntryPointVersion = (value) => {
11
25
  return Object.keys(entryPointRegistry).includes(value);
12
26
  };
27
+ /**
28
+ * Retrieves the entry point definition for the specified chain and version, falling back to the default version if not provided. Throws an error if the entry point address cannot be found.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * import { getEntryPoint } from "@aa-sdk/core";
33
+ * import { sepolia } from "viem/chains";
34
+ *
35
+ * const entryPoint060 = getEntryPoint(sepolia);
36
+ * const entryPoint070 = getEntryPoint(sepolia, { version: "0.7.0" });
37
+ * ```
38
+ *
39
+ * @param {Chain} chain The chain for which the entry point is being retrieved
40
+ * @param {GetEntryPointOptions<TEntryPointVersion>} options Options containing the version and address overrides for the entry point
41
+ * @returns {EntryPointDefRegistry<TChain>[EntryPointVersion]} The entry point definition for the specified chain and version
42
+ */
13
43
  export function getEntryPoint(chain, options) {
14
44
  const { version = defaultEntryPointVersion, addressOverride } = options ?? {
15
45
  version: defaultEntryPointVersion,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entrypoint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,aAAa,MAAM,UAAU,CAAC;AACrC,OAAO,aAAa,MAAM,UAAU,CAAC;AASrC,MAAM,CAAC,MAAM,wBAAwB,GAA6B,OAAO,CAAC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IACpD,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;CACvB,CAAC;AAgBF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAU,EACyB,EAAE;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AAuCF,MAAM,UAAU,aAAa,CAI3B,KAAa,EACb,OAAiD;IAEjD,MAAM,EAAE,OAAO,GAAG,wBAAwB,EAAE,eAAe,EAAE,GAAG,OAAO,IAAI;QACzE,OAAO,EAAE,wBAAwB;KAClC,CAAC;IAEF,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC;IAC3E,MAAM,OAAO,GACX,eAAe;QACf,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO;YACP,KAAK;YACL,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1B,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAChD,CAAC;IACJ,CAAC;SAAM,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAC1C,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO;YACP,KAAK;YACL,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1B,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAChD,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import { type Chain } from \"viem\";\nimport { EntryPointNotFoundError } from \"../errors/entrypoint.js\";\nimport EntryPoint_v6 from \"./0.6.js\";\nimport EntryPoint_v7 from \"./0.7.js\";\nimport type {\n DefaultEntryPointVersion,\n EntryPointDefRegistry,\n EntryPointRegistry,\n EntryPointVersion,\n GetEntryPointOptions,\n} from \"./types.js\";\n\nexport const defaultEntryPointVersion: DefaultEntryPointVersion = \"0.6.0\";\n\nexport const entryPointRegistry: EntryPointRegistry = {\n \"0.6.0\": EntryPoint_v6,\n \"0.7.0\": EntryPoint_v7,\n};\n\n/**\n * Checks if the given value is a valid key of the EntryPointRegistry.\n *\n * @example\n * ```ts\n * import { isEntryPointVersion } from \"@aa-sdk/core\";\n *\n * const valid = isEntryPointVersion(\"0.6.0\");\n * const invalid = isEntryPointVersion(\"0.8.0\");\n * ```\n *\n * @param {*} value The value to be checked\n * @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise\n */\nexport const isEntryPointVersion = (\n value: any\n): value is keyof EntryPointRegistry => {\n return Object.keys(entryPointRegistry).includes(value);\n};\n\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<\n TEntryPointVersion extends DefaultEntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options?: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<TChain extends Chain = Chain>(\n chain: TChain,\n options?: GetEntryPointOptions<DefaultEntryPointVersion>\n): EntryPointDefRegistry<TChain>[DefaultEntryPointVersion];\n\n/**\n * Retrieves the entry point definition for the specified chain and version, falling back to the default version if not provided. Throws an error if the entry point address cannot be found.\n *\n * @example\n * ```ts\n * import { getEntryPoint } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const entryPoint060 = getEntryPoint(sepolia);\n * const entryPoint070 = getEntryPoint(sepolia, { version: \"0.7.0\" });\n * ```\n *\n * @param {Chain} chain The chain for which the entry point is being retrieved\n * @param {GetEntryPointOptions<TEntryPointVersion>} options Options containing the version and address overrides for the entry point\n * @returns {EntryPointDefRegistry<TChain>[EntryPointVersion]} The entry point definition for the specified chain and version\n */\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[EntryPointVersion] {\n const { version = defaultEntryPointVersion, addressOverride } = options ?? {\n version: defaultEntryPointVersion,\n };\n\n const entryPoint = entryPointRegistry[version ?? defaultEntryPointVersion];\n const address =\n addressOverride ??\n entryPoint.address[chain.id] ??\n entryPoint.address.default;\n if (!address) {\n throw new EntryPointNotFoundError(chain, version);\n }\n\n if (entryPoint.version === \"0.6.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n } else if (entryPoint.version === \"0.7.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n }\n\n throw new EntryPointNotFoundError(chain, version);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entrypoint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,aAAa,MAAM,UAAU,CAAC;AACrC,OAAO,aAAa,MAAM,UAAU,CAAC;AASrC,MAAM,CAAC,MAAM,wBAAwB,GAA6B,OAAO,CAAC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IACpD,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;CACvB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAU,EACyB,EAAE;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AAuBF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAI3B,KAAa,EACb,OAAiD;IAEjD,MAAM,EAAE,OAAO,GAAG,wBAAwB,EAAE,eAAe,EAAE,GAAG,OAAO,IAAI;QACzE,OAAO,EAAE,wBAAwB;KAClC,CAAC;IAEF,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC;IAC3E,MAAM,OAAO,GACX,eAAe;QACf,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO;YACP,KAAK;YACL,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1B,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAChD,CAAC;IACJ,CAAC;SAAM,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAC1C,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO;YACP,KAAK;YACL,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1B,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAChD,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import { type Chain } from \"viem\";\nimport { EntryPointNotFoundError } from \"../errors/entrypoint.js\";\nimport EntryPoint_v6 from \"./0.6.js\";\nimport EntryPoint_v7 from \"./0.7.js\";\nimport type {\n DefaultEntryPointVersion,\n EntryPointDefRegistry,\n EntryPointRegistry,\n EntryPointVersion,\n GetEntryPointOptions,\n} from \"./types.js\";\n\nexport const defaultEntryPointVersion: DefaultEntryPointVersion = \"0.6.0\";\n\nexport const entryPointRegistry: EntryPointRegistry = {\n \"0.6.0\": EntryPoint_v6,\n \"0.7.0\": EntryPoint_v7,\n};\n\n/**\n * Checks if the given value is a valid key of the EntryPointRegistry.\n *\n * @example\n * ```ts\n * import { isEntryPointVersion } from \"@aa-sdk/core\";\n *\n * const valid = isEntryPointVersion(\"0.6.0\");\n * const invalid = isEntryPointVersion(\"0.8.0\");\n * ```\n *\n * @param {*} value The value to be checked\n * @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise\n */\nexport const isEntryPointVersion = (\n value: any\n): value is keyof EntryPointRegistry => {\n return Object.keys(entryPointRegistry).includes(value);\n};\n\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<\n TEntryPointVersion extends DefaultEntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options?: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<TChain extends Chain = Chain>(\n chain: TChain,\n options?: GetEntryPointOptions<DefaultEntryPointVersion>\n): EntryPointDefRegistry<TChain>[DefaultEntryPointVersion];\n\n/**\n * Retrieves the entry point definition for the specified chain and version, falling back to the default version if not provided. Throws an error if the entry point address cannot be found.\n *\n * @example\n * ```ts\n * import { getEntryPoint } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const entryPoint060 = getEntryPoint(sepolia);\n * const entryPoint070 = getEntryPoint(sepolia, { version: \"0.7.0\" });\n * ```\n *\n * @param {Chain} chain The chain for which the entry point is being retrieved\n * @param {GetEntryPointOptions<TEntryPointVersion>} options Options containing the version and address overrides for the entry point\n * @returns {EntryPointDefRegistry<TChain>[EntryPointVersion]} The entry point definition for the specified chain and version\n */\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[EntryPointVersion] {\n const { version = defaultEntryPointVersion, addressOverride } = options ?? {\n version: defaultEntryPointVersion,\n };\n\n const entryPoint = entryPointRegistry[version ?? defaultEntryPointVersion];\n const address =\n addressOverride ??\n entryPoint.address[chain.id] ??\n entryPoint.address.default;\n if (!address) {\n throw new EntryPointNotFoundError(chain, version);\n }\n\n if (entryPoint.version === \"0.6.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n } else if (entryPoint.version === \"0.7.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n }\n\n throw new EntryPointNotFoundError(chain, version);\n}\n"]}
@@ -13,7 +13,24 @@ export type SupportedEntryPoint<TEntryPointVersion extends EntryPointVersion = E
13
13
  version: TEntryPointVersion;
14
14
  address: Record<TChain["id"] | "default", Address>;
15
15
  abi: GetContractParameters<Transport, TChain, Account, TAbi>["abi"];
16
+ /**
17
+ * Generates a hash for a UserOperation valid from entry point version 0.6 onwards
18
+ *
19
+ * @param request - the UserOperation to get the hash for
20
+ * @param entryPointAddress - the entry point address that will be used to execute the UserOperation
21
+ * @param chainId - the chain on which this UserOperation will be executed
22
+ * @returns the hash of the UserOperation
23
+ */
16
24
  getUserOperationHash: (request: UserOperationRequest<TEntryPointVersion>, entryPointAddress: Address, chainId: number) => Hash;
25
+ /**
26
+ * Pack the user operation data into bytes for hashing for entry point version 0.6 onwards
27
+ * Reference:
28
+ * v6: https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.6/test/UserOp.ts#L16-L61
29
+ * v7: https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.7/test/UserOp.ts#L28-L67
30
+ *
31
+ * @param request - the UserOperation to get the hash for
32
+ * @returns the hash of the UserOperation
33
+ */
17
34
  packUserOperation: (userOperation: UserOperationRequest<TEntryPointVersion>) => Hex;
18
35
  };
19
36
  export interface EntryPointRegistry<TChain extends Chain = Chain> extends EntryPointRegistryBase<SupportedEntryPoint<EntryPointVersion, TChain, Abi>> {
@@ -1,47 +1,130 @@
1
1
  import type { Chain } from "viem";
2
2
  import type { EntryPointVersion } from "../entrypoint/types.js";
3
3
  import { BaseError } from "./base.js";
4
+ /**
5
+ * This error is thrown when an account could not be found to execute a specific action. It extends the `BaseError` class.
6
+ */
4
7
  export declare class AccountNotFoundError extends BaseError {
5
8
  name: string;
6
- constructor();
9
+ /**
10
+ * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.
11
+ */ constructor();
7
12
  }
13
+ /**
14
+ * Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version.
15
+ * This error suggests providing an override via the `factoryAddress` parameter when creating an account.
16
+ */
8
17
  export declare class DefaultFactoryNotDefinedError extends BaseError {
9
18
  name: string;
19
+ /**
20
+ * Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.
21
+ *
22
+ * @param {string} accountType the type of account
23
+ * @param {Chain} chain the blockchain chain
24
+ * @param {EntryPointVersion} version the entry point version
25
+ */
10
26
  constructor(accountType: string, chain: Chain, version: EntryPointVersion);
11
27
  }
28
+ /**
29
+ * Custom error class for handling errors when getting a counterfactual address. This extends the `BaseError` class and provides a custom error message and name.
30
+ */
12
31
  export declare class GetCounterFactualAddressError extends BaseError {
13
32
  name: string;
14
- constructor();
33
+ /**
34
+ * Constructor for initializing an error message indicating the failure of fetching the counter-factual address.
35
+ */ constructor();
15
36
  }
37
+ /**
38
+ * An error class representing the condition where upgrades are not supported for a specific account type. This error extends the `BaseError` class and provides a custom error message based on the account type.
39
+ */
16
40
  export declare class UpgradesNotSupportedError extends BaseError {
17
41
  name: string;
42
+ /**
43
+ * Error constructor for indicating that upgrades are not supported by the given account type.
44
+ *
45
+ * @param {string} accountType The type of account that does not support upgrades
46
+ */
18
47
  constructor(accountType: string);
19
48
  }
49
+ /**
50
+ * Error thrown when attempting to sign a transaction that is not supported by smart contracts.
51
+ */
20
52
  export declare class SignTransactionNotSupportedError extends BaseError {
21
53
  name: string;
22
- constructor();
54
+ /**
55
+ * Throws an error indicating that signing a transaction is not supported by smart contracts.
56
+ *
57
+
58
+ */ constructor();
23
59
  }
60
+ /**
61
+ * Custom error class `FailedToGetStorageSlotError` which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from `BaseError`.
62
+ */
24
63
  export declare class FailedToGetStorageSlotError extends BaseError {
25
64
  name: string;
65
+ /**
66
+ * Custom error message constructor for failing to get a specific storage slot.
67
+ *
68
+ * @param {string} slot The storage slot that failed to be accessed or retrieved
69
+ * @param {string} slotDescriptor A description of the storage slot, for additional context in the error message
70
+ */
26
71
  constructor(slot: string, slotDescriptor: string);
27
72
  }
73
+ /**
74
+ * Represents an error indicating that batch execution is not supported for a specific account type.
75
+ */
28
76
  export declare class BatchExecutionNotSupportedError extends BaseError {
29
77
  name: string;
78
+ /**
79
+ * Constructs an error message indicating that batch execution is not supported by the specified account type.
80
+ *
81
+ * @param {string} accountType the type of account that does not support batch execution
82
+ */
30
83
  constructor(accountType: string);
31
84
  }
85
+ /**
86
+ * Represents an error that occurs when an account requires an owner to execute but none is provided.
87
+ */
32
88
  export declare class AccountRequiresOwnerError extends BaseError {
33
89
  name: string;
90
+ /**
91
+ * Constructs an error indicating that an account of the specified type requires an owner to execute.
92
+ *
93
+ * @param {string} accountType The type of account that requires an owner
94
+ */
34
95
  constructor(accountType: string);
35
96
  }
97
+ /**
98
+ * Represents an error that occurs when an attempt is made to call `UpgradeToAndCall` on an account type that does not support it. Includes the account type in the error message.
99
+ */
36
100
  export declare class UpgradeToAndCallNotSupportedError extends BaseError {
37
101
  name: string;
102
+ /**
103
+ * Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.
104
+ *
105
+ * @param {string} accountType The type of account that does not support `UpgradeToAndCall`
106
+ */
38
107
  constructor(accountType: string);
39
108
  }
109
+ /**
110
+ * Represents an error thrown when an account type does not match the expected type.
111
+ */
40
112
  export declare class IncorrectAccountType extends BaseError {
41
113
  name: string;
114
+ /**
115
+ * Constructs an error object indicating that the expected account type does not match the actual account type.
116
+ *
117
+ * @param {string} expected the expected account type
118
+ * @param {string} actual the actual account type that was received
119
+ */
42
120
  constructor(expected: string, actual: string);
43
121
  }
122
+ /**
123
+ * Error class indicating that a smart account operation requires a signer.
124
+ */
44
125
  export declare class SmartAccountWithSignerRequiredError extends BaseError {
45
126
  name: string;
46
- constructor();
127
+ /**
128
+ * Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.
129
+ */ constructor();
47
130
  }
@@ -1,6 +1,12 @@
1
1
  import { BaseError } from "./base.js";
2
+ /**
3
+ * This error is thrown when an account could not be found to execute a specific action. It extends the `BaseError` class.
4
+ */
2
5
  export class AccountNotFoundError extends BaseError {
3
- constructor() {
6
+ // TODO: extend this further using docs path as well
7
+ /**
8
+ * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.
9
+ */ constructor() {
4
10
  super("Could not find an Account to execute with this Action.");
5
11
  Object.defineProperty(this, "name", {
6
12
  enumerable: true,
@@ -10,7 +16,18 @@ export class AccountNotFoundError extends BaseError {
10
16
  });
11
17
  }
12
18
  }
19
+ /**
20
+ * Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version.
21
+ * This error suggests providing an override via the `factoryAddress` parameter when creating an account.
22
+ */
13
23
  export class DefaultFactoryNotDefinedError extends BaseError {
24
+ /**
25
+ * Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.
26
+ *
27
+ * @param {string} accountType the type of account
28
+ * @param {Chain} chain the blockchain chain
29
+ * @param {EntryPointVersion} version the entry point version
30
+ */
14
31
  constructor(accountType, chain, version) {
15
32
  super([
16
33
  `No default factory for ${accountType} found on chain ${chain.name} for entrypoint version ${version}`,
@@ -24,8 +41,13 @@ export class DefaultFactoryNotDefinedError extends BaseError {
24
41
  });
25
42
  }
26
43
  }
44
+ /**
45
+ * Custom error class for handling errors when getting a counterfactual address. This extends the `BaseError` class and provides a custom error message and name.
46
+ */
27
47
  export class GetCounterFactualAddressError extends BaseError {
28
- constructor() {
48
+ /**
49
+ * Constructor for initializing an error message indicating the failure of fetching the counter-factual address.
50
+ */ constructor() {
29
51
  super("getCounterFactualAddress failed");
30
52
  Object.defineProperty(this, "name", {
31
53
  enumerable: true,
@@ -35,7 +57,15 @@ export class GetCounterFactualAddressError extends BaseError {
35
57
  });
36
58
  }
37
59
  }
60
+ /**
61
+ * An error class representing the condition where upgrades are not supported for a specific account type. This error extends the `BaseError` class and provides a custom error message based on the account type.
62
+ */
38
63
  export class UpgradesNotSupportedError extends BaseError {
64
+ /**
65
+ * Error constructor for indicating that upgrades are not supported by the given account type.
66
+ *
67
+ * @param {string} accountType The type of account that does not support upgrades
68
+ */
39
69
  constructor(accountType) {
40
70
  super(`Upgrades are not supported by ${accountType}`);
41
71
  Object.defineProperty(this, "name", {
@@ -46,8 +76,15 @@ export class UpgradesNotSupportedError extends BaseError {
46
76
  });
47
77
  }
48
78
  }
79
+ /**
80
+ * Error thrown when attempting to sign a transaction that is not supported by smart contracts.
81
+ */
49
82
  export class SignTransactionNotSupportedError extends BaseError {
50
- constructor() {
83
+ /**
84
+ * Throws an error indicating that signing a transaction is not supported by smart contracts.
85
+ *
86
+
87
+ */ constructor() {
51
88
  super(`SignTransaction is not supported by smart contracts`);
52
89
  Object.defineProperty(this, "name", {
53
90
  enumerable: true,
@@ -57,7 +94,16 @@ export class SignTransactionNotSupportedError extends BaseError {
57
94
  });
58
95
  }
59
96
  }
97
+ /**
98
+ * Custom error class `FailedToGetStorageSlotError` which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from `BaseError`.
99
+ */
60
100
  export class FailedToGetStorageSlotError extends BaseError {
101
+ /**
102
+ * Custom error message constructor for failing to get a specific storage slot.
103
+ *
104
+ * @param {string} slot The storage slot that failed to be accessed or retrieved
105
+ * @param {string} slotDescriptor A description of the storage slot, for additional context in the error message
106
+ */
61
107
  constructor(slot, slotDescriptor) {
62
108
  super(`Failed to get storage slot ${slot} (${slotDescriptor})`);
63
109
  Object.defineProperty(this, "name", {
@@ -68,7 +114,15 @@ export class FailedToGetStorageSlotError extends BaseError {
68
114
  });
69
115
  }
70
116
  }
117
+ /**
118
+ * Represents an error indicating that batch execution is not supported for a specific account type.
119
+ */
71
120
  export class BatchExecutionNotSupportedError extends BaseError {
121
+ /**
122
+ * Constructs an error message indicating that batch execution is not supported by the specified account type.
123
+ *
124
+ * @param {string} accountType the type of account that does not support batch execution
125
+ */
72
126
  constructor(accountType) {
73
127
  super(`Batch execution is not supported by ${accountType}`);
74
128
  Object.defineProperty(this, "name", {
@@ -79,7 +133,15 @@ export class BatchExecutionNotSupportedError extends BaseError {
79
133
  });
80
134
  }
81
135
  }
136
+ /**
137
+ * Represents an error that occurs when an account requires an owner to execute but none is provided.
138
+ */
82
139
  export class AccountRequiresOwnerError extends BaseError {
140
+ /**
141
+ * Constructs an error indicating that an account of the specified type requires an owner to execute.
142
+ *
143
+ * @param {string} accountType The type of account that requires an owner
144
+ */
83
145
  constructor(accountType) {
84
146
  super(`Account of type ${accountType} requires an owner to execute`);
85
147
  Object.defineProperty(this, "name", {
@@ -90,7 +152,15 @@ export class AccountRequiresOwnerError extends BaseError {
90
152
  });
91
153
  }
92
154
  }
155
+ /**
156
+ * Represents an error that occurs when an attempt is made to call `UpgradeToAndCall` on an account type that does not support it. Includes the account type in the error message.
157
+ */
93
158
  export class UpgradeToAndCallNotSupportedError extends BaseError {
159
+ /**
160
+ * Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.
161
+ *
162
+ * @param {string} accountType The type of account that does not support `UpgradeToAndCall`
163
+ */
94
164
  constructor(accountType) {
95
165
  super(`UpgradeToAndCall is not supported by ${accountType}`);
96
166
  Object.defineProperty(this, "name", {
@@ -101,7 +171,16 @@ export class UpgradeToAndCallNotSupportedError extends BaseError {
101
171
  });
102
172
  }
103
173
  }
174
+ /**
175
+ * Represents an error thrown when an account type does not match the expected type.
176
+ */
104
177
  export class IncorrectAccountType extends BaseError {
178
+ /**
179
+ * Constructs an error object indicating that the expected account type does not match the actual account type.
180
+ *
181
+ * @param {string} expected the expected account type
182
+ * @param {string} actual the actual account type that was received
183
+ */
105
184
  constructor(expected, actual) {
106
185
  super(`Expected account type ${expected}, got ${actual}`);
107
186
  Object.defineProperty(this, "name", {
@@ -112,8 +191,13 @@ export class IncorrectAccountType extends BaseError {
112
191
  });
113
192
  }
114
193
  }
194
+ /**
195
+ * Error class indicating that a smart account operation requires a signer.
196
+ */
115
197
  export class SmartAccountWithSignerRequiredError extends BaseError {
116
- constructor() {
198
+ /**
199
+ * Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.
200
+ */ constructor() {
117
201
  super("Smart account requires a signer");
118
202
  Object.defineProperty(this, "name", {
119
203
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/errors/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAKtC,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAO7C;QACF,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAPzD;;;;mBAAO,sBAAsB;WAAC;IAQvC,CAAC;CACF;AAMD,MAAM,OAAO,6BAA8B,SAAQ,SAAS;IAU1D,YAAY,WAAmB,EAAE,KAAY,EAAE,OAA0B;QACvE,KAAK,CACH;YACE,0BAA0B,WAAW,mBAAmB,KAAK,CAAC,IAAI,2BAA2B,OAAO,EAAE;YACtG,gFAAgF;SACjF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAfK;;;;mBAAO,+BAA+B;WAAC;IAgBhD,CAAC;CACF;AAKD,MAAM,OAAO,6BAA8B,SAAQ,SAAS;IAKtD;QACF,KAAK,CAAC,iCAAiC,CAAC,CAAC;QALlC;;;;mBAAO,+BAA+B;WAAC;IAMhD,CAAC;CACF;AAKD,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAQtD,YAAY,WAAmB;QAC7B,KAAK,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAC;QAR/C;;;;mBAAO,sBAAsB;WAAC;IASvC,CAAC;CACF;AAKD,MAAM,OAAO,gCAAiC,SAAQ,SAAS;IAOzD;QACF,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAPtD;;;;mBAAO,6BAA6B;WAAC;IAQ9C,CAAC;CACF;AAKD,MAAM,OAAO,2BAA4B,SAAQ,SAAS;IASxD,YAAY,IAAY,EAAE,cAAsB;QAC9C,KAAK,CAAC,8BAA8B,IAAI,KAAK,cAAc,GAAG,CAAC,CAAC;QATzD;;;;mBAAO,6BAA6B;WAAC;IAU9C,CAAC;CACF;AAKD,MAAM,OAAO,+BAAgC,SAAQ,SAAS;IAQ5D,YAAY,WAAmB;QAC7B,KAAK,CAAC,uCAAuC,WAAW,EAAE,CAAC,CAAC;QARrD;;;;mBAAO,iCAAiC;WAAC;IASlD,CAAC;CACF;AAKD,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAQtD,YAAY,WAAmB;QAC7B,KAAK,CAAC,mBAAmB,WAAW,+BAA+B,CAAC,CAAC;QAR9D;;;;mBAAO,2BAA2B;WAAC;IAS5C,CAAC;CACF;AAKD,MAAM,OAAO,iCAAkC,SAAQ,SAAS;IAQ9D,YAAY,WAAmB;QAC7B,KAAK,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;QARtD;;;;mBAAO,mCAAmC;WAAC;IASpD,CAAC;CACF;AAKD,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IASjD,YAAY,QAAgB,EAAE,MAAc;QAC1C,KAAK,CAAC,yBAAyB,QAAQ,SAAS,MAAM,EAAE,CAAC,CAAC;QATnD;;;;mBAAO,2BAA2B;WAAC;IAU5C,CAAC;CACF;AAKD,MAAM,OAAO,mCAAoC,SAAQ,SAAS;IAK5D;QACF,KAAK,CAAC,iCAAiC,CAAC,CAAC;QALlC;;;;mBAAO,qCAAqC;WAAC;IAMtD,CAAC;CACF","sourcesContent":["import type { Chain } from \"viem\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * This error is thrown when an account could not be found to execute a specific action. It extends the `BaseError` class.\n */\nexport class AccountNotFoundError extends BaseError {\n override name = \"AccountNotFoundError\";\n\n // TODO: extend this further using docs path as well\n\n /**\n * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.\n */ constructor() {\n super(\"Could not find an Account to execute with this Action.\");\n }\n}\n\n/**\n * Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version.\n * This error suggests providing an override via the `factoryAddress` parameter when creating an account.\n */\nexport class DefaultFactoryNotDefinedError extends BaseError {\n override name = \"DefaultFactoryNotDefinedError\";\n\n /**\n * Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.\n *\n * @param {string} accountType the type of account\n * @param {Chain} chain the blockchain chain\n * @param {EntryPointVersion} version the entry point version\n */\n constructor(accountType: string, chain: Chain, version: EntryPointVersion) {\n super(\n [\n `No default factory for ${accountType} found on chain ${chain.name} for entrypoint version ${version}`,\n \"Supply an override via the `factoryAddress` parameter when creating an account\",\n ].join(\"\\n\")\n );\n }\n}\n\n/**\n * Custom error class for handling errors when getting a counterfactual address. This extends the `BaseError` class and provides a custom error message and name.\n */\nexport class GetCounterFactualAddressError extends BaseError {\n override name = \"GetCounterFactualAddressError\";\n\n /**\n * Constructor for initializing an error message indicating the failure of fetching the counter-factual address.\n */ constructor() {\n super(\"getCounterFactualAddress failed\");\n }\n}\n\n/**\n * An error class representing the condition where upgrades are not supported for a specific account type. This error extends the `BaseError` class and provides a custom error message based on the account type.\n */\nexport class UpgradesNotSupportedError extends BaseError {\n override name = \"UpgradesNotSupported\";\n\n /**\n * Error constructor for indicating that upgrades are not supported by the given account type.\n *\n * @param {string} accountType The type of account that does not support upgrades\n */\n constructor(accountType: string) {\n super(`Upgrades are not supported by ${accountType}`);\n }\n}\n\n/**\n * Error thrown when attempting to sign a transaction that is not supported by smart contracts.\n */\nexport class SignTransactionNotSupportedError extends BaseError {\n override name = \"SignTransactionNotSupported\";\n\n /**\n * Throws an error indicating that signing a transaction is not supported by smart contracts.\n *\n \n */ constructor() {\n super(`SignTransaction is not supported by smart contracts`);\n }\n}\n\n/**\n * Custom error class `FailedToGetStorageSlotError` which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from `BaseError`.\n */\nexport class FailedToGetStorageSlotError extends BaseError {\n override name = \"FailedToGetStorageSlotError\";\n\n /**\n * Custom error message constructor for failing to get a specific storage slot.\n *\n * @param {string} slot The storage slot that failed to be accessed or retrieved\n * @param {string} slotDescriptor A description of the storage slot, for additional context in the error message\n */\n constructor(slot: string, slotDescriptor: string) {\n super(`Failed to get storage slot ${slot} (${slotDescriptor})`);\n }\n}\n\n/**\n * Represents an error indicating that batch execution is not supported for a specific account type.\n */\nexport class BatchExecutionNotSupportedError extends BaseError {\n override name = \"BatchExecutionNotSupportedError\";\n\n /**\n * Constructs an error message indicating that batch execution is not supported by the specified account type.\n *\n * @param {string} accountType the type of account that does not support batch execution\n */\n constructor(accountType: string) {\n super(`Batch execution is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error that occurs when an account requires an owner to execute but none is provided.\n */\nexport class AccountRequiresOwnerError extends BaseError {\n override name = \"AccountRequiresOwnerError\";\n\n /**\n * Constructs an error indicating that an account of the specified type requires an owner to execute.\n *\n * @param {string} accountType The type of account that requires an owner\n */\n constructor(accountType: string) {\n super(`Account of type ${accountType} requires an owner to execute`);\n }\n}\n\n/**\n * Represents an error that occurs when an attempt is made to call `UpgradeToAndCall` on an account type that does not support it. Includes the account type in the error message.\n */\nexport class UpgradeToAndCallNotSupportedError extends BaseError {\n override name = \"UpgradeToAndCallNotSupportedError\";\n\n /**\n * Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.\n *\n * @param {string} accountType The type of account that does not support `UpgradeToAndCall`\n */\n constructor(accountType: string) {\n super(`UpgradeToAndCall is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error thrown when an account type does not match the expected type.\n */\nexport class IncorrectAccountType extends BaseError {\n override name = \"IncorrectAccountTypeError\";\n\n /**\n * Constructs an error object indicating that the expected account type does not match the actual account type.\n *\n * @param {string} expected the expected account type\n * @param {string} actual the actual account type that was received\n */\n constructor(expected: string, actual: string) {\n super(`Expected account type ${expected}, got ${actual}`);\n }\n}\n\n/**\n * Error class indicating that a smart account operation requires a signer.\n */\nexport class SmartAccountWithSignerRequiredError extends BaseError {\n override name = \"SmartAccountWithSignerRequiredError\";\n\n /**\n * Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.\n */ constructor() {\n super(\"Smart account requires a signer\");\n }\n}\n"]}
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/errors/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD,oDAAoD;IAEpD;;OAEG,CAAC;QACF,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAPzD;;;;mBAAO,sBAAsB;WAAC;IAQvC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,SAAS;IAG1D;;;;;;OAMG;IACH,YAAY,WAAmB,EAAE,KAAY,EAAE,OAA0B;QACvE,KAAK,CACH;YACE,0BAA0B,WAAW,mBAAmB,KAAK,CAAC,IAAI,2BAA2B,OAAO,EAAE;YACtG,gFAAgF;SACjF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAfK;;;;mBAAO,+BAA+B;WAAC;IAgBhD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,SAAS;IAG1D;;OAEG,CAAC;QACF,KAAK,CAAC,iCAAiC,CAAC,CAAC;QALlC;;;;mBAAO,+BAA+B;WAAC;IAMhD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAGtD;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAC;QAR/C;;;;mBAAO,sBAAsB;WAAC;IASvC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,gCAAiC,SAAQ,SAAS;IAG7D;;;;OAIG,CAAC;QACF,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAPtD;;;;mBAAO,6BAA6B;WAAC;IAQ9C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,SAAS;IAGxD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,cAAsB;QAC9C,KAAK,CAAC,8BAA8B,IAAI,KAAK,cAAc,GAAG,CAAC,CAAC;QATzD;;;;mBAAO,6BAA6B;WAAC;IAU9C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,SAAS;IAG5D;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,uCAAuC,WAAW,EAAE,CAAC,CAAC;QARrD;;;;mBAAO,iCAAiC;WAAC;IASlD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAGtD;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,mBAAmB,WAAW,+BAA+B,CAAC,CAAC;QAR9D;;;;mBAAO,2BAA2B;WAAC;IAS5C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iCAAkC,SAAQ,SAAS;IAG9D;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;QARtD;;;;mBAAO,mCAAmC;WAAC;IASpD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD;;;;;OAKG;IACH,YAAY,QAAgB,EAAE,MAAc;QAC1C,KAAK,CAAC,yBAAyB,QAAQ,SAAS,MAAM,EAAE,CAAC,CAAC;QATnD;;;;mBAAO,2BAA2B;WAAC;IAU5C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,SAAS;IAGhE;;OAEG,CAAC;QACF,KAAK,CAAC,iCAAiC,CAAC,CAAC;QALlC;;;;mBAAO,qCAAqC;WAAC;IAMtD,CAAC;CACF","sourcesContent":["import type { Chain } from \"viem\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * This error is thrown when an account could not be found to execute a specific action. It extends the `BaseError` class.\n */\nexport class AccountNotFoundError extends BaseError {\n override name = \"AccountNotFoundError\";\n\n // TODO: extend this further using docs path as well\n\n /**\n * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.\n */ constructor() {\n super(\"Could not find an Account to execute with this Action.\");\n }\n}\n\n/**\n * Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version.\n * This error suggests providing an override via the `factoryAddress` parameter when creating an account.\n */\nexport class DefaultFactoryNotDefinedError extends BaseError {\n override name = \"DefaultFactoryNotDefinedError\";\n\n /**\n * Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.\n *\n * @param {string} accountType the type of account\n * @param {Chain} chain the blockchain chain\n * @param {EntryPointVersion} version the entry point version\n */\n constructor(accountType: string, chain: Chain, version: EntryPointVersion) {\n super(\n [\n `No default factory for ${accountType} found on chain ${chain.name} for entrypoint version ${version}`,\n \"Supply an override via the `factoryAddress` parameter when creating an account\",\n ].join(\"\\n\")\n );\n }\n}\n\n/**\n * Custom error class for handling errors when getting a counterfactual address. This extends the `BaseError` class and provides a custom error message and name.\n */\nexport class GetCounterFactualAddressError extends BaseError {\n override name = \"GetCounterFactualAddressError\";\n\n /**\n * Constructor for initializing an error message indicating the failure of fetching the counter-factual address.\n */ constructor() {\n super(\"getCounterFactualAddress failed\");\n }\n}\n\n/**\n * An error class representing the condition where upgrades are not supported for a specific account type. This error extends the `BaseError` class and provides a custom error message based on the account type.\n */\nexport class UpgradesNotSupportedError extends BaseError {\n override name = \"UpgradesNotSupported\";\n\n /**\n * Error constructor for indicating that upgrades are not supported by the given account type.\n *\n * @param {string} accountType The type of account that does not support upgrades\n */\n constructor(accountType: string) {\n super(`Upgrades are not supported by ${accountType}`);\n }\n}\n\n/**\n * Error thrown when attempting to sign a transaction that is not supported by smart contracts.\n */\nexport class SignTransactionNotSupportedError extends BaseError {\n override name = \"SignTransactionNotSupported\";\n\n /**\n * Throws an error indicating that signing a transaction is not supported by smart contracts.\n *\n \n */ constructor() {\n super(`SignTransaction is not supported by smart contracts`);\n }\n}\n\n/**\n * Custom error class `FailedToGetStorageSlotError` which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from `BaseError`.\n */\nexport class FailedToGetStorageSlotError extends BaseError {\n override name = \"FailedToGetStorageSlotError\";\n\n /**\n * Custom error message constructor for failing to get a specific storage slot.\n *\n * @param {string} slot The storage slot that failed to be accessed or retrieved\n * @param {string} slotDescriptor A description of the storage slot, for additional context in the error message\n */\n constructor(slot: string, slotDescriptor: string) {\n super(`Failed to get storage slot ${slot} (${slotDescriptor})`);\n }\n}\n\n/**\n * Represents an error indicating that batch execution is not supported for a specific account type.\n */\nexport class BatchExecutionNotSupportedError extends BaseError {\n override name = \"BatchExecutionNotSupportedError\";\n\n /**\n * Constructs an error message indicating that batch execution is not supported by the specified account type.\n *\n * @param {string} accountType the type of account that does not support batch execution\n */\n constructor(accountType: string) {\n super(`Batch execution is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error that occurs when an account requires an owner to execute but none is provided.\n */\nexport class AccountRequiresOwnerError extends BaseError {\n override name = \"AccountRequiresOwnerError\";\n\n /**\n * Constructs an error indicating that an account of the specified type requires an owner to execute.\n *\n * @param {string} accountType The type of account that requires an owner\n */\n constructor(accountType: string) {\n super(`Account of type ${accountType} requires an owner to execute`);\n }\n}\n\n/**\n * Represents an error that occurs when an attempt is made to call `UpgradeToAndCall` on an account type that does not support it. Includes the account type in the error message.\n */\nexport class UpgradeToAndCallNotSupportedError extends BaseError {\n override name = \"UpgradeToAndCallNotSupportedError\";\n\n /**\n * Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.\n *\n * @param {string} accountType The type of account that does not support `UpgradeToAndCall`\n */\n constructor(accountType: string) {\n super(`UpgradeToAndCall is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error thrown when an account type does not match the expected type.\n */\nexport class IncorrectAccountType extends BaseError {\n override name = \"IncorrectAccountTypeError\";\n\n /**\n * Constructs an error object indicating that the expected account type does not match the actual account type.\n *\n * @param {string} expected the expected account type\n * @param {string} actual the actual account type that was received\n */\n constructor(expected: string, actual: string) {\n super(`Expected account type ${expected}, got ${actual}`);\n }\n}\n\n/**\n * Error class indicating that a smart account operation requires a signer.\n */\nexport class SmartAccountWithSignerRequiredError extends BaseError {\n override name = \"SmartAccountWithSignerRequiredError\";\n\n /**\n * Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.\n */ constructor() {\n super(\"Smart account requires a signer\");\n }\n}\n"]}
@@ -10,6 +10,11 @@ type BaseErrorParameters = {
10
10
  cause: BaseError | Error;
11
11
  details?: never;
12
12
  });
13
+ /**
14
+ * A custom error class that extends from `ViemBaseError`. This class allows for error messages to include links to relevant documentation based on provided `docsPath` and `docsSlug` parameters.
15
+ * This is based on on viem's BaseError type (obviously from the import and extend)
16
+ * we want the errors here to point to our docs if we supply a docsPath though
17
+ */
13
18
  export declare class BaseError extends ViemBaseError {
14
19
  name: string;
15
20
  version: string;
@@ -1,5 +1,10 @@
1
1
  import { BaseError as ViemBaseError } from "viem";
2
2
  import { VERSION } from "../version.js";
3
+ /**
4
+ * A custom error class that extends from `ViemBaseError`. This class allows for error messages to include links to relevant documentation based on provided `docsPath` and `docsSlug` parameters.
5
+ * This is based on on viem's BaseError type (obviously from the import and extend)
6
+ * we want the errors here to point to our docs if we supply a docsPath though
7
+ */
3
8
  export class BaseError extends ViemBaseError {
4
9
  constructor(shortMessage, args = {}) {
5
10
  super(shortMessage, args);
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/errors/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAsBxC,MAAM,OAAO,SAAU,SAAQ,aAAa;IAI1C,YAAY,YAAoB,EAAE,OAA4B,EAAE;QAC9D,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAJnB;;;;mBAAO,YAAY;WAAC;QACpB;;;;mBAAU,OAAO;WAAC;QAKzB,MAAM,QAAQ,GACZ,IAAI,CAAC,KAAK,YAAY,SAAS;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;YACtC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;QAEpB,IAAI,CAAC,OAAO,GAAG;YACb,YAAY,IAAI,oBAAoB;YACpC,EAAE;YACF,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,GAAG,CAAC,QAAQ;gBACV,CAAC,CAAC;oBACE,uCAAuC,QAAQ,GAC7C,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EACxC,EAAE;iBACH;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,YAAY,IAAI,CAAC,OAAO,EAAE;SAC3B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;CACF","sourcesContent":["import { BaseError as ViemBaseError } from \"viem\";\nimport { VERSION } from \"../version.js\";\n\ntype BaseErrorParameters = {\n docsPath?: string;\n docsSlug?: string;\n metaMessages?: string[];\n} & (\n | {\n cause?: never;\n details?: string;\n }\n | {\n cause: BaseError | Error;\n details?: never;\n }\n);\n\n/**\n * A custom error class that extends from `ViemBaseError`. This class allows for error messages to include links to relevant documentation based on provided `docsPath` and `docsSlug` parameters.\n * This is based on on viem's BaseError type (obviously from the import and extend)\n * we want the errors here to point to our docs if we supply a docsPath though\n */\nexport class BaseError extends ViemBaseError {\n override name = \"AASDKError\";\n override version = VERSION;\n\n constructor(shortMessage: string, args: BaseErrorParameters = {}) {\n super(shortMessage, args);\n\n const docsPath =\n args.cause instanceof BaseError\n ? args.cause.docsPath || args.docsPath\n : args.docsPath;\n\n this.message = [\n shortMessage || \"An error occurred.\",\n \"\",\n ...(args.metaMessages ? [...args.metaMessages, \"\"] : []),\n ...(docsPath\n ? [\n `Docs: https://accountkit.alchemy.com${docsPath}${\n args.docsSlug ? `#${args.docsSlug}` : \"\"\n }`,\n ]\n : []),\n ...(this.details ? [`Details: ${this.details}`] : []),\n `Version: ${this.version}`,\n ].join(\"\\n\");\n }\n}\n"]}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/errors/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAiBxC;;;;GAIG;AACH,MAAM,OAAO,SAAU,SAAQ,aAAa;IAI1C,YAAY,YAAoB,EAAE,OAA4B,EAAE;QAC9D,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAJnB;;;;mBAAO,YAAY;WAAC;QACpB;;;;mBAAU,OAAO;WAAC;QAKzB,MAAM,QAAQ,GACZ,IAAI,CAAC,KAAK,YAAY,SAAS;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;YACtC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;QAEpB,IAAI,CAAC,OAAO,GAAG;YACb,YAAY,IAAI,oBAAoB;YACpC,EAAE;YACF,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,GAAG,CAAC,QAAQ;gBACV,CAAC,CAAC;oBACE,uCAAuC,QAAQ,GAC7C,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EACxC,EAAE;iBACH;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,YAAY,IAAI,CAAC,OAAO,EAAE;SAC3B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;CACF","sourcesContent":["import { BaseError as ViemBaseError } from \"viem\";\nimport { VERSION } from \"../version.js\";\n\ntype BaseErrorParameters = {\n docsPath?: string;\n docsSlug?: string;\n metaMessages?: string[];\n} & (\n | {\n cause?: never;\n details?: string;\n }\n | {\n cause: BaseError | Error;\n details?: never;\n }\n);\n\n/**\n * A custom error class that extends from `ViemBaseError`. This class allows for error messages to include links to relevant documentation based on provided `docsPath` and `docsSlug` parameters.\n * This is based on on viem's BaseError type (obviously from the import and extend)\n * we want the errors here to point to our docs if we supply a docsPath though\n */\nexport class BaseError extends ViemBaseError {\n override name = \"AASDKError\";\n override version = VERSION;\n\n constructor(shortMessage: string, args: BaseErrorParameters = {}) {\n super(shortMessage, args);\n\n const docsPath =\n args.cause instanceof BaseError\n ? args.cause.docsPath || args.docsPath\n : args.docsPath;\n\n this.message = [\n shortMessage || \"An error occurred.\",\n \"\",\n ...(args.metaMessages ? [...args.metaMessages, \"\"] : []),\n ...(docsPath\n ? [\n `Docs: https://accountkit.alchemy.com${docsPath}${\n args.docsSlug ? `#${args.docsSlug}` : \"\"\n }`,\n ]\n : []),\n ...(this.details ? [`Details: ${this.details}`] : []),\n `Version: ${this.version}`,\n ].join(\"\\n\");\n }\n}\n"]}
@@ -1,14 +1,38 @@
1
1
  import type { Client } from "viem";
2
2
  import { BaseError } from "./base.js";
3
+ /**
4
+ * Represents an error thrown when a client is not compatible with the expected client type for a specific method. The error message provides guidance on how to create a compatible client.
5
+ */
3
6
  export declare class IncompatibleClientError extends BaseError {
4
7
  name: string;
8
+ /**
9
+ * Throws an error when the client type does not match the expected client type.
10
+ *
11
+ * @param {string} expectedClient The expected type of the client.
12
+ * @param {string} method The method that was called.
13
+ * @param {Client} client The client instance.
14
+ */
5
15
  constructor(expectedClient: string, method: string, client: Client);
6
16
  }
17
+ /**
18
+ * Represents an error that occurs when an invalid RPC URL is provided. This class extends the `BaseError` class and includes the invalid URL in the error message.
19
+ */
7
20
  export declare class InvalidRpcUrlError extends BaseError {
8
21
  name: string;
22
+ /**
23
+ * Creates an instance of an error with a message indicating an invalid RPC URL.
24
+ *
25
+ * @param {string} [rpcUrl] The invalid RPC URL that caused the error
26
+ */
9
27
  constructor(rpcUrl?: string);
10
28
  }
29
+ /**
30
+ * Error class representing a "Chain Not Found" error, typically thrown when no chain is supplied to the client.
31
+ */
11
32
  export declare class ChainNotFoundError extends BaseError {
12
33
  name: string;
34
+ /**
35
+ * Initializes a new instance of the error message with a default message indicating that no chain was supplied to the client.
36
+ */
13
37
  constructor();
14
38
  }