viem 0.3.0-main.20230410T055525 → 0.3.0-main.20230411T014628

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 (495) 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.map +1 -1
  36. package/dist/cjs/actions/public/createContractEventFilter.js.map +1 -1
  37. package/dist/cjs/actions/public/createEventFilter.js.map +1 -1
  38. package/dist/cjs/actions/public/createPendingTransactionFilter.js.map +1 -1
  39. package/dist/cjs/actions/public/estimateContractGas.js.map +1 -1
  40. package/dist/cjs/actions/public/estimateGas.js +0 -4
  41. package/dist/cjs/actions/public/estimateGas.js.map +1 -1
  42. package/dist/cjs/actions/public/getBalance.js +0 -3
  43. package/dist/cjs/actions/public/getBalance.js.map +1 -1
  44. package/dist/cjs/actions/public/getBlock.js.map +1 -1
  45. package/dist/cjs/actions/public/getBlockNumber.js +0 -3
  46. package/dist/cjs/actions/public/getBlockNumber.js.map +1 -1
  47. package/dist/cjs/actions/public/getBlockTransactionCount.js.map +1 -1
  48. package/dist/cjs/actions/public/getBytecode.js.map +1 -1
  49. package/dist/cjs/actions/public/getChainId.js.map +1 -1
  50. package/dist/cjs/actions/public/getFeeHistory.js +0 -3
  51. package/dist/cjs/actions/public/getFeeHistory.js.map +1 -1
  52. package/dist/cjs/actions/public/getFilterChanges.js +0 -1
  53. package/dist/cjs/actions/public/getFilterChanges.js.map +1 -1
  54. package/dist/cjs/actions/public/getFilterLogs.js +0 -1
  55. package/dist/cjs/actions/public/getFilterLogs.js.map +1 -1
  56. package/dist/cjs/actions/public/getGasPrice.js +0 -3
  57. package/dist/cjs/actions/public/getGasPrice.js.map +1 -1
  58. package/dist/cjs/actions/public/getLogs.js +0 -4
  59. package/dist/cjs/actions/public/getLogs.js.map +1 -1
  60. package/dist/cjs/actions/public/getStorageAt.js.map +1 -1
  61. package/dist/cjs/actions/public/getTransaction.js +0 -1
  62. package/dist/cjs/actions/public/getTransaction.js.map +1 -1
  63. package/dist/cjs/actions/public/getTransactionConfirmations.js.map +1 -1
  64. package/dist/cjs/actions/public/getTransactionCount.js +0 -3
  65. package/dist/cjs/actions/public/getTransactionCount.js.map +1 -1
  66. package/dist/cjs/actions/public/getTransactionReceipt.js.map +1 -1
  67. package/dist/cjs/actions/public/multicall.js +0 -1
  68. package/dist/cjs/actions/public/multicall.js.map +1 -1
  69. package/dist/cjs/actions/public/readContract.js.map +1 -1
  70. package/dist/cjs/actions/public/simulateContract.js.map +1 -1
  71. package/dist/cjs/actions/public/uninstallFilter.js.map +1 -1
  72. package/dist/cjs/actions/public/waitForTransactionReceipt.js +0 -11
  73. package/dist/cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  74. package/dist/cjs/actions/public/watchBlockNumber.js +0 -7
  75. package/dist/cjs/actions/public/watchBlockNumber.js.map +1 -1
  76. package/dist/cjs/actions/public/watchBlocks.js +1 -13
  77. package/dist/cjs/actions/public/watchBlocks.js.map +1 -1
  78. package/dist/cjs/actions/public/watchContractEvent.js +0 -6
  79. package/dist/cjs/actions/public/watchContractEvent.js.map +1 -1
  80. package/dist/cjs/actions/public/watchEvent.js +0 -6
  81. package/dist/cjs/actions/public/watchEvent.js.map +1 -1
  82. package/dist/cjs/actions/public/watchPendingTransactions.js.map +1 -1
  83. package/dist/cjs/actions/wallet/deployContract.js.map +1 -1
  84. package/dist/cjs/actions/wallet/sendTransaction.js +0 -2
  85. package/dist/cjs/actions/wallet/sendTransaction.js.map +1 -1
  86. package/dist/cjs/actions/wallet/signTypedData.js +0 -2
  87. package/dist/cjs/actions/wallet/signTypedData.js.map +1 -1
  88. package/dist/cjs/adapters/ethers.js +0 -5
  89. package/dist/cjs/adapters/ethers.js.map +1 -1
  90. package/dist/cjs/clients/createClient.js +0 -3
  91. package/dist/cjs/clients/createClient.js.map +1 -1
  92. package/dist/cjs/clients/createPublicClient.js +0 -3
  93. package/dist/cjs/clients/createPublicClient.js.map +1 -1
  94. package/dist/cjs/clients/createTestClient.js +0 -3
  95. package/dist/cjs/clients/createTestClient.js.map +1 -1
  96. package/dist/cjs/clients/createWalletClient.js +0 -3
  97. package/dist/cjs/clients/createWalletClient.js.map +1 -1
  98. package/dist/cjs/clients/decorators/public.js.map +1 -1
  99. package/dist/cjs/clients/decorators/wallet.js.map +1 -1
  100. package/dist/cjs/clients/transports/createTransport.js +0 -3
  101. package/dist/cjs/clients/transports/createTransport.js.map +1 -1
  102. package/dist/cjs/clients/transports/custom.js +0 -3
  103. package/dist/cjs/clients/transports/custom.js.map +1 -1
  104. package/dist/cjs/clients/transports/fallback.js +0 -11
  105. package/dist/cjs/clients/transports/fallback.js.map +1 -1
  106. package/dist/cjs/clients/transports/http.js +1 -6
  107. package/dist/cjs/clients/transports/http.js.map +1 -1
  108. package/dist/cjs/clients/transports/webSocket.js +1 -6
  109. package/dist/cjs/clients/transports/webSocket.js.map +1 -1
  110. package/dist/cjs/constants/abis.js +0 -1
  111. package/dist/cjs/constants/abis.js.map +1 -1
  112. package/dist/cjs/constants/solidity.js +0 -1
  113. package/dist/cjs/constants/solidity.js.map +1 -1
  114. package/dist/cjs/errors/node.js +0 -9
  115. package/dist/cjs/errors/node.js.map +1 -1
  116. package/dist/cjs/errors/version.js +1 -1
  117. package/dist/cjs/types/eip1193.js +0 -2
  118. package/dist/cjs/types/eip1193.js.map +1 -1
  119. package/dist/cjs/utils/abi/decodeAbiParameters.js +0 -29
  120. package/dist/cjs/utils/abi/decodeAbiParameters.js.map +1 -1
  121. package/dist/cjs/utils/abi/decodeEventLog.js +0 -2
  122. package/dist/cjs/utils/abi/decodeEventLog.js.map +1 -1
  123. package/dist/cjs/utils/abi/encodeAbiParameters.js +1 -10
  124. package/dist/cjs/utils/abi/encodeAbiParameters.js.map +1 -1
  125. package/dist/cjs/utils/abi/getAbiItem.js +0 -7
  126. package/dist/cjs/utils/abi/getAbiItem.js.map +1 -1
  127. package/dist/cjs/utils/accounts.js +0 -3
  128. package/dist/cjs/utils/accounts.js.map +1 -1
  129. package/dist/cjs/utils/buildRequest.js +0 -2
  130. package/dist/cjs/utils/buildRequest.js.map +1 -1
  131. package/dist/cjs/utils/data/size.js +0 -6
  132. package/dist/cjs/utils/data/size.js.map +1 -1
  133. package/dist/cjs/utils/data/slice.js +0 -21
  134. package/dist/cjs/utils/data/slice.js.map +1 -1
  135. package/dist/cjs/utils/encoding/fromBytes.js +0 -15
  136. package/dist/cjs/utils/encoding/fromBytes.js.map +1 -1
  137. package/dist/cjs/utils/encoding/fromHex.js +0 -15
  138. package/dist/cjs/utils/encoding/fromHex.js.map +1 -1
  139. package/dist/cjs/utils/encoding/toBytes.js +0 -13
  140. package/dist/cjs/utils/encoding/toBytes.js.map +1 -1
  141. package/dist/cjs/utils/encoding/toHex.js +0 -15
  142. package/dist/cjs/utils/encoding/toHex.js.map +1 -1
  143. package/dist/cjs/utils/ens/avatar/parseAvatarRecord.js +2 -6
  144. package/dist/cjs/utils/ens/avatar/parseAvatarRecord.js.map +1 -1
  145. package/dist/cjs/utils/ens/avatar/utils.js +0 -10
  146. package/dist/cjs/utils/ens/avatar/utils.js.map +1 -1
  147. package/dist/cjs/utils/ens/labelhash.js +0 -9
  148. package/dist/cjs/utils/ens/labelhash.js.map +1 -1
  149. package/dist/cjs/utils/ens/namehash.js +0 -12
  150. package/dist/cjs/utils/ens/namehash.js.map +1 -1
  151. package/dist/cjs/utils/ens/normalize.js +0 -10
  152. package/dist/cjs/utils/ens/normalize.js.map +1 -1
  153. package/dist/cjs/utils/ens/packetToBytes.js +0 -4
  154. package/dist/cjs/utils/ens/packetToBytes.js.map +1 -1
  155. package/dist/cjs/utils/formatters/block.js +0 -1
  156. package/dist/cjs/utils/formatters/block.js.map +1 -1
  157. package/dist/cjs/utils/formatters/extract.js +0 -3
  158. package/dist/cjs/utils/formatters/extract.js.map +1 -1
  159. package/dist/cjs/utils/formatters/format.js +0 -3
  160. package/dist/cjs/utils/formatters/format.js.map +1 -1
  161. package/dist/cjs/utils/observe.js +0 -5
  162. package/dist/cjs/utils/observe.js.map +1 -1
  163. package/dist/cjs/utils/poll.js +0 -3
  164. package/dist/cjs/utils/poll.js.map +1 -1
  165. package/dist/cjs/utils/promise/withCache.js +0 -13
  166. package/dist/cjs/utils/promise/withCache.js.map +1 -1
  167. package/dist/cjs/utils/regex.js +0 -4
  168. package/dist/cjs/utils/regex.js.map +1 -1
  169. package/dist/cjs/utils/rpc.js +0 -10
  170. package/dist/cjs/utils/rpc.js.map +1 -1
  171. package/dist/cjs/utils/signature/hashTypedData.js +0 -3
  172. package/dist/cjs/utils/signature/hashTypedData.js.map +1 -1
  173. package/dist/cjs/utils/signature/recoverAddress.js +0 -2
  174. package/dist/cjs/utils/signature/recoverAddress.js.map +1 -1
  175. package/dist/cjs/utils/transaction/prepareRequest.js +0 -4
  176. package/dist/cjs/utils/transaction/prepareRequest.js.map +1 -1
  177. package/dist/cjs/utils/transaction/serializeTransaction.js +2 -4
  178. package/dist/cjs/utils/transaction/serializeTransaction.js.map +1 -1
  179. package/dist/cjs/utils/typedData.js +0 -4
  180. package/dist/cjs/utils/typedData.js.map +1 -1
  181. package/dist/cjs/utils/unit/parseUnits.js +0 -2
  182. package/dist/cjs/utils/unit/parseUnits.js.map +1 -1
  183. package/dist/esm/accounts/generateMnemonic.js +0 -7
  184. package/dist/esm/accounts/generateMnemonic.js.map +1 -1
  185. package/dist/esm/accounts/generatePrivateKey.js +0 -5
  186. package/dist/esm/accounts/generatePrivateKey.js.map +1 -1
  187. package/dist/esm/accounts/hdKeyToAccount.js +0 -5
  188. package/dist/esm/accounts/hdKeyToAccount.js.map +1 -1
  189. package/dist/esm/accounts/mnemonicToAccount.js +0 -5
  190. package/dist/esm/accounts/mnemonicToAccount.js.map +1 -1
  191. package/dist/esm/accounts/privateKeyToAccount.js +0 -5
  192. package/dist/esm/accounts/privateKeyToAccount.js.map +1 -1
  193. package/dist/esm/accounts/toAccount.js +0 -5
  194. package/dist/esm/accounts/toAccount.js.map +1 -1
  195. package/dist/esm/accounts/utils/publicKeyToAddress.js +0 -7
  196. package/dist/esm/accounts/utils/publicKeyToAddress.js.map +1 -1
  197. package/dist/esm/accounts/utils/sign.js +0 -8
  198. package/dist/esm/accounts/utils/sign.js.map +1 -1
  199. package/dist/esm/accounts/utils/signMessage.js +0 -6
  200. package/dist/esm/accounts/utils/signMessage.js.map +1 -1
  201. package/dist/esm/accounts/utils/signTypedData.js +0 -6
  202. package/dist/esm/accounts/utils/signTypedData.js.map +1 -1
  203. package/dist/esm/actions/ens/getEnsAddress.js +0 -6
  204. package/dist/esm/actions/ens/getEnsAddress.js.map +1 -1
  205. package/dist/esm/actions/ens/getEnsAvatar.js +0 -3
  206. package/dist/esm/actions/ens/getEnsAvatar.js.map +1 -1
  207. package/dist/esm/actions/ens/getEnsName.js +0 -12
  208. package/dist/esm/actions/ens/getEnsName.js.map +1 -1
  209. package/dist/esm/actions/ens/getEnsResolver.js +0 -3
  210. package/dist/esm/actions/ens/getEnsResolver.js.map +1 -1
  211. package/dist/esm/actions/ens/getEnsText.js +0 -15
  212. package/dist/esm/actions/ens/getEnsText.js.map +1 -1
  213. package/dist/esm/actions/getContract.js +0 -14
  214. package/dist/esm/actions/getContract.js.map +1 -1
  215. package/dist/esm/actions/public/call.js +0 -1
  216. package/dist/esm/actions/public/call.js.map +1 -1
  217. package/dist/esm/actions/public/createBlockFilter.js.map +1 -1
  218. package/dist/esm/actions/public/createContractEventFilter.js.map +1 -1
  219. package/dist/esm/actions/public/createEventFilter.js.map +1 -1
  220. package/dist/esm/actions/public/createPendingTransactionFilter.js.map +1 -1
  221. package/dist/esm/actions/public/estimateContractGas.js.map +1 -1
  222. package/dist/esm/actions/public/estimateGas.js +0 -4
  223. package/dist/esm/actions/public/estimateGas.js.map +1 -1
  224. package/dist/esm/actions/public/getBalance.js +0 -3
  225. package/dist/esm/actions/public/getBalance.js.map +1 -1
  226. package/dist/esm/actions/public/getBlock.js.map +1 -1
  227. package/dist/esm/actions/public/getBlockNumber.js +0 -3
  228. package/dist/esm/actions/public/getBlockNumber.js.map +1 -1
  229. package/dist/esm/actions/public/getBlockTransactionCount.js.map +1 -1
  230. package/dist/esm/actions/public/getBytecode.js.map +1 -1
  231. package/dist/esm/actions/public/getChainId.js.map +1 -1
  232. package/dist/esm/actions/public/getFeeHistory.js +0 -3
  233. package/dist/esm/actions/public/getFeeHistory.js.map +1 -1
  234. package/dist/esm/actions/public/getFilterChanges.js +0 -1
  235. package/dist/esm/actions/public/getFilterChanges.js.map +1 -1
  236. package/dist/esm/actions/public/getFilterLogs.js +0 -1
  237. package/dist/esm/actions/public/getFilterLogs.js.map +1 -1
  238. package/dist/esm/actions/public/getGasPrice.js +0 -3
  239. package/dist/esm/actions/public/getGasPrice.js.map +1 -1
  240. package/dist/esm/actions/public/getLogs.js +0 -4
  241. package/dist/esm/actions/public/getLogs.js.map +1 -1
  242. package/dist/esm/actions/public/getStorageAt.js.map +1 -1
  243. package/dist/esm/actions/public/getTransaction.js +0 -1
  244. package/dist/esm/actions/public/getTransaction.js.map +1 -1
  245. package/dist/esm/actions/public/getTransactionConfirmations.js.map +1 -1
  246. package/dist/esm/actions/public/getTransactionCount.js +0 -3
  247. package/dist/esm/actions/public/getTransactionCount.js.map +1 -1
  248. package/dist/esm/actions/public/getTransactionReceipt.js.map +1 -1
  249. package/dist/esm/actions/public/multicall.js +0 -1
  250. package/dist/esm/actions/public/multicall.js.map +1 -1
  251. package/dist/esm/actions/public/readContract.js.map +1 -1
  252. package/dist/esm/actions/public/simulateContract.js.map +1 -1
  253. package/dist/esm/actions/public/uninstallFilter.js.map +1 -1
  254. package/dist/esm/actions/public/waitForTransactionReceipt.js +0 -11
  255. package/dist/esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  256. package/dist/esm/actions/public/watchBlockNumber.js +0 -7
  257. package/dist/esm/actions/public/watchBlockNumber.js.map +1 -1
  258. package/dist/esm/actions/public/watchBlocks.js +1 -13
  259. package/dist/esm/actions/public/watchBlocks.js.map +1 -1
  260. package/dist/esm/actions/public/watchContractEvent.js +0 -6
  261. package/dist/esm/actions/public/watchContractEvent.js.map +1 -1
  262. package/dist/esm/actions/public/watchEvent.js +0 -6
  263. package/dist/esm/actions/public/watchEvent.js.map +1 -1
  264. package/dist/esm/actions/public/watchPendingTransactions.js.map +1 -1
  265. package/dist/esm/actions/wallet/deployContract.js.map +1 -1
  266. package/dist/esm/actions/wallet/sendTransaction.js +0 -2
  267. package/dist/esm/actions/wallet/sendTransaction.js.map +1 -1
  268. package/dist/esm/actions/wallet/signTypedData.js +0 -2
  269. package/dist/esm/actions/wallet/signTypedData.js.map +1 -1
  270. package/dist/esm/adapters/ethers.js +0 -5
  271. package/dist/esm/adapters/ethers.js.map +1 -1
  272. package/dist/esm/clients/createClient.js +0 -3
  273. package/dist/esm/clients/createClient.js.map +1 -1
  274. package/dist/esm/clients/createPublicClient.js +0 -3
  275. package/dist/esm/clients/createPublicClient.js.map +1 -1
  276. package/dist/esm/clients/createTestClient.js +0 -3
  277. package/dist/esm/clients/createTestClient.js.map +1 -1
  278. package/dist/esm/clients/createWalletClient.js +0 -3
  279. package/dist/esm/clients/createWalletClient.js.map +1 -1
  280. package/dist/esm/clients/decorators/public.js.map +1 -1
  281. package/dist/esm/clients/decorators/wallet.js.map +1 -1
  282. package/dist/esm/clients/transports/createTransport.js +0 -3
  283. package/dist/esm/clients/transports/createTransport.js.map +1 -1
  284. package/dist/esm/clients/transports/custom.js +0 -3
  285. package/dist/esm/clients/transports/custom.js.map +1 -1
  286. package/dist/esm/clients/transports/fallback.js +0 -11
  287. package/dist/esm/clients/transports/fallback.js.map +1 -1
  288. package/dist/esm/clients/transports/http.js +1 -6
  289. package/dist/esm/clients/transports/http.js.map +1 -1
  290. package/dist/esm/clients/transports/webSocket.js +1 -6
  291. package/dist/esm/clients/transports/webSocket.js.map +1 -1
  292. package/dist/esm/constants/abis.js +0 -1
  293. package/dist/esm/constants/abis.js.map +1 -1
  294. package/dist/esm/constants/solidity.js +0 -1
  295. package/dist/esm/constants/solidity.js.map +1 -1
  296. package/dist/esm/errors/node.js +0 -9
  297. package/dist/esm/errors/node.js.map +1 -1
  298. package/dist/esm/errors/version.js +1 -1
  299. package/dist/esm/types/eip1193.js +0 -2
  300. package/dist/esm/types/eip1193.js.map +1 -1
  301. package/dist/esm/utils/abi/decodeAbiParameters.js +0 -29
  302. package/dist/esm/utils/abi/decodeAbiParameters.js.map +1 -1
  303. package/dist/esm/utils/abi/decodeEventLog.js +0 -2
  304. package/dist/esm/utils/abi/decodeEventLog.js.map +1 -1
  305. package/dist/esm/utils/abi/encodeAbiParameters.js +1 -10
  306. package/dist/esm/utils/abi/encodeAbiParameters.js.map +1 -1
  307. package/dist/esm/utils/abi/getAbiItem.js +0 -7
  308. package/dist/esm/utils/abi/getAbiItem.js.map +1 -1
  309. package/dist/esm/utils/accounts.js +0 -3
  310. package/dist/esm/utils/accounts.js.map +1 -1
  311. package/dist/esm/utils/buildRequest.js +0 -2
  312. package/dist/esm/utils/buildRequest.js.map +1 -1
  313. package/dist/esm/utils/data/size.js +0 -6
  314. package/dist/esm/utils/data/size.js.map +1 -1
  315. package/dist/esm/utils/data/slice.js +0 -21
  316. package/dist/esm/utils/data/slice.js.map +1 -1
  317. package/dist/esm/utils/encoding/fromBytes.js +0 -15
  318. package/dist/esm/utils/encoding/fromBytes.js.map +1 -1
  319. package/dist/esm/utils/encoding/fromHex.js +0 -15
  320. package/dist/esm/utils/encoding/fromHex.js.map +1 -1
  321. package/dist/esm/utils/encoding/toBytes.js +0 -13
  322. package/dist/esm/utils/encoding/toBytes.js.map +1 -1
  323. package/dist/esm/utils/encoding/toHex.js +0 -15
  324. package/dist/esm/utils/encoding/toHex.js.map +1 -1
  325. package/dist/esm/utils/ens/avatar/parseAvatarRecord.js +2 -6
  326. package/dist/esm/utils/ens/avatar/parseAvatarRecord.js.map +1 -1
  327. package/dist/esm/utils/ens/avatar/utils.js +0 -10
  328. package/dist/esm/utils/ens/avatar/utils.js.map +1 -1
  329. package/dist/esm/utils/ens/labelhash.js +0 -9
  330. package/dist/esm/utils/ens/labelhash.js.map +1 -1
  331. package/dist/esm/utils/ens/namehash.js +0 -12
  332. package/dist/esm/utils/ens/namehash.js.map +1 -1
  333. package/dist/esm/utils/ens/normalize.js +0 -10
  334. package/dist/esm/utils/ens/normalize.js.map +1 -1
  335. package/dist/esm/utils/ens/packetToBytes.js +0 -4
  336. package/dist/esm/utils/ens/packetToBytes.js.map +1 -1
  337. package/dist/esm/utils/formatters/block.js +0 -1
  338. package/dist/esm/utils/formatters/block.js.map +1 -1
  339. package/dist/esm/utils/formatters/extract.js +0 -3
  340. package/dist/esm/utils/formatters/extract.js.map +1 -1
  341. package/dist/esm/utils/formatters/format.js +0 -3
  342. package/dist/esm/utils/formatters/format.js.map +1 -1
  343. package/dist/esm/utils/observe.js +0 -5
  344. package/dist/esm/utils/observe.js.map +1 -1
  345. package/dist/esm/utils/poll.js +0 -3
  346. package/dist/esm/utils/poll.js.map +1 -1
  347. package/dist/esm/utils/promise/withCache.js +0 -13
  348. package/dist/esm/utils/promise/withCache.js.map +1 -1
  349. package/dist/esm/utils/regex.js +0 -4
  350. package/dist/esm/utils/regex.js.map +1 -1
  351. package/dist/esm/utils/rpc.js +0 -10
  352. package/dist/esm/utils/rpc.js.map +1 -1
  353. package/dist/esm/utils/signature/hashTypedData.js +0 -3
  354. package/dist/esm/utils/signature/hashTypedData.js.map +1 -1
  355. package/dist/esm/utils/signature/recoverAddress.js +0 -2
  356. package/dist/esm/utils/signature/recoverAddress.js.map +1 -1
  357. package/dist/esm/utils/transaction/prepareRequest.js +0 -4
  358. package/dist/esm/utils/transaction/prepareRequest.js.map +1 -1
  359. package/dist/esm/utils/transaction/serializeTransaction.js +2 -4
  360. package/dist/esm/utils/transaction/serializeTransaction.js.map +1 -1
  361. package/dist/esm/utils/typedData.js +0 -4
  362. package/dist/esm/utils/typedData.js.map +1 -1
  363. package/dist/esm/utils/unit/parseUnits.js +0 -2
  364. package/dist/esm/utils/unit/parseUnits.js.map +1 -1
  365. package/dist/types/actions/ens/getEnsAddress.d.ts +28 -5
  366. package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -1
  367. package/dist/types/actions/ens/getEnsAvatar.d.ts +28 -2
  368. package/dist/types/actions/ens/getEnsAvatar.d.ts.map +1 -1
  369. package/dist/types/actions/ens/getEnsName.d.ts +19 -3
  370. package/dist/types/actions/ens/getEnsName.d.ts.map +1 -1
  371. package/dist/types/actions/ens/getEnsResolver.d.ts +29 -3
  372. package/dist/types/actions/ens/getEnsResolver.d.ts.map +1 -1
  373. package/dist/types/actions/ens/getEnsText.d.ts +22 -7
  374. package/dist/types/actions/ens/getEnsText.d.ts.map +1 -1
  375. package/dist/types/actions/getContract.d.ts +42 -3
  376. package/dist/types/actions/getContract.d.ts.map +1 -1
  377. package/dist/types/actions/public/call.d.ts +29 -1
  378. package/dist/types/actions/public/call.d.ts.map +1 -1
  379. package/dist/types/actions/public/createBlockFilter.d.ts +21 -0
  380. package/dist/types/actions/public/createBlockFilter.d.ts.map +1 -1
  381. package/dist/types/actions/public/createContractEventFilter.d.ts +22 -0
  382. package/dist/types/actions/public/createContractEventFilter.d.ts.map +1 -1
  383. package/dist/types/actions/public/createEventFilter.d.ts +23 -0
  384. package/dist/types/actions/public/createEventFilter.d.ts.map +1 -1
  385. package/dist/types/actions/public/createPendingTransactionFilter.d.ts +21 -0
  386. package/dist/types/actions/public/createPendingTransactionFilter.d.ts.map +1 -1
  387. package/dist/types/actions/public/estimateContractGas.d.ts +28 -0
  388. package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -1
  389. package/dist/types/actions/public/estimateGas.d.ts +27 -2
  390. package/dist/types/actions/public/estimateGas.d.ts.map +1 -1
  391. package/dist/types/actions/public/getBalance.d.ts +34 -1
  392. package/dist/types/actions/public/getBalance.d.ts.map +1 -1
  393. package/dist/types/actions/public/getBlock.d.ts +28 -1
  394. package/dist/types/actions/public/getBlock.d.ts.map +1 -1
  395. package/dist/types/actions/public/getBlockNumber.d.ts +21 -1
  396. package/dist/types/actions/public/getBlockNumber.d.ts.map +1 -1
  397. package/dist/types/actions/public/getBlockTransactionCount.d.ts +23 -0
  398. package/dist/types/actions/public/getBlockTransactionCount.d.ts.map +1 -1
  399. package/dist/types/actions/public/getBytecode.d.ts +23 -0
  400. package/dist/types/actions/public/getBytecode.d.ts.map +1 -1
  401. package/dist/types/actions/public/getChainId.d.ts +21 -0
  402. package/dist/types/actions/public/getChainId.d.ts.map +1 -1
  403. package/dist/types/actions/public/getFeeHistory.d.ts +33 -1
  404. package/dist/types/actions/public/getFeeHistory.d.ts.map +1 -1
  405. package/dist/types/actions/public/getFilterChanges.d.ts +83 -0
  406. package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -1
  407. package/dist/types/actions/public/getFilterLogs.d.ts +28 -0
  408. package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -1
  409. package/dist/types/actions/public/getGasPrice.d.ts +18 -1
  410. package/dist/types/actions/public/getGasPrice.d.ts.map +1 -1
  411. package/dist/types/actions/public/getLogs.d.ts +20 -1
  412. package/dist/types/actions/public/getLogs.d.ts.map +1 -1
  413. package/dist/types/actions/public/getStorageAt.d.ts +24 -0
  414. package/dist/types/actions/public/getStorageAt.d.ts.map +1 -1
  415. package/dist/types/actions/public/getTransaction.d.ts +24 -1
  416. package/dist/types/actions/public/getTransaction.d.ts.map +1 -1
  417. package/dist/types/actions/public/getTransactionConfirmations.d.ts +24 -0
  418. package/dist/types/actions/public/getTransactionConfirmations.d.ts.map +1 -1
  419. package/dist/types/actions/public/getTransactionCount.d.ts +21 -1
  420. package/dist/types/actions/public/getTransactionCount.d.ts.map +1 -1
  421. package/dist/types/actions/public/getTransactionReceipt.d.ts +24 -0
  422. package/dist/types/actions/public/getTransactionReceipt.d.ts.map +1 -1
  423. package/dist/types/actions/public/multicall.d.ts +39 -0
  424. package/dist/types/actions/public/multicall.d.ts.map +1 -1
  425. package/dist/types/actions/public/readContract.d.ts +32 -0
  426. package/dist/types/actions/public/readContract.d.ts.map +1 -1
  427. package/dist/types/actions/public/simulateContract.d.ts +32 -0
  428. package/dist/types/actions/public/simulateContract.d.ts.map +1 -1
  429. package/dist/types/actions/public/uninstallFilter.d.ts +25 -0
  430. package/dist/types/actions/public/uninstallFilter.d.ts.map +1 -1
  431. package/dist/types/actions/public/waitForTransactionReceipt.d.ts +48 -2
  432. package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  433. package/dist/types/actions/public/watchBlockNumber.d.ts +25 -1
  434. package/dist/types/actions/public/watchBlockNumber.d.ts.map +1 -1
  435. package/dist/types/actions/public/watchBlocks.d.ts +23 -1
  436. package/dist/types/actions/public/watchBlocks.d.ts.map +1 -1
  437. package/dist/types/actions/public/watchContractEvent.d.ts +31 -0
  438. package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -1
  439. package/dist/types/actions/public/watchEvent.d.ts +37 -1
  440. package/dist/types/actions/public/watchEvent.d.ts.map +1 -1
  441. package/dist/types/actions/public/watchPendingTransactions.d.ts +46 -3
  442. package/dist/types/actions/public/watchPendingTransactions.d.ts.map +1 -1
  443. package/dist/types/actions/wallet/deployContract.d.ts +27 -0
  444. package/dist/types/actions/wallet/deployContract.d.ts.map +1 -1
  445. package/dist/types/clients/decorators/public.d.ts +996 -1
  446. package/dist/types/clients/decorators/public.d.ts.map +1 -1
  447. package/dist/types/clients/decorators/wallet.d.ts +25 -0
  448. package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
  449. package/dist/types/errors/version.d.ts +1 -1
  450. package/dist/types/types/eip1193.d.ts +1 -1
  451. package/package.json +1 -1
  452. package/src/actions/ens/getEnsAddress.ts +28 -5
  453. package/src/actions/ens/getEnsAvatar.ts +28 -2
  454. package/src/actions/ens/getEnsName.ts +19 -3
  455. package/src/actions/ens/getEnsResolver.ts +29 -3
  456. package/src/actions/ens/getEnsText.ts +22 -7
  457. package/src/actions/getContract.ts +42 -3
  458. package/src/actions/public/call.ts +29 -1
  459. package/src/actions/public/createBlockFilter.ts +21 -0
  460. package/src/actions/public/createContractEventFilter.ts +22 -0
  461. package/src/actions/public/createEventFilter.ts +23 -0
  462. package/src/actions/public/createPendingTransactionFilter.ts +21 -0
  463. package/src/actions/public/estimateContractGas.ts +28 -0
  464. package/src/actions/public/estimateGas.ts +27 -2
  465. package/src/actions/public/getBalance.ts +34 -1
  466. package/src/actions/public/getBlock.ts +28 -1
  467. package/src/actions/public/getBlockNumber.ts +21 -1
  468. package/src/actions/public/getBlockTransactionCount.ts +23 -0
  469. package/src/actions/public/getBytecode.ts +23 -0
  470. package/src/actions/public/getChainId.ts +21 -0
  471. package/src/actions/public/getFeeHistory.ts +33 -1
  472. package/src/actions/public/getFilterChanges.ts +83 -0
  473. package/src/actions/public/getFilterLogs.ts +28 -0
  474. package/src/actions/public/getGasPrice.ts +18 -1
  475. package/src/actions/public/getLogs.ts +20 -1
  476. package/src/actions/public/getStorageAt.ts +24 -0
  477. package/src/actions/public/getTransaction.ts +24 -1
  478. package/src/actions/public/getTransactionConfirmations.ts +24 -0
  479. package/src/actions/public/getTransactionCount.ts +21 -1
  480. package/src/actions/public/getTransactionReceipt.ts +24 -0
  481. package/src/actions/public/multicall.ts +39 -0
  482. package/src/actions/public/readContract.ts +32 -0
  483. package/src/actions/public/simulateContract.ts +32 -0
  484. package/src/actions/public/uninstallFilter.ts +25 -0
  485. package/src/actions/public/waitForTransactionReceipt.ts +48 -2
  486. package/src/actions/public/watchBlockNumber.ts +25 -1
  487. package/src/actions/public/watchBlocks.ts +23 -1
  488. package/src/actions/public/watchContractEvent.ts +31 -0
  489. package/src/actions/public/watchEvent.ts +37 -1
  490. package/src/actions/public/watchPendingTransactions.ts +49 -4
  491. package/src/actions/wallet/deployContract.ts +27 -0
  492. package/src/clients/decorators/public.ts +996 -1
  493. package/src/clients/decorators/wallet.ts +25 -0
  494. package/src/errors/version.ts +1 -1
  495. package/src/types/eip1193.ts +1 -1
@@ -130,8 +130,70 @@ export type PublicActions<
130
130
  TTransport extends Transport = Transport,
131
131
  TChain extends Chain | undefined = Chain | undefined,
132
132
  > = {
133
- call: (args: CallParameters<TChain>) => Promise<CallReturnType>
133
+ /**
134
+ * Executes a new message call immediately without submitting a transaction to the network.
135
+ *
136
+ * - Docs: https://viem.sh/docs/actions/public/call.html
137
+ * - JSON-RPC Methods: [`eth_call`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_call)
138
+ *
139
+ * @param parameters - {@link CallParameters}
140
+ * @returns The call data. {@link CallReturnType}
141
+ *
142
+ * @example
143
+ * import { createPublicClient, http } from 'viem'
144
+ * import { mainnet } from 'viem/chains'
145
+ *
146
+ * const client = createPublicClient({
147
+ * chain: mainnet,
148
+ * transport: http(),
149
+ * })
150
+ * const data = await client.call({
151
+ * account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
152
+ * data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
153
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
154
+ * })
155
+ */
156
+ call: (parameters: CallParameters<TChain>) => Promise<CallReturnType>
157
+ /**
158
+ * Creates a Filter to listen for new block hashes that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges).
159
+ *
160
+ * - Docs: https://viem.sh/docs/actions/public/createBlockFilter.html
161
+ * - JSON-RPC Methods: [`eth_newBlockFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newBlockFilter)
162
+ *
163
+ * @returns Filter. {@link CreateBlockFilterReturnType}
164
+ *
165
+ * @example
166
+ * import { createPublicClient, createBlockFilter, http } from 'viem'
167
+ * import { mainnet } from 'viem/chains'
168
+ *
169
+ * const client = createPublicClient({
170
+ * chain: mainnet,
171
+ * transport: http(),
172
+ * })
173
+ * const filter = await createBlockFilter(client)
174
+ * // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
175
+ */
134
176
  createBlockFilter: () => Promise<CreateBlockFilterReturnType>
177
+ /**
178
+ * Creates a Filter to retrieve event logs that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges) or [`getFilterLogs`](https://viem.sh/docs/actions/public/getFilterLogs).
179
+ *
180
+ * - Docs: https://viem.sh/docs/contract/createContractEventFilter.html
181
+ *
182
+ * @param parameters - {@link CreateContractEventFilterParameters}
183
+ * @returns [`Filter`](https://viem.sh/docs/glossary/types.html#filter). {@link CreateContractEventFilterReturnType}
184
+ *
185
+ * @example
186
+ * import { createPublicClient, http, parseAbi } from 'viem'
187
+ * import { mainnet } from 'viem/chains'
188
+ *
189
+ * const client = createPublicClient({
190
+ * chain: mainnet,
191
+ * transport: http(),
192
+ * })
193
+ * const filter = await client.createContractEventFilter({
194
+ * abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']),
195
+ * })
196
+ */
135
197
  createContractEventFilter: <
136
198
  TAbi extends Abi | readonly unknown[],
137
199
  TEventName extends string | undefined,
@@ -139,6 +201,27 @@ export type PublicActions<
139
201
  >(
140
202
  args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs>,
141
203
  ) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs>>
204
+ /**
205
+ * Creates a [`Filter`](https://viem.sh/docs/glossary/types.html#filter) to listen for new events that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges).
206
+ *
207
+ * - Docs: https://viem.sh/docs/actions/public/createEventFilter.html
208
+ * - JSON-RPC Methods: [`eth_newFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter)
209
+ *
210
+ * @param parameters - {@link CreateEventFilterParameters}
211
+ * @returns [`Filter`](https://viem.sh/docs/glossary/types.html#filter). {@link CreateEventFilterReturnType}
212
+ *
213
+ * @example
214
+ * import { createPublicClient, http } from 'viem'
215
+ * import { mainnet } from 'viem/chains'
216
+ *
217
+ * const client = createPublicClient({
218
+ * chain: mainnet,
219
+ * transport: http(),
220
+ * })
221
+ * const filter = await client.createEventFilter({
222
+ * address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2',
223
+ * })
224
+ */
142
225
  createEventFilter: <
143
226
  TAbiEvent extends AbiEvent | undefined,
144
227
  TAbi extends Abi | readonly unknown[],
@@ -147,7 +230,52 @@ export type PublicActions<
147
230
  >(
148
231
  args?: CreateEventFilterParameters<TAbiEvent, TAbi, TEventName, TArgs>,
149
232
  ) => Promise<CreateEventFilterReturnType<TAbiEvent, TAbi, TEventName, TArgs>>
233
+ /**
234
+ * Creates a Filter to listen for new pending transaction hashes that can be used with [`getFilterChanges`](https://viem.sh/docs/actions/public/getFilterChanges).
235
+ *
236
+ * - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter.html
237
+ * - JSON-RPC Methods: [`eth_newPendingTransactionFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newpendingtransactionfilter)
238
+ *
239
+ * @returns [`Filter`](https://viem.sh/docs/glossary/types.html#filter). {@link CreateBlockFilterReturnType}
240
+ *
241
+ * @example
242
+ * import { createPublicClient, http } from 'viem'
243
+ * import { mainnet } from 'viem/chains'
244
+ *
245
+ * const client = createPublicClient({
246
+ * chain: mainnet,
247
+ * transport: http(),
248
+ * })
249
+ * const filter = await client.createPendingTransactionFilter()
250
+ * // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
251
+ */
150
252
  createPendingTransactionFilter: () => Promise<CreatePendingTransactionFilterReturnType>
253
+ /**
254
+ * Estimates the gas required to successfully execute a contract write function call.
255
+ *
256
+ * - Docs: https://viem.sh/docs/contract/estimateContractGas.html
257
+ *
258
+ * @remarks
259
+ * Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`estimateGas` action](https://viem.sh/docs/actions/public/estimateGas) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
260
+ *
261
+ * @param parameters - {@link EstimateContractGasParameters}
262
+ * @returns The gas estimate (in wei). {@link EstimateContractGasReturnType}
263
+ *
264
+ * @example
265
+ * import { createPublicClient, http, parseAbi } from 'viem'
266
+ * import { mainnet } from 'viem/chains'
267
+ *
268
+ * const client = createPublicClient({
269
+ * chain: mainnet,
270
+ * transport: http(),
271
+ * })
272
+ * const gas = await client.estimateContractGas({
273
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
274
+ * abi: parseAbi(['function mint() public']),
275
+ * functionName: 'mint',
276
+ * account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
277
+ * })
278
+ */
151
279
  estimateContractGas: <
152
280
  TChain extends Chain | undefined,
153
281
  TAbi extends Abi | readonly unknown[],
@@ -155,33 +283,432 @@ export type PublicActions<
155
283
  >(
156
284
  args: EstimateContractGasParameters<TAbi, TFunctionName, TChain>,
157
285
  ) => Promise<EstimateContractGasReturnType>
286
+ /**
287
+ * Estimates the gas necessary to complete a transaction without submitting it to the network.
288
+ *
289
+ * - Docs: https://viem.sh/docs/actions/public/estimateGas.html
290
+ * - JSON-RPC Methods: [`eth_estimateGas`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_estimategas)
291
+ *
292
+ * @param parameters - {@link EstimateGasParameters}
293
+ * @returns The gas estimate (in wei). {@link EstimateGasReturnType}
294
+ *
295
+ * @example
296
+ * import { createPublicClient, http, parseEther } from 'viem'
297
+ * import { mainnet } from 'viem/chains'
298
+ *
299
+ * const client = createPublicClient({
300
+ * chain: mainnet,
301
+ * transport: http(),
302
+ * })
303
+ * const gasEstimate = await client.estimateGas({
304
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
305
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
306
+ * value: parseEther('1'),
307
+ * })
308
+ */
158
309
  estimateGas: (
159
310
  args: EstimateGasParameters<TChain>,
160
311
  ) => Promise<EstimateGasReturnType>
312
+ /**
313
+ * Returns the balance of an address in wei.
314
+ *
315
+ * - Docs: https://viem.sh/docs/actions/public/getBalance.html
316
+ * - JSON-RPC Methods: [`eth_getBalance`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance)
317
+ *
318
+ * @remarks
319
+ * You can convert the balance to ether units with [`formatEther`](https://viem.sh/docs/utilities/formatEther.html).
320
+ *
321
+ * ```ts
322
+ * const balance = await getBalance(client, {
323
+ * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
324
+ * blockTag: 'safe'
325
+ * })
326
+ * const balanceAsEther = formatEther(balance)
327
+ * // "6.942"
328
+ * ```
329
+ *
330
+ * @param parameters - {@link GetBalanceParameters}
331
+ * @returns The balance of the address in wei. {@link GetBalanceReturnType}
332
+ *
333
+ * @example
334
+ * import { createPublicClient, http } from 'viem'
335
+ * import { mainnet } from 'viem/chains'
336
+ *
337
+ * const client = createPublicClient({
338
+ * chain: mainnet,
339
+ * transport: http(),
340
+ * })
341
+ * const balance = await client.getBalance({
342
+ * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
343
+ * })
344
+ * // 10000000000000000000000n (wei)
345
+ */
161
346
  getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>
347
+ /**
348
+ * Returns information about a block at a block number, hash, or tag.
349
+ *
350
+ * - Docs: https://viem.sh/docs/actions/public/getBlock.html
351
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks
352
+ * - JSON-RPC Methods:
353
+ * - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) for `blockNumber` & `blockTag`.
354
+ * - Calls [`eth_getBlockByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash) for `blockHash`.
355
+ *
356
+ * @param parameters - {@link GetBlockParameters}
357
+ * @returns Information about the block. {@link GetBlockReturnType}
358
+ *
359
+ * @example
360
+ * import { createPublicClient, http } from 'viem'
361
+ * import { mainnet } from 'viem/chains'
362
+ *
363
+ * const client = createPublicClient({
364
+ * chain: mainnet,
365
+ * transport: http(),
366
+ * })
367
+ * const block = await client.getBlock()
368
+ */
162
369
  getBlock: (args?: GetBlockParameters) => Promise<GetBlockReturnType<TChain>>
370
+ /**
371
+ * Returns the number of the most recent block seen.
372
+ *
373
+ * - Docs: https://viem.sh/docs/actions/public/getBlockNumber.html
374
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/fetching-blocks
375
+ * - JSON-RPC Methods: [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber)
376
+ *
377
+ * @param parameters - {@link GetBlockNumberParameters}
378
+ * @returns The number of the block. {@link GetBlockNumberReturnType}
379
+ *
380
+ * @example
381
+ * import { createPublicClient, http } from 'viem'
382
+ * import { mainnet } from 'viem/chains'
383
+ *
384
+ * const client = createPublicClient({
385
+ * chain: mainnet,
386
+ * transport: http(),
387
+ * })
388
+ * const blockNumber = await client.getBlockNumber()
389
+ * // 69420n
390
+ */
163
391
  getBlockNumber: (
164
392
  args?: GetBlockNumberParameters,
165
393
  ) => Promise<GetBlockNumberReturnType>
394
+ /**
395
+ * Returns the number of Transactions at a block number, hash, or tag.
396
+ *
397
+ * - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount.html
398
+ * - JSON-RPC Methods:
399
+ * - Calls [`eth_getBlockTransactionCountByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbynumber) for `blockNumber` & `blockTag`.
400
+ * - Calls [`eth_getBlockTransactionCountByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbyhash) for `blockHash`.
401
+ *
402
+ * @param parameters - {@link GetBlockTransactionCountParameters}
403
+ * @returns The block transaction count. {@link GetBlockTransactionCountReturnType}
404
+ *
405
+ * @example
406
+ * import { createPublicClient, http } from 'viem'
407
+ * import { mainnet } from 'viem/chains'
408
+ *
409
+ * const client = createPublicClient({
410
+ * chain: mainnet,
411
+ * transport: http(),
412
+ * })
413
+ * const count = await client.getBlockTransactionCount()
414
+ */
166
415
  getBlockTransactionCount: (
167
416
  args?: GetBlockTransactionCountParameters,
168
417
  ) => Promise<GetBlockTransactionCountReturnType>
418
+ /**
419
+ * Retrieves the bytecode at an address.
420
+ *
421
+ * - Docs: https://viem.sh/docs/contract/getBytecode.html
422
+ * - JSON-RPC Methods: [`eth_getCode`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getcode)
423
+ *
424
+ * @param parameters - {@link GetBytecodeParameters}
425
+ * @returns The contract's bytecode. {@link GetBytecodeReturnType}
426
+ *
427
+ * @example
428
+ * import { createPublicClient, http } from 'viem'
429
+ * import { mainnet } from 'viem/chains'
430
+ *
431
+ * const client = createPublicClient({
432
+ * chain: mainnet,
433
+ * transport: http(),
434
+ * })
435
+ * const code = await client.getBytecode({
436
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
437
+ * })
438
+ */
169
439
  getBytecode: (args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>
440
+ /**
441
+ * Returns the chain ID associated with the current network.
442
+ *
443
+ * - Docs: https://viem.sh/docs/actions/public/getChainId.html
444
+ * - JSON-RPC Methods: [`eth_chainId`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_chainid)
445
+ *
446
+ * @returns The current chain ID. {@link GetChainIdReturnType}
447
+ *
448
+ * @example
449
+ * import { createPublicClient, http } from 'viem'
450
+ * import { mainnet } from 'viem/chains'
451
+ *
452
+ * const client = createPublicClient({
453
+ * chain: mainnet,
454
+ * transport: http(),
455
+ * })
456
+ * const chainId = await client.getChainId()
457
+ * // 1
458
+ */
170
459
  getChainId: () => Promise<GetChainIdReturnType>
460
+ /**
461
+ * Gets address for ENS name.
462
+ *
463
+ * - Docs: https://viem.sh/docs/ens/actions/getEnsAddress.html
464
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
465
+ *
466
+ * @remarks
467
+ * Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
468
+ *
469
+ * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.
470
+ *
471
+ * @param parameters - {@link GetEnsAddressParameters}
472
+ * @returns Address for ENS name or `null` if not found. {@link GetEnsAddressReturnType}
473
+ *
474
+ * @example
475
+ * import { createPublicClient, http } from 'viem'
476
+ * import { mainnet } from 'viem/chains'
477
+ * import { normalize } from 'viem/ens'
478
+ *
479
+ * const client = createPublicClient({
480
+ * chain: mainnet,
481
+ * transport: http(),
482
+ * })
483
+ * const ensAddress = await client.getEnsAddress({
484
+ * name: normalize('wagmi-dev.eth'),
485
+ * })
486
+ * // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
487
+ */
171
488
  getEnsAddress: (
172
489
  args: GetEnsAddressParameters,
173
490
  ) => Promise<GetEnsAddressReturnType>
491
+ /**
492
+ * Gets the avatar of an ENS name.
493
+ *
494
+ * - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar.html
495
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
496
+ *
497
+ * @remarks
498
+ * Calls [`getEnsText`](https://viem.sh/docs/ens/actions/getEnsText.html) with `key` set to `'avatar'`.
499
+ *
500
+ * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.
501
+ *
502
+ * @param parameters - {@link GetEnsAvatarParameters}
503
+ * @returns Avatar URI or `null` if not found. {@link GetEnsAvatarReturnType}
504
+ *
505
+ * @example
506
+ * import { createPublicClient, http } from 'viem'
507
+ * import { mainnet } from 'viem/chains'
508
+ * import { normalize } from 'viem/ens'
509
+ *
510
+ * const client = createPublicClient({
511
+ * chain: mainnet,
512
+ * transport: http(),
513
+ * })
514
+ * const ensAvatar = await client.getEnsAvatar({
515
+ * name: normalize('wagmi-dev.eth'),
516
+ * })
517
+ * // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
518
+ */
174
519
  getEnsAvatar: (
175
520
  args: GetEnsAvatarParameters,
176
521
  ) => Promise<GetEnsAvatarReturnType>
522
+ /**
523
+ * Gets primary name for specified address.
524
+ *
525
+ * - Docs: https://viem.sh/docs/ens/actions/getEnsName.html
526
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
527
+ *
528
+ * @remarks
529
+ * Calls `reverse(bytes)` on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name.
530
+ *
531
+ * @param parameters - {@link GetEnsNameParameters}
532
+ * @returns Name or `null` if not found. {@link GetEnsNameReturnType}
533
+ *
534
+ * @example
535
+ * import { createPublicClient, http } from 'viem'
536
+ * import { mainnet } from 'viem/chains'
537
+ *
538
+ * const client = createPublicClient({
539
+ * chain: mainnet,
540
+ * transport: http(),
541
+ * })
542
+ * const ensName = await client.getEnsName({
543
+ * address: '0xd2135CfB216b74109775236E36d4b433F1DF507B',
544
+ * })
545
+ * // 'wagmi-dev.eth'
546
+ */
177
547
  getEnsName: (args: GetEnsNameParameters) => Promise<GetEnsNameReturnType>
548
+ /**
549
+ * Gets resolver for ENS name.
550
+ *
551
+ * - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html
552
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
553
+ *
554
+ * @remarks
555
+ * Calls `findResolver(bytes)` on ENS Universal Resolver Contract to retrieve the resolver of an ENS name.
556
+ *
557
+ * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.
558
+ *
559
+ * @param parameters - {@link GetEnsResolverParameters}
560
+ * @returns Address for ENS resolver. {@link GetEnsResolverReturnType}
561
+ *
562
+ * @example
563
+ * import { createPublicClient, http } from 'viem'
564
+ * import { mainnet } from 'viem/chains'
565
+ * import { normalize } from 'viem/ens'
566
+ *
567
+ * const client = createPublicClient({
568
+ * chain: mainnet,
569
+ * transport: http(),
570
+ * })
571
+ * const resolverAddress = await client.getEnsResolver({
572
+ * name: normalize('wagmi-dev.eth'),
573
+ * })
574
+ * // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
575
+ */
178
576
  getEnsResolver: (
179
577
  args: GetEnsResolverParameters,
180
578
  ) => Promise<GetEnsResolverReturnType>
579
+ /**
580
+ * Gets a text record for specified ENS name.
581
+ *
582
+ * - Docs: https://viem.sh/docs/ens/actions/getEnsResolver.html
583
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/ens
584
+ *
585
+ * @remarks
586
+ * Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.
587
+ *
588
+ * Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.
589
+ *
590
+ * @param parameters - {@link GetEnsTextParameters}
591
+ * @returns Address for ENS resolver. {@link GetEnsTextReturnType}
592
+ *
593
+ * @example
594
+ * import { createPublicClient, http } from 'viem'
595
+ * import { mainnet } from 'viem/chains'
596
+ * import { normalize } from 'viem/ens'
597
+ *
598
+ * const client = createPublicClient({
599
+ * chain: mainnet,
600
+ * transport: http(),
601
+ * })
602
+ * const twitterRecord = await client.getEnsText({
603
+ * name: normalize('wagmi-dev.eth'),
604
+ * key: 'com.twitter',
605
+ * })
606
+ * // 'wagmi_sh'
607
+ */
181
608
  getEnsText: (args: GetEnsTextParameters) => Promise<GetEnsTextReturnType>
609
+ /**
610
+ * Returns a collection of historical gas information.
611
+ *
612
+ * - Docs: https://viem.sh/docs/actions/public/getFeeHistory.html
613
+ * - JSON-RPC Methods: [`eth_feeHistory`](https://docs.alchemy.com/reference/eth-feehistory)
614
+ *
615
+ * @param parameters - {@link GetFeeHistoryParameters}
616
+ * @returns The gas estimate (in wei). {@link GetFeeHistoryReturnType}
617
+ *
618
+ * @example
619
+ * import { createPublicClient, http } from 'viem'
620
+ * import { mainnet } from 'viem/chains'
621
+ *
622
+ * const client = createPublicClient({
623
+ * chain: mainnet,
624
+ * transport: http(),
625
+ * })
626
+ * const feeHistory = await client.getFeeHistory({
627
+ * blockCount: 4,
628
+ * rewardPercentiles: [25, 75],
629
+ * })
630
+ */
182
631
  getFeeHistory: (
183
632
  args: GetFeeHistoryParameters,
184
633
  ) => Promise<GetFeeHistoryReturnType>
634
+ /**
635
+ * Returns a list of logs or hashes based on a [Filter](/docs/glossary/terms#filter) since the last time it was called.
636
+ *
637
+ * - Docs: https://viem.sh/docs/actions/public/getFilterChanges.html
638
+ * - JSON-RPC Methods: [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges)
639
+ *
640
+ * @remarks
641
+ * A Filter can be created from the following actions:
642
+ *
643
+ * - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
644
+ * - [`createContractEventFilter`](https://viem.sh/docs/contract/createContractEventFilter)
645
+ * - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
646
+ * - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter)
647
+ *
648
+ * Depending on the type of filter, the return value will be different:
649
+ *
650
+ * - If the filter was created with `createContractEventFilter` or `createEventFilter`, it returns a list of logs.
651
+ * - If the filter was created with `createPendingTransactionFilter`, it returns a list of transaction hashes.
652
+ * - If the filter was created with `createBlockFilter`, it returns a list of block hashes.
653
+ *
654
+ * @param parameters - {@link GetFilterChangesParameters}
655
+ * @returns Logs or hashes. {@link GetFilterChangesReturnType}
656
+ *
657
+ * @example
658
+ * // Blocks
659
+ * import { createPublicClient, http } from 'viem'
660
+ * import { mainnet } from 'viem/chains'
661
+ *
662
+ * const client = createPublicClient({
663
+ * chain: mainnet,
664
+ * transport: http(),
665
+ * })
666
+ * const filter = await client.createBlockFilter()
667
+ * const hashes = await client.getFilterChanges({ filter })
668
+ *
669
+ * @example
670
+ * // Contract Events
671
+ * import { createPublicClient, http, parseAbi } from 'viem'
672
+ * import { mainnet } from 'viem/chains'
673
+ *
674
+ * const client = createPublicClient({
675
+ * chain: mainnet,
676
+ * transport: http(),
677
+ * })
678
+ * const filter = await client.createContractEventFilter({
679
+ * address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
680
+ * abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']),
681
+ * eventName: 'Transfer',
682
+ * })
683
+ * const logs = await client.getFilterChanges({ filter })
684
+ *
685
+ * @example
686
+ * // Raw Events
687
+ * import { createPublicClient, http, parseAbiItem } from 'viem'
688
+ * import { mainnet } from 'viem/chains'
689
+ *
690
+ * const client = createPublicClient({
691
+ * chain: mainnet,
692
+ * transport: http(),
693
+ * })
694
+ * const filter = await client.createEventFilter({
695
+ * address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
696
+ * event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
697
+ * })
698
+ * const logs = await client.getFilterChanges({ filter })
699
+ *
700
+ * @example
701
+ * // Transactions
702
+ * import { createPublicClient, http } from 'viem'
703
+ * import { mainnet } from 'viem/chains'
704
+ *
705
+ * const client = createPublicClient({
706
+ * chain: mainnet,
707
+ * transport: http(),
708
+ * })
709
+ * const filter = await client.createPendingTransactionFilter()
710
+ * const hashes = await client.getFilterChanges({ filter })
711
+ */
185
712
  getFilterChanges: <
186
713
  TFilterType extends FilterType,
187
714
  TAbiEvent extends AbiEvent | undefined,
@@ -192,6 +719,32 @@ export type PublicActions<
192
719
  ) => Promise<
193
720
  GetFilterChangesReturnType<TFilterType, TAbiEvent, TAbi, TEventName>
194
721
  >
722
+ /**
723
+ * Returns a list of event logs since the filter was created.
724
+ *
725
+ * - Docs: https://viem.sh/docs/actions/public/getFilterLogs.html
726
+ * - JSON-RPC Methods: [`eth_getFilterLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterlogs)
727
+ *
728
+ * @remarks
729
+ * `getFilterLogs` is only compatible with **event filters**.
730
+ *
731
+ * @param parameters - {@link GetFilterLogsParameters}
732
+ * @returns A list of event logs. {@link GetFilterLogsReturnType}
733
+ *
734
+ * @example
735
+ * import { createPublicClient, http, parseAbiItem } from 'viem'
736
+ * import { mainnet } from 'viem/chains'
737
+ *
738
+ * const client = createPublicClient({
739
+ * chain: mainnet,
740
+ * transport: http(),
741
+ * })
742
+ * const filter = await client.createEventFilter({
743
+ * address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
744
+ * event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
745
+ * })
746
+ * const logs = await client.getFilterLogs({ filter })
747
+ */
195
748
  getFilterLogs: <
196
749
  TAbiEvent extends AbiEvent | undefined,
197
750
  TAbi extends Abi | readonly unknown[],
@@ -199,37 +752,283 @@ export type PublicActions<
199
752
  >(
200
753
  args: GetFilterLogsParameters<TAbiEvent, TAbi, TEventName>,
201
754
  ) => Promise<GetFilterLogsReturnType<TAbiEvent, TAbi, TEventName>>
755
+ /**
756
+ * Returns the current price of gas (in wei).
757
+ *
758
+ * - Docs: https://viem.sh/docs/actions/public/getGasPrice.html
759
+ * - JSON-RPC Methods: [`eth_gasPrice`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gasprice)
760
+ *
761
+ * @returns The gas price (in wei). {@link GetGasPriceReturnType}
762
+ *
763
+ * @example
764
+ * import { createPublicClient, http } from 'viem'
765
+ * import { mainnet } from 'viem/chains'
766
+ *
767
+ * const client = createPublicClient({
768
+ * chain: mainnet,
769
+ * transport: http(),
770
+ * })
771
+ * const gasPrice = await client.getGasPrice()
772
+ */
202
773
  getGasPrice: () => Promise<GetGasPriceReturnType>
774
+ /**
775
+ * Returns a list of event logs matching the provided parameters.
776
+ *
777
+ * - Docs: https://viem.sh/docs/actions/public/getLogs.html
778
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/filters-and-logs/event-logs
779
+ * - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
780
+ *
781
+ * @param parameters - {@link GetLogsParameters}
782
+ * @returns A list of event logs. {@link GetLogsReturnType}
783
+ *
784
+ * @example
785
+ * import { createPublicClient, http, parseAbiItem } from 'viem'
786
+ * import { mainnet } from 'viem/chains'
787
+ *
788
+ * const client = createPublicClient({
789
+ * chain: mainnet,
790
+ * transport: http(),
791
+ * })
792
+ * const logs = await client.getLogs()
793
+ */
203
794
  getLogs: <TAbiEvent extends AbiEvent | undefined>(
204
795
  args?: GetLogsParameters<TAbiEvent>,
205
796
  ) => Promise<GetLogsReturnType<TAbiEvent>>
797
+ /**
798
+ * Returns the value from a storage slot at a given address.
799
+ *
800
+ * - Docs: https://viem.sh/docs/contract/getStorageAt.html
801
+ * - JSON-RPC Methods: [`eth_getStorageAt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getstorageat)
802
+ *
803
+ * @param parameters - {@link GetStorageAtParameters}
804
+ * @returns The value of the storage slot. {@link GetStorageAtReturnType}
805
+ *
806
+ * @example
807
+ * import { createPublicClient, http } from 'viem'
808
+ * import { mainnet } from 'viem/chains'
809
+ * import { getStorageAt } from 'viem/contract'
810
+ *
811
+ * const client = createPublicClient({
812
+ * chain: mainnet,
813
+ * transport: http(),
814
+ * })
815
+ * const code = await client.getStorageAt({
816
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
817
+ * slot: toHex(0),
818
+ * })
819
+ */
206
820
  getStorageAt: (
207
821
  args: GetStorageAtParameters,
208
822
  ) => Promise<GetStorageAtReturnType>
823
+ /**
824
+ * Returns information about a [Transaction](https://viem.sh/docs/glossary/terms#transaction) given a hash or block identifier.
825
+ *
826
+ * - Docs: https://viem.sh/docs/actions/public/getTransaction.html
827
+ * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions
828
+ * - JSON-RPC Methods: [`eth_getTransactionByHash`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionByHash)
829
+ *
830
+ * @param parameters - {@link GetTransactionParameters}
831
+ * @returns The transaction information. {@link GetTransactionReturnType}
832
+ *
833
+ * @example
834
+ * import { createPublicClient, http } from 'viem'
835
+ * import { mainnet } from 'viem/chains'
836
+ *
837
+ * const client = createPublicClient({
838
+ * chain: mainnet,
839
+ * transport: http(),
840
+ * })
841
+ * const transaction = await client.getTransaction({
842
+ * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
843
+ * })
844
+ */
209
845
  getTransaction: (
210
846
  args: GetTransactionParameters,
211
847
  ) => Promise<GetTransactionReturnType<TChain>>
848
+ /**
849
+ * Returns the number of blocks passed (confirmations) since the transaction was processed on a block.
850
+ *
851
+ * - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations.html
852
+ * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions
853
+ * - JSON-RPC Methods: [`eth_getTransactionConfirmations`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionConfirmations)
854
+ *
855
+ * @param parameters - {@link GetTransactionConfirmationsParameters}
856
+ * @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}
857
+ *
858
+ * @example
859
+ * import { createPublicClient, http } from 'viem'
860
+ * import { mainnet } from 'viem/chains'
861
+ *
862
+ * const client = createPublicClient({
863
+ * chain: mainnet,
864
+ * transport: http(),
865
+ * })
866
+ * const confirmations = await client.getTransactionConfirmations({
867
+ * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
868
+ * })
869
+ */
212
870
  getTransactionConfirmations: (
213
871
  args: GetTransactionConfirmationsParameters<TChain>,
214
872
  ) => Promise<GetTransactionConfirmationsReturnType>
873
+ /**
874
+ * Returns the number of [Transactions](https://viem.sh/docs/glossary/terms#transaction) an Account has broadcast / sent.
875
+ *
876
+ * - Docs: https://viem.sh/docs/actions/public/getTransactionCount.html
877
+ * - JSON-RPC Methods: [`eth_getTransactionCount`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactioncount)
878
+ *
879
+ * @param parameters - {@link GetTransactionCountParameters}
880
+ * @returns The number of transactions an account has sent. {@link GetTransactionCountReturnType}
881
+ *
882
+ * @example
883
+ * import { createPublicClient, http } from 'viem'
884
+ * import { mainnet } from 'viem/chains'
885
+ *
886
+ * const client = createPublicClient({
887
+ * chain: mainnet,
888
+ * transport: http(),
889
+ * })
890
+ * const transactionCount = await client.getTransactionCount({
891
+ * address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
892
+ * })
893
+ */
215
894
  getTransactionCount: (
216
895
  args: GetTransactionCountParameters,
217
896
  ) => Promise<GetTransactionCountReturnType>
897
+ /**
898
+ * Returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash.
899
+ *
900
+ * - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt.html
901
+ * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/fetching-transactions
902
+ * - JSON-RPC Methods: [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt)
903
+ *
904
+ * @param parameters - {@link GetTransactionReceiptParameters}
905
+ * @returns The transaction receipt. {@link GetTransactionReceiptReturnType}
906
+ *
907
+ * @example
908
+ * import { createPublicClient, http } from 'viem'
909
+ * import { mainnet } from 'viem/chains'
910
+ *
911
+ * const client = createPublicClient({
912
+ * chain: mainnet,
913
+ * transport: http(),
914
+ * })
915
+ * const transactionReceipt = await client.getTransactionReceipt({
916
+ * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
917
+ * })
918
+ */
218
919
  getTransactionReceipt: (
219
920
  args: GetTransactionReceiptParameters,
220
921
  ) => Promise<GetTransactionReceiptReturnType<TChain>>
922
+ /**
923
+ * Similar to [`readContract`](https://viem.sh/docs/contract/readContract), but batches up multiple functions on a contract in a single RPC call via the [`multicall3` contract](https://github.com/mds1/multicall).
924
+ *
925
+ * - Docs: https://viem.sh/docs/contract/multicall.html
926
+ *
927
+ * @param parameters - {@link MulticallParameters}
928
+ * @returns An array of results with accompanying status. {@link MulticallReturnType}
929
+ *
930
+ * @example
931
+ * import { createPublicClient, http, parseAbi } from 'viem'
932
+ * import { mainnet } from 'viem/chains'
933
+ *
934
+ * const client = createPublicClient({
935
+ * chain: mainnet,
936
+ * transport: http(),
937
+ * })
938
+ * const abi = parseAbi([
939
+ * 'function balanceOf(address) view returns (uint256)',
940
+ * 'function totalSupply() view returns (uint256)',
941
+ * ])
942
+ * const results = await client.multicall({
943
+ * contracts: [
944
+ * {
945
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
946
+ * abi,
947
+ * functionName: 'balanceOf',
948
+ * args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'],
949
+ * },
950
+ * {
951
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
952
+ * abi,
953
+ * functionName: 'totalSupply',
954
+ * },
955
+ * ],
956
+ * })
957
+ * // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
958
+ */
221
959
  multicall: <
222
960
  TContracts extends ContractFunctionConfig[],
223
961
  TAllowFailure extends boolean = true,
224
962
  >(
225
963
  args: MulticallParameters<TContracts, TAllowFailure>,
226
964
  ) => Promise<MulticallReturnType<TContracts, TAllowFailure>>
965
+ /**
966
+ * Calls a read-only function on a contract, and returns the response.
967
+ *
968
+ * - Docs: https://viem.sh/docs/contract/readContract.html
969
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts
970
+ *
971
+ * @remarks
972
+ * A "read-only" function (constant function) on a Solidity contract is denoted by a `view` or `pure` keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas.
973
+ *
974
+ * Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
975
+ *
976
+ * @param parameters - {@link ReadContractParameters}
977
+ * @returns The response from the contract. Type is inferred. {@link ReadContractReturnType}
978
+ *
979
+ * @example
980
+ * import { createPublicClient, http, parseAbi } from 'viem'
981
+ * import { mainnet } from 'viem/chains'
982
+ * import { readContract } from 'viem/contract'
983
+ *
984
+ * const client = createPublicClient({
985
+ * chain: mainnet,
986
+ * transport: http(),
987
+ * })
988
+ * const results = await client.readContract({
989
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
990
+ * abi: parseAbi(['function balanceOf(address) view returns (uint256)']),
991
+ * functionName: 'balanceOf',
992
+ * args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'],
993
+ * })
994
+ * // 424122n
995
+ */
227
996
  readContract: <
228
997
  TAbi extends Abi | readonly unknown[],
229
998
  TFunctionName extends string,
230
999
  >(
231
1000
  args: ReadContractParameters<TAbi, TFunctionName>,
232
1001
  ) => Promise<ReadContractReturnType<TAbi, TFunctionName>>
1002
+ /**
1003
+ * Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions.
1004
+ *
1005
+ * - Docs: https://viem.sh/docs/contract/simulateContract.html
1006
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
1007
+ *
1008
+ * @remarks
1009
+ * This function does not require gas to execute and _**does not**_ change the state of the blockchain. It is almost identical to [`readContract`](https://viem.sh/docs/contract/readContract), but also supports contract write functions.
1010
+ *
1011
+ * Internally, uses a [Public Client](https://viem.sh/docs/clients/public) to call the [`call` action](https://viem.sh/docs/actions/public/call) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData).
1012
+ *
1013
+ * @param parameters - {@link SimulateContractParameters}
1014
+ * @returns The simulation result and write request. {@link SimulateContractReturnType}
1015
+ *
1016
+ * @example
1017
+ * import { createPublicClient, http } from 'viem'
1018
+ * import { mainnet } from 'viem/chains'
1019
+ *
1020
+ * const client = createPublicClient({
1021
+ * chain: mainnet,
1022
+ * transport: http(),
1023
+ * })
1024
+ * const results = await client.simulateContract({
1025
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
1026
+ * abi: parseAbi(['function mint(uint32) view returns (uint32)']),
1027
+ * functionName: 'mint',
1028
+ * args: ['69420'],
1029
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
1030
+ * })
1031
+ */
233
1032
  simulateContract: <
234
1033
  TAbi extends Abi | readonly unknown[] = Abi,
235
1034
  TFunctionName extends string = any,
@@ -244,27 +1043,223 @@ export type PublicActions<
244
1043
  ) => Promise<
245
1044
  SimulateContractReturnType<TAbi, TFunctionName, TChain, TChainOverride>
246
1045
  >
1046
+ /**
1047
+ * Destroys a Filter that was created from one of the following Actions:
1048
+ *
1049
+ * - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
1050
+ * - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
1051
+ * - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter)
1052
+ *
1053
+ * - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html
1054
+ * - JSON-RPC Methods: [`eth_uninstallFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_uninstallFilter)
1055
+ *
1056
+ * @param parameters - {@link UninstallFilterParameters}
1057
+ * @returns A boolean indicating if the Filter was successfully uninstalled. {@link UninstallFilterReturnType}
1058
+ *
1059
+ * @example
1060
+ * import { createPublicClient, http } from 'viem'
1061
+ * import { mainnet } from 'viem/chains'
1062
+ * import { createPendingTransactionFilter, uninstallFilter } from 'viem/public'
1063
+ *
1064
+ * const filter = await client.createPendingTransactionFilter()
1065
+ * const uninstalled = await client.uninstallFilter({ filter })
1066
+ * // true
1067
+ */
247
1068
  uninstallFilter: (
248
1069
  args: UninstallFilterParameters,
249
1070
  ) => Promise<UninstallFilterReturnType>
1071
+ /**
1072
+ * Waits for the [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) to be included on a [Block](https://viem.sh/docs/glossary/terms.html#block) (one confirmation), and then returns the [Transaction Receipt](https://viem.sh/docs/glossary/terms.html#transaction-receipt). If the Transaction reverts, then the action will throw an error.
1073
+ *
1074
+ * - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html
1075
+ * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
1076
+ * - JSON-RPC Methods:
1077
+ * - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.
1078
+ * - If a Transaction has been replaced:
1079
+ * - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) and extracts the transactions
1080
+ * - Checks if one of the Transactions is a replacement
1081
+ * - If so, calls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt).
1082
+ *
1083
+ * @remarks
1084
+ * The `waitForTransactionReceipt` action additionally supports Replacement detection (e.g. sped up Transactions).
1085
+ *
1086
+ * Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce.
1087
+ *
1088
+ * There are 3 types of Transaction Replacement reasons:
1089
+ *
1090
+ * - `repriced`: The gas price has been modified (e.g. different `maxFeePerGas`)
1091
+ * - `cancelled`: The Transaction has been cancelled (e.g. `value === 0n`)
1092
+ * - `replaced`: The Transaction has been replaced (e.g. different `value` or `data`)
1093
+ *
1094
+ * @param parameters - {@link WaitForTransactionReceiptParameters}
1095
+ * @returns The transaction receipt. {@link WaitForTransactionReceiptReturnType}
1096
+ *
1097
+ * @example
1098
+ * import { createPublicClient, http } from 'viem'
1099
+ * import { mainnet } from 'viem/chains'
1100
+ *
1101
+ * const client = createPublicClient({
1102
+ * chain: mainnet,
1103
+ * transport: http(),
1104
+ * })
1105
+ * const transactionReceipt = await client.waitForTransactionReceipt({
1106
+ * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
1107
+ * })
1108
+ */
250
1109
  waitForTransactionReceipt: (
251
1110
  args: WaitForTransactionReceiptParameters<TChain>,
252
1111
  ) => Promise<WaitForTransactionReceiptReturnType<TChain>>
1112
+ /**
1113
+ * Watches and returns incoming block numbers.
1114
+ *
1115
+ * - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html
1116
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks
1117
+ * - JSON-RPC Methods:
1118
+ * - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.
1119
+ * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
1120
+ *
1121
+ * @param parameters - {@link WatchBlockNumberParameters}
1122
+ * @returns A function that can be invoked to stop watching for new block numbers. {@link WatchBlockNumberReturnType}
1123
+ *
1124
+ * @example
1125
+ * import { createPublicClient, http } from 'viem'
1126
+ * import { mainnet } from 'viem/chains'
1127
+ *
1128
+ * const client = createPublicClient({
1129
+ * chain: mainnet,
1130
+ * transport: http(),
1131
+ * })
1132
+ * const unwatch = await client.watchBlockNumber({
1133
+ * onBlockNumber: (blockNumber) => console.log(blockNumber),
1134
+ * })
1135
+ */
253
1136
  watchBlockNumber: (
254
1137
  args: WatchBlockNumberParameters,
255
1138
  ) => WatchBlockNumberReturnType
1139
+ /**
1140
+ * Watches and returns information for incoming blocks.
1141
+ *
1142
+ * - Docs: https://viem.sh/docs/actions/public/watchBlocks.html
1143
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks
1144
+ * - JSON-RPC Methods:
1145
+ * - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval.
1146
+ * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
1147
+ *
1148
+ * @param parameters - {@link WatchBlocksParameters}
1149
+ * @returns A function that can be invoked to stop watching for new block numbers. {@link WatchBlocksReturnType}
1150
+ *
1151
+ * @example
1152
+ * import { createPublicClient, http } from 'viem'
1153
+ * import { mainnet } from 'viem/chains'
1154
+ *
1155
+ * const client = createPublicClient({
1156
+ * chain: mainnet,
1157
+ * transport: http(),
1158
+ * })
1159
+ * const unwatch = await client.watchBlocks({
1160
+ * onBlock: (block) => console.log(block),
1161
+ * })
1162
+ */
256
1163
  watchBlocks: (
257
1164
  args: WatchBlocksParameters<TTransport, TChain>,
258
1165
  ) => WatchBlocksReturnType
1166
+ /**
1167
+ * Watches and returns emitted contract event logs.
1168
+ *
1169
+ * - Docs: https://viem.sh/docs/contract/watchContractEvent.html
1170
+ *
1171
+ * @remarks
1172
+ * This Action will batch up all the event logs found within the [`pollingInterval`](https://viem.sh/docs/contract/watchContractEvent.html#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/contract/watchContractEvent.html#onLogs).
1173
+ *
1174
+ * `watchContractEvent` will attempt to create an [Event Filter](https://viem.sh/docs/contract/createContractEventFilter) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchContractEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs) instead.
1175
+ *
1176
+ * @param parameters - {@link WatchContractEventParameters}
1177
+ * @returns A function that can be invoked to stop watching for new event logs. {@link WatchContractEventReturnType}
1178
+ *
1179
+ * @example
1180
+ * import { createPublicClient, http, parseAbi } from 'viem'
1181
+ * import { mainnet } from 'viem/chains'
1182
+ *
1183
+ * const client = createPublicClient({
1184
+ * chain: mainnet,
1185
+ * transport: http(),
1186
+ * })
1187
+ * const unwatch = client.watchContractEvent({
1188
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
1189
+ * abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']),
1190
+ * eventName: 'Transfer',
1191
+ * args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' },
1192
+ * onLogs: (logs) => console.log(logs),
1193
+ * })
1194
+ */
259
1195
  watchContractEvent: <
260
1196
  TAbi extends Abi | readonly unknown[],
261
1197
  TEventName extends string,
262
1198
  >(
263
1199
  args: WatchContractEventParameters<TAbi, TEventName>,
264
1200
  ) => WatchContractEventReturnType
1201
+ /**
1202
+ * Watches and returns emitted [Event Logs](https://viem.sh/docs/glossary/terms#event-log).
1203
+ *
1204
+ * - Docs: https://viem.sh/docs/actions/public/watchEvent.html
1205
+ * - JSON-RPC Methods:
1206
+ * - **RPC Provider supports `eth_newFilter`:**
1207
+ * - Calls [`eth_newFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter) to create a filter (called on initialize).
1208
+ * - On a polling interval, it will call [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges).
1209
+ * - **RPC Provider does not support `eth_newFilter`:**
1210
+ * - Calls [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) for each block between the polling interval.
1211
+ *
1212
+ * @remarks
1213
+ * This Action will batch up all the Event Logs found within the [`pollingInterval`](https://viem.sh/docs/actions/public/watchEvent.html#pollinginterval-optional), and invoke them via [`onLogs`](https://viem.sh/docs/actions/public/watchEvent.html#onLogs).
1214
+ *
1215
+ * `watchEvent` will attempt to create an [Event Filter](https://viem.sh/docs/actions/public/createEventFilter.html) and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. `eth_newFilter`), then `watchEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs) instead.
1216
+ *
1217
+ * @param parameters - {@link WatchEventParameters}
1218
+ * @returns A function that can be invoked to stop watching for new Event Logs. {@link WatchEventReturnType}
1219
+ *
1220
+ * @example
1221
+ * import { createPublicClient, http } from 'viem'
1222
+ * import { mainnet } from 'viem/chains'
1223
+ *
1224
+ * const client = createPublicClient({
1225
+ * chain: mainnet,
1226
+ * transport: http(),
1227
+ * })
1228
+ * const unwatch = client.watchEvent({
1229
+ * onLogs: (logs) => console.log(logs),
1230
+ * })
1231
+ */
265
1232
  watchEvent: <TAbiEvent extends AbiEvent | undefined>(
266
1233
  args: WatchEventParameters<TAbiEvent>,
267
1234
  ) => WatchEventReturnType
1235
+ /**
1236
+ * Watches and returns pending transaction hashes.
1237
+ *
1238
+ * - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions.html
1239
+ * - JSON-RPC Methods:
1240
+ * - When `poll: true`
1241
+ * - Calls [`eth_newPendingTransactionFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newpendingtransactionfilter) to initialize the filter.
1242
+ * - Calls [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getFilterChanges) on a polling interval.
1243
+ * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newPendingTransactions"` event.
1244
+ *
1245
+ * @remarks
1246
+ * This Action will batch up all the pending transactions found within the [`pollingInterval`](https://viem.sh/docs/actions/public/watchPendingTransactions.html#pollinginterval-optional), and invoke them via [`onTransactions`](https://viem.sh/docs/actions/public/watchPendingTransactions.html#ontransactions).
1247
+ *
1248
+ * @param parameters - {@link WatchPendingTransactionsParameters}
1249
+ * @returns A function that can be invoked to stop watching for new pending transaction hashes. {@link WatchPendingTransactionsReturnType}
1250
+ *
1251
+ * @example
1252
+ * import { createPublicClient, http } from 'viem'
1253
+ * import { mainnet } from 'viem/chains'
1254
+ *
1255
+ * const client = createPublicClient({
1256
+ * chain: mainnet,
1257
+ * transport: http(),
1258
+ * })
1259
+ * const unwatch = await client.watchPendingTransactions({
1260
+ * onTransactions: (hashes) => console.log(hashes),
1261
+ * })
1262
+ */
268
1263
  watchPendingTransactions: (
269
1264
  args: WatchPendingTransactionsParameters<TTransport>,
270
1265
  ) => WatchPendingTransactionsReturnType