@aa-sdk/core 4.0.0-alpha.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 (743) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +54 -0
  3. package/dist/cjs/abis/EntryPointAbi_v6.d.ts +1018 -0
  4. package/dist/cjs/abis/EntryPointAbi_v6.js +1313 -0
  5. package/dist/cjs/abis/EntryPointAbi_v6.js.map +1 -0
  6. package/dist/cjs/abis/EntryPointAbi_v7.d.ts +775 -0
  7. package/dist/cjs/abis/EntryPointAbi_v7.js +661 -0
  8. package/dist/cjs/abis/EntryPointAbi_v7.js.map +1 -0
  9. package/dist/cjs/abis/SimpleAccountAbi_v6.d.ts +405 -0
  10. package/dist/cjs/abis/SimpleAccountAbi_v6.js +528 -0
  11. package/dist/cjs/abis/SimpleAccountAbi_v6.js.map +1 -0
  12. package/dist/cjs/abis/SimpleAccountAbi_v7.d.ts +410 -0
  13. package/dist/cjs/abis/SimpleAccountAbi_v7.js +538 -0
  14. package/dist/cjs/abis/SimpleAccountAbi_v7.js.map +1 -0
  15. package/dist/cjs/abis/SimpleAccountFactoryAbi.d.ts +55 -0
  16. package/dist/cjs/abis/SimpleAccountFactoryAbi.js +78 -0
  17. package/dist/cjs/abis/SimpleAccountFactoryAbi.js.map +1 -0
  18. package/dist/cjs/account/base.d.ts +49 -0
  19. package/dist/cjs/account/base.js +257 -0
  20. package/dist/cjs/account/base.js.map +1 -0
  21. package/dist/cjs/account/schema.d.ts +100 -0
  22. package/dist/cjs/account/schema.js +43 -0
  23. package/dist/cjs/account/schema.js.map +1 -0
  24. package/dist/cjs/account/simple.d.ts +14 -0
  25. package/dist/cjs/account/simple.js +119 -0
  26. package/dist/cjs/account/simple.js.map +1 -0
  27. package/dist/cjs/account/smartContractAccount.d.ts +68 -0
  28. package/dist/cjs/account/smartContractAccount.js +174 -0
  29. package/dist/cjs/account/smartContractAccount.js.map +1 -0
  30. package/dist/cjs/account/types.d.ts +30 -0
  31. package/dist/cjs/account/types.js +3 -0
  32. package/dist/cjs/account/types.js.map +1 -0
  33. package/dist/cjs/actions/bundler/estimateUserOperationGas.d.ts +8 -0
  34. package/dist/cjs/actions/bundler/estimateUserOperationGas.js +18 -0
  35. package/dist/cjs/actions/bundler/estimateUserOperationGas.js.map +1 -0
  36. package/dist/cjs/actions/bundler/getSupportedEntryPoints.d.ts +3 -0
  37. package/dist/cjs/actions/bundler/getSupportedEntryPoints.js +11 -0
  38. package/dist/cjs/actions/bundler/getSupportedEntryPoints.js.map +1 -0
  39. package/dist/cjs/actions/bundler/getUserOperationByHash.d.ts +6 -0
  40. package/dist/cjs/actions/bundler/getUserOperationByHash.js +11 -0
  41. package/dist/cjs/actions/bundler/getUserOperationByHash.js.map +1 -0
  42. package/dist/cjs/actions/bundler/getUserOperationReceipt.d.ts +6 -0
  43. package/dist/cjs/actions/bundler/getUserOperationReceipt.js +11 -0
  44. package/dist/cjs/actions/bundler/getUserOperationReceipt.js.map +1 -0
  45. package/dist/cjs/actions/bundler/sendRawUserOperation.d.ts +7 -0
  46. package/dist/cjs/actions/bundler/sendRawUserOperation.js +11 -0
  47. package/dist/cjs/actions/bundler/sendRawUserOperation.js.map +1 -0
  48. package/dist/cjs/actions/smartAccount/buildUserOperation.d.ts +5 -0
  49. package/dist/cjs/actions/smartAccount/buildUserOperation.js +25 -0
  50. package/dist/cjs/actions/smartAccount/buildUserOperation.js.map +1 -0
  51. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.d.ts +5 -0
  52. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js +39 -0
  53. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +1 -0
  54. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.d.ts +4 -0
  55. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js +62 -0
  56. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -0
  57. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +4 -0
  58. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js +34 -0
  59. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -0
  60. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.d.ts +5 -0
  61. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js +64 -0
  62. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -0
  63. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.d.ts +5 -0
  64. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js +23 -0
  65. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +1 -0
  66. package/dist/cjs/actions/smartAccount/getAddress.d.ts +4 -0
  67. package/dist/cjs/actions/smartAccount/getAddress.js +13 -0
  68. package/dist/cjs/actions/smartAccount/getAddress.js.map +1 -0
  69. package/dist/cjs/actions/smartAccount/internal/initUserOperation.d.ts +7 -0
  70. package/dist/cjs/actions/smartAccount/internal/initUserOperation.js +42 -0
  71. package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +1 -0
  72. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.d.ts +10 -0
  73. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js +47 -0
  74. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -0
  75. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.d.ts +10 -0
  76. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js +28 -0
  77. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +1 -0
  78. package/dist/cjs/actions/smartAccount/sendTransaction.d.ts +5 -0
  79. package/dist/cjs/actions/smartAccount/sendTransaction.js +35 -0
  80. package/dist/cjs/actions/smartAccount/sendTransaction.js.map +1 -0
  81. package/dist/cjs/actions/smartAccount/sendTransactions.d.ts +4 -0
  82. package/dist/cjs/actions/smartAccount/sendTransactions.js +36 -0
  83. package/dist/cjs/actions/smartAccount/sendTransactions.js.map +1 -0
  84. package/dist/cjs/actions/smartAccount/sendUserOperation.d.ts +5 -0
  85. package/dist/cjs/actions/smartAccount/sendUserOperation.js +31 -0
  86. package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +1 -0
  87. package/dist/cjs/actions/smartAccount/signMessage.d.ts +6 -0
  88. package/dist/cjs/actions/smartAccount/signMessage.js +12 -0
  89. package/dist/cjs/actions/smartAccount/signMessage.js.map +1 -0
  90. package/dist/cjs/actions/smartAccount/signMessageWith6492.d.ts +4 -0
  91. package/dist/cjs/actions/smartAccount/signMessageWith6492.js +12 -0
  92. package/dist/cjs/actions/smartAccount/signMessageWith6492.js.map +1 -0
  93. package/dist/cjs/actions/smartAccount/signTypedData.d.ts +10 -0
  94. package/dist/cjs/actions/smartAccount/signTypedData.js +12 -0
  95. package/dist/cjs/actions/smartAccount/signTypedData.js.map +1 -0
  96. package/dist/cjs/actions/smartAccount/signTypedDataWith6492.d.ts +6 -0
  97. package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js +12 -0
  98. package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js.map +1 -0
  99. package/dist/cjs/actions/smartAccount/signUserOperation.d.ts +5 -0
  100. package/dist/cjs/actions/smartAccount/signUserOperation.js +30 -0
  101. package/dist/cjs/actions/smartAccount/signUserOperation.js.map +1 -0
  102. package/dist/cjs/actions/smartAccount/types.d.ts +42 -0
  103. package/dist/cjs/actions/smartAccount/types.js +3 -0
  104. package/dist/cjs/actions/smartAccount/types.js.map +1 -0
  105. package/dist/cjs/actions/smartAccount/upgradeAccount.d.ts +4 -0
  106. package/dist/cjs/actions/smartAccount/upgradeAccount.js +38 -0
  107. package/dist/cjs/actions/smartAccount/upgradeAccount.js.map +1 -0
  108. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.d.ts +3 -0
  109. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js +36 -0
  110. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -0
  111. package/dist/cjs/chains/index.d.ts +20 -0
  112. package/dist/cjs/chains/index.js +169 -0
  113. package/dist/cjs/chains/index.js.map +1 -0
  114. package/dist/cjs/client/bundlerClient.d.ts +10 -0
  115. package/dist/cjs/client/bundlerClient.js +51 -0
  116. package/dist/cjs/client/bundlerClient.js.map +1 -0
  117. package/dist/cjs/client/decorators/bundlerClient.d.ts +41 -0
  118. package/dist/cjs/client/decorators/bundlerClient.js +17 -0
  119. package/dist/cjs/client/decorators/bundlerClient.js.map +1 -0
  120. package/dist/cjs/client/decorators/smartAccountClient.d.ts +35 -0
  121. package/dist/cjs/client/decorators/smartAccountClient.js +43 -0
  122. package/dist/cjs/client/decorators/smartAccountClient.js.map +1 -0
  123. package/dist/cjs/client/isSmartAccountClient.d.ts +5 -0
  124. package/dist/cjs/client/isSmartAccountClient.js +18 -0
  125. package/dist/cjs/client/isSmartAccountClient.js.map +1 -0
  126. package/dist/cjs/client/schema.d.ts +767 -0
  127. package/dist/cjs/client/schema.js +63 -0
  128. package/dist/cjs/client/schema.js.map +1 -0
  129. package/dist/cjs/client/smartAccountClient.d.ts +33 -0
  130. package/dist/cjs/client/smartAccountClient.js +93 -0
  131. package/dist/cjs/client/smartAccountClient.js.map +1 -0
  132. package/dist/cjs/client/types.d.ts +26 -0
  133. package/dist/cjs/client/types.js +3 -0
  134. package/dist/cjs/client/types.js.map +1 -0
  135. package/dist/cjs/ens/utils.d.ts +6 -0
  136. package/dist/cjs/ens/utils.js +53 -0
  137. package/dist/cjs/ens/utils.js.map +1 -0
  138. package/dist/cjs/entrypoint/0.6.d.ts +1029 -0
  139. package/dist/cjs/entrypoint/0.6.js +49 -0
  140. package/dist/cjs/entrypoint/0.6.js.map +1 -0
  141. package/dist/cjs/entrypoint/0.7.d.ts +792 -0
  142. package/dist/cjs/entrypoint/0.7.js +88 -0
  143. package/dist/cjs/entrypoint/0.7.js.map +1 -0
  144. package/dist/cjs/entrypoint/index.d.ts +8 -0
  145. package/dist/cjs/entrypoint/index.js +53 -0
  146. package/dist/cjs/entrypoint/index.js.map +1 -0
  147. package/dist/cjs/entrypoint/types.d.ts +46 -0
  148. package/dist/cjs/entrypoint/types.js +3 -0
  149. package/dist/cjs/entrypoint/types.js.map +1 -0
  150. package/dist/cjs/errors/account.d.ts +47 -0
  151. package/dist/cjs/errors/account.js +140 -0
  152. package/dist/cjs/errors/account.js.map +1 -0
  153. package/dist/cjs/errors/base.d.ts +18 -0
  154. package/dist/cjs/errors/base.js +39 -0
  155. package/dist/cjs/errors/base.js.map +1 -0
  156. package/dist/cjs/errors/client.d.ts +14 -0
  157. package/dist/cjs/errors/client.js +44 -0
  158. package/dist/cjs/errors/client.js.map +1 -0
  159. package/dist/cjs/errors/entrypoint.d.ts +10 -0
  160. package/dist/cjs/errors/entrypoint.js +32 -0
  161. package/dist/cjs/errors/entrypoint.js.map +1 -0
  162. package/dist/cjs/errors/signer.d.ts +5 -0
  163. package/dist/cjs/errors/signer.js +20 -0
  164. package/dist/cjs/errors/signer.js.map +1 -0
  165. package/dist/cjs/errors/transaction.d.ts +10 -0
  166. package/dist/cjs/errors/transaction.js +29 -0
  167. package/dist/cjs/errors/transaction.js.map +1 -0
  168. package/dist/cjs/errors/useroperation.d.ts +10 -0
  169. package/dist/cjs/errors/useroperation.js +34 -0
  170. package/dist/cjs/errors/useroperation.js.map +1 -0
  171. package/dist/cjs/index.d.ts +63 -0
  172. package/dist/cjs/index.js +198 -0
  173. package/dist/cjs/index.js.map +1 -0
  174. package/dist/cjs/logger.d.ts +20 -0
  175. package/dist/cjs/logger.js +60 -0
  176. package/dist/cjs/logger.js.map +1 -0
  177. package/dist/cjs/middleware/actions.d.ts +12 -0
  178. package/dist/cjs/middleware/actions.js +37 -0
  179. package/dist/cjs/middleware/actions.js.map +1 -0
  180. package/dist/cjs/middleware/defaults/feeEstimator.d.ts +3 -0
  181. package/dist/cjs/middleware/defaults/feeEstimator.js +21 -0
  182. package/dist/cjs/middleware/defaults/feeEstimator.js.map +1 -0
  183. package/dist/cjs/middleware/defaults/gasEstimator.d.ts +3 -0
  184. package/dist/cjs/middleware/defaults/gasEstimator.js +26 -0
  185. package/dist/cjs/middleware/defaults/gasEstimator.js.map +1 -0
  186. package/dist/cjs/middleware/defaults/paymasterAndData.d.ts +2 -0
  187. package/dist/cjs/middleware/defaults/paymasterAndData.js +12 -0
  188. package/dist/cjs/middleware/defaults/paymasterAndData.js.map +1 -0
  189. package/dist/cjs/middleware/defaults/userOpSigner.d.ts +2 -0
  190. package/dist/cjs/middleware/defaults/userOpSigner.js +26 -0
  191. package/dist/cjs/middleware/defaults/userOpSigner.js.map +1 -0
  192. package/dist/cjs/middleware/noopMiddleware.d.ts +2 -0
  193. package/dist/cjs/middleware/noopMiddleware.js +8 -0
  194. package/dist/cjs/middleware/noopMiddleware.js.map +1 -0
  195. package/dist/cjs/middleware/types.d.ts +21 -0
  196. package/dist/cjs/middleware/types.js +3 -0
  197. package/dist/cjs/middleware/types.js.map +1 -0
  198. package/dist/cjs/package.json +1 -0
  199. package/dist/cjs/signer/local-account.d.ts +219 -0
  200. package/dist/cjs/signer/local-account.js +56 -0
  201. package/dist/cjs/signer/local-account.js.map +1 -0
  202. package/dist/cjs/signer/schema.d.ts +4 -0
  203. package/dist/cjs/signer/schema.js +16 -0
  204. package/dist/cjs/signer/schema.js.map +1 -0
  205. package/dist/cjs/signer/types.d.ts +15 -0
  206. package/dist/cjs/signer/types.js +3 -0
  207. package/dist/cjs/signer/types.js.map +1 -0
  208. package/dist/cjs/signer/utils.d.ts +15 -0
  209. package/dist/cjs/signer/utils.js +31 -0
  210. package/dist/cjs/signer/utils.js.map +1 -0
  211. package/dist/cjs/signer/wallet-client.d.ts +217 -0
  212. package/dist/cjs/signer/wallet-client.js +58 -0
  213. package/dist/cjs/signer/wallet-client.js.map +1 -0
  214. package/dist/cjs/transport/split.d.ts +9 -0
  215. package/dist/cjs/transport/split.js +26 -0
  216. package/dist/cjs/transport/split.js.map +1 -0
  217. package/dist/cjs/types.d.ts +158 -0
  218. package/dist/cjs/types.js +3 -0
  219. package/dist/cjs/types.js.map +1 -0
  220. package/dist/cjs/utils/bigint.d.ts +10 -0
  221. package/dist/cjs/utils/bigint.js +55 -0
  222. package/dist/cjs/utils/bigint.js.map +1 -0
  223. package/dist/cjs/utils/bytes.d.ts +7 -0
  224. package/dist/cjs/utils/bytes.js +11 -0
  225. package/dist/cjs/utils/bytes.js.map +1 -0
  226. package/dist/cjs/utils/defaults.d.ts +6 -0
  227. package/dist/cjs/utils/defaults.js +59 -0
  228. package/dist/cjs/utils/defaults.js.map +1 -0
  229. package/dist/cjs/utils/index.d.ts +23 -0
  230. package/dist/cjs/utils/index.js +127 -0
  231. package/dist/cjs/utils/index.js.map +1 -0
  232. package/dist/cjs/utils/schema.d.ts +25 -0
  233. package/dist/cjs/utils/schema.js +35 -0
  234. package/dist/cjs/utils/schema.js.map +1 -0
  235. package/dist/cjs/utils/stateOverride.d.ts +4 -0
  236. package/dist/cjs/utils/stateOverride.js +52 -0
  237. package/dist/cjs/utils/stateOverride.js.map +1 -0
  238. package/dist/cjs/utils/testUtils.d.ts +6 -0
  239. package/dist/cjs/utils/testUtils.js +33 -0
  240. package/dist/cjs/utils/testUtils.js.map +1 -0
  241. package/dist/cjs/utils/types.d.ts +16 -0
  242. package/dist/cjs/utils/types.js +3 -0
  243. package/dist/cjs/utils/types.js.map +1 -0
  244. package/dist/cjs/utils/userop.d.ts +49 -0
  245. package/dist/cjs/utils/userop.js +75 -0
  246. package/dist/cjs/utils/userop.js.map +1 -0
  247. package/dist/cjs/version.d.ts +1 -0
  248. package/dist/cjs/version.js +5 -0
  249. package/dist/cjs/version.js.map +1 -0
  250. package/dist/esm/abis/EntryPointAbi_v6.d.ts +1018 -0
  251. package/dist/esm/abis/EntryPointAbi_v6.js +1310 -0
  252. package/dist/esm/abis/EntryPointAbi_v6.js.map +1 -0
  253. package/dist/esm/abis/EntryPointAbi_v7.d.ts +775 -0
  254. package/dist/esm/abis/EntryPointAbi_v7.js +658 -0
  255. package/dist/esm/abis/EntryPointAbi_v7.js.map +1 -0
  256. package/dist/esm/abis/SimpleAccountAbi_v6.d.ts +405 -0
  257. package/dist/esm/abis/SimpleAccountAbi_v6.js +525 -0
  258. package/dist/esm/abis/SimpleAccountAbi_v6.js.map +1 -0
  259. package/dist/esm/abis/SimpleAccountAbi_v7.d.ts +410 -0
  260. package/dist/esm/abis/SimpleAccountAbi_v7.js +535 -0
  261. package/dist/esm/abis/SimpleAccountAbi_v7.js.map +1 -0
  262. package/dist/esm/abis/SimpleAccountFactoryAbi.d.ts +55 -0
  263. package/dist/esm/abis/SimpleAccountFactoryAbi.js +75 -0
  264. package/dist/esm/abis/SimpleAccountFactoryAbi.js.map +1 -0
  265. package/dist/esm/account/base.d.ts +49 -0
  266. package/dist/esm/account/base.js +253 -0
  267. package/dist/esm/account/base.js.map +1 -0
  268. package/dist/esm/account/schema.d.ts +100 -0
  269. package/dist/esm/account/schema.js +35 -0
  270. package/dist/esm/account/schema.js.map +1 -0
  271. package/dist/esm/account/simple.d.ts +14 -0
  272. package/dist/esm/account/simple.js +115 -0
  273. package/dist/esm/account/simple.js.map +1 -0
  274. package/dist/esm/account/smartContractAccount.d.ts +68 -0
  275. package/dist/esm/account/smartContractAccount.js +167 -0
  276. package/dist/esm/account/smartContractAccount.js.map +1 -0
  277. package/dist/esm/account/types.d.ts +30 -0
  278. package/dist/esm/account/types.js +2 -0
  279. package/dist/esm/account/types.js.map +1 -0
  280. package/dist/esm/actions/bundler/estimateUserOperationGas.d.ts +8 -0
  281. package/dist/esm/actions/bundler/estimateUserOperationGas.js +14 -0
  282. package/dist/esm/actions/bundler/estimateUserOperationGas.js.map +1 -0
  283. package/dist/esm/actions/bundler/getSupportedEntryPoints.d.ts +3 -0
  284. package/dist/esm/actions/bundler/getSupportedEntryPoints.js +7 -0
  285. package/dist/esm/actions/bundler/getSupportedEntryPoints.js.map +1 -0
  286. package/dist/esm/actions/bundler/getUserOperationByHash.d.ts +6 -0
  287. package/dist/esm/actions/bundler/getUserOperationByHash.js +7 -0
  288. package/dist/esm/actions/bundler/getUserOperationByHash.js.map +1 -0
  289. package/dist/esm/actions/bundler/getUserOperationReceipt.d.ts +6 -0
  290. package/dist/esm/actions/bundler/getUserOperationReceipt.js +7 -0
  291. package/dist/esm/actions/bundler/getUserOperationReceipt.js.map +1 -0
  292. package/dist/esm/actions/bundler/sendRawUserOperation.d.ts +7 -0
  293. package/dist/esm/actions/bundler/sendRawUserOperation.js +7 -0
  294. package/dist/esm/actions/bundler/sendRawUserOperation.js.map +1 -0
  295. package/dist/esm/actions/smartAccount/buildUserOperation.d.ts +5 -0
  296. package/dist/esm/actions/smartAccount/buildUserOperation.js +22 -0
  297. package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -0
  298. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.d.ts +5 -0
  299. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js +36 -0
  300. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -0
  301. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.d.ts +4 -0
  302. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js +58 -0
  303. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -0
  304. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +4 -0
  305. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js +30 -0
  306. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -0
  307. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.d.ts +5 -0
  308. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js +60 -0
  309. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -0
  310. package/dist/esm/actions/smartAccount/estimateUserOperationGas.d.ts +5 -0
  311. package/dist/esm/actions/smartAccount/estimateUserOperationGas.js +20 -0
  312. package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -0
  313. package/dist/esm/actions/smartAccount/getAddress.d.ts +4 -0
  314. package/dist/esm/actions/smartAccount/getAddress.js +9 -0
  315. package/dist/esm/actions/smartAccount/getAddress.js.map +1 -0
  316. package/dist/esm/actions/smartAccount/internal/initUserOperation.d.ts +7 -0
  317. package/dist/esm/actions/smartAccount/internal/initUserOperation.js +38 -0
  318. package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -0
  319. package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.d.ts +10 -0
  320. package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js +43 -0
  321. package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -0
  322. package/dist/esm/actions/smartAccount/internal/sendUserOperation.d.ts +10 -0
  323. package/dist/esm/actions/smartAccount/internal/sendUserOperation.js +24 -0
  324. package/dist/esm/actions/smartAccount/internal/sendUserOperation.js.map +1 -0
  325. package/dist/esm/actions/smartAccount/sendTransaction.d.ts +5 -0
  326. package/dist/esm/actions/smartAccount/sendTransaction.js +31 -0
  327. package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -0
  328. package/dist/esm/actions/smartAccount/sendTransactions.d.ts +4 -0
  329. package/dist/esm/actions/smartAccount/sendTransactions.js +32 -0
  330. package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -0
  331. package/dist/esm/actions/smartAccount/sendUserOperation.d.ts +5 -0
  332. package/dist/esm/actions/smartAccount/sendUserOperation.js +27 -0
  333. package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -0
  334. package/dist/esm/actions/smartAccount/signMessage.d.ts +6 -0
  335. package/dist/esm/actions/smartAccount/signMessage.js +8 -0
  336. package/dist/esm/actions/smartAccount/signMessage.js.map +1 -0
  337. package/dist/esm/actions/smartAccount/signMessageWith6492.d.ts +4 -0
  338. package/dist/esm/actions/smartAccount/signMessageWith6492.js +8 -0
  339. package/dist/esm/actions/smartAccount/signMessageWith6492.js.map +1 -0
  340. package/dist/esm/actions/smartAccount/signTypedData.d.ts +10 -0
  341. package/dist/esm/actions/smartAccount/signTypedData.js +8 -0
  342. package/dist/esm/actions/smartAccount/signTypedData.js.map +1 -0
  343. package/dist/esm/actions/smartAccount/signTypedDataWith6492.d.ts +6 -0
  344. package/dist/esm/actions/smartAccount/signTypedDataWith6492.js +8 -0
  345. package/dist/esm/actions/smartAccount/signTypedDataWith6492.js.map +1 -0
  346. package/dist/esm/actions/smartAccount/signUserOperation.d.ts +5 -0
  347. package/dist/esm/actions/smartAccount/signUserOperation.js +26 -0
  348. package/dist/esm/actions/smartAccount/signUserOperation.js.map +1 -0
  349. package/dist/esm/actions/smartAccount/types.d.ts +42 -0
  350. package/dist/esm/actions/smartAccount/types.js +2 -0
  351. package/dist/esm/actions/smartAccount/types.js.map +1 -0
  352. package/dist/esm/actions/smartAccount/upgradeAccount.d.ts +4 -0
  353. package/dist/esm/actions/smartAccount/upgradeAccount.js +34 -0
  354. package/dist/esm/actions/smartAccount/upgradeAccount.js.map +1 -0
  355. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.d.ts +3 -0
  356. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js +32 -0
  357. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -0
  358. package/dist/esm/chains/index.d.ts +20 -0
  359. package/dist/esm/chains/index.js +166 -0
  360. package/dist/esm/chains/index.js.map +1 -0
  361. package/dist/esm/client/bundlerClient.d.ts +10 -0
  362. package/dist/esm/client/bundlerClient.js +46 -0
  363. package/dist/esm/client/bundlerClient.js.map +1 -0
  364. package/dist/esm/client/decorators/bundlerClient.d.ts +41 -0
  365. package/dist/esm/client/decorators/bundlerClient.js +13 -0
  366. package/dist/esm/client/decorators/bundlerClient.js.map +1 -0
  367. package/dist/esm/client/decorators/smartAccountClient.d.ts +35 -0
  368. package/dist/esm/client/decorators/smartAccountClient.js +40 -0
  369. package/dist/esm/client/decorators/smartAccountClient.js.map +1 -0
  370. package/dist/esm/client/isSmartAccountClient.d.ts +5 -0
  371. package/dist/esm/client/isSmartAccountClient.js +13 -0
  372. package/dist/esm/client/isSmartAccountClient.js.map +1 -0
  373. package/dist/esm/client/schema.d.ts +767 -0
  374. package/dist/esm/client/schema.js +59 -0
  375. package/dist/esm/client/schema.js.map +1 -0
  376. package/dist/esm/client/smartAccountClient.d.ts +33 -0
  377. package/dist/esm/client/smartAccountClient.js +90 -0
  378. package/dist/esm/client/smartAccountClient.js.map +1 -0
  379. package/dist/esm/client/types.d.ts +26 -0
  380. package/dist/esm/client/types.js +2 -0
  381. package/dist/esm/client/types.js.map +1 -0
  382. package/dist/esm/ens/utils.d.ts +6 -0
  383. package/dist/esm/ens/utils.js +24 -0
  384. package/dist/esm/ens/utils.js.map +1 -0
  385. package/dist/esm/entrypoint/0.6.d.ts +1029 -0
  386. package/dist/esm/entrypoint/0.6.js +47 -0
  387. package/dist/esm/entrypoint/0.6.js.map +1 -0
  388. package/dist/esm/entrypoint/0.7.d.ts +792 -0
  389. package/dist/esm/entrypoint/0.7.js +82 -0
  390. package/dist/esm/entrypoint/0.7.js.map +1 -0
  391. package/dist/esm/entrypoint/index.d.ts +8 -0
  392. package/dist/esm/entrypoint/index.js +46 -0
  393. package/dist/esm/entrypoint/index.js.map +1 -0
  394. package/dist/esm/entrypoint/types.d.ts +46 -0
  395. package/dist/esm/entrypoint/types.js +2 -0
  396. package/dist/esm/entrypoint/types.js.map +1 -0
  397. package/dist/esm/errors/account.d.ts +47 -0
  398. package/dist/esm/errors/account.js +126 -0
  399. package/dist/esm/errors/account.js.map +1 -0
  400. package/dist/esm/errors/base.d.ts +18 -0
  401. package/dist/esm/errors/base.js +35 -0
  402. package/dist/esm/errors/base.js.map +1 -0
  403. package/dist/esm/errors/client.d.ts +14 -0
  404. package/dist/esm/errors/client.js +38 -0
  405. package/dist/esm/errors/client.js.map +1 -0
  406. package/dist/esm/errors/entrypoint.d.ts +10 -0
  407. package/dist/esm/errors/entrypoint.js +27 -0
  408. package/dist/esm/errors/entrypoint.js.map +1 -0
  409. package/dist/esm/errors/signer.d.ts +5 -0
  410. package/dist/esm/errors/signer.js +16 -0
  411. package/dist/esm/errors/signer.js.map +1 -0
  412. package/dist/esm/errors/transaction.d.ts +10 -0
  413. package/dist/esm/errors/transaction.js +24 -0
  414. package/dist/esm/errors/transaction.js.map +1 -0
  415. package/dist/esm/errors/useroperation.d.ts +10 -0
  416. package/dist/esm/errors/useroperation.js +29 -0
  417. package/dist/esm/errors/useroperation.js.map +1 -0
  418. package/dist/esm/index.d.ts +63 -0
  419. package/dist/esm/index.js +48 -0
  420. package/dist/esm/index.js.map +1 -0
  421. package/dist/esm/logger.d.ts +20 -0
  422. package/dist/esm/logger.js +56 -0
  423. package/dist/esm/logger.js.map +1 -0
  424. package/dist/esm/middleware/actions.d.ts +12 -0
  425. package/dist/esm/middleware/actions.js +33 -0
  426. package/dist/esm/middleware/actions.js.map +1 -0
  427. package/dist/esm/middleware/defaults/feeEstimator.d.ts +3 -0
  428. package/dist/esm/middleware/defaults/feeEstimator.js +17 -0
  429. package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -0
  430. package/dist/esm/middleware/defaults/gasEstimator.d.ts +3 -0
  431. package/dist/esm/middleware/defaults/gasEstimator.js +22 -0
  432. package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -0
  433. package/dist/esm/middleware/defaults/paymasterAndData.d.ts +2 -0
  434. package/dist/esm/middleware/defaults/paymasterAndData.js +8 -0
  435. package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -0
  436. package/dist/esm/middleware/defaults/userOpSigner.d.ts +2 -0
  437. package/dist/esm/middleware/defaults/userOpSigner.js +22 -0
  438. package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -0
  439. package/dist/esm/middleware/noopMiddleware.d.ts +2 -0
  440. package/dist/esm/middleware/noopMiddleware.js +4 -0
  441. package/dist/esm/middleware/noopMiddleware.js.map +1 -0
  442. package/dist/esm/middleware/types.d.ts +21 -0
  443. package/dist/esm/middleware/types.js +2 -0
  444. package/dist/esm/middleware/types.js.map +1 -0
  445. package/dist/esm/package.json +1 -0
  446. package/dist/esm/signer/local-account.d.ts +219 -0
  447. package/dist/esm/signer/local-account.js +53 -0
  448. package/dist/esm/signer/local-account.js.map +1 -0
  449. package/dist/esm/signer/schema.d.ts +4 -0
  450. package/dist/esm/signer/schema.js +12 -0
  451. package/dist/esm/signer/schema.js.map +1 -0
  452. package/dist/esm/signer/types.d.ts +15 -0
  453. package/dist/esm/signer/types.js +2 -0
  454. package/dist/esm/signer/types.js.map +1 -0
  455. package/dist/esm/signer/utils.d.ts +15 -0
  456. package/dist/esm/signer/utils.js +26 -0
  457. package/dist/esm/signer/utils.js.map +1 -0
  458. package/dist/esm/signer/wallet-client.d.ts +217 -0
  459. package/dist/esm/signer/wallet-client.js +54 -0
  460. package/dist/esm/signer/wallet-client.js.map +1 -0
  461. package/dist/esm/transport/split.d.ts +9 -0
  462. package/dist/esm/transport/split.js +22 -0
  463. package/dist/esm/transport/split.js.map +1 -0
  464. package/dist/esm/types.d.ts +158 -0
  465. package/dist/esm/types.js +2 -0
  466. package/dist/esm/types.js.map +1 -0
  467. package/dist/esm/utils/bigint.d.ts +10 -0
  468. package/dist/esm/utils/bigint.js +47 -0
  469. package/dist/esm/utils/bigint.js.map +1 -0
  470. package/dist/esm/utils/bytes.d.ts +7 -0
  471. package/dist/esm/utils/bytes.js +7 -0
  472. package/dist/esm/utils/bytes.js.map +1 -0
  473. package/dist/esm/utils/defaults.d.ts +6 -0
  474. package/dist/esm/utils/defaults.js +55 -0
  475. package/dist/esm/utils/defaults.js.map +1 -0
  476. package/dist/esm/utils/index.d.ts +23 -0
  477. package/dist/esm/utils/index.js +88 -0
  478. package/dist/esm/utils/index.js.map +1 -0
  479. package/dist/esm/utils/schema.d.ts +25 -0
  480. package/dist/esm/utils/schema.js +30 -0
  481. package/dist/esm/utils/schema.js.map +1 -0
  482. package/dist/esm/utils/stateOverride.d.ts +4 -0
  483. package/dist/esm/utils/stateOverride.js +48 -0
  484. package/dist/esm/utils/stateOverride.js.map +1 -0
  485. package/dist/esm/utils/testUtils.d.ts +6 -0
  486. package/dist/esm/utils/testUtils.js +28 -0
  487. package/dist/esm/utils/testUtils.js.map +1 -0
  488. package/dist/esm/utils/types.d.ts +16 -0
  489. package/dist/esm/utils/types.js +2 -0
  490. package/dist/esm/utils/types.js.map +1 -0
  491. package/dist/esm/utils/userop.d.ts +49 -0
  492. package/dist/esm/utils/userop.js +62 -0
  493. package/dist/esm/utils/userop.js.map +1 -0
  494. package/dist/esm/version.d.ts +1 -0
  495. package/dist/esm/version.js +2 -0
  496. package/dist/esm/version.js.map +1 -0
  497. package/dist/types/abis/EntryPointAbi_v6.d.ts +1019 -0
  498. package/dist/types/abis/EntryPointAbi_v6.d.ts.map +1 -0
  499. package/dist/types/abis/EntryPointAbi_v7.d.ts +776 -0
  500. package/dist/types/abis/EntryPointAbi_v7.d.ts.map +1 -0
  501. package/dist/types/abis/SimpleAccountAbi_v6.d.ts +406 -0
  502. package/dist/types/abis/SimpleAccountAbi_v6.d.ts.map +1 -0
  503. package/dist/types/abis/SimpleAccountAbi_v7.d.ts +411 -0
  504. package/dist/types/abis/SimpleAccountAbi_v7.d.ts.map +1 -0
  505. package/dist/types/abis/SimpleAccountFactoryAbi.d.ts +56 -0
  506. package/dist/types/abis/SimpleAccountFactoryAbi.d.ts.map +1 -0
  507. package/dist/types/account/base.d.ts +128 -0
  508. package/dist/types/account/base.d.ts.map +1 -0
  509. package/dist/types/account/schema.d.ts +101 -0
  510. package/dist/types/account/schema.d.ts.map +1 -0
  511. package/dist/types/account/simple.d.ts +15 -0
  512. package/dist/types/account/simple.d.ts.map +1 -0
  513. package/dist/types/account/smartContractAccount.d.ts +69 -0
  514. package/dist/types/account/smartContractAccount.d.ts.map +1 -0
  515. package/dist/types/account/types.d.ts +144 -0
  516. package/dist/types/account/types.d.ts.map +1 -0
  517. package/dist/types/actions/bundler/estimateUserOperationGas.d.ts +9 -0
  518. package/dist/types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -0
  519. package/dist/types/actions/bundler/getSupportedEntryPoints.d.ts +4 -0
  520. package/dist/types/actions/bundler/getSupportedEntryPoints.d.ts.map +1 -0
  521. package/dist/types/actions/bundler/getUserOperationByHash.d.ts +7 -0
  522. package/dist/types/actions/bundler/getUserOperationByHash.d.ts.map +1 -0
  523. package/dist/types/actions/bundler/getUserOperationReceipt.d.ts +7 -0
  524. package/dist/types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -0
  525. package/dist/types/actions/bundler/sendRawUserOperation.d.ts +8 -0
  526. package/dist/types/actions/bundler/sendRawUserOperation.d.ts.map +1 -0
  527. package/dist/types/actions/smartAccount/buildUserOperation.d.ts +6 -0
  528. package/dist/types/actions/smartAccount/buildUserOperation.d.ts.map +1 -0
  529. package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts +45 -0
  530. package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts.map +1 -0
  531. package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts +75 -0
  532. package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -0
  533. package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +33 -0
  534. package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts.map +1 -0
  535. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts +6 -0
  536. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -0
  537. package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts +19 -0
  538. package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts.map +1 -0
  539. package/dist/types/actions/smartAccount/getAddress.d.ts +5 -0
  540. package/dist/types/actions/smartAccount/getAddress.d.ts.map +1 -0
  541. package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts +22 -0
  542. package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -0
  543. package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts +25 -0
  544. package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -0
  545. package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts +18 -0
  546. package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -0
  547. package/dist/types/actions/smartAccount/sendTransaction.d.ts +6 -0
  548. package/dist/types/actions/smartAccount/sendTransaction.d.ts.map +1 -0
  549. package/dist/types/actions/smartAccount/sendTransactions.d.ts +5 -0
  550. package/dist/types/actions/smartAccount/sendTransactions.d.ts.map +1 -0
  551. package/dist/types/actions/smartAccount/sendUserOperation.d.ts +13 -0
  552. package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -0
  553. package/dist/types/actions/smartAccount/signMessage.d.ts +7 -0
  554. package/dist/types/actions/smartAccount/signMessage.d.ts.map +1 -0
  555. package/dist/types/actions/smartAccount/signMessageWith6492.d.ts +5 -0
  556. package/dist/types/actions/smartAccount/signMessageWith6492.d.ts.map +1 -0
  557. package/dist/types/actions/smartAccount/signTypedData.d.ts +11 -0
  558. package/dist/types/actions/smartAccount/signTypedData.d.ts.map +1 -0
  559. package/dist/types/actions/smartAccount/signTypedDataWith6492.d.ts +7 -0
  560. package/dist/types/actions/smartAccount/signTypedDataWith6492.d.ts.map +1 -0
  561. package/dist/types/actions/smartAccount/signUserOperation.d.ts +6 -0
  562. package/dist/types/actions/smartAccount/signUserOperation.d.ts.map +1 -0
  563. package/dist/types/actions/smartAccount/types.d.ts +57 -0
  564. package/dist/types/actions/smartAccount/types.d.ts.map +1 -0
  565. package/dist/types/actions/smartAccount/upgradeAccount.d.ts +5 -0
  566. package/dist/types/actions/smartAccount/upgradeAccount.d.ts.map +1 -0
  567. package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts +4 -0
  568. package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts.map +1 -0
  569. package/dist/types/chains/index.d.ts +21 -0
  570. package/dist/types/chains/index.d.ts.map +1 -0
  571. package/dist/types/client/bundlerClient.d.ts +17 -0
  572. package/dist/types/client/bundlerClient.d.ts.map +1 -0
  573. package/dist/types/client/decorators/bundlerClient.d.ts +74 -0
  574. package/dist/types/client/decorators/bundlerClient.d.ts.map +1 -0
  575. package/dist/types/client/decorators/smartAccountClient.d.ts +36 -0
  576. package/dist/types/client/decorators/smartAccountClient.d.ts.map +1 -0
  577. package/dist/types/client/isSmartAccountClient.d.ts +22 -0
  578. package/dist/types/client/isSmartAccountClient.d.ts.map +1 -0
  579. package/dist/types/client/schema.d.ts +780 -0
  580. package/dist/types/client/schema.d.ts.map +1 -0
  581. package/dist/types/client/smartAccountClient.d.ts +34 -0
  582. package/dist/types/client/smartAccountClient.d.ts.map +1 -0
  583. package/dist/types/client/types.d.ts +27 -0
  584. package/dist/types/client/types.d.ts.map +1 -0
  585. package/dist/types/ens/utils.d.ts +7 -0
  586. package/dist/types/ens/utils.d.ts.map +1 -0
  587. package/dist/types/entrypoint/0.6.d.ts +1030 -0
  588. package/dist/types/entrypoint/0.6.d.ts.map +1 -0
  589. package/dist/types/entrypoint/0.7.d.ts +793 -0
  590. package/dist/types/entrypoint/0.7.d.ts.map +1 -0
  591. package/dist/types/entrypoint/index.d.ts +9 -0
  592. package/dist/types/entrypoint/index.d.ts.map +1 -0
  593. package/dist/types/entrypoint/types.d.ts +64 -0
  594. package/dist/types/entrypoint/types.d.ts.map +1 -0
  595. package/dist/types/errors/account.d.ts +48 -0
  596. package/dist/types/errors/account.d.ts.map +1 -0
  597. package/dist/types/errors/base.d.ts +19 -0
  598. package/dist/types/errors/base.d.ts.map +1 -0
  599. package/dist/types/errors/client.d.ts +15 -0
  600. package/dist/types/errors/client.d.ts.map +1 -0
  601. package/dist/types/errors/entrypoint.d.ts +11 -0
  602. package/dist/types/errors/entrypoint.d.ts.map +1 -0
  603. package/dist/types/errors/signer.d.ts +6 -0
  604. package/dist/types/errors/signer.d.ts.map +1 -0
  605. package/dist/types/errors/transaction.d.ts +11 -0
  606. package/dist/types/errors/transaction.d.ts.map +1 -0
  607. package/dist/types/errors/useroperation.d.ts +36 -0
  608. package/dist/types/errors/useroperation.d.ts.map +1 -0
  609. package/dist/types/index.d.ts +64 -0
  610. package/dist/types/index.d.ts.map +1 -0
  611. package/dist/types/logger.d.ts +21 -0
  612. package/dist/types/logger.d.ts.map +1 -0
  613. package/dist/types/middleware/actions.d.ts +27 -0
  614. package/dist/types/middleware/actions.d.ts.map +1 -0
  615. package/dist/types/middleware/defaults/feeEstimator.d.ts +4 -0
  616. package/dist/types/middleware/defaults/feeEstimator.d.ts.map +1 -0
  617. package/dist/types/middleware/defaults/gasEstimator.d.ts +12 -0
  618. package/dist/types/middleware/defaults/gasEstimator.d.ts.map +1 -0
  619. package/dist/types/middleware/defaults/paymasterAndData.d.ts +3 -0
  620. package/dist/types/middleware/defaults/paymasterAndData.d.ts.map +1 -0
  621. package/dist/types/middleware/defaults/userOpSigner.d.ts +3 -0
  622. package/dist/types/middleware/defaults/userOpSigner.d.ts.map +1 -0
  623. package/dist/types/middleware/noopMiddleware.d.ts +10 -0
  624. package/dist/types/middleware/noopMiddleware.d.ts.map +1 -0
  625. package/dist/types/middleware/types.d.ts +22 -0
  626. package/dist/types/middleware/types.d.ts.map +1 -0
  627. package/dist/types/signer/local-account.d.ts +220 -0
  628. package/dist/types/signer/local-account.d.ts.map +1 -0
  629. package/dist/types/signer/schema.d.ts +5 -0
  630. package/dist/types/signer/schema.d.ts.map +1 -0
  631. package/dist/types/signer/types.d.ts +28 -0
  632. package/dist/types/signer/types.d.ts.map +1 -0
  633. package/dist/types/signer/utils.d.ts +16 -0
  634. package/dist/types/signer/utils.d.ts.map +1 -0
  635. package/dist/types/signer/wallet-client.d.ts +218 -0
  636. package/dist/types/signer/wallet-client.d.ts.map +1 -0
  637. package/dist/types/transport/split.d.ts +42 -0
  638. package/dist/types/transport/split.d.ts.map +1 -0
  639. package/dist/types/types.d.ts +176 -0
  640. package/dist/types/types.d.ts.map +1 -0
  641. package/dist/types/utils/bigint.d.ts +56 -0
  642. package/dist/types/utils/bigint.d.ts.map +1 -0
  643. package/dist/types/utils/bytes.d.ts +17 -0
  644. package/dist/types/utils/bytes.d.ts.map +1 -0
  645. package/dist/types/utils/defaults.d.ts +15 -0
  646. package/dist/types/utils/defaults.d.ts.map +1 -0
  647. package/dist/types/utils/index.d.ts +63 -0
  648. package/dist/types/utils/index.d.ts.map +1 -0
  649. package/dist/types/utils/schema.d.ts +29 -0
  650. package/dist/types/utils/schema.d.ts.map +1 -0
  651. package/dist/types/utils/stateOverride.d.ts +5 -0
  652. package/dist/types/utils/stateOverride.d.ts.map +1 -0
  653. package/dist/types/utils/testUtils.d.ts +7 -0
  654. package/dist/types/utils/testUtils.d.ts.map +1 -0
  655. package/dist/types/utils/types.d.ts +39 -0
  656. package/dist/types/utils/types.d.ts.map +1 -0
  657. package/dist/types/utils/userop.d.ts +129 -0
  658. package/dist/types/utils/userop.d.ts.map +1 -0
  659. package/dist/types/version.d.ts +2 -0
  660. package/dist/types/version.d.ts.map +1 -0
  661. package/package.json +70 -0
  662. package/src/abis/EntryPointAbi_v6.ts +1309 -0
  663. package/src/abis/EntryPointAbi_v7.ts +658 -0
  664. package/src/abis/SimpleAccountAbi_v6.ts +524 -0
  665. package/src/abis/SimpleAccountAbi_v7.ts +534 -0
  666. package/src/abis/SimpleAccountFactoryAbi.ts +74 -0
  667. package/src/account/base.ts +415 -0
  668. package/src/account/schema.ts +51 -0
  669. package/src/account/simple.ts +215 -0
  670. package/src/account/smartContractAccount.ts +406 -0
  671. package/src/account/types.ts +184 -0
  672. package/src/actions/bundler/estimateUserOperationGas.ts +32 -0
  673. package/src/actions/bundler/getSupportedEntryPoints.ts +13 -0
  674. package/src/actions/bundler/getUserOperationByHash.ts +17 -0
  675. package/src/actions/bundler/getUserOperationReceipt.ts +17 -0
  676. package/src/actions/bundler/sendRawUserOperation.ts +20 -0
  677. package/src/actions/smartAccount/buildUserOperation.ts +52 -0
  678. package/src/actions/smartAccount/buildUserOperationFromTx.ts +112 -0
  679. package/src/actions/smartAccount/buildUserOperationFromTxs.ts +168 -0
  680. package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +86 -0
  681. package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +111 -0
  682. package/src/actions/smartAccount/estimateUserOperationGas.ts +65 -0
  683. package/src/actions/smartAccount/getAddress.ts +25 -0
  684. package/src/actions/smartAccount/internal/initUserOperation.ts +93 -0
  685. package/src/actions/smartAccount/internal/runMiddlewareStack.ts +121 -0
  686. package/src/actions/smartAccount/internal/sendUserOperation.ts +64 -0
  687. package/src/actions/smartAccount/sendTransaction.ts +73 -0
  688. package/src/actions/smartAccount/sendTransactions.ts +53 -0
  689. package/src/actions/smartAccount/sendUserOperation.ts +65 -0
  690. package/src/actions/smartAccount/signMessage.ts +28 -0
  691. package/src/actions/smartAccount/signMessageWith6492.ts +21 -0
  692. package/src/actions/smartAccount/signTypedData.ts +42 -0
  693. package/src/actions/smartAccount/signTypedDataWith6492.ts +23 -0
  694. package/src/actions/smartAccount/signUserOperation.ts +54 -0
  695. package/src/actions/smartAccount/types.ts +158 -0
  696. package/src/actions/smartAccount/upgradeAccount.ts +66 -0
  697. package/src/actions/smartAccount/waitForUserOperationTransacation.ts +58 -0
  698. package/src/chains/index.ts +194 -0
  699. package/src/client/bundlerClient.ts +107 -0
  700. package/src/client/decorators/bundlerClient.ts +129 -0
  701. package/src/client/decorators/smartAccountClient.ts +177 -0
  702. package/src/client/isSmartAccountClient.ts +53 -0
  703. package/src/client/schema.ts +92 -0
  704. package/src/client/smartAccountClient.ts +276 -0
  705. package/src/client/types.ts +51 -0
  706. package/src/ens/utils.ts +37 -0
  707. package/src/entrypoint/0.6.ts +74 -0
  708. package/src/entrypoint/0.7.ts +153 -0
  709. package/src/entrypoint/index.ts +152 -0
  710. package/src/entrypoint/types.ts +120 -0
  711. package/src/errors/account.ts +87 -0
  712. package/src/errors/base.ts +48 -0
  713. package/src/errors/client.ts +28 -0
  714. package/src/errors/entrypoint.ts +25 -0
  715. package/src/errors/signer.ts +13 -0
  716. package/src/errors/transaction.ts +16 -0
  717. package/src/errors/useroperation.ts +54 -0
  718. package/src/index.ts +172 -0
  719. package/src/logger.ts +58 -0
  720. package/src/middleware/actions.ts +92 -0
  721. package/src/middleware/defaults/feeEstimator.ts +50 -0
  722. package/src/middleware/defaults/gasEstimator.ts +66 -0
  723. package/src/middleware/defaults/paymasterAndData.ts +13 -0
  724. package/src/middleware/defaults/userOpSigner.ts +35 -0
  725. package/src/middleware/noopMiddleware.ts +12 -0
  726. package/src/middleware/types.ts +49 -0
  727. package/src/signer/local-account.ts +59 -0
  728. package/src/signer/schema.ts +16 -0
  729. package/src/signer/types.ts +46 -0
  730. package/src/signer/utils.ts +68 -0
  731. package/src/signer/wallet-client.ts +49 -0
  732. package/src/transport/split.ts +69 -0
  733. package/src/types.ts +411 -0
  734. package/src/utils/bigint.ts +118 -0
  735. package/src/utils/bytes.ts +23 -0
  736. package/src/utils/defaults.ts +93 -0
  737. package/src/utils/index.ts +173 -0
  738. package/src/utils/schema.ts +52 -0
  739. package/src/utils/stateOverride.ts +80 -0
  740. package/src/utils/testUtils.ts +42 -0
  741. package/src/utils/types.ts +94 -0
  742. package/src/utils/userop.ts +220 -0
  743. package/src/version.ts +3 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-client.js","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,GAMX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,MAAM,OAAO,kBAAkB;IAI7B,YAAY,MAAoB,EAAE,UAAkB;QAHpD;;;;;WAAmB;QACnB;;;;;WAAoB;QAUpB;;;;mBAA2C,KAAK,IAAI,EAAE;gBACpD,IAAI,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;gBAChD,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;WAAC;QAEO;;;;mBACP,KAAK,EAAE,OAAO,EAAE,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACtD,CAAC;WAAC;QAEJ;;;;mBAAgB,KAAK,EAInB,SAAwD,EAC1C,EAAE;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;gBAEhE,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;oBAC9B,OAAO;oBACP,GAAG,SAAS;iBACb,CAAC,CAAC;YACL,CAAC;WAAC;QA/BA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,sBAAsB,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CA2BF","sourcesContent":["import {\n getAddress,\n type Hex,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n type WalletClient,\n} from \"viem\";\nimport { InvalidSignerTypeError } from \"../errors/signer.js\";\nimport type { SmartAccountSigner } from \"./types\";\n\nexport class WalletClientSigner implements SmartAccountSigner<WalletClient> {\n signerType: string;\n inner: WalletClient;\n\n constructor(client: WalletClient, signerType: string) {\n this.inner = client;\n if (!signerType) {\n throw new InvalidSignerTypeError(signerType);\n }\n this.signerType = signerType;\n }\n\n getAddress: () => Promise<`0x${string}`> = async () => {\n let addresses = await this.inner.getAddresses();\n return getAddress(addresses[0]);\n };\n\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> =\n async (message) => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signMessage({ message, account });\n };\n\n signTypedData = async <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>\n ): Promise<Hex> => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signTypedData({\n account,\n ...typedData,\n });\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { type CustomTransport, type Transport } from "viem";
2
+ export interface SplitTransportParams {
3
+ overrides: {
4
+ methods: string[];
5
+ transport: Transport;
6
+ }[];
7
+ fallback: Transport;
8
+ }
9
+ export declare const split: (params: SplitTransportParams) => CustomTransport;
@@ -0,0 +1,22 @@
1
+ import { custom } from "viem";
2
+ export const split = (params) => {
3
+ const overrideMap = params.overrides.reduce((accum, curr) => {
4
+ curr.methods.forEach((method) => {
5
+ if (accum.has(method) && accum.get(method) !== curr.transport) {
6
+ throw new Error("A method cannot be handled by more than one transport");
7
+ }
8
+ accum.set(method, curr.transport);
9
+ });
10
+ return accum;
11
+ }, new Map());
12
+ return (opts) => custom({
13
+ request: async (args) => {
14
+ const transportOverride = overrideMap.get(args.method);
15
+ if (transportOverride != null) {
16
+ return transportOverride(opts).request(args);
17
+ }
18
+ return params.fallback(opts).request(args);
19
+ },
20
+ })(opts);
21
+ };
22
+ //# sourceMappingURL=split.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/transport/split.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAwC,MAAM,MAAM,CAAC;AA0CpE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,MAA4B,EAAmB,EAAE;IACrE,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;YACJ,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,IAAI,GAAG,EAAqB,CAAC,CAAC;IAEjC,OAAO,CAAC,IAAI,EAAE,EAAE,CACd,MAAM,CAAC;QACL,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvD,IAAI,iBAAiB,IAAI,IAAI,EAAE,CAAC;gBAC9B,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/C,CAAC;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC,IAAI,CAAC,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { custom, type CustomTransport, type Transport } from \"viem\";\n\nexport interface SplitTransportParams {\n overrides: {\n methods: string[];\n transport: Transport;\n }[];\n fallback: Transport;\n}\n\n/**\n * The Split Transport allows you to split RPC traffic for specific methods across\n * different RPC providers. This is done by specifying the methods you want handled\n * specially as overrides and providing a fallback transport for all other methods.\n *\n * @example\n * ```ts\n * import { createPublicClient, http } from \"viem\";\n * import { split } from \"@aa-sdk/core\";\n *\n * const bundlerMethods = [\n * \"eth_sendUserOperation\",\n * \"eth_estimateUserOperationGas\",\n * \"eth_getUserOperationReceipt\",\n * \"eth_getUserOperationByHash\",\n * \"eth_supportedEntryPoints\"\n * ];\n *\n * const clientWithSplit = createPublicClient({\n * transport: split({\n * overrides: [{\n * methods: bundlerMethods,\n * transport: http(BUNDLER_RPC_URL)\n * }]\n * fallback: http(OTHER_RPC_URL)\n * }),\n * });\n * ```\n *\n * @param params {@link SplitTransportParams} split transport configuration containing the methods overrides and fallback transport\n * @returns a {@link CustomTransport} that splits traffic\n */\nexport const split = (params: SplitTransportParams): CustomTransport => {\n const overrideMap = params.overrides.reduce((accum, curr) => {\n curr.methods.forEach((method) => {\n if (accum.has(method) && accum.get(method) !== curr.transport) {\n throw new Error(\n \"A method cannot be handled by more than one transport\"\n );\n }\n\n accum.set(method, curr.transport);\n });\n\n return accum;\n }, new Map<string, Transport>());\n\n return (opts) =>\n custom({\n request: async (args) => {\n const transportOverride = overrideMap.get(args.method);\n if (transportOverride != null) {\n return transportOverride(opts).request(args);\n }\n\n return params.fallback(opts).request(args);\n },\n })(opts);\n};\n"]}
@@ -0,0 +1,158 @@
1
+ import { type Address, type Hash, type Hex, type StateOverride, type TransactionReceipt } from "viem";
2
+ import type { z } from "zod";
3
+ import type { UserOperationFeeOptionsFieldSchema, UserOperationFeeOptionsSchema, UserOperationFeeOptionsSchema_v6, UserOperationFeeOptionsSchema_v7 } from "./client/schema";
4
+ import type { EntryPointVersion } from "./entrypoint/types";
5
+ import type { BigNumberishRangeSchema, BigNumberishSchema, MultiplierSchema, NoUndefined } from "./utils";
6
+ export type EmptyHex = `0x`;
7
+ export type NullAddress = `0x0`;
8
+ export type PromiseOrValue<T> = T | Promise<T>;
9
+ export type BytesLike = Uint8Array | Hex;
10
+ export type Multiplier = z.input<typeof MultiplierSchema>;
11
+ export type BigNumberish = z.input<typeof BigNumberishSchema>;
12
+ export type BigNumberishRange = z.input<typeof BigNumberishRangeSchema>;
13
+ export type UserOperationCallData = {
14
+ target: Address;
15
+ data: Hex;
16
+ value?: bigint;
17
+ } | Hex;
18
+ export type BatchUserOperationCallData = Exclude<UserOperationCallData, Hex>[];
19
+ export type UserOperationFeeOptionsField = z.input<typeof UserOperationFeeOptionsFieldSchema>;
20
+ export type UserOperationFeeOptions<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = TEntryPointVersion extends "0.6.0" ? z.input<typeof UserOperationFeeOptionsSchema_v6> : TEntryPointVersion extends "0.7.0" ? z.input<typeof UserOperationFeeOptionsSchema_v7> : z.input<typeof UserOperationFeeOptionsSchema>;
21
+ export type UserOperationOverridesParameter<TEntryPointVersion extends EntryPointVersion = EntryPointVersion, Required extends boolean = false> = Required extends true ? {
22
+ overrides: UserOperationOverrides<TEntryPointVersion>;
23
+ } : {
24
+ overrides?: UserOperationOverrides<TEntryPointVersion>;
25
+ };
26
+ export type UserOperationPaymasterOverrides<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = TEntryPointVersion extends "0.6.0" ? {
27
+ paymasterAndData: Hex;
28
+ } : TEntryPointVersion extends "0.7.0" ? {
29
+ paymasterData: Hex;
30
+ paymaster: Address;
31
+ paymasterVerificationGasLimit: NoUndefined<UserOperationStruct<"0.7.0">["paymasterVerificationGasLimit"]> | Multiplier;
32
+ paymasterPostOpGasLimit: NoUndefined<UserOperationStruct<"0.7.0">["paymasterPostOpGasLimit"]> | Multiplier;
33
+ } : {};
34
+ export type UserOperationOverrides<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = Partial<{
35
+ callGasLimit: UserOperationStruct<TEntryPointVersion>["callGasLimit"] | Multiplier;
36
+ maxFeePerGas: UserOperationStruct<TEntryPointVersion>["maxFeePerGas"] | Multiplier;
37
+ maxPriorityFeePerGas: UserOperationStruct<TEntryPointVersion>["maxPriorityFeePerGas"] | Multiplier;
38
+ preVerificationGas: UserOperationStruct<TEntryPointVersion>["preVerificationGas"] | Multiplier;
39
+ verificationGasLimit: UserOperationStruct<TEntryPointVersion>["verificationGasLimit"] | Multiplier;
40
+ nonceKey: bigint;
41
+ stateOverride: StateOverride;
42
+ } & UserOperationPaymasterOverrides<TEntryPointVersion>>;
43
+ export interface UserOperationRequest_v6 {
44
+ sender: Address;
45
+ nonce: Hex;
46
+ initCode: Hex | EmptyHex;
47
+ callData: Hex;
48
+ callGasLimit: Hex;
49
+ verificationGasLimit: Hex;
50
+ preVerificationGas: Hex;
51
+ maxFeePerGas: Hex;
52
+ maxPriorityFeePerGas: Hex;
53
+ paymasterAndData: Hex | EmptyHex;
54
+ signature: Hex;
55
+ }
56
+ export interface UserOperationRequest_v7 {
57
+ sender: Address;
58
+ nonce: Hex;
59
+ factory?: Address;
60
+ factoryData?: Hex;
61
+ callData: Hex;
62
+ callGasLimit: Hex;
63
+ verificationGasLimit: Hex;
64
+ preVerificationGas: Hex;
65
+ maxFeePerGas: Hex;
66
+ maxPriorityFeePerGas: Hex;
67
+ paymaster?: Address;
68
+ paymasterVerificationGasLimit?: Hex;
69
+ paymasterPostOpGasLimit?: Hex;
70
+ paymasterData?: Hex;
71
+ signature: Hex;
72
+ }
73
+ export type UserOperationRequest<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = TEntryPointVersion extends "0.6.0" ? UserOperationRequest_v6 : TEntryPointVersion extends "0.7.0" ? UserOperationRequest_v7 : never;
74
+ export interface UserOperationEstimateGasResponse<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> {
75
+ preVerificationGas: BigNumberish;
76
+ verificationGasLimit: BigNumberish;
77
+ callGasLimit: BigNumberish;
78
+ paymasterVerificationGasLimit: TEntryPointVersion extends "0.7.0" ? BigNumberish | undefined : never;
79
+ }
80
+ export interface UserOperationResponse<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> {
81
+ userOperation: UserOperationRequest<TEntryPointVersion>;
82
+ entryPoint: Address;
83
+ blockNumber: BigNumberish;
84
+ blockHash: Hash;
85
+ transactionHash: Hash;
86
+ }
87
+ export interface UserOperationReceipt {
88
+ userOpHash: Hash;
89
+ entryPoint: Address;
90
+ sender: Address;
91
+ nonce: BigNumberish;
92
+ paymaster?: Address;
93
+ actualGasCost: BigNumberish;
94
+ actualGasUsed: BigNumberish;
95
+ success: boolean;
96
+ reason?: string;
97
+ logs: string[];
98
+ receipt: TransactionReceipt;
99
+ }
100
+ export interface UserOperationReceiptObject {
101
+ blockHash: Hash;
102
+ blockNumber: BigNumberish;
103
+ transactionIndex: BigNumberish;
104
+ transactionHash: Hash;
105
+ from: Address;
106
+ to: Address;
107
+ cumulativeGasUsed: BigNumberish;
108
+ gasUsed: BigNumberish;
109
+ contractAddress: Address;
110
+ logs: UserOperationReceiptLog[];
111
+ logsBloom: Hex;
112
+ root: Hex;
113
+ status: number;
114
+ effectiveGasPrice: BigNumberish;
115
+ type: string;
116
+ }
117
+ export interface UserOperationReceiptLog {
118
+ blockHash: Hash;
119
+ blockNumber: BigNumberish;
120
+ transactionIndex: BigNumberish;
121
+ address: Address;
122
+ logIndex: BigNumberish;
123
+ data: Hex;
124
+ removed: boolean;
125
+ topics: string[];
126
+ transactionHash: Hash;
127
+ }
128
+ export interface UserOperationStruct_v6 {
129
+ sender: string;
130
+ nonce: BigNumberish;
131
+ initCode: BytesLike | "0x";
132
+ callData: BytesLike;
133
+ callGasLimit?: BigNumberish;
134
+ verificationGasLimit?: BigNumberish;
135
+ preVerificationGas?: BigNumberish;
136
+ maxFeePerGas?: BigNumberish;
137
+ maxPriorityFeePerGas?: BigNumberish;
138
+ paymasterAndData: BytesLike | "0x";
139
+ signature: BytesLike;
140
+ }
141
+ export interface UserOperationStruct_v7 {
142
+ sender: string;
143
+ nonce: BigNumberish;
144
+ factory?: string;
145
+ factoryData?: BytesLike;
146
+ callData: BytesLike;
147
+ callGasLimit?: BigNumberish;
148
+ verificationGasLimit?: BigNumberish;
149
+ preVerificationGas?: BigNumberish;
150
+ maxFeePerGas?: BigNumberish;
151
+ maxPriorityFeePerGas?: BigNumberish;
152
+ paymaster?: string;
153
+ paymasterVerificationGasLimit?: BigNumberish;
154
+ paymasterPostOpGasLimit?: BigNumberish;
155
+ paymasterData?: BytesLike;
156
+ signature: BytesLike;
157
+ }
158
+ export type UserOperationStruct<TEntryPointVersion extends EntryPointVersion = EntryPointVersion> = TEntryPointVersion extends "0.6.0" ? UserOperationStruct_v6 : TEntryPointVersion extends "0.7.0" ? UserOperationStruct_v7 : never;
@@ -0,0 +1,2 @@
1
+ import {} from "viem";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,MAAM,MAAM,CAAC","sourcesContent":["import {\n type Address,\n type Hash,\n type Hex,\n type StateOverride,\n type TransactionReceipt,\n} from \"viem\";\nimport type { z } from \"zod\";\nimport type {\n UserOperationFeeOptionsFieldSchema,\n UserOperationFeeOptionsSchema,\n UserOperationFeeOptionsSchema_v6,\n UserOperationFeeOptionsSchema_v7,\n} from \"./client/schema\";\nimport type { EntryPointVersion } from \"./entrypoint/types\";\nimport type {\n BigNumberishRangeSchema,\n BigNumberishSchema,\n MultiplierSchema,\n NoUndefined,\n} from \"./utils\";\n\nexport type EmptyHex = `0x`;\nexport type NullAddress = `0x0`;\n\n// based on @account-abstraction/common\nexport type PromiseOrValue<T> = T | Promise<T>;\nexport type BytesLike = Uint8Array | Hex;\nexport type Multiplier = z.input<typeof MultiplierSchema>;\n\nexport type BigNumberish = z.input<typeof BigNumberishSchema>;\nexport type BigNumberishRange = z.input<typeof BigNumberishRangeSchema>;\n\n// [!region UserOperationCallData]\nexport type UserOperationCallData =\n | {\n /* the target of the call */\n target: Address;\n /* the data passed to the target */\n data: Hex;\n /* the amount of native token to send to the target (default: 0) */\n value?: bigint;\n }\n | Hex;\n// [!endregion UserOperationCallData]\n\n// [!region BatchUserOperationCallData]\nexport type BatchUserOperationCallData = Exclude<UserOperationCallData, Hex>[];\n// [!endregion BatchUserOperationCallData]\n\nexport type UserOperationFeeOptionsField = z.input<\n typeof UserOperationFeeOptionsFieldSchema\n>;\n\nexport type UserOperationFeeOptions<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = TEntryPointVersion extends \"0.6.0\"\n ? z.input<typeof UserOperationFeeOptionsSchema_v6>\n : TEntryPointVersion extends \"0.7.0\"\n ? z.input<typeof UserOperationFeeOptionsSchema_v7>\n : z.input<typeof UserOperationFeeOptionsSchema>;\n\nexport type UserOperationOverridesParameter<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n Required extends boolean = false\n> = Required extends true\n ? { overrides: UserOperationOverrides<TEntryPointVersion> }\n : { overrides?: UserOperationOverrides<TEntryPointVersion> };\n\n// [!region UserOperationPaymasterOverrides]\nexport type UserOperationPaymasterOverrides<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = TEntryPointVersion extends \"0.6.0\"\n ? {\n // paymasterData overrides to bypass paymaster middleware\n paymasterAndData: Hex;\n }\n : TEntryPointVersion extends \"0.7.0\"\n ? {\n // paymasterData overrides to bypass paymaster middleware\n // if set to '0x', all paymaster related fields are omitted from the user op request\n paymasterData: Hex;\n paymaster: Address;\n paymasterVerificationGasLimit:\n | NoUndefined<\n UserOperationStruct<\"0.7.0\">[\"paymasterVerificationGasLimit\"]\n >\n | Multiplier;\n paymasterPostOpGasLimit:\n | NoUndefined<UserOperationStruct<\"0.7.0\">[\"paymasterPostOpGasLimit\"]>\n | Multiplier;\n }\n : {};\n// [!endregion UserOperationOverridesParameter]\n\n// [!region UserOperationOverrides]\nexport type UserOperationOverrides<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = Partial<\n {\n callGasLimit:\n | UserOperationStruct<TEntryPointVersion>[\"callGasLimit\"]\n | Multiplier;\n maxFeePerGas:\n | UserOperationStruct<TEntryPointVersion>[\"maxFeePerGas\"]\n | Multiplier;\n maxPriorityFeePerGas:\n | UserOperationStruct<TEntryPointVersion>[\"maxPriorityFeePerGas\"]\n | Multiplier;\n preVerificationGas:\n | UserOperationStruct<TEntryPointVersion>[\"preVerificationGas\"]\n | Multiplier;\n verificationGasLimit:\n | UserOperationStruct<TEntryPointVersion>[\"verificationGasLimit\"]\n | Multiplier;\n /**\n * This can be used to override the key used when calling `entryPoint.getNonce`\n * It is useful when you want to use parallel nonces for user operations\n *\n * NOTE: not all bundlers fully support this feature and it could be that your bundler will still only include\n * one user operation for your account in a bundle\n */\n nonceKey: bigint;\n\n /**\n * The same state overrides for\n * [`eth_call`](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-eth#eth-call) method.\n * An address-to-state mapping, where each entry specifies some state to be ephemerally overridden\n * prior to executing the call. State overrides allow you to customize the network state for\n * the purpose of the simulation, so this feature is useful when you need to estimate gas\n * for user operation scenarios under conditions that aren’t currently present on the live network.\n */\n stateOverride: StateOverride;\n } & UserOperationPaymasterOverrides<TEntryPointVersion>\n>;\n// [!endregion UserOperationOverrides]\n\n// [!region UserOperationRequest_v6]\n// represents the request as it needs to be formatted for v0.6 RPC requests\n// Reference: https://github.com/ethereum/ERCs/blob/8dd085d159cb123f545c272c0d871a5339550e79/ERCS/erc-4337.md#definitions\nexport interface UserOperationRequest_v6 {\n /* the origin of the request */\n sender: Address;\n /* nonce (as hex) of the transaction, returned from the entry point for this Address */\n nonce: Hex;\n /* the initCode for creating the sender if it does not exist yet, otherwise \"0x\" */\n initCode: Hex | EmptyHex;\n /* the callData passed to the target */\n callData: Hex;\n /* Gas value (as hex) used by inner account execution */\n callGasLimit: Hex;\n /* Actual gas (as hex) used by the validation of this UserOperation */\n verificationGasLimit: Hex;\n /* Gas overhead (as hex) of this UserOperation */\n preVerificationGas: Hex;\n /* Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) (as hex)*/\n maxFeePerGas: Hex;\n /* Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) (as hex)*/\n maxPriorityFeePerGas: Hex;\n /* Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (\"0x\" for self-sponsored transaction) */\n paymasterAndData: Hex | EmptyHex;\n /* Data passed into the account along with the nonce during the verification step */\n signature: Hex;\n}\n// [!endregion UserOperationRequest_v6]\n\n// [!region UserOperationRequest_v7]\n// represents the request as it needs to be formatted for v0.7 RPC requests\n// Reference: https://eips.ethereum.org/EIPS/eip-4337#definitions\nexport interface UserOperationRequest_v7 {\n /* the account making the operation */\n sender: Address;\n /* anti-replay parameter. nonce of the transaction, returned from the entry point for this address */\n nonce: Hex;\n /* account factory, only for new accounts */\n factory?: Address;\n /* data for account factory (only if account factory exists) */\n factoryData?: Hex;\n /* the data to pass to the sender during the main execution call */\n callData: Hex;\n /* the amount of gas to allocate the main execution call */\n callGasLimit: Hex;\n /* the amount of gas to allocate for the verification step */\n verificationGasLimit: Hex;\n /* extra gas to pay the bunder */\n preVerificationGas: Hex;\n /* maximum fee per gas (similar to EIP-1559 max_fee_per_gas) */\n maxFeePerGas: Hex;\n /* maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) */\n maxPriorityFeePerGas: Hex;\n /* address of paymaster contract, (or empty, if account pays for itself) */\n paymaster?: Address;\n /* the amount of gas to allocate for the paymaster validation code */\n paymasterVerificationGasLimit?: Hex;\n /* the amount of gas to allocate for the paymaster post-operation code */\n paymasterPostOpGasLimit?: Hex;\n /* data for paymaster (only if paymaster exists) */\n paymasterData?: Hex;\n /* data passed into the account to verify authorization */\n signature: Hex;\n}\n// [!endregion UserOperationRequest_v7]\n\n// [!region UserOperationRequest]\n// Reference: https://eips.ethereum.org/EIPS/eip-4337#definitions\nexport type UserOperationRequest<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = TEntryPointVersion extends \"0.6.0\"\n ? UserOperationRequest_v6\n : TEntryPointVersion extends \"0.7.0\"\n ? UserOperationRequest_v7\n : never;\n\n// [!endregion UserOperationRequest]\n\n// [!region UserOperationEstimateGasResponse]\nexport interface UserOperationEstimateGasResponse<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> {\n /* Gas overhead of this UserOperation */\n preVerificationGas: BigNumberish;\n /* Actual gas used by the validation of this UserOperation */\n verificationGasLimit: BigNumberish;\n /* Value used by inner account execution */\n callGasLimit: BigNumberish;\n /*\n * EntryPoint v0.7.0 operations only.\n * The amount of gas to allocate for the paymaster validation code.\n * Note: `eth_estimateUserOperationGas` does not return paymasterPostOpGasLimit.\n */\n paymasterVerificationGasLimit: TEntryPointVersion extends \"0.7.0\"\n ? BigNumberish | undefined\n : never;\n}\n// [!endregion UserOperationEstimateGasResponse]\n\n// [!region UserOperationResponse]\nexport interface UserOperationResponse<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> {\n /* the User Operation */\n userOperation: UserOperationRequest<TEntryPointVersion>;\n /* the address of the entry point contract that executed the user operation */\n entryPoint: Address;\n /* the block number the user operation was included in */\n blockNumber: BigNumberish;\n /* the hash of the block the user operation was included in */\n blockHash: Hash;\n /* the hash of the transaction that included the user operation */\n transactionHash: Hash;\n}\n// [!endregion UserOperationResponse]\n\n// [!region UserOperationReceipt]\nexport interface UserOperationReceipt {\n /* The request hash of the UserOperation. */\n userOpHash: Hash;\n /* The entry point address used for the UserOperation. */\n entryPoint: Address;\n /* The account initiating the UserOperation. */\n sender: Address;\n /* The nonce used in the UserOperation. */\n nonce: BigNumberish;\n /* The paymaster used for this UserOperation (or empty). */\n paymaster?: Address;\n /* The actual amount paid (by account or paymaster) for this UserOperation. */\n actualGasCost: BigNumberish;\n /* The total gas used by this UserOperation (including preVerification, creation, validation, and execution). */\n actualGasUsed: BigNumberish;\n /* Indicates whether the execution completed without reverting. */\n success: boolean;\n /* In case of revert, this is the revert reason. */\n reason?: string;\n /* The logs generated by this UserOperation (not including logs of other UserOperations in the same bundle). */\n logs: string[];\n /* The TransactionReceipt object for the entire bundle, not only for this UserOperation. */\n receipt: TransactionReceipt;\n}\n// [!endregion UserOperationReceipt]\n\n/** @deprecated use viem type TransactionReceipt instead */\nexport interface UserOperationReceiptObject {\n /* 32 Bytes - hash of the block where this log was in. null when its pending. null when its pending log */\n blockHash: Hash;\n /* The block number where this log was in. null when its pending. null when its pending log. */\n blockNumber: BigNumberish;\n /* The index of the transaction within the block. */\n transactionIndex: BigNumberish;\n /* 32 Bytes - hash of the transaction. null when its pending. */\n transactionHash: Hash;\n /* 20 Bytes - address of the sender */\n from: Address;\n /* 20 Bytes - address of the receiver. null when its a contract creation transaction */\n to: Address;\n /* The total amount of gas used when this transaction was executed in the block. */\n cumulativeGasUsed: BigNumberish;\n /* The amount of gas used by this specific transaction alone */\n gasUsed: BigNumberish;\n /* 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null */\n contractAddress: Address;\n logs: UserOperationReceiptLog[];\n /* 256 Bytes - Bloom filter for light clients to quickly retrieve related logs */\n logsBloom: Hex;\n /* 32 bytes of post-transaction stateroot. (pre Byzantium hard fork at block 4,370,000) */\n root: Hex;\n /* Either 1 (success) or 0 (failure). (post Byzantium hard fork at block 4,370,000) */\n status: number;\n /* The cumulative gas used in the block containing this UserOperation. */\n effectiveGasPrice: BigNumberish;\n /* The type of the recipt object */\n type: string;\n}\n\n/** @deprecated use viem type Log instead */\n/* https://github.com/wevm/viem/blob/6ef4ac131a878bf1dc4b335f5dc127e62618dda0/src/types/log.ts#L15 */\nexport interface UserOperationReceiptLog {\n /* The hash of the block where the given transaction was included. */\n blockHash: Hash;\n /* The number of the block where the given transaction was included. */\n blockNumber: BigNumberish;\n /* The index of the transaction within the block. */\n transactionIndex: BigNumberish;\n /* 20 Bytes - address from which this log originated. */\n address: Address;\n /* Integer of the log index position in the block. null when its pending log. */\n logIndex: BigNumberish;\n /* Contains one or more 32 Bytes non-indexed arguments of the log. */\n data: Hex;\n /* true when the log was removed, due to a chain reorganization. false if its a valid log. */\n removed: boolean;\n /* Array of zero to four 32 Bytes DATA of indexed log arguments. */\n topics: string[];\n /* hash of the transaction */\n transactionHash: Hash;\n}\n\n// [!region UserOperationStruct_v6]\n// https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.6/test/UserOperation.ts\n// this is used for building requests for v0.6 entry point contract\nexport interface UserOperationStruct_v6 {\n /* the origin of the request */\n sender: string;\n /* nonce of the transaction, returned from the entry point for this address */\n nonce: BigNumberish;\n /* the initCode for creating the sender if it does not exist yet, otherwise \"0x\" */\n initCode: BytesLike | \"0x\";\n /* the callData passed to the target */\n callData: BytesLike;\n /* Value used by inner account execution */\n callGasLimit?: BigNumberish;\n /* Actual gas used by the validation of this UserOperation */\n verificationGasLimit?: BigNumberish;\n /* Gas overhead of this UserOperation */\n preVerificationGas?: BigNumberish;\n /* Maximum fee per gas (similar to EIP-1559 max_fee_per_gas) */\n maxFeePerGas?: BigNumberish;\n /* Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) */\n maxPriorityFeePerGas?: BigNumberish;\n /* Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (\"0x\" for self-sponsored transaction) */\n paymasterAndData: BytesLike | \"0x\";\n /* Data passed into the account along with the nonce during the verification step */\n signature: BytesLike;\n}\n// [!endregion UserOperationStruct_v6]\n\n// [!region UserOperationStruct_v7]\n// based on https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.7/test/UserOperation.ts\n// this is used for building requests for v0.7 entry point contract\nexport interface UserOperationStruct_v7 {\n /* the account making the operation */\n sender: string;\n /* anti-replay parameter. nonce of the transaction, returned from the entry point for this address */\n nonce: BigNumberish;\n /* account factory, only for new accounts */\n factory?: string;\n /* data for account factory (only if account factory exists) */\n factoryData?: BytesLike;\n /* the data to pass to the sender during the main execution call */\n callData: BytesLike;\n /* the amount of gas to allocate the main execution call */\n callGasLimit?: BigNumberish;\n /* the amount of gas to allocate for the verification step */\n verificationGasLimit?: BigNumberish;\n /* extra gas to pay the bunder */\n preVerificationGas?: BigNumberish;\n /* maximum fee per gas (similar to EIP-1559 max_fee_per_gas) */\n maxFeePerGas?: BigNumberish;\n /* maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas) */\n maxPriorityFeePerGas?: BigNumberish;\n /* address of paymaster contract, (or empty, if account pays for itself) */\n paymaster?: string;\n /* the amount of gas to allocate for the paymaster validation code */\n paymasterVerificationGasLimit?: BigNumberish;\n /* the amount of gas to allocate for the paymaster post-operation code */\n paymasterPostOpGasLimit?: BigNumberish;\n /* data for paymaster (only if paymaster exists) */\n paymasterData?: BytesLike;\n /* data passed into the account to verify authorization */\n signature: BytesLike;\n}\n// [!endregion UserOperationStruct_v7]\n\n// [!region UserOperationStruct]\nexport type UserOperationStruct<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = TEntryPointVersion extends \"0.6.0\"\n ? UserOperationStruct_v6\n : TEntryPointVersion extends \"0.7.0\"\n ? UserOperationStruct_v7\n : never;\n// [!endregion UserOperationStruct]\n"]}
@@ -0,0 +1,10 @@
1
+ import type { BigNumberish, Multiplier } from "../types";
2
+ export declare const bigIntMax: (...args: bigint[]) => bigint;
3
+ export declare const bigIntMin: (...args: bigint[]) => bigint;
4
+ export declare const bigIntClamp: (value: BigNumberish, lower: BigNumberish | null | undefined, upper: BigNumberish | null | undefined) => bigint;
5
+ export declare enum RoundingMode {
6
+ ROUND_DOWN = 0,
7
+ ROUND_UP = 1
8
+ }
9
+ export declare const bigIntMultiply: (base: BigNumberish, multiplier: Multiplier["multiplier"], roundingMode?: RoundingMode) => bigint;
10
+ export declare const stringToIndex: (phrase: string) => bigint;
@@ -0,0 +1,47 @@
1
+ import { keccak256, toHex } from "viem";
2
+ import { isMultiplier } from "./schema.js";
3
+ export const bigIntMax = (...args) => {
4
+ if (!args.length) {
5
+ throw new Error("bigIntMax requires at least one argument");
6
+ }
7
+ return args.reduce((m, c) => (m > c ? m : c));
8
+ };
9
+ export const bigIntMin = (...args) => {
10
+ if (!args.length) {
11
+ throw new Error("bigIntMin requires at least one argument");
12
+ }
13
+ return args.reduce((m, c) => (m < c ? m : c));
14
+ };
15
+ export const bigIntClamp = (value, lower, upper) => {
16
+ lower = lower != null ? BigInt(lower) : null;
17
+ upper = upper != null ? BigInt(upper) : null;
18
+ if (upper != null && lower != null && upper < lower) {
19
+ throw new Error(`invalid range: upper bound ${upper} is less than lower bound ${lower}`);
20
+ }
21
+ let ret = BigInt(value);
22
+ if (lower != null && lower > ret) {
23
+ ret = lower;
24
+ }
25
+ if (upper != null && upper < ret) {
26
+ ret = upper;
27
+ }
28
+ return ret;
29
+ };
30
+ export var RoundingMode;
31
+ (function (RoundingMode) {
32
+ RoundingMode[RoundingMode["ROUND_DOWN"] = 0] = "ROUND_DOWN";
33
+ RoundingMode[RoundingMode["ROUND_UP"] = 1] = "ROUND_UP";
34
+ })(RoundingMode || (RoundingMode = {}));
35
+ export const bigIntMultiply = (base, multiplier, roundingMode = RoundingMode.ROUND_UP) => {
36
+ if (!isMultiplier({ multiplier })) {
37
+ throw new Error("bigIntMultiply requires a multiplier validated number as the second argument");
38
+ }
39
+ const decimalPlaces = multiplier.toString().split(".")[1]?.length ?? 0;
40
+ const val = roundingMode === RoundingMode.ROUND_UP
41
+ ? BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces) +
42
+ BigInt(10 ** decimalPlaces - 1)
43
+ : BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces);
44
+ return val / BigInt(10 ** decimalPlaces);
45
+ };
46
+ export const stringToIndex = (phrase) => BigInt(keccak256(toHex(phrase)));
47
+ //# sourceMappingURL=bigint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bigint.js","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,IAAc,EAAU,EAAE;IACrD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,C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GX;AAHD,WAAY,YAAY;IACtB,2DAAc,CAAA;IACd,uDAAY,CAAA;AACd,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAWD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,IAAkB,EAClB,UAAoC,EACpC,eAA6B,YAAY,CAAC,QAAQ,EAClD,EAAE;IACF,IAAI,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,8EAA8E,CAC/E,CAAC;IACJ,CAAC;IAGD,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;IACvE,MAAM,GAAG,GACP,YAAY,KAAK,YAAY,CAAC,QAAQ;QACpC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,GAAG,EAAE,IAAI,aAAa,CAAC;YACvD,MAAM,CAAC,EAAE,IAAI,aAAa,GAAG,CAAC,CAAC;QACjC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,GAAG,EAAE,IAAI,aAAa,CAAC,CAAC;IAE9D,OAAO,GAAG,GAAG,MAAM,CAAC,EAAE,IAAI,aAAa,CAAC,CAAC;AAC3C,CAAC,CAAC;AAkBF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAc,EAAU,EAAE,CACtD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC","sourcesContent":["import { keccak256, toHex } from \"viem\";\nimport type { BigNumberish, Multiplier } from \"../types\";\nimport { isMultiplier } from \"./schema.js\";\n\n/**\n * Returns the max bigint in a list of bigints\n *\n * @param args a list of bigints to get the max of\n * @returns the max bigint in the list\n */\nexport const bigIntMax = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMax requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m > c ? m : c));\n};\n\n/**\n * Returns the min bigint in a list of bigints\n *\n * @param args a list of bigints to get the max of\n * @returns the min bigint in the list\n */\nexport const bigIntMin = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMin requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m < c ? m : c));\n};\n\n/**\n * Given a bigint and a min-max range, returns the min-max clamped bigint value\n *\n * @param value a bigint value to clamp\n * @param lower lower bound min max tuple value\n * @param upper upper bound min max tuple value\n * @returns the clamped bigint value per given range\n */\nexport const bigIntClamp = (\n value: BigNumberish,\n lower: BigNumberish | null | undefined,\n upper: BigNumberish | null | undefined\n) => {\n lower = lower != null ? BigInt(lower) : null;\n upper = upper != null ? BigInt(upper) : null;\n\n if (upper != null && lower != null && upper < lower) {\n throw new Error(\n `invalid range: upper bound ${upper} is less than lower bound ${lower}`\n );\n }\n\n let ret = BigInt(value);\n if (lower != null && lower > ret) {\n ret = lower;\n }\n if (upper != null && upper < ret) {\n ret = upper;\n }\n return ret;\n};\n\nexport enum RoundingMode {\n ROUND_DOWN = 0,\n ROUND_UP = 1,\n}\n\n/**\n * Given a bigint and a number (which can be a float), returns the bigint value.\n * Note: this function has loss and will round down to the nearest integer.\n *\n * @param base - the number to be multiplied\n * @param multiplier - the amount to multiply by\n * @param roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP\n * @returns the bigint value of the multiplication with the number rounded by the rounding mode\n */\nexport const bigIntMultiply = (\n base: BigNumberish,\n multiplier: Multiplier[\"multiplier\"],\n roundingMode: RoundingMode = RoundingMode.ROUND_UP\n) => {\n if (!isMultiplier({ multiplier })) {\n throw new Error(\n \"bigIntMultiply requires a multiplier validated number as the second argument\"\n );\n }\n\n // Get decimal places of b. Max decimal places is defined by the MultiplerSchema.\n const decimalPlaces = multiplier.toString().split(\".\")[1]?.length ?? 0;\n const val =\n roundingMode === RoundingMode.ROUND_UP\n ? BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces) +\n BigInt(10 ** decimalPlaces - 1)\n : BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces);\n\n return val / BigInt(10 ** decimalPlaces);\n};\n\n/**\n * Useful if you want to use a string, such as a user's email address, as salt to generate a unique SmartAccount per user.\n *\n * example:\n * ```\n * const salt = stringToIndex(\"alice@example.com\");\n *\n * export const account = new SimpleSmartContractAccount({\n * index: salt,\n * // other args omitted...\n * });\n * ```\n *\n * @param phrase -- any string value.\n * @returns the bigint value of the hashed string\n */\nexport const stringToIndex = (phrase: string): bigint =>\n BigInt(keccak256(toHex(phrase)));\n"]}
@@ -0,0 +1,7 @@
1
+ import type { Hex } from "viem";
2
+ type TakeBytesOpts = {
3
+ count?: number;
4
+ offset?: number;
5
+ };
6
+ export declare const takeBytes: (bytes: Hex, opts?: TakeBytesOpts) => Hex;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ export const takeBytes = (bytes, opts = {}) => {
2
+ const { offset, count } = opts;
3
+ const start = (offset ? offset * 2 : 0) + 2;
4
+ const end = count ? start + count * 2 : undefined;
5
+ return `0x${bytes.slice(start, end)}`;
6
+ };
7
+ //# sourceMappingURL=bytes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src/utils/bytes.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,OAAsB,EAAE,EAAO,EAAE;IACrE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAElD,OAAO,KAAK,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import type { Hex } from \"viem\";\n\ntype TakeBytesOpts = {\n count?: number;\n offset?: number;\n};\n\n/**\n * Given a bytes string, returns a slice of the bytes\n *\n * @param bytes - the hex string representing bytes\n * @param opts - optional parameters for slicing the bytes\n * @param opts.offset - the offset in bytes to start slicing from\n * @param opts.count - the number of bytes to slice\n * @returns the sliced bytes\n */\nexport const takeBytes = (bytes: Hex, opts: TakeBytesOpts = {}): Hex => {\n const { offset, count } = opts;\n const start = (offset ? offset * 2 : 0) + 2; // add 2 to skip the 0x prefix\n const end = count ? start + count * 2 : undefined;\n\n return `0x${bytes.slice(start, end)}`;\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import { type Address, type Chain } from "viem";
2
+ import type { EntryPointVersion } from "../entrypoint/types.js";
3
+ import type { UserOperationFeeOptions } from "../types";
4
+ export declare const getDefaultSimpleAccountFactoryAddress: (chain: Chain, version?: EntryPointVersion) => Address;
5
+ export declare const minPriorityFeePerBidDefaults: Map<number, bigint>;
6
+ export declare const getDefaultUserOperationFeeOptions: (chain: Chain) => UserOperationFeeOptions;
@@ -0,0 +1,55 @@
1
+ import {} from "viem";
2
+ import { arbitrum, arbitrumGoerli, arbitrumSepolia, base, baseGoerli, baseSepolia, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, } from "../chains/index.js";
3
+ import { defaultEntryPointVersion } from "../entrypoint/index.js";
4
+ import { DefaultFactoryNotDefinedError } from "../errors/account.js";
5
+ export const getDefaultSimpleAccountFactoryAddress = (chain, version = defaultEntryPointVersion) => {
6
+ switch (version) {
7
+ case "0.6.0":
8
+ switch (chain.id) {
9
+ case mainnet.id:
10
+ case polygon.id:
11
+ case polygonAmoy.id:
12
+ case optimism.id:
13
+ case optimismSepolia.id:
14
+ case arbitrum.id:
15
+ case arbitrumSepolia.id:
16
+ case base.id:
17
+ case baseGoerli.id:
18
+ case baseSepolia.id:
19
+ case fraxtal.id:
20
+ case fraxtalSepolia.id:
21
+ case zora.id:
22
+ case zoraSepolia.id:
23
+ return "0x15Ba39375ee2Ab563E8873C8390be6f2E2F50232";
24
+ case sepolia.id:
25
+ case goerli.id:
26
+ case polygonMumbai.id:
27
+ case optimismGoerli.id:
28
+ case arbitrumGoerli.id:
29
+ return "0x9406Cc6185a346906296840746125a0E44976454";
30
+ default:
31
+ break;
32
+ }
33
+ break;
34
+ case "0.7.0":
35
+ switch (chain.id) {
36
+ default:
37
+ return "0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985";
38
+ }
39
+ }
40
+ throw new DefaultFactoryNotDefinedError("SimpleAccount", chain, version);
41
+ };
42
+ export const minPriorityFeePerBidDefaults = new Map([
43
+ [arbitrum.id, 10000000n],
44
+ [arbitrumGoerli.id, 10000000n],
45
+ [arbitrumSepolia.id, 10000000n],
46
+ ]);
47
+ export const getDefaultUserOperationFeeOptions = (chain) => {
48
+ return {
49
+ maxPriorityFeePerGas: {
50
+ min: minPriorityFeePerBidDefaults.get(chain.id) ?? 100000000n,
51
+ multiplier: 1.33,
52
+ },
53
+ };
54
+ };
55
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,MAAM,CAAC;AAChD,OAAO,EACL,QAAQ,EACR,cAAc,EACd,eAAe,EACf,IAAI,EACJ,UAAU,EACV,WAAW,EACX,OAAO,EACP,cAAc,EACd,MAAM,EACN,OAAO,EACP,QAAQ,EACR,cAAc,EACd,eAAe,EACf,OAAO,EACP,WAAW,EACX,aAAa,EACb,OAAO,EACP,IAAI,EACJ,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAE,6BAA6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AA4B,GAAG,IAAI,GAAG,CAAiB;IAClE,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAW,CAAC;IAC1B,CAAC,cAAc,CAAC,EAAE,EAAE,SAAW,CAAC;IAChC,CAAC,eAAe,CAAC,EAAE,EAAE,SAAW,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,KAAY,EACa,EAAE;IAC3B,OAAO;QACL,oBAAoB,EAAE;YACpB,GAAG,EAAE,4BAA4B,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,UAAY;YAC/D,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { type Address, type Chain } from \"viem\";\nimport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n zora,\n zoraSepolia,\n} from \"../chains/index.js\";\nimport { defaultEntryPointVersion } from \"../entrypoint/index.js\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { DefaultFactoryNotDefinedError } from \"../errors/account.js\";\nimport type { UserOperationFeeOptions } from \"../types\";\n\n/**\n * Utility method returning the default simple account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - {@link EntryPointVersion} value that defaults to `defaultEntryPointVersion`\n * @returns a {@link abi.Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultSimpleAccountFactoryAddress = (\n chain: Chain,\n version: EntryPointVersion = defaultEntryPointVersion\n): Address => {\n switch (version) {\n case \"0.6.0\":\n switch (chain.id) {\n case mainnet.id:\n case polygon.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n case baseGoerli.id:\n case baseSepolia.id:\n case fraxtal.id:\n case fraxtalSepolia.id:\n case zora.id:\n case zoraSepolia.id:\n return \"0x15Ba39375ee2Ab563E8873C8390be6f2E2F50232\";\n case sepolia.id:\n case goerli.id:\n case polygonMumbai.id:\n case optimismGoerli.id:\n case arbitrumGoerli.id:\n return \"0x9406Cc6185a346906296840746125a0E44976454\";\n default:\n break;\n }\n break;\n case \"0.7.0\":\n switch (chain.id) {\n default:\n return \"0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985\";\n }\n }\n\n throw new DefaultFactoryNotDefinedError(\"SimpleAccount\", chain, version);\n};\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [arbitrum.id, 10_000_000n],\n [arbitrumGoerli.id, 10_000_000n],\n [arbitrumSepolia.id, 10_000_000n],\n]);\n\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain\n): UserOperationFeeOptions => {\n return {\n maxPriorityFeePerGas: {\n min: minPriorityFeePerBidDefaults.get(chain.id) ?? 100_000_000n,\n multiplier: 1.33,\n },\n };\n};\n"]}
@@ -0,0 +1,23 @@
1
+ import type { Chain } from "viem";
2
+ import type { PromiseOrValue } from "../types.js";
3
+ import type { RecordableKeys } from "./types.js";
4
+ export declare const AlchemyChainMap: Map<number, Chain>;
5
+ export declare const getChain: (chainId: number) => Chain;
6
+ export declare const asyncPipe: <S, O, F>(...fns: ((s: S, o?: O | undefined, f?: F | undefined) => Promise<S>)[]) => (s: S, o?: O | undefined, f?: F | undefined) => Promise<S>;
7
+ export type Deferrable<T> = {
8
+ [K in keyof T]: PromiseOrValue<T[K]>;
9
+ };
10
+ export declare function resolveProperties<T>(object: Deferrable<T>): Promise<T>;
11
+ export declare function deepHexlify(obj: any): any;
12
+ export declare function defineReadOnly<T, K extends keyof T>(object: T, key: K, value: T[K]): void;
13
+ export declare function filterUndefined<T>(obj: T): T;
14
+ export declare function pick(obj: Record<string, unknown>, keys: string | string[]): {};
15
+ export declare const allEqual: (...params: any[]) => boolean;
16
+ export declare const conditionalReturn: <T>(condition: Promise<boolean>, value: () => Promise<T>) => Promise<T | undefined>;
17
+ export declare const toRecord: <T extends { [K in RecordableKeys<T>]: string | number | symbol; }, K_1 extends RecordableKeys<T>, V>(array: T[], selector: K_1, fn: (item: T) => V) => Record<T[K_1], V>;
18
+ export * from "./bigint.js";
19
+ export * from "./bytes.js";
20
+ export * from "./defaults.js";
21
+ export * from "./schema.js";
22
+ export type * from "./types.js";
23
+ export * from "./userop.js";
@@ -0,0 +1,88 @@
1
+ import { toHex } from "viem";
2
+ import * as chains from "viem/chains";
3
+ import * as alchemyChains from "../chains/index.js";
4
+ export const AlchemyChainMap = new Map(Object.values(alchemyChains).map((c) => [c.id, c]));
5
+ export const getChain = (chainId) => {
6
+ for (const chain of Object.values(chains)) {
7
+ if (chain.id === chainId) {
8
+ return AlchemyChainMap.get(chain.id) ?? chain;
9
+ }
10
+ }
11
+ throw new Error("could not find chain");
12
+ };
13
+ export const asyncPipe = (...fns) => async (s, o, f) => {
14
+ let result = s;
15
+ for (const fn of fns) {
16
+ result = await fn(result, o, f);
17
+ }
18
+ return result;
19
+ };
20
+ export async function resolveProperties(object) {
21
+ const promises = Object.keys(object).map((key) => {
22
+ const value = object[key];
23
+ return Promise.resolve(value).then((v) => ({ key: key, value: v }));
24
+ });
25
+ const results = await Promise.all(promises);
26
+ return filterUndefined(results.reduce((accum, curr) => {
27
+ accum[curr.key] = curr.value;
28
+ return accum;
29
+ }, {}));
30
+ }
31
+ export function deepHexlify(obj) {
32
+ if (typeof obj === "function") {
33
+ return undefined;
34
+ }
35
+ if (obj == null || typeof obj === "string" || typeof obj === "boolean") {
36
+ return obj;
37
+ }
38
+ else if (typeof obj === "bigint") {
39
+ return toHex(obj);
40
+ }
41
+ else if (obj._isBigNumber != null || typeof obj !== "object") {
42
+ return toHex(obj).replace(/^0x0/, "0x");
43
+ }
44
+ if (Array.isArray(obj)) {
45
+ return obj.map((member) => deepHexlify(member));
46
+ }
47
+ return Object.keys(obj).reduce((set, key) => ({
48
+ ...set,
49
+ [key]: deepHexlify(obj[key]),
50
+ }), {});
51
+ }
52
+ export function defineReadOnly(object, key, value) {
53
+ Object.defineProperty(object, key, {
54
+ enumerable: true,
55
+ value: value,
56
+ writable: false,
57
+ });
58
+ }
59
+ export function filterUndefined(obj) {
60
+ for (const key in obj) {
61
+ if (obj[key] == null) {
62
+ delete obj[key];
63
+ }
64
+ }
65
+ return obj;
66
+ }
67
+ export function pick(obj, keys) {
68
+ return Object.keys(obj)
69
+ .filter((k) => keys.includes(k))
70
+ .reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});
71
+ }
72
+ export const allEqual = (...params) => {
73
+ if (params.length === 0) {
74
+ throw new Error("no values passed in");
75
+ }
76
+ return params.every((v) => v === params[0]);
77
+ };
78
+ export const conditionalReturn = (condition, value) => condition.then((t) => (t ? value() : undefined));
79
+ export const toRecord = (array, selector, fn) => array.reduce((acc, item) => {
80
+ acc[item[selector]] = fn(item);
81
+ return acc;
82
+ }, {});
83
+ export * from "./bigint.js";
84
+ export * from "./bytes.js";
85
+ export * from "./defaults.js";
86
+ export * from "./schema.js";
87
+ export * from "./userop.js";
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AAIpD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CACpC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CACnD,CAAC;AASF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAS,EAAE;IACjD,KAAK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AAC,CAAC,CAAC;AAE9E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAKtB,KAAU,EACV,QAAW,EACX,EAAkB,EACD,EAAE,CACnB,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;IACzB,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAAqB,CAAC,CAAC;AAE5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAE5B,cAAc,aAAa,CAAC","sourcesContent":["import type { Chain } from \"viem\";\nimport { toHex } from \"viem\";\nimport * as chains from \"viem/chains\";\nimport * as alchemyChains from \"../chains/index.js\";\nimport type { PromiseOrValue } from \"../types.js\";\nimport type { RecordableKeys } from \"./types.js\";\n\nexport const AlchemyChainMap = new Map<number, Chain>(\n Object.values(alchemyChains).map((c) => [c.id, c])\n);\n\n/**\n * Utility method for converting a chainId to a {@link Chain} object\n *\n * @param chainId - the chainId to convert\n * @returns a {@link Chain} object for the given chainId\n * @throws if the chainId is not found\n */\nexport const getChain = (chainId: number): Chain => {\n for (const chain of Object.values(chains)) {\n if (chain.id === chainId) {\n return AlchemyChainMap.get(chain.id) ?? chain;\n }\n }\n throw new Error(\"could not find chain\");\n};\n\n/**\n * Utility function that allows for piping a series of async functions together\n *\n * @param fns - functions to pipe\n * @returns result of the pipe\n */\nexport const asyncPipe =\n <S, O, F>(...fns: ((s: S, o?: O, f?: F) => Promise<S>)[]) =>\n async (s: S, o?: O, f?: F) => {\n let result = s;\n for (const fn of fns) {\n result = await fn(result, o, f);\n }\n return result;\n };\n\n// based on @ethersproject/properties, but pulled in here to minize the dependency on ethers\nexport type Deferrable<T> = {\n [K in keyof T]: PromiseOrValue<T[K]>;\n};\n\n/**\n * Await all of the properties of a {@link Deferrable} object\n *\n * @param object - a {@link Deferrable} object\n * @returns the object with its properties resolved\n */\nexport async function resolveProperties<T>(object: Deferrable<T>): Promise<T> {\n const promises = Object.keys(object).map((key) => {\n const value = object[key as keyof Deferrable<T>];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n\n const results = await Promise.all(promises);\n\n return filterUndefined<T>(\n results.reduce((accum, curr) => {\n accum[curr.key as keyof T] = curr.value;\n return accum;\n }, {} as T)\n );\n}\n\n/**\n * Recursively converts all values in an object to hex strings\n *\n * @param obj - obj to deep hexlify\n * @returns object with all of its values hexlified\n */\nexport function deepHexlify(obj: any): any {\n if (typeof obj === \"function\") {\n return undefined;\n }\n if (obj == null || typeof obj === \"string\" || typeof obj === \"boolean\") {\n return obj;\n } else if (typeof obj === \"bigint\") {\n return toHex(obj);\n } else if (obj._isBigNumber != null || typeof obj !== \"object\") {\n return toHex(obj).replace(/^0x0/, \"0x\");\n }\n if (Array.isArray(obj)) {\n return obj.map((member) => deepHexlify(member));\n }\n return Object.keys(obj).reduce(\n (set, key) => ({\n ...set,\n [key]: deepHexlify(obj[key]),\n }),\n {}\n );\n}\n\n// borrowed from ethers.js\nexport function defineReadOnly<T, K extends keyof T>(\n object: T,\n key: K,\n value: T[K]\n): void {\n Object.defineProperty(object, key, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\n\nexport function filterUndefined<T>(obj: T): T {\n for (const key in obj) {\n if (obj[key] == null) {\n delete obj[key];\n }\n }\n return obj as T;\n}\n\nexport function pick(obj: Record<string, unknown>, keys: string | string[]) {\n return Object.keys(obj)\n .filter((k) => keys.includes(k))\n .reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});\n}\n\n/**\n * Utility method for checking if the passed in values are all equal (strictly)\n *\n * @param params - values to check\n * @returns a boolean indicating if all values are the same\n * @throws if no values are passed in\n */\nexport const allEqual = (...params: any[]): boolean => {\n if (params.length === 0) {\n throw new Error(\"no values passed in\");\n }\n return params.every((v) => v === params[0]);\n};\n\n/**\n * Utility method for checking the condition and return the value if condition holds true, undefined if not.\n *\n * @param condition - condition to check\n * @param value - value to return when condition holds true\n * @returns the value if condition holds true, undefined if not\n */\nexport const conditionalReturn = <T>(\n condition: Promise<boolean>,\n value: () => Promise<T>\n): Promise<T | undefined> => condition.then((t) => (t ? value() : undefined));\n\nexport const toRecord = <\n T extends { [K in RecordableKeys<T>]: string | number | symbol },\n K extends RecordableKeys<T>,\n V\n>(\n array: T[],\n selector: K,\n fn: (item: T) => V\n): Record<T[K], V> =>\n array.reduce((acc, item) => {\n acc[item[selector]] = fn(item);\n return acc;\n }, {} as Record<T[K], V>);\n\nexport * from \"./bigint.js\";\nexport * from \"./bytes.js\";\nexport * from \"./defaults.js\";\nexport * from \"./schema.js\";\nexport type * from \"./types.js\";\nexport * from \"./userop.js\";\n"]}
@@ -0,0 +1,25 @@
1
+ import { type Chain } from "viem";
2
+ import { z } from "zod";
3
+ import type { BigNumberish, Multiplier } from "../types";
4
+ export declare const ChainSchema: z.ZodType<Chain, z.ZodTypeDef, Chain>;
5
+ export declare const HexSchema: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
6
+ export declare const BigNumberishSchema: z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>;
7
+ export declare const BigNumberishRangeSchema: z.ZodObject<{
8
+ min: z.ZodOptional<z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>>;
9
+ max: z.ZodOptional<z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>>;
10
+ }, "strict", z.ZodTypeAny, {
11
+ min?: number | bigint | `0x${string}` | undefined;
12
+ max?: number | bigint | `0x${string}` | undefined;
13
+ }, {
14
+ min?: number | bigint | `0x${string}` | undefined;
15
+ max?: number | bigint | `0x${string}` | undefined;
16
+ }>;
17
+ export declare const MultiplierSchema: z.ZodObject<{
18
+ multiplier: z.ZodEffects<z.ZodNumber, number, number>;
19
+ }, "strict", z.ZodTypeAny, {
20
+ multiplier: number;
21
+ }, {
22
+ multiplier: number;
23
+ }>;
24
+ export declare function isBigNumberish(x: any): x is BigNumberish;
25
+ export declare function isMultiplier(x: any): x is Multiplier;
@@ -0,0 +1,30 @@
1
+ import { isHex } from "viem";
2
+ import { z } from "zod";
3
+ export const ChainSchema = z.custom((chain) => chain != null &&
4
+ typeof chain === "object" &&
5
+ "id" in chain &&
6
+ typeof chain.id === "number");
7
+ export const HexSchema = z.custom((val) => {
8
+ return isHex(val, { strict: true });
9
+ });
10
+ export const BigNumberishSchema = z.union([HexSchema, z.number(), z.bigint()]);
11
+ export const BigNumberishRangeSchema = z
12
+ .object({
13
+ min: BigNumberishSchema.optional(),
14
+ max: BigNumberishSchema.optional(),
15
+ })
16
+ .strict();
17
+ export const MultiplierSchema = z
18
+ .object({
19
+ multiplier: z.number().refine((n) => {
20
+ return (n.toString().split(".")[1]?.length ?? 0) <= 4;
21
+ }, { message: "Max precision is 4 decimal places" }),
22
+ })
23
+ .strict();
24
+ export function isBigNumberish(x) {
25
+ return x != null && BigNumberishSchema.safeParse(x).success;
26
+ }
27
+ export function isMultiplier(x) {
28
+ return x != null && MultiplierSchema.safeParse(x).success;
29
+ }
30
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CACjC,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,IAAI,IAAI,KAAK;IACb,OAAO,KAAK,CAAC,EAAE,KAAK,Q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chain } from \"viem\";\nimport { z } from \"zod\";\nimport type { BigNumberish, Multiplier } from \"../types\";\n\nexport const ChainSchema = z.custom<Chain>(\n (chain) =>\n chain != null &&\n typeof chain === \"object\" &&\n \"id\" in chain &&\n typeof chain.id === \"number\"\n);\n\nexport const HexSchema = z.custom<`0x${string}` | \"0x\">((val) => {\n return isHex(val, { strict: true });\n});\n\n// [!region BigNumberish]\nexport const BigNumberishSchema = z.union([HexSchema, z.number(), z.bigint()]);\n// [!endregion BigNumberish]\n\n// [!region BigNumberishRange]\nexport const BigNumberishRangeSchema = z\n .object({\n min: BigNumberishSchema.optional(),\n max: BigNumberishSchema.optional(),\n })\n .strict();\n// [!endregion BigNumberishRange]\n\n// [!region Multiplier]\nexport const MultiplierSchema = z\n .object({\n /**\n * Multiplier value with max precision of 4 decimal places\n */\n multiplier: z.number().refine(\n (n) => {\n return (n.toString().split(\".\")[1]?.length ?? 0) <= 4;\n },\n { message: \"Max precision is 4 decimal places\" }\n ),\n })\n .strict();\n// [!endregion Multiplier]\n\nexport function isBigNumberish(x: any): x is BigNumberish {\n return x != null && BigNumberishSchema.safeParse(x).success;\n}\n\nexport function isMultiplier(x: any): x is Multiplier {\n return x != null && MultiplierSchema.safeParse(x).success;\n}\n"]}