viem 0.3.0-tsc-nodenext-2.20230407T050527 → 0.3.1

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 (650) hide show
  1. package/dist/cjs/accounts/generateMnemonic.js +0 -7
  2. package/dist/cjs/accounts/generateMnemonic.js.map +1 -1
  3. package/dist/cjs/accounts/generatePrivateKey.js +0 -5
  4. package/dist/cjs/accounts/generatePrivateKey.js.map +1 -1
  5. package/dist/cjs/accounts/hdKeyToAccount.js +0 -5
  6. package/dist/cjs/accounts/hdKeyToAccount.js.map +1 -1
  7. package/dist/cjs/accounts/mnemonicToAccount.js +0 -5
  8. package/dist/cjs/accounts/mnemonicToAccount.js.map +1 -1
  9. package/dist/cjs/accounts/privateKeyToAccount.js +0 -5
  10. package/dist/cjs/accounts/privateKeyToAccount.js.map +1 -1
  11. package/dist/cjs/accounts/toAccount.js +0 -5
  12. package/dist/cjs/accounts/toAccount.js.map +1 -1
  13. package/dist/cjs/accounts/utils/publicKeyToAddress.js +0 -7
  14. package/dist/cjs/accounts/utils/publicKeyToAddress.js.map +1 -1
  15. package/dist/cjs/accounts/utils/sign.js +0 -8
  16. package/dist/cjs/accounts/utils/sign.js.map +1 -1
  17. package/dist/cjs/accounts/utils/signMessage.js +0 -6
  18. package/dist/cjs/accounts/utils/signMessage.js.map +1 -1
  19. package/dist/cjs/accounts/utils/signTypedData.js +0 -6
  20. package/dist/cjs/accounts/utils/signTypedData.js.map +1 -1
  21. package/dist/cjs/actions/ens/getEnsAddress.js +0 -6
  22. package/dist/cjs/actions/ens/getEnsAddress.js.map +1 -1
  23. package/dist/cjs/actions/ens/getEnsAvatar.js +0 -3
  24. package/dist/cjs/actions/ens/getEnsAvatar.js.map +1 -1
  25. package/dist/cjs/actions/ens/getEnsName.js +0 -12
  26. package/dist/cjs/actions/ens/getEnsName.js.map +1 -1
  27. package/dist/cjs/actions/ens/getEnsResolver.js +0 -3
  28. package/dist/cjs/actions/ens/getEnsResolver.js.map +1 -1
  29. package/dist/cjs/actions/ens/getEnsText.js +0 -15
  30. package/dist/cjs/actions/ens/getEnsText.js.map +1 -1
  31. package/dist/cjs/actions/getContract.js +0 -14
  32. package/dist/cjs/actions/getContract.js.map +1 -1
  33. package/dist/cjs/actions/public/call.js +0 -1
  34. package/dist/cjs/actions/public/call.js.map +1 -1
  35. package/dist/cjs/actions/public/createBlockFilter.js +5 -1
  36. package/dist/cjs/actions/public/createBlockFilter.js.map +1 -1
  37. package/dist/cjs/actions/public/createContractEventFilter.js +5 -0
  38. package/dist/cjs/actions/public/createContractEventFilter.js.map +1 -1
  39. package/dist/cjs/actions/public/createEventFilter.js +5 -0
  40. package/dist/cjs/actions/public/createEventFilter.js.map +1 -1
  41. package/dist/cjs/actions/public/createPendingTransactionFilter.js +5 -1
  42. package/dist/cjs/actions/public/createPendingTransactionFilter.js.map +1 -1
  43. package/dist/cjs/actions/public/estimateContractGas.js.map +1 -1
  44. package/dist/cjs/actions/public/estimateGas.js +0 -4
  45. package/dist/cjs/actions/public/estimateGas.js.map +1 -1
  46. package/dist/cjs/actions/public/getBalance.js +0 -3
  47. package/dist/cjs/actions/public/getBalance.js.map +1 -1
  48. package/dist/cjs/actions/public/getBlock.js.map +1 -1
  49. package/dist/cjs/actions/public/getBlockNumber.js +0 -3
  50. package/dist/cjs/actions/public/getBlockNumber.js.map +1 -1
  51. package/dist/cjs/actions/public/getBlockTransactionCount.js.map +1 -1
  52. package/dist/cjs/actions/public/getBytecode.js.map +1 -1
  53. package/dist/cjs/actions/public/getChainId.js.map +1 -1
  54. package/dist/cjs/actions/public/getFeeHistory.js +0 -3
  55. package/dist/cjs/actions/public/getFeeHistory.js.map +1 -1
  56. package/dist/cjs/actions/public/getFilterChanges.js +2 -3
  57. package/dist/cjs/actions/public/getFilterChanges.js.map +1 -1
  58. package/dist/cjs/actions/public/getFilterLogs.js +2 -3
  59. package/dist/cjs/actions/public/getFilterLogs.js.map +1 -1
  60. package/dist/cjs/actions/public/getGasPrice.js +0 -3
  61. package/dist/cjs/actions/public/getGasPrice.js.map +1 -1
  62. package/dist/cjs/actions/public/getLogs.js +0 -4
  63. package/dist/cjs/actions/public/getLogs.js.map +1 -1
  64. package/dist/cjs/actions/public/getStorageAt.js.map +1 -1
  65. package/dist/cjs/actions/public/getTransaction.js +0 -1
  66. package/dist/cjs/actions/public/getTransaction.js.map +1 -1
  67. package/dist/cjs/actions/public/getTransactionConfirmations.js.map +1 -1
  68. package/dist/cjs/actions/public/getTransactionCount.js +0 -3
  69. package/dist/cjs/actions/public/getTransactionCount.js.map +1 -1
  70. package/dist/cjs/actions/public/getTransactionReceipt.js.map +1 -1
  71. package/dist/cjs/actions/public/multicall.js +0 -1
  72. package/dist/cjs/actions/public/multicall.js.map +1 -1
  73. package/dist/cjs/actions/public/readContract.js.map +1 -1
  74. package/dist/cjs/actions/public/simulateContract.js.map +1 -1
  75. package/dist/cjs/actions/public/uninstallFilter.js +2 -2
  76. package/dist/cjs/actions/public/uninstallFilter.js.map +1 -1
  77. package/dist/cjs/actions/public/waitForTransactionReceipt.js +0 -11
  78. package/dist/cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  79. package/dist/cjs/actions/public/watchBlockNumber.js +0 -7
  80. package/dist/cjs/actions/public/watchBlockNumber.js.map +1 -1
  81. package/dist/cjs/actions/public/watchBlocks.js +1 -13
  82. package/dist/cjs/actions/public/watchBlocks.js.map +1 -1
  83. package/dist/cjs/actions/public/watchContractEvent.js +0 -6
  84. package/dist/cjs/actions/public/watchContractEvent.js.map +1 -1
  85. package/dist/cjs/actions/public/watchEvent.js +0 -6
  86. package/dist/cjs/actions/public/watchEvent.js.map +1 -1
  87. package/dist/cjs/actions/public/watchPendingTransactions.js.map +1 -1
  88. package/dist/cjs/actions/wallet/deployContract.js.map +1 -1
  89. package/dist/cjs/actions/wallet/sendTransaction.js +0 -2
  90. package/dist/cjs/actions/wallet/sendTransaction.js.map +1 -1
  91. package/dist/cjs/actions/wallet/signTypedData.js +0 -2
  92. package/dist/cjs/actions/wallet/signTypedData.js.map +1 -1
  93. package/dist/cjs/adapters/ethers.js +0 -5
  94. package/dist/cjs/adapters/ethers.js.map +1 -1
  95. package/dist/cjs/clients/createClient.js +0 -3
  96. package/dist/cjs/clients/createClient.js.map +1 -1
  97. package/dist/cjs/clients/createPublicClient.js +0 -3
  98. package/dist/cjs/clients/createPublicClient.js.map +1 -1
  99. package/dist/cjs/clients/createTestClient.js +0 -3
  100. package/dist/cjs/clients/createTestClient.js.map +1 -1
  101. package/dist/cjs/clients/createWalletClient.js +0 -3
  102. package/dist/cjs/clients/createWalletClient.js.map +1 -1
  103. package/dist/cjs/clients/decorators/public.js.map +1 -1
  104. package/dist/cjs/clients/decorators/wallet.js.map +1 -1
  105. package/dist/cjs/clients/transports/createTransport.js +0 -3
  106. package/dist/cjs/clients/transports/createTransport.js.map +1 -1
  107. package/dist/cjs/clients/transports/custom.js +0 -3
  108. package/dist/cjs/clients/transports/custom.js.map +1 -1
  109. package/dist/cjs/clients/transports/fallback.js +18 -12
  110. package/dist/cjs/clients/transports/fallback.js.map +1 -1
  111. package/dist/cjs/clients/transports/http.js +1 -6
  112. package/dist/cjs/clients/transports/http.js.map +1 -1
  113. package/dist/cjs/clients/transports/webSocket.js +1 -6
  114. package/dist/cjs/clients/transports/webSocket.js.map +1 -1
  115. package/dist/cjs/constants/abis.js +0 -1
  116. package/dist/cjs/constants/abis.js.map +1 -1
  117. package/dist/cjs/constants/solidity.js +0 -1
  118. package/dist/cjs/constants/solidity.js.map +1 -1
  119. package/dist/cjs/errors/abi.js.map +1 -1
  120. package/dist/cjs/errors/account.js.map +1 -1
  121. package/dist/cjs/errors/address.js.map +1 -1
  122. package/dist/cjs/errors/base.js +27 -21
  123. package/dist/cjs/errors/base.js.map +1 -1
  124. package/dist/cjs/errors/block.js.map +1 -1
  125. package/dist/cjs/errors/chain.js.map +1 -1
  126. package/dist/cjs/errors/contract.js.map +1 -1
  127. package/dist/cjs/errors/data.js.map +1 -1
  128. package/dist/cjs/errors/encoding.js.map +1 -1
  129. package/dist/cjs/errors/ens.js.map +1 -1
  130. package/dist/cjs/errors/estimateGas.js.map +1 -1
  131. package/dist/cjs/errors/index.js +27 -23
  132. package/dist/cjs/errors/index.js.map +1 -1
  133. package/dist/cjs/errors/log.js.map +1 -1
  134. package/dist/cjs/errors/node.js +0 -9
  135. package/dist/cjs/errors/node.js.map +1 -1
  136. package/dist/cjs/errors/request.js +50 -259
  137. package/dist/cjs/errors/request.js.map +1 -1
  138. package/dist/cjs/errors/rpc.js +271 -50
  139. package/dist/cjs/errors/rpc.js.map +1 -1
  140. package/dist/cjs/errors/transaction.js.map +1 -1
  141. package/dist/cjs/errors/version.js +1 -1
  142. package/dist/cjs/errors/version.js.map +1 -1
  143. package/dist/cjs/index.js +10 -5
  144. package/dist/cjs/index.js.map +1 -1
  145. package/dist/cjs/types/eip1193.js +0 -2
  146. package/dist/cjs/types/eip1193.js.map +1 -1
  147. package/dist/cjs/utils/abi/decodeAbiParameters.js +0 -29
  148. package/dist/cjs/utils/abi/decodeAbiParameters.js.map +1 -1
  149. package/dist/cjs/utils/abi/decodeEventLog.js +0 -2
  150. package/dist/cjs/utils/abi/decodeEventLog.js.map +1 -1
  151. package/dist/cjs/utils/abi/encodeAbiParameters.js +1 -10
  152. package/dist/cjs/utils/abi/encodeAbiParameters.js.map +1 -1
  153. package/dist/cjs/utils/abi/getAbiItem.js +0 -7
  154. package/dist/cjs/utils/abi/getAbiItem.js.map +1 -1
  155. package/dist/cjs/utils/accounts.js +0 -3
  156. package/dist/cjs/utils/accounts.js.map +1 -1
  157. package/dist/cjs/utils/buildRequest.js +16 -3
  158. package/dist/cjs/utils/buildRequest.js.map +1 -1
  159. package/dist/cjs/utils/data/size.js +0 -6
  160. package/dist/cjs/utils/data/size.js.map +1 -1
  161. package/dist/cjs/utils/data/slice.js +0 -21
  162. package/dist/cjs/utils/data/slice.js.map +1 -1
  163. package/dist/cjs/utils/encoding/fromBytes.js +0 -15
  164. package/dist/cjs/utils/encoding/fromBytes.js.map +1 -1
  165. package/dist/cjs/utils/encoding/fromHex.js +0 -15
  166. package/dist/cjs/utils/encoding/fromHex.js.map +1 -1
  167. package/dist/cjs/utils/encoding/toBytes.js +0 -13
  168. package/dist/cjs/utils/encoding/toBytes.js.map +1 -1
  169. package/dist/cjs/utils/encoding/toHex.js +0 -15
  170. package/dist/cjs/utils/encoding/toHex.js.map +1 -1
  171. package/dist/cjs/utils/ens/avatar/parseAvatarRecord.js +2 -6
  172. package/dist/cjs/utils/ens/avatar/parseAvatarRecord.js.map +1 -1
  173. package/dist/cjs/utils/ens/avatar/utils.js +0 -10
  174. package/dist/cjs/utils/ens/avatar/utils.js.map +1 -1
  175. package/dist/cjs/utils/ens/labelhash.js +0 -9
  176. package/dist/cjs/utils/ens/labelhash.js.map +1 -1
  177. package/dist/cjs/utils/ens/namehash.js +0 -12
  178. package/dist/cjs/utils/ens/namehash.js.map +1 -1
  179. package/dist/cjs/utils/ens/normalize.js +0 -10
  180. package/dist/cjs/utils/ens/normalize.js.map +1 -1
  181. package/dist/cjs/utils/ens/packetToBytes.js +0 -4
  182. package/dist/cjs/utils/ens/packetToBytes.js.map +1 -1
  183. package/dist/cjs/utils/errors/getNodeError.js +28 -27
  184. package/dist/cjs/utils/errors/getNodeError.js.map +1 -1
  185. package/dist/cjs/utils/filters/createFilterRequestScope.js +14 -0
  186. package/dist/cjs/utils/filters/createFilterRequestScope.js.map +1 -0
  187. package/dist/cjs/utils/formatters/block.js +0 -1
  188. package/dist/cjs/utils/formatters/block.js.map +1 -1
  189. package/dist/cjs/utils/formatters/extract.js +0 -3
  190. package/dist/cjs/utils/formatters/extract.js.map +1 -1
  191. package/dist/cjs/utils/formatters/format.js +0 -3
  192. package/dist/cjs/utils/formatters/format.js.map +1 -1
  193. package/dist/cjs/utils/index.js +2 -1
  194. package/dist/cjs/utils/index.js.map +1 -1
  195. package/dist/cjs/utils/observe.js +0 -5
  196. package/dist/cjs/utils/observe.js.map +1 -1
  197. package/dist/cjs/utils/poll.js +0 -3
  198. package/dist/cjs/utils/poll.js.map +1 -1
  199. package/dist/cjs/utils/promise/withCache.js +0 -13
  200. package/dist/cjs/utils/promise/withCache.js.map +1 -1
  201. package/dist/cjs/utils/regex.js +0 -4
  202. package/dist/cjs/utils/regex.js.map +1 -1
  203. package/dist/cjs/utils/rpc.js +3 -13
  204. package/dist/cjs/utils/rpc.js.map +1 -1
  205. package/dist/cjs/utils/signature/hashTypedData.js +0 -3
  206. package/dist/cjs/utils/signature/hashTypedData.js.map +1 -1
  207. package/dist/cjs/utils/signature/index.js +3 -1
  208. package/dist/cjs/utils/signature/index.js.map +1 -1
  209. package/dist/cjs/utils/signature/recoverAddress.js +2 -13
  210. package/dist/cjs/utils/signature/recoverAddress.js.map +1 -1
  211. package/dist/cjs/utils/signature/recoverPublicKey.js +18 -0
  212. package/dist/cjs/utils/signature/recoverPublicKey.js.map +1 -0
  213. package/dist/cjs/utils/transaction/prepareRequest.js +0 -4
  214. package/dist/cjs/utils/transaction/prepareRequest.js.map +1 -1
  215. package/dist/cjs/utils/transaction/serializeTransaction.js +2 -4
  216. package/dist/cjs/utils/transaction/serializeTransaction.js.map +1 -1
  217. package/dist/cjs/utils/typedData.js +0 -4
  218. package/dist/cjs/utils/typedData.js.map +1 -1
  219. package/dist/cjs/utils/unit/parseUnits.js +0 -2
  220. package/dist/cjs/utils/unit/parseUnits.js.map +1 -1
  221. package/dist/esm/accounts/generateMnemonic.js +0 -7
  222. package/dist/esm/accounts/generateMnemonic.js.map +1 -1
  223. package/dist/esm/accounts/generatePrivateKey.js +0 -5
  224. package/dist/esm/accounts/generatePrivateKey.js.map +1 -1
  225. package/dist/esm/accounts/hdKeyToAccount.js +0 -5
  226. package/dist/esm/accounts/hdKeyToAccount.js.map +1 -1
  227. package/dist/esm/accounts/mnemonicToAccount.js +0 -5
  228. package/dist/esm/accounts/mnemonicToAccount.js.map +1 -1
  229. package/dist/esm/accounts/privateKeyToAccount.js +0 -5
  230. package/dist/esm/accounts/privateKeyToAccount.js.map +1 -1
  231. package/dist/esm/accounts/toAccount.js +0 -5
  232. package/dist/esm/accounts/toAccount.js.map +1 -1
  233. package/dist/esm/accounts/utils/publicKeyToAddress.js +0 -7
  234. package/dist/esm/accounts/utils/publicKeyToAddress.js.map +1 -1
  235. package/dist/esm/accounts/utils/sign.js +0 -8
  236. package/dist/esm/accounts/utils/sign.js.map +1 -1
  237. package/dist/esm/accounts/utils/signMessage.js +0 -6
  238. package/dist/esm/accounts/utils/signMessage.js.map +1 -1
  239. package/dist/esm/accounts/utils/signTypedData.js +0 -6
  240. package/dist/esm/accounts/utils/signTypedData.js.map +1 -1
  241. package/dist/esm/actions/ens/getEnsAddress.js +0 -6
  242. package/dist/esm/actions/ens/getEnsAddress.js.map +1 -1
  243. package/dist/esm/actions/ens/getEnsAvatar.js +0 -3
  244. package/dist/esm/actions/ens/getEnsAvatar.js.map +1 -1
  245. package/dist/esm/actions/ens/getEnsName.js +0 -12
  246. package/dist/esm/actions/ens/getEnsName.js.map +1 -1
  247. package/dist/esm/actions/ens/getEnsResolver.js +0 -3
  248. package/dist/esm/actions/ens/getEnsResolver.js.map +1 -1
  249. package/dist/esm/actions/ens/getEnsText.js +0 -15
  250. package/dist/esm/actions/ens/getEnsText.js.map +1 -1
  251. package/dist/esm/actions/getContract.js +0 -14
  252. package/dist/esm/actions/getContract.js.map +1 -1
  253. package/dist/esm/actions/public/call.js +0 -1
  254. package/dist/esm/actions/public/call.js.map +1 -1
  255. package/dist/esm/actions/public/createBlockFilter.js +5 -1
  256. package/dist/esm/actions/public/createBlockFilter.js.map +1 -1
  257. package/dist/esm/actions/public/createContractEventFilter.js +5 -0
  258. package/dist/esm/actions/public/createContractEventFilter.js.map +1 -1
  259. package/dist/esm/actions/public/createEventFilter.js +5 -0
  260. package/dist/esm/actions/public/createEventFilter.js.map +1 -1
  261. package/dist/esm/actions/public/createPendingTransactionFilter.js +5 -1
  262. package/dist/esm/actions/public/createPendingTransactionFilter.js.map +1 -1
  263. package/dist/esm/actions/public/estimateContractGas.js.map +1 -1
  264. package/dist/esm/actions/public/estimateGas.js +0 -4
  265. package/dist/esm/actions/public/estimateGas.js.map +1 -1
  266. package/dist/esm/actions/public/getBalance.js +0 -3
  267. package/dist/esm/actions/public/getBalance.js.map +1 -1
  268. package/dist/esm/actions/public/getBlock.js.map +1 -1
  269. package/dist/esm/actions/public/getBlockNumber.js +0 -3
  270. package/dist/esm/actions/public/getBlockNumber.js.map +1 -1
  271. package/dist/esm/actions/public/getBlockTransactionCount.js.map +1 -1
  272. package/dist/esm/actions/public/getBytecode.js.map +1 -1
  273. package/dist/esm/actions/public/getChainId.js.map +1 -1
  274. package/dist/esm/actions/public/getFeeHistory.js +0 -3
  275. package/dist/esm/actions/public/getFeeHistory.js.map +1 -1
  276. package/dist/esm/actions/public/getFilterChanges.js +2 -3
  277. package/dist/esm/actions/public/getFilterChanges.js.map +1 -1
  278. package/dist/esm/actions/public/getFilterLogs.js +2 -3
  279. package/dist/esm/actions/public/getFilterLogs.js.map +1 -1
  280. package/dist/esm/actions/public/getGasPrice.js +0 -3
  281. package/dist/esm/actions/public/getGasPrice.js.map +1 -1
  282. package/dist/esm/actions/public/getLogs.js +0 -4
  283. package/dist/esm/actions/public/getLogs.js.map +1 -1
  284. package/dist/esm/actions/public/getStorageAt.js.map +1 -1
  285. package/dist/esm/actions/public/getTransaction.js +0 -1
  286. package/dist/esm/actions/public/getTransaction.js.map +1 -1
  287. package/dist/esm/actions/public/getTransactionConfirmations.js.map +1 -1
  288. package/dist/esm/actions/public/getTransactionCount.js +0 -3
  289. package/dist/esm/actions/public/getTransactionCount.js.map +1 -1
  290. package/dist/esm/actions/public/getTransactionReceipt.js.map +1 -1
  291. package/dist/esm/actions/public/multicall.js +0 -1
  292. package/dist/esm/actions/public/multicall.js.map +1 -1
  293. package/dist/esm/actions/public/readContract.js.map +1 -1
  294. package/dist/esm/actions/public/simulateContract.js.map +1 -1
  295. package/dist/esm/actions/public/uninstallFilter.js +2 -2
  296. package/dist/esm/actions/public/uninstallFilter.js.map +1 -1
  297. package/dist/esm/actions/public/waitForTransactionReceipt.js +0 -11
  298. package/dist/esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  299. package/dist/esm/actions/public/watchBlockNumber.js +0 -7
  300. package/dist/esm/actions/public/watchBlockNumber.js.map +1 -1
  301. package/dist/esm/actions/public/watchBlocks.js +1 -13
  302. package/dist/esm/actions/public/watchBlocks.js.map +1 -1
  303. package/dist/esm/actions/public/watchContractEvent.js +0 -6
  304. package/dist/esm/actions/public/watchContractEvent.js.map +1 -1
  305. package/dist/esm/actions/public/watchEvent.js +0 -6
  306. package/dist/esm/actions/public/watchEvent.js.map +1 -1
  307. package/dist/esm/actions/public/watchPendingTransactions.js.map +1 -1
  308. package/dist/esm/actions/wallet/deployContract.js.map +1 -1
  309. package/dist/esm/actions/wallet/sendTransaction.js +0 -2
  310. package/dist/esm/actions/wallet/sendTransaction.js.map +1 -1
  311. package/dist/esm/actions/wallet/signTypedData.js +0 -2
  312. package/dist/esm/actions/wallet/signTypedData.js.map +1 -1
  313. package/dist/esm/adapters/ethers.js +0 -5
  314. package/dist/esm/adapters/ethers.js.map +1 -1
  315. package/dist/esm/clients/createClient.js +0 -3
  316. package/dist/esm/clients/createClient.js.map +1 -1
  317. package/dist/esm/clients/createPublicClient.js +0 -3
  318. package/dist/esm/clients/createPublicClient.js.map +1 -1
  319. package/dist/esm/clients/createTestClient.js +0 -3
  320. package/dist/esm/clients/createTestClient.js.map +1 -1
  321. package/dist/esm/clients/createWalletClient.js +0 -3
  322. package/dist/esm/clients/createWalletClient.js.map +1 -1
  323. package/dist/esm/clients/decorators/public.js.map +1 -1
  324. package/dist/esm/clients/decorators/wallet.js.map +1 -1
  325. package/dist/esm/clients/transports/createTransport.js +0 -3
  326. package/dist/esm/clients/transports/createTransport.js.map +1 -1
  327. package/dist/esm/clients/transports/custom.js +0 -3
  328. package/dist/esm/clients/transports/custom.js.map +1 -1
  329. package/dist/esm/clients/transports/fallback.js +18 -12
  330. package/dist/esm/clients/transports/fallback.js.map +1 -1
  331. package/dist/esm/clients/transports/http.js +1 -6
  332. package/dist/esm/clients/transports/http.js.map +1 -1
  333. package/dist/esm/clients/transports/webSocket.js +1 -6
  334. package/dist/esm/clients/transports/webSocket.js.map +1 -1
  335. package/dist/esm/constants/abis.js +0 -1
  336. package/dist/esm/constants/abis.js.map +1 -1
  337. package/dist/esm/constants/solidity.js +0 -1
  338. package/dist/esm/constants/solidity.js.map +1 -1
  339. package/dist/esm/errors/abi.js.map +1 -1
  340. package/dist/esm/errors/account.js.map +1 -1
  341. package/dist/esm/errors/address.js.map +1 -1
  342. package/dist/esm/errors/base.js +27 -21
  343. package/dist/esm/errors/base.js.map +1 -1
  344. package/dist/esm/errors/block.js.map +1 -1
  345. package/dist/esm/errors/chain.js.map +1 -1
  346. package/dist/esm/errors/contract.js.map +1 -1
  347. package/dist/esm/errors/data.js.map +1 -1
  348. package/dist/esm/errors/encoding.js.map +1 -1
  349. package/dist/esm/errors/ens.js.map +1 -1
  350. package/dist/esm/errors/estimateGas.js.map +1 -1
  351. package/dist/esm/errors/index.js +4 -4
  352. package/dist/esm/errors/index.js.map +1 -1
  353. package/dist/esm/errors/log.js.map +1 -1
  354. package/dist/esm/errors/node.js +0 -9
  355. package/dist/esm/errors/node.js.map +1 -1
  356. package/dist/esm/errors/request.js +45 -241
  357. package/dist/esm/errors/request.js.map +1 -1
  358. package/dist/esm/errors/rpc.js +249 -45
  359. package/dist/esm/errors/rpc.js.map +1 -1
  360. package/dist/esm/errors/transaction.js.map +1 -1
  361. package/dist/esm/errors/version.js +1 -1
  362. package/dist/esm/errors/version.js.map +1 -1
  363. package/dist/esm/index.js +2 -2
  364. package/dist/esm/index.js.map +1 -1
  365. package/dist/esm/types/eip1193.js +0 -2
  366. package/dist/esm/types/eip1193.js.map +1 -1
  367. package/dist/esm/utils/abi/decodeAbiParameters.js +0 -29
  368. package/dist/esm/utils/abi/decodeAbiParameters.js.map +1 -1
  369. package/dist/esm/utils/abi/decodeEventLog.js +0 -2
  370. package/dist/esm/utils/abi/decodeEventLog.js.map +1 -1
  371. package/dist/esm/utils/abi/encodeAbiParameters.js +1 -10
  372. package/dist/esm/utils/abi/encodeAbiParameters.js.map +1 -1
  373. package/dist/esm/utils/abi/getAbiItem.js +0 -7
  374. package/dist/esm/utils/abi/getAbiItem.js.map +1 -1
  375. package/dist/esm/utils/accounts.js +0 -3
  376. package/dist/esm/utils/accounts.js.map +1 -1
  377. package/dist/esm/utils/buildRequest.js +16 -3
  378. package/dist/esm/utils/buildRequest.js.map +1 -1
  379. package/dist/esm/utils/data/size.js +0 -6
  380. package/dist/esm/utils/data/size.js.map +1 -1
  381. package/dist/esm/utils/data/slice.js +0 -21
  382. package/dist/esm/utils/data/slice.js.map +1 -1
  383. package/dist/esm/utils/encoding/fromBytes.js +0 -15
  384. package/dist/esm/utils/encoding/fromBytes.js.map +1 -1
  385. package/dist/esm/utils/encoding/fromHex.js +0 -15
  386. package/dist/esm/utils/encoding/fromHex.js.map +1 -1
  387. package/dist/esm/utils/encoding/toBytes.js +0 -13
  388. package/dist/esm/utils/encoding/toBytes.js.map +1 -1
  389. package/dist/esm/utils/encoding/toHex.js +0 -15
  390. package/dist/esm/utils/encoding/toHex.js.map +1 -1
  391. package/dist/esm/utils/ens/avatar/parseAvatarRecord.js +2 -6
  392. package/dist/esm/utils/ens/avatar/parseAvatarRecord.js.map +1 -1
  393. package/dist/esm/utils/ens/avatar/utils.js +0 -10
  394. package/dist/esm/utils/ens/avatar/utils.js.map +1 -1
  395. package/dist/esm/utils/ens/labelhash.js +0 -9
  396. package/dist/esm/utils/ens/labelhash.js.map +1 -1
  397. package/dist/esm/utils/ens/namehash.js +0 -12
  398. package/dist/esm/utils/ens/namehash.js.map +1 -1
  399. package/dist/esm/utils/ens/normalize.js +0 -10
  400. package/dist/esm/utils/ens/normalize.js.map +1 -1
  401. package/dist/esm/utils/ens/packetToBytes.js +0 -4
  402. package/dist/esm/utils/ens/packetToBytes.js.map +1 -1
  403. package/dist/esm/utils/errors/getNodeError.js +3 -2
  404. package/dist/esm/utils/errors/getNodeError.js.map +1 -1
  405. package/dist/esm/utils/filters/createFilterRequestScope.js +10 -0
  406. package/dist/esm/utils/filters/createFilterRequestScope.js.map +1 -0
  407. package/dist/esm/utils/formatters/block.js +0 -1
  408. package/dist/esm/utils/formatters/block.js.map +1 -1
  409. package/dist/esm/utils/formatters/extract.js +0 -3
  410. package/dist/esm/utils/formatters/extract.js.map +1 -1
  411. package/dist/esm/utils/formatters/format.js +0 -3
  412. package/dist/esm/utils/formatters/format.js.map +1 -1
  413. package/dist/esm/utils/index.js +1 -1
  414. package/dist/esm/utils/index.js.map +1 -1
  415. package/dist/esm/utils/observe.js +0 -5
  416. package/dist/esm/utils/observe.js.map +1 -1
  417. package/dist/esm/utils/poll.js +0 -3
  418. package/dist/esm/utils/poll.js.map +1 -1
  419. package/dist/esm/utils/promise/withCache.js +0 -13
  420. package/dist/esm/utils/promise/withCache.js.map +1 -1
  421. package/dist/esm/utils/regex.js +0 -4
  422. package/dist/esm/utils/regex.js.map +1 -1
  423. package/dist/esm/utils/rpc.js +4 -14
  424. package/dist/esm/utils/rpc.js.map +1 -1
  425. package/dist/esm/utils/signature/hashTypedData.js +0 -3
  426. package/dist/esm/utils/signature/hashTypedData.js.map +1 -1
  427. package/dist/esm/utils/signature/index.js +1 -0
  428. package/dist/esm/utils/signature/index.js.map +1 -1
  429. package/dist/esm/utils/signature/recoverAddress.js +2 -13
  430. package/dist/esm/utils/signature/recoverAddress.js.map +1 -1
  431. package/dist/esm/utils/signature/recoverPublicKey.js +14 -0
  432. package/dist/esm/utils/signature/recoverPublicKey.js.map +1 -0
  433. package/dist/esm/utils/transaction/prepareRequest.js +0 -4
  434. package/dist/esm/utils/transaction/prepareRequest.js.map +1 -1
  435. package/dist/esm/utils/transaction/serializeTransaction.js +2 -4
  436. package/dist/esm/utils/transaction/serializeTransaction.js.map +1 -1
  437. package/dist/esm/utils/typedData.js +0 -4
  438. package/dist/esm/utils/typedData.js.map +1 -1
  439. package/dist/esm/utils/unit/parseUnits.js +0 -2
  440. package/dist/esm/utils/unit/parseUnits.js.map +1 -1
  441. package/dist/types/actions/ens/getEnsAddress.d.ts +28 -5
  442. package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -1
  443. package/dist/types/actions/ens/getEnsAvatar.d.ts +28 -2
  444. package/dist/types/actions/ens/getEnsAvatar.d.ts.map +1 -1
  445. package/dist/types/actions/ens/getEnsName.d.ts +19 -3
  446. package/dist/types/actions/ens/getEnsName.d.ts.map +1 -1
  447. package/dist/types/actions/ens/getEnsResolver.d.ts +29 -3
  448. package/dist/types/actions/ens/getEnsResolver.d.ts.map +1 -1
  449. package/dist/types/actions/ens/getEnsText.d.ts +22 -7
  450. package/dist/types/actions/ens/getEnsText.d.ts.map +1 -1
  451. package/dist/types/actions/getContract.d.ts +42 -3
  452. package/dist/types/actions/getContract.d.ts.map +1 -1
  453. package/dist/types/actions/public/call.d.ts +29 -1
  454. package/dist/types/actions/public/call.d.ts.map +1 -1
  455. package/dist/types/actions/public/createBlockFilter.d.ts +21 -0
  456. package/dist/types/actions/public/createBlockFilter.d.ts.map +1 -1
  457. package/dist/types/actions/public/createContractEventFilter.d.ts +22 -0
  458. package/dist/types/actions/public/createContractEventFilter.d.ts.map +1 -1
  459. package/dist/types/actions/public/createEventFilter.d.ts +23 -0
  460. package/dist/types/actions/public/createEventFilter.d.ts.map +1 -1
  461. package/dist/types/actions/public/createPendingTransactionFilter.d.ts +21 -0
  462. package/dist/types/actions/public/createPendingTransactionFilter.d.ts.map +1 -1
  463. package/dist/types/actions/public/estimateContractGas.d.ts +28 -0
  464. package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -1
  465. package/dist/types/actions/public/estimateGas.d.ts +27 -2
  466. package/dist/types/actions/public/estimateGas.d.ts.map +1 -1
  467. package/dist/types/actions/public/getBalance.d.ts +34 -1
  468. package/dist/types/actions/public/getBalance.d.ts.map +1 -1
  469. package/dist/types/actions/public/getBlock.d.ts +28 -1
  470. package/dist/types/actions/public/getBlock.d.ts.map +1 -1
  471. package/dist/types/actions/public/getBlockNumber.d.ts +21 -1
  472. package/dist/types/actions/public/getBlockNumber.d.ts.map +1 -1
  473. package/dist/types/actions/public/getBlockTransactionCount.d.ts +23 -0
  474. package/dist/types/actions/public/getBlockTransactionCount.d.ts.map +1 -1
  475. package/dist/types/actions/public/getBytecode.d.ts +23 -0
  476. package/dist/types/actions/public/getBytecode.d.ts.map +1 -1
  477. package/dist/types/actions/public/getChainId.d.ts +21 -0
  478. package/dist/types/actions/public/getChainId.d.ts.map +1 -1
  479. package/dist/types/actions/public/getFeeHistory.d.ts +33 -1
  480. package/dist/types/actions/public/getFeeHistory.d.ts.map +1 -1
  481. package/dist/types/actions/public/getFilterChanges.d.ts +84 -1
  482. package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -1
  483. package/dist/types/actions/public/getFilterLogs.d.ts +29 -1
  484. package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -1
  485. package/dist/types/actions/public/getGasPrice.d.ts +18 -1
  486. package/dist/types/actions/public/getGasPrice.d.ts.map +1 -1
  487. package/dist/types/actions/public/getLogs.d.ts +22 -3
  488. package/dist/types/actions/public/getLogs.d.ts.map +1 -1
  489. package/dist/types/actions/public/getStorageAt.d.ts +24 -0
  490. package/dist/types/actions/public/getStorageAt.d.ts.map +1 -1
  491. package/dist/types/actions/public/getTransaction.d.ts +24 -1
  492. package/dist/types/actions/public/getTransaction.d.ts.map +1 -1
  493. package/dist/types/actions/public/getTransactionConfirmations.d.ts +24 -0
  494. package/dist/types/actions/public/getTransactionConfirmations.d.ts.map +1 -1
  495. package/dist/types/actions/public/getTransactionCount.d.ts +21 -1
  496. package/dist/types/actions/public/getTransactionCount.d.ts.map +1 -1
  497. package/dist/types/actions/public/getTransactionReceipt.d.ts +24 -0
  498. package/dist/types/actions/public/getTransactionReceipt.d.ts.map +1 -1
  499. package/dist/types/actions/public/multicall.d.ts +39 -0
  500. package/dist/types/actions/public/multicall.d.ts.map +1 -1
  501. package/dist/types/actions/public/readContract.d.ts +32 -0
  502. package/dist/types/actions/public/readContract.d.ts.map +1 -1
  503. package/dist/types/actions/public/simulateContract.d.ts +32 -0
  504. package/dist/types/actions/public/simulateContract.d.ts.map +1 -1
  505. package/dist/types/actions/public/uninstallFilter.d.ts +26 -1
  506. package/dist/types/actions/public/uninstallFilter.d.ts.map +1 -1
  507. package/dist/types/actions/public/waitForTransactionReceipt.d.ts +48 -2
  508. package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  509. package/dist/types/actions/public/watchBlockNumber.d.ts +25 -1
  510. package/dist/types/actions/public/watchBlockNumber.d.ts.map +1 -1
  511. package/dist/types/actions/public/watchBlocks.d.ts +24 -2
  512. package/dist/types/actions/public/watchBlocks.d.ts.map +1 -1
  513. package/dist/types/actions/public/watchContractEvent.d.ts +31 -0
  514. package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -1
  515. package/dist/types/actions/public/watchEvent.d.ts +37 -1
  516. package/dist/types/actions/public/watchEvent.d.ts.map +1 -1
  517. package/dist/types/actions/public/watchPendingTransactions.d.ts +47 -4
  518. package/dist/types/actions/public/watchPendingTransactions.d.ts.map +1 -1
  519. package/dist/types/actions/wallet/deployContract.d.ts +27 -0
  520. package/dist/types/actions/wallet/deployContract.d.ts.map +1 -1
  521. package/dist/types/clients/decorators/public.d.ts +996 -1
  522. package/dist/types/clients/decorators/public.d.ts.map +1 -1
  523. package/dist/types/clients/decorators/wallet.d.ts +25 -0
  524. package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
  525. package/dist/types/clients/transports/fallback.d.ts +14 -0
  526. package/dist/types/clients/transports/fallback.d.ts.map +1 -1
  527. package/dist/types/errors/abi.d.ts.map +1 -1
  528. package/dist/types/errors/account.d.ts.map +1 -1
  529. package/dist/types/errors/address.d.ts.map +1 -1
  530. package/dist/types/errors/base.d.ts +1 -0
  531. package/dist/types/errors/base.d.ts.map +1 -1
  532. package/dist/types/errors/block.d.ts.map +1 -1
  533. package/dist/types/errors/chain.d.ts.map +1 -1
  534. package/dist/types/errors/contract.d.ts.map +1 -1
  535. package/dist/types/errors/data.d.ts.map +1 -1
  536. package/dist/types/errors/encoding.d.ts.map +1 -1
  537. package/dist/types/errors/ens.d.ts.map +1 -1
  538. package/dist/types/errors/estimateGas.d.ts.map +1 -1
  539. package/dist/types/errors/index.d.ts +4 -4
  540. package/dist/types/errors/index.d.ts.map +1 -1
  541. package/dist/types/errors/log.d.ts.map +1 -1
  542. package/dist/types/errors/node.d.ts.map +1 -1
  543. package/dist/types/errors/request.d.ts +42 -80
  544. package/dist/types/errors/request.d.ts.map +1 -1
  545. package/dist/types/errors/rpc.d.ts +189 -43
  546. package/dist/types/errors/rpc.d.ts.map +1 -1
  547. package/dist/types/errors/transaction.d.ts.map +1 -1
  548. package/dist/types/errors/version.d.ts +1 -1
  549. package/dist/types/errors/version.d.ts.map +1 -1
  550. package/dist/types/index.d.ts +4 -4
  551. package/dist/types/index.d.ts.map +1 -1
  552. package/dist/types/types/eip1193.d.ts +2 -1
  553. package/dist/types/types/eip1193.d.ts.map +1 -1
  554. package/dist/types/types/filter.d.ts +2 -0
  555. package/dist/types/types/filter.d.ts.map +1 -1
  556. package/dist/types/types/index.d.ts +1 -0
  557. package/dist/types/types/index.d.ts.map +1 -1
  558. package/dist/types/types/window.d.ts +2 -4
  559. package/dist/types/types/window.d.ts.map +1 -1
  560. package/dist/types/utils/abi/getAbiItem.d.ts +1 -1
  561. package/dist/types/utils/abi/getAbiItem.d.ts.map +1 -1
  562. package/dist/types/utils/buildRequest.d.ts.map +1 -1
  563. package/dist/types/utils/errors/getNodeError.d.ts +1 -1
  564. package/dist/types/utils/errors/getNodeError.d.ts.map +1 -1
  565. package/dist/types/utils/filters/createFilterRequestScope.d.ts +16 -0
  566. package/dist/types/utils/filters/createFilterRequestScope.d.ts.map +1 -0
  567. package/dist/types/utils/index.d.ts +2 -2
  568. package/dist/types/utils/index.d.ts.map +1 -1
  569. package/dist/types/utils/rpc.d.ts.map +1 -1
  570. package/dist/types/utils/signature/index.d.ts +2 -0
  571. package/dist/types/utils/signature/index.d.ts.map +1 -1
  572. package/dist/types/utils/signature/recoverAddress.d.ts.map +1 -1
  573. package/dist/types/utils/signature/recoverPublicKey.d.ts +8 -0
  574. package/dist/types/utils/signature/recoverPublicKey.d.ts.map +1 -0
  575. package/package.json +2 -2
  576. package/src/actions/ens/getEnsAddress.ts +28 -5
  577. package/src/actions/ens/getEnsAvatar.ts +28 -2
  578. package/src/actions/ens/getEnsName.ts +19 -3
  579. package/src/actions/ens/getEnsResolver.ts +29 -3
  580. package/src/actions/ens/getEnsText.ts +22 -7
  581. package/src/actions/getContract.ts +42 -3
  582. package/src/actions/public/call.ts +29 -1
  583. package/src/actions/public/createBlockFilter.ts +26 -1
  584. package/src/actions/public/createContractEventFilter.ts +28 -0
  585. package/src/actions/public/createEventFilter.ts +30 -0
  586. package/src/actions/public/createPendingTransactionFilter.ts +26 -1
  587. package/src/actions/public/estimateContractGas.ts +28 -0
  588. package/src/actions/public/estimateGas.ts +27 -2
  589. package/src/actions/public/getBalance.ts +34 -1
  590. package/src/actions/public/getBlock.ts +28 -1
  591. package/src/actions/public/getBlockNumber.ts +21 -1
  592. package/src/actions/public/getBlockTransactionCount.ts +23 -0
  593. package/src/actions/public/getBytecode.ts +23 -0
  594. package/src/actions/public/getChainId.ts +21 -0
  595. package/src/actions/public/getFeeHistory.ts +33 -1
  596. package/src/actions/public/getFilterChanges.ts +85 -2
  597. package/src/actions/public/getFilterLogs.ts +30 -2
  598. package/src/actions/public/getGasPrice.ts +18 -1
  599. package/src/actions/public/getLogs.ts +23 -4
  600. package/src/actions/public/getStorageAt.ts +24 -0
  601. package/src/actions/public/getTransaction.ts +24 -1
  602. package/src/actions/public/getTransactionConfirmations.ts +24 -0
  603. package/src/actions/public/getTransactionCount.ts +21 -1
  604. package/src/actions/public/getTransactionReceipt.ts +24 -0
  605. package/src/actions/public/multicall.ts +39 -0
  606. package/src/actions/public/readContract.ts +32 -0
  607. package/src/actions/public/simulateContract.ts +32 -0
  608. package/src/actions/public/uninstallFilter.ts +27 -2
  609. package/src/actions/public/waitForTransactionReceipt.ts +48 -2
  610. package/src/actions/public/watchBlockNumber.ts +25 -1
  611. package/src/actions/public/watchBlocks.ts +24 -2
  612. package/src/actions/public/watchContractEvent.ts +31 -0
  613. package/src/actions/public/watchEvent.ts +37 -1
  614. package/src/actions/public/watchPendingTransactions.ts +49 -4
  615. package/src/actions/wallet/deployContract.ts +27 -0
  616. package/src/clients/decorators/public.ts +996 -1
  617. package/src/clients/decorators/wallet.ts +25 -0
  618. package/src/clients/transports/fallback.ts +46 -2
  619. package/src/errors/abi.ts +25 -25
  620. package/src/errors/account.ts +1 -1
  621. package/src/errors/address.ts +1 -1
  622. package/src/errors/base.ts +7 -5
  623. package/src/errors/block.ts +1 -1
  624. package/src/errors/chain.ts +4 -4
  625. package/src/errors/contract.ts +7 -7
  626. package/src/errors/data.ts +1 -1
  627. package/src/errors/encoding.ts +7 -7
  628. package/src/errors/ens.ts +4 -4
  629. package/src/errors/estimateGas.ts +2 -2
  630. package/src/errors/index.ts +15 -11
  631. package/src/errors/log.ts +1 -1
  632. package/src/errors/node.ts +12 -12
  633. package/src/errors/request.ts +82 -175
  634. package/src/errors/rpc.ts +355 -89
  635. package/src/errors/transaction.ts +11 -11
  636. package/src/errors/version.ts +1 -1
  637. package/src/index.ts +9 -1
  638. package/src/types/eip1193.ts +6 -1
  639. package/src/types/filter.ts +3 -0
  640. package/src/types/index.ts +2 -0
  641. package/src/types/window.ts +2 -4
  642. package/src/utils/abi/getAbiItem.ts +9 -8
  643. package/src/utils/buildRequest.ts +19 -1
  644. package/src/utils/errors/getNodeError.ts +2 -3
  645. package/src/utils/filters/createFilterRequestScope.ts +42 -0
  646. package/src/utils/index.ts +3 -0
  647. package/src/utils/rpc.ts +6 -4
  648. package/src/utils/signature/index.ts +6 -0
  649. package/src/utils/signature/recoverAddress.ts +2 -17
  650. package/src/utils/signature/recoverPublicKey.ts +30 -0
@@ -49,7 +49,10 @@ export type EstimateGasParameters<
49
49
  }
50
50
  | {
51
51
  blockNumber?: never
52
- /** The balance of the account at a block tag. */
52
+ /**
53
+ * The balance of the account at a block tag.
54
+ * @default 'latest'
55
+ */
53
56
  blockTag?: BlockTag
54
57
  }
55
58
  )
@@ -57,7 +60,29 @@ export type EstimateGasParameters<
57
60
  export type EstimateGasReturnType = bigint
58
61
 
59
62
  /**
60
- * @description Estimates the gas necessary to complete a transaction without submitting it to the network.
63
+ * Estimates the gas necessary to complete a transaction without submitting it to the network.
64
+ *
65
+ * - Docs: https://viem.sh/docs/actions/public/estimateGas.html
66
+ * - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
67
+ *
68
+ * @param client - Client to use
69
+ * @param parameters - {@link EstimateGasParameters}
70
+ * @returns The gas estimate (in wei). {@link EstimateGasReturnType}
71
+ *
72
+ * @example
73
+ * import { createPublicClient, http, parseEther } from 'viem'
74
+ * import { mainnet } from 'viem/chains'
75
+ * import { estimateGas } from 'viem/public'
76
+ *
77
+ * const client = createPublicClient({
78
+ * chain: mainnet,
79
+ * transport: http(),
80
+ * })
81
+ * const gasEstimate = await estimateGas(client, {
82
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
83
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
84
+ * value: parseEther('1'),
85
+ * })
61
86
  */
62
87
  export async function estimateGas<
63
88
  TChain extends Chain | undefined,
@@ -21,7 +21,40 @@ export type GetBalanceParameters = {
21
21
  export type GetBalanceReturnType = bigint
22
22
 
23
23
  /**
24
- * @description Returns the balance of an address in wei.
24
+ * Returns the balance of an address in wei.
25
+ *
26
+ * - Docs: https://viem.sh/docs/actions/public/getBalance.html
27
+ * - JSON-RPC Methods: [`eth_getBalance`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance)
28
+ *
29
+ * @remarks
30
+ * You can convert the balance to ether units with [`formatEther`](https://viem.sh/docs/utilities/formatEther.html).
31
+ *
32
+ * ```ts
33
+ * const balance = await getBalance(client, {
34
+ * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
35
+ * blockTag: 'safe'
36
+ * })
37
+ * const balanceAsEther = formatEther(balance)
38
+ * // "6.942"
39
+ * ```
40
+ *
41
+ * @param client - Client to use
42
+ * @param parameters - {@link GetBalanceParameters}
43
+ * @returns The balance of the address in wei. {@link GetBalanceReturnType}
44
+ *
45
+ * @example
46
+ * import { createPublicClient, http } from 'viem'
47
+ * import { mainnet } from 'viem/chains'
48
+ * import { getBalance } from 'viem/public'
49
+ *
50
+ * const client = createPublicClient({
51
+ * chain: mainnet,
52
+ * transport: http(),
53
+ * })
54
+ * const balance = await getBalance(client, {
55
+ * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
56
+ * })
57
+ * // 10000000000000000000000n (wei)
25
58
  */
26
59
  export async function getBalance<TChain extends Chain | undefined>(
27
60
  client: PublicClient<Transport, TChain>,
@@ -33,7 +33,10 @@ export type GetBlockParameters = {
33
33
  | {
34
34
  blockHash?: never
35
35
  blockNumber?: never
36
- /** The block tag. Defaults to 'latest'. */
36
+ /**
37
+ * The block tag.
38
+ * @default 'latest'
39
+ */
37
40
  blockTag?: BlockTag
38
41
  }
39
42
  )
@@ -42,6 +45,30 @@ export type GetBlockReturnType<
42
45
  TChain extends Chain | undefined = Chain | undefined,
43
46
  > = FormattedBlock<BlockFormatter<TChain>>
44
47
 
48
+ /**
49
+ * Returns information about a block at a block number, hash, or tag.
50
+ *
51
+ * - Docs: https://viem.sh/docs/actions/public/getBlock.html
52
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks
53
+ * - JSON-RPC Methods:
54
+ * - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) for `blockNumber` & `blockTag`.
55
+ * - Calls [`eth_getBlockByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) for `blockHash`.
56
+ *
57
+ * @param client - Client to use
58
+ * @param parameters - {@link GetBlockParameters}
59
+ * @returns Information about the block. {@link GetBlockReturnType}
60
+ *
61
+ * @example
62
+ * import { createPublicClient, http } from 'viem'
63
+ * import { mainnet } from 'viem/chains'
64
+ * import { getBlock } from 'viem/public'
65
+ *
66
+ * const client = createPublicClient({
67
+ * chain: mainnet,
68
+ * transport: http(),
69
+ * })
70
+ * const block = await getBlock(client)
71
+ */
45
72
  export async function getBlock<
46
73
  TChain extends Chain | undefined,
47
74
  TAccount extends Account | undefined,
@@ -16,7 +16,27 @@ export function getBlockNumberCache(id: string) {
16
16
  }
17
17
 
18
18
  /**
19
- * @description Returns the number of the most recent block seen.
19
+ * Returns the number of the most recent block seen.
20
+ *
21
+ * - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html
22
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks
23
+ * - JSON-RPC Methods: [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber)
24
+ *
25
+ * @param client - Client to use
26
+ * @param parameters - {@link GetBlockNumberParameters}
27
+ * @returns The number of the block. {@link GetBlockNumberReturnType}
28
+ *
29
+ * @example
30
+ * import { createPublicClient, http } from 'viem'
31
+ * import { mainnet } from 'viem/chains'
32
+ * import { getBlockNumber } from 'viem/public'
33
+ *
34
+ * const client = createPublicClient({
35
+ * chain: mainnet,
36
+ * transport: http(),
37
+ * })
38
+ * const blockNumber = await getBlockNumber(client)
39
+ * // 69420n
20
40
  */
21
41
  export async function getBlockNumber<TChain extends Chain | undefined>(
22
42
  client: PublicClient<Transport, TChain>,
@@ -24,6 +24,29 @@ export type GetBlockTransactionCountParameters =
24
24
 
25
25
  export type GetBlockTransactionCountReturnType = number
26
26
 
27
+ /**
28
+ * Returns the number of Transactions at a block number, hash, or tag.
29
+ *
30
+ * - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount.html
31
+ * - JSON-RPC Methods:
32
+ * - Calls [`eth_getBlockTransactionCountByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbynumber) for `blockNumber` & `blockTag`.
33
+ * - Calls [`eth_getBlockTransactionCountByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbyhash) for `blockHash`.
34
+ *
35
+ * @param client - Client to use
36
+ * @param parameters - {@link GetBlockTransactionCountParameters}
37
+ * @returns The block transaction count. {@link GetBlockTransactionCountReturnType}
38
+ *
39
+ * @example
40
+ * import { createPublicClient, http } from 'viem'
41
+ * import { mainnet } from 'viem/chains'
42
+ * import { getBlockTransactionCount } from 'viem/public'
43
+ *
44
+ * const client = createPublicClient({
45
+ * chain: mainnet,
46
+ * transport: http(),
47
+ * })
48
+ * const count = await getBlockTransactionCount(client)
49
+ */
27
50
  export async function getBlockTransactionCount<
28
51
  TChain extends Chain | undefined,
29
52
  >(
@@ -17,6 +17,29 @@ export type GetBytecodeParameters = {
17
17
 
18
18
  export type GetBytecodeReturnType = Hex | undefined
19
19
 
20
+ /**
21
+ * Retrieves the bytecode at an address.
22
+ *
23
+ * - Docs: https://viem.sh/docs/contract/getBytecode.html
24
+ * - JSON-RPC Methods: [`eth_getCode`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getcode)
25
+ *
26
+ * @param client - Client to use
27
+ * @param parameters - {@link GetBytecodeParameters}
28
+ * @returns The contract's bytecode. {@link GetBytecodeReturnType}
29
+ *
30
+ * @example
31
+ * import { createPublicClient, http } from 'viem'
32
+ * import { mainnet } from 'viem/chains'
33
+ * import { getBytecode } from 'viem/contract'
34
+ *
35
+ * const client = createPublicClient({
36
+ * chain: mainnet,
37
+ * transport: http(),
38
+ * })
39
+ * const code = await getBytecode(client, {
40
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
41
+ * })
42
+ */
20
43
  export async function getBytecode<TChain extends Chain | undefined>(
21
44
  client: PublicClient<Transport, TChain>,
22
45
  { address, blockNumber, blockTag = 'latest' }: GetBytecodeParameters,
@@ -8,6 +8,27 @@ import { hexToNumber } from '../../utils/index.js'
8
8
 
9
9
  export type GetChainIdReturnType = number
10
10
 
11
+ /**
12
+ * Returns the chain ID associated with the current network.
13
+ *
14
+ * - Docs: https://viem.sh/docs/actions/public/getChainId.html
15
+ * - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)
16
+ *
17
+ * @param client - Client to use
18
+ * @returns The current chain ID. {@link GetChainIdReturnType}
19
+ *
20
+ * @example
21
+ * import { createPublicClient, http } from 'viem'
22
+ * import { mainnet } from 'viem/chains'
23
+ * import { getChainId } from 'viem/public'
24
+ *
25
+ * const client = createPublicClient({
26
+ * chain: mainnet,
27
+ * transport: http(),
28
+ * })
29
+ * const chainId = await getChainId(client)
30
+ * // 1
31
+ */
11
32
  export async function getChainId<
12
33
  TChain extends Chain | undefined,
13
34
  TAccount extends Account | undefined,
@@ -5,14 +5,25 @@ import { numberToHex } from '../../utils/index.js'
5
5
  import { formatFeeHistory } from '../../utils/formatters/index.js'
6
6
 
7
7
  export type GetFeeHistoryParameters = {
8
+ /**
9
+ * Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available.
10
+ */
8
11
  blockCount: number
12
+ /**
13
+ * A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used.
14
+ */
9
15
  rewardPercentiles: number[]
10
16
  } & (
11
17
  | {
12
18
  blockNumber?: never
19
+ /**
20
+ * Highest number block of the requested range.
21
+ * @default 'latest'
22
+ */
13
23
  blockTag?: BlockTag
14
24
  }
15
25
  | {
26
+ /** Highest number block of the requested range. */
16
27
  blockNumber?: bigint
17
28
  blockTag?: never
18
29
  }
@@ -20,7 +31,28 @@ export type GetFeeHistoryParameters = {
20
31
  export type GetFeeHistoryReturnType = FeeHistory
21
32
 
22
33
  /**
23
- * @description Returns a collection of historical gas information.
34
+ * Returns a collection of historical gas information.
35
+ *
36
+ * - Docs: https://viem.sh/docs/actions/public/getFeeHistory.html
37
+ * - JSON-RPC Methods: [`eth_feeHistory`](https://docs.alchemy.com/reference/eth-feehistory)
38
+ *
39
+ * @param client - Client to use
40
+ * @param parameters - {@link GetFeeHistoryParameters}
41
+ * @returns The gas estimate (in wei). {@link GetFeeHistoryReturnType}
42
+ *
43
+ * @example
44
+ * import { createPublicClient, http } from 'viem'
45
+ * import { mainnet } from 'viem/chains'
46
+ * import { getFeeHistory } from 'viem/public'
47
+ *
48
+ * const client = createPublicClient({
49
+ * chain: mainnet,
50
+ * transport: http(),
51
+ * })
52
+ * const feeHistory = await getFeeHistory(client, {
53
+ * blockCount: 4,
54
+ * rewardPercentiles: [25, 75],
55
+ * })
24
56
  */
25
57
  export async function getFeeHistory<TChain extends Chain | undefined>(
26
58
  client: PublicClient<Transport, TChain>,
@@ -30,6 +30,89 @@ export type GetFilterChangesReturnType<
30
30
  ? Log<bigint, number, TAbiEvent, TAbi, TEventName>[]
31
31
  : Hash[]
32
32
 
33
+ /**
34
+ * Returns a list of logs or hashes based on a [Filter](/docs/glossary/terms#filter) since the last time it was called.
35
+ *
36
+ * - Docs: https://viem.sh/docs/actions/public/getFilterChanges.html
37
+ * - JSON-RPC Methods: [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges)
38
+ *
39
+ * @remarks
40
+ * A Filter can be created from the following actions:
41
+ *
42
+ * - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
43
+ * - [`createContractEventFilter`](https://viem.sh/docs/contract/createContractEventFilter)
44
+ * - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
45
+ * - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter)
46
+ *
47
+ * Depending on the type of filter, the return value will be different:
48
+ *
49
+ * - If the filter was created with `createContractEventFilter` or `createEventFilter`, it returns a list of logs.
50
+ * - If the filter was created with `createPendingTransactionFilter`, it returns a list of transaction hashes.
51
+ * - If the filter was created with `createBlockFilter`, it returns a list of block hashes.
52
+ *
53
+ * @param client - Client to use
54
+ * @param parameters - {@link GetFilterChangesParameters}
55
+ * @returns Logs or hashes. {@link GetFilterChangesReturnType}
56
+ *
57
+ * @example
58
+ * // Blocks
59
+ * import { createPublicClient, http } from 'viem'
60
+ * import { mainnet } from 'viem/chains'
61
+ * import { createBlockFilter, getFilterChanges } from 'viem/public'
62
+ *
63
+ * const client = createPublicClient({
64
+ * chain: mainnet,
65
+ * transport: http(),
66
+ * })
67
+ * const filter = await createBlockFilter(client)
68
+ * const hashes = await getFilterChanges(client, { filter })
69
+ *
70
+ * @example
71
+ * // Contract Events
72
+ * import { createPublicClient, http, parseAbi } from 'viem'
73
+ * import { mainnet } from 'viem/chains'
74
+ * import { createContractEventFilter, getFilterChanges } from 'viem/public'
75
+ *
76
+ * const client = createPublicClient({
77
+ * chain: mainnet,
78
+ * transport: http(),
79
+ * })
80
+ * const filter = await createContractEventFilter(client, {
81
+ * address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
82
+ * abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']),
83
+ * eventName: 'Transfer',
84
+ * })
85
+ * const logs = await getFilterChanges(client, { filter })
86
+ *
87
+ * @example
88
+ * // Raw Events
89
+ * import { createPublicClient, http, parseAbiItem } from 'viem'
90
+ * import { mainnet } from 'viem/chains'
91
+ * import { createEventFilter, getFilterChanges } from 'viem/public'
92
+ *
93
+ * const client = createPublicClient({
94
+ * chain: mainnet,
95
+ * transport: http(),
96
+ * })
97
+ * const filter = await createEventFilter(client, {
98
+ * address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
99
+ * event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
100
+ * })
101
+ * const logs = await getFilterChanges(client, { filter })
102
+ *
103
+ * @example
104
+ * // Transactions
105
+ * import { createPublicClient, http } from 'viem'
106
+ * import { mainnet } from 'viem/chains'
107
+ * import { createPendingTransactionFilter, getFilterChanges } from 'viem/public'
108
+ *
109
+ * const client = createPublicClient({
110
+ * chain: mainnet,
111
+ * transport: http(),
112
+ * })
113
+ * const filter = await createPendingTransactionFilter(client)
114
+ * const hashes = await getFilterChanges(client, { filter })
115
+ */
33
116
  export async function getFilterChanges<
34
117
  TTransport extends Transport,
35
118
  TChain extends Chain | undefined,
@@ -38,12 +121,12 @@ export async function getFilterChanges<
38
121
  TAbi extends Abi | readonly unknown[],
39
122
  TEventName extends string | undefined,
40
123
  >(
41
- client: PublicClient<TTransport, TChain>,
124
+ _client: PublicClient<TTransport, TChain>,
42
125
  {
43
126
  filter,
44
127
  }: GetFilterChangesParameters<TFilterType, TAbiEvent, TAbi, TEventName>,
45
128
  ) {
46
- const logs = await client.request({
129
+ const logs = await filter.request({
47
130
  method: 'eth_getFilterChanges',
48
131
  params: [filter.id],
49
132
  })
@@ -23,16 +23,44 @@ export type GetFilterLogsReturnType<
23
23
  TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>,
24
24
  > = Log<bigint, number, TAbiEvent, TAbi, TEventName>[]
25
25
 
26
+ /**
27
+ * Returns a list of event logs since the filter was created.
28
+ *
29
+ * - Docs: https://viem.sh/docs/actions/public/getFilterLogs.html
30
+ * - JSON-RPC Methods: [`eth_getFilterLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterlogs)
31
+ *
32
+ * @remarks
33
+ * `getFilterLogs` is only compatible with **event filters**.
34
+ *
35
+ * @param client - Client to use
36
+ * @param parameters - {@link GetFilterLogsParameters}
37
+ * @returns A list of event logs. {@link GetFilterLogsReturnType}
38
+ *
39
+ * @example
40
+ * import { createPublicClient, http, parseAbiItem } from 'viem'
41
+ * import { mainnet } from 'viem/chains'
42
+ * import { createEventFilter, getFilterLogs } from 'viem/public'
43
+ *
44
+ * const client = createPublicClient({
45
+ * chain: mainnet,
46
+ * transport: http(),
47
+ * })
48
+ * const filter = await createEventFilter(client, {
49
+ * address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
50
+ * event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
51
+ * })
52
+ * const logs = await getFilterLogs(client, { filter })
53
+ */
26
54
  export async function getFilterLogs<
27
55
  TChain extends Chain | undefined,
28
56
  TAbiEvent extends AbiEvent | undefined,
29
57
  TAbi extends Abi | readonly unknown[],
30
58
  TEventName extends string | undefined,
31
59
  >(
32
- client: PublicClient<Transport, TChain>,
60
+ _client: PublicClient<Transport, TChain>,
33
61
  { filter }: GetFilterLogsParameters<TAbiEvent, TAbi, TEventName>,
34
62
  ): Promise<GetFilterLogsReturnType<TAbiEvent, TAbi, TEventName>> {
35
- const logs = await client.request({
63
+ const logs = await filter.request({
36
64
  method: 'eth_getFilterLogs',
37
65
  params: [filter.id],
38
66
  })
@@ -8,7 +8,24 @@ import type { Account, Chain } from '../../types/index.js'
8
8
  export type GetGasPriceReturnType = bigint
9
9
 
10
10
  /**
11
- * @description Returns the current price of gas (in wei).
11
+ * Returns the current price of gas (in wei).
12
+ *
13
+ * - Docs: https://viem.sh/docs/actions/public/getGasPrice.html
14
+ * - JSON-RPC Methods: [`eth_gasPrice`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gasprice)
15
+ *
16
+ * @param client - Client to use
17
+ * @returns The gas price (in wei). {@link GetGasPriceReturnType}
18
+ *
19
+ * @example
20
+ * import { createPublicClient, http } from 'viem'
21
+ * import { mainnet } from 'viem/chains'
22
+ * import { getGasPrice } from 'viem/public'
23
+ *
24
+ * const client = createPublicClient({
25
+ * chain: mainnet,
26
+ * transport: http(),
27
+ * })
28
+ * const gasPrice = await getGasPrice(client)
12
29
  */
13
30
  export async function getGasPrice<
14
31
  TChain extends Chain | undefined,
@@ -1,4 +1,4 @@
1
- import type { AbiEvent } from 'abitype'
1
+ import type { AbiEvent, Narrow } from 'abitype'
2
2
  import type { PublicClient, Transport } from '../../clients/index.js'
3
3
  import type {
4
4
  Address,
@@ -28,7 +28,7 @@ export type GetLogsParameters<
28
28
  address?: Address | Address[]
29
29
  } & (
30
30
  | {
31
- event: TAbiEvent
31
+ event: Narrow<TAbiEvent>
32
32
  args?: MaybeExtractEventArgsFromAbi<[TAbiEvent], TEventName>
33
33
  }
34
34
  | {
@@ -58,7 +58,26 @@ export type GetLogsReturnType<
58
58
  > = Log<bigint, number, TAbiEvent, [TAbiEvent], TEventName>[]
59
59
 
60
60
  /**
61
- * @description Returns a collection of event logs.
61
+ * Returns a list of event logs matching the provided parameters.
62
+ *
63
+ * - Docs: https://viem.sh/docs/actions/public/getLogs.html
64
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/filters-and-logs/event-logs
65
+ * - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
66
+ *
67
+ * @param client - Client to use
68
+ * @param parameters - {@link GetLogsParameters}
69
+ * @returns A list of event logs. {@link GetLogsReturnType}
70
+ *
71
+ * @example
72
+ * import { createPublicClient, http, parseAbiItem } from 'viem'
73
+ * import { mainnet } from 'viem/chains'
74
+ * import { getLogs } from 'viem/public'
75
+ *
76
+ * const client = createPublicClient({
77
+ * chain: mainnet,
78
+ * transport: http(),
79
+ * })
80
+ * const logs = await getLogs(client)
62
81
  */
63
82
  export async function getLogs<
64
83
  TChain extends Chain | undefined,
@@ -78,7 +97,7 @@ export async function getLogs<
78
97
  if (event)
79
98
  topics = encodeEventTopics({
80
99
  abi: [event],
81
- eventName: event.name,
100
+ eventName: (event as AbiEvent).name,
82
101
  args,
83
102
  } as EncodeEventTopicsParameters)
84
103
 
@@ -18,6 +18,30 @@ export type GetStorageAtParameters = {
18
18
 
19
19
  export type GetStorageAtReturnType = Hex | undefined
20
20
 
21
+ /**
22
+ * Returns the value from a storage slot at a given address.
23
+ *
24
+ * - Docs: https://viem.sh/docs/contract/getStorageAt.html
25
+ * - JSON-RPC Methods: [`eth_getStorageAt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getstorageat)
26
+ *
27
+ * @param client - Client to use
28
+ * @param parameters - {@link GetStorageAtParameters}
29
+ * @returns The value of the storage slot. {@link GetStorageAtReturnType}
30
+ *
31
+ * @example
32
+ * import { createPublicClient, http } from 'viem'
33
+ * import { mainnet } from 'viem/chains'
34
+ * import { getStorageAt } from 'viem/contract'
35
+ *
36
+ * const client = createPublicClient({
37
+ * chain: mainnet,
38
+ * transport: http(),
39
+ * })
40
+ * const code = await getStorageAt(client, {
41
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
42
+ * slot: toHex(0),
43
+ * })
44
+ */
21
45
  export async function getStorageAt<TChain extends Chain | undefined>(
22
46
  client: PublicClient<Transport, TChain>,
23
47
  { address, blockNumber, blockTag = 'latest', slot }: GetStorageAtParameters,
@@ -53,7 +53,30 @@ export type GetTransactionParameters =
53
53
  export type GetTransactionReturnType<TChain extends Chain | undefined = Chain> =
54
54
  FormattedTransaction<TransactionFormatter<TChain>>
55
55
 
56
- /** @description Returns information about a transaction given a hash or block identifier. */
56
+ /**
57
+ * Returns information about a [Transaction](https://viem.sh/docs/glossary/terms#transaction) given a hash or block identifier.
58
+ *
59
+ * - Docs: https://viem.sh/docs/actions/public/getTransaction.html
60
+ * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions
61
+ * - JSON-RPC Methods: [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionByHash)
62
+ *
63
+ * @param client - Client to use
64
+ * @param parameters - {@link GetTransactionParameters}
65
+ * @returns The transaction information. {@link GetTransactionReturnType}
66
+ *
67
+ * @example
68
+ * import { createPublicClient, http } from 'viem'
69
+ * import { mainnet } from 'viem/chains'
70
+ * import { getTransaction } from 'viem/public'
71
+ *
72
+ * const client = createPublicClient({
73
+ * chain: mainnet,
74
+ * transport: http(),
75
+ * })
76
+ * const transaction = await getTransaction(client, {
77
+ * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
78
+ * })
79
+ */
57
80
  export async function getTransaction<TChain extends Chain | undefined>(
58
81
  client: PublicClient<Transport, TChain>,
59
82
  {
@@ -25,6 +25,30 @@ export type GetTransactionConfirmationsParameters<
25
25
 
26
26
  export type GetTransactionConfirmationsReturnType = bigint
27
27
 
28
+ /**
29
+ * Returns the number of blocks passed (confirmations) since the transaction was processed on a block.
30
+ *
31
+ * - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html
32
+ * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions
33
+ * - JSON-RPC Methods: [`eth_getTransactionConfirmations`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionConfirmations)
34
+ *
35
+ * @param client - Client to use
36
+ * @param parameters - {@link GetTransactionConfirmationsParameters}
37
+ * @returns The number of blocks passed since the transaction was processed. If confirmations is 0, then the Transaction has not been confirmed & processed yet. {@link GetTransactionConfirmationsReturnType}
38
+ *
39
+ * @example
40
+ * import { createPublicClient, http } from 'viem'
41
+ * import { mainnet } from 'viem/chains'
42
+ * import { getTransactionConfirmations } from 'viem/public'
43
+ *
44
+ * const client = createPublicClient({
45
+ * chain: mainnet,
46
+ * transport: http(),
47
+ * })
48
+ * const confirmations = await getTransactionConfirmations(client, {
49
+ * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
50
+ * })
51
+ */
28
52
  export async function getTransactionConfirmations<
29
53
  TChain extends Chain | undefined,
30
54
  >(
@@ -24,7 +24,27 @@ export type GetTransactionCountParameters = {
24
24
  export type GetTransactionCountReturnType = number
25
25
 
26
26
  /**
27
- * @description Returns the number of transactions an account has broadcast / sent.
27
+ * Returns the number of [Transactions](https://viem.sh/docs/glossary/terms#transaction) an Account has broadcast / sent.
28
+ *
29
+ * - Docs: https://viem.sh/docs/actions/public/getTransactionCount.html
30
+ * - JSON-RPC Methods: [`eth_getTransactionCount`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactioncount)
31
+ *
32
+ * @param client - Client to use
33
+ * @param parameters - {@link GetTransactionCountParameters}
34
+ * @returns The number of transactions an account has sent. {@link GetTransactionCountReturnType}
35
+ *
36
+ * @example
37
+ * import { createPublicClient, http } from 'viem'
38
+ * import { mainnet } from 'viem/chains'
39
+ * import { getTransactionCount } from 'viem/public'
40
+ *
41
+ * const client = createPublicClient({
42
+ * chain: mainnet,
43
+ * transport: http(),
44
+ * })
45
+ * const transactionCount = await getTransactionCount(client, {
46
+ * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
47
+ * })
28
48
  */
29
49
  export async function getTransactionCount<
30
50
  TChain extends Chain | undefined,