viem 0.3.5 → 0.4.0-jxom-multicall-chunk-size.20230420T212142

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 (589) hide show
  1. package/dist/cjs/actions/public/multicall.js +33 -16
  2. package/dist/cjs/actions/public/multicall.js.map +1 -1
  3. package/dist/cjs/errors/version.js +1 -1
  4. package/dist/cjs/errors/version.js.map +1 -1
  5. package/dist/esm/actions/public/multicall.js +33 -16
  6. package/dist/esm/actions/public/multicall.js.map +1 -1
  7. package/dist/esm/errors/version.js +1 -1
  8. package/dist/esm/errors/version.js.map +1 -1
  9. package/dist/types/abi.d.ts +3 -0
  10. package/dist/types/abi.d.ts.map +1 -0
  11. package/dist/types/accounts/generateMnemonic.d.ts +9 -0
  12. package/dist/types/accounts/generateMnemonic.d.ts.map +1 -0
  13. package/dist/types/accounts/generatePrivateKey.d.ts +8 -0
  14. package/dist/types/accounts/generatePrivateKey.d.ts.map +1 -0
  15. package/dist/types/accounts/hdKeyToAccount.d.ts +9 -0
  16. package/dist/types/accounts/hdKeyToAccount.d.ts.map +1 -0
  17. package/dist/types/accounts/index.d.ts +21 -0
  18. package/dist/types/accounts/index.d.ts.map +1 -0
  19. package/dist/types/accounts/mnemonicToAccount.d.ts +8 -0
  20. package/dist/types/accounts/mnemonicToAccount.d.ts.map +1 -0
  21. package/dist/types/accounts/privateKeyToAccount.d.ts +9 -0
  22. package/dist/types/accounts/privateKeyToAccount.d.ts.map +1 -0
  23. package/dist/types/accounts/toAccount.d.ts +11 -0
  24. package/dist/types/accounts/toAccount.d.ts.map +1 -0
  25. package/dist/types/accounts/types.d.ts +45 -0
  26. package/dist/types/accounts/types.d.ts.map +1 -0
  27. package/dist/types/accounts/utils/index.d.ts +10 -0
  28. package/dist/types/accounts/utils/index.d.ts.map +1 -0
  29. package/dist/types/accounts/utils/parseAccount.d.ts +4 -0
  30. package/dist/types/accounts/utils/parseAccount.d.ts.map +1 -0
  31. package/dist/types/accounts/utils/publicKeyToAddress.d.ts +10 -0
  32. package/dist/types/accounts/utils/publicKeyToAddress.d.ts.map +1 -0
  33. package/dist/types/accounts/utils/sign.d.ts +16 -0
  34. package/dist/types/accounts/utils/sign.d.ts.map +1 -0
  35. package/dist/types/accounts/utils/signMessage.d.ts +16 -0
  36. package/dist/types/accounts/utils/signMessage.d.ts.map +1 -0
  37. package/dist/types/accounts/utils/signTransaction.d.ts +9 -0
  38. package/dist/types/accounts/utils/signTransaction.d.ts.map +1 -0
  39. package/dist/types/accounts/utils/signTypedData.d.ts +19 -0
  40. package/dist/types/accounts/utils/signTypedData.d.ts.map +1 -0
  41. package/dist/types/accounts/utils/signatureToHex.d.ts +3 -0
  42. package/dist/types/accounts/utils/signatureToHex.d.ts.map +1 -0
  43. package/dist/types/accounts/wordlists/czech.d.ts +2 -0
  44. package/dist/types/accounts/wordlists/czech.d.ts.map +1 -0
  45. package/dist/types/accounts/wordlists/english.d.ts +2 -0
  46. package/dist/types/accounts/wordlists/english.d.ts.map +1 -0
  47. package/dist/types/accounts/wordlists/french.d.ts +2 -0
  48. package/dist/types/accounts/wordlists/french.d.ts.map +1 -0
  49. package/dist/types/accounts/wordlists/italian.d.ts +2 -0
  50. package/dist/types/accounts/wordlists/italian.d.ts.map +1 -0
  51. package/dist/types/accounts/wordlists/japanese.d.ts +2 -0
  52. package/dist/types/accounts/wordlists/japanese.d.ts.map +1 -0
  53. package/dist/types/accounts/wordlists/korean.d.ts +2 -0
  54. package/dist/types/accounts/wordlists/korean.d.ts.map +1 -0
  55. package/dist/types/accounts/wordlists/simplifiedChinese.d.ts +2 -0
  56. package/dist/types/accounts/wordlists/simplifiedChinese.d.ts.map +1 -0
  57. package/dist/types/accounts/wordlists/spanish.d.ts +2 -0
  58. package/dist/types/accounts/wordlists/spanish.d.ts.map +1 -0
  59. package/dist/types/accounts/wordlists/traditionalChinese.d.ts +2 -0
  60. package/dist/types/accounts/wordlists/traditionalChinese.d.ts.map +1 -0
  61. package/dist/types/actions/ens/getEnsAddress.d.ts +40 -0
  62. package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -0
  63. package/dist/types/actions/ens/getEnsAvatar.d.ts +38 -0
  64. package/dist/types/actions/ens/getEnsAvatar.d.ts.map +1 -0
  65. package/dist/types/actions/ens/getEnsName.d.ts +38 -0
  66. package/dist/types/actions/ens/getEnsName.d.ts.map +1 -0
  67. package/dist/types/actions/ens/getEnsResolver.d.ts +40 -0
  68. package/dist/types/actions/ens/getEnsResolver.d.ts.map +1 -0
  69. package/dist/types/actions/ens/getEnsText.d.ts +43 -0
  70. package/dist/types/actions/ens/getEnsText.d.ts.map +1 -0
  71. package/dist/types/actions/ens/index.d.ts +6 -0
  72. package/dist/types/actions/ens/index.d.ts.map +1 -0
  73. package/dist/types/actions/getContract.d.ts +261 -0
  74. package/dist/types/actions/getContract.d.ts.map +1 -0
  75. package/dist/types/actions/index.d.ts +11 -0
  76. package/dist/types/actions/index.d.ts.map +1 -0
  77. package/dist/types/actions/public/call.d.ts +49 -0
  78. package/dist/types/actions/public/call.d.ts.map +1 -0
  79. package/dist/types/actions/public/createBlockFilter.d.ts +26 -0
  80. package/dist/types/actions/public/createBlockFilter.d.ts.map +1 -0
  81. package/dist/types/actions/public/createContractEventFilter.d.ts +41 -0
  82. package/dist/types/actions/public/createContractEventFilter.d.ts.map +1 -0
  83. package/dist/types/actions/public/createEventFilter.d.ts +46 -0
  84. package/dist/types/actions/public/createEventFilter.d.ts.map +1 -0
  85. package/dist/types/actions/public/createPendingTransactionFilter.d.ts +26 -0
  86. package/dist/types/actions/public/createPendingTransactionFilter.d.ts.map +1 -0
  87. package/dist/types/actions/public/estimateContractGas.d.ts +35 -0
  88. package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -0
  89. package/dist/types/actions/public/estimateGas.d.ts +45 -0
  90. package/dist/types/actions/public/estimateGas.d.ts.map +1 -0
  91. package/dist/types/actions/public/getBalance.d.ts +52 -0
  92. package/dist/types/actions/public/getBalance.d.ts.map +1 -0
  93. package/dist/types/actions/public/getBlock.d.ts +52 -0
  94. package/dist/types/actions/public/getBlock.d.ts.map +1 -0
  95. package/dist/types/actions/public/getBlockNumber.d.ts +54 -0
  96. package/dist/types/actions/public/getBlockNumber.d.ts.map +1 -0
  97. package/dist/types/actions/public/getBlockTransactionCount.d.ts +44 -0
  98. package/dist/types/actions/public/getBlockTransactionCount.d.ts.map +1 -0
  99. package/dist/types/actions/public/getBytecode.d.ts +37 -0
  100. package/dist/types/actions/public/getBytecode.d.ts.map +1 -0
  101. package/dist/types/actions/public/getChainId.d.ts +26 -0
  102. package/dist/types/actions/public/getChainId.d.ts.map +1 -0
  103. package/dist/types/actions/public/getFeeHistory.d.ts +50 -0
  104. package/dist/types/actions/public/getFeeHistory.d.ts.map +1 -0
  105. package/dist/types/actions/public/getFilterChanges.d.ts +91 -0
  106. package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -0
  107. package/dist/types/actions/public/getFilterLogs.d.ts +36 -0
  108. package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -0
  109. package/dist/types/actions/public/getGasPrice.d.ts +25 -0
  110. package/dist/types/actions/public/getGasPrice.d.ts.map +1 -0
  111. package/dist/types/actions/public/getLogs.d.ts +49 -0
  112. package/dist/types/actions/public/getLogs.d.ts.map +1 -0
  113. package/dist/types/actions/public/getStorageAt.d.ts +39 -0
  114. package/dist/types/actions/public/getStorageAt.d.ts.map +1 -0
  115. package/dist/types/actions/public/getTransaction.d.ts +62 -0
  116. package/dist/types/actions/public/getTransaction.d.ts.map +1 -0
  117. package/dist/types/actions/public/getTransactionConfirmations.d.ts +39 -0
  118. package/dist/types/actions/public/getTransactionConfirmations.d.ts.map +1 -0
  119. package/dist/types/actions/public/getTransactionCount.d.ts +40 -0
  120. package/dist/types/actions/public/getTransactionCount.d.ts.map +1 -0
  121. package/dist/types/actions/public/getTransactionReceipt.d.ts +34 -0
  122. package/dist/types/actions/public/getTransactionReceipt.d.ts.map +1 -0
  123. package/dist/types/actions/public/index.d.ts +67 -0
  124. package/dist/types/actions/public/index.d.ts.map +1 -0
  125. package/dist/types/actions/public/multicall.d.ts +53 -0
  126. package/dist/types/actions/public/multicall.d.ts.map +1 -0
  127. package/dist/types/actions/public/readContract.d.ts +39 -0
  128. package/dist/types/actions/public/readContract.d.ts.map +1 -0
  129. package/dist/types/actions/public/simulateContract.d.ts +47 -0
  130. package/dist/types/actions/public/simulateContract.d.ts.map +1 -0
  131. package/dist/types/actions/public/uninstallFilter.d.ts +32 -0
  132. package/dist/types/actions/public/uninstallFilter.d.ts.map +1 -0
  133. package/dist/types/actions/public/waitForTransactionReceipt.d.ts +69 -0
  134. package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -0
  135. package/dist/types/actions/public/watchBlockNumber.d.ts +57 -0
  136. package/dist/types/actions/public/watchBlockNumber.d.ts.map +1 -0
  137. package/dist/types/actions/public/watchBlocks.d.ts +64 -0
  138. package/dist/types/actions/public/watchBlocks.d.ts.map +1 -0
  139. package/dist/types/actions/public/watchContractEvent.d.ts +55 -0
  140. package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -0
  141. package/dist/types/actions/public/watchEvent.d.ts +61 -0
  142. package/dist/types/actions/public/watchEvent.d.ts.map +1 -0
  143. package/dist/types/actions/public/watchPendingTransactions.d.ts +71 -0
  144. package/dist/types/actions/public/watchPendingTransactions.d.ts.map +1 -0
  145. package/dist/types/actions/test/dropTransaction.d.ts +30 -0
  146. package/dist/types/actions/test/dropTransaction.d.ts.map +1 -0
  147. package/dist/types/actions/test/getAutomine.d.ts +25 -0
  148. package/dist/types/actions/test/getAutomine.d.ts.map +1 -0
  149. package/dist/types/actions/test/getTxpoolContent.d.ts +31 -0
  150. package/dist/types/actions/test/getTxpoolContent.d.ts.map +1 -0
  151. package/dist/types/actions/test/getTxpoolStatus.d.ts +28 -0
  152. package/dist/types/actions/test/getTxpoolStatus.d.ts.map +1 -0
  153. package/dist/types/actions/test/impersonateAccount.d.ts +30 -0
  154. package/dist/types/actions/test/impersonateAccount.d.ts.map +1 -0
  155. package/dist/types/actions/test/increaseTime.d.ts +30 -0
  156. package/dist/types/actions/test/increaseTime.d.ts.map +1 -0
  157. package/dist/types/actions/test/index.d.ts +52 -0
  158. package/dist/types/actions/test/index.d.ts.map +1 -0
  159. package/dist/types/actions/test/inspectTxpool.d.ts +28 -0
  160. package/dist/types/actions/test/inspectTxpool.d.ts.map +1 -0
  161. package/dist/types/actions/test/mine.d.ts +30 -0
  162. package/dist/types/actions/test/mine.d.ts.map +1 -0
  163. package/dist/types/actions/test/removeBlockTimestampInterval.d.ts +23 -0
  164. package/dist/types/actions/test/removeBlockTimestampInterval.d.ts.map +1 -0
  165. package/dist/types/actions/test/reset.d.ts +30 -0
  166. package/dist/types/actions/test/reset.d.ts.map +1 -0
  167. package/dist/types/actions/test/revert.d.ts +28 -0
  168. package/dist/types/actions/test/revert.d.ts.map +1 -0
  169. package/dist/types/actions/test/sendUnsignedTransaction.d.ts +31 -0
  170. package/dist/types/actions/test/sendUnsignedTransaction.d.ts.map +1 -0
  171. package/dist/types/actions/test/setAutomine.d.ts +23 -0
  172. package/dist/types/actions/test/setAutomine.d.ts.map +1 -0
  173. package/dist/types/actions/test/setBalance.d.ts +33 -0
  174. package/dist/types/actions/test/setBalance.d.ts.map +1 -0
  175. package/dist/types/actions/test/setBlockGasLimit.d.ts +28 -0
  176. package/dist/types/actions/test/setBlockGasLimit.d.ts.map +1 -0
  177. package/dist/types/actions/test/setBlockTimestampInterval.d.ts +28 -0
  178. package/dist/types/actions/test/setBlockTimestampInterval.d.ts.map +1 -0
  179. package/dist/types/actions/test/setCode.d.ts +33 -0
  180. package/dist/types/actions/test/setCode.d.ts.map +1 -0
  181. package/dist/types/actions/test/setCoinbase.d.ts +30 -0
  182. package/dist/types/actions/test/setCoinbase.d.ts.map +1 -0
  183. package/dist/types/actions/test/setIntervalMining.d.ts +28 -0
  184. package/dist/types/actions/test/setIntervalMining.d.ts.map +1 -0
  185. package/dist/types/actions/test/setLoggingEnabled.d.ts +23 -0
  186. package/dist/types/actions/test/setLoggingEnabled.d.ts.map +1 -0
  187. package/dist/types/actions/test/setMinGasPrice.d.ts +32 -0
  188. package/dist/types/actions/test/setMinGasPrice.d.ts.map +1 -0
  189. package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts +30 -0
  190. package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts.map +1 -0
  191. package/dist/types/actions/test/setNextBlockTimestamp.d.ts +28 -0
  192. package/dist/types/actions/test/setNextBlockTimestamp.d.ts.map +1 -0
  193. package/dist/types/actions/test/setNonce.d.ts +33 -0
  194. package/dist/types/actions/test/setNonce.d.ts.map +1 -0
  195. package/dist/types/actions/test/setRpcUrl.d.ts +24 -0
  196. package/dist/types/actions/test/setRpcUrl.d.ts.map +1 -0
  197. package/dist/types/actions/test/setStorageAt.d.ts +36 -0
  198. package/dist/types/actions/test/setStorageAt.d.ts.map +1 -0
  199. package/dist/types/actions/test/snapshot.d.ts +23 -0
  200. package/dist/types/actions/test/snapshot.d.ts.map +1 -0
  201. package/dist/types/actions/test/stopImpersonatingAccount.d.ts +30 -0
  202. package/dist/types/actions/test/stopImpersonatingAccount.d.ts.map +1 -0
  203. package/dist/types/actions/wallet/addChain.d.ts +27 -0
  204. package/dist/types/actions/wallet/addChain.d.ts.map +1 -0
  205. package/dist/types/actions/wallet/deployContract.d.ts +38 -0
  206. package/dist/types/actions/wallet/deployContract.d.ts.map +1 -0
  207. package/dist/types/actions/wallet/getAddresses.d.ts +26 -0
  208. package/dist/types/actions/wallet/getAddresses.d.ts.map +1 -0
  209. package/dist/types/actions/wallet/getPermissions.d.ts +26 -0
  210. package/dist/types/actions/wallet/getPermissions.d.ts.map +1 -0
  211. package/dist/types/actions/wallet/index.d.ts +27 -0
  212. package/dist/types/actions/wallet/index.d.ts.map +1 -0
  213. package/dist/types/actions/wallet/requestAddresses.d.ts +30 -0
  214. package/dist/types/actions/wallet/requestAddresses.d.ts.map +1 -0
  215. package/dist/types/actions/wallet/requestPermissions.d.ts +34 -0
  216. package/dist/types/actions/wallet/requestPermissions.d.ts.map +1 -0
  217. package/dist/types/actions/wallet/sendTransaction.d.ts +53 -0
  218. package/dist/types/actions/wallet/sendTransaction.d.ts.map +1 -0
  219. package/dist/types/actions/wallet/signMessage.d.ts +54 -0
  220. package/dist/types/actions/wallet/signMessage.d.ts.map +1 -0
  221. package/dist/types/actions/wallet/signTypedData.d.ts +109 -0
  222. package/dist/types/actions/wallet/signTypedData.d.ts.map +1 -0
  223. package/dist/types/actions/wallet/switchChain.d.ts +28 -0
  224. package/dist/types/actions/wallet/switchChain.d.ts.map +1 -0
  225. package/dist/types/actions/wallet/watchAsset.d.ts +35 -0
  226. package/dist/types/actions/wallet/watchAsset.d.ts.map +1 -0
  227. package/dist/types/actions/wallet/writeContract.d.ts +58 -0
  228. package/dist/types/actions/wallet/writeContract.d.ts.map +1 -0
  229. package/dist/types/adapters/ethers.d.ts +27 -0
  230. package/dist/types/adapters/ethers.d.ts.map +1 -0
  231. package/dist/types/chains.d.ts +2487 -0
  232. package/dist/types/chains.d.ts.map +1 -0
  233. package/dist/types/clients/createClient.d.ts +43 -0
  234. package/dist/types/clients/createClient.d.ts.map +1 -0
  235. package/dist/types/clients/createPublicClient.d.ts +40 -0
  236. package/dist/types/clients/createPublicClient.d.ts.map +1 -0
  237. package/dist/types/clients/createTestClient.d.ts +38 -0
  238. package/dist/types/clients/createTestClient.d.ts.map +1 -0
  239. package/dist/types/clients/createWalletClient.d.ts +51 -0
  240. package/dist/types/clients/createWalletClient.d.ts.map +1 -0
  241. package/dist/types/clients/decorators/index.d.ts +7 -0
  242. package/dist/types/clients/decorators/index.d.ts.map +1 -0
  243. package/dist/types/clients/decorators/public.d.ts +1043 -0
  244. package/dist/types/clients/decorators/public.d.ts.map +1 -0
  245. package/dist/types/clients/decorators/test.d.ts +572 -0
  246. package/dist/types/clients/decorators/test.d.ts.map +1 -0
  247. package/dist/types/clients/decorators/wallet.d.ts +436 -0
  248. package/dist/types/clients/decorators/wallet.d.ts.map +1 -0
  249. package/dist/types/clients/index.d.ts +11 -0
  250. package/dist/types/clients/index.d.ts.map +1 -0
  251. package/dist/types/clients/transports/createTransport.d.ts +37 -0
  252. package/dist/types/clients/transports/createTransport.d.ts.map +1 -0
  253. package/dist/types/clients/transports/custom.d.ts +21 -0
  254. package/dist/types/clients/transports/custom.d.ts.map +1 -0
  255. package/dist/types/clients/transports/fallback.d.ts +75 -0
  256. package/dist/types/clients/transports/fallback.d.ts.map +1 -0
  257. package/dist/types/clients/transports/http.d.ts +29 -0
  258. package/dist/types/clients/transports/http.d.ts.map +1 -0
  259. package/dist/types/clients/transports/index.d.ts +11 -0
  260. package/dist/types/clients/transports/index.d.ts.map +1 -0
  261. package/dist/types/clients/transports/webSocket.d.ts +46 -0
  262. package/dist/types/clients/transports/webSocket.d.ts.map +1 -0
  263. package/dist/types/constants/abis.d.ts +79 -0
  264. package/dist/types/constants/abis.d.ts.map +1 -0
  265. package/dist/types/constants/contract.d.ts +2 -0
  266. package/dist/types/constants/contract.d.ts.map +1 -0
  267. package/dist/types/constants/index.d.ts +5 -0
  268. package/dist/types/constants/index.d.ts.map +1 -0
  269. package/dist/types/constants/solidity.d.ts +15 -0
  270. package/dist/types/constants/solidity.d.ts.map +1 -0
  271. package/dist/types/constants/unit.d.ts +13 -0
  272. package/dist/types/constants/unit.d.ts.map +1 -0
  273. package/dist/types/contract.d.ts +7 -0
  274. package/dist/types/contract.d.ts.map +1 -0
  275. package/dist/types/ens.d.ts +5 -0
  276. package/dist/types/ens.d.ts.map +1 -0
  277. package/dist/types/errors/abi.d.ts +165 -0
  278. package/dist/types/errors/abi.d.ts.map +1 -0
  279. package/dist/types/errors/account.d.ts +8 -0
  280. package/dist/types/errors/account.d.ts.map +1 -0
  281. package/dist/types/errors/address.d.ts +8 -0
  282. package/dist/types/errors/address.d.ts.map +1 -0
  283. package/dist/types/errors/base.d.ts +22 -0
  284. package/dist/types/errors/base.d.ts.map +1 -0
  285. package/dist/types/errors/block.d.ts +10 -0
  286. package/dist/types/errors/block.d.ts.map +1 -0
  287. package/dist/types/errors/chain.d.ts +35 -0
  288. package/dist/types/errors/chain.d.ts.map +1 -0
  289. package/dist/types/errors/contract.d.ts +58 -0
  290. package/dist/types/errors/contract.d.ts.map +1 -0
  291. package/dist/types/errors/data.d.ts +10 -0
  292. package/dist/types/errors/data.d.ts.map +1 -0
  293. package/dist/types/errors/encoding.d.ts +53 -0
  294. package/dist/types/errors/encoding.d.ts.map +1 -0
  295. package/dist/types/errors/ens.d.ts +26 -0
  296. package/dist/types/errors/ens.d.ts.map +1 -0
  297. package/dist/types/errors/estimateGas.d.ts +13 -0
  298. package/dist/types/errors/estimateGas.d.ts.map +1 -0
  299. package/dist/types/errors/index.d.ts +18 -0
  300. package/dist/types/errors/index.d.ts.map +1 -0
  301. package/dist/types/errors/log.d.ts +6 -0
  302. package/dist/types/errors/log.d.ts.map +1 -0
  303. package/dist/types/errors/node.d.ts +105 -0
  304. package/dist/types/errors/node.d.ts.map +1 -0
  305. package/dist/types/errors/request.d.ts +53 -0
  306. package/dist/types/errors/request.d.ts.map +1 -0
  307. package/dist/types/errors/rpc.d.ts +199 -0
  308. package/dist/types/errors/rpc.d.ts.map +1 -0
  309. package/dist/types/errors/transaction.d.ts +75 -0
  310. package/dist/types/errors/transaction.d.ts.map +1 -0
  311. package/dist/types/errors/transport.d.ts +5 -0
  312. package/dist/types/errors/transport.d.ts.map +1 -0
  313. package/dist/types/errors/utils.d.ts +5 -0
  314. package/dist/types/errors/utils.d.ts.map +1 -0
  315. package/dist/types/errors/version.d.ts +2 -0
  316. package/dist/types/errors/version.d.ts.map +1 -0
  317. package/dist/types/ethers.d.ts +2 -0
  318. package/dist/types/ethers.d.ts.map +1 -0
  319. package/dist/types/index.d.ts +12 -0
  320. package/dist/types/index.d.ts.map +1 -0
  321. package/dist/types/public.d.ts +3 -0
  322. package/dist/types/public.d.ts.map +1 -0
  323. package/dist/types/test.d.ts +3 -0
  324. package/dist/types/test.d.ts.map +1 -0
  325. package/dist/types/types/account.d.ts +11 -0
  326. package/dist/types/types/account.d.ts.map +1 -0
  327. package/dist/types/types/block.d.ts +62 -0
  328. package/dist/types/types/block.d.ts.map +1 -0
  329. package/dist/types/types/chain.d.ts +17 -0
  330. package/dist/types/types/chain.d.ts.map +1 -0
  331. package/dist/types/types/contract.d.ts +159 -0
  332. package/dist/types/types/contract.d.ts.map +1 -0
  333. package/dist/types/types/eip1193.d.ts +1002 -0
  334. package/dist/types/types/eip1193.d.ts.map +1 -0
  335. package/dist/types/types/ens.d.ts +5 -0
  336. package/dist/types/types/ens.d.ts.map +1 -0
  337. package/dist/types/types/fee.d.ts +28 -0
  338. package/dist/types/types/fee.d.ts.map +1 -0
  339. package/dist/types/types/filter.d.ts +27 -0
  340. package/dist/types/types/filter.d.ts.map +1 -0
  341. package/dist/types/types/formatter.d.ts +13 -0
  342. package/dist/types/types/formatter.d.ts.map +1 -0
  343. package/dist/types/types/index.d.ts +19 -0
  344. package/dist/types/types/index.d.ts.map +1 -0
  345. package/dist/types/types/log.d.ts +42 -0
  346. package/dist/types/types/log.d.ts.map +1 -0
  347. package/dist/types/types/misc.d.ts +10 -0
  348. package/dist/types/types/misc.d.ts.map +1 -0
  349. package/dist/types/types/multicall.d.ts +48 -0
  350. package/dist/types/types/multicall.d.ts.map +1 -0
  351. package/dist/types/types/rpc.d.ts +19 -0
  352. package/dist/types/types/rpc.d.ts.map +1 -0
  353. package/dist/types/types/transaction.d.ts +132 -0
  354. package/dist/types/types/transaction.d.ts.map +1 -0
  355. package/dist/types/types/transport.d.ts +3 -0
  356. package/dist/types/types/transport.d.ts.map +1 -0
  357. package/dist/types/types/typedData.d.ts +47 -0
  358. package/dist/types/types/typedData.d.ts.map +1 -0
  359. package/dist/types/types/utils.d.ts +156 -0
  360. package/dist/types/types/utils.d.ts.map +1 -0
  361. package/dist/types/types/window.d.ts +7 -0
  362. package/dist/types/types/window.d.ts.map +1 -0
  363. package/dist/types/utils/abi/decodeAbiParameters.d.ts +5 -0
  364. package/dist/types/utils/abi/decodeAbiParameters.d.ts.map +1 -0
  365. package/dist/types/utils/abi/decodeDeployData.d.ts +13 -0
  366. package/dist/types/utils/abi/decodeDeployData.d.ts.map +1 -0
  367. package/dist/types/utils/abi/decodeErrorResult.d.ts +13 -0
  368. package/dist/types/utils/abi/decodeErrorResult.d.ts.map +1 -0
  369. package/dist/types/utils/abi/decodeEventLog.d.ts +13 -0
  370. package/dist/types/utils/abi/decodeEventLog.d.ts.map +1 -0
  371. package/dist/types/utils/abi/decodeFunctionData.d.ts +14 -0
  372. package/dist/types/utils/abi/decodeFunctionData.d.ts.map +1 -0
  373. package/dist/types/utils/abi/decodeFunctionResult.d.ts +10 -0
  374. package/dist/types/utils/abi/decodeFunctionResult.d.ts.map +1 -0
  375. package/dist/types/utils/abi/encodeAbiParameters.d.ts +9 -0
  376. package/dist/types/utils/abi/encodeAbiParameters.d.ts.map +1 -0
  377. package/dist/types/utils/abi/encodeDeployData.d.ts +8 -0
  378. package/dist/types/utils/abi/encodeDeployData.d.ts.map +1 -0
  379. package/dist/types/utils/abi/encodeErrorResult.d.ts +8 -0
  380. package/dist/types/utils/abi/encodeErrorResult.d.ts.map +1 -0
  381. package/dist/types/utils/abi/encodeEventTopics.d.ts +9 -0
  382. package/dist/types/utils/abi/encodeEventTopics.d.ts.map +1 -0
  383. package/dist/types/utils/abi/encodeFunctionData.d.ts +8 -0
  384. package/dist/types/utils/abi/encodeFunctionData.d.ts.map +1 -0
  385. package/dist/types/utils/abi/encodeFunctionResult.d.ts +9 -0
  386. package/dist/types/utils/abi/encodeFunctionResult.d.ts.map +1 -0
  387. package/dist/types/utils/abi/encodePacked.d.ts +11 -0
  388. package/dist/types/utils/abi/encodePacked.d.ts.map +1 -0
  389. package/dist/types/utils/abi/formatAbiItem.d.ts +9 -0
  390. package/dist/types/utils/abi/formatAbiItem.d.ts.map +1 -0
  391. package/dist/types/utils/abi/formatAbiItemWithArgs.d.ts +8 -0
  392. package/dist/types/utils/abi/formatAbiItemWithArgs.d.ts.map +1 -0
  393. package/dist/types/utils/abi/getAbiItem.d.ts +12 -0
  394. package/dist/types/utils/abi/getAbiItem.d.ts.map +1 -0
  395. package/dist/types/utils/abi/index.d.ts +30 -0
  396. package/dist/types/utils/abi/index.d.ts.map +1 -0
  397. package/dist/types/utils/accounts.d.ts +3 -0
  398. package/dist/types/utils/accounts.d.ts.map +1 -0
  399. package/dist/types/utils/address/getAddress.d.ts +4 -0
  400. package/dist/types/utils/address/getAddress.d.ts.map +1 -0
  401. package/dist/types/utils/address/getContractAddress.d.ts +19 -0
  402. package/dist/types/utils/address/getContractAddress.d.ts.map +1 -0
  403. package/dist/types/utils/address/index.d.ts +6 -0
  404. package/dist/types/utils/address/index.d.ts.map +1 -0
  405. package/dist/types/utils/address/isAddress.d.ts +3 -0
  406. package/dist/types/utils/address/isAddress.d.ts.map +1 -0
  407. package/dist/types/utils/address/isAddressEqual.d.ts +3 -0
  408. package/dist/types/utils/address/isAddressEqual.d.ts.map +1 -0
  409. package/dist/types/utils/buildRequest.d.ts +6 -0
  410. package/dist/types/utils/buildRequest.d.ts.map +1 -0
  411. package/dist/types/utils/chain.d.ts +8 -0
  412. package/dist/types/utils/chain.d.ts.map +1 -0
  413. package/dist/types/utils/contract/extractFunctionParts.d.ts +13 -0
  414. package/dist/types/utils/contract/extractFunctionParts.d.ts.map +1 -0
  415. package/dist/types/utils/contract/index.d.ts +2 -0
  416. package/dist/types/utils/contract/index.d.ts.map +1 -0
  417. package/dist/types/utils/data/concat.d.ts +6 -0
  418. package/dist/types/utils/data/concat.d.ts.map +1 -0
  419. package/dist/types/utils/data/index.d.ts +8 -0
  420. package/dist/types/utils/data/index.d.ts.map +1 -0
  421. package/dist/types/utils/data/isBytes.d.ts +3 -0
  422. package/dist/types/utils/data/isBytes.d.ts.map +1 -0
  423. package/dist/types/utils/data/isHex.d.ts +3 -0
  424. package/dist/types/utils/data/isHex.d.ts.map +1 -0
  425. package/dist/types/utils/data/pad.d.ts +11 -0
  426. package/dist/types/utils/data/pad.d.ts.map +1 -0
  427. package/dist/types/utils/data/size.d.ts +9 -0
  428. package/dist/types/utils/data/size.d.ts.map +1 -0
  429. package/dist/types/utils/data/slice.d.ts +27 -0
  430. package/dist/types/utils/data/slice.d.ts.map +1 -0
  431. package/dist/types/utils/data/trim.d.ts +8 -0
  432. package/dist/types/utils/data/trim.d.ts.map +1 -0
  433. package/dist/types/utils/encoding/fromBytes.d.ts +110 -0
  434. package/dist/types/utils/encoding/fromBytes.d.ts.map +1 -0
  435. package/dist/types/utils/encoding/fromHex.d.ts +138 -0
  436. package/dist/types/utils/encoding/fromHex.d.ts.map +1 -0
  437. package/dist/types/utils/encoding/fromRlp.d.ts +6 -0
  438. package/dist/types/utils/encoding/fromRlp.d.ts.map +1 -0
  439. package/dist/types/utils/encoding/index.d.ts +8 -0
  440. package/dist/types/utils/encoding/index.d.ts.map +1 -0
  441. package/dist/types/utils/encoding/toBytes.d.ts +125 -0
  442. package/dist/types/utils/encoding/toBytes.d.ts.map +1 -0
  443. package/dist/types/utils/encoding/toHex.d.ts +139 -0
  444. package/dist/types/utils/encoding/toHex.d.ts.map +1 -0
  445. package/dist/types/utils/encoding/toRlp.d.ts +8 -0
  446. package/dist/types/utils/encoding/toRlp.d.ts.map +1 -0
  447. package/dist/types/utils/ens/avatar/index.d.ts +2 -0
  448. package/dist/types/utils/ens/avatar/index.d.ts.map +1 -0
  449. package/dist/types/utils/ens/avatar/parseAvatarRecord.d.ts +7 -0
  450. package/dist/types/utils/ens/avatar/parseAvatarRecord.d.ts.map +1 -0
  451. package/dist/types/utils/ens/avatar/utils.d.ts +34 -0
  452. package/dist/types/utils/ens/avatar/utils.d.ts.map +1 -0
  453. package/dist/types/utils/ens/index.d.ts +5 -0
  454. package/dist/types/utils/ens/index.d.ts.map +1 -0
  455. package/dist/types/utils/ens/labelhash.d.ts +11 -0
  456. package/dist/types/utils/ens/labelhash.d.ts.map +1 -0
  457. package/dist/types/utils/ens/namehash.d.ts +13 -0
  458. package/dist/types/utils/ens/namehash.d.ts.map +1 -0
  459. package/dist/types/utils/ens/normalize.d.ts +12 -0
  460. package/dist/types/utils/ens/normalize.d.ts.map +1 -0
  461. package/dist/types/utils/ens/packetToBytes.d.ts +3 -0
  462. package/dist/types/utils/ens/packetToBytes.d.ts.map +1 -0
  463. package/dist/types/utils/errors/getCallError.d.ts +9 -0
  464. package/dist/types/utils/errors/getCallError.d.ts.map +1 -0
  465. package/dist/types/utils/errors/getContractError.d.ts +13 -0
  466. package/dist/types/utils/errors/getContractError.d.ts.map +1 -0
  467. package/dist/types/utils/errors/getEstimateGasError.d.ts +10 -0
  468. package/dist/types/utils/errors/getEstimateGasError.d.ts.map +1 -0
  469. package/dist/types/utils/errors/getNodeError.d.ts +6 -0
  470. package/dist/types/utils/errors/getNodeError.d.ts.map +1 -0
  471. package/dist/types/utils/errors/getTransactionError.d.ts +10 -0
  472. package/dist/types/utils/errors/getTransactionError.d.ts.map +1 -0
  473. package/dist/types/utils/errors/index.d.ts +6 -0
  474. package/dist/types/utils/errors/index.d.ts.map +1 -0
  475. package/dist/types/utils/filters/createFilterRequestScope.d.ts +16 -0
  476. package/dist/types/utils/filters/createFilterRequestScope.d.ts.map +1 -0
  477. package/dist/types/utils/formatters/block.d.ts +14 -0
  478. package/dist/types/utils/formatters/block.d.ts.map +1 -0
  479. package/dist/types/utils/formatters/extract.d.ts +8 -0
  480. package/dist/types/utils/formatters/extract.d.ts.map +1 -0
  481. package/dist/types/utils/formatters/feeHistory.d.ts +3 -0
  482. package/dist/types/utils/formatters/feeHistory.d.ts.map +1 -0
  483. package/dist/types/utils/formatters/format.d.ts +36 -0
  484. package/dist/types/utils/formatters/format.d.ts.map +1 -0
  485. package/dist/types/utils/formatters/index.d.ts +13 -0
  486. package/dist/types/utils/formatters/index.d.ts.map +1 -0
  487. package/dist/types/utils/formatters/log.d.ts +16 -0
  488. package/dist/types/utils/formatters/log.d.ts.map +1 -0
  489. package/dist/types/utils/formatters/transaction.d.ts +19 -0
  490. package/dist/types/utils/formatters/transaction.d.ts.map +1 -0
  491. package/dist/types/utils/formatters/transactionReceipt.d.ts +14 -0
  492. package/dist/types/utils/formatters/transactionReceipt.d.ts.map +1 -0
  493. package/dist/types/utils/formatters/transactionRequest.d.ts +14 -0
  494. package/dist/types/utils/formatters/transactionRequest.d.ts.map +1 -0
  495. package/dist/types/utils/hash/getEventSelector.d.ts +3 -0
  496. package/dist/types/utils/hash/getEventSelector.d.ts.map +1 -0
  497. package/dist/types/utils/hash/getFunctionSelector.d.ts +2 -0
  498. package/dist/types/utils/hash/getFunctionSelector.d.ts.map +1 -0
  499. package/dist/types/utils/hash/hashFunction.d.ts +2 -0
  500. package/dist/types/utils/hash/hashFunction.d.ts.map +1 -0
  501. package/dist/types/utils/hash/index.d.ts +5 -0
  502. package/dist/types/utils/hash/index.d.ts.map +1 -0
  503. package/dist/types/utils/hash/isHash.d.ts +3 -0
  504. package/dist/types/utils/hash/isHash.d.ts.map +1 -0
  505. package/dist/types/utils/hash/keccak256.d.ts +6 -0
  506. package/dist/types/utils/hash/keccak256.d.ts.map +1 -0
  507. package/dist/types/utils/index.d.ts +26 -0
  508. package/dist/types/utils/index.d.ts.map +1 -0
  509. package/dist/types/utils/observe.d.ts +17 -0
  510. package/dist/types/utils/observe.d.ts.map +1 -0
  511. package/dist/types/utils/poll.d.ts +13 -0
  512. package/dist/types/utils/poll.d.ts.map +1 -0
  513. package/dist/types/utils/promise/createBatchScheduler.d.ts +15 -0
  514. package/dist/types/utils/promise/createBatchScheduler.d.ts.map +1 -0
  515. package/dist/types/utils/promise/index.d.ts +5 -0
  516. package/dist/types/utils/promise/index.d.ts.map +1 -0
  517. package/dist/types/utils/promise/withCache.d.ts +36 -0
  518. package/dist/types/utils/promise/withCache.d.ts.map +1 -0
  519. package/dist/types/utils/promise/withRetry.d.ts +12 -0
  520. package/dist/types/utils/promise/withRetry.d.ts.map +1 -0
  521. package/dist/types/utils/promise/withTimeout.d.ts +8 -0
  522. package/dist/types/utils/promise/withTimeout.d.ts.map +1 -0
  523. package/dist/types/utils/regex.d.ts +4 -0
  524. package/dist/types/utils/regex.d.ts.map +1 -0
  525. package/dist/types/utils/rpc.d.ts +64 -0
  526. package/dist/types/utils/rpc.d.ts.map +1 -0
  527. package/dist/types/utils/signature/hashMessage.d.ts +6 -0
  528. package/dist/types/utils/signature/hashMessage.d.ts.map +1 -0
  529. package/dist/types/utils/signature/hashTypedData.d.ts +10 -0
  530. package/dist/types/utils/signature/hashTypedData.d.ts.map +1 -0
  531. package/dist/types/utils/signature/index.d.ts +16 -0
  532. package/dist/types/utils/signature/index.d.ts.map +1 -0
  533. package/dist/types/utils/signature/recoverAddress.d.ts +8 -0
  534. package/dist/types/utils/signature/recoverAddress.d.ts.map +1 -0
  535. package/dist/types/utils/signature/recoverMessageAddress.d.ts +8 -0
  536. package/dist/types/utils/signature/recoverMessageAddress.d.ts.map +1 -0
  537. package/dist/types/utils/signature/recoverPublicKey.d.ts +8 -0
  538. package/dist/types/utils/signature/recoverPublicKey.d.ts.map +1 -0
  539. package/dist/types/utils/signature/recoverTypedDataAddress.d.ts +12 -0
  540. package/dist/types/utils/signature/recoverTypedDataAddress.d.ts.map +1 -0
  541. package/dist/types/utils/signature/verifyMessage.d.ts +10 -0
  542. package/dist/types/utils/signature/verifyMessage.d.ts.map +1 -0
  543. package/dist/types/utils/signature/verifyTypedData.d.ts +13 -0
  544. package/dist/types/utils/signature/verifyTypedData.d.ts.map +1 -0
  545. package/dist/types/utils/stringify.d.ts +2 -0
  546. package/dist/types/utils/stringify.d.ts.map +1 -0
  547. package/dist/types/utils/transaction/assertRequest.d.ts +4 -0
  548. package/dist/types/utils/transaction/assertRequest.d.ts.map +1 -0
  549. package/dist/types/utils/transaction/assertTransaction.d.ts +5 -0
  550. package/dist/types/utils/transaction/assertTransaction.d.ts.map +1 -0
  551. package/dist/types/utils/transaction/getSerializedTransactionType.d.ts +4 -0
  552. package/dist/types/utils/transaction/getSerializedTransactionType.d.ts.map +1 -0
  553. package/dist/types/utils/transaction/getTransactionType.d.ts +4 -0
  554. package/dist/types/utils/transaction/getTransactionType.d.ts.map +1 -0
  555. package/dist/types/utils/transaction/index.d.ts +10 -0
  556. package/dist/types/utils/transaction/index.d.ts.map +1 -0
  557. package/dist/types/utils/transaction/parseTransaction.d.ts +5 -0
  558. package/dist/types/utils/transaction/parseTransaction.d.ts.map +1 -0
  559. package/dist/types/utils/transaction/prepareRequest.d.ts +21 -0
  560. package/dist/types/utils/transaction/prepareRequest.d.ts.map +1 -0
  561. package/dist/types/utils/transaction/serializeTransaction.d.ts +5 -0
  562. package/dist/types/utils/transaction/serializeTransaction.d.ts.map +1 -0
  563. package/dist/types/utils/typedData.d.ts +6 -0
  564. package/dist/types/utils/typedData.d.ts.map +1 -0
  565. package/dist/types/utils/uid.d.ts +2 -0
  566. package/dist/types/utils/uid.d.ts.map +1 -0
  567. package/dist/types/utils/unit/formatEther.d.ts +2 -0
  568. package/dist/types/utils/unit/formatEther.d.ts.map +1 -0
  569. package/dist/types/utils/unit/formatGwei.d.ts +2 -0
  570. package/dist/types/utils/unit/formatGwei.d.ts.map +1 -0
  571. package/dist/types/utils/unit/formatUnits.d.ts +2 -0
  572. package/dist/types/utils/unit/formatUnits.d.ts.map +1 -0
  573. package/dist/types/utils/unit/index.d.ts +7 -0
  574. package/dist/types/utils/unit/index.d.ts.map +1 -0
  575. package/dist/types/utils/unit/parseEther.d.ts +2 -0
  576. package/dist/types/utils/unit/parseEther.d.ts.map +1 -0
  577. package/dist/types/utils/unit/parseGwei.d.ts +2 -0
  578. package/dist/types/utils/unit/parseGwei.d.ts.map +1 -0
  579. package/dist/types/utils/unit/parseUnits.d.ts +2 -0
  580. package/dist/types/utils/unit/parseUnits.d.ts.map +1 -0
  581. package/dist/types/utils/wait.d.ts +2 -0
  582. package/dist/types/utils/wait.d.ts.map +1 -0
  583. package/dist/types/wallet.d.ts +3 -0
  584. package/dist/types/wallet.d.ts.map +1 -0
  585. package/dist/types/window.d.ts +2 -0
  586. package/dist/types/window.d.ts.map +1 -0
  587. package/package.json +2 -2
  588. package/src/actions/public/multicall.ts +53 -20
  589. package/src/errors/version.ts +1 -1
@@ -0,0 +1,39 @@
1
+ import type { Abi } from 'abitype';
2
+ import type { PublicClient, Transport } from '../../clients/index.js';
3
+ import type { Chain, ContractFunctionConfig, ContractFunctionResult } from '../../types/index.js';
4
+ import type { CallParameters } from './call.js';
5
+ export type ReadContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Pick<CallParameters, 'blockNumber' | 'blockTag'> & ContractFunctionConfig<TAbi, TFunctionName, 'view' | 'pure'>;
6
+ export type ReadContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ContractFunctionResult<TAbi, TFunctionName>;
7
+ /**
8
+ * Calls a read-only function on a contract, and returns the response.
9
+ *
10
+ * - Docs: https://viem.sh/docs/contract/readContract.html
11
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/reading-contracts
12
+ *
13
+ * 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.
14
+ *
15
+ * 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).
16
+ *
17
+ * @param client - Client to use
18
+ * @param parameters - {@link ReadContractParameters}
19
+ * @returns The response from the contract. Type is inferred. {@link ReadContractReturnType}
20
+ *
21
+ * @example
22
+ * import { createPublicClient, http, parseAbi } from 'viem'
23
+ * import { mainnet } from 'viem/chains'
24
+ * import { readContract } from 'viem/contract'
25
+ *
26
+ * const client = createPublicClient({
27
+ * chain: mainnet,
28
+ * transport: http(),
29
+ * })
30
+ * const result = await readContract(client, {
31
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
32
+ * abi: parseAbi(['function balanceOf(address) view returns (uint256)']),
33
+ * functionName: 'balanceOf',
34
+ * args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'],
35
+ * })
36
+ * // 424122n
37
+ */
38
+ export declare function readContract<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client: PublicClient<Transport, TChain>, { abi, address, args, functionName, ...callRequest }: ReadContractParameters<TAbi, TFunctionName>): Promise<ReadContractReturnType<TAbi, TFunctionName>>;
39
+ //# sourceMappingURL=readContract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readContract.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/readContract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAErE,OAAO,KAAK,EACV,KAAK,EACL,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,sBAAsB,CAAA;AAW7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,MAAM,MAAM,sBAAsB,CAChC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,GAAG,EAC3C,aAAa,SAAS,MAAM,GAAG,MAAM,IACnC,IAAI,CAAC,cAAc,EAAE,aAAa,GAAG,UAAU,CAAC,GAClD,sBAAsB,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;AAE9D,MAAM,MAAM,sBAAsB,CAChC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,GAAG,EAC3C,aAAa,SAAS,MAAM,GAAG,MAAM,IACnC,sBAAsB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,YAAY,CAChC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,EACrC,aAAa,SAAS,MAAM,EAE5B,MAAM,EAAE,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,EACvC,EACE,GAAG,EACH,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,GAAG,WAAW,EACf,EAAE,sBAAsB,CAAC,IAAI,EAAE,aAAa,CAAC,GAC7C,OAAO,CAAC,sBAAsB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CA2BtD"}
@@ -0,0 +1,47 @@
1
+ import type { Abi } from 'abitype';
2
+ import type { PublicClient, Transport } from '../../clients/index.js';
3
+ import type { Chain, ContractFunctionConfig, ContractFunctionResult, GetValue } from '../../types/index.js';
4
+ import type { WriteContractParameters } from '../wallet/index.js';
5
+ import type { CallParameters } from './call.js';
6
+ export type SimulateContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChain extends Chain | undefined = Chain | undefined, TChainOverride extends Chain | undefined = undefined> = {
7
+ chain?: TChainOverride;
8
+ } & ContractFunctionConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & Omit<CallParameters<TChainOverride extends Chain ? TChainOverride : TChain>, 'batch' | 'to' | 'data' | 'value'> & GetValue<TAbi, TFunctionName, CallParameters<TChain>['value']>;
9
+ export type SimulateContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChain extends Chain | undefined = Chain | undefined, TChainOverride extends Chain | undefined = undefined> = {
10
+ result: ContractFunctionResult<TAbi, TFunctionName>;
11
+ request: Omit<WriteContractParameters<TAbi, TFunctionName, TChain, undefined, TChainOverride>, 'chain'> & {
12
+ chain: TChainOverride;
13
+ } & ContractFunctionConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
14
+ };
15
+ /**
16
+ * Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions.
17
+ *
18
+ * - Docs: https://viem.sh/docs/contract/simulateContract.html
19
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
20
+ *
21
+ * 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.
22
+ *
23
+ * 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).
24
+ *
25
+ * @param client - Client to use
26
+ * @param parameters - {@link SimulateContractParameters}
27
+ * @returns The simulation result and write request. {@link SimulateContractReturnType}
28
+ *
29
+ * @example
30
+ * import { createPublicClient, http } from 'viem'
31
+ * import { mainnet } from 'viem/chains'
32
+ * import { simulateContract } from 'viem/contract'
33
+ *
34
+ * const client = createPublicClient({
35
+ * chain: mainnet,
36
+ * transport: http(),
37
+ * })
38
+ * const result = await simulateContract(client, {
39
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
40
+ * abi: parseAbi(['function mint(uint32) view returns (uint32)']),
41
+ * functionName: 'mint',
42
+ * args: ['69420'],
43
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
44
+ * })
45
+ */
46
+ export declare function simulateContract<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(client: PublicClient<Transport, TChain>, { abi, address, args, functionName, ...callRequest }: SimulateContractParameters<TAbi, TFunctionName, TChain, TChainOverride>): Promise<SimulateContractReturnType<TAbi, TFunctionName, TChain, TChainOverride>>;
47
+ //# sourceMappingURL=simulateContract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulateContract.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/simulateContract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAErE,OAAO,KAAK,EACV,KAAK,EACL,sBAAsB,EACtB,sBAAsB,EACtB,QAAQ,EACT,MAAM,sBAAsB,CAAA;AAW7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,MAAM,MAAM,0BAA0B,CACpC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,GAAG,EAC3C,aAAa,SAAS,MAAM,GAAG,GAAG,EAClC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,IAClD;IACF,KAAK,CAAC,EAAE,cAAc,CAAA;CACvB,GAAG,sBAAsB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAG,YAAY,CAAC,GACvE,IAAI,CACF,cAAc,CAAC,cAAc,SAAS,KAAK,GAAG,cAAc,GAAG,MAAM,CAAC,EACtE,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CAClC,GACD,QAAQ,CAAC,IAAI,EAAE,aAAa,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AAEhE,MAAM,MAAM,0BAA0B,CACpC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,GAAG,EAC3C,aAAa,SAAS,MAAM,GAAG,MAAM,EACrC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,IAClD;IACF,MAAM,EAAE,sBAAsB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;IACnD,OAAO,EAAE,IAAI,CACX,uBAAuB,CACrB,IAAI,EACJ,aAAa,EACb,MAAM,EACN,SAAS,EACT,cAAc,CACf,EACD,OAAO,CACR,GAAG;QACF,KAAK,EAAE,cAAc,CAAA;KACtB,GAAG,sBAAsB,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,GAAG,YAAY,CAAC,CAAA;CAC1E,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,EACrC,aAAa,SAAS,MAAM,EAC5B,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,MAAM,EAAE,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,EACvC,EACE,GAAG,EACH,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,GAAG,WAAW,EACf,EAAE,0BAA0B,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,GACzE,OAAO,CACR,0BAA0B,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,CACxE,CA+CA"}
@@ -0,0 +1,32 @@
1
+ import type { PublicClient, Transport } from '../../clients/index.js';
2
+ import type { Chain, Filter } from '../../types/index.js';
3
+ export type UninstallFilterParameters = {
4
+ filter: Filter<any>;
5
+ };
6
+ export type UninstallFilterReturnType = boolean;
7
+ /**
8
+ * Destroys a [`Filter`](https://viem.sh/docs/glossary/types.html#filter).
9
+ *
10
+ * - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html
11
+ * - JSON-RPC Methods: [`eth_uninstallFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_uninstallFilter)
12
+ *
13
+ * Destroys a Filter that was created from one of the following Actions:
14
+ * - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter)
15
+ * - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter)
16
+ * - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter)
17
+ *
18
+ * @param client - Client to use
19
+ * @param parameters - {@link UninstallFilterParameters}
20
+ * @returns A boolean indicating if the Filter was successfully uninstalled. {@link UninstallFilterReturnType}
21
+ *
22
+ * @example
23
+ * import { createPublicClient, http } from 'viem'
24
+ * import { mainnet } from 'viem/chains'
25
+ * import { createPendingTransactionFilter, uninstallFilter } from 'viem/public'
26
+ *
27
+ * const filter = await createPendingTransactionFilter(client)
28
+ * const uninstalled = await uninstallFilter(client, { filter })
29
+ * // true
30
+ */
31
+ export declare function uninstallFilter<TTransport extends Transport, TChain extends Chain | undefined>(_client: PublicClient<TTransport, TChain>, { filter }: UninstallFilterParameters): Promise<UninstallFilterReturnType>;
32
+ //# sourceMappingURL=uninstallFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uninstallFilter.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/uninstallFilter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAEzD,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAA;CACpB,CAAA;AACD,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CACnC,UAAU,SAAS,SAAS,EAC5B,MAAM,SAAS,KAAK,GAAG,SAAS,EAEhC,OAAO,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,EACzC,EAAE,MAAM,EAAE,EAAE,yBAAyB,GACpC,OAAO,CAAC,yBAAyB,CAAC,CAKpC"}
@@ -0,0 +1,69 @@
1
+ import type { PublicClient, Transport } from '../../clients/index.js';
2
+ import type { Chain, Hash, Transaction } from '../../types/index.js';
3
+ import type { GetTransactionReceiptReturnType } from './getTransactionReceipt.js';
4
+ export type ReplacementReason = 'cancelled' | 'replaced' | 'repriced';
5
+ export type ReplacementReturnType<TChain extends Chain | undefined = Chain | undefined> = {
6
+ reason: ReplacementReason;
7
+ replacedTransaction: Transaction;
8
+ transaction: Transaction;
9
+ transactionReceipt: GetTransactionReceiptReturnType<TChain>;
10
+ };
11
+ export type WaitForTransactionReceiptReturnType<TChain extends Chain | undefined = Chain | undefined> = GetTransactionReceiptReturnType<TChain>;
12
+ export type WaitForTransactionReceiptParameters<TChain extends Chain | undefined = Chain | undefined> = {
13
+ /**
14
+ * The number of confirmations (blocks that have passed) to wait before resolving.
15
+ * @default 1
16
+ */
17
+ confirmations?: number;
18
+ /** The hash of the transaction. */
19
+ hash: Hash;
20
+ /** Optional callback to emit if the transaction has been replaced. */
21
+ onReplaced?: (response: ReplacementReturnType<TChain>) => void;
22
+ /**
23
+ * Polling frequency (in ms). Defaults to the client's pollingInterval config.
24
+ * @default client.pollingInterval
25
+ */
26
+ pollingInterval?: number;
27
+ /** Optional timeout (in milliseconds) to wait before stopping polling. */
28
+ timeout?: number;
29
+ };
30
+ /**
31
+ * 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.
32
+ *
33
+ * - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html
34
+ * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
35
+ * - JSON-RPC Methods:
36
+ * - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.
37
+ * - If a Transaction has been replaced:
38
+ * - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) and extracts the transactions
39
+ * - Checks if one of the Transactions is a replacement
40
+ * - If so, calls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt).
41
+ *
42
+ * The `waitForTransactionReceipt` action additionally supports Replacement detection (e.g. sped up Transactions).
43
+ *
44
+ * 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.
45
+ *
46
+ * There are 3 types of Transaction Replacement reasons:
47
+ *
48
+ * - `repriced`: The gas price has been modified (e.g. different `maxFeePerGas`)
49
+ * - `cancelled`: The Transaction has been cancelled (e.g. `value === 0n`)
50
+ * - `replaced`: The Transaction has been replaced (e.g. different `value` or `data`)
51
+ *
52
+ * @param client - Client to use
53
+ * @param parameters - {@link WaitForTransactionReceiptParameters}
54
+ * @returns The transaction receipt. {@link WaitForTransactionReceiptReturnType}
55
+ *
56
+ * @example
57
+ * import { createPublicClient, waitForTransactionReceipt, http } from 'viem'
58
+ * import { mainnet } from 'viem/chains'
59
+ *
60
+ * const client = createPublicClient({
61
+ * chain: mainnet,
62
+ * transport: http(),
63
+ * })
64
+ * const transactionReceipt = await waitForTransactionReceipt(client, {
65
+ * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
66
+ * })
67
+ */
68
+ export declare function waitForTransactionReceipt<TChain extends Chain | undefined>(client: PublicClient<Transport, TChain>, { confirmations, hash, onReplaced, pollingInterval, timeout, }: WaitForTransactionReceiptParameters<TChain>): Promise<WaitForTransactionReceiptReturnType<TChain>>;
69
+ //# sourceMappingURL=waitForTransactionReceipt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waitForTransactionReceipt.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/waitForTransactionReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAMrE,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAMpE,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAA;AAGjF,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAA;AACrE,MAAM,MAAM,qBAAqB,CAC/B,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAClD;IACF,MAAM,EAAE,iBAAiB,CAAA;IACzB,mBAAmB,EAAE,WAAW,CAAA;IAChC,WAAW,EAAE,WAAW,CAAA;IACxB,kBAAkB,EAAE,+BAA+B,CAAC,MAAM,CAAC,CAAA;CAC5D,CAAA;AAED,MAAM,MAAM,mCAAmC,CAC7C,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAClD,+BAA+B,CAAC,MAAM,CAAC,CAAA;AAE3C,MAAM,MAAM,mCAAmC,CAC7C,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAClD;IACF;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mCAAmC;IACnC,IAAI,EAAE,IAAI,CAAA;IACV,sEAAsE;IACtE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;IAC9D;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,SAAS,KAAK,GAAG,SAAS,EAEhC,MAAM,EAAE,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,EACvC,EACE,aAAiB,EACjB,IAAI,EACJ,UAAU,EACV,eAAwC,EACxC,OAAO,GACR,EAAE,mCAAmC,CAAC,MAAM,CAAC,GAC7C,OAAO,CAAC,mCAAmC,CAAC,MAAM,CAAC,CAAC,CA2HtD"}
@@ -0,0 +1,57 @@
1
+ import type { PublicClient, Transport } from '../../clients/index.js';
2
+ import type { Chain, GetTransportConfig } from '../../types/index.js';
3
+ import type { GetBlockNumberReturnType } from './getBlockNumber.js';
4
+ export type OnBlockNumberParameter = GetBlockNumberReturnType;
5
+ export type OnBlockNumberFn = (blockNumber: OnBlockNumberParameter, prevBlockNumber: OnBlockNumberParameter | undefined) => void;
6
+ export type PollOptions = {
7
+ /** Whether or not to emit the missed block numbers to the callback. */
8
+ emitMissed?: boolean;
9
+ /** Whether or not to emit the latest block number to the callback when the subscription opens. */
10
+ emitOnBegin?: boolean;
11
+ /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
12
+ pollingInterval?: number;
13
+ };
14
+ export type WatchBlockNumberParameters<TTransport extends Transport = Transport> = {
15
+ /** The callback to call when a new block number is received. */
16
+ onBlockNumber: OnBlockNumberFn;
17
+ /** The callback to call when an error occurred when trying to get for a new block. */
18
+ onError?: (error: Error) => void;
19
+ } & (GetTransportConfig<TTransport>['type'] extends 'webSocket' ? {
20
+ emitMissed?: never;
21
+ emitOnBegin?: never;
22
+ /** Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`. */
23
+ poll?: false;
24
+ pollingInterval?: never;
25
+ } | (PollOptions & {
26
+ poll: true;
27
+ }) : PollOptions & {
28
+ poll?: true;
29
+ });
30
+ export type WatchBlockNumberReturnType = () => void;
31
+ /**
32
+ * Watches and returns incoming block numbers.
33
+ *
34
+ * - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html
35
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks
36
+ * - JSON-RPC Methods:
37
+ * - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.
38
+ * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
39
+ *
40
+ * @param client - Client to use
41
+ * @param parameters - {@link WatchBlockNumberParameters}
42
+ * @returns A function that can be invoked to stop watching for new block numbers. {@link WatchBlockNumberReturnType}
43
+ *
44
+ * @example
45
+ * import { createPublicClient, watchBlockNumber, http } from 'viem'
46
+ * import { mainnet } from 'viem/chains'
47
+ *
48
+ * const client = createPublicClient({
49
+ * chain: mainnet,
50
+ * transport: http(),
51
+ * })
52
+ * const unwatch = await watchBlockNumber(client, {
53
+ * onBlockNumber: (blockNumber) => console.log(blockNumber),
54
+ * })
55
+ */
56
+ export declare function watchBlockNumber<TChain extends Chain | undefined, TTransport extends Transport>(client: PublicClient<TTransport, TChain>, { emitOnBegin, emitMissed, onBlockNumber, onError, poll: poll_, pollingInterval, }: WatchBlockNumberParameters<TTransport>): WatchBlockNumberReturnType;
57
+ //# sourceMappingURL=watchBlockNumber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchBlockNumber.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/watchBlockNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAIrE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAGnE,MAAM,MAAM,sBAAsB,GAAG,wBAAwB,CAAA;AAC7D,MAAM,MAAM,eAAe,GAAG,CAC5B,WAAW,EAAE,sBAAsB,EACnC,eAAe,EAAE,sBAAsB,GAAG,SAAS,KAChD,IAAI,CAAA;AAET,MAAM,MAAM,WAAW,GAAG;IACxB,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kGAAkG;IAClG,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,0BAA0B,CACpC,UAAU,SAAS,SAAS,GAAG,SAAS,IACtC;IACF,gEAAgE;IAChE,aAAa,EAAE,eAAe,CAAA;IAC9B,sFAAsF;IACtF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACjC,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,SAAS,WAAW,GAEvD;IACE,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,0GAA0G;IAC1G,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,eAAe,CAAC,EAAE,KAAK,CAAA;CACxB,GACD,CAAC,WAAW,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,GAClC,WAAW,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC,CAAA;AAElC,MAAM,MAAM,0BAA0B,GAAG,MAAM,IAAI,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,UAAU,SAAS,SAAS,EAE5B,MAAM,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,EACxC,EACE,WAAmB,EACnB,UAAkB,EAClB,aAAa,EACb,OAAO,EACP,IAAI,EAAE,KAAK,EACX,eAAwC,GACzC,EAAE,0BAA0B,CAAC,UAAU,CAAC,GACxC,0BAA0B,CAiF5B"}
@@ -0,0 +1,64 @@
1
+ import type { PublicClient, Transport } from '../../clients/index.js';
2
+ import type { BlockTag, Chain, GetTransportConfig } from '../../types/index.js';
3
+ import type { GetBlockReturnType } from './getBlock.js';
4
+ export type OnBlockParameter<TChain extends Chain | undefined = Chain> = GetBlockReturnType<TChain>;
5
+ export type OnBlock<TChain extends Chain | undefined = Chain> = (block: OnBlockParameter<TChain>, prevBlock: OnBlockParameter<TChain> | undefined) => void;
6
+ type PollOptions = {
7
+ /** The block tag. Defaults to "latest". */
8
+ blockTag?: BlockTag;
9
+ /** Whether or not to emit the missed blocks to the callback. */
10
+ emitMissed?: boolean;
11
+ /** Whether or not to emit the block to the callback when the subscription opens. */
12
+ emitOnBegin?: boolean;
13
+ /** Whether or not to include transaction data in the response. */
14
+ includeTransactions?: boolean;
15
+ /** Polling frequency (in ms). Defaults to the client's pollingInterval config. */
16
+ pollingInterval?: number;
17
+ };
18
+ export type WatchBlocksParameters<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain> = {
19
+ /** The callback to call when a new block is received. */
20
+ onBlock: OnBlock<TChain>;
21
+ /** The callback to call when an error occurred when trying to get for a new block. */
22
+ onError?: (error: Error) => void;
23
+ } & (GetTransportConfig<TTransport>['type'] extends 'webSocket' ? {
24
+ blockTag?: never;
25
+ emitMissed?: never;
26
+ emitOnBegin?: never;
27
+ includeTransactions?: never;
28
+ /** Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`. */
29
+ poll?: false;
30
+ pollingInterval?: never;
31
+ } | (PollOptions & {
32
+ poll?: true;
33
+ }) : PollOptions & {
34
+ poll?: true;
35
+ });
36
+ export type WatchBlocksReturnType = () => void;
37
+ /**
38
+ * Watches and returns information for incoming blocks.
39
+ *
40
+ * - Docs: https://viem.sh/docs/actions/public/watchBlocks.html
41
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks
42
+ * - JSON-RPC Methods:
43
+ * - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval.
44
+ * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
45
+ *
46
+ * @param client - Client to use
47
+ * @param parameters - {@link WatchBlocksParameters}
48
+ * @returns A function that can be invoked to stop watching for new block numbers. {@link WatchBlocksReturnType}
49
+ *
50
+ * @example
51
+ * import { createPublicClient, watchBlocks, http } from 'viem'
52
+ * import { mainnet } from 'viem/chains'
53
+ *
54
+ * const client = createPublicClient({
55
+ * chain: mainnet,
56
+ * transport: http(),
57
+ * })
58
+ * const unwatch = await watchBlocks(client, {
59
+ * onBlock: (block) => console.log(block),
60
+ * })
61
+ */
62
+ export declare function watchBlocks<TTransport extends Transport, TChain extends Chain | undefined>(client: PublicClient<TTransport, TChain>, { blockTag, emitMissed, emitOnBegin, onBlock, onError, includeTransactions, poll: poll_, pollingInterval, }: WatchBlocksParameters<TTransport, TChain>): WatchBlocksReturnType;
63
+ export {};
64
+ //# sourceMappingURL=watchBlocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchBlocks.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/watchBlocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAG/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAGvD,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,IACnE,kBAAkB,CAAC,MAAM,CAAC,CAAA;AAE5B,MAAM,MAAM,OAAO,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,IAAI,CAC9D,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAC/B,SAAS,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,KAC5C,IAAI,CAAA;AAET,KAAK,WAAW,GAAG;IACjB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,gEAAgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,oFAAoF;IACpF,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,kEAAkE;IAClE,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,kFAAkF;IAClF,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,qBAAqB,CAC/B,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,IACtC;IACF,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACxB,sFAAsF;IACtF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACjC,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,SAAS,WAAW,GAEvD;IACE,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAC3B,0GAA0G;IAC1G,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,eAAe,CAAC,EAAE,KAAK,CAAA;CACxB,GACD,CAAC,WAAW,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC,GACnC,WAAW,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC,CAAA;AAElC,MAAM,MAAM,qBAAqB,GAAG,MAAM,IAAI,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CACzB,UAAU,SAAS,SAAS,EAC5B,MAAM,SAAS,KAAK,GAAG,SAAS,EAEhC,MAAM,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,EACxC,EACE,QAAmB,EACnB,UAAkB,EAClB,WAAmB,EACnB,OAAO,EACP,OAAO,EACP,mBAA2B,EAC3B,IAAI,EAAE,KAAK,EACX,eAAwC,GACzC,EAAE,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,GAC3C,qBAAqB,CA8FvB"}
@@ -0,0 +1,55 @@
1
+ import type { Abi, ExtractAbiEvent, Narrow } from 'abitype';
2
+ import type { PublicClient, Transport } from '../../clients/index.js';
3
+ import type { Address, Chain, GetEventArgs, InferEventName, Log } from '../../types/index.js';
4
+ export type OnLogsParameter<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = TAbi extends Abi ? Log<bigint, number, ExtractAbiEvent<TAbi, TEventName>>[] : Log[];
5
+ export type OnLogsFn<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = (logs: OnLogsParameter<TAbi, TEventName>) => void;
6
+ export type WatchContractEventParameters<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = {
7
+ /** The address of the contract. */
8
+ address?: Address | Address[];
9
+ /** Contract ABI. */
10
+ abi: Narrow<TAbi>;
11
+ args?: GetEventArgs<TAbi, TEventName>;
12
+ /** Whether or not the event logs should be batched on each invocation. */
13
+ batch?: boolean;
14
+ /** Contract event. */
15
+ eventName?: InferEventName<TAbi, TEventName>;
16
+ /** The callback to call when an error occurred when trying to get for a new block. */
17
+ onError?: (error: Error) => void;
18
+ /** The callback to call when new event logs are received. */
19
+ onLogs: OnLogsFn<TAbi, TEventName>;
20
+ /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
21
+ pollingInterval?: number;
22
+ };
23
+ export type WatchContractEventReturnType = () => void;
24
+ /**
25
+ * Watches and returns emitted contract event logs.
26
+ *
27
+ * - Docs: https://viem.sh/docs/contract/watchContractEvent.html
28
+ *
29
+ * 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).
30
+ *
31
+ * `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.
32
+ *
33
+ * @param client - Client to use
34
+ * @param parameters - {@link WatchContractEventParameters}
35
+ * @returns A function that can be invoked to stop watching for new event logs. {@link WatchContractEventReturnType}
36
+ *
37
+ * @example
38
+ * import { createPublicClient, http, parseAbi } from 'viem'
39
+ * import { mainnet } from 'viem/chains'
40
+ * import { watchContractEvent } from 'viem/contract'
41
+ *
42
+ * const client = createPublicClient({
43
+ * chain: mainnet,
44
+ * transport: http(),
45
+ * })
46
+ * const unwatch = watchContractEvent(client, {
47
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
48
+ * abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']),
49
+ * eventName: 'Transfer',
50
+ * args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' },
51
+ * onLogs: (logs) => console.log(logs),
52
+ * })
53
+ */
54
+ export declare function watchContractEvent<TChain extends Chain | undefined, TAbi extends Abi | readonly unknown[], TEventName extends string>(client: PublicClient<Transport, TChain>, { abi, address, args, batch, eventName, onError, onLogs, pollingInterval, }: WatchContractEventParameters<TAbi, TEventName>): WatchContractEventReturnType;
55
+ //# sourceMappingURL=watchContractEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchContractEvent.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/watchContractEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,YAAY,EACZ,cAAc,EAEd,GAAG,EACJ,MAAM,sBAAsB,CAAA;AAa7B,MAAM,MAAM,eAAe,CACzB,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,SAAS,OAAO,EAAE,EAC1D,UAAU,SAAS,MAAM,GAAG,MAAM,IAChC,IAAI,SAAS,GAAG,GAChB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,EAAE,GACxD,GAAG,EAAE,CAAA;AACT,MAAM,MAAM,QAAQ,CAClB,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,SAAS,OAAO,EAAE,EAC1D,UAAU,SAAS,MAAM,GAAG,MAAM,IAChC,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,IAAI,CAAA;AAErD,MAAM,MAAM,4BAA4B,CACtC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,SAAS,OAAO,EAAE,EAC1D,UAAU,SAAS,MAAM,GAAG,MAAM,IAChC;IACF,mCAAmC;IACnC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAA;IAC7B,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IACjB,IAAI,CAAC,EAAE,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IACrC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,sBAAsB;IACtB,SAAS,CAAC,EAAE,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IAC5C,sFAAsF;IACtF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,6DAA6D;IAC7D,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IAClC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG,MAAM,IAAI,CAAA;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,EACrC,UAAU,SAAS,MAAM,EAEzB,MAAM,EAAE,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,EACvC,EACE,GAAG,EACH,OAAO,EACP,IAAI,EACJ,KAAY,EACZ,SAAS,EACT,OAAO,EACP,MAAM,EACN,eAAwC,GACzC,EAAE,4BAA4B,CAAC,IAAI,EAAE,UAAU,CAAC,GAChD,4BAA4B,CAoF9B"}
@@ -0,0 +1,61 @@
1
+ import type { AbiEvent } from 'abitype';
2
+ import type { PublicClient, Transport } from '../../clients/index.js';
3
+ import type { Address, Chain, Log, MaybeAbiEventName, MaybeExtractEventArgsFromAbi } from '../../types/index.js';
4
+ export type OnLogsParameter<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = Log<bigint, number, TAbiEvent, [TAbiEvent], TEventName>[];
5
+ export type OnLogsFn<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = (logs: OnLogsParameter<TAbiEvent, TEventName>) => void;
6
+ export type WatchEventParameters<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
7
+ /** The address of the contract. */
8
+ address?: Address | Address[];
9
+ /**
10
+ * Whether or not the event logs should be batched on each invocation.
11
+ * @default true
12
+ */
13
+ batch?: boolean;
14
+ /** The callback to call when an error occurred when trying to get for a new block. */
15
+ onError?: (error: Error) => void;
16
+ /** The callback to call when new event logs are received. */
17
+ onLogs: OnLogsFn<TAbiEvent, TEventName>;
18
+ /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
19
+ pollingInterval?: number;
20
+ } & ({
21
+ event: TAbiEvent;
22
+ args?: MaybeExtractEventArgsFromAbi<[TAbiEvent], TEventName>;
23
+ } | {
24
+ event?: never;
25
+ args?: never;
26
+ });
27
+ export type WatchEventReturnType = () => void;
28
+ /**
29
+ * Watches and returns emitted [Event Logs](https://viem.sh/docs/glossary/terms#event-log).
30
+ *
31
+ * - Docs: https://viem.sh/docs/actions/public/watchEvent.html
32
+ * - JSON-RPC Methods:
33
+ * - **RPC Provider supports `eth_newFilter`:**
34
+ * - Calls [`eth_newFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter) to create a filter (called on initialize).
35
+ * - On a polling interval, it will call [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges).
36
+ * - **RPC Provider does not support `eth_newFilter`:**
37
+ * - Calls [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) for each block between the polling interval.
38
+ *
39
+ * 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).
40
+ *
41
+ * `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.
42
+ *
43
+ * @param client - Client to use
44
+ * @param parameters - {@link WatchEventParameters}
45
+ * @returns A function that can be invoked to stop watching for new Event Logs. {@link WatchEventReturnType}
46
+ *
47
+ * @example
48
+ * import { createPublicClient, http } from 'viem'
49
+ * import { mainnet } from 'viem/chains'
50
+ * import { watchEvent } from 'viem/public'
51
+ *
52
+ * const client = createPublicClient({
53
+ * chain: mainnet,
54
+ * transport: http(),
55
+ * })
56
+ * const unwatch = watchEvent(client, {
57
+ * onLogs: (logs) => console.log(logs),
58
+ * })
59
+ */
60
+ export declare function watchEvent<TChain extends Chain | undefined, TAbiEvent extends AbiEvent | undefined, TEventName extends string | undefined>(client: PublicClient<Transport, TChain>, { address, args, batch, event, onError, onLogs, pollingInterval, }: WatchEventParameters<TAbiEvent>): WatchEventReturnType;
61
+ //# sourceMappingURL=watchEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchEvent.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/watchEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EAEL,GAAG,EACH,iBAAiB,EACjB,4BAA4B,EAC7B,MAAM,sBAAsB,CAAA;AAU7B,MAAM,MAAM,eAAe,CACzB,SAAS,SAAS,QAAQ,GAAG,SAAS,GAAG,SAAS,EAClD,UAAU,SAAS,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,IAClE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,EAAE,CAAA;AAC7D,MAAM,MAAM,QAAQ,CAClB,SAAS,SAAS,QAAQ,GAAG,SAAS,GAAG,SAAS,EAClD,UAAU,SAAS,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,IAClE,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,EAAE,UAAU,CAAC,KAAK,IAAI,CAAA;AAE1D,MAAM,MAAM,oBAAoB,CAC9B,SAAS,SAAS,QAAQ,GAAG,SAAS,GAAG,SAAS,EAClD,UAAU,SAAS,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC,IAClE;IACF,mCAAmC;IACnC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAA;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,sFAAsF;IACtF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,6DAA6D;IAC7D,MAAM,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IACvC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,GAAG,CACA;IACE,KAAK,EAAE,SAAS,CAAA;IAChB,IAAI,CAAC,EAAE,4BAA4B,CAAC,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,CAAA;CAC7D,GACD;IACE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,IAAI,CAAC,EAAE,KAAK,CAAA;CACb,CACJ,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,UAAU,CACxB,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,SAAS,SAAS,QAAQ,GAAG,SAAS,EACtC,UAAU,SAAS,MAAM,GAAG,SAAS,EAErC,MAAM,EAAE,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,EACvC,EACE,OAAO,EACP,IAAI,EACJ,KAAY,EACZ,KAAK,EACL,OAAO,EACP,MAAM,EACN,eAAwC,GACzC,EAAE,oBAAoB,CAAC,SAAS,CAAC,GACjC,oBAAoB,CAgFtB"}
@@ -0,0 +1,71 @@
1
+ import type { PublicClient, Transport } from '../../clients/index.js';
2
+ import type { Chain, GetTransportConfig, Hash } from '../../types/index.js';
3
+ export type OnTransactionsParameter = Hash[];
4
+ export type OnTransactionsFn = (transactions: OnTransactionsParameter) => void;
5
+ type PollOptions = {
6
+ /**
7
+ * Whether or not the transaction hashes should be batched on each invocation.
8
+ * @default true
9
+ */
10
+ batch?: boolean;
11
+ /**
12
+ * Polling frequency (in ms). Defaults to Client's pollingInterval config.
13
+ * @default client.pollingInterval
14
+ */
15
+ pollingInterval?: number;
16
+ };
17
+ export type WatchPendingTransactionsParameters<TTransport extends Transport = Transport> = {
18
+ /** The callback to call when an error occurred when trying to get for a new block. */
19
+ onError?: (error: Error) => void;
20
+ /** The callback to call when new transactions are received. */
21
+ onTransactions: OnTransactionsFn;
22
+ } & (GetTransportConfig<TTransport>['type'] extends 'webSocket' ? {
23
+ batch?: never;
24
+ /**
25
+ * Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`.
26
+ * @default false
27
+ */
28
+ poll?: false;
29
+ pollingInterval?: never;
30
+ } | (PollOptions & {
31
+ /**
32
+ * Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`.
33
+ * @default true
34
+ */
35
+ poll?: true;
36
+ }) : PollOptions & {
37
+ poll?: true;
38
+ });
39
+ export type WatchPendingTransactionsReturnType = () => void;
40
+ /**
41
+ * Watches and returns pending transaction hashes.
42
+ *
43
+ * - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions.html
44
+ * - JSON-RPC Methods:
45
+ * - When `poll: true`
46
+ * - Calls [`eth_newPendingTransactionFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newpendingtransactionfilter) to initialize the filter.
47
+ * - Calls [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getFilterChanges) on a polling interval.
48
+ * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newPendingTransactions"` event.
49
+ *
50
+ * 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).
51
+ *
52
+ * @param client - Client to use
53
+ * @param parameters - {@link WatchPendingTransactionsParameters}
54
+ * @returns A function that can be invoked to stop watching for new pending transaction hashes. {@link WatchPendingTransactionsReturnType}
55
+ *
56
+ * @example
57
+ * import { createPublicClient, http } from 'viem'
58
+ * import { mainnet } from 'viem/chains'
59
+ * import { watchPendingTransactions } from 'viem/public'
60
+ *
61
+ * const client = createPublicClient({
62
+ * chain: mainnet,
63
+ * transport: http(),
64
+ * })
65
+ * const unwatch = await watchPendingTransactions(client, {
66
+ * onTransactions: (hashes) => console.log(hashes),
67
+ * })
68
+ */
69
+ export declare function watchPendingTransactions<TTransport extends Transport, TChain extends Chain | undefined>(client: PublicClient<TTransport, TChain>, { batch, onError, onTransactions, poll: poll_, pollingInterval, }: WatchPendingTransactionsParameters<TTransport>): () => void;
70
+ export {};
71
+ //# sourceMappingURL=watchPendingTransactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchPendingTransactions.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/watchPendingTransactions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,KAAK,EACV,KAAK,EAEL,kBAAkB,EAClB,IAAI,EACL,MAAM,sBAAsB,CAAA;AAO7B,MAAM,MAAM,uBAAuB,GAAG,IAAI,EAAE,CAAA;AAC5C,MAAM,MAAM,gBAAgB,GAAG,CAAC,YAAY,EAAE,uBAAuB,KAAK,IAAI,CAAA;AAE9E,KAAK,WAAW,GAAG;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,kCAAkC,CAC5C,UAAU,SAAS,SAAS,GAAG,SAAS,IACtC;IACF,sFAAsF;IACtF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,+DAA+D;IAC/D,cAAc,EAAE,gBAAgB,CAAA;CACjC,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,SAAS,WAAW,GAEvD;IACE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,eAAe,CAAC,EAAE,KAAK,CAAA;CACxB,GACD,CAAC,WAAW,GAAG;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAC,GACN,WAAW,GAAG;IACZ,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAC,CAAA;AAEN,MAAM,MAAM,kCAAkC,GAAG,MAAM,IAAI,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,SAAS,SAAS,EAC5B,MAAM,SAAS,KAAK,GAAG,SAAS,EAEhC,MAAM,EAAE,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,EACxC,EACE,KAAY,EACZ,OAAO,EACP,cAAc,EACd,IAAI,EAAE,KAAK,EACX,eAAwC,GACzC,EAAE,kCAAkC,CAAC,UAAU,CAAC,cA6ElD"}
@@ -0,0 +1,30 @@
1
+ import type { TestClient, TestClientMode, Transport } from '../../clients/index.js';
2
+ import type { Chain, Hash } from '../../types/index.js';
3
+ export type DropTransactionParameters = {
4
+ /** The hash of the transaction to drop. */
5
+ hash: Hash;
6
+ };
7
+ /**
8
+ * Removes a transaction from the mempool.
9
+ *
10
+ * - Docs: https://viem.sh/docs/actions/test/dropTransaction.html
11
+ *
12
+ * @param client - Client to use
13
+ * @param parameters - {@link DropTransactionParameters}
14
+ *
15
+ * @example
16
+ * import { createTestClient, http } from 'viem'
17
+ * import { foundry } from 'viem/chains'
18
+ * import { dropTransaction } from 'viem/test'
19
+ *
20
+ * const client = createTestClient({
21
+ * mode: 'anvil',
22
+ * chain: 'foundry',
23
+ * transport: http(),
24
+ * })
25
+ * await dropTransaction(client, {
26
+ * hash: '0xe58dceb6b20b03965bb678e27d141e151d7d4efc2334c2d6a49b9fac523f7364'
27
+ * })
28
+ */
29
+ export declare function dropTransaction<TChain extends Chain | undefined>(client: TestClient<TestClientMode, Transport, TChain>, { hash }: DropTransactionParameters): Promise<void>;
30
+ //# sourceMappingURL=dropTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropTransaction.d.ts","sourceRoot":"","sources":["../../../../src/actions/test/dropTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACV,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,MAAM,yBAAyB,GAAG;IACtC,2CAA2C;IAC3C,IAAI,EAAE,IAAI,CAAA;CACX,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,eAAe,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,EACpE,MAAM,EAAE,UAAU,CAAC,cAAc,EAAE,SAAS,EAAE,MAAM,CAAC,EACrD,EAAE,IAAI,EAAE,EAAE,yBAAyB,iBAMpC"}
@@ -0,0 +1,25 @@
1
+ import type { TestClient, TestClientMode, Transport } from '../../clients/index.js';
2
+ import type { Chain } from '../../types/index.js';
3
+ export type GetAutomineReturnType = boolean;
4
+ /**
5
+ * Returns the automatic mining status of the node.
6
+ *
7
+ * - Docs: https://viem.sh/docs/actions/test/getAutomine.html
8
+ *
9
+ * @param client - Client to use
10
+ * @returns Whether or not the node is auto mining. {@link GetAutomineReturnType}
11
+ *
12
+ * @example
13
+ * import { createTestClient, http } from 'viem'
14
+ * import { foundry } from 'viem/chains'
15
+ * import { getAutomine } from 'viem/test'
16
+ *
17
+ * const client = createTestClient({
18
+ * mode: 'anvil',
19
+ * chain: 'foundry',
20
+ * transport: http(),
21
+ * })
22
+ * const isAutomining = await getAutomine(client)
23
+ */
24
+ export declare function getAutomine<TChain extends Chain | undefined>(client: TestClient<TestClientMode, Transport, TChain>): Promise<GetAutomineReturnType>;
25
+ //# sourceMappingURL=getAutomine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAutomine.d.ts","sourceRoot":"","sources":["../../../../src/actions/test/getAutomine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,SAAS,EACV,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAEjD,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChE,MAAM,EAAE,UAAU,CAAC,cAAc,EAAE,SAAS,EAAE,MAAM,CAAC,GACpD,OAAO,CAAC,qBAAqB,CAAC,CAIhC"}