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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/dist/esm/abis/EntryPointAbi_v7.js +1 -0
  2. package/dist/esm/abis/EntryPointAbi_v7.js.map +1 -1
  3. package/dist/esm/account/smartContractAccount.d.ts +50 -1
  4. package/dist/esm/account/smartContractAccount.js +111 -2
  5. package/dist/esm/account/smartContractAccount.js.map +1 -1
  6. package/dist/esm/actions/smartAccount/buildUserOperation.d.ts +23 -0
  7. package/dist/esm/actions/smartAccount/buildUserOperation.js +23 -0
  8. package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -1
  9. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.d.ts +39 -0
  10. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js +39 -0
  11. package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
  12. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.d.ts +54 -0
  13. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js +55 -0
  14. package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
  15. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +28 -0
  16. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js +28 -0
  17. package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
  18. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.d.ts +22 -0
  19. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js +27 -6
  20. package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
  21. package/dist/esm/actions/smartAccount/estimateUserOperationGas.d.ts +13 -0
  22. package/dist/esm/actions/smartAccount/estimateUserOperationGas.js +13 -0
  23. package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
  24. package/dist/esm/actions/smartAccount/internal/initUserOperation.d.ts +13 -0
  25. package/dist/esm/actions/smartAccount/internal/initUserOperation.js +14 -1
  26. package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
  27. package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js +2 -1
  28. package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
  29. package/dist/esm/actions/smartAccount/sendTransaction.d.ts +24 -0
  30. package/dist/esm/actions/smartAccount/sendTransaction.js +24 -0
  31. package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -1
  32. package/dist/esm/actions/smartAccount/sendTransactions.d.ts +23 -0
  33. package/dist/esm/actions/smartAccount/sendTransactions.js +23 -0
  34. package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -1
  35. package/dist/esm/actions/smartAccount/sendUserOperation.d.ts +21 -0
  36. package/dist/esm/actions/smartAccount/sendUserOperation.js +21 -0
  37. package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
  38. package/dist/esm/actions/smartAccount/types.d.ts +14 -0
  39. package/dist/esm/actions/smartAccount/types.js +1 -0
  40. package/dist/esm/actions/smartAccount/types.js.map +1 -1
  41. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.d.ts +24 -0
  42. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js +24 -0
  43. package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
  44. package/dist/esm/client/bundlerClient.d.ts +21 -0
  45. package/dist/esm/client/bundlerClient.js +32 -0
  46. package/dist/esm/client/bundlerClient.js.map +1 -1
  47. package/dist/esm/client/decorators/bundlerClient.d.ts +41 -0
  48. package/dist/esm/client/decorators/bundlerClient.js +10 -0
  49. package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
  50. package/dist/esm/client/decorators/smartAccountClient.d.ts +8 -0
  51. package/dist/esm/client/decorators/smartAccountClient.js +12 -1
  52. package/dist/esm/client/decorators/smartAccountClient.js.map +1 -1
  53. package/dist/esm/client/isSmartAccountClient.d.ts +16 -0
  54. package/dist/esm/client/isSmartAccountClient.js +16 -0
  55. package/dist/esm/client/isSmartAccountClient.js.map +1 -1
  56. package/dist/esm/client/schema.d.ts +12 -0
  57. package/dist/esm/client/schema.js +14 -0
  58. package/dist/esm/client/schema.js.map +1 -1
  59. package/dist/esm/client/smartAccountClient.js +53 -0
  60. package/dist/esm/client/smartAccountClient.js.map +1 -1
  61. package/dist/esm/client/types.js +1 -0
  62. package/dist/esm/client/types.js.map +1 -1
  63. package/dist/esm/ens/utils.d.ts +45 -0
  64. package/dist/esm/ens/utils.js +49 -0
  65. package/dist/esm/ens/utils.js.map +1 -1
  66. package/dist/esm/entrypoint/index.d.ts +14 -0
  67. package/dist/esm/entrypoint/index.js +30 -0
  68. package/dist/esm/entrypoint/index.js.map +1 -1
  69. package/dist/esm/entrypoint/types.d.ts +17 -0
  70. package/dist/esm/errors/account.d.ts +87 -4
  71. package/dist/esm/errors/account.js +88 -4
  72. package/dist/esm/errors/account.js.map +1 -1
  73. package/dist/esm/errors/base.d.ts +5 -0
  74. package/dist/esm/errors/base.js +5 -0
  75. package/dist/esm/errors/base.js.map +1 -1
  76. package/dist/esm/errors/client.d.ts +24 -0
  77. package/dist/esm/errors/client.js +24 -0
  78. package/dist/esm/errors/client.js.map +1 -1
  79. package/dist/esm/errors/entrypoint.d.ts +18 -0
  80. package/dist/esm/errors/entrypoint.js +18 -0
  81. package/dist/esm/errors/entrypoint.js.map +1 -1
  82. package/dist/esm/errors/signer.d.ts +8 -0
  83. package/dist/esm/errors/signer.js +8 -0
  84. package/dist/esm/errors/signer.js.map +1 -1
  85. package/dist/esm/errors/transaction.d.ts +14 -1
  86. package/dist/esm/errors/transaction.js +14 -1
  87. package/dist/esm/errors/transaction.js.map +1 -1
  88. package/dist/esm/errors/useroperation.d.ts +25 -0
  89. package/dist/esm/errors/useroperation.js +26 -0
  90. package/dist/esm/errors/useroperation.js.map +1 -1
  91. package/dist/esm/index.d.ts +0 -1
  92. package/dist/esm/index.js +0 -1
  93. package/dist/esm/index.js.map +1 -1
  94. package/dist/esm/logger.d.ts +91 -0
  95. package/dist/esm/logger.js +91 -0
  96. package/dist/esm/logger.js.map +1 -1
  97. package/dist/esm/middleware/actions.d.ts +14 -0
  98. package/dist/esm/middleware/actions.js +7 -0
  99. package/dist/esm/middleware/actions.js.map +1 -1
  100. package/dist/esm/middleware/defaults/feeEstimator.d.ts +20 -0
  101. package/dist/esm/middleware/defaults/feeEstimator.js +28 -0
  102. package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
  103. package/dist/esm/middleware/defaults/gasEstimator.d.ts +8 -0
  104. package/dist/esm/middleware/defaults/gasEstimator.js +10 -1
  105. package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
  106. package/dist/esm/middleware/defaults/paymasterAndData.d.ts +8 -0
  107. package/dist/esm/middleware/defaults/paymasterAndData.js +8 -0
  108. package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
  109. package/dist/esm/middleware/defaults/userOpSigner.d.ts +10 -0
  110. package/dist/esm/middleware/defaults/userOpSigner.js +10 -0
  111. package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
  112. package/dist/esm/middleware/erc7677middleware.d.ts +21 -0
  113. package/dist/esm/middleware/erc7677middleware.js +23 -0
  114. package/dist/esm/middleware/erc7677middleware.js.map +1 -1
  115. package/dist/esm/middleware/noopMiddleware.d.ts +6 -0
  116. package/dist/esm/middleware/noopMiddleware.js +6 -0
  117. package/dist/esm/middleware/noopMiddleware.js.map +1 -1
  118. package/dist/esm/middleware/types.js +1 -0
  119. package/dist/esm/middleware/types.js.map +1 -1
  120. package/dist/esm/signer/local-account.d.ts +96 -1
  121. package/dist/esm/signer/local-account.js +97 -2
  122. package/dist/esm/signer/local-account.js.map +1 -1
  123. package/dist/esm/signer/schema.d.ts +14 -0
  124. package/dist/esm/signer/schema.js +14 -0
  125. package/dist/esm/signer/schema.js.map +1 -1
  126. package/dist/esm/signer/types.d.ts +12 -0
  127. package/dist/esm/signer/types.js +1 -0
  128. package/dist/esm/signer/types.js.map +1 -1
  129. package/dist/esm/signer/utils.d.ts +20 -0
  130. package/dist/esm/signer/utils.js +27 -0
  131. package/dist/esm/signer/utils.js.map +1 -1
  132. package/dist/esm/signer/wallet-client.d.ts +92 -0
  133. package/dist/esm/signer/wallet-client.js +92 -0
  134. package/dist/esm/signer/wallet-client.js.map +1 -1
  135. package/dist/esm/transport/split.d.ts +32 -0
  136. package/dist/esm/transport/split.js +32 -0
  137. package/dist/esm/transport/split.js.map +1 -1
  138. package/dist/esm/types.d.ts +17 -0
  139. package/dist/esm/types.js +1 -0
  140. package/dist/esm/types.js.map +1 -1
  141. package/dist/esm/utils/bigint.d.ts +45 -0
  142. package/dist/esm/utils/bigint.js +46 -0
  143. package/dist/esm/utils/bigint.js.map +1 -1
  144. package/dist/esm/utils/bytes.d.ts +9 -0
  145. package/dist/esm/utils/bytes.js +10 -1
  146. package/dist/esm/utils/bytes.js.map +1 -1
  147. package/dist/esm/utils/index.d.ts +86 -0
  148. package/dist/esm/utils/index.js +86 -0
  149. package/dist/esm/utils/index.js.map +1 -1
  150. package/dist/esm/utils/schema.d.ts +3 -0
  151. package/dist/esm/utils/schema.js +9 -0
  152. package/dist/esm/utils/schema.js.map +1 -1
  153. package/dist/esm/utils/stateOverride.js +2 -0
  154. package/dist/esm/utils/stateOverride.js.map +1 -1
  155. package/dist/esm/utils/types.d.ts +22 -0
  156. package/dist/esm/utils/types.js +1 -0
  157. package/dist/esm/utils/types.js.map +1 -1
  158. package/dist/esm/utils/userop.d.ts +79 -0
  159. package/dist/esm/utils/userop.js +83 -0
  160. package/dist/esm/utils/userop.js.map +1 -1
  161. package/dist/esm/version.d.ts +1 -1
  162. package/dist/esm/version.js +3 -1
  163. package/dist/esm/version.js.map +1 -1
  164. package/dist/types/account/smartContractAccount.d.ts +1 -1
  165. package/dist/types/account/smartContractAccount.d.ts.map +1 -1
  166. package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts +1 -1
  167. package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
  168. package/dist/types/client/smartAccountClient.d.ts.map +1 -1
  169. package/dist/types/index.d.ts +0 -1
  170. package/dist/types/index.d.ts.map +1 -1
  171. package/dist/types/middleware/defaults/gasEstimator.d.ts.map +1 -1
  172. package/dist/types/transport/split.d.ts +1 -1
  173. package/dist/types/version.d.ts +1 -1
  174. package/dist/types/version.d.ts.map +1 -1
  175. package/package.json +11 -12
  176. package/src/account/smartContractAccount.ts +3 -4
  177. package/src/actions/smartAccount/buildUserOperationFromTx.ts +1 -1
  178. package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +10 -10
  179. package/src/actions/smartAccount/internal/initUserOperation.ts +1 -1
  180. package/src/client/smartAccountClient.ts +7 -0
  181. package/src/index.ts +0 -1
  182. package/src/middleware/defaults/gasEstimator.ts +2 -1
  183. package/src/transport/split.ts +1 -1
  184. package/src/version.ts +1 -1
  185. package/dist/cjs/abis/EntryPointAbi_v6.d.ts +0 -1018
  186. package/dist/cjs/abis/EntryPointAbi_v6.js +0 -1313
  187. package/dist/cjs/abis/EntryPointAbi_v6.js.map +0 -1
  188. package/dist/cjs/abis/EntryPointAbi_v7.d.ts +0 -775
  189. package/dist/cjs/abis/EntryPointAbi_v7.js +0 -661
  190. package/dist/cjs/abis/EntryPointAbi_v7.js.map +0 -1
  191. package/dist/cjs/abis/SimpleAccountAbi_v6.d.ts +0 -405
  192. package/dist/cjs/abis/SimpleAccountAbi_v6.js +0 -528
  193. package/dist/cjs/abis/SimpleAccountAbi_v6.js.map +0 -1
  194. package/dist/cjs/abis/SimpleAccountAbi_v7.d.ts +0 -410
  195. package/dist/cjs/abis/SimpleAccountAbi_v7.js +0 -538
  196. package/dist/cjs/abis/SimpleAccountAbi_v7.js.map +0 -1
  197. package/dist/cjs/abis/SimpleAccountFactoryAbi.d.ts +0 -55
  198. package/dist/cjs/abis/SimpleAccountFactoryAbi.js +0 -78
  199. package/dist/cjs/abis/SimpleAccountFactoryAbi.js.map +0 -1
  200. package/dist/cjs/account/smartContractAccount.d.ts +0 -74
  201. package/dist/cjs/account/smartContractAccount.js +0 -180
  202. package/dist/cjs/account/smartContractAccount.js.map +0 -1
  203. package/dist/cjs/actions/bundler/estimateUserOperationGas.d.ts +0 -8
  204. package/dist/cjs/actions/bundler/estimateUserOperationGas.js +0 -18
  205. package/dist/cjs/actions/bundler/estimateUserOperationGas.js.map +0 -1
  206. package/dist/cjs/actions/bundler/getSupportedEntryPoints.d.ts +0 -3
  207. package/dist/cjs/actions/bundler/getSupportedEntryPoints.js +0 -11
  208. package/dist/cjs/actions/bundler/getSupportedEntryPoints.js.map +0 -1
  209. package/dist/cjs/actions/bundler/getUserOperationByHash.d.ts +0 -6
  210. package/dist/cjs/actions/bundler/getUserOperationByHash.js +0 -11
  211. package/dist/cjs/actions/bundler/getUserOperationByHash.js.map +0 -1
  212. package/dist/cjs/actions/bundler/getUserOperationReceipt.d.ts +0 -6
  213. package/dist/cjs/actions/bundler/getUserOperationReceipt.js +0 -11
  214. package/dist/cjs/actions/bundler/getUserOperationReceipt.js.map +0 -1
  215. package/dist/cjs/actions/bundler/sendRawUserOperation.d.ts +0 -7
  216. package/dist/cjs/actions/bundler/sendRawUserOperation.js +0 -11
  217. package/dist/cjs/actions/bundler/sendRawUserOperation.js.map +0 -1
  218. package/dist/cjs/actions/smartAccount/buildUserOperation.d.ts +0 -5
  219. package/dist/cjs/actions/smartAccount/buildUserOperation.js +0 -25
  220. package/dist/cjs/actions/smartAccount/buildUserOperation.js.map +0 -1
  221. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.d.ts +0 -5
  222. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js +0 -39
  223. package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +0 -1
  224. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.d.ts +0 -4
  225. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js +0 -62
  226. package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +0 -1
  227. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +0 -4
  228. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js +0 -34
  229. package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +0 -1
  230. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.d.ts +0 -5
  231. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js +0 -64
  232. package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js.map +0 -1
  233. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.d.ts +0 -5
  234. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js +0 -23
  235. package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +0 -1
  236. package/dist/cjs/actions/smartAccount/getAddress.d.ts +0 -4
  237. package/dist/cjs/actions/smartAccount/getAddress.js +0 -13
  238. package/dist/cjs/actions/smartAccount/getAddress.js.map +0 -1
  239. package/dist/cjs/actions/smartAccount/internal/initUserOperation.d.ts +0 -7
  240. package/dist/cjs/actions/smartAccount/internal/initUserOperation.js +0 -42
  241. package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +0 -1
  242. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.d.ts +0 -10
  243. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js +0 -47
  244. package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +0 -1
  245. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.d.ts +0 -10
  246. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js +0 -28
  247. package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +0 -1
  248. package/dist/cjs/actions/smartAccount/sendTransaction.d.ts +0 -5
  249. package/dist/cjs/actions/smartAccount/sendTransaction.js +0 -35
  250. package/dist/cjs/actions/smartAccount/sendTransaction.js.map +0 -1
  251. package/dist/cjs/actions/smartAccount/sendTransactions.d.ts +0 -4
  252. package/dist/cjs/actions/smartAccount/sendTransactions.js +0 -36
  253. package/dist/cjs/actions/smartAccount/sendTransactions.js.map +0 -1
  254. package/dist/cjs/actions/smartAccount/sendUserOperation.d.ts +0 -5
  255. package/dist/cjs/actions/smartAccount/sendUserOperation.js +0 -31
  256. package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +0 -1
  257. package/dist/cjs/actions/smartAccount/signMessage.d.ts +0 -6
  258. package/dist/cjs/actions/smartAccount/signMessage.js +0 -12
  259. package/dist/cjs/actions/smartAccount/signMessage.js.map +0 -1
  260. package/dist/cjs/actions/smartAccount/signMessageWith6492.d.ts +0 -4
  261. package/dist/cjs/actions/smartAccount/signMessageWith6492.js +0 -12
  262. package/dist/cjs/actions/smartAccount/signMessageWith6492.js.map +0 -1
  263. package/dist/cjs/actions/smartAccount/signTypedData.d.ts +0 -10
  264. package/dist/cjs/actions/smartAccount/signTypedData.js +0 -12
  265. package/dist/cjs/actions/smartAccount/signTypedData.js.map +0 -1
  266. package/dist/cjs/actions/smartAccount/signTypedDataWith6492.d.ts +0 -6
  267. package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js +0 -12
  268. package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js.map +0 -1
  269. package/dist/cjs/actions/smartAccount/signUserOperation.d.ts +0 -5
  270. package/dist/cjs/actions/smartAccount/signUserOperation.js +0 -30
  271. package/dist/cjs/actions/smartAccount/signUserOperation.js.map +0 -1
  272. package/dist/cjs/actions/smartAccount/types.d.ts +0 -42
  273. package/dist/cjs/actions/smartAccount/types.js +0 -3
  274. package/dist/cjs/actions/smartAccount/types.js.map +0 -1
  275. package/dist/cjs/actions/smartAccount/upgradeAccount.d.ts +0 -4
  276. package/dist/cjs/actions/smartAccount/upgradeAccount.js +0 -38
  277. package/dist/cjs/actions/smartAccount/upgradeAccount.js.map +0 -1
  278. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.d.ts +0 -3
  279. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js +0 -36
  280. package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js.map +0 -1
  281. package/dist/cjs/client/bundlerClient.d.ts +0 -10
  282. package/dist/cjs/client/bundlerClient.js +0 -51
  283. package/dist/cjs/client/bundlerClient.js.map +0 -1
  284. package/dist/cjs/client/decorators/bundlerClient.d.ts +0 -41
  285. package/dist/cjs/client/decorators/bundlerClient.js +0 -17
  286. package/dist/cjs/client/decorators/bundlerClient.js.map +0 -1
  287. package/dist/cjs/client/decorators/smartAccountClient.d.ts +0 -35
  288. package/dist/cjs/client/decorators/smartAccountClient.js +0 -43
  289. package/dist/cjs/client/decorators/smartAccountClient.js.map +0 -1
  290. package/dist/cjs/client/isSmartAccountClient.d.ts +0 -5
  291. package/dist/cjs/client/isSmartAccountClient.js +0 -18
  292. package/dist/cjs/client/isSmartAccountClient.js.map +0 -1
  293. package/dist/cjs/client/schema.d.ts +0 -767
  294. package/dist/cjs/client/schema.js +0 -63
  295. package/dist/cjs/client/schema.js.map +0 -1
  296. package/dist/cjs/client/smartAccountClient.d.ts +0 -33
  297. package/dist/cjs/client/smartAccountClient.js +0 -93
  298. package/dist/cjs/client/smartAccountClient.js.map +0 -1
  299. package/dist/cjs/client/types.d.ts +0 -21
  300. package/dist/cjs/client/types.js +0 -3
  301. package/dist/cjs/client/types.js.map +0 -1
  302. package/dist/cjs/ens/utils.d.ts +0 -6
  303. package/dist/cjs/ens/utils.js +0 -53
  304. package/dist/cjs/ens/utils.js.map +0 -1
  305. package/dist/cjs/entrypoint/0.6.d.ts +0 -1029
  306. package/dist/cjs/entrypoint/0.6.js +0 -49
  307. package/dist/cjs/entrypoint/0.6.js.map +0 -1
  308. package/dist/cjs/entrypoint/0.7.d.ts +0 -792
  309. package/dist/cjs/entrypoint/0.7.js +0 -88
  310. package/dist/cjs/entrypoint/0.7.js.map +0 -1
  311. package/dist/cjs/entrypoint/index.d.ts +0 -8
  312. package/dist/cjs/entrypoint/index.js +0 -53
  313. package/dist/cjs/entrypoint/index.js.map +0 -1
  314. package/dist/cjs/entrypoint/types.d.ts +0 -46
  315. package/dist/cjs/entrypoint/types.js +0 -3
  316. package/dist/cjs/entrypoint/types.js.map +0 -1
  317. package/dist/cjs/errors/account.d.ts +0 -47
  318. package/dist/cjs/errors/account.js +0 -140
  319. package/dist/cjs/errors/account.js.map +0 -1
  320. package/dist/cjs/errors/base.d.ts +0 -18
  321. package/dist/cjs/errors/base.js +0 -39
  322. package/dist/cjs/errors/base.js.map +0 -1
  323. package/dist/cjs/errors/client.d.ts +0 -14
  324. package/dist/cjs/errors/client.js +0 -44
  325. package/dist/cjs/errors/client.js.map +0 -1
  326. package/dist/cjs/errors/entrypoint.d.ts +0 -10
  327. package/dist/cjs/errors/entrypoint.js +0 -32
  328. package/dist/cjs/errors/entrypoint.js.map +0 -1
  329. package/dist/cjs/errors/signer.d.ts +0 -5
  330. package/dist/cjs/errors/signer.js +0 -20
  331. package/dist/cjs/errors/signer.js.map +0 -1
  332. package/dist/cjs/errors/transaction.d.ts +0 -10
  333. package/dist/cjs/errors/transaction.js +0 -29
  334. package/dist/cjs/errors/transaction.js.map +0 -1
  335. package/dist/cjs/errors/useroperation.d.ts +0 -10
  336. package/dist/cjs/errors/useroperation.js +0 -34
  337. package/dist/cjs/errors/useroperation.js.map +0 -1
  338. package/dist/cjs/index.d.ts +0 -60
  339. package/dist/cjs/index.js +0 -170
  340. package/dist/cjs/index.js.map +0 -1
  341. package/dist/cjs/logger.d.ts +0 -20
  342. package/dist/cjs/logger.js +0 -60
  343. package/dist/cjs/logger.js.map +0 -1
  344. package/dist/cjs/middleware/actions.d.ts +0 -12
  345. package/dist/cjs/middleware/actions.js +0 -21
  346. package/dist/cjs/middleware/actions.js.map +0 -1
  347. package/dist/cjs/middleware/defaults/feeEstimator.d.ts +0 -3
  348. package/dist/cjs/middleware/defaults/feeEstimator.js +0 -23
  349. package/dist/cjs/middleware/defaults/feeEstimator.js.map +0 -1
  350. package/dist/cjs/middleware/defaults/gasEstimator.d.ts +0 -3
  351. package/dist/cjs/middleware/defaults/gasEstimator.js +0 -27
  352. package/dist/cjs/middleware/defaults/gasEstimator.js.map +0 -1
  353. package/dist/cjs/middleware/defaults/paymasterAndData.d.ts +0 -2
  354. package/dist/cjs/middleware/defaults/paymasterAndData.js +0 -12
  355. package/dist/cjs/middleware/defaults/paymasterAndData.js.map +0 -1
  356. package/dist/cjs/middleware/defaults/userOpSigner.d.ts +0 -2
  357. package/dist/cjs/middleware/defaults/userOpSigner.js +0 -26
  358. package/dist/cjs/middleware/defaults/userOpSigner.js.map +0 -1
  359. package/dist/cjs/middleware/erc7677middleware.d.ts +0 -40
  360. package/dist/cjs/middleware/erc7677middleware.js +0 -77
  361. package/dist/cjs/middleware/erc7677middleware.js.map +0 -1
  362. package/dist/cjs/middleware/noopMiddleware.d.ts +0 -3
  363. package/dist/cjs/middleware/noopMiddleware.js +0 -8
  364. package/dist/cjs/middleware/noopMiddleware.js.map +0 -1
  365. package/dist/cjs/middleware/types.d.ts +0 -22
  366. package/dist/cjs/middleware/types.js +0 -3
  367. package/dist/cjs/middleware/types.js.map +0 -1
  368. package/dist/cjs/package.json +0 -1
  369. package/dist/cjs/signer/local-account.d.ts +0 -219
  370. package/dist/cjs/signer/local-account.js +0 -56
  371. package/dist/cjs/signer/local-account.js.map +0 -1
  372. package/dist/cjs/signer/schema.d.ts +0 -4
  373. package/dist/cjs/signer/schema.js +0 -16
  374. package/dist/cjs/signer/schema.js.map +0 -1
  375. package/dist/cjs/signer/types.d.ts +0 -15
  376. package/dist/cjs/signer/types.js +0 -3
  377. package/dist/cjs/signer/types.js.map +0 -1
  378. package/dist/cjs/signer/utils.d.ts +0 -7
  379. package/dist/cjs/signer/utils.js +0 -16
  380. package/dist/cjs/signer/utils.js.map +0 -1
  381. package/dist/cjs/signer/wallet-client.d.ts +0 -217
  382. package/dist/cjs/signer/wallet-client.js +0 -58
  383. package/dist/cjs/signer/wallet-client.js.map +0 -1
  384. package/dist/cjs/transport/split.d.ts +0 -9
  385. package/dist/cjs/transport/split.js +0 -26
  386. package/dist/cjs/transport/split.js.map +0 -1
  387. package/dist/cjs/types.d.ts +0 -158
  388. package/dist/cjs/types.js +0 -3
  389. package/dist/cjs/types.js.map +0 -1
  390. package/dist/cjs/utils/bigint.d.ts +0 -10
  391. package/dist/cjs/utils/bigint.js +0 -55
  392. package/dist/cjs/utils/bigint.js.map +0 -1
  393. package/dist/cjs/utils/bytes.d.ts +0 -7
  394. package/dist/cjs/utils/bytes.js +0 -11
  395. package/dist/cjs/utils/bytes.js.map +0 -1
  396. package/dist/cjs/utils/defaults.d.ts +0 -4
  397. package/dist/cjs/utils/defaults.js +0 -19
  398. package/dist/cjs/utils/defaults.js.map +0 -1
  399. package/dist/cjs/utils/index.d.ts +0 -19
  400. package/dist/cjs/utils/index.js +0 -95
  401. package/dist/cjs/utils/index.js.map +0 -1
  402. package/dist/cjs/utils/schema.d.ts +0 -25
  403. package/dist/cjs/utils/schema.js +0 -35
  404. package/dist/cjs/utils/schema.js.map +0 -1
  405. package/dist/cjs/utils/stateOverride.d.ts +0 -4
  406. package/dist/cjs/utils/stateOverride.js +0 -52
  407. package/dist/cjs/utils/stateOverride.js.map +0 -1
  408. package/dist/cjs/utils/testUtils.d.ts +0 -6
  409. package/dist/cjs/utils/testUtils.js +0 -33
  410. package/dist/cjs/utils/testUtils.js.map +0 -1
  411. package/dist/cjs/utils/types.d.ts +0 -16
  412. package/dist/cjs/utils/types.js +0 -3
  413. package/dist/cjs/utils/types.js.map +0 -1
  414. package/dist/cjs/utils/userop.d.ts +0 -49
  415. package/dist/cjs/utils/userop.js +0 -75
  416. package/dist/cjs/utils/userop.js.map +0 -1
  417. package/dist/cjs/version.d.ts +0 -1
  418. package/dist/cjs/version.js +0 -5
  419. package/dist/cjs/version.js.map +0 -1
  420. package/dist/esm/package.json +0 -1
@@ -1,6 +1,19 @@
1
1
  import { AccountNotFoundError } from "../../../errors/account.js";
2
2
  import { ChainNotFoundError } from "../../../errors/client.js";
3
3
  import { conditionalReturn } from "../../../utils/index.js";
4
+ /**
5
+ * Description internal action function of SmartAccountClient for initializing
6
+ * a user operation for the sender account
7
+ *
8
+ * @template {Transport} TTransport
9
+ * @template {Chain | undefined} TChain
10
+ * @template {SmartContractAccount | undefined} TAccount
11
+ * @template {UserOperationContext | undefined} TContext
12
+ * @template {GetEntryPointFromAccount} TEntryPointVersion
13
+ * @param {BaseSmartAccountClient<TTransport, TChain, TAccount>} client smart account client
14
+ * @param {SendUserOperationParameters<TAccount, TContext, TEntryPointVersion> | BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>} args send user operation parameters
15
+ * @returns {Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>} initialized user operation struct
16
+ */
4
17
  export async function _initUserOperation(client, args) {
5
18
  const { account = client.account, uo, overrides } = args;
6
19
  if (!account) {
@@ -16,7 +29,7 @@ export async function _initUserOperation(client, args) {
16
29
  ? uo
17
30
  : account.encodeExecute(uo);
18
31
  const signature = account.getDummySignature();
19
- const nonce = account.getNonce(overrides?.nonceKey);
32
+ const nonce = account.getAccountNonce(overrides?.nonceKey);
20
33
  const struct = entryPoint.version === "0.6.0"
21
34
  ? {
22
35
  initCode: account.getInitCode(),
@@ -1 +1 @@
1
- {"version":3,"file":"initUserOperation.js","sourceRoot":"","sources":["../../../../../src/actions/smartAccount/internal/initUserOperation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAmB,MAAM,yBAAyB,CAAC;AAoB7E,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAWtC,MAA4D,EAC5D,IAEwE;IAExE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACzD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAE3C,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAChC,CAAC,CAAC,OAAO,EAAE,KAAK,QAAQ;YACxB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAE9B,MAAM,SAAS,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE9C,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAEpD,MAAM,MAAM,GACV,UAAU,CAAC,OAAO,KAAK,OAAO;QAC5B,CAAC,CAAE;YACC,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE;YAC/B,MAAM,EAAE,OAAO,CAAC,OAAO;YACvB,KAAK;YACL,QAAQ;YACR,SAAS;SAC8C;QAC3D,CAAC,CAAE;YACC,OAAO,EAAE,iBAAiB,CACxB,OAAO,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EACzD,OAAO,CAAC,iBAAiB,CAC1B;YACD,WAAW,EAAE,iBAAiB,CAC5B,OAAO,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EACzD,OAAO,CAAC,cAAc,CACvB;YACD,MAAM,EAAE,OAAO,CAAC,OAAO;YACvB,KAAK;YACL,QAAQ;YACR,SAAS;SAC8C,CAAC;IAEhE,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { Chain, Transport } from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../../account/smartContractAccount.js\";\nimport type { BaseSmartAccountClient } from \"../../../client/smartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../../errors/client.js\";\nimport type { UserOperationStruct } from \"../../../types.js\";\nimport { conditionalReturn, type Deferrable } from \"../../../utils/index.js\";\nimport type {\n BuildUserOperationParameters,\n SendUserOperationParameters,\n UserOperationContext,\n} from \"../types.js\";\n\n/**\n * Description internal action function of SmartAccountClient for initializing\n * a user operation for the sender account\n *\n * @template {Transport} TTransport\n * @template {Chain | undefined} TChain\n * @template {SmartContractAccount | undefined} TAccount\n * @template {UserOperationContext | undefined} TContext\n * @template {GetEntryPointFromAccount} TEntryPointVersion\n * @param {BaseSmartAccountClient<TTransport, TChain, TAccount>} client smart account client\n * @param {SendUserOperationParameters<TAccount, TContext, TEntryPointVersion> | BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>} args send user operation parameters\n * @returns {Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>} initialized user operation struct\n */\nexport async function _initUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n args:\n | SendUserOperationParameters<TAccount, TContext, TEntryPointVersion>\n | BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>\n): Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>> {\n const { account = client.account, uo, overrides } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const entryPoint = account.getEntryPoint();\n\n const callData = Array.isArray(uo)\n ? account.encodeBatchExecute(uo)\n : typeof uo === \"string\"\n ? uo\n : account.encodeExecute(uo);\n\n const signature = account.getDummySignature();\n\n const nonce = account.getNonce(overrides?.nonceKey);\n\n const struct =\n entryPoint.version === \"0.6.0\"\n ? ({\n initCode: account.getInitCode(),\n sender: account.address,\n nonce,\n callData,\n signature,\n } as Deferrable<UserOperationStruct<TEntryPointVersion>>)\n : ({\n factory: conditionalReturn(\n account.isAccountDeployed().then((deployed) => !deployed),\n account.getFactoryAddress\n ),\n factoryData: conditionalReturn(\n account.isAccountDeployed().then((deployed) => !deployed),\n account.getFactoryData\n ),\n sender: account.address,\n nonce,\n callData,\n signature,\n } as Deferrable<UserOperationStruct<TEntryPointVersion>>);\n\n return struct;\n}\n"]}
1
+ {"version":3,"file":"initUserOperation.js","sourceRoot":"","sources":["../../../../../src/actions/smartAccount/internal/initUserOperation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAmB,MAAM,yBAAyB,CAAC;AAO7E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAWtC,MAA4D,EAC5D,IAEwE;IAExE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACzD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAE3C,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAChC,CAAC,CAAC,OAAO,EAAE,KAAK,QAAQ;YACxB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAE9B,MAAM,SAAS,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE9C,MAAM,KAAK,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAE3D,MAAM,MAAM,GACV,UAAU,CAAC,OAAO,KAAK,OAAO;QAC5B,CAAC,CAAE;YACC,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE;YAC/B,MAAM,EAAE,OAAO,CAAC,OAAO;YACvB,KAAK;YACL,QAAQ;YACR,SAAS;SAC8C;QAC3D,CAAC,CAAE;YACC,OAAO,EAAE,iBAAiB,CACxB,OAAO,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EACzD,OAAO,CAAC,iBAAiB,CAC1B;YACD,WAAW,EAAE,iBAAiB,CAC5B,OAAO,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EACzD,OAAO,CAAC,cAAc,CACvB;YACD,MAAM,EAAE,OAAO,CAAC,OAAO;YACvB,KAAK;YACL,QAAQ;YACR,SAAS;SAC8C,CAAC;IAEhE,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { Chain, Transport } from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../../account/smartContractAccount.js\";\nimport type { BaseSmartAccountClient } from \"../../../client/smartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../../errors/client.js\";\nimport type { UserOperationStruct } from \"../../../types.js\";\nimport { conditionalReturn, type Deferrable } from \"../../../utils/index.js\";\nimport type {\n BuildUserOperationParameters,\n SendUserOperationParameters,\n UserOperationContext,\n} from \"../types.js\";\n\n/**\n * Description internal action function of SmartAccountClient for initializing\n * a user operation for the sender account\n *\n * @template {Transport} TTransport\n * @template {Chain | undefined} TChain\n * @template {SmartContractAccount | undefined} TAccount\n * @template {UserOperationContext | undefined} TContext\n * @template {GetEntryPointFromAccount} TEntryPointVersion\n * @param {BaseSmartAccountClient<TTransport, TChain, TAccount>} client smart account client\n * @param {SendUserOperationParameters<TAccount, TContext, TEntryPointVersion> | BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>} args send user operation parameters\n * @returns {Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>} initialized user operation struct\n */\nexport async function _initUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n args:\n | SendUserOperationParameters<TAccount, TContext, TEntryPointVersion>\n | BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>\n): Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>> {\n const { account = client.account, uo, overrides } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const entryPoint = account.getEntryPoint();\n\n const callData = Array.isArray(uo)\n ? account.encodeBatchExecute(uo)\n : typeof uo === \"string\"\n ? uo\n : account.encodeExecute(uo);\n\n const signature = account.getDummySignature();\n\n const nonce = account.getAccountNonce(overrides?.nonceKey);\n\n const struct =\n entryPoint.version === \"0.6.0\"\n ? ({\n initCode: account.getInitCode(),\n sender: account.address,\n nonce,\n callData,\n signature,\n } as Deferrable<UserOperationStruct<TEntryPointVersion>>)\n : ({\n factory: conditionalReturn(\n account.isAccountDeployed().then((deployed) => !deployed),\n account.getFactoryAddress\n ),\n factoryData: conditionalReturn(\n account.isAccountDeployed().then((deployed) => !deployed),\n account.getFactoryData\n ),\n sender: account.address,\n nonce,\n callData,\n signature,\n } as Deferrable<UserOperationStruct<TEntryPointVersion>>);\n\n return struct;\n}\n"]}
@@ -27,7 +27,8 @@ export async function _runMiddlewareStack(client, args) {
27
27
  paymasterData: overrides.paymasterData,
28
28
  paymaster: overrides.paymaster,
29
29
  }
30
- :
30
+ : // At this point, nothing has run so no fields are set
31
+ // for 0.7 when not using a paymaster, all fields should be undefined
31
32
  undefined),
32
33
  };
33
34
  },
@@ -1 +1 @@
1
- {"version":3,"file":"runMiddlewareStack.js","sourceRoot":"","sources":["../../../../../src/actions/smartAccount/internal/runMiddlewareStack.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAMvE,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAElB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,SAAS,GACb,CAAU,GAAG,GAAyC,EAAE,EAAE,CAC1D,KAAK,EAAE,CAAI,EAAE,IAAU,EAAE,EAAE;IACzB,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEJ,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAWvC,MAA4D,EAC5D,IAIqD;IAErD,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAClE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,EACJ,qBAAqB,EACrB,gBAAgB,GACjB,GAGG,sBAAsB,CAAC,SAAS,CAAC;QACnC,CAAC,CAAC;YACE,qBAAqB,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;gBACjD,OAAO;oBACL,GAAG,EAAE;oBACL,GAAG,CAAC,kBAAkB,IAAI,SAAU;wBAClC,CAAC,CAAC,EAAE,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,EAAE;wBAClD,CAAC,CAAC,eAAe,IAAI,SAAU;4BAC7B,WAAW,IAAI,SAAS;4BACxB,SAAS,CAAC,aAAa,KAAK,IAAI;4BAClC,CAAC,CAAC;gCACE,aAAa,EAAE,SAAS,CAAC,aAAa;gCACtC,SAAS,EAAE,SAAS,CAAC,SAAS;6BAC/B;4BACH,CAAC;gCAEC,SAAS,CAAC;iBACf,CAAC;YACJ,CAAC;YACD,gBAAgB,EAAE,cAAc;SACjC;QACH,CAAC,CAAC;YACE,qBAAqB,EAAE,MAAM,CAAC,UAAU,CAAC,qBAAqB;YAC9D,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,gBAAgB;SACrD,CAAC;IAEN,MAAM,MAAM,GAAG,MAAM,SAAS,CAC5B,qBAAqB,EACrB,MAAM,CAAC,UAAU,CAAC,YAAY,EAC9B,MAAM,CAAC,UAAU,CAAC,YAAY,EAC9B,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAClC,gBAAgB,EAChB,MAAM,CAAC,UAAU,CAAC,sBAAsB,CACzC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAE9E,OAAO,iBAAiB,CAEtB,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import type { Chain, Transport } from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../../account/smartContractAccount\";\nimport type { BaseSmartAccountClient } from \"../../../client/smartAccountClient\";\nimport { AccountNotFoundError } from \"../../../errors/account.js\";\nimport { noopMiddleware } from \"../../../middleware/noopMiddleware.js\";\nimport type { ClientMiddleware } from \"../../../middleware/types\";\nimport type {\n UserOperationOverridesParameter,\n UserOperationStruct,\n} from \"../../../types\";\nimport {\n bypassPaymasterAndData,\n resolveProperties,\n type Deferrable,\n} from \"../../../utils/index.js\";\nimport type { UserOperationContext } from \"../types\";\n\nconst asyncPipe =\n <S, Opts>(...fns: ((s: S, opts: Opts) => Promise<S>)[]) =>\n async (s: S, opts: Opts) => {\n let result = s;\n for (const fn of fns) {\n result = await fn(result, opts);\n }\n return result;\n };\n\nexport async function _runMiddlewareStack<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n args: {\n uo: Deferrable<UserOperationStruct<TEntryPointVersion>>;\n context?: TContext;\n } & GetAccountParameter<TAccount> &\n UserOperationOverridesParameter<TEntryPointVersion>\n): Promise<UserOperationStruct<TEntryPointVersion>> {\n const { uo, overrides, account = client.account, context } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n const {\n dummyPaymasterAndData,\n paymasterAndData,\n }: Pick<\n ClientMiddleware<TContext>,\n \"dummyPaymasterAndData\" | \"paymasterAndData\"\n > = bypassPaymasterAndData(overrides)\n ? {\n dummyPaymasterAndData: async (uo, { overrides }) => {\n return {\n ...uo,\n ...(\"paymasterAndData\" in overrides!\n ? { paymasterAndData: overrides.paymasterAndData }\n : \"paymasterData\" in overrides! &&\n \"paymaster\" in overrides &&\n overrides.paymasterData !== \"0x\"\n ? {\n paymasterData: overrides.paymasterData,\n paymaster: overrides.paymaster,\n }\n : // At this point, nothing has run so no fields are set\n // for 0.7 when not using a paymaster, all fields should be undefined\n undefined),\n };\n },\n paymasterAndData: noopMiddleware,\n }\n : {\n dummyPaymasterAndData: client.middleware.dummyPaymasterAndData,\n paymasterAndData: client.middleware.paymasterAndData,\n };\n\n const result = await asyncPipe(\n dummyPaymasterAndData,\n client.middleware.feeEstimator,\n client.middleware.gasEstimator,\n client.middleware.customMiddleware,\n paymasterAndData,\n client.middleware.userOperationSimulator\n )(uo, { overrides, feeOptions: client.feeOptions, account, client, context });\n\n return resolveProperties<\n UserOperationStruct<GetEntryPointFromAccount<TAccount>>\n >(result);\n}\n"]}
1
+ {"version":3,"file":"runMiddlewareStack.js","sourceRoot":"","sources":["../../../../../src/actions/smartAccount/internal/runMiddlewareStack.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAMvE,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAElB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,SAAS,GACb,CAAU,GAAG,GAAyC,EAAE,EAAE,CAC1D,KAAK,EAAE,CAAI,EAAE,IAAU,EAAE,EAAE;IACzB,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEJ,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAWvC,MAA4D,EAC5D,IAIqD;IAErD,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAClE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,EACJ,qBAAqB,EACrB,gBAAgB,GACjB,GAGG,sBAAsB,CAAC,SAAS,CAAC;QACnC,CAAC,CAAC;YACE,qBAAqB,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;gBACjD,OAAO;oBACL,GAAG,EAAE;oBACL,GAAG,CAAC,kBAAkB,IAAI,SAAU;wBAClC,CAAC,CAAC,EAAE,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,EAAE;wBAClD,CAAC,CAAC,eAAe,IAAI,SAAU;4BAC7B,WAAW,IAAI,SAAS;4BACxB,SAAS,CAAC,aAAa,KAAK,IAAI;4BAClC,CAAC,CAAC;gCACE,aAAa,EAAE,SAAS,CAAC,aAAa;gCACtC,SAAS,EAAE,SAAS,CAAC,SAAS;6BAC/B;4BACH,CAAC,CAAC,sDAAsD;gCACtD,qEAAqE;gCACrE,SAAS,CAAC;iBACf,CAAC;YACJ,CAAC;YACD,gBAAgB,EAAE,cAAc;SACjC;QACH,CAAC,CAAC;YACE,qBAAqB,EAAE,MAAM,CAAC,UAAU,CAAC,qBAAqB;YAC9D,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,gBAAgB;SACrD,CAAC;IAEN,MAAM,MAAM,GAAG,MAAM,SAAS,CAC5B,qBAAqB,EACrB,MAAM,CAAC,UAAU,CAAC,YAAY,EAC9B,MAAM,CAAC,UAAU,CAAC,YAAY,EAC9B,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAClC,gBAAgB,EAChB,MAAM,CAAC,UAAU,CAAC,sBAAsB,CACzC,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAE9E,OAAO,iBAAiB,CAEtB,MAAM,CAAC,CAAC;AACZ,CAAC","sourcesContent":["import type { Chain, Transport } from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../../account/smartContractAccount\";\nimport type { BaseSmartAccountClient } from \"../../../client/smartAccountClient\";\nimport { AccountNotFoundError } from \"../../../errors/account.js\";\nimport { noopMiddleware } from \"../../../middleware/noopMiddleware.js\";\nimport type { ClientMiddleware } from \"../../../middleware/types\";\nimport type {\n UserOperationOverridesParameter,\n UserOperationStruct,\n} from \"../../../types\";\nimport {\n bypassPaymasterAndData,\n resolveProperties,\n type Deferrable,\n} from \"../../../utils/index.js\";\nimport type { UserOperationContext } from \"../types\";\n\nconst asyncPipe =\n <S, Opts>(...fns: ((s: S, opts: Opts) => Promise<S>)[]) =>\n async (s: S, opts: Opts) => {\n let result = s;\n for (const fn of fns) {\n result = await fn(result, opts);\n }\n return result;\n };\n\nexport async function _runMiddlewareStack<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n args: {\n uo: Deferrable<UserOperationStruct<TEntryPointVersion>>;\n context?: TContext;\n } & GetAccountParameter<TAccount> &\n UserOperationOverridesParameter<TEntryPointVersion>\n): Promise<UserOperationStruct<TEntryPointVersion>> {\n const { uo, overrides, account = client.account, context } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n const {\n dummyPaymasterAndData,\n paymasterAndData,\n }: Pick<\n ClientMiddleware<TContext>,\n \"dummyPaymasterAndData\" | \"paymasterAndData\"\n > = bypassPaymasterAndData(overrides)\n ? {\n dummyPaymasterAndData: async (uo, { overrides }) => {\n return {\n ...uo,\n ...(\"paymasterAndData\" in overrides!\n ? { paymasterAndData: overrides.paymasterAndData }\n : \"paymasterData\" in overrides! &&\n \"paymaster\" in overrides &&\n overrides.paymasterData !== \"0x\"\n ? {\n paymasterData: overrides.paymasterData,\n paymaster: overrides.paymaster,\n }\n : // At this point, nothing has run so no fields are set\n // for 0.7 when not using a paymaster, all fields should be undefined\n undefined),\n };\n },\n paymasterAndData: noopMiddleware,\n }\n : {\n dummyPaymasterAndData: client.middleware.dummyPaymasterAndData,\n paymasterAndData: client.middleware.paymasterAndData,\n };\n\n const result = await asyncPipe(\n dummyPaymasterAndData,\n client.middleware.feeEstimator,\n client.middleware.gasEstimator,\n client.middleware.customMiddleware,\n paymasterAndData,\n client.middleware.userOperationSimulator\n )(uo, { overrides, feeOptions: client.feeOptions, account, client, context });\n\n return resolveProperties<\n UserOperationStruct<GetEntryPointFromAccount<TAccount>>\n >(result);\n}\n"]}
@@ -2,4 +2,28 @@ import type { Chain, Client, Hex, SendTransactionParameters, Transport } from "v
2
2
  import type { GetEntryPointFromAccount, SmartContractAccount } from "../../account/smartContractAccount.js";
3
3
  import type { UserOperationOverrides } from "../../types.js";
4
4
  import type { UserOperationContext } from "./types.js";
5
+ /**
6
+ * Sends a transaction using the provided client, arguments, optional overrides, and context.
7
+ * This sends a UO and then waits for it to be mined
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { createSmartAccountClient } from "@aa-sdk/core";
12
+ *
13
+ * // smart account client is already extended with sendTransaction
14
+ * const client = createSmartAccountClient(...);
15
+ * const result = await client.sendTransaction({
16
+ * to: "0x...",
17
+ * data: "0x...", // or "0x",
18
+ * value: 0n, // optional
19
+ * account, // only required if the client above is not connected to an account
20
+ * });
21
+ * ```
22
+ *
23
+ * @param {Client<Transport, TChain, TAccount>} client The client to send the transaction through
24
+ * @param {SendTransactionParameters<TChain, TAccount, TChainOverride>} args The parameters required to send the transaction
25
+ * @param {UserOperationOverrides<TEntryPointVersion>} [overrides] Optional overrides for the user operation
26
+ * @param {UserOperationContext} [context] Optional context for the user operation
27
+ * @returns {Promise<Hex>} A promise that resolves to a hex string representing the transaction hash
28
+ */
5
29
  export declare function sendTransaction<TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TChainOverride extends Chain | undefined = Chain | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>>(client: Client<Transport, TChain, TAccount>, args: SendTransactionParameters<TChain, TAccount, TChainOverride>, overrides?: UserOperationOverrides<TEntryPointVersion>, context?: TContext): Promise<Hex>;
@@ -6,6 +6,30 @@ import { WaitForUserOperationError } from "../../errors/useroperation.js";
6
6
  import { buildUserOperationFromTx } from "./buildUserOperationFromTx.js";
7
7
  import { _sendUserOperation } from "./internal/sendUserOperation.js";
8
8
  import { waitForUserOperationTransaction } from "./waitForUserOperationTransacation.js";
9
+ /**
10
+ * Sends a transaction using the provided client, arguments, optional overrides, and context.
11
+ * This sends a UO and then waits for it to be mined
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { createSmartAccountClient } from "@aa-sdk/core";
16
+ *
17
+ * // smart account client is already extended with sendTransaction
18
+ * const client = createSmartAccountClient(...);
19
+ * const result = await client.sendTransaction({
20
+ * to: "0x...",
21
+ * data: "0x...", // or "0x",
22
+ * value: 0n, // optional
23
+ * account, // only required if the client above is not connected to an account
24
+ * });
25
+ * ```
26
+ *
27
+ * @param {Client<Transport, TChain, TAccount>} client The client to send the transaction through
28
+ * @param {SendTransactionParameters<TChain, TAccount, TChainOverride>} args The parameters required to send the transaction
29
+ * @param {UserOperationOverrides<TEntryPointVersion>} [overrides] Optional overrides for the user operation
30
+ * @param {UserOperationContext} [context] Optional context for the user operation
31
+ * @returns {Promise<Hex>} A promise that resolves to a hex string representing the transaction hash
32
+ */
9
33
  export async function sendTransaction(client, args, overrides, context) {
10
34
  const { account = client.account } = args;
11
35
  if (!account || typeof account === "string") {
@@ -1 +1 @@
1
- {"version":3,"file":"sendTransaction.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/sendTransaction.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AA0BxF,MAAM,CAAC,KAAK,UAAU,eAAe,CAWnC,MAA2C,EAC3C,IAAiE,EACjE,SAAsD,EACtD,OAAkB;IAElB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC1C,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,MAAM,IAAI,8BAA8B,EAAE,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,wBAAwB,EACxB,iBAAiB,EACjB,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,wBAAwB,CAC7C,MAAM,EACN,IAAI,EACJ,SAAS,EACT,OAAO,CACR,CAAC;IAEF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE;QACzD,OAAO,EAAE,OAA+B;QACxC,QAAQ;QACR,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,+BAA+B,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACnE,MAAM,IAAI,yBAAyB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type {\n Chain,\n Client,\n Hex,\n SendTransactionParameters,\n Transport,\n} from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { TransactionMissingToParamError } from \"../../errors/transaction.js\";\nimport { WaitForUserOperationError } from \"../../errors/useroperation.js\";\nimport type { UserOperationOverrides } from \"../../types.js\";\nimport { buildUserOperationFromTx } from \"./buildUserOperationFromTx.js\";\nimport { _sendUserOperation } from \"./internal/sendUserOperation.js\";\nimport type { UserOperationContext } from \"./types.js\";\nimport { waitForUserOperationTransaction } from \"./waitForUserOperationTransacation.js\";\n\n/**\n * Sends a transaction using the provided client, arguments, optional overrides, and context.\n * This sends a UO and then waits for it to be mined\n *\n * @example\n * ```ts\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with sendTransaction\n * const client = createSmartAccountClient(...);\n * const result = await client.sendTransaction({\n * to: \"0x...\",\n * data: \"0x...\", // or \"0x\",\n * value: 0n, // optional\n * account, // only required if the client above is not connected to an account\n * });\n * ```\n *\n * @param {Client<Transport, TChain, TAccount>} client The client to send the transaction through\n * @param {SendTransactionParameters<TChain, TAccount, TChainOverride>} args The parameters required to send the transaction\n * @param {UserOperationOverrides<TEntryPointVersion>} [overrides] Optional overrides for the user operation\n * @param {UserOperationContext} [context] Optional context for the user operation\n * @returns {Promise<Hex>} A promise that resolves to a hex string representing the transaction hash\n */\nexport async function sendTransaction<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TChainOverride extends Chain | undefined = Chain | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n client: Client<Transport, TChain, TAccount>,\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n): Promise<Hex> {\n const { account = client.account } = args;\n if (!account || typeof account === \"string\") {\n throw new AccountNotFoundError();\n }\n\n if (!args.to) {\n throw new TransactionMissingToParamError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"sendTransaction\",\n client\n );\n }\n\n const uoStruct = await buildUserOperationFromTx(\n client,\n args,\n overrides,\n context\n );\n\n const { hash, request } = await _sendUserOperation(client, {\n account: account as SmartContractAccount,\n uoStruct,\n context,\n overrides,\n });\n\n return waitForUserOperationTransaction(client, { hash }).catch((e) => {\n throw new WaitForUserOperationError(request, e);\n });\n}\n"]}
1
+ {"version":3,"file":"sendTransaction.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/sendTransaction.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAWnC,MAA2C,EAC3C,IAAiE,EACjE,SAAsD,EACtD,OAAkB;IAElB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC1C,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,MAAM,IAAI,8BAA8B,EAAE,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,wBAAwB,EACxB,iBAAiB,EACjB,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,wBAAwB,CAC7C,MAAM,EACN,IAAI,EACJ,SAAS,EACT,OAAO,CACR,CAAC;IAEF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE;QACzD,OAAO,EAAE,OAA+B;QACxC,QAAQ;QACR,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,+BAA+B,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACnE,MAAM,IAAI,yBAAyB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type {\n Chain,\n Client,\n Hex,\n SendTransactionParameters,\n Transport,\n} from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { TransactionMissingToParamError } from \"../../errors/transaction.js\";\nimport { WaitForUserOperationError } from \"../../errors/useroperation.js\";\nimport type { UserOperationOverrides } from \"../../types.js\";\nimport { buildUserOperationFromTx } from \"./buildUserOperationFromTx.js\";\nimport { _sendUserOperation } from \"./internal/sendUserOperation.js\";\nimport type { UserOperationContext } from \"./types.js\";\nimport { waitForUserOperationTransaction } from \"./waitForUserOperationTransacation.js\";\n\n/**\n * Sends a transaction using the provided client, arguments, optional overrides, and context.\n * This sends a UO and then waits for it to be mined\n *\n * @example\n * ```ts\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with sendTransaction\n * const client = createSmartAccountClient(...);\n * const result = await client.sendTransaction({\n * to: \"0x...\",\n * data: \"0x...\", // or \"0x\",\n * value: 0n, // optional\n * account, // only required if the client above is not connected to an account\n * });\n * ```\n *\n * @param {Client<Transport, TChain, TAccount>} client The client to send the transaction through\n * @param {SendTransactionParameters<TChain, TAccount, TChainOverride>} args The parameters required to send the transaction\n * @param {UserOperationOverrides<TEntryPointVersion>} [overrides] Optional overrides for the user operation\n * @param {UserOperationContext} [context] Optional context for the user operation\n * @returns {Promise<Hex>} A promise that resolves to a hex string representing the transaction hash\n */\nexport async function sendTransaction<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TChainOverride extends Chain | undefined = Chain | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n client: Client<Transport, TChain, TAccount>,\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n): Promise<Hex> {\n const { account = client.account } = args;\n if (!account || typeof account === \"string\") {\n throw new AccountNotFoundError();\n }\n\n if (!args.to) {\n throw new TransactionMissingToParamError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"sendTransaction\",\n client\n );\n }\n\n const uoStruct = await buildUserOperationFromTx(\n client,\n args,\n overrides,\n context\n );\n\n const { hash, request } = await _sendUserOperation(client, {\n account: account as SmartContractAccount,\n uoStruct,\n context,\n overrides,\n });\n\n return waitForUserOperationTransaction(client, { hash }).catch((e) => {\n throw new WaitForUserOperationError(request, e);\n });\n}\n"]}
@@ -1,4 +1,27 @@
1
1
  import type { Chain, Client, Hex, Transport } from "viem";
2
2
  import type { SmartContractAccount } from "../../account/smartContractAccount.js";
3
3
  import type { SendTransactionsParameters, UserOperationContext } from "./types";
4
+ /**
5
+ * Sends transactions using the provided client and transaction parameters. This function builds user operations from the transactions, sends them, and waits for the transaction to be mined.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { createSmartAccountClient } from "@aa-sdk/core";
10
+ *
11
+ * // smart account client is already extended with sendTransactions
12
+ * const client = createSmartAccountClient(...);
13
+ * const result = await client.sendTransactions({
14
+ * requests: [{
15
+ * to: "0x...",
16
+ * data: "0x...", // or "0x",
17
+ * value: 0n, // optional
18
+ * }],
19
+ * account, // only required if the client above is not connected to an account
20
+ * });
21
+ * ```
22
+ *
23
+ * @param {Client<TTransport, TChain, TAccount>} client The client used to send the transactions
24
+ * @param {SendTransactionsParameters<TAccount, TContext>} args The parameters for sending the transactions, including requests, overrides, account, and context
25
+ * @returns {Promise<Hex>} A promise that resolves to the transaction hash of the sent transactions
26
+ */
4
27
  export declare function sendTransactions<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext>(client: Client<TTransport, TChain, TAccount>, args: SendTransactionsParameters<TAccount, TContext>): Promise<Hex>;
@@ -5,6 +5,29 @@ import { WaitForUserOperationError } from "../../errors/useroperation.js";
5
5
  import { buildUserOperationFromTxs } from "./buildUserOperationFromTxs.js";
6
6
  import { _sendUserOperation } from "./internal/sendUserOperation.js";
7
7
  import { waitForUserOperationTransaction } from "./waitForUserOperationTransacation.js";
8
+ /**
9
+ * Sends transactions using the provided client and transaction parameters. This function builds user operations from the transactions, sends them, and waits for the transaction to be mined.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { createSmartAccountClient } from "@aa-sdk/core";
14
+ *
15
+ * // smart account client is already extended with sendTransactions
16
+ * const client = createSmartAccountClient(...);
17
+ * const result = await client.sendTransactions({
18
+ * requests: [{
19
+ * to: "0x...",
20
+ * data: "0x...", // or "0x",
21
+ * value: 0n, // optional
22
+ * }],
23
+ * account, // only required if the client above is not connected to an account
24
+ * });
25
+ * ```
26
+ *
27
+ * @param {Client<TTransport, TChain, TAccount>} client The client used to send the transactions
28
+ * @param {SendTransactionsParameters<TAccount, TContext>} args The parameters for sending the transactions, including requests, overrides, account, and context
29
+ * @returns {Promise<Hex>} A promise that resolves to the transaction hash of the sent transactions
30
+ */
8
31
  export async function sendTransactions(client, args) {
9
32
  const { requests, overrides, account = client.account, context } = args;
10
33
  if (!account) {
@@ -1 +1 @@
1
- {"version":3,"file":"sendTransactions.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/sendTransactions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAyBxF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAQpC,MAA4C,EAC5C,IAAoD;IAEpD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACxE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,wBAAwB,EACxB,kBAAkB,EAClB,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,yBAAyB,CAAC,MAAM,EAAE;QAC3D,QAAQ;QACR,SAAS;QACT,OAAO;QACP,OAAO;KACR,CAAC,CAAC;IAEH,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE;QACzD,OAAO;QACP,QAAQ;QACR,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,+BAA+B,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACnE,MAAM,IAAI,yBAAyB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { SmartContractAccount } from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { WaitForUserOperationError } from \"../../errors/useroperation.js\";\nimport { buildUserOperationFromTxs } from \"./buildUserOperationFromTxs.js\";\nimport { _sendUserOperation } from \"./internal/sendUserOperation.js\";\nimport type { SendTransactionsParameters, UserOperationContext } from \"./types\";\nimport { waitForUserOperationTransaction } from \"./waitForUserOperationTransacation.js\";\n\n/**\n * Sends transactions using the provided client and transaction parameters. This function builds user operations from the transactions, sends them, and waits for the transaction to be mined.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with sendTransactions\n * const client = createSmartAccountClient(...);\n * const result = await client.sendTransactions({\n * requests: [{\n * to: \"0x...\",\n * data: \"0x...\", // or \"0x\",\n * value: 0n, // optional\n * }],\n * account, // only required if the client above is not connected to an account\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client used to send the transactions\n * @param {SendTransactionsParameters<TAccount, TContext>} args The parameters for sending the transactions, including requests, overrides, account, and context\n * @returns {Promise<Hex>} A promise that resolves to the transaction hash of the sent transactions\n */\nexport async function sendTransactions<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined = UserOperationContext\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SendTransactionsParameters<TAccount, TContext>\n): Promise<Hex> {\n const { requests, overrides, account = client.account, context } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"sendTransactions\",\n client\n );\n }\n\n const { uoStruct } = await buildUserOperationFromTxs(client, {\n requests,\n overrides,\n account,\n context,\n });\n\n const { hash, request } = await _sendUserOperation(client, {\n account,\n uoStruct,\n context,\n overrides,\n });\n\n return waitForUserOperationTransaction(client, { hash }).catch((e) => {\n throw new WaitForUserOperationError(request, e);\n });\n}\n"]}
1
+ {"version":3,"file":"sendTransactions.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/sendTransactions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAQpC,MAA4C,EAC5C,IAAoD;IAEpD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACxE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,wBAAwB,EACxB,kBAAkB,EAClB,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,yBAAyB,CAAC,MAAM,EAAE;QAC3D,QAAQ;QACR,SAAS;QACT,OAAO;QACP,OAAO;KACR,CAAC,CAAC;IAEH,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE;QACzD,OAAO;QACP,QAAQ;QACR,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,+BAA+B,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACnE,MAAM,IAAI,yBAAyB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { SmartContractAccount } from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { WaitForUserOperationError } from \"../../errors/useroperation.js\";\nimport { buildUserOperationFromTxs } from \"./buildUserOperationFromTxs.js\";\nimport { _sendUserOperation } from \"./internal/sendUserOperation.js\";\nimport type { SendTransactionsParameters, UserOperationContext } from \"./types\";\nimport { waitForUserOperationTransaction } from \"./waitForUserOperationTransacation.js\";\n\n/**\n * Sends transactions using the provided client and transaction parameters. This function builds user operations from the transactions, sends them, and waits for the transaction to be mined.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with sendTransactions\n * const client = createSmartAccountClient(...);\n * const result = await client.sendTransactions({\n * requests: [{\n * to: \"0x...\",\n * data: \"0x...\", // or \"0x\",\n * value: 0n, // optional\n * }],\n * account, // only required if the client above is not connected to an account\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client used to send the transactions\n * @param {SendTransactionsParameters<TAccount, TContext>} args The parameters for sending the transactions, including requests, overrides, account, and context\n * @returns {Promise<Hex>} A promise that resolves to the transaction hash of the sent transactions\n */\nexport async function sendTransactions<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined = UserOperationContext\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SendTransactionsParameters<TAccount, TContext>\n): Promise<Hex> {\n const { requests, overrides, account = client.account, context } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"sendTransactions\",\n client\n );\n }\n\n const { uoStruct } = await buildUserOperationFromTxs(client, {\n requests,\n overrides,\n account,\n context,\n });\n\n const { hash, request } = await _sendUserOperation(client, {\n account,\n uoStruct,\n context,\n overrides,\n });\n\n return waitForUserOperationTransaction(client, { hash }).catch((e) => {\n throw new WaitForUserOperationError(request, e);\n });\n}\n"]}
@@ -2,4 +2,25 @@ import type { Chain, Client, Transport } from "viem";
2
2
  import type { GetEntryPointFromAccount, SmartContractAccount } from "../../account/smartContractAccount.js";
3
3
  import type { SendUserOperationResult } from "../../client/types.js";
4
4
  import type { SendUserOperationParameters, UserOperationContext } from "./types.js";
5
+ /**
6
+ * Sends a user operation or batch of user operations using the connected account. Before executing, sendUserOperation will run the user operation through the middleware pipeline.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { createSmartAccountClient, toSmartContractAccount } from "@aa-sdk/core";
11
+ *
12
+ * const account = await toSmartContractAccount(...);
13
+ * const result = await createSmartAccountClient(...).sendUserOperation({
14
+ * uo: {
15
+ * target: "0x...",
16
+ * data: "0x...", // or "0x",
17
+ * value: 0n, // optional
18
+ * }
19
+ * });
20
+ * ```
21
+ *
22
+ * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests
23
+ * @param {SendUserOperationParameters<TAccount, TContext>} args contains the UO or batch to send, context, overrides, and account if not hoisted on the client
24
+ * @returns {Promise<SendUserOperationResult<TEntryPointVersion>>} a Promise containing the result of the user operation
25
+ */
5
26
  export declare function sendUserOperation<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>>(client: Client<TTransport, TChain, TAccount>, args: SendUserOperationParameters<TAccount, TContext>): Promise<SendUserOperationResult<TEntryPointVersion>>;
@@ -3,6 +3,27 @@ import { AccountNotFoundError } from "../../errors/account.js";
3
3
  import { IncompatibleClientError } from "../../errors/client.js";
4
4
  import { buildUserOperation } from "./buildUserOperation.js";
5
5
  import { _sendUserOperation } from "./internal/sendUserOperation.js";
6
+ /**
7
+ * Sends a user operation or batch of user operations using the connected account. Before executing, sendUserOperation will run the user operation through the middleware pipeline.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { createSmartAccountClient, toSmartContractAccount } from "@aa-sdk/core";
12
+ *
13
+ * const account = await toSmartContractAccount(...);
14
+ * const result = await createSmartAccountClient(...).sendUserOperation({
15
+ * uo: {
16
+ * target: "0x...",
17
+ * data: "0x...", // or "0x",
18
+ * value: 0n, // optional
19
+ * }
20
+ * });
21
+ * ```
22
+ *
23
+ * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests
24
+ * @param {SendUserOperationParameters<TAccount, TContext>} args contains the UO or batch to send, context, overrides, and account if not hoisted on the client
25
+ * @returns {Promise<SendUserOperationResult<TEntryPointVersion>>} a Promise containing the result of the user operation
26
+ */
6
27
  export async function sendUserOperation(client, args) {
7
28
  const { account = client.account, context, overrides } = args;
8
29
  if (!account) {
@@ -1 +1 @@
1
- {"version":3,"file":"sendUserOperation.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/sendUserOperation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AA2BrE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAWrC,MAA4C,EAC5C,IAAqD;IAErD,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,wBAAwB,EACxB,mBAAmB,EACnB,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE;QAChD,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,OAAO;QACP,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,kBAAkB,CAAC,MAAM,EAAE;QAChC,OAAO;QACP,QAAQ;QACR,OAAO;QACP,SAAS;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Chain, Client, Transport } from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport type { SendUserOperationResult } from \"../../client/types.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { buildUserOperation } from \"./buildUserOperation.js\";\nimport { _sendUserOperation } from \"./internal/sendUserOperation.js\";\nimport type {\n SendUserOperationParameters,\n UserOperationContext,\n} from \"./types.js\";\n\n/**\n * Sends a user operation or batch of user operations using the connected account. Before executing, sendUserOperation will run the user operation through the middleware pipeline.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n *\n * const account = await toSmartContractAccount(...);\n * const result = await createSmartAccountClient(...).sendUserOperation({\n * uo: {\n * target: \"0x...\",\n * data: \"0x...\", // or \"0x\",\n * value: 0n, // optional\n * }\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests\n * @param {SendUserOperationParameters<TAccount, TContext>} args contains the UO or batch to send, context, overrides, and account if not hoisted on the client\n * @returns {Promise<SendUserOperationResult<TEntryPointVersion>>} a Promise containing the result of the user operation\n */\nexport async function sendUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SendUserOperationParameters<TAccount, TContext>\n): Promise<SendUserOperationResult<TEntryPointVersion>> {\n const { account = client.account, context, overrides } = args;\n\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"sendUserOperation\",\n client\n );\n }\n\n const uoStruct = await buildUserOperation(client, {\n uo: args.uo,\n account,\n context,\n overrides,\n });\n\n return _sendUserOperation(client, {\n account,\n uoStruct,\n context,\n overrides,\n });\n}\n"]}
1
+ {"version":3,"file":"sendUserOperation.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/sendUserOperation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAMrE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAWrC,MAA4C,EAC5C,IAAqD;IAErD,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAE9D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,oBAAoB,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,wBAAwB,EACxB,mBAAmB,EACnB,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE;QAChD,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,OAAO;QACP,OAAO;QACP,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,kBAAkB,CAAC,MAAM,EAAE;QAChC,OAAO;QACP,QAAQ;QACR,OAAO;QACP,SAAS;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Chain, Client, Transport } from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport type { SendUserOperationResult } from \"../../client/types.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { buildUserOperation } from \"./buildUserOperation.js\";\nimport { _sendUserOperation } from \"./internal/sendUserOperation.js\";\nimport type {\n SendUserOperationParameters,\n UserOperationContext,\n} from \"./types.js\";\n\n/**\n * Sends a user operation or batch of user operations using the connected account. Before executing, sendUserOperation will run the user operation through the middleware pipeline.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n *\n * const account = await toSmartContractAccount(...);\n * const result = await createSmartAccountClient(...).sendUserOperation({\n * uo: {\n * target: \"0x...\",\n * data: \"0x...\", // or \"0x\",\n * value: 0n, // optional\n * }\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests\n * @param {SendUserOperationParameters<TAccount, TContext>} args contains the UO or batch to send, context, overrides, and account if not hoisted on the client\n * @returns {Promise<SendUserOperationResult<TEntryPointVersion>>} a Promise containing the result of the user operation\n */\nexport async function sendUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SendUserOperationParameters<TAccount, TContext>\n): Promise<SendUserOperationResult<TEntryPointVersion>> {\n const { account = client.account, context, overrides } = args;\n\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"sendUserOperation\",\n client\n );\n }\n\n const uoStruct = await buildUserOperation(client, {\n uo: args.uo,\n account,\n context,\n overrides,\n });\n\n return _sendUserOperation(client, {\n account,\n uoStruct,\n context,\n overrides,\n });\n}\n"]}
@@ -24,9 +24,23 @@ export type DropAndReplaceUserOperationParameters<TAccount extends SmartContract
24
24
  } & GetAccountParameter<TAccount> & GetContextParameter<TContext> & UserOperationOverridesParameter<TEntryPointVersion>;
25
25
  export type WaitForUserOperationTxParameters = {
26
26
  hash: Hex;
27
+ /**
28
+ * Exponential backoff paramters that can be used to override
29
+ * the configuration on the client. If not provided, this method
30
+ * will use the paramters passed via the `opts` parameter on the
31
+ * smart account client.
32
+ */
27
33
  retries?: {
34
+ /**
35
+ * the base retry interval or delay between requests
36
+ */
28
37
  intervalMs: number;
38
+ /**
39
+ * the multiplier to exponentiate based on the number retries
40
+ * setting this to one will result in a linear backoff
41
+ */
29
42
  multiplier: number;
43
+ /** the maximum number of retries before failing */
30
44
  maxRetries: number;
31
45
  };
32
46
  };
@@ -1,2 +1,3 @@
1
1
  export {};
2
+ // [!endregion GetContextParameter]
2
3
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Hex, RpcTransactionRequest } from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport type { UpgradeToData } from \"../../client/types\";\nimport type { EntryPointVersion } from \"../../entrypoint/types\";\nimport type {\n BatchUserOperationCallData,\n UserOperationCallData,\n UserOperationOverridesParameter,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../../types\";\nimport type { IsUndefined } from \"../../utils\";\n\n// [!region UpgradeAccountParams]\nexport type UpgradeAccountParams<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n upgradeTo: UpgradeToData;\n waitForTx?: boolean;\n} & GetAccountParameter<TAccount> &\n GetContextParameter<TContext> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n// [!endregion UpgradeAccountParams]\n\n// [!region SendUserOperationParameters]\nexport type SendUserOperationParameters<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n uo: UserOperationCallData | BatchUserOperationCallData;\n} & GetAccountParameter<TAccount> &\n GetContextParameter<TContext> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n// [!endregion SendUserOperationParameters]\n\n// [!region BuildUserOperationParameters]\nexport type BuildUserOperationParameters<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = SendUserOperationParameters<TAccount, TContext, TEntryPointVersion>;\n// [!endregion BuildUserOperationParameters]\n\n// [!region SignUserOperationParameters]\nexport type SignUserOperationParameters<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = {\n uoStruct: UserOperationStruct<TEntryPointVersion>;\n} & GetAccountParameter<TAccount> &\n GetContextParameter<TContext>;\n// [!endregion SignUserOperationParameters]\n\n// [!region SendTransactionsParameters]\nexport type SendTransactionsParameters<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n requests: RpcTransactionRequest[];\n} & GetAccountParameter<TAccount> &\n GetContextParameter<TContext> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n// [!endregion SendTransactionsParameters]\n\n// [!region BuildTransactionParameters]\nexport type BuildTransactionParameters<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = SendTransactionsParameters<TAccount, TContext, TEntryPointVersion>;\n// [!endregion BuildTransactionParameters]\n\n// [!region DropAndReplaceUserOperationParameters]\nexport type DropAndReplaceUserOperationParameters<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n uoToDrop: UserOperationRequest<TEntryPointVersion>;\n} & GetAccountParameter<TAccount> &\n GetContextParameter<TContext> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n// [!endregion DropAndReplaceUserOperationParameters]\n\n// [!region WaitForUserOperationTxParameters]\nexport type WaitForUserOperationTxParameters = {\n hash: Hex;\n /**\n * Exponential backoff paramters that can be used to override\n * the configuration on the client. If not provided, this method\n * will use the paramters passed via the `opts` parameter on the\n * smart account client.\n */\n retries?: {\n /**\n * the base retry interval or delay between requests\n */\n intervalMs: number;\n /**\n * the multiplier to exponentiate based on the number retries\n * setting this to one will result in a linear backoff\n */\n multiplier: number;\n /** the maximum number of retries before failing */\n maxRetries: number;\n };\n};\n// [!endregion WaitForUserOperationTxParameters]\n\n// [!region BuildUserOperationFromTransactionsResult]\nexport type BuildUserOperationFromTransactionsResult<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n uoStruct: UserOperationStruct<TEntryPointVersion>;\n batch: BatchUserOperationCallData;\n} & UserOperationOverridesParameter<TEntryPointVersion, true>;\n// [!endregion BuildUserOperationFromTransactionsResult]\n\n// [!region UserOperationContext]\nexport type UserOperationContext = Record<string, any>;\n// [!endregion UserOperationContext]\n\n// [!region GetContextParameter]\nexport type GetContextParameter<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = IsUndefined<TContext> extends true\n ? {\n context?: TContext;\n }\n : { context: TContext };\n// [!endregion GetContextParameter]\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/types.ts"],"names":[],"mappings":";AA6JA,mCAAmC","sourcesContent":["import type { Hex, RpcTransactionRequest } from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport type { UpgradeToData } from \"../../client/types\";\nimport type { EntryPointVersion } from \"../../entrypoint/types\";\nimport type {\n BatchUserOperationCallData,\n UserOperationCallData,\n UserOperationOverridesParameter,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../../types\";\nimport type { IsUndefined } from \"../../utils\";\n\n// [!region UpgradeAccountParams]\nexport type UpgradeAccountParams<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n upgradeTo: UpgradeToData;\n waitForTx?: boolean;\n} & GetAccountParameter<TAccount> &\n GetContextParameter<TContext> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n// [!endregion UpgradeAccountParams]\n\n// [!region SendUserOperationParameters]\nexport type SendUserOperationParameters<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n uo: UserOperationCallData | BatchUserOperationCallData;\n} & GetAccountParameter<TAccount> &\n GetContextParameter<TContext> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n// [!endregion SendUserOperationParameters]\n\n// [!region BuildUserOperationParameters]\nexport type BuildUserOperationParameters<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = SendUserOperationParameters<TAccount, TContext, TEntryPointVersion>;\n// [!endregion BuildUserOperationParameters]\n\n// [!region SignUserOperationParameters]\nexport type SignUserOperationParameters<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = {\n uoStruct: UserOperationStruct<TEntryPointVersion>;\n} & GetAccountParameter<TAccount> &\n GetContextParameter<TContext>;\n// [!endregion SignUserOperationParameters]\n\n// [!region SendTransactionsParameters]\nexport type SendTransactionsParameters<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n requests: RpcTransactionRequest[];\n} & GetAccountParameter<TAccount> &\n GetContextParameter<TContext> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n// [!endregion SendTransactionsParameters]\n\n// [!region BuildTransactionParameters]\nexport type BuildTransactionParameters<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = SendTransactionsParameters<TAccount, TContext, TEntryPointVersion>;\n// [!endregion BuildTransactionParameters]\n\n// [!region DropAndReplaceUserOperationParameters]\nexport type DropAndReplaceUserOperationParameters<\n TAccount extends SmartContractAccount | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>\n> = {\n uoToDrop: UserOperationRequest<TEntryPointVersion>;\n} & GetAccountParameter<TAccount> &\n GetContextParameter<TContext> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n// [!endregion DropAndReplaceUserOperationParameters]\n\n// [!region WaitForUserOperationTxParameters]\nexport type WaitForUserOperationTxParameters = {\n hash: Hex;\n /**\n * Exponential backoff paramters that can be used to override\n * the configuration on the client. If not provided, this method\n * will use the paramters passed via the `opts` parameter on the\n * smart account client.\n */\n retries?: {\n /**\n * the base retry interval or delay between requests\n */\n intervalMs: number;\n /**\n * the multiplier to exponentiate based on the number retries\n * setting this to one will result in a linear backoff\n */\n multiplier: number;\n /** the maximum number of retries before failing */\n maxRetries: number;\n };\n};\n// [!endregion WaitForUserOperationTxParameters]\n\n// [!region BuildUserOperationFromTransactionsResult]\nexport type BuildUserOperationFromTransactionsResult<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n uoStruct: UserOperationStruct<TEntryPointVersion>;\n batch: BatchUserOperationCallData;\n} & UserOperationOverridesParameter<TEntryPointVersion, true>;\n// [!endregion BuildUserOperationFromTransactionsResult]\n\n// [!region UserOperationContext]\nexport type UserOperationContext = Record<string, any>;\n// [!endregion UserOperationContext]\n\n// [!region GetContextParameter]\nexport type GetContextParameter<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = IsUndefined<TContext> extends true\n ? {\n context?: TContext;\n }\n : { context: TContext };\n// [!endregion GetContextParameter]\n"]}
@@ -1,3 +1,27 @@
1
1
  import type { Chain, Client, Hex, Transport } from "viem";
2
2
  import type { WaitForUserOperationTxParameters } from "./types.js";
3
+ /**
4
+ * Waits for a user operation transaction to be confirmed by checking the receipt periodically until it is found or a maximum number of retries is reached.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { createSmartAccountClient } from "@aa-sdk/core";
9
+ *
10
+ * // smart account client is already extended with waitForUserOperationTransaction
11
+ * const client = createSmartAccountClient(...);
12
+ * const result = await client.waitForUserOperationTransaction({
13
+ * hash: "0x...",
14
+ * retries: {...} // optional param to configure the retry amounts
15
+ * });
16
+ * ```
17
+ *
18
+ * @param {Client<TTransport, TChain, any>} client The client instance used to interact with the blockchain
19
+ * @param {WaitForUserOperationTxParameters} args The parameters for the transaction to wait for
20
+ * @param {Hex} args.hash The transaction hash to wait for
21
+ * @param {WaitForUserOperationTxParameters["retries"]} [args.retries] Optional retry parameters
22
+ * @param {number} [args.retries.maxRetries] The maximum number of retry attempts
23
+ * @param {number} [args.retries.intervalMs] The interval in milliseconds between retries
24
+ * @param {number} [args.retries.multiplier] The multiplier for the interval between retries
25
+ * @returns {Promise<Hex>} A promise that resolves to the transaction hash when the transaction is confirmed
26
+ */
3
27
  export declare const waitForUserOperationTransaction: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined>(client: Client<TTransport, TChain, any>, args: WaitForUserOperationTxParameters) => Promise<Hex>;
@@ -3,6 +3,30 @@ import { isBaseSmartAccountClient } from "../../client/isSmartAccountClient.js";
3
3
  import { IncompatibleClientError } from "../../errors/client.js";
4
4
  import { FailedToFindTransactionError } from "../../errors/transaction.js";
5
5
  import { Logger } from "../../logger.js";
6
+ /**
7
+ * Waits for a user operation transaction to be confirmed by checking the receipt periodically until it is found or a maximum number of retries is reached.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { createSmartAccountClient } from "@aa-sdk/core";
12
+ *
13
+ * // smart account client is already extended with waitForUserOperationTransaction
14
+ * const client = createSmartAccountClient(...);
15
+ * const result = await client.waitForUserOperationTransaction({
16
+ * hash: "0x...",
17
+ * retries: {...} // optional param to configure the retry amounts
18
+ * });
19
+ * ```
20
+ *
21
+ * @param {Client<TTransport, TChain, any>} client The client instance used to interact with the blockchain
22
+ * @param {WaitForUserOperationTxParameters} args The parameters for the transaction to wait for
23
+ * @param {Hex} args.hash The transaction hash to wait for
24
+ * @param {WaitForUserOperationTxParameters["retries"]} [args.retries] Optional retry parameters
25
+ * @param {number} [args.retries.maxRetries] The maximum number of retry attempts
26
+ * @param {number} [args.retries.intervalMs] The interval in milliseconds between retries
27
+ * @param {number} [args.retries.multiplier] The multiplier for the interval between retries
28
+ * @returns {Promise<Hex>} A promise that resolves to the transaction hash when the transaction is confirmed
29
+ */
6
30
  export const waitForUserOperationTransaction = async (client, args) => {
7
31
  if (!isBaseSmartAccountClient(client)) {
8
32
  throw new IncompatibleClientError("BaseSmartAccountClient", "waitForUserOperationTransaction", client);
@@ -1 +1 @@
1
- {"version":3,"file":"waitForUserOperationTransacation.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/waitForUserOperationTransacation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA2BzC,MAAM,CAAC,MAAM,+BAA+B,GAMxB,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IACzC,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,wBAAwB,EACxB,iCAAiC,EACjC,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,EACJ,IAAI,EACJ,OAAO,GAAG;QACR,UAAU,EAAE,MAAM,CAAC,YAAY;QAC/B,UAAU,EAAE,MAAM,CAAC,iBAAiB;QACpC,UAAU,EAAE,MAAM,CAAC,iBAAiB;KACrC,GACF,GAAG,IAAI,CAAC;IAET,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,2BAA2B,GAC/B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;YACpD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;QAEtB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC5B,UAAU,CAAC,OAAO,EAAE,2BAA2B,CAAC,CACjD,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,MAAM;aACzB,uBAAuB,CAAC,IAAqB,CAAC;aAC9C,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACX,MAAM,CAAC,KAAK,CACV,qFAAqF,IAAI,KAAK,CAAC,EAAE,CAClG,CAAC;QACJ,CAAC,CAAC,CAAC;QAEL,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,cAAc,CAAC,MAAM,EAAE;gBAC5B,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,eAAe;aACtC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,MAAM,IAAI,4BAA4B,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC,CAAC","sourcesContent":["import type { Chain, Client, Hex, Transport } from \"viem\";\nimport { getTransaction } from \"viem/actions\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { FailedToFindTransactionError } from \"../../errors/transaction.js\";\nimport { Logger } from \"../../logger.js\";\nimport type { WaitForUserOperationTxParameters } from \"./types.js\";\n\n/**\n * Waits for a user operation transaction to be confirmed by checking the receipt periodically until it is found or a maximum number of retries is reached.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with waitForUserOperationTransaction\n * const client = createSmartAccountClient(...);\n * const result = await client.waitForUserOperationTransaction({\n * hash: \"0x...\",\n * retries: {...} // optional param to configure the retry amounts\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, any>} client The client instance used to interact with the blockchain\n * @param {WaitForUserOperationTxParameters} args The parameters for the transaction to wait for\n * @param {Hex} args.hash The transaction hash to wait for\n * @param {WaitForUserOperationTxParameters[\"retries\"]} [args.retries] Optional retry parameters\n * @param {number} [args.retries.maxRetries] The maximum number of retry attempts\n * @param {number} [args.retries.intervalMs] The interval in milliseconds between retries\n * @param {number} [args.retries.multiplier] The multiplier for the interval between retries\n * @returns {Promise<Hex>} A promise that resolves to the transaction hash when the transaction is confirmed\n */\nexport const waitForUserOperationTransaction: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined\n>(\n client: Client<TTransport, TChain, any>,\n args: WaitForUserOperationTxParameters\n) => Promise<Hex> = async (client, args) => {\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"waitForUserOperationTransaction\",\n client\n );\n }\n\n const {\n hash,\n retries = {\n maxRetries: client.txMaxRetries,\n intervalMs: client.txRetryIntervalMs,\n multiplier: client.txRetryMultiplier,\n },\n } = args;\n\n for (let i = 0; i < retries.maxRetries; i++) {\n const txRetryIntervalWithJitterMs =\n retries.intervalMs * Math.pow(retries.multiplier, i) +\n Math.random() * 100;\n\n await new Promise((resolve) =>\n setTimeout(resolve, txRetryIntervalWithJitterMs)\n );\n\n const receipt = await client\n .getUserOperationReceipt(hash as `0x${string}`)\n .catch((e) => {\n Logger.error(\n `[SmartAccountProvider] waitForUserOperationTransaction error fetching receipt for ${hash}: ${e}`\n );\n });\n\n if (receipt) {\n return getTransaction(client, {\n hash: receipt.receipt.transactionHash,\n }).then((x) => x.hash);\n }\n }\n\n throw new FailedToFindTransactionError(hash);\n};\n"]}
1
+ {"version":3,"file":"waitForUserOperationTransacation.js","sourceRoot":"","sources":["../../../../src/actions/smartAccount/waitForUserOperationTransacation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAMxB,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IACzC,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,uBAAuB,CAC/B,wBAAwB,EACxB,iCAAiC,EACjC,MAAM,CACP,CAAC;IACJ,CAAC;IAED,MAAM,EACJ,IAAI,EACJ,OAAO,GAAG;QACR,UAAU,EAAE,MAAM,CAAC,YAAY;QAC/B,UAAU,EAAE,MAAM,CAAC,iBAAiB;QACpC,UAAU,EAAE,MAAM,CAAC,iBAAiB;KACrC,GACF,GAAG,IAAI,CAAC;IAET,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,2BAA2B,GAC/B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;YACpD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;QAEtB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC5B,UAAU,CAAC,OAAO,EAAE,2BAA2B,CAAC,CACjD,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,MAAM;aACzB,uBAAuB,CAAC,IAAqB,CAAC;aAC9C,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACX,MAAM,CAAC,KAAK,CACV,qFAAqF,IAAI,KAAK,CAAC,EAAE,CAClG,CAAC;QACJ,CAAC,CAAC,CAAC;QAEL,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,cAAc,CAAC,MAAM,EAAE;gBAC5B,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,eAAe;aACtC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,MAAM,IAAI,4BAA4B,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC,CAAC","sourcesContent":["import type { Chain, Client, Hex, Transport } from \"viem\";\nimport { getTransaction } from \"viem/actions\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { FailedToFindTransactionError } from \"../../errors/transaction.js\";\nimport { Logger } from \"../../logger.js\";\nimport type { WaitForUserOperationTxParameters } from \"./types.js\";\n\n/**\n * Waits for a user operation transaction to be confirmed by checking the receipt periodically until it is found or a maximum number of retries is reached.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with waitForUserOperationTransaction\n * const client = createSmartAccountClient(...);\n * const result = await client.waitForUserOperationTransaction({\n * hash: \"0x...\",\n * retries: {...} // optional param to configure the retry amounts\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, any>} client The client instance used to interact with the blockchain\n * @param {WaitForUserOperationTxParameters} args The parameters for the transaction to wait for\n * @param {Hex} args.hash The transaction hash to wait for\n * @param {WaitForUserOperationTxParameters[\"retries\"]} [args.retries] Optional retry parameters\n * @param {number} [args.retries.maxRetries] The maximum number of retry attempts\n * @param {number} [args.retries.intervalMs] The interval in milliseconds between retries\n * @param {number} [args.retries.multiplier] The multiplier for the interval between retries\n * @returns {Promise<Hex>} A promise that resolves to the transaction hash when the transaction is confirmed\n */\nexport const waitForUserOperationTransaction: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined\n>(\n client: Client<TTransport, TChain, any>,\n args: WaitForUserOperationTxParameters\n) => Promise<Hex> = async (client, args) => {\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"waitForUserOperationTransaction\",\n client\n );\n }\n\n const {\n hash,\n retries = {\n maxRetries: client.txMaxRetries,\n intervalMs: client.txRetryIntervalMs,\n multiplier: client.txRetryMultiplier,\n },\n } = args;\n\n for (let i = 0; i < retries.maxRetries; i++) {\n const txRetryIntervalWithJitterMs =\n retries.intervalMs * Math.pow(retries.multiplier, i) +\n Math.random() * 100;\n\n await new Promise((resolve) =>\n setTimeout(resolve, txRetryIntervalWithJitterMs)\n );\n\n const receipt = await client\n .getUserOperationReceipt(hash as `0x${string}`)\n .catch((e) => {\n Logger.error(\n `[SmartAccountProvider] waitForUserOperationTransaction error fetching receipt for ${hash}: ${e}`\n );\n });\n\n if (receipt) {\n return getTransaction(client, {\n hash: receipt.receipt.transactionHash,\n }).then((x) => x.hash);\n }\n }\n\n throw new FailedToFindTransactionError(hash);\n};\n"]}
@@ -4,7 +4,28 @@ export type BundlerClient<T extends Transport = Transport> = Client<T, Chain, un
4
4
  ...PublicRpcSchema,
5
5
  ...BundlerRpcSchema
6
6
  ], PublicActions<T, Chain> & BundlerActions>;
7
+ /**
8
+ * Creates a bundler client from an existing public client with the provided transport and chain.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { createPublicClient } from "viem";
13
+ * import { createBundlerClientFromExisting } from "@aa-sdk/core";
14
+ *
15
+ * const publicClient = createPublicClient(...);
16
+ * const bundlerClient = createBundlerClientFromExisting(publicClient);
17
+ * ```
18
+ *
19
+ * @param {PublicClient<T, Chain>} client The existing public client to be extended with bundler actions
20
+ * @returns {BundlerClient<T>} A bundler client that extends the functionality of the provided public client
21
+ */
7
22
  export declare const createBundlerClientFromExisting: <T extends Transport | FallbackTransport = Transport>(client: PublicClient<T, Chain>) => BundlerClient<T>;
23
+ /**
24
+ * Creates a PublicClient with methods for calling Bundler RPC methods
25
+ *
26
+ * @param {PublicClientConfig<TTransport, Chain> & { type?: string }} args - configuration for the client
27
+ * @returns {BundlerClient<TTransport>} a PublicClient with methods for calling Bundler RPC methods
28
+ */
8
29
  export declare function createBundlerClient<TTransport extends Transport>(args: PublicClientConfig<TTransport, Chain> & {
9
30
  type?: string;
10
31
  }): BundlerClient<TTransport>;
@@ -2,9 +2,41 @@ import { createClient, http, publicActions, } from "viem";
2
2
  import { ChainNotFoundError } from "../errors/client.js";
3
3
  import { VERSION } from "../version.js";
4
4
  import { bundlerActions, } from "./decorators/bundlerClient.js";
5
+ /**
6
+ * Creates a bundler client from an existing public client with the provided transport and chain.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { createPublicClient } from "viem";
11
+ * import { createBundlerClientFromExisting } from "@aa-sdk/core";
12
+ *
13
+ * const publicClient = createPublicClient(...);
14
+ * const bundlerClient = createBundlerClientFromExisting(publicClient);
15
+ * ```
16
+ *
17
+ * @param {PublicClient<T, Chain>} client The existing public client to be extended with bundler actions
18
+ * @returns {BundlerClient<T>} A bundler client that extends the functionality of the provided public client
19
+ */
5
20
  export const createBundlerClientFromExisting = (client) => {
6
21
  return client.extend(bundlerActions);
7
22
  };
23
+ /**
24
+ * Creates a Bundler Client using the provided configuration parameters, including chain and optional type.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { createBundlerClient } from "@aa-sdk/core";
29
+ * import { sepolia } from "viem/chains";
30
+ *
31
+ * const client = createBundlerClient({
32
+ * chain: sepolia,
33
+ * transport: http("RPC_URL"),
34
+ * });
35
+ * ```
36
+ *
37
+ * @param {PublicClientConfig & { type?: string }} args Configuration for creating the Bundler Client, including parameters for the chain, transport, and optional type
38
+ * @returns {BundlerClient} The created Bundler Client with extended public and bundler actions
39
+ */
8
40
  export function createBundlerClient(args) {
9
41
  if (!args.chain) {
10
42
  throw new ChainNotFoundError();
@@ -1 +1 @@
1
- {"version":3,"file":"bundlerClient.js","sourceRoot":"","sources":["../../../src/client/bundlerClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,aAAa,GAUd,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,cAAc,GAGf,MAAM,+BAA+B,CAAC;AA0BvC,MAAM,CAAC,MAAM,+BAA+B,GAIpB,CACtB,MAA8B,EACZ,EAAE;IACpB,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AACvC,CAAC,CAAC;AA8BF,MAAM,UAAU,mBAAmB,CACjC,IAA4C;IAE5C,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IACD,MAAM,EACJ,GAAG,GAAG,gBAAgB,EACtB,IAAI,GAAG,uBAAuB,EAC9B,IAAI,GAAG,eAAe,GACvB,GAAG,IAAI,CAAC;IAET,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IACpC,MAAM,iBAAiB,GAAG,SAAS,CAAC;QAClC,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,eAAe,EAAE,IAAI,CAAC,eAAe;KACtC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG;QACrB,GAAG,IAAI;QACP,GAAG;QACH,IAAI;QACJ,IAAI;KACL,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;QACnB,IAAI,iBAAiB,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC7C,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,iBAAiB,CAAC,KAG9D,CAAC;YAEF,MAAM,YAAY,GAAG,aAAa,IAAI,EAAE,CAAC;YAEzC,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC9C,YAAY,CAAC,OAAO,GAAG;oBACrB,GAAG,YAAY,CAAC,OAAO;oBACvB,wBAAwB,EAAE,OAAO;iBAClC,CAAC;YACJ,CAAC;YAED,OAAO,YAAY,CAAmB;gBACpC,GAAG,cAAc;gBACjB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;oBACnB,GAAG,iBAAiB,CAAC,MAAM;oBAC3B,YAAY;iBACb,CAAC;aACH,CAAC,CAAC;QACL,CAAC;QAED,OAAO,YAAY,CAAmB,cAAc,CAAC,CAAC;IACxD,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import {\n createClient,\n http,\n publicActions,\n type Chain,\n type Client,\n type FallbackTransport,\n type HttpTransportConfig,\n type PublicActions,\n type PublicClient,\n type PublicClientConfig,\n type PublicRpcSchema,\n type Transport,\n} from \"viem\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { VERSION } from \"../version.js\";\nimport {\n bundlerActions,\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\n\n// [!region BundlerClient]\nexport type BundlerClient<T extends Transport = Transport> = Client<\n T,\n Chain,\n undefined,\n [...PublicRpcSchema, ...BundlerRpcSchema],\n PublicActions<T, Chain> & BundlerActions\n>;\n\n/**\n * Creates a bundler client from an existing public client with the provided transport and chain.\n *\n * @example\n * ```ts\n * import { createPublicClient } from \"viem\";\n * import { createBundlerClientFromExisting } from \"@aa-sdk/core\";\n *\n * const publicClient = createPublicClient(...);\n * const bundlerClient = createBundlerClientFromExisting(publicClient);\n * ```\n *\n * @param {PublicClient<T, Chain>} client The existing public client to be extended with bundler actions\n * @returns {BundlerClient<T>} A bundler client that extends the functionality of the provided public client\n */\nexport const createBundlerClientFromExisting: <\n T extends Transport | FallbackTransport = Transport\n>(\n client: PublicClient<T, Chain>\n) => BundlerClient<T> = <T extends Transport | FallbackTransport = Transport>(\n client: PublicClient<T, Chain>\n): BundlerClient<T> => {\n return client.extend(bundlerActions);\n};\n// [!endregion BundlerClient]\n\n/**\n * Creates a PublicClient with methods for calling Bundler RPC methods\n *\n * @param {PublicClientConfig<TTransport, Chain> & { type?: string }} args - configuration for the client\n * @returns {BundlerClient<TTransport>} a PublicClient with methods for calling Bundler RPC methods\n */\nexport function createBundlerClient<TTransport extends Transport>(\n args: PublicClientConfig<TTransport, Chain> & { type?: string }\n): BundlerClient<TTransport>;\n\n/**\n * Creates a Bundler Client using the provided configuration parameters, including chain and optional type.\n *\n * @example\n * ```ts\n * import { createBundlerClient } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createBundlerClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * });\n * ```\n *\n * @param {PublicClientConfig & { type?: string }} args Configuration for creating the Bundler Client, including parameters for the chain, transport, and optional type\n * @returns {BundlerClient} The created Bundler Client with extended public and bundler actions\n */\nexport function createBundlerClient(\n args: PublicClientConfig & { type?: string }\n): BundlerClient {\n if (!args.chain) {\n throw new ChainNotFoundError();\n }\n const {\n key = \"bundler-public\",\n name = \"Public Bundler Client\",\n type = \"bundlerClient\",\n } = args;\n\n const { transport, ...opts } = args;\n const resolvedTransport = transport({\n chain: args.chain,\n pollingInterval: opts.pollingInterval,\n });\n\n const baseParameters = {\n ...args,\n key,\n name,\n type,\n };\n\n const client = (() => {\n if (resolvedTransport.config.type === \"http\") {\n const { url, fetchOptions: fetchOptions_ } = resolvedTransport.value as {\n fetchOptions: HttpTransportConfig[\"fetchOptions\"];\n url: string;\n };\n\n const fetchOptions = fetchOptions_ ?? {};\n\n if (url.toLowerCase().indexOf(\"alchemy\") > -1) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n \"Alchemy-AA-Sdk-Version\": VERSION,\n };\n }\n\n return createClient<Transport, Chain>({\n ...baseParameters,\n transport: http(url, {\n ...resolvedTransport.config,\n fetchOptions,\n }),\n });\n }\n\n return createClient<Transport, Chain>(baseParameters);\n })();\n\n return client.extend(publicActions).extend(bundlerActions);\n}\n"]}
1
+ {"version":3,"file":"bundlerClient.js","sourceRoot":"","sources":["../../../src/client/bundlerClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,aAAa,GAUd,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,cAAc,GAGf,MAAM,+BAA+B,CAAC;AAWvC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAIpB,CACtB,MAA8B,EACZ,EAAE;IACpB,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AACvC,CAAC,CAAC;AAaF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAA4C;IAE5C,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IACD,MAAM,EACJ,GAAG,GAAG,gBAAgB,EACtB,IAAI,GAAG,uBAAuB,EAC9B,IAAI,GAAG,eAAe,GACvB,GAAG,IAAI,CAAC;IAET,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IACpC,MAAM,iBAAiB,GAAG,SAAS,CAAC;QAClC,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,eAAe,EAAE,IAAI,CAAC,eAAe;KACtC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG;QACrB,GAAG,IAAI;QACP,GAAG;QACH,IAAI;QACJ,IAAI;KACL,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;QACnB,IAAI,iBAAiB,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YAC7C,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,iBAAiB,CAAC,KAG9D,CAAC;YAEF,MAAM,YAAY,GAAG,aAAa,IAAI,EAAE,CAAC;YAEzC,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC9C,YAAY,CAAC,OAAO,GAAG;oBACrB,GAAG,YAAY,CAAC,OAAO;oBACvB,wBAAwB,EAAE,OAAO;iBAClC,CAAC;YACJ,CAAC;YAED,OAAO,YAAY,CAAmB;gBACpC,GAAG,cAAc;gBACjB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;oBACnB,GAAG,iBAAiB,CAAC,MAAM;oBAC3B,YAAY;iBACb,CAAC;aACH,CAAC,CAAC;QACL,CAAC;QAED,OAAO,YAAY,CAAmB,cAAc,CAAC,CAAC;IACxD,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import {\n createClient,\n http,\n publicActions,\n type Chain,\n type Client,\n type FallbackTransport,\n type HttpTransportConfig,\n type PublicActions,\n type PublicClient,\n type PublicClientConfig,\n type PublicRpcSchema,\n type Transport,\n} from \"viem\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { VERSION } from \"../version.js\";\nimport {\n bundlerActions,\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\n\n// [!region BundlerClient]\nexport type BundlerClient<T extends Transport = Transport> = Client<\n T,\n Chain,\n undefined,\n [...PublicRpcSchema, ...BundlerRpcSchema],\n PublicActions<T, Chain> & BundlerActions\n>;\n\n/**\n * Creates a bundler client from an existing public client with the provided transport and chain.\n *\n * @example\n * ```ts\n * import { createPublicClient } from \"viem\";\n * import { createBundlerClientFromExisting } from \"@aa-sdk/core\";\n *\n * const publicClient = createPublicClient(...);\n * const bundlerClient = createBundlerClientFromExisting(publicClient);\n * ```\n *\n * @param {PublicClient<T, Chain>} client The existing public client to be extended with bundler actions\n * @returns {BundlerClient<T>} A bundler client that extends the functionality of the provided public client\n */\nexport const createBundlerClientFromExisting: <\n T extends Transport | FallbackTransport = Transport\n>(\n client: PublicClient<T, Chain>\n) => BundlerClient<T> = <T extends Transport | FallbackTransport = Transport>(\n client: PublicClient<T, Chain>\n): BundlerClient<T> => {\n return client.extend(bundlerActions);\n};\n// [!endregion BundlerClient]\n\n/**\n * Creates a PublicClient with methods for calling Bundler RPC methods\n *\n * @param {PublicClientConfig<TTransport, Chain> & { type?: string }} args - configuration for the client\n * @returns {BundlerClient<TTransport>} a PublicClient with methods for calling Bundler RPC methods\n */\nexport function createBundlerClient<TTransport extends Transport>(\n args: PublicClientConfig<TTransport, Chain> & { type?: string }\n): BundlerClient<TTransport>;\n\n/**\n * Creates a Bundler Client using the provided configuration parameters, including chain and optional type.\n *\n * @example\n * ```ts\n * import { createBundlerClient } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createBundlerClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * });\n * ```\n *\n * @param {PublicClientConfig & { type?: string }} args Configuration for creating the Bundler Client, including parameters for the chain, transport, and optional type\n * @returns {BundlerClient} The created Bundler Client with extended public and bundler actions\n */\nexport function createBundlerClient(\n args: PublicClientConfig & { type?: string }\n): BundlerClient {\n if (!args.chain) {\n throw new ChainNotFoundError();\n }\n const {\n key = \"bundler-public\",\n name = \"Public Bundler Client\",\n type = \"bundlerClient\",\n } = args;\n\n const { transport, ...opts } = args;\n const resolvedTransport = transport({\n chain: args.chain,\n pollingInterval: opts.pollingInterval,\n });\n\n const baseParameters = {\n ...args,\n key,\n name,\n type,\n };\n\n const client = (() => {\n if (resolvedTransport.config.type === \"http\") {\n const { url, fetchOptions: fetchOptions_ } = resolvedTransport.value as {\n fetchOptions: HttpTransportConfig[\"fetchOptions\"];\n url: string;\n };\n\n const fetchOptions = fetchOptions_ ?? {};\n\n if (url.toLowerCase().indexOf(\"alchemy\") > -1) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n \"Alchemy-AA-Sdk-Version\": VERSION,\n };\n }\n\n return createClient<Transport, Chain>({\n ...baseParameters,\n transport: http(url, {\n ...resolvedTransport.config,\n fetchOptions,\n }),\n });\n }\n\n return createClient<Transport, Chain>(baseParameters);\n })();\n\n return client.extend(publicActions).extend(bundlerActions);\n}\n"]}