@aa-sdk/core 4.0.0-alpha.0 → 4.0.0-alpha.10

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 (342) hide show
  1. package/dist/cjs/account/smartContractAccount.d.ts +9 -3
  2. package/dist/cjs/account/smartContractAccount.js +13 -7
  3. package/dist/cjs/account/smartContractAccount.js.map +1 -1
  4. package/dist/cjs/actions/smartAccount/buildUserOperation.js.map +1 -1
  5. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
  6. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
  7. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
  8. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
  9. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
  10. package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +1 -1
  11. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
  12. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
  13. package/dist/cjs/actions/smartAccount/sendTransaction.js.map +1 -1
  14. package/dist/cjs/actions/smartAccount/sendTransactions.js.map +1 -1
  15. package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
  16. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
  17. package/dist/cjs/client/bundlerClient.js.map +1 -1
  18. package/dist/cjs/client/decorators/bundlerClient.js.map +1 -1
  19. package/dist/cjs/client/decorators/smartAccountClient.js.map +1 -1
  20. package/dist/cjs/client/isSmartAccountClient.js.map +1 -1
  21. package/dist/cjs/client/smartAccountClient.js.map +1 -1
  22. package/dist/cjs/client/types.d.ts +2 -7
  23. package/dist/cjs/client/types.js.map +1 -1
  24. package/dist/cjs/ens/utils.d.ts +1 -1
  25. package/dist/cjs/ens/utils.js +3 -3
  26. package/dist/cjs/ens/utils.js.map +1 -1
  27. package/dist/cjs/entrypoint/index.js.map +1 -1
  28. package/dist/cjs/errors/account.js.map +1 -1
  29. package/dist/cjs/errors/base.js.map +1 -1
  30. package/dist/cjs/errors/client.js.map +1 -1
  31. package/dist/cjs/errors/entrypoint.js.map +1 -1
  32. package/dist/cjs/errors/signer.js.map +1 -1
  33. package/dist/cjs/errors/transaction.js.map +1 -1
  34. package/dist/cjs/errors/useroperation.js.map +1 -1
  35. package/dist/cjs/index.d.ts +4 -7
  36. package/dist/cjs/index.js +38 -66
  37. package/dist/cjs/index.js.map +1 -1
  38. package/dist/cjs/logger.js.map +1 -1
  39. package/dist/cjs/middleware/actions.js +2 -18
  40. package/dist/cjs/middleware/actions.js.map +1 -1
  41. package/dist/cjs/middleware/defaults/feeEstimator.d.ts +1 -1
  42. package/dist/cjs/middleware/defaults/feeEstimator.js +17 -15
  43. package/dist/cjs/middleware/defaults/feeEstimator.js.map +1 -1
  44. package/dist/cjs/middleware/defaults/gasEstimator.js +4 -2
  45. package/dist/cjs/middleware/defaults/gasEstimator.js.map +1 -1
  46. package/dist/cjs/middleware/defaults/paymasterAndData.js.map +1 -1
  47. package/dist/cjs/middleware/defaults/userOpSigner.js.map +1 -1
  48. package/dist/cjs/middleware/erc7677middleware.d.ts +40 -0
  49. package/dist/cjs/middleware/erc7677middleware.js +77 -0
  50. package/dist/cjs/middleware/erc7677middleware.js.map +1 -0
  51. package/dist/cjs/middleware/noopMiddleware.d.ts +2 -1
  52. package/dist/cjs/middleware/noopMiddleware.js.map +1 -1
  53. package/dist/cjs/middleware/types.d.ts +3 -2
  54. package/dist/cjs/middleware/types.js.map +1 -1
  55. package/dist/cjs/signer/local-account.d.ts +44 -44
  56. package/dist/cjs/signer/local-account.js.map +1 -1
  57. package/dist/cjs/signer/schema.js.map +1 -1
  58. package/dist/cjs/signer/utils.d.ts +1 -9
  59. package/dist/cjs/signer/utils.js +1 -16
  60. package/dist/cjs/signer/utils.js.map +1 -1
  61. package/dist/cjs/signer/wallet-client.d.ts +44 -44
  62. package/dist/cjs/signer/wallet-client.js.map +1 -1
  63. package/dist/cjs/transport/split.js.map +1 -1
  64. package/dist/cjs/utils/bigint.js.map +1 -1
  65. package/dist/cjs/utils/bytes.js.map +1 -1
  66. package/dist/cjs/utils/defaults.d.ts +2 -4
  67. package/dist/cjs/utils/defaults.js +5 -45
  68. package/dist/cjs/utils/defaults.js.map +1 -1
  69. package/dist/cjs/utils/index.d.ts +0 -4
  70. package/dist/cjs/utils/index.js +1 -33
  71. package/dist/cjs/utils/index.js.map +1 -1
  72. package/dist/cjs/utils/types.js.map +1 -1
  73. package/dist/cjs/utils/userop.js.map +1 -1
  74. package/dist/cjs/version.d.ts +1 -1
  75. package/dist/cjs/version.js +1 -1
  76. package/dist/cjs/version.js.map +1 -1
  77. package/dist/esm/account/smartContractAccount.d.ts +9 -3
  78. package/dist/esm/account/smartContractAccount.js +8 -2
  79. package/dist/esm/account/smartContractAccount.js.map +1 -1
  80. package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -1
  81. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
  82. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
  83. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
  84. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
  85. package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
  86. package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
  87. package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
  88. package/dist/esm/actions/smartAccount/internal/sendUserOperation.js.map +1 -1
  89. package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -1
  90. package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -1
  91. package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
  92. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
  93. package/dist/esm/client/bundlerClient.js.map +1 -1
  94. package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
  95. package/dist/esm/client/decorators/smartAccountClient.js.map +1 -1
  96. package/dist/esm/client/isSmartAccountClient.js.map +1 -1
  97. package/dist/esm/client/smartAccountClient.js.map +1 -1
  98. package/dist/esm/client/types.d.ts +2 -7
  99. package/dist/esm/client/types.js.map +1 -1
  100. package/dist/esm/ens/utils.d.ts +1 -1
  101. package/dist/esm/ens/utils.js +1 -1
  102. package/dist/esm/ens/utils.js.map +1 -1
  103. package/dist/esm/entrypoint/index.js.map +1 -1
  104. package/dist/esm/errors/account.js.map +1 -1
  105. package/dist/esm/errors/base.js.map +1 -1
  106. package/dist/esm/errors/client.js.map +1 -1
  107. package/dist/esm/errors/entrypoint.js.map +1 -1
  108. package/dist/esm/errors/signer.js.map +1 -1
  109. package/dist/esm/errors/transaction.js.map +1 -1
  110. package/dist/esm/errors/useroperation.js.map +1 -1
  111. package/dist/esm/index.d.ts +4 -7
  112. package/dist/esm/index.js +3 -5
  113. package/dist/esm/index.js.map +1 -1
  114. package/dist/esm/logger.js.map +1 -1
  115. package/dist/esm/middleware/actions.js +3 -18
  116. package/dist/esm/middleware/actions.js.map +1 -1
  117. package/dist/esm/middleware/defaults/feeEstimator.d.ts +1 -1
  118. package/dist/esm/middleware/defaults/feeEstimator.js +17 -15
  119. package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
  120. package/dist/esm/middleware/defaults/gasEstimator.js +4 -2
  121. package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
  122. package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
  123. package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
  124. package/dist/esm/middleware/erc7677middleware.d.ts +40 -0
  125. package/dist/esm/middleware/erc7677middleware.js +73 -0
  126. package/dist/esm/middleware/erc7677middleware.js.map +1 -0
  127. package/dist/esm/middleware/noopMiddleware.d.ts +2 -1
  128. package/dist/esm/middleware/noopMiddleware.js.map +1 -1
  129. package/dist/esm/middleware/types.d.ts +3 -2
  130. package/dist/esm/middleware/types.js.map +1 -1
  131. package/dist/esm/signer/local-account.d.ts +44 -44
  132. package/dist/esm/signer/local-account.js.map +1 -1
  133. package/dist/esm/signer/schema.js.map +1 -1
  134. package/dist/esm/signer/utils.d.ts +1 -9
  135. package/dist/esm/signer/utils.js +0 -14
  136. package/dist/esm/signer/utils.js.map +1 -1
  137. package/dist/esm/signer/wallet-client.d.ts +44 -44
  138. package/dist/esm/signer/wallet-client.js.map +1 -1
  139. package/dist/esm/transport/split.js.map +1 -1
  140. package/dist/esm/utils/bigint.js.map +1 -1
  141. package/dist/esm/utils/bytes.js.map +1 -1
  142. package/dist/esm/utils/defaults.d.ts +2 -4
  143. package/dist/esm/utils/defaults.js +1 -40
  144. package/dist/esm/utils/defaults.js.map +1 -1
  145. package/dist/esm/utils/index.d.ts +0 -4
  146. package/dist/esm/utils/index.js +0 -18
  147. package/dist/esm/utils/index.js.map +1 -1
  148. package/dist/esm/utils/types.js.map +1 -1
  149. package/dist/esm/utils/userop.js.map +1 -1
  150. package/dist/esm/version.d.ts +1 -1
  151. package/dist/esm/version.js +1 -1
  152. package/dist/esm/version.js.map +1 -1
  153. package/dist/types/account/smartContractAccount.d.ts +58 -3
  154. package/dist/types/account/smartContractAccount.d.ts.map +1 -1
  155. package/dist/types/actions/smartAccount/buildUserOperation.d.ts +23 -0
  156. package/dist/types/actions/smartAccount/buildUserOperation.d.ts.map +1 -1
  157. package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts +33 -33
  158. package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts +43 -59
  159. package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -1
  160. package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +18 -18
  161. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts +22 -0
  162. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
  163. package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts +3 -3
  164. package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts +3 -4
  165. package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -1
  166. package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts +0 -14
  167. package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -1
  168. package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts +0 -7
  169. package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -1
  170. package/dist/types/actions/smartAccount/sendTransaction.d.ts +24 -0
  171. package/dist/types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
  172. package/dist/types/actions/smartAccount/sendTransactions.d.ts +23 -0
  173. package/dist/types/actions/smartAccount/sendTransactions.d.ts.map +1 -1
  174. package/dist/types/actions/smartAccount/sendUserOperation.d.ts +17 -3
  175. package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
  176. package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts +24 -0
  177. package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts.map +1 -1
  178. package/dist/types/client/bundlerClient.d.ts +17 -2
  179. package/dist/types/client/bundlerClient.d.ts.map +1 -1
  180. package/dist/types/client/decorators/bundlerClient.d.ts +17 -8
  181. package/dist/types/client/decorators/bundlerClient.d.ts.map +1 -1
  182. package/dist/types/client/decorators/smartAccountClient.d.ts +8 -0
  183. package/dist/types/client/decorators/smartAccountClient.d.ts.map +1 -1
  184. package/dist/types/client/isSmartAccountClient.d.ts +4 -4
  185. package/dist/types/client/smartAccountClient.d.ts.map +1 -1
  186. package/dist/types/client/types.d.ts +2 -7
  187. package/dist/types/client/types.d.ts.map +1 -1
  188. package/dist/types/ens/utils.d.ts +46 -1
  189. package/dist/types/ens/utils.d.ts.map +1 -1
  190. package/dist/types/entrypoint/index.d.ts +14 -0
  191. package/dist/types/entrypoint/index.d.ts.map +1 -1
  192. package/dist/types/errors/account.d.ts +87 -4
  193. package/dist/types/errors/account.d.ts.map +1 -1
  194. package/dist/types/errors/base.d.ts +5 -0
  195. package/dist/types/errors/base.d.ts.map +1 -1
  196. package/dist/types/errors/client.d.ts +24 -0
  197. package/dist/types/errors/client.d.ts.map +1 -1
  198. package/dist/types/errors/entrypoint.d.ts +18 -0
  199. package/dist/types/errors/entrypoint.d.ts.map +1 -1
  200. package/dist/types/errors/signer.d.ts +8 -0
  201. package/dist/types/errors/signer.d.ts.map +1 -1
  202. package/dist/types/errors/transaction.d.ts +14 -1
  203. package/dist/types/errors/transaction.d.ts.map +1 -1
  204. package/dist/types/errors/useroperation.d.ts +5 -5
  205. package/dist/types/errors/useroperation.d.ts.map +1 -1
  206. package/dist/types/index.d.ts +4 -7
  207. package/dist/types/index.d.ts.map +1 -1
  208. package/dist/types/logger.d.ts +91 -0
  209. package/dist/types/logger.d.ts.map +1 -1
  210. package/dist/types/middleware/actions.d.ts +3 -3
  211. package/dist/types/middleware/actions.d.ts.map +1 -1
  212. package/dist/types/middleware/defaults/feeEstimator.d.ts +21 -1
  213. package/dist/types/middleware/defaults/feeEstimator.d.ts.map +1 -1
  214. package/dist/types/middleware/defaults/gasEstimator.d.ts +2 -2
  215. package/dist/types/middleware/defaults/gasEstimator.d.ts.map +1 -1
  216. package/dist/types/middleware/defaults/paymasterAndData.d.ts +8 -0
  217. package/dist/types/middleware/defaults/paymasterAndData.d.ts.map +1 -1
  218. package/dist/types/middleware/defaults/userOpSigner.d.ts +10 -0
  219. package/dist/types/middleware/defaults/userOpSigner.d.ts.map +1 -1
  220. package/dist/types/middleware/erc7677middleware.d.ts +62 -0
  221. package/dist/types/middleware/erc7677middleware.d.ts.map +1 -0
  222. package/dist/types/middleware/noopMiddleware.d.ts +4 -4
  223. package/dist/types/middleware/noopMiddleware.d.ts.map +1 -1
  224. package/dist/types/middleware/types.d.ts +3 -2
  225. package/dist/types/middleware/types.d.ts.map +1 -1
  226. package/dist/types/signer/local-account.d.ts +140 -45
  227. package/dist/types/signer/local-account.d.ts.map +1 -1
  228. package/dist/types/signer/schema.d.ts +14 -0
  229. package/dist/types/signer/schema.d.ts.map +1 -1
  230. package/dist/types/signer/utils.d.ts +21 -9
  231. package/dist/types/signer/utils.d.ts.map +1 -1
  232. package/dist/types/signer/wallet-client.d.ts +136 -44
  233. package/dist/types/signer/wallet-client.d.ts.map +1 -1
  234. package/dist/types/transport/split.d.ts +2 -2
  235. package/dist/types/utils/bigint.d.ts +14 -14
  236. package/dist/types/utils/bigint.d.ts.map +1 -1
  237. package/dist/types/utils/bytes.d.ts +5 -5
  238. package/dist/types/utils/defaults.d.ts +2 -12
  239. package/dist/types/utils/defaults.d.ts.map +1 -1
  240. package/dist/types/utils/index.d.ts +66 -23
  241. package/dist/types/utils/index.d.ts.map +1 -1
  242. package/dist/types/utils/types.d.ts +2 -2
  243. package/dist/types/utils/userop.d.ts +33 -33
  244. package/dist/types/version.d.ts +1 -1
  245. package/dist/types/version.d.ts.map +1 -1
  246. package/package.json +4 -3
  247. package/src/account/smartContractAccount.ts +134 -23
  248. package/src/actions/smartAccount/buildUserOperation.ts +23 -0
  249. package/src/actions/smartAccount/buildUserOperationFromTx.ts +35 -35
  250. package/src/actions/smartAccount/buildUserOperationFromTxs.ts +44 -60
  251. package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +19 -19
  252. package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +22 -0
  253. package/src/actions/smartAccount/estimateUserOperationGas.ts +3 -3
  254. package/src/actions/smartAccount/internal/initUserOperation.ts +3 -4
  255. package/src/actions/smartAccount/internal/runMiddlewareStack.ts +0 -22
  256. package/src/actions/smartAccount/internal/sendUserOperation.ts +0 -7
  257. package/src/actions/smartAccount/sendTransaction.ts +24 -0
  258. package/src/actions/smartAccount/sendTransactions.ts +23 -0
  259. package/src/actions/smartAccount/sendUserOperation.ts +17 -3
  260. package/src/actions/smartAccount/waitForUserOperationTransacation.ts +24 -0
  261. package/src/client/bundlerClient.ts +34 -2
  262. package/src/client/decorators/bundlerClient.ts +17 -8
  263. package/src/client/decorators/smartAccountClient.ts +8 -0
  264. package/src/client/isSmartAccountClient.ts +4 -4
  265. package/src/client/smartAccountClient.ts +41 -0
  266. package/src/client/types.ts +2 -15
  267. package/src/ens/utils.ts +46 -2
  268. package/src/entrypoint/index.ts +30 -62
  269. package/src/errors/account.ts +98 -4
  270. package/src/errors/base.ts +5 -2
  271. package/src/errors/client.ts +27 -0
  272. package/src/errors/entrypoint.ts +18 -0
  273. package/src/errors/signer.ts +9 -0
  274. package/src/errors/transaction.ts +16 -1
  275. package/src/errors/useroperation.ts +5 -6
  276. package/src/index.ts +3 -36
  277. package/src/logger.ts +91 -0
  278. package/src/middleware/actions.ts +6 -27
  279. package/src/middleware/defaults/feeEstimator.ts +24 -4
  280. package/src/middleware/defaults/gasEstimator.ts +9 -5
  281. package/src/middleware/defaults/paymasterAndData.ts +8 -0
  282. package/src/middleware/defaults/userOpSigner.ts +10 -0
  283. package/src/middleware/erc7677middleware.ts +201 -0
  284. package/src/middleware/noopMiddleware.ts +6 -4
  285. package/src/middleware/types.ts +16 -7
  286. package/src/signer/local-account.ts +97 -2
  287. package/src/signer/schema.ts +14 -0
  288. package/src/signer/utils.ts +20 -32
  289. package/src/signer/wallet-client.ts +92 -0
  290. package/src/transport/split.ts +2 -2
  291. package/src/utils/bigint.ts +15 -15
  292. package/src/utils/bytes.ts +5 -5
  293. package/src/utils/defaults.ts +3 -76
  294. package/src/utils/index.ts +66 -48
  295. package/src/utils/types.ts +2 -2
  296. package/src/utils/userop.ts +33 -33
  297. package/src/version.ts +1 -1
  298. package/dist/cjs/account/base.d.ts +0 -49
  299. package/dist/cjs/account/base.js +0 -257
  300. package/dist/cjs/account/base.js.map +0 -1
  301. package/dist/cjs/account/schema.d.ts +0 -100
  302. package/dist/cjs/account/schema.js +0 -43
  303. package/dist/cjs/account/schema.js.map +0 -1
  304. package/dist/cjs/account/simple.d.ts +0 -14
  305. package/dist/cjs/account/simple.js +0 -119
  306. package/dist/cjs/account/simple.js.map +0 -1
  307. package/dist/cjs/account/types.d.ts +0 -30
  308. package/dist/cjs/account/types.js +0 -3
  309. package/dist/cjs/account/types.js.map +0 -1
  310. package/dist/cjs/chains/index.d.ts +0 -20
  311. package/dist/cjs/chains/index.js +0 -169
  312. package/dist/cjs/chains/index.js.map +0 -1
  313. package/dist/esm/account/base.d.ts +0 -49
  314. package/dist/esm/account/base.js +0 -253
  315. package/dist/esm/account/base.js.map +0 -1
  316. package/dist/esm/account/schema.d.ts +0 -100
  317. package/dist/esm/account/schema.js +0 -35
  318. package/dist/esm/account/schema.js.map +0 -1
  319. package/dist/esm/account/simple.d.ts +0 -14
  320. package/dist/esm/account/simple.js +0 -115
  321. package/dist/esm/account/simple.js.map +0 -1
  322. package/dist/esm/account/types.d.ts +0 -30
  323. package/dist/esm/account/types.js +0 -2
  324. package/dist/esm/account/types.js.map +0 -1
  325. package/dist/esm/chains/index.d.ts +0 -20
  326. package/dist/esm/chains/index.js +0 -166
  327. package/dist/esm/chains/index.js.map +0 -1
  328. package/dist/types/account/base.d.ts +0 -128
  329. package/dist/types/account/base.d.ts.map +0 -1
  330. package/dist/types/account/schema.d.ts +0 -101
  331. package/dist/types/account/schema.d.ts.map +0 -1
  332. package/dist/types/account/simple.d.ts +0 -15
  333. package/dist/types/account/simple.d.ts.map +0 -1
  334. package/dist/types/account/types.d.ts +0 -144
  335. package/dist/types/account/types.d.ts.map +0 -1
  336. package/dist/types/chains/index.d.ts +0 -21
  337. package/dist/types/chains/index.d.ts.map +0 -1
  338. package/src/account/base.ts +0 -415
  339. package/src/account/schema.ts +0 -51
  340. package/src/account/simple.ts +0 -215
  341. package/src/account/types.ts +0 -184
  342. package/src/chains/index.ts +0 -194
@@ -1,11 +1,103 @@
1
1
  import { type Hex, type SignableMessage, type TypedDataDefinition, type WalletClient } from "viem";
2
2
  import type { SmartAccountSigner } from "./types";
3
+ /**
4
+ * Represents a wallet client signer for smart accounts, providing methods to get the address, sign messages, and sign typed data.
5
+ */
3
6
  export declare class WalletClientSigner implements SmartAccountSigner<WalletClient> {
4
7
  signerType: string;
5
8
  inner: WalletClient;
9
+ /**
10
+ * Initializes a signer with a given wallet client and signer type.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { WalletClientSigner } from "@aa-sdk/core";
15
+ * import { createWalletClient, custom } from 'viem'
16
+ * import { mainnet } from 'viem/chains'
17
+ *
18
+ * const client = createWalletClient({
19
+ * chain: mainnet,
20
+ * transport: custom(window.ethereum!)
21
+ * });
22
+ *
23
+ * const signer = new WalletClientSigner(client, 'wallet');
24
+ * ```
25
+ *
26
+ * @param {WalletClient} client The wallet client to interact with
27
+ * @param {string} signerType The type of signer; must be a valid signer type, otherwise an error will be thrown
28
+ * @throws {InvalidSignerTypeError} If the signer type is invalid
29
+ */
6
30
  constructor(client: WalletClient, signerType: string);
31
+ /**
32
+ * Asynchronously retrieves addresses from the inner object and returns the first address after applying the `getAddress` function.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * import { WalletClientSigner } from "@aa-sdk/core";
37
+ * import { createWalletClient, custom } from 'viem'
38
+ * import { mainnet } from 'viem/chains'
39
+ *
40
+ * const client = createWalletClient({
41
+ * chain: mainnet,
42
+ * transport: custom(window.ethereum!)
43
+ * });
44
+ *
45
+ * const signer = new WalletClientSigner(client, 'wallet');
46
+ * console.log(await signer.getAddress());
47
+ * ```
48
+ *
49
+ * @returns {Promise<string>} A promise that resolves to the first address after being processed by the `getAddress` function.
50
+ */
7
51
  getAddress: () => Promise<`0x${string}`>;
52
+ /**
53
+ * Signs a message using the account's signing method.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * import { WalletClientSigner } from "@aa-sdk/core";
58
+ * import { createWalletClient, custom } from 'viem'
59
+ * import { mainnet } from 'viem/chains'
60
+ *
61
+ * const client = createWalletClient({
62
+ * chain: mainnet,
63
+ * transport: custom(window.ethereum!)
64
+ * });
65
+ *
66
+ * const signer = new WalletClientSigner(client, 'wallet');
67
+ * console.log(await signer.signMessage("hello"));
68
+ * ```
69
+ *
70
+ * @param {string} message the message string that needs to be signed
71
+ * @returns {Promise<string>} a promise that resolves to the signed message
72
+ */
8
73
  readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`>;
74
+ /**
75
+ * Signs the provided typed data using the account's private key.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * import { WalletClientSigner } from "@aa-sdk/core";
80
+ * import { createWalletClient, custom } from 'viem'
81
+ * import { mainnet } from 'viem/chains'
82
+ *
83
+ * const client = createWalletClient({
84
+ * chain: mainnet,
85
+ * transport: custom(window.ethereum!)
86
+ * });
87
+ *
88
+ * const signer = new WalletClientSigner(client, 'wallet');
89
+ * console.log(await signer.signTypedData({
90
+ * types: {
91
+ * "Message": [{ name: "content", type: "string" }]
92
+ * },
93
+ * primaryType: "Message",
94
+ * message: { content: "Hello" },
95
+ * }));
96
+ * ```
97
+ *
98
+ * @param {TypedDataDefinition<TTypedData, TPrimaryType>} typedData The typed data to be signed
99
+ * @returns {Promise<Hex>} A promise that resolves to a hex string representing the signed data
100
+ */
9
101
  signTypedData: <const TTypedData extends {
10
102
  [x: string]: readonly import("viem").TypedDataParameter[];
11
103
  [x: `string[${string}]`]: undefined;
@@ -33,31 +125,31 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
33
125
  [x: `bytes9[${string}]`]: undefined;
34
126
  [x: `bytes10[${string}]`]: undefined;
35
127
  [x: `bytes25[${string}]`]: undefined;
128
+ [x: `bytes31[${string}]`]: undefined;
129
+ [x: `bytes30[${string}]`]: undefined;
130
+ [x: `bytes29[${string}]`]: undefined;
131
+ [x: `bytes28[${string}]`]: undefined;
132
+ [x: `bytes27[${string}]`]: undefined;
133
+ [x: `bytes26[${string}]`]: undefined;
134
+ [x: `bytes24[${string}]`]: undefined;
135
+ [x: `bytes23[${string}]`]: undefined;
136
+ [x: `bytes22[${string}]`]: undefined;
137
+ [x: `bytes21[${string}]`]: undefined;
138
+ [x: `bytes20[${string}]`]: undefined;
139
+ [x: `bytes19[${string}]`]: undefined;
36
140
  [x: `bytes18[${string}]`]: undefined;
37
- [x: `bytes12[${string}]`]: undefined;
38
- [x: `bytes13[${string}]`]: undefined;
39
- [x: `bytes14[${string}]`]: undefined;
40
- [x: `bytes15[${string}]`]: undefined;
41
- [x: `bytes16[${string}]`]: undefined;
42
141
  [x: `bytes17[${string}]`]: undefined;
43
- [x: `bytes19[${string}]`]: undefined;
44
- [x: `bytes20[${string}]`]: undefined;
45
- [x: `bytes21[${string}]`]: undefined;
46
- [x: `bytes22[${string}]`]: undefined;
47
- [x: `bytes23[${string}]`]: undefined;
48
- [x: `bytes24[${string}]`]: undefined;
49
- [x: `bytes26[${string}]`]: undefined;
50
- [x: `bytes27[${string}]`]: undefined;
51
- [x: `bytes28[${string}]`]: undefined;
52
- [x: `bytes29[${string}]`]: undefined;
53
- [x: `bytes30[${string}]`]: undefined;
54
- [x: `bytes31[${string}]`]: undefined;
142
+ [x: `bytes16[${string}]`]: undefined;
143
+ [x: `bytes15[${string}]`]: undefined;
144
+ [x: `bytes14[${string}]`]: undefined;
145
+ [x: `bytes13[${string}]`]: undefined;
146
+ [x: `bytes12[${string}]`]: undefined;
55
147
  [x: `int[${string}]`]: undefined;
56
148
  [x: `int8[${string}]`]: undefined;
57
- [x: `int16[${string}]`]: undefined;
58
- [x: `int24[${string}]`]: undefined;
59
- [x: `int32[${string}]`]: undefined;
60
149
  [x: `int40[${string}]`]: undefined;
150
+ [x: `int32[${string}]`]: undefined;
151
+ [x: `int24[${string}]`]: undefined;
152
+ [x: `int16[${string}]`]: undefined;
61
153
  [x: `int48[${string}]`]: undefined;
62
154
  [x: `int56[${string}]`]: undefined;
63
155
  [x: `int64[${string}]`]: undefined;
@@ -86,9 +178,9 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
86
178
  [x: `int248[${string}]`]: undefined;
87
179
  [x: `int256[${string}]`]: undefined;
88
180
  [x: `uint[${string}]`]: undefined;
89
- [x: `uint16[${string}]`]: undefined;
90
- [x: `uint24[${string}]`]: undefined;
91
181
  [x: `uint40[${string}]`]: undefined;
182
+ [x: `uint24[${string}]`]: undefined;
183
+ [x: `uint16[${string}]`]: undefined;
92
184
  [x: `uint56[${string}]`]: undefined;
93
185
  [x: `uint72[${string}]`]: undefined;
94
186
  [x: `uint80[${string}]`]: undefined;
@@ -135,30 +227,30 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
135
227
  bytes9?: undefined;
136
228
  bytes10?: undefined;
137
229
  bytes25?: undefined;
230
+ bytes31?: undefined;
231
+ bytes30?: undefined;
232
+ bytes29?: undefined;
233
+ bytes28?: undefined;
234
+ bytes27?: undefined;
235
+ bytes26?: undefined;
236
+ bytes24?: undefined;
237
+ bytes23?: undefined;
238
+ bytes22?: undefined;
239
+ bytes21?: undefined;
240
+ bytes20?: undefined;
241
+ bytes19?: undefined;
138
242
  bytes18?: undefined;
139
- bytes12?: undefined;
140
- bytes13?: undefined;
141
- bytes14?: undefined;
142
- bytes15?: undefined;
143
- bytes16?: undefined;
144
243
  bytes17?: undefined;
145
- bytes19?: undefined;
146
- bytes20?: undefined;
147
- bytes21?: undefined;
148
- bytes22?: undefined;
149
- bytes23?: undefined;
150
- bytes24?: undefined;
151
- bytes26?: undefined;
152
- bytes27?: undefined;
153
- bytes28?: undefined;
154
- bytes29?: undefined;
155
- bytes30?: undefined;
156
- bytes31?: undefined;
244
+ bytes16?: undefined;
245
+ bytes15?: undefined;
246
+ bytes14?: undefined;
247
+ bytes13?: undefined;
248
+ bytes12?: undefined;
157
249
  int8?: undefined;
158
- int16?: undefined;
159
- int24?: undefined;
160
- int32?: undefined;
161
250
  int40?: undefined;
251
+ int32?: undefined;
252
+ int24?: undefined;
253
+ int16?: undefined;
162
254
  int48?: undefined;
163
255
  int56?: undefined;
164
256
  int64?: undefined;
@@ -186,9 +278,9 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
186
278
  int240?: undefined;
187
279
  int248?: undefined;
188
280
  int256?: undefined;
189
- uint16?: undefined;
190
- uint24?: undefined;
191
281
  uint40?: undefined;
282
+ uint24?: undefined;
283
+ uint16?: undefined;
192
284
  uint56?: undefined;
193
285
  uint72?: undefined;
194
286
  uint80?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-client.d.ts","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,eAAe,EAEpB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,qBAAa,kBAAmB,YAAW,kBAAkB,CAAC,YAAY,CAAC;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;gBAER,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM;IAQpD,UAAU,EAAE,MAAM,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAGtC;IAEF,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAKtE;IAEJ,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0GAKV,QAAQ,GAAG,CAAC,CAOb;CACH"}
1
+ {"version":3,"file":"wallet-client.d.ts","sourceRoot":"","sources":["../../../src/signer/wallet-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,eAAe,EAEpB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;GAEG;AACH,qBAAa,kBAAmB,YAAW,kBAAkB,CAAC,YAAY,CAAC;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IAEpB;;;;;;;;;;;;;;;;;;;;OAoBG;gBACS,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM;IAQpD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAGtC;IAEF;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAKtE;IAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0GAKV,QAAQ,GAAG,CAAC,CAOb;CACH"}
@@ -35,8 +35,8 @@ export interface SplitTransportParams {
35
35
  * });
36
36
  * ```
37
37
  *
38
- * @param params {@link SplitTransportParams} split transport configuration containing the methods overrides and fallback transport
39
- * @returns a {@link CustomTransport} that splits traffic
38
+ * @param {SplitTransportParams} params split transport configuration containing the methods overrides and fallback transport
39
+ * @returns {CustomTransport} a viem Transport that splits traffic
40
40
  */
41
41
  export declare const split: (params: SplitTransportParams) => CustomTransport;
42
42
  //# sourceMappingURL=split.d.ts.map
@@ -2,24 +2,24 @@ import type { BigNumberish, Multiplier } from "../types";
2
2
  /**
3
3
  * Returns the max bigint in a list of bigints
4
4
  *
5
- * @param args a list of bigints to get the max of
6
- * @returns the max bigint in the list
5
+ * @param {bigint[]} args a list of bigints to get the max of
6
+ * @returns {bigint} the max bigint in the list
7
7
  */
8
8
  export declare const bigIntMax: (...args: bigint[]) => bigint;
9
9
  /**
10
10
  * Returns the min bigint in a list of bigints
11
11
  *
12
- * @param args a list of bigints to get the max of
13
- * @returns the min bigint in the list
12
+ * @param {bigint[]} args a list of bigints to get the max of
13
+ * @returns {bigint} the min bigint in the list
14
14
  */
15
15
  export declare const bigIntMin: (...args: bigint[]) => bigint;
16
16
  /**
17
17
  * Given a bigint and a min-max range, returns the min-max clamped bigint value
18
18
  *
19
- * @param value a bigint value to clamp
20
- * @param lower lower bound min max tuple value
21
- * @param upper upper bound min max tuple value
22
- * @returns the clamped bigint value per given range
19
+ * @param {BigNumberish} value a bigint value to clamp
20
+ * @param {BigNumberish | undefined} lower lower bound min max tuple value
21
+ * @param {BigNumberish | undefined} upper upper bound min max tuple value
22
+ * @returns {bigint} the clamped bigint value per given range
23
23
  */
24
24
  export declare const bigIntClamp: (value: BigNumberish, lower: BigNumberish | null | undefined, upper: BigNumberish | null | undefined) => bigint;
25
25
  export declare enum RoundingMode {
@@ -30,10 +30,10 @@ export declare enum RoundingMode {
30
30
  * Given a bigint and a number (which can be a float), returns the bigint value.
31
31
  * Note: this function has loss and will round down to the nearest integer.
32
32
  *
33
- * @param base - the number to be multiplied
34
- * @param multiplier - the amount to multiply by
35
- * @param roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP
36
- * @returns the bigint value of the multiplication with the number rounded by the rounding mode
33
+ * @param {BigNumberish} base - the number to be multiplied
34
+ * @param {number} multiplier - the amount to multiply by
35
+ * @param {RoundingMode} roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP
36
+ * @returns {bigint} the bigint value of the multiplication with the number rounded by the rounding mode
37
37
  */
38
38
  export declare const bigIntMultiply: (base: BigNumberish, multiplier: Multiplier["multiplier"], roundingMode?: RoundingMode) => bigint;
39
39
  /**
@@ -49,8 +49,8 @@ export declare const bigIntMultiply: (base: BigNumberish, multiplier: Multiplier
49
49
  * });
50
50
  * ```
51
51
  *
52
- * @param phrase -- any string value.
53
- * @returns the bigint value of the hashed string
52
+ * @param {string} phrase -- any string value.
53
+ * @returns {bigint} the bigint value of the hashed string
54
54
  */
55
55
  export declare const stringToIndex: (phrase: string) => bigint;
56
56
  //# sourceMappingURL=bigint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGzD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAa,MAAM,EAAE,KAAG,MAM7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAa,MAAM,EAAE,KAAG,MAM7C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,UACf,YAAY,SACZ,YAAY,GAAG,IAAI,GAAG,SAAS,SAC/B,YAAY,GAAG,IAAI,GAAG,SAAS,WAmBvC,CAAC;AAEF,oBAAY,YAAY;IACtB,UAAU,IAAI;IACd,QAAQ,IAAI;CACb;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,SACnB,YAAY,cACN,UAAU,CAAC,YAAY,CAAC,iBACtB,YAAY,WAiB3B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,KAAG,MACb,CAAC"}
1
+ {"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGzD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAa,MAAM,EAAE,KAAG,MAM7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,YAAa,MAAM,EAAE,KAAG,MAM7C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,UACf,YAAY,SACZ,YAAY,GAAG,IAAI,GAAG,SAAS,SAC/B,YAAY,GAAG,IAAI,GAAG,SAAS,KACrC,MAkBF,CAAC;AAEF,oBAAY,YAAY;IACtB,UAAU,IAAI;IACd,QAAQ,IAAI;CACb;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,SACnB,YAAY,cACN,UAAU,CAAC,YAAY,CAAC,iBACtB,YAAY,WAiB3B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,KAAG,MACb,CAAC"}
@@ -6,11 +6,11 @@ type TakeBytesOpts = {
6
6
  /**
7
7
  * Given a bytes string, returns a slice of the bytes
8
8
  *
9
- * @param bytes - the hex string representing bytes
10
- * @param opts - optional parameters for slicing the bytes
11
- * @param opts.offset - the offset in bytes to start slicing from
12
- * @param opts.count - the number of bytes to slice
13
- * @returns the sliced bytes
9
+ * @param {Hex} bytes - the hex string representing bytes
10
+ * @param {TakeBytesOpts} opts - optional parameters for slicing the bytes
11
+ * @param {number} opts.offset - the offset in bytes to start slicing from
12
+ * @param {number} opts.count - the number of bytes to slice
13
+ * @returns {Hex} the sliced bytes
14
14
  */
15
15
  export declare const takeBytes: (bytes: Hex, opts?: TakeBytesOpts) => Hex;
16
16
  export {};
@@ -1,15 +1,5 @@
1
- import { type Address, type Chain } from "viem";
2
- import type { EntryPointVersion } from "../entrypoint/types.js";
3
- import type { UserOperationFeeOptions } from "../types";
4
- /**
5
- * Utility method returning the default simple account factory address given a {@link Chain} object
6
- *
7
- * @param chain - a {@link Chain} object
8
- * @param version - {@link EntryPointVersion} value that defaults to `defaultEntryPointVersion`
9
- * @returns a {@link abi.Address} for the given chain
10
- * @throws if the chain doesn't have an address currently deployed
11
- */
12
- export declare const getDefaultSimpleAccountFactoryAddress: (chain: Chain, version?: EntryPointVersion) => Address;
1
+ import { type Chain } from "viem";
2
+ import type { UserOperationFeeOptions } from "../types.js";
13
3
  export declare const minPriorityFeePerBidDefaults: Map<number, bigint>;
14
4
  export declare const getDefaultUserOperationFeeOptions: (chain: Chain) => UserOperationFeeOptions;
15
5
  //# sourceMappingURL=defaults.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,MAAM,CAAC;AAuBhD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,UACzC,KAAK,YACH,iBAAiB,KACzB,OAqCF,CAAC;AAEF,eAAO,MAAM,4BAA4B,qBAIvC,CAAC;AAEH,eAAO,MAAM,iCAAiC,UACrC,KAAK,KACX,uBAOF,CAAC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,4BAA4B,qBAIvC,CAAC;AAEH,eAAO,MAAM,iCAAiC,UACrC,KAAK,KACX,uBAOF,CAAC"}
@@ -1,58 +1,101 @@
1
- import type { Chain } from "viem";
2
1
  import type { PromiseOrValue } from "../types.js";
3
2
  import type { RecordableKeys } from "./types.js";
4
- export declare const AlchemyChainMap: Map<number, Chain>;
5
- /**
6
- * Utility method for converting a chainId to a {@link Chain} object
7
- *
8
- * @param chainId - the chainId to convert
9
- * @returns a {@link Chain} object for the given chainId
10
- * @throws if the chainId is not found
11
- */
12
- export declare const getChain: (chainId: number) => Chain;
13
3
  /**
14
4
  * Utility function that allows for piping a series of async functions together
15
5
  *
16
- * @param fns - functions to pipe
17
- * @returns result of the pipe
6
+ * @param {((s: S, o?: O, f?: F) => Promise<S>)[]} fns - functions to pipe
7
+ * @returns {S} result of the pipe
18
8
  */
19
9
  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>;
20
10
  export type Deferrable<T> = {
21
11
  [K in keyof T]: PromiseOrValue<T[K]>;
22
12
  };
23
13
  /**
24
- * Await all of the properties of a {@link Deferrable} object
14
+ * Await all of the properties of a Deferrable object
25
15
  *
26
- * @param object - a {@link Deferrable} object
27
- * @returns the object with its properties resolved
16
+ * @param {Deferrable<T>} object - a Deferrable object
17
+ * @returns {Promise<T>} the object with its properties resolved
28
18
  */
29
19
  export declare function resolveProperties<T>(object: Deferrable<T>): Promise<T>;
30
20
  /**
31
21
  * Recursively converts all values in an object to hex strings
32
22
  *
33
- * @param obj - obj to deep hexlify
34
- * @returns object with all of its values hexlified
23
+ * @param {any} obj - obj to deep hexlify
24
+ * @returns {any} object with all of its values hexlified
35
25
  */
36
26
  export declare function deepHexlify(obj: any): any;
37
- export declare function defineReadOnly<T, K extends keyof T>(object: T, key: K, value: T[K]): void;
27
+ /**
28
+ * Filters out properties with undefined or null values from the provided object.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * import { filterUndefined } from "@aa-sdk/core";
33
+ *
34
+ * const result = filterUndefined({
35
+ * foo: undefined,
36
+ * bar: null,
37
+ * baz: "baz",
38
+ * }); // { baz: "baz" }
39
+ * ```
40
+ *
41
+ * @param {T} obj the object from which to remove properties with undefined or null values
42
+ * @returns {T} the object with undefined or null properties removed
43
+ */
38
44
  export declare function filterUndefined<T>(obj: T): T;
45
+ /**
46
+ * Picks the specified keys from an object and returns a new object containing only those key-value pairs.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * import { pick } from "@aa-sdk/core";
51
+ *
52
+ * const picked = pick({
53
+ * foo: "foo",
54
+ * bar: "bar",
55
+ * }, ["foo"]); // { foo: "foo" }
56
+ * ```
57
+ *
58
+ * @param {Record<string, unknown>} obj The object from which to pick keys
59
+ * @param {string|string[]} keys A single key or an array of keys to pick from the object
60
+ * @returns {Record<string, unknown>} A new object containing only the picked key-value pairs
61
+ */
39
62
  export declare function pick(obj: Record<string, unknown>, keys: string | string[]): {};
40
63
  /**
41
64
  * Utility method for checking if the passed in values are all equal (strictly)
42
65
  *
43
- * @param params - values to check
44
- * @returns a boolean indicating if all values are the same
66
+ * @param {...any[]} params - values to check
67
+ * @returns {boolean} a boolean indicating if all values are the same
45
68
  * @throws if no values are passed in
46
69
  */
47
70
  export declare const allEqual: (...params: any[]) => boolean;
48
71
  /**
49
72
  * Utility method for checking the condition and return the value if condition holds true, undefined if not.
50
73
  *
51
- * @param condition - condition to check
52
- * @param value - value to return when condition holds true
53
- * @returns the value if condition holds true, undefined if not
74
+ * @param {Promise<boolean>} condition - condition to check
75
+ * @param {() => Promise<T>} value - value to return when condition holds true
76
+ * @returns {Promise<T | undefined>} the value if condition holds true, undefined if not
54
77
  */
55
78
  export declare const conditionalReturn: <T>(condition: Promise<boolean>, value: () => Promise<T>) => Promise<T | undefined>;
79
+ /**
80
+ * Converts an array of objects into a record (object) where each key is determined by the specified selector and the value is determined by the provided function.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * import { toRecord } from "@aa-sdk/core";
85
+ * import { sepolia, mainnet } from "viem/chains";
86
+ *
87
+ * const addressesByChain = toRecord(
88
+ * [sepolia, mainnet],
89
+ * "id",
90
+ * () => "0x..."
91
+ * ); // { [sepolia.id]: "0x...", [mainnet.id]: "0x..." }
92
+ * ```
93
+ *
94
+ * @param {T[]} array The array of objects to convert to a record
95
+ * @param {K} selector The key used to select the property that will become the record's key
96
+ * @param {(item: T) => V} fn The function that transforms each item in the array into the record's value
97
+ * @returns {Record<T[K], V>} The resulting record object
98
+ */
56
99
  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>;
57
100
  export * from "./bigint.js";
58
101
  export * from "./bytes.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAIlC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,eAAe,oBAE3B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,YAAa,MAAM,KAAG,KAO1C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,iJAQnB,CAAC;AAGJ,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;KACzB,CAAC,IAAI,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAc5E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAqBzC;AAGD,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EACjD,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GACV,IAAI,CAMN;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAO5C;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,MAIzE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,cAAe,GAAG,EAAE,KAAG,OAK3C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,iBACjB,QAAQ,OAAO,CAAC,oDAEgD,CAAC;AAE9E,eAAO,MAAM,QAAQ,2KAYM,CAAC;AAE5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,mBAAmB,YAAY,CAAC;AAChC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,iJAQnB,CAAC;AAGJ,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;KACzB,CAAC,IAAI,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACrC,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAc5E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAqBzC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAO5C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,MAIzE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,cAAe,GAAG,EAAE,KAAG,OAK3C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,iBACjB,QAAQ,OAAO,CAAC,oDAEgD,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,QAAQ,2KAYM,CAAC;AAE5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,mBAAmB,YAAY,CAAC;AAChC,cAAc,aAAa,CAAC"}
@@ -7,7 +7,7 @@
7
7
  */
8
8
  export type NoUndefined<T> = T extends undefined ? never : T;
9
9
  /**
10
- * @description Checks if {@link T} is `undefined`
10
+ * @description Checks if T is `undefined`
11
11
  * @param T - Type to check
12
12
  * @example
13
13
  * type Result = IsUndefined<undefined>
@@ -18,7 +18,7 @@ export type RequiredBy<TType, TKeys extends keyof TType> = Required<Pick<TType,
18
18
  /**
19
19
  * @description Combines members of an intersection into a readable type.
20
20
  *
21
- * @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}
21
+ * @see https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg
22
22
  * @example
23
23
  * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>
24
24
  * => { a: string, b: string, c: number, d: bigint }
@@ -2,53 +2,53 @@ import { type Hex } from "viem";
2
2
  import type { EntryPointVersion } from "../entrypoint/types";
3
3
  import type { BigNumberish, Multiplier, UserOperationFeeOptionsField, UserOperationOverrides, UserOperationRequest, UserOperationStruct } from "../types";
4
4
  /**
5
- * Utility method for asserting a {@link UserOperationStruct} has valid fields for the given entry point version
5
+ * Utility method for asserting a UserOperationStruct has valid fields for the given entry point version
6
6
  *
7
- * @param request a {@link UserOperationStruct} to validate
8
- * @returns a type guard that asserts the {@link UserOperationRequest} is valid
7
+ * @param {UserOperationStruct} request a UserOperationStruct to validate
8
+ * @returns {boolean} a type guard that asserts the UserOperationRequest is valid
9
9
  */
10
10
  export declare function isValidRequest<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationStruct<TEntryPointVersion>): request is UserOperationRequest<TEntryPointVersion>;
11
11
  /**
12
- * Utility method for asserting a {@link UserOperationRequest} has valid fields for the paymaster data
12
+ * Utility method for asserting a UserOperationRequest has valid fields for the paymaster data
13
13
  *
14
- * @param request a {@link UserOperationRequest} to validate
15
- * @returns a type guard that asserts the {@link UserOperationRequest} is a {@link UserOperationRequest}
14
+ * @param {UserOperationRequest} request a UserOperationRequest to validate
15
+ * @returns {boolean} a type guard that asserts the UserOperationRequest is a UserOperationRequest
16
16
  */
17
17
  export declare function isValidPaymasterAndData<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationStruct<TEntryPointVersion>): boolean;
18
18
  /**
19
- * Utility method for asserting a {@link UserOperationStruct} has valid fields for the paymaster data
19
+ * Utility method for asserting a UserOperationStruct has valid fields for the paymaster data
20
20
  *
21
- * @param request a {@link UserOperationRequest} to validate
22
- * @returns a type guard that asserts the {@link UserOperationStruct} is a {@link UserOperationRequest}
21
+ * @param {UserOperationRequest} request a UserOperationRequest to validate
22
+ * @returns {boolean} a type guard that asserts the UserOperationStruct is a UserOperationRequest
23
23
  */
24
24
  export declare function isValidFactoryAndData<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationStruct<TEntryPointVersion>): boolean;
25
25
  /**
26
- * Utility method for applying a {@link UserOperationOverrides} field value
26
+ * Utility method for applying a UserOperationOverrides field value
27
27
  * over the current value set for the field
28
28
  *
29
- * @param value the current value of the field
30
- * @param override the override value to apply
31
- * @returns the new value of the field after applying the override
29
+ * @param {BigNumberish} value the current value of the field
30
+ * @param {BigNumberish | Multiplier} override the override value to apply
31
+ * @returns {BigNumberish} the new value of the field after applying the override
32
32
  */
33
33
  export declare function applyUserOpOverride<TValue extends BigNumberish | undefined>(value: TValue, override?: BigNumberish | Multiplier): TValue | BigNumberish;
34
34
  /**
35
- * Utility method for applying a {@link UserOperationFeeOptionsField} value
35
+ * Utility method for applying a UserOperationFeeOptionsField value
36
36
  * over the current value set for the field
37
37
  *
38
- * @param value the current value of the field
39
- * @param feeOption the fee option field value to apply
40
- * @returns the new value of the field after applying the fee option
38
+ * @param {BigNumberish} value the current value of the field
39
+ * @param {UserOperationFeeOptionsField} feeOption the override value to apply
40
+ * @returns {BigNumberish} the new value of the field after applying the override
41
41
  */
42
42
  export declare function applyUserOpFeeOption<TValue extends BigNumberish | undefined>(value: TValue, feeOption?: UserOperationFeeOptionsField): TValue | BigNumberish;
43
43
  /**
44
- * Utility method for applying a {@link UserOperationOverrides} field value and
45
- * a {@link UserOperationFeeOptionsField} value over the current value set for the field,
44
+ * Utility method for applying a UserOperationOverrides field value and
45
+ * a UserOperationFeeOptionsField value over the current value set for the field,
46
46
  * with the override taking precedence over the fee option
47
47
  *
48
- * @param value the current value of the field
49
- * @param [override] the override value to apply
50
- * @param [feeOption] the fee option field value to apply
51
- * @returns the new value of the field after applying the override or fee option
48
+ * @param {BigNumberish} value the current value of the field
49
+ * @param {BigNumberish | Multiplier} [override] the override value to apply
50
+ * @param {UserOperationFeeOptionsField} [feeOption] the fee option field value to apply
51
+ * @returns {BigNumberish} the new value of the field after applying the override or fee option
52
52
  */
53
53
  export declare function applyUserOpOverrideOrFeeOption<TValue extends BigNumberish | undefined>(value: TValue, override?: BigNumberish | Multiplier, feeOption?: UserOperationFeeOptionsField): TValue | BigNumberish;
54
54
  /**
@@ -57,8 +57,8 @@ export declare function applyUserOpOverrideOrFeeOption<TValue extends BigNumberi
57
57
  * either because the UserOp is paying for its own gas, or passing a specific paymaster
58
58
  *
59
59
  * @template EntryPointVersion TEntryPointVersion
60
- * @param overrides the user operation overrides to check
61
- * @returns whether the paymaster middleware should be bypassed
60
+ * @param {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the user operation overrides to check
61
+ * @returns {boolean} whether the paymaster middleware should be bypassed
62
62
  */
63
63
  export declare const bypassPaymasterAndData: <TEntryPointVersion extends keyof import("../entrypoint/types").EntryPointRegistryBase<unknown> = keyof import("../entrypoint/types").EntryPointRegistryBase<unknown>>(overrides: Partial<{
64
64
  callGasLimit: {
@@ -85,8 +85,8 @@ export declare const bypassPaymasterAndData: <TEntryPointVersion extends keyof i
85
85
  * pay for its own gas
86
86
  *
87
87
  * @template EntryPointVersion TEntryPointVersion
88
- * @param overrides the user operation overrides to check
89
- * @returns whether the paymaster middleware should be bypassed
88
+ * @param {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the user operation overrides to check
89
+ * @returns {boolean} whether the paymaster middleware should be bypassed
90
90
  */
91
91
  export declare const bypassPaymasterAndDataEmptyHex: <TEntryPointVersion extends keyof import("../entrypoint/types").EntryPointRegistryBase<unknown> = keyof import("../entrypoint/types").EntryPointRegistryBase<unknown>>(overrides: Partial<{
92
92
  callGasLimit: {
@@ -110,20 +110,20 @@ export declare const bypassPaymasterAndDataEmptyHex: <TEntryPointVersion extends
110
110
  /**
111
111
  * Utility method for parsing the paymaster address and paymasterData from the paymasterAndData hex string
112
112
  *
113
- * @param paymasterAndData the paymaster and data hex string to parse.
113
+ * @param {Hex} paymasterAndData the paymaster and data hex string to parse.
114
114
  * The hex string refers to the paymasterAndData field of entrypoint v0.6 user operation request
115
- * @returns the parsed paymaster and paymasterData fields of entrypoint v0.7 user operation request paymaster and paymasterData field
115
+ * @returns {{ paymaster: Hex; paymasterData: Hex}} the parsed paymaster and paymasterData fields of entrypoint v0.7 user operation request paymaster and paymasterData field
116
116
  */
117
117
  export declare const parsePaymasterAndData: (paymasterAndData: Hex) => Pick<UserOperationRequest<"0.7.0">, "paymaster" | "paymasterData">;
118
118
  /**
119
119
  * Utility method for converting the object containing the paymaster address and paymaster data
120
120
  * to the paymaster and data concatenated hex string
121
121
  *
122
- * @param paymasterAndData the object containing the picked paymaster and paymasterData fields of
122
+ * @param {{ paymaster: Hex; paymasterData: Hex}} paymasterAndData the object containing the picked paymaster and paymasterData fields of
123
123
  * entrypoint v0.7 user operation request
124
- * @param paymasterAndData.paymaster the paymaster address
125
- * @param paymasterAndData.paymasterData the paymaster data
126
- * @returns the paymasterAndData hex value of entrypoint v0.6 user operation request paymasterAndData field
124
+ * @param {Hex} paymasterAndData.paymaster the paymaster address
125
+ * @param {Hex} paymasterAndData.paymasterData the paymaster data
126
+ * @returns {Hex} the paymasterAndData hex value of entrypoint v0.6 user operation request paymasterAndData field
127
127
  */
128
128
  export declare const concatPaymasterAndData: ({ paymaster, paymasterData, }: Pick<UserOperationRequest<"0.7.0">, "paymaster" | "paymasterData">) => Hex;
129
129
  //# sourceMappingURL=userop.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.0.0-alpha.0";
1
+ export declare const VERSION = "4.0.0-alpha.10";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,kBAAkB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,mBAAmB,CAAC"}