@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
@@ -29,12 +29,53 @@ export type BundlerRpcSchema = [
29
29
  }
30
30
  ];
31
31
  export type BundlerActions = {
32
+ /**
33
+ * calls `eth_estimateUserOperationGas` and returns the result
34
+ *
35
+ * @param request - the UserOperationRequest to estimate gas for
36
+ * @param entryPoint - the entry point address the op will be sent to
37
+ * @param stateOverride - the state override to use for the estimation
38
+ * @returns the gas estimates for the given response
39
+ */
32
40
  estimateUserOperationGas<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationRequest<TEntryPointVersion>, entryPoint: Address, stateOverride?: StateOverride): Promise<UserOperationEstimateGasResponse<TEntryPointVersion>>;
41
+ /**
42
+ * calls `eth_sendUserOperation` and returns the hash of the sent UserOperation
43
+ *
44
+ * @param request - the UserOperationRequest to send
45
+ * @param entryPoint - the entry point address the op will be sent to
46
+ * @returns the hash of the sent UserOperation
47
+ */
33
48
  sendRawUserOperation<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationRequest<TEntryPointVersion>, entryPoint: Address): Promise<Hash>;
49
+ /**
50
+ * calls `eth_getUserOperationByHash` and returns the UserOperationResponse
51
+ *
52
+ * @param hash - the hash of the UserOperation to fetch
53
+ * @returns - the user operation if found or null
54
+ */
34
55
  getUserOperationByHash(hash: Hash): Promise<UserOperationResponse | null>;
56
+ /**
57
+ * calls `eth_getUserOperationReceipt` and returns the UserOperationReceipt
58
+ *
59
+ * @param hash - the hash of the UserOperation to get the receipt for
60
+ * @returns - a user operation receipt or null if not found
61
+ */
35
62
  getUserOperationReceipt(hash: Hash): Promise<UserOperationReceipt | null>;
63
+ /**
64
+ * calls `eth_supportedEntryPoints` and returns the entry points the RPC supports
65
+ *
66
+ * @returns - an array of the entrypoint addresses supported
67
+ */
36
68
  getSupportedEntryPoints(): Promise<Address[]>;
37
69
  };
70
+ /**
71
+ * A viem client decorator that provides Bundler specific actions.
72
+ * These actions include estimating gas for user operations, sending raw user operations, retrieving user operations by hash, getting supported entry points, and getting user operation receipts.
73
+ *
74
+ * NOTE: this is already added to the client returned from `createBundlerClient`
75
+ *
76
+ * @param {TClient} client The client instance that will be used to perform bundler actions
77
+ * @returns {BundlerActions} An object containing various bundler-related actions that can be executed using the provided client
78
+ */
38
79
  export declare const bundlerActions: <TClient extends Client<Transport, Chain | undefined, any, [
39
80
  ...PublicRpcSchema,
40
81
  ...BundlerRpcSchema
@@ -3,6 +3,16 @@ import { getSupportedEntryPoints } from "../../actions/bundler/getSupportedEntry
3
3
  import { getUserOperationByHash } from "../../actions/bundler/getUserOperationByHash.js";
4
4
  import { getUserOperationReceipt } from "../../actions/bundler/getUserOperationReceipt.js";
5
5
  import { sendRawUserOperation } from "../../actions/bundler/sendRawUserOperation.js";
6
+ // [!endregion BundlerActions]
7
+ /**
8
+ * A viem client decorator that provides Bundler specific actions.
9
+ * These actions include estimating gas for user operations, sending raw user operations, retrieving user operations by hash, getting supported entry points, and getting user operation receipts.
10
+ *
11
+ * NOTE: this is already added to the client returned from `createBundlerClient`
12
+ *
13
+ * @param {TClient} client The client instance that will be used to perform bundler actions
14
+ * @returns {BundlerActions} An object containing various bundler-related actions that can be executed using the provided client
15
+ */
6
16
  export const bundlerActions = (client) => ({
7
17
  estimateUserOperationGas: async (request, entryPoint, stateOverride) => estimateUserOperationGas(client, { request, entryPoint, stateOverride }),
8
18
  sendRawUserOperation: async (request, entryPoint) => sendRawUserOperation(client, { request, entryPoint }),
@@ -1 +1 @@
1
- {"version":3,"file":"bundlerClient.js","sourceRoot":"","sources":["../../../../src/client/decorators/bundlerClient.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAwGrF,MAAM,CAAC,MAAM,cAAc,GASL,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACjC,wBAAwB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,CACrE,wBAAwB,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;IAC1E,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,CAClD,oBAAoB,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IACvD,sBAAsB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACrC,sBAAsB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC;IAC1C,uBAAuB,EAAE,KAAK,IAAI,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC;IACpE,uBAAuB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACtC,uBAAuB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC;CAC5C,CAAC,CAAC","sourcesContent":["import type {\n Address,\n Chain,\n Client,\n Hash,\n PublicRpcSchema,\n RpcStateOverride,\n StateOverride,\n Transport,\n} from \"viem\";\nimport { estimateUserOperationGas } from \"../../actions/bundler/estimateUserOperationGas.js\";\nimport { getSupportedEntryPoints } from \"../../actions/bundler/getSupportedEntryPoints.js\";\nimport { getUserOperationByHash } from \"../../actions/bundler/getUserOperationByHash.js\";\nimport { getUserOperationReceipt } from \"../../actions/bundler/getUserOperationReceipt.js\";\nimport { sendRawUserOperation } from \"../../actions/bundler/sendRawUserOperation.js\";\nimport type { EntryPointVersion } from \"../../entrypoint/types.js\";\nimport type {\n UserOperationEstimateGasResponse,\n UserOperationReceipt,\n UserOperationRequest,\n UserOperationResponse,\n} from \"../../types.js\";\n\n// Reference: https://eips.ethereum.org/EIPS/eip-4337#rpc-methods-eth-namespace\nexport type BundlerRpcSchema = [\n {\n Method: \"eth_sendUserOperation\";\n Parameters: [UserOperationRequest, Address];\n ReturnType: Hash;\n },\n {\n Method: \"eth_estimateUserOperationGas\";\n Parameters: [UserOperationRequest, Address, RpcStateOverride?];\n ReturnType: UserOperationEstimateGasResponse;\n },\n {\n Method: \"eth_getUserOperationReceipt\";\n Parameters: [Hash];\n ReturnType: UserOperationReceipt | null;\n },\n {\n Method: \"eth_getUserOperationByHash\";\n Parameters: [Hash];\n ReturnType: UserOperationResponse | null;\n },\n {\n Method: \"eth_supportedEntryPoints\";\n Parameters: [];\n ReturnType: Address[];\n }\n];\n\n// [!region BundlerActions]\nexport type BundlerActions = {\n /**\n * calls `eth_estimateUserOperationGas` and returns the result\n *\n * @param request - the UserOperationRequest to estimate gas for\n * @param entryPoint - the entry point address the op will be sent to\n * @param stateOverride - the state override to use for the estimation\n * @returns the gas estimates for the given response\n */\n estimateUserOperationGas<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n >(\n request: UserOperationRequest<TEntryPointVersion>,\n entryPoint: Address,\n stateOverride?: StateOverride\n ): Promise<UserOperationEstimateGasResponse<TEntryPointVersion>>;\n\n /**\n * calls `eth_sendUserOperation` and returns the hash of the sent UserOperation\n *\n * @param request - the UserOperationRequest to send\n * @param entryPoint - the entry point address the op will be sent to\n * @returns the hash of the sent UserOperation\n */\n sendRawUserOperation<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n >(\n request: UserOperationRequest<TEntryPointVersion>,\n entryPoint: Address\n ): Promise<Hash>;\n\n /**\n * calls `eth_getUserOperationByHash` and returns the UserOperationResponse\n *\n * @param hash - the hash of the UserOperation to fetch\n * @returns - the user operation if found or null\n */\n getUserOperationByHash(hash: Hash): Promise<UserOperationResponse | null>;\n\n /**\n * calls `eth_getUserOperationReceipt` and returns the UserOperationReceipt\n *\n * @param hash - the hash of the UserOperation to get the receipt for\n * @returns - a user operation receipt or null if not found\n */\n getUserOperationReceipt(hash: Hash): Promise<UserOperationReceipt | null>;\n\n /**\n * calls `eth_supportedEntryPoints` and returns the entry points the RPC supports\n *\n * @returns - an array of the entrypoint addresses supported\n */\n getSupportedEntryPoints(): Promise<Address[]>;\n};\n// [!endregion BundlerActions]\n\n/**\n * A viem client decorator that provides Bundler specific actions.\n * These actions include estimating gas for user operations, sending raw user operations, retrieving user operations by hash, getting supported entry points, and getting user operation receipts.\n *\n * NOTE: this is already added to the client returned from `createBundlerClient`\n *\n * @param {TClient} client The client instance that will be used to perform bundler actions\n * @returns {BundlerActions} An object containing various bundler-related actions that can be executed using the provided client\n */\nexport const bundlerActions: <\n TClient extends Client<\n Transport,\n Chain | undefined,\n any,\n [...PublicRpcSchema, ...BundlerRpcSchema]\n >\n>(\n client: TClient\n) => BundlerActions = (client) => ({\n estimateUserOperationGas: async (request, entryPoint, stateOverride) =>\n estimateUserOperationGas(client, { request, entryPoint, stateOverride }),\n sendRawUserOperation: async (request, entryPoint) =>\n sendRawUserOperation(client, { request, entryPoint }),\n getUserOperationByHash: async (hash) =>\n getUserOperationByHash(client, { hash }),\n getSupportedEntryPoints: async () => getSupportedEntryPoints(client),\n getUserOperationReceipt: async (hash) =>\n getUserOperationReceipt(client, { hash }),\n});\n"]}
1
+ {"version":3,"file":"bundlerClient.js","sourceRoot":"","sources":["../../../../src/client/decorators/bundlerClient.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AA6FrF,8BAA8B;AAE9B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GASL,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACjC,wBAAwB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,CACrE,wBAAwB,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;IAC1E,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,CAClD,oBAAoB,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IACvD,sBAAsB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACrC,sBAAsB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC;IAC1C,uBAAuB,EAAE,KAAK,IAAI,EAAE,CAAC,uBAAuB,CAAC,MAAM,CAAC;IACpE,uBAAuB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACtC,uBAAuB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC;CAC5C,CAAC,CAAC","sourcesContent":["import type {\n Address,\n Chain,\n Client,\n Hash,\n PublicRpcSchema,\n RpcStateOverride,\n StateOverride,\n Transport,\n} from \"viem\";\nimport { estimateUserOperationGas } from \"../../actions/bundler/estimateUserOperationGas.js\";\nimport { getSupportedEntryPoints } from \"../../actions/bundler/getSupportedEntryPoints.js\";\nimport { getUserOperationByHash } from \"../../actions/bundler/getUserOperationByHash.js\";\nimport { getUserOperationReceipt } from \"../../actions/bundler/getUserOperationReceipt.js\";\nimport { sendRawUserOperation } from \"../../actions/bundler/sendRawUserOperation.js\";\nimport type { EntryPointVersion } from \"../../entrypoint/types.js\";\nimport type {\n UserOperationEstimateGasResponse,\n UserOperationReceipt,\n UserOperationRequest,\n UserOperationResponse,\n} from \"../../types.js\";\n\n// Reference: https://eips.ethereum.org/EIPS/eip-4337#rpc-methods-eth-namespace\nexport type BundlerRpcSchema = [\n {\n Method: \"eth_sendUserOperation\";\n Parameters: [UserOperationRequest, Address];\n ReturnType: Hash;\n },\n {\n Method: \"eth_estimateUserOperationGas\";\n Parameters: [UserOperationRequest, Address, RpcStateOverride?];\n ReturnType: UserOperationEstimateGasResponse;\n },\n {\n Method: \"eth_getUserOperationReceipt\";\n Parameters: [Hash];\n ReturnType: UserOperationReceipt | null;\n },\n {\n Method: \"eth_getUserOperationByHash\";\n Parameters: [Hash];\n ReturnType: UserOperationResponse | null;\n },\n {\n Method: \"eth_supportedEntryPoints\";\n Parameters: [];\n ReturnType: Address[];\n }\n];\n\n// [!region BundlerActions]\nexport type BundlerActions = {\n /**\n * calls `eth_estimateUserOperationGas` and returns the result\n *\n * @param request - the UserOperationRequest to estimate gas for\n * @param entryPoint - the entry point address the op will be sent to\n * @param stateOverride - the state override to use for the estimation\n * @returns the gas estimates for the given response\n */\n estimateUserOperationGas<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n >(\n request: UserOperationRequest<TEntryPointVersion>,\n entryPoint: Address,\n stateOverride?: StateOverride\n ): Promise<UserOperationEstimateGasResponse<TEntryPointVersion>>;\n\n /**\n * calls `eth_sendUserOperation` and returns the hash of the sent UserOperation\n *\n * @param request - the UserOperationRequest to send\n * @param entryPoint - the entry point address the op will be sent to\n * @returns the hash of the sent UserOperation\n */\n sendRawUserOperation<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n >(\n request: UserOperationRequest<TEntryPointVersion>,\n entryPoint: Address\n ): Promise<Hash>;\n\n /**\n * calls `eth_getUserOperationByHash` and returns the UserOperationResponse\n *\n * @param hash - the hash of the UserOperation to fetch\n * @returns - the user operation if found or null\n */\n getUserOperationByHash(hash: Hash): Promise<UserOperationResponse | null>;\n\n /**\n * calls `eth_getUserOperationReceipt` and returns the UserOperationReceipt\n *\n * @param hash - the hash of the UserOperation to get the receipt for\n * @returns - a user operation receipt or null if not found\n */\n getUserOperationReceipt(hash: Hash): Promise<UserOperationReceipt | null>;\n\n /**\n * calls `eth_supportedEntryPoints` and returns the entry points the RPC supports\n *\n * @returns - an array of the entrypoint addresses supported\n */\n getSupportedEntryPoints(): Promise<Address[]>;\n};\n// [!endregion BundlerActions]\n\n/**\n * A viem client decorator that provides Bundler specific actions.\n * These actions include estimating gas for user operations, sending raw user operations, retrieving user operations by hash, getting supported entry points, and getting user operation receipts.\n *\n * NOTE: this is already added to the client returned from `createBundlerClient`\n *\n * @param {TClient} client The client instance that will be used to perform bundler actions\n * @returns {BundlerActions} An object containing various bundler-related actions that can be executed using the provided client\n */\nexport const bundlerActions: <\n TClient extends Client<\n Transport,\n Chain | undefined,\n any,\n [...PublicRpcSchema, ...BundlerRpcSchema]\n >\n>(\n client: TClient\n) => BundlerActions = (client) => ({\n estimateUserOperationGas: async (request, entryPoint, stateOverride) =>\n estimateUserOperationGas(client, { request, entryPoint, stateOverride }),\n sendRawUserOperation: async (request, entryPoint) =>\n sendRawUserOperation(client, { request, entryPoint }),\n getUserOperationByHash: async (hash) =>\n getUserOperationByHash(client, { hash }),\n getSupportedEntryPoints: async () => getSupportedEntryPoints(client),\n getUserOperationReceipt: async (hash) =>\n getUserOperationReceipt(client, { hash }),\n});\n"]}
@@ -31,5 +31,13 @@ export type BaseSmartAccountClientActions<TChain extends Chain | undefined = Cha
31
31
  } : {
32
32
  getAddress: (args: GetAccountParameter<TAccount>) => Address;
33
33
  });
34
+ /**
35
+ * Provides a set of smart account client actions to decorate the provided client. These actions include building and signing user operations, sending transactions, and more.
36
+ *
37
+ * NOTE: this is already added to clients returned from `createSmartAccountClient`
38
+ *
39
+ * @param {Client<TTransport, TChain, TAccount>} client The client to bind the smart account actions to
40
+ * @returns {BaseSmartAccountClientActions<TChain, TAccount, TContext>} An object containing various smart account client actions
41
+ */
34
42
  export declare const smartAccountClientActions: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(client: Client<TTransport, TChain, TAccount>) => BaseSmartAccountClientActions<TChain, TAccount, TContext>;
35
43
  export declare const smartAccountClientMethodKeys: Set<string>;
@@ -15,6 +15,15 @@ import { signTypedDataWith6492 } from "../../actions/smartAccount/signTypedDataW
15
15
  import { signUserOperation } from "../../actions/smartAccount/signUserOperation.js";
16
16
  import { upgradeAccount } from "../../actions/smartAccount/upgradeAccount.js";
17
17
  import { waitForUserOperationTransaction } from "../../actions/smartAccount/waitForUserOperationTransacation.js";
18
+ // #endregion SmartAccountClientActions
19
+ /**
20
+ * Provides a set of smart account client actions to decorate the provided client. These actions include building and signing user operations, sending transactions, and more.
21
+ *
22
+ * NOTE: this is already added to clients returned from `createSmartAccountClient`
23
+ *
24
+ * @param {Client<TTransport, TChain, TAccount>} client The client to bind the smart account actions to
25
+ * @returns {BaseSmartAccountClientActions<TChain, TAccount, TContext>} An object containing various smart account client actions
26
+ */
18
27
  export const smartAccountClientActions = (client) => ({
19
28
  buildUserOperation: (args) => buildUserOperation(client, args),
20
29
  buildUserOperationFromTx: (args, overrides, context) => buildUserOperationFromTx(client, args, overrides, context),
@@ -33,7 +42,9 @@ export const smartAccountClientActions = (client) => ({
33
42
  signMessageWith6492: (args) => signMessageWith6492(client, args),
34
43
  signTypedDataWith6492: (args) => signTypedDataWith6492(client, args),
35
44
  });
36
- export const smartAccountClientMethodKeys = Object.keys(smartAccountClientActions(undefined)).reduce((accum, curr) => {
45
+ export const smartAccountClientMethodKeys = Object.keys(
46
+ // @ts-expect-error we just want to get the keys
47
+ smartAccountClientActions(undefined)).reduce((accum, curr) => {
37
48
  accum.add(curr);
38
49
  return accum;
39
50
  }, new Set());
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,MAAM,MAAM,CAAC;AAMd,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AACpG,OAAO,EAAE,8BAA8B,EAAE,MAAM,8DAA8D,CAAC;AAC9G,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AAC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AAC,CAAC","sourcesContent":["import {\n type Address,\n type Chain,\n type Client,\n type Hex,\n type SendTransactionParameters,\n type Transport,\n type TypedData,\n} from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { buildUserOperation } from \"../../actions/smartAccount/buildUserOperation.js\";\nimport { buildUserOperationFromTx } from \"../../actions/smartAccount/buildUserOperationFromTx.js\";\nimport { buildUserOperationFromTxs } from \"../../actions/smartAccount/buildUserOperationFromTxs.js\";\nimport { checkGasSponsorshipEligibility } from \"../../actions/smartAccount/checkGasSponsorshipEligibility.js\";\nimport { dropAndReplaceUserOperation } from \"../../actions/smartAccount/dropAndReplaceUserOperation.js\";\nimport { getAddress } from \"../../actions/smartAccount/getAddress.js\";\nimport { sendTransaction } from \"../../actions/smartAccount/sendTransaction.js\";\nimport { sendTransactions } from \"../../actions/smartAccount/sendTransactions.js\";\nimport { sendUserOperation } from \"../../actions/smartAccount/sendUserOperation.js\";\nimport {\n signMessage,\n type SignMessageParameters,\n} from \"../../actions/smartAccount/signMessage.js\";\nimport { signMessageWith6492 } from \"../../actions/smartAccount/signMessageWith6492.js\";\nimport {\n signTypedData,\n type SignTypedDataParameters,\n} from \"../../actions/smartAccount/signTypedData.js\";\nimport { signTypedDataWith6492 } from \"../../actions/smartAccount/signTypedDataWith6492.js\";\nimport { signUserOperation } from \"../../actions/smartAccount/signUserOperation.js\";\nimport type {\n BuildTransactionParameters,\n BuildUserOperationFromTransactionsResult,\n BuildUserOperationParameters,\n DropAndReplaceUserOperationParameters,\n SendTransactionsParameters,\n SendUserOperationParameters,\n SignUserOperationParameters,\n UpgradeAccountParams,\n UserOperationContext,\n WaitForUserOperationTxParameters,\n} from \"../../actions/smartAccount/types\";\nimport { upgradeAccount } from \"../../actions/smartAccount/upgradeAccount.js\";\nimport { waitForUserOperationTransaction } from \"../../actions/smartAccount/waitForUserOperationTransacation.js\";\nimport type {\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../../types\";\nimport type { IsUndefined } from \"../../utils\";\nimport type { SendUserOperationResult } from \"../types\";\n\n//#region SmartAccountClientActions\nexport type BaseSmartAccountClientActions<\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 buildUserOperation: (\n args: BuildUserOperationParameters<TAccount, TContext>\n ) => Promise<UserOperationStruct<TEntryPointVersion>>;\n buildUserOperationFromTx: (\n args: SendTransactionParameters<TChain, TAccount>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n ) => Promise<UserOperationStruct<TEntryPointVersion>>;\n buildUserOperationFromTxs: (\n args: BuildTransactionParameters<TAccount, TContext>\n ) => Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>>;\n checkGasSponsorshipEligibility: <\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n >(\n args: SendUserOperationParameters<TAccount, TContext>\n ) => Promise<boolean>;\n signUserOperation: (\n args: SignUserOperationParameters<TAccount, TEntryPointVersion, TContext>\n ) => Promise<UserOperationRequest<TEntryPointVersion>>;\n dropAndReplaceUserOperation: (\n args: DropAndReplaceUserOperationParameters<TAccount, TContext>\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n // TODO: for v4 we should combine override and context into an `opts` parameter\n // which wraps both of these properties so we can use GetContextParameter\n sendTransaction: <TChainOverride extends Chain | undefined = undefined>(\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n ) => Promise<Hex>;\n sendTransactions: (\n args: SendTransactionsParameters<TAccount, TContext>\n ) => Promise<Hex>;\n sendUserOperation: (\n args: SendUserOperationParameters<\n TAccount,\n TContext,\n GetEntryPointFromAccount<TAccount>\n >\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n waitForUserOperationTransaction: (\n args: WaitForUserOperationTxParameters\n ) => Promise<Hex>;\n upgradeAccount: (\n args: UpgradeAccountParams<TAccount, TContext>\n ) => Promise<Hex>;\n signMessage: (args: SignMessageParameters<TAccount>) => Promise<Hex>;\n signTypedData: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>\n ) => Promise<Hex>;\n signMessageWith6492: (args: SignMessageParameters<TAccount>) => Promise<Hex>;\n signTypedDataWith6492: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>\n ) => Promise<Hex>;\n} & (IsUndefined<TAccount> extends false\n ? { getAddress: () => Address }\n : {\n getAddress: (args: GetAccountParameter<TAccount>) => Address;\n });\n// #endregion SmartAccountClientActions\n\n/**\n * Provides a set of smart account client actions to decorate the provided client. These actions include building and signing user operations, sending transactions, and more.\n *\n * NOTE: this is already added to clients returned from `createSmartAccountClient`\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client to bind the smart account actions to\n * @returns {BaseSmartAccountClientActions<TChain, TAccount, TContext>} An object containing various smart account client actions\n */\nexport const smartAccountClientActions: <\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>(\n client: Client<TTransport, TChain, TAccount>\n) => BaseSmartAccountClientActions<TChain, TAccount, TContext> = (client) => ({\n buildUserOperation: (args) => buildUserOperation(client, args),\n buildUserOperationFromTx: (args, overrides, context) =>\n buildUserOperationFromTx(client, args, overrides, context),\n buildUserOperationFromTxs: (args) => buildUserOperationFromTxs(client, args),\n checkGasSponsorshipEligibility: (args) =>\n checkGasSponsorshipEligibility(client, args),\n signUserOperation: (args) => signUserOperation(client, args),\n dropAndReplaceUserOperation: (args) =>\n dropAndReplaceUserOperation(client, args),\n sendTransaction: (args, overrides, context) =>\n sendTransaction(client, args, overrides, context),\n sendTransactions: (args) => sendTransactions(client, args),\n sendUserOperation: (args) => sendUserOperation(client, args),\n waitForUserOperationTransaction: (args) =>\n waitForUserOperationTransaction.bind(client)(client, args),\n upgradeAccount: (args) => upgradeAccount(client, args),\n getAddress: (args) => getAddress(client, args),\n signMessage: (args) => signMessage(client, args),\n signTypedData: (args) => signTypedData(client, args),\n signMessageWith6492: (args) => signMessageWith6492(client, args),\n signTypedDataWith6492: (args) => signTypedDataWith6492(client, args),\n});\n\nexport const smartAccountClientMethodKeys = Object.keys(\n // @ts-expect-error we just want to get the keys\n smartAccountClientActions(undefined)\n).reduce((accum, curr) => {\n accum.add(curr);\n return accum;\n}, new Set<string>());\n"]}
1
+ {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../../src/client/decorators/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,MAAM,MAAM,CAAC;AAMd,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AACpG,OAAO,EAAE,8BAA8B,EAAE,MAAM,8DAA8D,CAAC;AAC9G,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AACxG,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACpF,OAAO,EACL,WAAW,GAEZ,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,M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,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC;IAC5D,+BAA+B,EAAE,CAAC,IAAI,EAAE,EAAE,CACxC,+BAA+B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC;IAC5D,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC;IACtD,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC;IAC9C,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC;IAChD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC;IACpD,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC;IAChE,qBAAqB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC;CACrE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,IAAI;AACrD,gDAAgD;AAChD,yBAAyB,CAAC,SAAS,CAAC,CACrC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACvB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChB,OAAO,KAAK,CAAC;AACf,CAAC,EAAE,IAAI,GAAG,EAAU,CAAC,CAAC","sourcesContent":["import {\n type Address,\n type Chain,\n type Client,\n type Hex,\n type SendTransactionParameters,\n type Transport,\n type TypedData,\n} from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { buildUserOperation } from \"../../actions/smartAccount/buildUserOperation.js\";\nimport { buildUserOperationFromTx } from \"../../actions/smartAccount/buildUserOperationFromTx.js\";\nimport { buildUserOperationFromTxs } from \"../../actions/smartAccount/buildUserOperationFromTxs.js\";\nimport { checkGasSponsorshipEligibility } from \"../../actions/smartAccount/checkGasSponsorshipEligibility.js\";\nimport { dropAndReplaceUserOperation } from \"../../actions/smartAccount/dropAndReplaceUserOperation.js\";\nimport { getAddress } from \"../../actions/smartAccount/getAddress.js\";\nimport { sendTransaction } from \"../../actions/smartAccount/sendTransaction.js\";\nimport { sendTransactions } from \"../../actions/smartAccount/sendTransactions.js\";\nimport { sendUserOperation } from \"../../actions/smartAccount/sendUserOperation.js\";\nimport {\n signMessage,\n type SignMessageParameters,\n} from \"../../actions/smartAccount/signMessage.js\";\nimport { signMessageWith6492 } from \"../../actions/smartAccount/signMessageWith6492.js\";\nimport {\n signTypedData,\n type SignTypedDataParameters,\n} from \"../../actions/smartAccount/signTypedData.js\";\nimport { signTypedDataWith6492 } from \"../../actions/smartAccount/signTypedDataWith6492.js\";\nimport { signUserOperation } from \"../../actions/smartAccount/signUserOperation.js\";\nimport type {\n BuildTransactionParameters,\n BuildUserOperationFromTransactionsResult,\n BuildUserOperationParameters,\n DropAndReplaceUserOperationParameters,\n SendTransactionsParameters,\n SendUserOperationParameters,\n SignUserOperationParameters,\n UpgradeAccountParams,\n UserOperationContext,\n WaitForUserOperationTxParameters,\n} from \"../../actions/smartAccount/types\";\nimport { upgradeAccount } from \"../../actions/smartAccount/upgradeAccount.js\";\nimport { waitForUserOperationTransaction } from \"../../actions/smartAccount/waitForUserOperationTransacation.js\";\nimport type {\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../../types\";\nimport type { IsUndefined } from \"../../utils\";\nimport type { SendUserOperationResult } from \"../types\";\n\n//#region SmartAccountClientActions\nexport type BaseSmartAccountClientActions<\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 buildUserOperation: (\n args: BuildUserOperationParameters<TAccount, TContext>\n ) => Promise<UserOperationStruct<TEntryPointVersion>>;\n buildUserOperationFromTx: (\n args: SendTransactionParameters<TChain, TAccount>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n ) => Promise<UserOperationStruct<TEntryPointVersion>>;\n buildUserOperationFromTxs: (\n args: BuildTransactionParameters<TAccount, TContext>\n ) => Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>>;\n checkGasSponsorshipEligibility: <\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n >(\n args: SendUserOperationParameters<TAccount, TContext>\n ) => Promise<boolean>;\n signUserOperation: (\n args: SignUserOperationParameters<TAccount, TEntryPointVersion, TContext>\n ) => Promise<UserOperationRequest<TEntryPointVersion>>;\n dropAndReplaceUserOperation: (\n args: DropAndReplaceUserOperationParameters<TAccount, TContext>\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n // TODO: for v4 we should combine override and context into an `opts` parameter\n // which wraps both of these properties so we can use GetContextParameter\n sendTransaction: <TChainOverride extends Chain | undefined = undefined>(\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext\n ) => Promise<Hex>;\n sendTransactions: (\n args: SendTransactionsParameters<TAccount, TContext>\n ) => Promise<Hex>;\n sendUserOperation: (\n args: SendUserOperationParameters<\n TAccount,\n TContext,\n GetEntryPointFromAccount<TAccount>\n >\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n waitForUserOperationTransaction: (\n args: WaitForUserOperationTxParameters\n ) => Promise<Hex>;\n upgradeAccount: (\n args: UpgradeAccountParams<TAccount, TContext>\n ) => Promise<Hex>;\n signMessage: (args: SignMessageParameters<TAccount>) => Promise<Hex>;\n signTypedData: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>\n ) => Promise<Hex>;\n signMessageWith6492: (args: SignMessageParameters<TAccount>) => Promise<Hex>;\n signTypedDataWith6492: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string\n >(\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>\n ) => Promise<Hex>;\n} & (IsUndefined<TAccount> extends false\n ? { getAddress: () => Address }\n : {\n getAddress: (args: GetAccountParameter<TAccount>) => Address;\n });\n// #endregion SmartAccountClientActions\n\n/**\n * Provides a set of smart account client actions to decorate the provided client. These actions include building and signing user operations, sending transactions, and more.\n *\n * NOTE: this is already added to clients returned from `createSmartAccountClient`\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client to bind the smart account actions to\n * @returns {BaseSmartAccountClientActions<TChain, TAccount, TContext>} An object containing various smart account client actions\n */\nexport const smartAccountClientActions: <\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>(\n client: Client<TTransport, TChain, TAccount>\n) => BaseSmartAccountClientActions<TChain, TAccount, TContext> = (client) => ({\n buildUserOperation: (args) => buildUserOperation(client, args),\n buildUserOperationFromTx: (args, overrides, context) =>\n buildUserOperationFromTx(client, args, overrides, context),\n buildUserOperationFromTxs: (args) => buildUserOperationFromTxs(client, args),\n checkGasSponsorshipEligibility: (args) =>\n checkGasSponsorshipEligibility(client, args),\n signUserOperation: (args) => signUserOperation(client, args),\n dropAndReplaceUserOperation: (args) =>\n dropAndReplaceUserOperation(client, args),\n sendTransaction: (args, overrides, context) =>\n sendTransaction(client, args, overrides, context),\n sendTransactions: (args) => sendTransactions(client, args),\n sendUserOperation: (args) => sendUserOperation(client, args),\n waitForUserOperationTransaction: (args) =>\n waitForUserOperationTransaction.bind(client)(client, args),\n upgradeAccount: (args) => upgradeAccount(client, args),\n getAddress: (args) => getAddress(client, args),\n signMessage: (args) => signMessage(client, args),\n signTypedData: (args) => signTypedData(client, args),\n signMessageWith6492: (args) => signMessageWith6492(client, args),\n signTypedDataWith6492: (args) => signTypedDataWith6492(client, args),\n});\n\nexport const smartAccountClientMethodKeys = Object.keys(\n // @ts-expect-error we just want to get the keys\n smartAccountClientActions(undefined)\n).reduce((accum, curr) => {\n accum.add(curr);\n return accum;\n}, new Set<string>());\n"]}
@@ -1,5 +1,21 @@
1
1
  import type { Chain, Client, Transport } from "viem";
2
2
  import type { SmartContractAccount } from "../account/smartContractAccount";
3
3
  import type { BaseSmartAccountClient, SmartAccountClient } from "./smartAccountClient";
4
+ /**
5
+ * Use this method to assert that a client is a BaseSmartAccountClient.
6
+ * Useful for narrowing the type of the client down when used within the
7
+ * smart account client decorators
8
+ *
9
+ * @param {Client<TTransport, TChain, TAccount>} client a viem client
10
+ * @returns {boolean} true if the client is a SmartAccountClient
11
+ */
4
12
  export declare function isSmartAccountClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<TTransport, TChain, TAccount>): client is SmartAccountClient<TTransport, TChain, TAccount>;
13
+ /**
14
+ * Use this method to assert that a client is a BaseSmartAccountClient.
15
+ * Useful for narrowing the type of the client down when used within the
16
+ * smart account action decorators
17
+ *
18
+ * @param {Client<TTransport, TChain, TAccount>} client a viem client
19
+ * @returns {boolean} true if the account is a BaseSmartAccountClient
20
+ */
5
21
  export declare function isBaseSmartAccountClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<TTransport, TChain, TAccount>): client is BaseSmartAccountClient<TTransport, TChain, TAccount>;
@@ -1,4 +1,12 @@
1
1
  import { smartAccountClientMethodKeys } from "./decorators/smartAccountClient.js";
2
+ /**
3
+ * Use this method to assert that a client is a BaseSmartAccountClient.
4
+ * Useful for narrowing the type of the client down when used within the
5
+ * smart account client decorators
6
+ *
7
+ * @param {Client<TTransport, TChain, TAccount>} client a viem client
8
+ * @returns {boolean} true if the client is a SmartAccountClient
9
+ */
2
10
  export function isSmartAccountClient(client) {
3
11
  for (const key of smartAccountClientMethodKeys) {
4
12
  if (!(key in client)) {
@@ -7,6 +15,14 @@ export function isSmartAccountClient(client) {
7
15
  }
8
16
  return client && "middleware" in client;
9
17
  }
18
+ /**
19
+ * Use this method to assert that a client is a BaseSmartAccountClient.
20
+ * Useful for narrowing the type of the client down when used within the
21
+ * smart account action decorators
22
+ *
23
+ * @param {Client<TTransport, TChain, TAccount>} client a viem client
24
+ * @returns {boolean} true if the account is a BaseSmartAccountClient
25
+ */
10
26
  export function isBaseSmartAccountClient(client) {
11
27
  return client && "middleware" in client;
12
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"isSmartAccountClient.js","sourceRoot":"","sources":["../../../src/client/isSmartAccountClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAclF,MAAM,UAAU,oBAAoB,CAOlC,MAA4C;IAE5C,KAAK,MAAM,GAAG,IAAI,4BAA4B,EAAE,CAAC;QAC/C,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,MAAM,IAAI,YAAY,IAAI,MAAM,CAAC;AAC1C,CAAC;AAUD,MAAM,UAAU,wBAAwB,CAOtC,MAA4C;IAE5C,OAAO,MAAM,IAAI,YAAY,IAAI,MAAM,CAAC;AAC1C,CAAC","sourcesContent":["import type { Chain, Client, Transport } from \"viem\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount\";\nimport { smartAccountClientMethodKeys } from \"./decorators/smartAccountClient.js\";\nimport type {\n BaseSmartAccountClient,\n SmartAccountClient,\n} from \"./smartAccountClient\";\n\n/**\n * Use this method to assert that a client is a BaseSmartAccountClient.\n * Useful for narrowing the type of the client down when used within the\n * smart account client decorators\n *\n * @param {Client<TTransport, TChain, TAccount>} client a viem client\n * @returns {boolean} true if the client is a SmartAccountClient\n */\nexport function isSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n): client is SmartAccountClient<TTransport, TChain, TAccount> {\n for (const key of smartAccountClientMethodKeys) {\n if (!(key in client)) {\n return false;\n }\n }\n\n return client && \"middleware\" in client;\n}\n\n/**\n * Use this method to assert that a client is a BaseSmartAccountClient.\n * Useful for narrowing the type of the client down when used within the\n * smart account action decorators\n *\n * @param {Client<TTransport, TChain, TAccount>} client a viem client\n * @returns {boolean} true if the account is a BaseSmartAccountClient\n */\nexport function isBaseSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n): client is BaseSmartAccountClient<TTransport, TChain, TAccount> {\n return client && \"middleware\" in client;\n}\n"]}
1
+ {"version":3,"file":"isSmartAccountClient.js","sourceRoot":"","sources":["../../../src/client/isSmartAccountClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAMlF;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAOlC,MAA4C;IAE5C,KAAK,MAAM,GAAG,IAAI,4BAA4B,EAAE,CAAC;QAC/C,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,MAAM,IAAI,YAAY,IAAI,MAAM,CAAC;AAC1C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAOtC,MAA4C;IAE5C,OAAO,MAAM,IAAI,YAAY,IAAI,MAAM,CAAC;AAC1C,CAAC","sourcesContent":["import type { Chain, Client, Transport } from \"viem\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount\";\nimport { smartAccountClientMethodKeys } from \"./decorators/smartAccountClient.js\";\nimport type {\n BaseSmartAccountClient,\n SmartAccountClient,\n} from \"./smartAccountClient\";\n\n/**\n * Use this method to assert that a client is a BaseSmartAccountClient.\n * Useful for narrowing the type of the client down when used within the\n * smart account client decorators\n *\n * @param {Client<TTransport, TChain, TAccount>} client a viem client\n * @returns {boolean} true if the client is a SmartAccountClient\n */\nexport function isSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n): client is SmartAccountClient<TTransport, TChain, TAccount> {\n for (const key of smartAccountClientMethodKeys) {\n if (!(key in client)) {\n return false;\n }\n }\n\n return client && \"middleware\" in client;\n}\n\n/**\n * Use this method to assert that a client is a BaseSmartAccountClient.\n * Useful for narrowing the type of the client down when used within the\n * smart account action decorators\n *\n * @param {Client<TTransport, TChain, TAccount>} client a viem client\n * @returns {boolean} true if the account is a BaseSmartAccountClient\n */\nexport function isBaseSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined\n>(\n client: Client<TTransport, TChain, TAccount>\n): client is BaseSmartAccountClient<TTransport, TChain, TAccount> {\n return client && \"middleware\" in client;\n}\n"]}
@@ -514,9 +514,21 @@ export declare const UserOperationFeeOptionsSchema: z.ZodObject<{
514
514
  } | undefined;
515
515
  }>;
516
516
  export declare const SmartAccountClientOptsSchema: z.ZodObject<{
517
+ /**
518
+ * The maximum number of times to try fetching a transaction receipt before giving up (default: 5)
519
+ */
517
520
  txMaxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
521
+ /**
522
+ * The interval in milliseconds to wait between retries while waiting for tx receipts (default: 2_000)
523
+ */
518
524
  txRetryIntervalMs: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
525
+ /**
526
+ * The multiplier on interval length to wait between retries while waiting for tx receipts (default: 1.5)
527
+ */
519
528
  txRetryMultiplier: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
529
+ /**
530
+ * Optional user operation fee options to be set globally at the provider level
531
+ */
520
532
  feeOptions: z.ZodOptional<z.ZodObject<{
521
533
  callGasLimit: z.ZodOptional<z.ZodOptional<z.ZodObject<{
522
534
  min: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>>>;
@@ -8,6 +8,7 @@ export const createPublicErc4337ClientSchema = () => z.custom((provider) => {
8
8
  "key" in provider &&
9
9
  "name" in provider);
10
10
  });
11
+ // [!region ConnectionConfigSchema]
11
12
  export const ConnectionConfigSchema = z.union([
12
13
  z.object({
13
14
  rpcUrl: z.never().optional(),
@@ -30,6 +31,7 @@ export const ConnectionConfigSchema = z.union([
30
31
  jwt: z.string(),
31
32
  }),
32
33
  ]);
34
+ // [!endregion ConnectionConfigSchema]
33
35
  export const UserOperationFeeOptionsFieldSchema = BigNumberishRangeSchema.merge(MultiplierSchema).partial();
34
36
  export const UserOperationFeeOptionsSchema_v6 = z
35
37
  .object({
@@ -50,9 +52,21 @@ export const UserOperationFeeOptionsSchema_v7 = UserOperationFeeOptionsSchema_v6
50
52
  export const UserOperationFeeOptionsSchema = UserOperationFeeOptionsSchema_v7;
51
53
  export const SmartAccountClientOptsSchema = z
52
54
  .object({
55
+ /**
56
+ * The maximum number of times to try fetching a transaction receipt before giving up (default: 5)
57
+ */
53
58
  txMaxRetries: z.number().min(0).optional().default(5),
59
+ /**
60
+ * The interval in milliseconds to wait between retries while waiting for tx receipts (default: 2_000)
61
+ */
54
62
  txRetryIntervalMs: z.number().min(0).optional().default(2000),
63
+ /**
64
+ * The multiplier on interval length to wait between retries while waiting for tx receipts (default: 1.5)
65
+ */
55
66
  txRetryMultiplier: z.number().min(0).optional().default(1.5),
67
+ /**
68
+ * Optional user operation fee options to be set globally at the provider level
69
+ */
56
70
  feeOptions: UserOperationFeeOptionsSchema.optional(),
57
71
  })
58
72
  .strict();
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/client/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG9E,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAE3C,EAAE,CACJ,CAAC,CAAC,MAAM,CAA4B,CAAC,QAAQ,EAAE,EAAE;IAC/C,OAAO,CACL,QAAQ,IAAI,IAAI;QAChB,OAAO,QAAQ,KAAK,QAAQ;QAC5B,SAAS,IAAI,QAAQ;QACrB,MAAM,IAAI,QAAQ;QAClB,KAAK,IAAI,QAAQ;QACjB,MAAM,IAAI,QAAQ,CACnB,CAAC;AACJ,CAAC,CAAC,CAAC;AAGL,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5C,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;QAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,GAAG,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;KAC1B,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;QAC5B,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;QAC5B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;KAChB,CAAC;IACF,CAAC,CAAC,MAAM,C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,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAK,CAAC;IAK9D,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;IAK5D,UAAU,EAAE,6BAA6B,CAAC,QAAQ,EAAE;CACrD,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["import type { Transport } from \"viem\";\nimport { z } from \"zod\";\n\nimport { BigNumberishRangeSchema, MultiplierSchema } from \"../utils/index.js\";\nimport type { BundlerClient } from \"./bundlerClient.js\";\n\nexport const createPublicErc4337ClientSchema = <\n TTransport extends Transport = Transport\n>() =>\n z.custom<BundlerClient<TTransport>>((provider) => {\n return (\n provider != null &&\n typeof provider === \"object\" &&\n \"request\" in provider &&\n \"type\" in provider &&\n \"key\" in provider &&\n \"name\" in provider\n );\n });\n\n// [!region ConnectionConfigSchema]\nexport const ConnectionConfigSchema = z.union([\n z.object({\n rpcUrl: z.never().optional(),\n apiKey: z.string(),\n jwt: z.never().optional(),\n }),\n z.object({\n rpcUrl: z.never().optional(),\n apiKey: z.never().optional(),\n jwt: z.string(),\n }),\n z.object({\n rpcUrl: z.string(),\n apiKey: z.never().optional(),\n jwt: z.never().optional(),\n }),\n z.object({\n rpcUrl: z.string(),\n apiKey: z.never().optional(),\n jwt: z.string(),\n }),\n]);\n// [!endregion ConnectionConfigSchema]\n\nexport const UserOperationFeeOptionsFieldSchema =\n BigNumberishRangeSchema.merge(MultiplierSchema).partial();\n\nexport const UserOperationFeeOptionsSchema_v6 = z\n .object({\n maxFeePerGas: UserOperationFeeOptionsFieldSchema,\n maxPriorityFeePerGas: UserOperationFeeOptionsFieldSchema,\n callGasLimit: UserOperationFeeOptionsFieldSchema,\n verificationGasLimit: UserOperationFeeOptionsFieldSchema,\n preVerificationGas: UserOperationFeeOptionsFieldSchema,\n })\n .partial()\n .strict();\n\nexport const UserOperationFeeOptionsSchema_v7 =\n UserOperationFeeOptionsSchema_v6.extend({\n paymasterVerificationGasLimit: UserOperationFeeOptionsFieldSchema,\n paymasterPostOpGasLimit: UserOperationFeeOptionsFieldSchema,\n })\n .partial()\n .strict();\n\nexport const UserOperationFeeOptionsSchema = UserOperationFeeOptionsSchema_v7;\n\nexport const SmartAccountClientOptsSchema = z\n .object({\n /**\n * The maximum number of times to try fetching a transaction receipt before giving up (default: 5)\n */\n txMaxRetries: z.number().min(0).optional().default(5),\n\n /**\n * The interval in milliseconds to wait between retries while waiting for tx receipts (default: 2_000)\n */\n txRetryIntervalMs: z.number().min(0).optional().default(2_000),\n\n /**\n * The multiplier on interval length to wait between retries while waiting for tx receipts (default: 1.5)\n */\n txRetryMultiplier: z.number().min(0).optional().default(1.5),\n\n /**\n * Optional user operation fee options to be set globally at the provider level\n */\n feeOptions: UserOperationFeeOptionsSchema.optional(),\n })\n .strict();\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/client/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG9E,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAE3C,EAAE,CACJ,CAAC,CAAC,MAAM,CAA4B,CAAC,QAAQ,EAAE,EAAE;IAC/C,OAAO,CACL,QAAQ,IAAI,IAAI;QAChB,OAAO,QAAQ,KAAK,QAAQ;QAC5B,SAAS,IAAI,QAAQ;QACrB,MAAM,IAAI,QAAQ;QAClB,KAAK,IAAI,QAAQ;QACjB,MAAM,IAAI,QAAQ,CACnB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,mCAAmC;AACnC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5C,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAA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AkC;CAC5D,CAAC;KACC,OAAO,EAAE;KACT,MAAM,EAAE,CAAC;AAEd,MAAM,CAAC,MAAM,6BAA6B,GAAG,gCAAgC,CAAC;AAE9E,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACN;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAErD;;OAEG;IACH,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAK,CAAC;IAE9D;;OAEG;IACH,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;IAE5D;;OAEG;IACH,UAAU,EAAE,6BAA6B,CAAC,QAAQ,EAAE;CACrD,CAAC;KACD,MAAM,EAAE,CAAC","sourcesContent":["import type { Transport } from \"viem\";\nimport { z } from \"zod\";\n\nimport { BigNumberishRangeSchema, MultiplierSchema } from \"../utils/index.js\";\nimport type { BundlerClient } from \"./bundlerClient.js\";\n\nexport const createPublicErc4337ClientSchema = <\n TTransport extends Transport = Transport\n>() =>\n z.custom<BundlerClient<TTransport>>((provider) => {\n return (\n provider != null &&\n typeof provider === \"object\" &&\n \"request\" in provider &&\n \"type\" in provider &&\n \"key\" in provider &&\n \"name\" in provider\n );\n });\n\n// [!region ConnectionConfigSchema]\nexport const ConnectionConfigSchema = z.union([\n z.object({\n rpcUrl: z.never().optional(),\n apiKey: z.string(),\n jwt: z.never().optional(),\n }),\n z.object({\n rpcUrl: z.never().optional(),\n apiKey: z.never().optional(),\n jwt: z.string(),\n }),\n z.object({\n rpcUrl: z.string(),\n apiKey: z.never().optional(),\n jwt: z.never().optional(),\n }),\n z.object({\n rpcUrl: z.string(),\n apiKey: z.never().optional(),\n jwt: z.string(),\n }),\n]);\n// [!endregion ConnectionConfigSchema]\n\nexport const UserOperationFeeOptionsFieldSchema =\n BigNumberishRangeSchema.merge(MultiplierSchema).partial();\n\nexport const UserOperationFeeOptionsSchema_v6 = z\n .object({\n maxFeePerGas: UserOperationFeeOptionsFieldSchema,\n maxPriorityFeePerGas: UserOperationFeeOptionsFieldSchema,\n callGasLimit: UserOperationFeeOptionsFieldSchema,\n verificationGasLimit: UserOperationFeeOptionsFieldSchema,\n preVerificationGas: UserOperationFeeOptionsFieldSchema,\n })\n .partial()\n .strict();\n\nexport const UserOperationFeeOptionsSchema_v7 =\n UserOperationFeeOptionsSchema_v6.extend({\n paymasterVerificationGasLimit: UserOperationFeeOptionsFieldSchema,\n paymasterPostOpGasLimit: UserOperationFeeOptionsFieldSchema,\n })\n .partial()\n .strict();\n\nexport const UserOperationFeeOptionsSchema = UserOperationFeeOptionsSchema_v7;\n\nexport const SmartAccountClientOptsSchema = z\n .object({\n /**\n * The maximum number of times to try fetching a transaction receipt before giving up (default: 5)\n */\n txMaxRetries: z.number().min(0).optional().default(5),\n\n /**\n * The interval in milliseconds to wait between retries while waiting for tx receipts (default: 2_000)\n */\n txRetryIntervalMs: z.number().min(0).optional().default(2_000),\n\n /**\n * The multiplier on interval length to wait between retries while waiting for tx receipts (default: 1.5)\n */\n txRetryMultiplier: z.number().min(0).optional().default(1.5),\n\n /**\n * Optional user operation fee options to be set globally at the provider level\n */\n feeOptions: UserOperationFeeOptionsSchema.optional(),\n })\n .strict();\n"]}
@@ -7,18 +7,48 @@ import { createBundlerClient } from "./bundlerClient.js";
7
7
  import {} from "./decorators/bundlerClient.js";
8
8
  import { smartAccountClientActions, } from "./decorators/smartAccountClient.js";
9
9
  import { SmartAccountClientOptsSchema } from "./schema.js";
10
+ /**
11
+ * Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { createSmartAccountClient, toSmartContractAccount } from "@aa-sdk/core";
16
+ * import { http } from "viem";
17
+ * import { sepolia } from "viem/chains";
18
+ *
19
+ * const client = createSmartAccountClient({
20
+ * chain: sepolia,
21
+ * transport: http("RPC_URL"),
22
+ * // optionally hoist the account
23
+ * account: toSmartContractAccount(...),
24
+ * });
25
+ * ```
26
+ *
27
+ * @param {SmartAccountClientConfig} config The configuration for creating the smart account client
28
+ * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account
29
+ */
10
30
  export function createSmartAccountClient(config) {
11
31
  const { key = "account", name = "account provider", transport, type = "SmartAccountClient", ...params } = config;
12
32
  const client = createBundlerClient({
13
33
  ...params,
14
34
  key,
15
35
  name,
36
+ // we start out with this because the base methods for a SmartAccountClient
37
+ // require a smart account client, but once we have completed building everything
38
+ // we want to override this value with the one passed in by the extender
16
39
  type: "SmartAccountClient",
40
+ // TODO: this needs to be tested
17
41
  transport: (opts) => {
18
42
  const rpcTransport = transport(opts);
19
43
  return custom({
20
44
  async request({ method, params }) {
21
45
  switch (method) {
46
+ case "eth_accounts": {
47
+ if (!client.account) {
48
+ throw new AccountNotFoundError();
49
+ }
50
+ return [client.account.address];
51
+ }
22
52
  case "eth_sendTransaction":
23
53
  if (!client.account) {
24
54
  throw new AccountNotFoundError();
@@ -67,6 +97,8 @@ export function createSmartAccountClient(config) {
67
97
  }
68
98
  return opts.chain.id;
69
99
  default:
100
+ // TODO: there's probably a number of methods we just don't support, will need to test most of them out
101
+ // first let's get something working though
70
102
  return rpcTransport.request({ method, params });
71
103
  }
72
104
  },
@@ -80,6 +112,27 @@ export function createSmartAccountClient(config) {
80
112
  .extend(smartAccountClientActions);
81
113
  return { ...client, type };
82
114
  }
115
+ /**
116
+ * Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * import {
121
+ * createBundlerClient,
122
+ * createSmartAccountClientFromExisting,
123
+ * toSmartContractAccount
124
+ * } from "@aa-sdk/core";
125
+ *
126
+ * const bundlerClient = createBundlerClient(...);
127
+ * const client = createSmartAccountClientFromExisting({
128
+ * client,
129
+ * account: toSmartContractAccount(...),
130
+ * })
131
+ * ```
132
+ *
133
+ * @param {Omit<SmartAccountClientConfig, "transport" | "chain"> & {client: BundlerClient}} config the configuration object which includes the client
134
+ * @returns {SmartAccountClient} A smart account client created from the existing BundlerClient
135
+ */
83
136
  export function createSmartAccountClientFromExisting(config) {
84
137
  return createSmartAccountClient({
85
138
  ...config,
@@ -1 +1 @@
1
- {"version":3,"file":"smartAccountClient.js","sourceRoot":"","sources":["../../../src/client/smartAccountClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GAUP,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAGN,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,GAE1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAgI3D,MAAM,UAAU,wBAAwB,CACtC,MAAgC;IAEhC,MAAM,EACJ,GAAG,GAAG,SAAS,EACf,IAAI,GAAG,kBAAkB,EACzB,SAAS,EACT,IAAI,GAAG,oBAAoB,EAC3B,GAAG,MAAM,EACV,GAAG,MAAM,CAAC;IAEX,MAAM,MAAM,GAAuB,mBAAmB,CAAC;QACrD,GAAG,MAAM;QACT,GAAG;QACH,IAAI;QAIJ,IAAI,EAAE,oBAAoB;QAE1B,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;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AG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;QAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;KACjC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n custom,\n type Chain,\n type Client,\n type ClientConfig,\n type CustomTransport,\n type FormattedTransactionRequest,\n type PublicActions,\n type PublicRpcSchema,\n type RpcSchema,\n type Transport,\n} from \"viem\";\nimport { z } from \"zod\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport { AccountNotFoundError } from \"../errors/account.js\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { middlewareActions } from \"../middleware/actions.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { Prettify } from \"../utils/index.js\";\nimport { createBundlerClient, type BundlerClient } from \"./bundlerClient.js\";\nimport {\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\nimport {\n smartAccountClientActions,\n type BaseSmartAccountClientActions,\n} from \"./decorators/smartAccountClient.js\";\nimport { SmartAccountClientOptsSchema } from \"./schema.js\";\nimport type { ClientMiddlewareConfig } from \"./types.js\";\n\ntype SmartAccountClientOpts = z.output<typeof SmartAccountClientOptsSchema>;\n\nexport type SmartAccountClientConfig<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Pick<\n ClientConfig<transport, chain, account>,\n | \"cacheTime\"\n | \"chain\"\n | \"key\"\n | \"name\"\n | \"pollingInterval\"\n | \"transport\"\n | \"type\"\n > & {\n account?: account;\n opts?: z.input<typeof SmartAccountClientOptsSchema>;\n } & ClientMiddlewareConfig<context>\n>;\n\nexport type SmartAccountClientRpcSchema = [\n ...BundlerRpcSchema,\n ...PublicRpcSchema\n];\n\n//#region SmartAccountClientActions\nexport type SmartAccountClientActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = BaseSmartAccountClientActions<chain, account, context> &\n BundlerActions &\n PublicActions;\n//#endregion SmartAccountClientActions\n\n//#region SmartAccountClient\nexport type SmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n rpcSchema,\n actions & SmartAccountClientActions<chain, account, context>\n >\n>;\n//#endregion SmartAccountClient\n\nexport type BaseSmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n {\n middleware: ClientMiddleware<context>;\n } & SmartAccountClientOpts &\n BundlerActions &\n PublicActions\n >\n>;\n\nexport function createSmartAccountClient<\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>(\n config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>\n): SmartAccountClient<TTransport, TChain, TAccount>;\n\n/**\n * Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * // optionally hoist the account\n * account: toSmartContractAccount(...),\n * });\n * ```\n *\n * @param {SmartAccountClientConfig} config The configuration for creating the smart account client\n * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account\n */\nexport function createSmartAccountClient(\n config: SmartAccountClientConfig\n): SmartAccountClient {\n const {\n key = \"account\",\n name = \"account provider\",\n transport,\n type = \"SmartAccountClient\",\n ...params\n } = config;\n\n const client: SmartAccountClient = createBundlerClient({\n ...params,\n key,\n name,\n // we start out with this because the base methods for a SmartAccountClient\n // require a smart account client, but once we have completed building everything\n // we want to override this value with the one passed in by the extender\n type: \"SmartAccountClient\",\n // TODO: this needs to be tested\n transport: (opts) => {\n const rpcTransport = transport(opts);\n\n return custom({\n async request({ method, params }) {\n switch (method) {\n case \"eth_sendTransaction\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n const [tx] = params as [FormattedTransactionRequest];\n return client.sendTransaction({\n ...tx,\n account: client.account,\n chain: client.chain,\n });\n case \"eth_sign\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, data] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signMessage(data);\n case \"personal_sign\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [data, address] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signMessage(data);\n }\n case \"eth_signTypedData_v4\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, dataParams] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signTypedData(dataParams);\n }\n case \"eth_chainId\":\n if (!opts.chain) {\n throw new ChainNotFoundError();\n }\n\n return opts.chain.id;\n default:\n // TODO: there's probably a number of methods we just don't support, will need to test most of them out\n // first let's get something working though\n return rpcTransport.request({ method, params });\n }\n },\n })(opts);\n },\n })\n .extend(() => ({\n ...SmartAccountClientOptsSchema.parse(config.opts ?? {}),\n }))\n .extend(middlewareActions(config))\n .extend(smartAccountClientActions);\n\n return { ...client, type };\n}\n\nexport function createSmartAccountClientFromExisting<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TClient extends BundlerClient<TTransport> = BundlerClient<TTransport>,\n TActions extends SmartAccountClientActions<\n TChain,\n TAccount,\n TContext\n > = SmartAccountClientActions<TChain, TAccount>,\n TRpcSchema extends SmartAccountClientRpcSchema = SmartAccountClientRpcSchema,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n config: Omit<\n SmartAccountClientConfig<Transport, TChain, TAccount, TContext>,\n \"transport\" | \"chain\"\n > & { client: TClient }\n): SmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n TActions,\n TRpcSchema,\n TContext\n>;\n\n/**\n * Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account.\n *\n * @example\n * ```ts\n * import {\n * createBundlerClient,\n * createSmartAccountClientFromExisting,\n * toSmartContractAccount\n * } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n * const client = createSmartAccountClientFromExisting({\n * client,\n * account: toSmartContractAccount(...),\n * })\n * ```\n *\n * @param {Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {client: BundlerClient}} config the configuration object which includes the client\n * @returns {SmartAccountClient} A smart account client created from the existing BundlerClient\n */\nexport function createSmartAccountClientFromExisting(\n config: Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {\n client: BundlerClient;\n }\n): SmartAccountClient {\n return createSmartAccountClient({\n ...config,\n chain: config.client.chain,\n transport: custom(config.client),\n });\n}\n"]}
1
+ {"version":3,"file":"smartAccountClient.js","sourceRoot":"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,CAAC,MAAM,CAAC,KAAK;QAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;KACjC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n custom,\n type Chain,\n type Client,\n type ClientConfig,\n type CustomTransport,\n type FormattedTransactionRequest,\n type PublicActions,\n type PublicRpcSchema,\n type RpcSchema,\n type Transport,\n} from \"viem\";\nimport { z } from \"zod\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport { AccountNotFoundError } from \"../errors/account.js\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { middlewareActions } from \"../middleware/actions.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { Prettify } from \"../utils/index.js\";\nimport { createBundlerClient, type BundlerClient } from \"./bundlerClient.js\";\nimport {\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\nimport {\n smartAccountClientActions,\n type BaseSmartAccountClientActions,\n} from \"./decorators/smartAccountClient.js\";\nimport { SmartAccountClientOptsSchema } from \"./schema.js\";\nimport type { ClientMiddlewareConfig } from \"./types.js\";\n\ntype SmartAccountClientOpts = z.output<typeof SmartAccountClientOptsSchema>;\n\nexport type SmartAccountClientConfig<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Pick<\n ClientConfig<transport, chain, account>,\n | \"cacheTime\"\n | \"chain\"\n | \"key\"\n | \"name\"\n | \"pollingInterval\"\n | \"transport\"\n | \"type\"\n > & {\n account?: account;\n opts?: z.input<typeof SmartAccountClientOptsSchema>;\n } & ClientMiddlewareConfig<context>\n>;\n\nexport type SmartAccountClientRpcSchema = [\n ...BundlerRpcSchema,\n ...PublicRpcSchema\n];\n\n//#region SmartAccountClientActions\nexport type SmartAccountClientActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = BaseSmartAccountClientActions<chain, account, context> &\n BundlerActions &\n PublicActions;\n//#endregion SmartAccountClientActions\n\n//#region SmartAccountClient\nexport type SmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n rpcSchema,\n actions & SmartAccountClientActions<chain, account, context>\n >\n>;\n//#endregion SmartAccountClient\n\nexport type BaseSmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n {\n middleware: ClientMiddleware<context>;\n } & SmartAccountClientOpts &\n BundlerActions &\n PublicActions\n >\n>;\n\nexport function createSmartAccountClient<\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>(\n config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>\n): SmartAccountClient<TTransport, TChain, TAccount>;\n\n/**\n * Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * // optionally hoist the account\n * account: toSmartContractAccount(...),\n * });\n * ```\n *\n * @param {SmartAccountClientConfig} config The configuration for creating the smart account client\n * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account\n */\nexport function createSmartAccountClient(\n config: SmartAccountClientConfig\n): SmartAccountClient {\n const {\n key = \"account\",\n name = \"account provider\",\n transport,\n type = \"SmartAccountClient\",\n ...params\n } = config;\n\n const client: SmartAccountClient = createBundlerClient({\n ...params,\n key,\n name,\n // we start out with this because the base methods for a SmartAccountClient\n // require a smart account client, but once we have completed building everything\n // we want to override this value with the one passed in by the extender\n type: \"SmartAccountClient\",\n // TODO: this needs to be tested\n transport: (opts) => {\n const rpcTransport = transport(opts);\n\n return custom({\n async request({ method, params }) {\n switch (method) {\n case \"eth_accounts\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n\n return [client.account.address];\n }\n case \"eth_sendTransaction\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n const [tx] = params as [FormattedTransactionRequest];\n return client.sendTransaction({\n ...tx,\n account: client.account,\n chain: client.chain,\n });\n case \"eth_sign\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, data] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signMessage(data);\n case \"personal_sign\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [data, address] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signMessage(data);\n }\n case \"eth_signTypedData_v4\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, dataParams] = params!;\n if (address !== client.account.address) {\n throw new Error(\n \"cannot sign for address that is not the current account\"\n );\n }\n return client.signTypedData(dataParams);\n }\n case \"eth_chainId\":\n if (!opts.chain) {\n throw new ChainNotFoundError();\n }\n\n return opts.chain.id;\n default:\n // TODO: there's probably a number of methods we just don't support, will need to test most of them out\n // first let's get something working though\n return rpcTransport.request({ method, params });\n }\n },\n })(opts);\n },\n })\n .extend(() => ({\n ...SmartAccountClientOptsSchema.parse(config.opts ?? {}),\n }))\n .extend(middlewareActions(config))\n .extend(smartAccountClientActions);\n\n return { ...client, type };\n}\n\nexport function createSmartAccountClientFromExisting<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TClient extends BundlerClient<TTransport> = BundlerClient<TTransport>,\n TActions extends SmartAccountClientActions<\n TChain,\n TAccount,\n TContext\n > = SmartAccountClientActions<TChain, TAccount>,\n TRpcSchema extends SmartAccountClientRpcSchema = SmartAccountClientRpcSchema,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n>(\n config: Omit<\n SmartAccountClientConfig<Transport, TChain, TAccount, TContext>,\n \"transport\" | \"chain\"\n > & { client: TClient }\n): SmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n TActions,\n TRpcSchema,\n TContext\n>;\n\n/**\n * Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account.\n *\n * @example\n * ```ts\n * import {\n * createBundlerClient,\n * createSmartAccountClientFromExisting,\n * toSmartContractAccount\n * } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n * const client = createSmartAccountClientFromExisting({\n * client,\n * account: toSmartContractAccount(...),\n * })\n * ```\n *\n * @param {Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {client: BundlerClient}} config the configuration object which includes the client\n * @returns {SmartAccountClient} A smart account client created from the existing BundlerClient\n */\nexport function createSmartAccountClientFromExisting(\n config: Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {\n client: BundlerClient;\n }\n): SmartAccountClient {\n return createSmartAccountClient({\n ...config,\n chain: config.client.chain,\n transport: custom(config.client),\n });\n}\n"]}
@@ -1,2 +1,3 @@
1
1
  export {};
2
+ // [!endregion ClientMiddlewareConfig]
2
3
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Address } from \"abitype\";\nimport type { Hash, Hex } from \"viem\";\nimport type { z } from \"zod\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { UserOperationRequest } from \"../types.js\";\nimport type { ConnectionConfigSchema } from \"./schema.js\";\n\nexport type ConnectorData = {\n chainId?: Hex;\n};\n\nexport type ConnectionConfig = z.input<typeof ConnectionConfigSchema>;\n\n// [!region SendUserOperationResult]\nexport type SendUserOperationResult<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n hash: Hash;\n request: UserOperationRequest<TEntryPointVersion>;\n};\n// [!endregion SendUserOperationResult]\n\n// [!region UpgradeToData]\nexport type UpgradeToData = {\n implAddress: Address;\n initializationData: Hex;\n};\n// [!endregion UpgradeToData]\n\n// [!region ClientMiddlewareConfig]\nexport type ClientMiddlewareConfig<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Partial<ClientMiddleware<TContext>>;\n// [!endregion ClientMiddlewareConfig]\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":";AAqCA,sCAAsC","sourcesContent":["import type { Address } from \"abitype\";\nimport type { Hash, Hex } from \"viem\";\nimport type { z } from \"zod\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { UserOperationRequest } from \"../types.js\";\nimport type { ConnectionConfigSchema } from \"./schema.js\";\n\nexport type ConnectorData = {\n chainId?: Hex;\n};\n\nexport type ConnectionConfig = z.input<typeof ConnectionConfigSchema>;\n\n// [!region SendUserOperationResult]\nexport type SendUserOperationResult<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n> = {\n hash: Hash;\n request: UserOperationRequest<TEntryPointVersion>;\n};\n// [!endregion SendUserOperationResult]\n\n// [!region UpgradeToData]\nexport type UpgradeToData = {\n implAddress: Address;\n initializationData: Hex;\n};\n// [!endregion UpgradeToData]\n\n// [!region ClientMiddlewareConfig]\nexport type ClientMiddlewareConfig<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined\n> = Partial<ClientMiddleware<TContext>>;\n// [!endregion ClientMiddlewareConfig]\n"]}
@@ -1,6 +1,51 @@
1
1
  import * as chains from "viem/chains";
2
2
  import { type Chain } from "viem/chains";
3
3
  export declare const ChainsById: Map<number, chains.Chain>;
4
+ /**
5
+ * Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { convertChainIdToCoinType } from "@aa-sdk/core";
10
+ * import { sepolia } from "viem/chains";
11
+ *
12
+ * const coinType = convertChainIdToCoinType(sepolia.id);
13
+ * ```
14
+ *
15
+ * @param {number} chainId the blockchain chain ID that you want to convert to a coin type
16
+ * @returns {number} the corresponding coin type for the given chain ID
17
+ */
4
18
  export declare const convertChainIdToCoinType: (chainId: number) => number;
19
+ /**
20
+ * Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * import { convertChainIdToCoinType, convertCoinTypeToChainId } from "@aa-sdk/core";
25
+ * import { sepolia } from "viem/chains";
26
+ *
27
+ * const coinType = convertChainIdToCoinType(sepolia.id);
28
+ * const chainId = convertCoinTypeToChainId(coinType);
29
+ * ```
30
+ *
31
+ * @param {number} coinType the coin type to be converted to a chain ID
32
+ * @returns {number} the corresponding chain ID
33
+ */
5
34
  export declare const convertCoinTypeToChainId: (coinType: number) => number;
35
+ /**
36
+ * Converts a coin type to its corresponding blockchain chain based on a predefined mapping.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * import { convertChainIdToCoinType, convertCoinTypeToChain } from "@aa-sdk/core";
41
+ * import { sepolia } from "viem/chains";
42
+ *
43
+ * const coinType = convertChainIdToCoinType(sepolia.id);
44
+ * const chain = convertCoinTypeToChain(coinType);
45
+ * ```
46
+ *
47
+ * @param {number} coinType The numerical identifier for the coin type
48
+ * @returns {Chain} The corresponding blockchain chain
49
+ * @throws {Error} If the coin type does not map to a supported chain
50
+ */
6
51
  export declare const convertCoinTypeToChain: (coinType: number) => Chain;