viem 1.6.6 → 1.6.7

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 (583) hide show
  1. package/chains/dist/cjs/celo/formatters.js +58 -0
  2. package/chains/dist/cjs/celo/parsers.js +72 -0
  3. package/chains/dist/cjs/celo/serializers.js +75 -0
  4. package/chains/dist/cjs/celo/types.js +3 -0
  5. package/chains/dist/cjs/index.js +135 -0
  6. package/chains/dist/cjs/optimism/fees.js +7 -0
  7. package/chains/dist/cjs/optimism/formatters.js +52 -0
  8. package/chains/dist/cjs/optimism/types.js +3 -0
  9. package/chains/dist/cjs/types.js +3 -0
  10. package/chains/dist/cjs/utils.js +49 -0
  11. package/chains/dist/tsconfig.build.tsbuildinfo +1 -1
  12. package/dist/cjs/errors/version.js +1 -1
  13. package/dist/esm/errors/version.js +1 -1
  14. package/dist/types/abi.d.ts +6 -0
  15. package/dist/types/abi.d.ts.map +1 -0
  16. package/dist/types/accounts/generateMnemonic.d.ts +9 -0
  17. package/dist/types/accounts/generateMnemonic.d.ts.map +1 -0
  18. package/dist/types/accounts/generatePrivateKey.d.ts +8 -0
  19. package/dist/types/accounts/generatePrivateKey.d.ts.map +1 -0
  20. package/dist/types/accounts/hdKeyToAccount.d.ts +9 -0
  21. package/dist/types/accounts/hdKeyToAccount.d.ts.map +1 -0
  22. package/dist/types/accounts/index.d.ts +27 -0
  23. package/dist/types/accounts/index.d.ts.map +1 -0
  24. package/dist/types/accounts/mnemonicToAccount.d.ts +8 -0
  25. package/dist/types/accounts/mnemonicToAccount.d.ts.map +1 -0
  26. package/dist/types/accounts/privateKeyToAccount.d.ts +9 -0
  27. package/dist/types/accounts/privateKeyToAccount.d.ts.map +1 -0
  28. package/dist/types/accounts/toAccount.d.ts +11 -0
  29. package/dist/types/accounts/toAccount.d.ts.map +1 -0
  30. package/dist/types/accounts/types.d.ts +52 -0
  31. package/dist/types/accounts/types.d.ts.map +1 -0
  32. package/dist/types/accounts/utils/parseAccount.d.ts +4 -0
  33. package/dist/types/accounts/utils/parseAccount.d.ts.map +1 -0
  34. package/dist/types/accounts/utils/privateKeyToAddress.d.ts +11 -0
  35. package/dist/types/accounts/utils/privateKeyToAddress.d.ts.map +1 -0
  36. package/dist/types/accounts/utils/publicKeyToAddress.d.ts +11 -0
  37. package/dist/types/accounts/utils/publicKeyToAddress.d.ts.map +1 -0
  38. package/dist/types/accounts/utils/sign.d.ts +16 -0
  39. package/dist/types/accounts/utils/sign.d.ts.map +1 -0
  40. package/dist/types/accounts/utils/signMessage.d.ts +16 -0
  41. package/dist/types/accounts/utils/signMessage.d.ts.map +1 -0
  42. package/dist/types/accounts/utils/signTransaction.d.ts +12 -0
  43. package/dist/types/accounts/utils/signTransaction.d.ts.map +1 -0
  44. package/dist/types/accounts/utils/signTypedData.d.ts +20 -0
  45. package/dist/types/accounts/utils/signTypedData.d.ts.map +1 -0
  46. package/dist/types/accounts/wordlists/czech.d.ts +2 -0
  47. package/dist/types/accounts/wordlists/czech.d.ts.map +1 -0
  48. package/dist/types/accounts/wordlists/english.d.ts +2 -0
  49. package/dist/types/accounts/wordlists/english.d.ts.map +1 -0
  50. package/dist/types/accounts/wordlists/french.d.ts +2 -0
  51. package/dist/types/accounts/wordlists/french.d.ts.map +1 -0
  52. package/dist/types/accounts/wordlists/italian.d.ts +2 -0
  53. package/dist/types/accounts/wordlists/italian.d.ts.map +1 -0
  54. package/dist/types/accounts/wordlists/japanese.d.ts +2 -0
  55. package/dist/types/accounts/wordlists/japanese.d.ts.map +1 -0
  56. package/dist/types/accounts/wordlists/korean.d.ts +2 -0
  57. package/dist/types/accounts/wordlists/korean.d.ts.map +1 -0
  58. package/dist/types/accounts/wordlists/simplifiedChinese.d.ts +2 -0
  59. package/dist/types/accounts/wordlists/simplifiedChinese.d.ts.map +1 -0
  60. package/dist/types/accounts/wordlists/spanish.d.ts +2 -0
  61. package/dist/types/accounts/wordlists/spanish.d.ts.map +1 -0
  62. package/dist/types/accounts/wordlists/traditionalChinese.d.ts +2 -0
  63. package/dist/types/accounts/wordlists/traditionalChinese.d.ts.map +1 -0
  64. package/dist/types/actions/ens/getEnsAddress.d.ts +45 -0
  65. package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -0
  66. package/dist/types/actions/ens/getEnsAvatar.d.ts +41 -0
  67. package/dist/types/actions/ens/getEnsAvatar.d.ts.map +1 -0
  68. package/dist/types/actions/ens/getEnsName.d.ts +41 -0
  69. package/dist/types/actions/ens/getEnsName.d.ts.map +1 -0
  70. package/dist/types/actions/ens/getEnsResolver.d.ts +43 -0
  71. package/dist/types/actions/ens/getEnsResolver.d.ts.map +1 -0
  72. package/dist/types/actions/ens/getEnsText.d.ts +46 -0
  73. package/dist/types/actions/ens/getEnsText.d.ts.map +1 -0
  74. package/dist/types/actions/getContract.d.ts +314 -0
  75. package/dist/types/actions/getContract.d.ts.map +1 -0
  76. package/dist/types/actions/index.d.ts +80 -0
  77. package/dist/types/actions/index.d.ts.map +1 -0
  78. package/dist/types/actions/public/call.d.ts +56 -0
  79. package/dist/types/actions/public/call.d.ts.map +1 -0
  80. package/dist/types/actions/public/createBlockFilter.d.ts +28 -0
  81. package/dist/types/actions/public/createBlockFilter.d.ts.map +1 -0
  82. package/dist/types/actions/public/createContractEventFilter.d.ts +50 -0
  83. package/dist/types/actions/public/createContractEventFilter.d.ts.map +1 -0
  84. package/dist/types/actions/public/createEventFilter.d.ts +76 -0
  85. package/dist/types/actions/public/createEventFilter.d.ts.map +1 -0
  86. package/dist/types/actions/public/createPendingTransactionFilter.d.ts +28 -0
  87. package/dist/types/actions/public/createPendingTransactionFilter.d.ts.map +1 -0
  88. package/dist/types/actions/public/estimateContractGas.d.ts +39 -0
  89. package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -0
  90. package/dist/types/actions/public/estimateGas.d.ts +49 -0
  91. package/dist/types/actions/public/estimateGas.d.ts.map +1 -0
  92. package/dist/types/actions/public/getBalance.d.ts +55 -0
  93. package/dist/types/actions/public/getBalance.d.ts.map +1 -0
  94. package/dist/types/actions/public/getBlock.d.ts +56 -0
  95. package/dist/types/actions/public/getBlock.d.ts.map +1 -0
  96. package/dist/types/actions/public/getBlockNumber.d.ts +57 -0
  97. package/dist/types/actions/public/getBlockNumber.d.ts.map +1 -0
  98. package/dist/types/actions/public/getBlockTransactionCount.d.ts +47 -0
  99. package/dist/types/actions/public/getBlockTransactionCount.d.ts.map +1 -0
  100. package/dist/types/actions/public/getBytecode.d.ts +41 -0
  101. package/dist/types/actions/public/getBytecode.d.ts.map +1 -0
  102. package/dist/types/actions/public/getChainId.d.ts +28 -0
  103. package/dist/types/actions/public/getChainId.d.ts.map +1 -0
  104. package/dist/types/actions/public/getFeeHistory.d.ts +53 -0
  105. package/dist/types/actions/public/getFeeHistory.d.ts.map +1 -0
  106. package/dist/types/actions/public/getFilterChanges.d.ts +96 -0
  107. package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -0
  108. package/dist/types/actions/public/getFilterLogs.d.ts +40 -0
  109. package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -0
  110. package/dist/types/actions/public/getGasPrice.d.ts +27 -0
  111. package/dist/types/actions/public/getGasPrice.d.ts.map +1 -0
  112. package/dist/types/actions/public/getLogs.d.ts +71 -0
  113. package/dist/types/actions/public/getLogs.d.ts.map +1 -0
  114. package/dist/types/actions/public/getStorageAt.d.ts +43 -0
  115. package/dist/types/actions/public/getStorageAt.d.ts.map +1 -0
  116. package/dist/types/actions/public/getTransaction.d.ts +65 -0
  117. package/dist/types/actions/public/getTransaction.d.ts.map +1 -0
  118. package/dist/types/actions/public/getTransactionConfirmations.d.ts +41 -0
  119. package/dist/types/actions/public/getTransactionConfirmations.d.ts.map +1 -0
  120. package/dist/types/actions/public/getTransactionCount.d.ts +44 -0
  121. package/dist/types/actions/public/getTransactionCount.d.ts.map +1 -0
  122. package/dist/types/actions/public/getTransactionReceipt.d.ts +36 -0
  123. package/dist/types/actions/public/getTransactionReceipt.d.ts.map +1 -0
  124. package/dist/types/actions/public/multicall.d.ts +56 -0
  125. package/dist/types/actions/public/multicall.d.ts.map +1 -0
  126. package/dist/types/actions/public/readContract.d.ts +41 -0
  127. package/dist/types/actions/public/readContract.d.ts.map +1 -0
  128. package/dist/types/actions/public/simulateContract.d.ts +54 -0
  129. package/dist/types/actions/public/simulateContract.d.ts.map +1 -0
  130. package/dist/types/actions/public/uninstallFilter.d.ts +34 -0
  131. package/dist/types/actions/public/uninstallFilter.d.ts.map +1 -0
  132. package/dist/types/actions/public/verifyHash.d.ts +24 -0
  133. package/dist/types/actions/public/verifyHash.d.ts.map +1 -0
  134. package/dist/types/actions/public/verifyMessage.d.ts +28 -0
  135. package/dist/types/actions/public/verifyMessage.d.ts.map +1 -0
  136. package/dist/types/actions/public/verifyTypedData.d.ts +27 -0
  137. package/dist/types/actions/public/verifyTypedData.d.ts.map +1 -0
  138. package/dist/types/actions/public/waitForTransactionReceipt.d.ts +72 -0
  139. package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -0
  140. package/dist/types/actions/public/watchBlockNumber.d.ts +59 -0
  141. package/dist/types/actions/public/watchBlockNumber.d.ts.map +1 -0
  142. package/dist/types/actions/public/watchBlocks.d.ts +67 -0
  143. package/dist/types/actions/public/watchBlocks.d.ts.map +1 -0
  144. package/dist/types/actions/public/watchContractEvent.d.ts +89 -0
  145. package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -0
  146. package/dist/types/actions/public/watchEvent.d.ts +104 -0
  147. package/dist/types/actions/public/watchEvent.d.ts.map +1 -0
  148. package/dist/types/actions/public/watchPendingTransactions.d.ts +74 -0
  149. package/dist/types/actions/public/watchPendingTransactions.d.ts.map +1 -0
  150. package/dist/types/actions/test/dropTransaction.d.ts +33 -0
  151. package/dist/types/actions/test/dropTransaction.d.ts.map +1 -0
  152. package/dist/types/actions/test/getAutomine.d.ts +27 -0
  153. package/dist/types/actions/test/getAutomine.d.ts.map +1 -0
  154. package/dist/types/actions/test/getTxpoolContent.d.ts +34 -0
  155. package/dist/types/actions/test/getTxpoolContent.d.ts.map +1 -0
  156. package/dist/types/actions/test/getTxpoolStatus.d.ts +30 -0
  157. package/dist/types/actions/test/getTxpoolStatus.d.ts.map +1 -0
  158. package/dist/types/actions/test/impersonateAccount.d.ts +33 -0
  159. package/dist/types/actions/test/impersonateAccount.d.ts.map +1 -0
  160. package/dist/types/actions/test/increaseTime.d.ts +32 -0
  161. package/dist/types/actions/test/increaseTime.d.ts.map +1 -0
  162. package/dist/types/actions/test/inspectTxpool.d.ts +31 -0
  163. package/dist/types/actions/test/inspectTxpool.d.ts.map +1 -0
  164. package/dist/types/actions/test/mine.d.ts +32 -0
  165. package/dist/types/actions/test/mine.d.ts.map +1 -0
  166. package/dist/types/actions/test/removeBlockTimestampInterval.d.ts +25 -0
  167. package/dist/types/actions/test/removeBlockTimestampInterval.d.ts.map +1 -0
  168. package/dist/types/actions/test/reset.d.ts +32 -0
  169. package/dist/types/actions/test/reset.d.ts.map +1 -0
  170. package/dist/types/actions/test/revert.d.ts +31 -0
  171. package/dist/types/actions/test/revert.d.ts.map +1 -0
  172. package/dist/types/actions/test/sendUnsignedTransaction.d.ts +35 -0
  173. package/dist/types/actions/test/sendUnsignedTransaction.d.ts.map +1 -0
  174. package/dist/types/actions/test/setAutomine.d.ts +25 -0
  175. package/dist/types/actions/test/setAutomine.d.ts.map +1 -0
  176. package/dist/types/actions/test/setBalance.d.ts +36 -0
  177. package/dist/types/actions/test/setBalance.d.ts.map +1 -0
  178. package/dist/types/actions/test/setBlockGasLimit.d.ts +30 -0
  179. package/dist/types/actions/test/setBlockGasLimit.d.ts.map +1 -0
  180. package/dist/types/actions/test/setBlockTimestampInterval.d.ts +30 -0
  181. package/dist/types/actions/test/setBlockTimestampInterval.d.ts.map +1 -0
  182. package/dist/types/actions/test/setCode.d.ts +37 -0
  183. package/dist/types/actions/test/setCode.d.ts.map +1 -0
  184. package/dist/types/actions/test/setCoinbase.d.ts +33 -0
  185. package/dist/types/actions/test/setCoinbase.d.ts.map +1 -0
  186. package/dist/types/actions/test/setIntervalMining.d.ts +30 -0
  187. package/dist/types/actions/test/setIntervalMining.d.ts.map +1 -0
  188. package/dist/types/actions/test/setLoggingEnabled.d.ts +25 -0
  189. package/dist/types/actions/test/setLoggingEnabled.d.ts.map +1 -0
  190. package/dist/types/actions/test/setMinGasPrice.d.ts +34 -0
  191. package/dist/types/actions/test/setMinGasPrice.d.ts.map +1 -0
  192. package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts +32 -0
  193. package/dist/types/actions/test/setNextBlockBaseFeePerGas.d.ts.map +1 -0
  194. package/dist/types/actions/test/setNextBlockTimestamp.d.ts +30 -0
  195. package/dist/types/actions/test/setNextBlockTimestamp.d.ts.map +1 -0
  196. package/dist/types/actions/test/setNonce.d.ts +36 -0
  197. package/dist/types/actions/test/setNonce.d.ts.map +1 -0
  198. package/dist/types/actions/test/setRpcUrl.d.ts +26 -0
  199. package/dist/types/actions/test/setRpcUrl.d.ts.map +1 -0
  200. package/dist/types/actions/test/setStorageAt.d.ts +40 -0
  201. package/dist/types/actions/test/setStorageAt.d.ts.map +1 -0
  202. package/dist/types/actions/test/snapshot.d.ts +25 -0
  203. package/dist/types/actions/test/snapshot.d.ts.map +1 -0
  204. package/dist/types/actions/test/stopImpersonatingAccount.d.ts +33 -0
  205. package/dist/types/actions/test/stopImpersonatingAccount.d.ts.map +1 -0
  206. package/dist/types/actions/wallet/addChain.d.ts +29 -0
  207. package/dist/types/actions/wallet/addChain.d.ts.map +1 -0
  208. package/dist/types/actions/wallet/deployContract.d.ts +43 -0
  209. package/dist/types/actions/wallet/deployContract.d.ts.map +1 -0
  210. package/dist/types/actions/wallet/getAddresses.d.ts +28 -0
  211. package/dist/types/actions/wallet/getAddresses.d.ts.map +1 -0
  212. package/dist/types/actions/wallet/getPermissions.d.ts +28 -0
  213. package/dist/types/actions/wallet/getPermissions.d.ts.map +1 -0
  214. package/dist/types/actions/wallet/requestAddresses.d.ts +32 -0
  215. package/dist/types/actions/wallet/requestAddresses.d.ts.map +1 -0
  216. package/dist/types/actions/wallet/requestPermissions.d.ts +37 -0
  217. package/dist/types/actions/wallet/requestPermissions.d.ts.map +1 -0
  218. package/dist/types/actions/wallet/sendTransaction.d.ts +57 -0
  219. package/dist/types/actions/wallet/sendTransaction.d.ts.map +1 -0
  220. package/dist/types/actions/wallet/signMessage.d.ts +58 -0
  221. package/dist/types/actions/wallet/signMessage.d.ts.map +1 -0
  222. package/dist/types/actions/wallet/signTypedData.d.ts +114 -0
  223. package/dist/types/actions/wallet/signTypedData.d.ts.map +1 -0
  224. package/dist/types/actions/wallet/switchChain.d.ts +30 -0
  225. package/dist/types/actions/wallet/switchChain.d.ts.map +1 -0
  226. package/dist/types/actions/wallet/watchAsset.d.ts +37 -0
  227. package/dist/types/actions/wallet/watchAsset.d.ts.map +1 -0
  228. package/dist/types/actions/wallet/writeContract.d.ts +68 -0
  229. package/dist/types/actions/wallet/writeContract.d.ts.map +1 -0
  230. package/dist/types/chains/celo/formatters.d.ts +195 -0
  231. package/dist/types/chains/celo/formatters.d.ts.map +1 -0
  232. package/dist/types/chains/celo/parsers.d.ts +6 -0
  233. package/dist/types/chains/celo/parsers.d.ts.map +1 -0
  234. package/dist/types/chains/celo/serializers.d.ts +9 -0
  235. package/dist/types/chains/celo/serializers.d.ts.map +1 -0
  236. package/dist/types/chains/celo/types.d.ts +74 -0
  237. package/dist/types/chains/celo/types.d.ts.map +1 -0
  238. package/dist/types/chains/index.d.ts +5329 -0
  239. package/dist/types/chains/index.d.ts.map +1 -0
  240. package/dist/types/chains/optimism/fees.d.ts +4 -0
  241. package/dist/types/chains/optimism/fees.d.ts.map +1 -0
  242. package/dist/types/chains/optimism/formatters.d.ts +299 -0
  243. package/dist/types/chains/optimism/formatters.d.ts.map +1 -0
  244. package/dist/types/chains/optimism/types.d.ts +53 -0
  245. package/dist/types/chains/optimism/types.d.ts.map +1 -0
  246. package/dist/types/chains/utils.d.ts +7 -0
  247. package/dist/types/chains/utils.d.ts.map +1 -0
  248. package/dist/types/clients/createClient.d.ts +79 -0
  249. package/dist/types/clients/createClient.d.ts.map +1 -0
  250. package/dist/types/clients/createPublicClient.d.ts +29 -0
  251. package/dist/types/clients/createPublicClient.d.ts.map +1 -0
  252. package/dist/types/clients/createTestClient.d.ts +43 -0
  253. package/dist/types/clients/createTestClient.d.ts.map +1 -0
  254. package/dist/types/clients/createWalletClient.d.ts +49 -0
  255. package/dist/types/clients/createWalletClient.d.ts.map +1 -0
  256. package/dist/types/clients/decorators/public.d.ts +1087 -0
  257. package/dist/types/clients/decorators/public.d.ts.map +1 -0
  258. package/dist/types/clients/decorators/test.d.ts +599 -0
  259. package/dist/types/clients/decorators/test.d.ts.map +1 -0
  260. package/dist/types/clients/decorators/wallet.d.ts +449 -0
  261. package/dist/types/clients/decorators/wallet.d.ts.map +1 -0
  262. package/dist/types/clients/transports/createTransport.d.ts +34 -0
  263. package/dist/types/clients/transports/createTransport.d.ts.map +1 -0
  264. package/dist/types/clients/transports/custom.d.ts +21 -0
  265. package/dist/types/clients/transports/custom.d.ts.map +1 -0
  266. package/dist/types/clients/transports/fallback.d.ts +75 -0
  267. package/dist/types/clients/transports/fallback.d.ts.map +1 -0
  268. package/dist/types/clients/transports/http.d.ts +40 -0
  269. package/dist/types/clients/transports/http.d.ts.map +1 -0
  270. package/dist/types/clients/transports/webSocket.d.ts +46 -0
  271. package/dist/types/clients/transports/webSocket.d.ts.map +1 -0
  272. package/dist/types/constants/abis.d.ts +165 -0
  273. package/dist/types/constants/abis.d.ts.map +1 -0
  274. package/dist/types/constants/address.d.ts +2 -0
  275. package/dist/types/constants/address.d.ts.map +1 -0
  276. package/dist/types/constants/contract.d.ts +2 -0
  277. package/dist/types/constants/contract.d.ts.map +1 -0
  278. package/dist/types/constants/contracts.d.ts +2 -0
  279. package/dist/types/constants/contracts.d.ts.map +1 -0
  280. package/dist/types/constants/number.d.ts +97 -0
  281. package/dist/types/constants/number.d.ts.map +1 -0
  282. package/dist/types/constants/solidity.d.ts +15 -0
  283. package/dist/types/constants/solidity.d.ts.map +1 -0
  284. package/dist/types/constants/unit.d.ts +13 -0
  285. package/dist/types/constants/unit.d.ts.map +1 -0
  286. package/dist/types/contract.d.ts +30 -0
  287. package/dist/types/contract.d.ts.map +1 -0
  288. package/dist/types/ens.d.ts +9 -0
  289. package/dist/types/ens.d.ts.map +1 -0
  290. package/dist/types/errors/abi.d.ts +169 -0
  291. package/dist/types/errors/abi.d.ts.map +1 -0
  292. package/dist/types/errors/account.d.ts +8 -0
  293. package/dist/types/errors/account.d.ts.map +1 -0
  294. package/dist/types/errors/address.d.ts +8 -0
  295. package/dist/types/errors/address.d.ts.map +1 -0
  296. package/dist/types/errors/base.d.ts +24 -0
  297. package/dist/types/errors/base.d.ts.map +1 -0
  298. package/dist/types/errors/block.d.ts +10 -0
  299. package/dist/types/errors/block.d.ts.map +1 -0
  300. package/dist/types/errors/ccip.d.ts +29 -0
  301. package/dist/types/errors/ccip.d.ts.map +1 -0
  302. package/dist/types/errors/chain.d.ts +35 -0
  303. package/dist/types/errors/chain.d.ts.map +1 -0
  304. package/dist/types/errors/contract.d.ts +64 -0
  305. package/dist/types/errors/contract.d.ts.map +1 -0
  306. package/dist/types/errors/data.d.ts +18 -0
  307. package/dist/types/errors/data.d.ts.map +1 -0
  308. package/dist/types/errors/encoding.d.ts +53 -0
  309. package/dist/types/errors/encoding.d.ts.map +1 -0
  310. package/dist/types/errors/ens.d.ts +26 -0
  311. package/dist/types/errors/ens.d.ts.map +1 -0
  312. package/dist/types/errors/estimateGas.d.ts +14 -0
  313. package/dist/types/errors/estimateGas.d.ts.map +1 -0
  314. package/dist/types/errors/log.d.ts +6 -0
  315. package/dist/types/errors/log.d.ts.map +1 -0
  316. package/dist/types/errors/node.d.ts +105 -0
  317. package/dist/types/errors/node.d.ts.map +1 -0
  318. package/dist/types/errors/request.d.ts +61 -0
  319. package/dist/types/errors/request.d.ts.map +1 -0
  320. package/dist/types/errors/rpc.d.ts +221 -0
  321. package/dist/types/errors/rpc.d.ts.map +1 -0
  322. package/dist/types/errors/transaction.d.ts +79 -0
  323. package/dist/types/errors/transaction.d.ts.map +1 -0
  324. package/dist/types/errors/transport.d.ts +5 -0
  325. package/dist/types/errors/transport.d.ts.map +1 -0
  326. package/dist/types/errors/utils.d.ts +5 -0
  327. package/dist/types/errors/utils.d.ts.map +1 -0
  328. package/dist/types/errors/version.d.ts +2 -0
  329. package/dist/types/errors/version.d.ts.map +1 -0
  330. package/dist/types/index.d.ts +211 -0
  331. package/dist/types/index.d.ts.map +1 -0
  332. package/dist/types/public.d.ts +31 -0
  333. package/dist/types/public.d.ts.map +1 -0
  334. package/dist/types/test.d.ts +29 -0
  335. package/dist/types/test.d.ts.map +1 -0
  336. package/dist/types/types/account.d.ts +12 -0
  337. package/dist/types/types/account.d.ts.map +1 -0
  338. package/dist/types/types/block.d.ts +62 -0
  339. package/dist/types/types/block.d.ts.map +1 -0
  340. package/dist/types/types/chain.d.ts +62 -0
  341. package/dist/types/types/chain.d.ts.map +1 -0
  342. package/dist/types/types/contract.d.ts +138 -0
  343. package/dist/types/types/contract.d.ts.map +1 -0
  344. package/dist/types/types/eip1193.d.ts +1216 -0
  345. package/dist/types/types/eip1193.d.ts.map +1 -0
  346. package/dist/types/types/ens.d.ts +5 -0
  347. package/dist/types/types/ens.d.ts.map +1 -0
  348. package/dist/types/types/fee.d.ts +29 -0
  349. package/dist/types/types/fee.d.ts.map +1 -0
  350. package/dist/types/types/filter.d.ts +40 -0
  351. package/dist/types/types/filter.d.ts.map +1 -0
  352. package/dist/types/types/log.d.ts +55 -0
  353. package/dist/types/types/log.d.ts.map +1 -0
  354. package/dist/types/types/misc.d.ts +14 -0
  355. package/dist/types/types/misc.d.ts.map +1 -0
  356. package/dist/types/types/multicall.d.ts +48 -0
  357. package/dist/types/types/multicall.d.ts.map +1 -0
  358. package/dist/types/types/rpc.d.ts +20 -0
  359. package/dist/types/types/rpc.d.ts.map +1 -0
  360. package/dist/types/types/transaction.d.ts +147 -0
  361. package/dist/types/types/transaction.d.ts.map +1 -0
  362. package/dist/types/types/transport.d.ts +3 -0
  363. package/dist/types/types/transport.d.ts.map +1 -0
  364. package/dist/types/types/typedData.d.ts +47 -0
  365. package/dist/types/types/typedData.d.ts.map +1 -0
  366. package/dist/types/types/utils.d.ts +188 -0
  367. package/dist/types/types/utils.d.ts.map +1 -0
  368. package/dist/types/types/window.d.ts +7 -0
  369. package/dist/types/types/window.d.ts.map +1 -0
  370. package/dist/types/utils/abi/decodeAbiParameters.d.ts +5 -0
  371. package/dist/types/utils/abi/decodeAbiParameters.d.ts.map +1 -0
  372. package/dist/types/utils/abi/decodeDeployData.d.ts +13 -0
  373. package/dist/types/utils/abi/decodeDeployData.d.ts.map +1 -0
  374. package/dist/types/utils/abi/decodeErrorResult.d.ts +16 -0
  375. package/dist/types/utils/abi/decodeErrorResult.d.ts.map +1 -0
  376. package/dist/types/utils/abi/decodeEventLog.d.ts +20 -0
  377. package/dist/types/utils/abi/decodeEventLog.d.ts.map +1 -0
  378. package/dist/types/utils/abi/decodeFunctionData.d.ts +15 -0
  379. package/dist/types/utils/abi/decodeFunctionData.d.ts.map +1 -0
  380. package/dist/types/utils/abi/decodeFunctionResult.d.ts +14 -0
  381. package/dist/types/utils/abi/decodeFunctionResult.d.ts.map +1 -0
  382. package/dist/types/utils/abi/encodeAbiParameters.d.ts +9 -0
  383. package/dist/types/utils/abi/encodeAbiParameters.d.ts.map +1 -0
  384. package/dist/types/utils/abi/encodeDeployData.d.ts +9 -0
  385. package/dist/types/utils/abi/encodeDeployData.d.ts.map +1 -0
  386. package/dist/types/utils/abi/encodeErrorResult.d.ts +11 -0
  387. package/dist/types/utils/abi/encodeErrorResult.d.ts.map +1 -0
  388. package/dist/types/utils/abi/encodeEventTopics.d.ts +13 -0
  389. package/dist/types/utils/abi/encodeEventTopics.d.ts.map +1 -0
  390. package/dist/types/utils/abi/encodeFunctionData.d.ts +11 -0
  391. package/dist/types/utils/abi/encodeFunctionData.d.ts.map +1 -0
  392. package/dist/types/utils/abi/encodeFunctionResult.d.ts +13 -0
  393. package/dist/types/utils/abi/encodeFunctionResult.d.ts.map +1 -0
  394. package/dist/types/utils/abi/encodePacked.d.ts +11 -0
  395. package/dist/types/utils/abi/encodePacked.d.ts.map +1 -0
  396. package/dist/types/utils/abi/formatAbiItem.d.ts +9 -0
  397. package/dist/types/utils/abi/formatAbiItem.d.ts.map +1 -0
  398. package/dist/types/utils/abi/formatAbiItemWithArgs.d.ts +8 -0
  399. package/dist/types/utils/abi/formatAbiItemWithArgs.d.ts.map +1 -0
  400. package/dist/types/utils/abi/getAbiItem.d.ts +12 -0
  401. package/dist/types/utils/abi/getAbiItem.d.ts.map +1 -0
  402. package/dist/types/utils/accounts.d.ts +3 -0
  403. package/dist/types/utils/accounts.d.ts.map +1 -0
  404. package/dist/types/utils/address/getAddress.d.ts +4 -0
  405. package/dist/types/utils/address/getAddress.d.ts.map +1 -0
  406. package/dist/types/utils/address/getContractAddress.d.ts +20 -0
  407. package/dist/types/utils/address/getContractAddress.d.ts.map +1 -0
  408. package/dist/types/utils/address/isAddress.d.ts +3 -0
  409. package/dist/types/utils/address/isAddress.d.ts.map +1 -0
  410. package/dist/types/utils/address/isAddressEqual.d.ts +3 -0
  411. package/dist/types/utils/address/isAddressEqual.d.ts.map +1 -0
  412. package/dist/types/utils/buildRequest.d.ts +6 -0
  413. package/dist/types/utils/buildRequest.d.ts.map +1 -0
  414. package/dist/types/utils/ccip.d.ts +37 -0
  415. package/dist/types/utils/ccip.d.ts.map +1 -0
  416. package/dist/types/utils/chain.d.ts +14 -0
  417. package/dist/types/utils/chain.d.ts.map +1 -0
  418. package/dist/types/utils/contract/extractFunctionParts.d.ts +13 -0
  419. package/dist/types/utils/contract/extractFunctionParts.d.ts.map +1 -0
  420. package/dist/types/utils/data/concat.d.ts +6 -0
  421. package/dist/types/utils/data/concat.d.ts.map +1 -0
  422. package/dist/types/utils/data/isBytes.d.ts +3 -0
  423. package/dist/types/utils/data/isBytes.d.ts.map +1 -0
  424. package/dist/types/utils/data/isBytesEqual.d.ts +3 -0
  425. package/dist/types/utils/data/isBytesEqual.d.ts.map +1 -0
  426. package/dist/types/utils/data/isHex.d.ts +5 -0
  427. package/dist/types/utils/data/isHex.d.ts.map +1 -0
  428. package/dist/types/utils/data/pad.d.ts +11 -0
  429. package/dist/types/utils/data/pad.d.ts.map +1 -0
  430. package/dist/types/utils/data/size.d.ts +9 -0
  431. package/dist/types/utils/data/size.d.ts.map +1 -0
  432. package/dist/types/utils/data/slice.d.ts +33 -0
  433. package/dist/types/utils/data/slice.d.ts.map +1 -0
  434. package/dist/types/utils/data/trim.d.ts +8 -0
  435. package/dist/types/utils/data/trim.d.ts.map +1 -0
  436. package/dist/types/utils/encoding/fromBytes.d.ts +109 -0
  437. package/dist/types/utils/encoding/fromBytes.d.ts.map +1 -0
  438. package/dist/types/utils/encoding/fromHex.d.ts +138 -0
  439. package/dist/types/utils/encoding/fromHex.d.ts.map +1 -0
  440. package/dist/types/utils/encoding/fromRlp.d.ts +6 -0
  441. package/dist/types/utils/encoding/fromRlp.d.ts.map +1 -0
  442. package/dist/types/utils/encoding/toBytes.d.ts +125 -0
  443. package/dist/types/utils/encoding/toBytes.d.ts.map +1 -0
  444. package/dist/types/utils/encoding/toHex.d.ts +139 -0
  445. package/dist/types/utils/encoding/toHex.d.ts.map +1 -0
  446. package/dist/types/utils/encoding/toRlp.d.ts +8 -0
  447. package/dist/types/utils/encoding/toRlp.d.ts.map +1 -0
  448. package/dist/types/utils/ens/avatar/parseAvatarRecord.d.ts +9 -0
  449. package/dist/types/utils/ens/avatar/parseAvatarRecord.d.ts.map +1 -0
  450. package/dist/types/utils/ens/avatar/utils.d.ts +37 -0
  451. package/dist/types/utils/ens/avatar/utils.d.ts.map +1 -0
  452. package/dist/types/utils/ens/encodeLabelhash.d.ts +3 -0
  453. package/dist/types/utils/ens/encodeLabelhash.d.ts.map +1 -0
  454. package/dist/types/utils/ens/encodedLabelToLabelhash.d.ts +3 -0
  455. package/dist/types/utils/ens/encodedLabelToLabelhash.d.ts.map +1 -0
  456. package/dist/types/utils/ens/errors.d.ts +2 -0
  457. package/dist/types/utils/ens/errors.d.ts.map +1 -0
  458. package/dist/types/utils/ens/labelhash.d.ts +11 -0
  459. package/dist/types/utils/ens/labelhash.d.ts.map +1 -0
  460. package/dist/types/utils/ens/namehash.d.ts +13 -0
  461. package/dist/types/utils/ens/namehash.d.ts.map +1 -0
  462. package/dist/types/utils/ens/normalize.d.ts +12 -0
  463. package/dist/types/utils/ens/normalize.d.ts.map +1 -0
  464. package/dist/types/utils/ens/packetToBytes.d.ts +3 -0
  465. package/dist/types/utils/ens/packetToBytes.d.ts.map +1 -0
  466. package/dist/types/utils/errors/getCallError.d.ts +9 -0
  467. package/dist/types/utils/errors/getCallError.d.ts.map +1 -0
  468. package/dist/types/utils/errors/getContractError.d.ts +12 -0
  469. package/dist/types/utils/errors/getContractError.d.ts.map +1 -0
  470. package/dist/types/utils/errors/getEstimateGasError.d.ts +11 -0
  471. package/dist/types/utils/errors/getEstimateGasError.d.ts.map +1 -0
  472. package/dist/types/utils/errors/getNodeError.d.ts +7 -0
  473. package/dist/types/utils/errors/getNodeError.d.ts.map +1 -0
  474. package/dist/types/utils/errors/getTransactionError.d.ts +12 -0
  475. package/dist/types/utils/errors/getTransactionError.d.ts.map +1 -0
  476. package/dist/types/utils/filters/createFilterRequestScope.d.ts +22 -0
  477. package/dist/types/utils/filters/createFilterRequestScope.d.ts.map +1 -0
  478. package/dist/types/utils/formatters/block.d.ts +28 -0
  479. package/dist/types/utils/formatters/block.d.ts.map +1 -0
  480. package/dist/types/utils/formatters/extract.d.ts +8 -0
  481. package/dist/types/utils/formatters/extract.d.ts.map +1 -0
  482. package/dist/types/utils/formatters/feeHistory.d.ts +4 -0
  483. package/dist/types/utils/formatters/feeHistory.d.ts.map +1 -0
  484. package/dist/types/utils/formatters/formatter.d.ts +10 -0
  485. package/dist/types/utils/formatters/formatter.d.ts.map +1 -0
  486. package/dist/types/utils/formatters/log.d.ts +7 -0
  487. package/dist/types/utils/formatters/log.d.ts.map +1 -0
  488. package/dist/types/utils/formatters/transaction.d.ts +30 -0
  489. package/dist/types/utils/formatters/transaction.d.ts.map +1 -0
  490. package/dist/types/utils/formatters/transactionReceipt.d.ts +14 -0
  491. package/dist/types/utils/formatters/transactionReceipt.d.ts.map +1 -0
  492. package/dist/types/utils/formatters/transactionRequest.d.ts +14 -0
  493. package/dist/types/utils/formatters/transactionRequest.d.ts.map +1 -0
  494. package/dist/types/utils/hash/getEventSelector.d.ts +4 -0
  495. package/dist/types/utils/hash/getEventSelector.d.ts.map +1 -0
  496. package/dist/types/utils/hash/getFunctionSelector.d.ts +3 -0
  497. package/dist/types/utils/hash/getFunctionSelector.d.ts.map +1 -0
  498. package/dist/types/utils/hash/hashFunction.d.ts +4 -0
  499. package/dist/types/utils/hash/hashFunction.d.ts.map +1 -0
  500. package/dist/types/utils/hash/isHash.d.ts +3 -0
  501. package/dist/types/utils/hash/isHash.d.ts.map +1 -0
  502. package/dist/types/utils/hash/keccak256.d.ts +6 -0
  503. package/dist/types/utils/hash/keccak256.d.ts.map +1 -0
  504. package/dist/types/utils/index.d.ts +82 -0
  505. package/dist/types/utils/index.d.ts.map +1 -0
  506. package/dist/types/utils/observe.d.ts +17 -0
  507. package/dist/types/utils/observe.d.ts.map +1 -0
  508. package/dist/types/utils/poll.d.ts +13 -0
  509. package/dist/types/utils/poll.d.ts.map +1 -0
  510. package/dist/types/utils/promise/createBatchScheduler.d.ts +17 -0
  511. package/dist/types/utils/promise/createBatchScheduler.d.ts.map +1 -0
  512. package/dist/types/utils/promise/withCache.d.ts +36 -0
  513. package/dist/types/utils/promise/withCache.d.ts.map +1 -0
  514. package/dist/types/utils/promise/withRetry.d.ts +12 -0
  515. package/dist/types/utils/promise/withRetry.d.ts.map +1 -0
  516. package/dist/types/utils/promise/withTimeout.d.ts +8 -0
  517. package/dist/types/utils/promise/withTimeout.d.ts.map +1 -0
  518. package/dist/types/utils/regex.d.ts +4 -0
  519. package/dist/types/utils/regex.d.ts.map +1 -0
  520. package/dist/types/utils/rpc.d.ts +72 -0
  521. package/dist/types/utils/rpc.d.ts.map +1 -0
  522. package/dist/types/utils/signature/hashMessage.d.ts +6 -0
  523. package/dist/types/utils/signature/hashMessage.d.ts.map +1 -0
  524. package/dist/types/utils/signature/hashTypedData.d.ts +11 -0
  525. package/dist/types/utils/signature/hashTypedData.d.ts.map +1 -0
  526. package/dist/types/utils/signature/hexToSignature.d.ts +13 -0
  527. package/dist/types/utils/signature/hexToSignature.d.ts.map +1 -0
  528. package/dist/types/utils/signature/recoverAddress.d.ts +9 -0
  529. package/dist/types/utils/signature/recoverAddress.d.ts.map +1 -0
  530. package/dist/types/utils/signature/recoverMessageAddress.d.ts +9 -0
  531. package/dist/types/utils/signature/recoverMessageAddress.d.ts.map +1 -0
  532. package/dist/types/utils/signature/recoverPublicKey.d.ts +8 -0
  533. package/dist/types/utils/signature/recoverPublicKey.d.ts.map +1 -0
  534. package/dist/types/utils/signature/recoverTypedDataAddress.d.ts +13 -0
  535. package/dist/types/utils/signature/recoverTypedDataAddress.d.ts.map +1 -0
  536. package/dist/types/utils/signature/signatureToHex.d.ts +17 -0
  537. package/dist/types/utils/signature/signatureToHex.d.ts.map +1 -0
  538. package/dist/types/utils/signature/verifyMessage.d.ts +25 -0
  539. package/dist/types/utils/signature/verifyMessage.d.ts.map +1 -0
  540. package/dist/types/utils/signature/verifyTypedData.d.ts +28 -0
  541. package/dist/types/utils/signature/verifyTypedData.d.ts.map +1 -0
  542. package/dist/types/utils/stringify.d.ts +2 -0
  543. package/dist/types/utils/stringify.d.ts.map +1 -0
  544. package/dist/types/utils/transaction/assertRequest.d.ts +5 -0
  545. package/dist/types/utils/transaction/assertRequest.d.ts.map +1 -0
  546. package/dist/types/utils/transaction/assertTransaction.d.ts +5 -0
  547. package/dist/types/utils/transaction/assertTransaction.d.ts.map +1 -0
  548. package/dist/types/utils/transaction/getSerializedTransactionType.d.ts +4 -0
  549. package/dist/types/utils/transaction/getSerializedTransactionType.d.ts.map +1 -0
  550. package/dist/types/utils/transaction/getTransactionType.d.ts +4 -0
  551. package/dist/types/utils/transaction/getTransactionType.d.ts.map +1 -0
  552. package/dist/types/utils/transaction/parseTransaction.d.ts +9 -0
  553. package/dist/types/utils/transaction/parseTransaction.d.ts.map +1 -0
  554. package/dist/types/utils/transaction/prepareRequest.d.ts +20 -0
  555. package/dist/types/utils/transaction/prepareRequest.d.ts.map +1 -0
  556. package/dist/types/utils/transaction/serializeAccessList.d.ts +5 -0
  557. package/dist/types/utils/transaction/serializeAccessList.d.ts.map +1 -0
  558. package/dist/types/utils/transaction/serializeTransaction.d.ts +7 -0
  559. package/dist/types/utils/transaction/serializeTransaction.d.ts.map +1 -0
  560. package/dist/types/utils/typedData.d.ts +6 -0
  561. package/dist/types/utils/typedData.d.ts.map +1 -0
  562. package/dist/types/utils/uid.d.ts +2 -0
  563. package/dist/types/utils/uid.d.ts.map +1 -0
  564. package/dist/types/utils/unit/formatEther.d.ts +2 -0
  565. package/dist/types/utils/unit/formatEther.d.ts.map +1 -0
  566. package/dist/types/utils/unit/formatGwei.d.ts +2 -0
  567. package/dist/types/utils/unit/formatGwei.d.ts.map +1 -0
  568. package/dist/types/utils/unit/formatUnits.d.ts +2 -0
  569. package/dist/types/utils/unit/formatUnits.d.ts.map +1 -0
  570. package/dist/types/utils/unit/parseEther.d.ts +2 -0
  571. package/dist/types/utils/unit/parseEther.d.ts.map +1 -0
  572. package/dist/types/utils/unit/parseGwei.d.ts +2 -0
  573. package/dist/types/utils/unit/parseGwei.d.ts.map +1 -0
  574. package/dist/types/utils/unit/parseUnits.d.ts +2 -0
  575. package/dist/types/utils/unit/parseUnits.d.ts.map +1 -0
  576. package/dist/types/utils/wait.d.ts +2 -0
  577. package/dist/types/utils/wait.d.ts.map +1 -0
  578. package/dist/types/wallet.d.ts +11 -0
  579. package/dist/types/wallet.d.ts.map +1 -0
  580. package/dist/types/window.d.ts +2 -0
  581. package/dist/types/window.d.ts.map +1 -0
  582. package/package.json +1 -1
  583. package/src/errors/version.ts +1 -1
@@ -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,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAE5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,yBAAyB,CAAA;AAWhC,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,WAAW,CAAA;AAErD,MAAM,MAAM,sBAAsB,CAChC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,GAAG,EAC3C,aAAa,SAAS,MAAM,GAAG,MAAM,IACnC,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC,GAC9D,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,KAAK,CAAC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,EAC3C,aAAa,SAAS,MAAM,EAE5B,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,EACjC,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,CA8BtD"}
@@ -0,0 +1,54 @@
1
+ import type { Abi } from 'abitype';
2
+ import type { Client } from '../../clients/createClient.js';
3
+ import type { Transport } from '../../clients/transports/createTransport.js';
4
+ import type { Chain } from '../../types/chain.js';
5
+ import type { ContractFunctionConfig, ContractFunctionResult, GetValue } from '../../types/contract.js';
6
+ import type { Hex } from '../../types/misc.js';
7
+ import type { UnionOmit } from '../../types/utils.js';
8
+ import type { WriteContractParameters } from '../wallet/writeContract.js';
9
+ import { type CallParameters } from './call.js';
10
+ export type SimulateContractParameters<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any, TChain extends Chain | undefined = Chain | undefined, TChainOverride extends Chain | undefined = Chain | undefined> = {
11
+ chain?: TChainOverride;
12
+ /** Data to append to the end of the calldata. Useful for adding a ["domain" tag](https://opensea.notion.site/opensea/Seaport-Order-Attributions-ec2d69bf455041a5baa490941aad307f). */
13
+ dataSuffix?: Hex;
14
+ } & ContractFunctionConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & UnionOmit<CallParameters<TChainOverride extends Chain ? TChainOverride : TChain>, 'batch' | 'to' | 'data' | 'value'> & GetValue<TAbi, TFunctionName, CallParameters<TChain> extends CallParameters ? CallParameters<TChain>['value'] : CallParameters['value']>;
15
+ export type SimulateContractReturnType<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TChain extends Chain | undefined = Chain | undefined, TChainOverride extends Chain | undefined = Chain | undefined> = {
16
+ result: ContractFunctionResult<TAbi, TFunctionName>;
17
+ request: UnionOmit<WriteContractParameters<TAbi, TFunctionName, TChain, undefined, TChainOverride>, 'chain' | 'functionName'> & {
18
+ chain: TChainOverride;
19
+ functionName: TFunctionName;
20
+ } & ContractFunctionConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
21
+ };
22
+ /**
23
+ * Simulates/validates a contract interaction. This is useful for retrieving **return data** and **revert reasons** of contract write functions.
24
+ *
25
+ * - Docs: https://viem.sh/docs/contract/simulateContract.html
26
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
27
+ *
28
+ * 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.html), but also supports contract write functions.
29
+ *
30
+ * Internally, uses a [Public Client](https://viem.sh/docs/clients/public.html) to call the [`call` action](https://viem.sh/docs/actions/public/call.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
31
+ *
32
+ * @param client - Client to use
33
+ * @param parameters - {@link SimulateContractParameters}
34
+ * @returns The simulation result and write request. {@link SimulateContractReturnType}
35
+ *
36
+ * @example
37
+ * import { createPublicClient, http } from 'viem'
38
+ * import { mainnet } from 'viem/chains'
39
+ * import { simulateContract } from 'viem/contract'
40
+ *
41
+ * const client = createPublicClient({
42
+ * chain: mainnet,
43
+ * transport: http(),
44
+ * })
45
+ * const result = await simulateContract(client, {
46
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
47
+ * abi: parseAbi(['function mint(uint32) view returns (uint32)']),
48
+ * functionName: 'mint',
49
+ * args: ['69420'],
50
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
51
+ * })
52
+ */
53
+ export declare function simulateContract<TChain extends Chain | undefined, const TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined>(client: Client<Transport, TChain>, { abi, address, args, dataSuffix, functionName, ...callRequest }: SimulateContractParameters<TAbi, TFunctionName, TChain, TChainOverride>): Promise<SimulateContractReturnType<TAbi, TFunctionName, TChain, TChainOverride>>;
54
+ //# sourceMappingURL=simulateContract.d.ts.map
@@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AC,CACxE,CAgDA"}
@@ -0,0 +1,34 @@
1
+ import type { Client } from '../../clients/createClient.js';
2
+ import type { Transport } from '../../clients/transports/createTransport.js';
3
+ import type { Chain } from '../../types/chain.js';
4
+ import type { Filter } from '../../types/filter.js';
5
+ export type UninstallFilterParameters = {
6
+ filter: Filter<any>;
7
+ };
8
+ export type UninstallFilterReturnType = boolean;
9
+ /**
10
+ * Destroys a [`Filter`](https://viem.sh/docs/glossary/types.html#filter).
11
+ *
12
+ * - Docs: https://viem.sh/docs/actions/public/uninstallFilter.html
13
+ * - JSON-RPC Methods: [`eth_uninstallFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_uninstallFilter)
14
+ *
15
+ * Destroys a Filter that was created from one of the following Actions:
16
+ * - [`createBlockFilter`](https://viem.sh/docs/actions/public/createBlockFilter.html)
17
+ * - [`createEventFilter`](https://viem.sh/docs/actions/public/createEventFilter.html)
18
+ * - [`createPendingTransactionFilter`](https://viem.sh/docs/actions/public/createPendingTransactionFilter.html)
19
+ *
20
+ * @param client - Client to use
21
+ * @param parameters - {@link UninstallFilterParameters}
22
+ * @returns A boolean indicating if the Filter was successfully uninstalled. {@link UninstallFilterReturnType}
23
+ *
24
+ * @example
25
+ * import { createPublicClient, http } from 'viem'
26
+ * import { mainnet } from 'viem/chains'
27
+ * import { createPendingTransactionFilter, uninstallFilter } from 'viem/public'
28
+ *
29
+ * const filter = await createPendingTransactionFilter(client)
30
+ * const uninstalled = await uninstallFilter(client, { filter })
31
+ * // true
32
+ */
33
+ export declare function uninstallFilter<TTransport extends Transport, TChain extends Chain | undefined>(_client: Client<TTransport, TChain>, { filter }: UninstallFilterParameters): Promise<UninstallFilterReturnType>;
34
+ //# 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,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,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,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,EACnC,EAAE,MAAM,EAAE,EAAE,yBAAyB,GACpC,OAAO,CAAC,yBAAyB,CAAC,CAKpC"}
@@ -0,0 +1,24 @@
1
+ import type { Address } from 'abitype';
2
+ import type { Chain } from '../../chains/index.js';
3
+ import type { Client } from '../../clients/createClient.js';
4
+ import type { Transport } from '../../clients/transports/createTransport.js';
5
+ import type { ByteArray, Hex } from '../../types/misc.js';
6
+ import { type CallParameters } from './call.js';
7
+ export type VerifyHashParameters = Pick<CallParameters, 'blockNumber' | 'blockTag'> & {
8
+ /** The address that signed the original message. */
9
+ address: Address;
10
+ /** The hash to be verified. */
11
+ hash: Hex;
12
+ /** The signature that was generated by signing the message with the address's private key. */
13
+ signature: Hex | ByteArray;
14
+ };
15
+ export type VerifyHashReturnType = boolean;
16
+ /**
17
+ * Verifies a message hash on chain using ERC-6492.
18
+ *
19
+ * @param client - Client to use.
20
+ * @param parameters - {@link VerifyHashParameters}
21
+ * @returns Whether or not the signature is valid. {@link VerifyHashReturnType}
22
+ */
23
+ export declare function verifyHash<TChain extends Chain | undefined>(client: Client<Transport, TChain>, { address, hash, signature, ...callRequest }: VerifyHashParameters): Promise<VerifyHashReturnType>;
24
+ //# sourceMappingURL=verifyHash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyHash.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/verifyHash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAI5E,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAGzD,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,WAAW,CAAA;AAErD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,cAAc,EACd,aAAa,GAAG,UAAU,CAC3B,GAAG;IACF,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAA;IAChB,+BAA+B;IAC/B,IAAI,EAAE,GAAG,CAAA;IACT,8FAA8F;IAC9F,SAAS,EAAE,GAAG,GAAG,SAAS,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAA;AAE1C;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,EAC/D,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,EACjC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,EAAE,oBAAoB,GACjE,OAAO,CAAC,oBAAoB,CAAC,CAwB/B"}
@@ -0,0 +1,28 @@
1
+ import type { Chain } from '../../chains/index.js';
2
+ import type { Client } from '../../clients/createClient.js';
3
+ import type { Transport } from '../../clients/transports/createTransport.js';
4
+ import type { ByteArray, Hex, SignableMessage } from '../../types/misc.js';
5
+ import { type VerifyHashParameters } from './verifyHash.js';
6
+ import type { Address } from 'abitype';
7
+ export type VerifyMessageParameters = Omit<VerifyHashParameters, 'hash'> & {
8
+ /** The address that signed the original message. */
9
+ address: Address;
10
+ /** The message to be verified. */
11
+ message: SignableMessage;
12
+ /** The signature that was generated by signing the message with the address's private key. */
13
+ signature: Hex | ByteArray;
14
+ };
15
+ export type VerifyMessageReturnType = boolean;
16
+ /**
17
+ * Verify that a message was signed by the provided address.
18
+ *
19
+ * Compatible with Smart Contract Accounts & Externally Owned Accounts via [ERC-6492](https://eips.ethereum.org/EIPS/eip-6492).
20
+ *
21
+ * - Docs {@link https://viem.sh/docs/actions/public/verifyMessage.html}
22
+ *
23
+ * @param client - Client to use.
24
+ * @param parameters - {@link VerifyMessageParameters}
25
+ * @returns Whether or not the signature is valid. {@link VerifyMessageReturnType}
26
+ */
27
+ export declare function verifyMessage<TChain extends Chain | undefined>(client: Client<Transport, TChain>, { address, message, signature, ...callRequest }: VerifyMessageParameters): Promise<VerifyMessageReturnType>;
28
+ //# sourceMappingURL=verifyMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyMessage.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/verifyMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAE1E,OAAO,EAAE,KAAK,oBAAoB,EAAc,MAAM,iBAAiB,CAAA;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG;IACzE,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAA;IAChB,kCAAkC;IAClC,OAAO,EAAE,eAAe,CAAA;IACxB,8FAA8F;IAC9F,SAAS,EAAE,GAAG,GAAG,SAAS,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAA;AAE7C;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,EAClE,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,EACjC,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,EAAE,uBAAuB,GACvE,OAAO,CAAC,uBAAuB,CAAC,CAQlC"}
@@ -0,0 +1,27 @@
1
+ import type { Chain } from '../../chains/index.js';
2
+ import type { Client } from '../../clients/createClient.js';
3
+ import type { Transport } from '../../clients/transports/createTransport.js';
4
+ import type { ByteArray, Hex } from '../../types/misc.js';
5
+ import type { TypedDataDefinition } from '../../types/typedData.js';
6
+ import { type VerifyHashParameters } from './verifyHash.js';
7
+ import type { Address, TypedData } from 'abitype';
8
+ export type VerifyTypedDataParameters<TTypedData extends TypedData | {
9
+ [key: string]: unknown;
10
+ } = TypedData, TPrimaryType extends string = string> = Omit<VerifyHashParameters, 'hash'> & TypedDataDefinition<TTypedData, TPrimaryType> & {
11
+ /** The address to verify the typed data for. */
12
+ address: Address;
13
+ /** The signature to verify */
14
+ signature: Hex | ByteArray;
15
+ };
16
+ export type VerifyTypedDataReturnType = boolean;
17
+ /**
18
+ * Verify that typed data was signed by the provided address.
19
+ *
20
+ * - Docs {@link https://viem.sh/docs/actions/public/verifyTypedData.html}
21
+ *
22
+ * @param client - Client to use.
23
+ * @param parameters - {@link VerifyTypedDataParameters}
24
+ * @returns Whether or not the signature is valid. {@link VerifyTypedDataReturnType}
25
+ */
26
+ export declare function verifyTypedData<TChain extends Chain | undefined>(client: Client<Transport, TChain>, { address, signature, message, primaryType, types, domain, ...callRequest }: VerifyTypedDataParameters): Promise<VerifyTypedDataReturnType>;
27
+ //# sourceMappingURL=verifyTypedData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyTypedData.d.ts","sourceRoot":"","sources":["../../../../src/actions/public/verifyTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAEnE,OAAO,EAAE,KAAK,oBAAoB,EAAc,MAAM,iBAAiB,CAAA;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEjD,MAAM,MAAM,yBAAyB,CACnC,UAAU,SAAS,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAAG,SAAS,EACrE,YAAY,SAAS,MAAM,GAAG,MAAM,IAClC,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GACpC,mBAAmB,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG;IAC9C,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAA;IAChB,8BAA8B;IAC9B,SAAS,EAAE,GAAG,GAAG,SAAS,CAAA;CAC3B,CAAA;AAEH,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAA;AAE/C;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,MAAM,SAAS,KAAK,GAAG,SAAS,EACpE,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,EACjC,EACE,OAAO,EACP,SAAS,EACT,OAAO,EACP,WAAW,EACX,KAAK,EACL,MAAM,EACN,GAAG,WAAW,EACf,EAAE,yBAAyB,GAC3B,OAAO,CAAC,yBAAyB,CAAC,CAQpC"}
@@ -0,0 +1,72 @@
1
+ import type { Client } from '../../clients/createClient.js';
2
+ import type { Transport } from '../../clients/transports/createTransport.js';
3
+ import type { Chain } from '../../types/chain.js';
4
+ import type { Hash } from '../../types/misc.js';
5
+ import type { Transaction } from '../../types/transaction.js';
6
+ import { type GetTransactionReceiptReturnType } from './getTransactionReceipt.js';
7
+ export type ReplacementReason = 'cancelled' | 'replaced' | 'repriced';
8
+ export type ReplacementReturnType<TChain extends Chain | undefined = Chain | undefined> = {
9
+ reason: ReplacementReason;
10
+ replacedTransaction: Transaction;
11
+ transaction: Transaction;
12
+ transactionReceipt: GetTransactionReceiptReturnType<TChain>;
13
+ };
14
+ export type WaitForTransactionReceiptReturnType<TChain extends Chain | undefined = Chain | undefined> = GetTransactionReceiptReturnType<TChain>;
15
+ export type WaitForTransactionReceiptParameters<TChain extends Chain | undefined = Chain | undefined> = {
16
+ /**
17
+ * The number of confirmations (blocks that have passed) to wait before resolving.
18
+ * @default 1
19
+ */
20
+ confirmations?: number;
21
+ /** The hash of the transaction. */
22
+ hash: Hash;
23
+ /** Optional callback to emit if the transaction has been replaced. */
24
+ onReplaced?: (response: ReplacementReturnType<TChain>) => void;
25
+ /**
26
+ * Polling frequency (in ms). Defaults to the client's pollingInterval config.
27
+ * @default client.pollingInterval
28
+ */
29
+ pollingInterval?: number;
30
+ /** Optional timeout (in milliseconds) to wait before stopping polling. */
31
+ timeout?: number;
32
+ };
33
+ /**
34
+ * 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.
35
+ *
36
+ * - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt.html
37
+ * - Example: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
38
+ * - JSON-RPC Methods:
39
+ * - Polls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt) on each block until it has been processed.
40
+ * - If a Transaction has been replaced:
41
+ * - Calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbynumber) and extracts the transactions
42
+ * - Checks if one of the Transactions is a replacement
43
+ * - If so, calls [`eth_getTransactionReceipt`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getTransactionReceipt).
44
+ *
45
+ * The `waitForTransactionReceipt` action additionally supports Replacement detection (e.g. sped up Transactions).
46
+ *
47
+ * 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.
48
+ *
49
+ * There are 3 types of Transaction Replacement reasons:
50
+ *
51
+ * - `repriced`: The gas price has been modified (e.g. different `maxFeePerGas`)
52
+ * - `cancelled`: The Transaction has been cancelled (e.g. `value === 0n`)
53
+ * - `replaced`: The Transaction has been replaced (e.g. different `value` or `data`)
54
+ *
55
+ * @param client - Client to use
56
+ * @param parameters - {@link WaitForTransactionReceiptParameters}
57
+ * @returns The transaction receipt. {@link WaitForTransactionReceiptReturnType}
58
+ *
59
+ * @example
60
+ * import { createPublicClient, waitForTransactionReceipt, http } from 'viem'
61
+ * import { mainnet } from 'viem/chains'
62
+ *
63
+ * const client = createPublicClient({
64
+ * chain: mainnet,
65
+ * transport: http(),
66
+ * })
67
+ * const transactionReceipt = await waitForTransactionReceipt(client, {
68
+ * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
69
+ * })
70
+ */
71
+ export declare function waitForTransactionReceipt<TChain extends Chain | undefined>(client: Client<Transport, TChain>, { confirmations, hash, onReplaced, pollingInterval, timeout, }: WaitForTransactionReceiptParameters<TChain>): Promise<WaitForTransactionReceiptReturnType<TChain>>;
72
+ //# sourceMappingURL=waitForTransactionReceipt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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C1E,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,SAAS,KAAK,GAAG,SAAS,EAEhC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,EACjC,EACE,aAAiB,EACjB,IAAI,EACJ,UAAU,EACV,eAAwC,EACxC,OAAO,GACR,EAAE,mCAAmC,CAAC,MAAM,CAAC,GAC7C,OAAO,CAAC,mCAAmC,CAAC,MAAM,CAAC,CAAC,CAoJtD"}
@@ -0,0 +1,59 @@
1
+ import type { Client } from '../../clients/createClient.js';
2
+ import type { Transport } from '../../clients/transports/createTransport.js';
3
+ import type { Chain } from '../../types/chain.js';
4
+ import type { GetTransportConfig } from '../../types/transport.js';
5
+ import { type GetBlockNumberReturnType } from './getBlockNumber.js';
6
+ export type OnBlockNumberParameter = GetBlockNumberReturnType;
7
+ export type OnBlockNumberFn = (blockNumber: OnBlockNumberParameter, prevBlockNumber: OnBlockNumberParameter | undefined) => void;
8
+ export type PollOptions = {
9
+ /** Whether or not to emit the missed block numbers to the callback. */
10
+ emitMissed?: boolean;
11
+ /** Whether or not to emit the latest block number to the callback when the subscription opens. */
12
+ emitOnBegin?: boolean;
13
+ /** Polling frequency (in ms). Defaults to Client's pollingInterval config. */
14
+ pollingInterval?: number;
15
+ };
16
+ export type WatchBlockNumberParameters<TTransport extends Transport = Transport> = {
17
+ /** The callback to call when a new block number is received. */
18
+ onBlockNumber: OnBlockNumberFn;
19
+ /** The callback to call when an error occurred when trying to get for a new block. */
20
+ onError?: (error: Error) => void;
21
+ } & (GetTransportConfig<TTransport>['type'] extends 'webSocket' ? {
22
+ emitMissed?: never;
23
+ emitOnBegin?: never;
24
+ /** Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`. */
25
+ poll?: false;
26
+ pollingInterval?: never;
27
+ } | (PollOptions & {
28
+ poll: true;
29
+ }) : PollOptions & {
30
+ poll?: true;
31
+ });
32
+ export type WatchBlockNumberReturnType = () => void;
33
+ /**
34
+ * Watches and returns incoming block numbers.
35
+ *
36
+ * - Docs: https://viem.sh/docs/actions/public/watchBlockNumber.html
37
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks
38
+ * - JSON-RPC Methods:
39
+ * - When `poll: true`, calls [`eth_blockNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber) on a polling interval.
40
+ * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
41
+ *
42
+ * @param client - Client to use
43
+ * @param parameters - {@link WatchBlockNumberParameters}
44
+ * @returns A function that can be invoked to stop watching for new block numbers. {@link WatchBlockNumberReturnType}
45
+ *
46
+ * @example
47
+ * import { createPublicClient, watchBlockNumber, http } from 'viem'
48
+ * import { mainnet } from 'viem/chains'
49
+ *
50
+ * const client = createPublicClient({
51
+ * chain: mainnet,
52
+ * transport: http(),
53
+ * })
54
+ * const unwatch = watchBlockNumber(client, {
55
+ * onBlockNumber: (blockNumber) => console.log(blockNumber),
56
+ * })
57
+ */
58
+ export declare function watchBlockNumber<TChain extends Chain | undefined, TTransport extends Transport>(client: Client<TTransport, TChain>, { emitOnBegin, emitMissed, onBlockNumber, onError, poll: poll_, pollingInterval, }: WatchBlockNumberParameters<TTransport>): WatchBlockNumberReturnType;
59
+ //# 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,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,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AAU,SAAS,SAAS,EAE5B,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,EAClC,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,67 @@
1
+ import type { Client } from '../../clients/createClient.js';
2
+ import type { Transport } from '../../clients/transports/createTransport.js';
3
+ import type { BlockTag } from '../../types/block.js';
4
+ import type { Chain } from '../../types/chain.js';
5
+ import type { GetTransportConfig } from '../../types/transport.js';
6
+ import { type GetBlockReturnType } from './getBlock.js';
7
+ export type OnBlockParameter<TChain extends Chain | undefined = Chain, TIncludeTransactions extends boolean = false, TBlockTag extends BlockTag = 'latest'> = GetBlockReturnType<TChain, TIncludeTransactions, TBlockTag>;
8
+ export type OnBlock<TChain extends Chain | undefined = Chain, TIncludeTransactions extends boolean = false, TBlockTag extends BlockTag = 'latest'> = (block: OnBlockParameter<TChain, TIncludeTransactions, TBlockTag>, prevBlock: OnBlockParameter<TChain, TIncludeTransactions, TBlockTag> | undefined) => void;
9
+ type PollOptions<TIncludeTransactions extends boolean = false, TBlockTag extends BlockTag = 'latest'> = {
10
+ /** The block tag. Defaults to "latest". */
11
+ blockTag?: TBlockTag | BlockTag;
12
+ /** Whether or not to emit the missed blocks to the callback. */
13
+ emitMissed?: boolean;
14
+ /** Whether or not to emit the block to the callback when the subscription opens. */
15
+ emitOnBegin?: boolean;
16
+ /** Whether or not to include transaction data in the response. */
17
+ includeTransactions?: TIncludeTransactions;
18
+ /** Polling frequency (in ms). Defaults to the client's pollingInterval config. */
19
+ pollingInterval?: number;
20
+ };
21
+ export type WatchBlocksParameters<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain, TIncludeTransactions extends boolean = false, TBlockTag extends BlockTag = 'latest'> = {
22
+ /** The callback to call when a new block is received. */
23
+ onBlock: OnBlock<TChain, TIncludeTransactions, TBlockTag>;
24
+ /** The callback to call when an error occurred when trying to get for a new block. */
25
+ onError?: (error: Error) => void;
26
+ } & (GetTransportConfig<TTransport>['type'] extends 'webSocket' ? {
27
+ blockTag?: never;
28
+ emitMissed?: never;
29
+ emitOnBegin?: never;
30
+ includeTransactions?: never;
31
+ /** Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`. */
32
+ poll?: false;
33
+ pollingInterval?: never;
34
+ } | (PollOptions<TIncludeTransactions, TBlockTag> & {
35
+ poll?: true;
36
+ }) : PollOptions<TIncludeTransactions, TBlockTag> & {
37
+ poll?: true;
38
+ });
39
+ export type WatchBlocksReturnType = () => void;
40
+ /**
41
+ * Watches and returns information for incoming blocks.
42
+ *
43
+ * - Docs: https://viem.sh/docs/actions/public/watchBlocks.html
44
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/blocks/watching-blocks
45
+ * - JSON-RPC Methods:
46
+ * - When `poll: true`, calls [`eth_getBlockByNumber`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getBlockByNumber) on a polling interval.
47
+ * - When `poll: false` & WebSocket Transport, uses a WebSocket subscription via [`eth_subscribe`](https://docs.alchemy.com/reference/eth-subscribe-polygon) and the `"newHeads"` event.
48
+ *
49
+ * @param client - Client to use
50
+ * @param parameters - {@link WatchBlocksParameters}
51
+ * @returns A function that can be invoked to stop watching for new block numbers. {@link WatchBlocksReturnType}
52
+ *
53
+ * @example
54
+ * import { createPublicClient, watchBlocks, http } from 'viem'
55
+ * import { mainnet } from 'viem/chains'
56
+ *
57
+ * const client = createPublicClient({
58
+ * chain: mainnet,
59
+ * transport: http(),
60
+ * })
61
+ * const unwatch = watchBlocks(client, {
62
+ * onBlock: (block) => console.log(block),
63
+ * })
64
+ */
65
+ export declare function watchBlocks<TTransport extends Transport, TChain extends Chain | undefined, TIncludeTransactions extends boolean = false, TBlockTag extends BlockTag = 'latest'>(client: Client<TTransport, TChain>, { blockTag, emitMissed, emitOnBegin, onBlock, onError, includeTransactions: includeTransactions_, poll: poll_, pollingInterval, }: WatchBlocksParameters<TTransport, TChain, TIncludeTransactions, TBlockTag>): WatchBlocksReturnType;
66
+ export {};
67
+ //# 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,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAMlE,OAAO,EAAE,KAAK,kBAAkB,EAAY,MAAM,eAAe,CAAA;AAEjE,MAAM,MAAM,gBAAgB,CAC1B,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,EACxC,oBAAoB,SAAS,OAAO,GAAG,KAAK,EAC5C,SAAS,SAAS,QAAQ,GAAG,QAAQ,IACnC,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,EAAE,SAAS,CAAC,CAAA;AAE/D,MAAM,MAAM,OAAO,CACjB,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,EACxC,oBAAoB,SAAS,OAAO,GAAG,KAAK,EAC5C,SAAS,SAAS,QAAQ,GAAG,QAAQ,IACnC,CACF,KAAK,EAAE,gBAAgB,CAAC,MAAM,EAAE,oBAAoB,EAAE,SAAS,CAAC,EAChE,SAAS,EACL,gBAAgB,CAAC,MAAM,EAAE,oBAAoB,EAAE,SAAS,CAAC,GACzD,SAAS,KACV,IAAI,CAAA;AAET,KAAK,WAAW,CACd,oBAAoB,SAAS,OAAO,GAAG,KAAK,EAC5C,SAAS,SAA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AAqB,GAAG,MAAM,IAAI,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CACzB,UAAU,SAAS,SAAS,EAC5B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,oBAAoB,SAAS,OAAO,GAAG,KAAK,EAC5C,SAAS,SAAS,QAAQ,GAAG,QAAQ,EAErC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,EAClC,EACE,QAAmB,EACnB,UAAkB,EAClB,WAAmB,EACnB,OAAO,EACP,OAAO,EACP,mBAAmB,EAAE,oBAAoB,EACzC,IAAI,EAAE,KAAK,EACX,eAAwC,GACzC,EAAE,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,oBAAoB,EAAE,SAAS,CAAC,GAC5E,qBAAqB,CAmGvB"}
@@ -0,0 +1,89 @@
1
+ import type { Abi, Address, ExtractAbiEvent } from 'abitype';
2
+ import type { Client } from '../../clients/createClient.js';
3
+ import type { Transport } from '../../clients/transports/createTransport.js';
4
+ import type { Chain } from '../../types/chain.js';
5
+ import type { GetEventArgs, InferEventName } from '../../types/contract.js';
6
+ import type { Log } from '../../types/log.js';
7
+ import type { GetTransportConfig } from '../../types/transport.js';
8
+ type PollOptions = {
9
+ /**
10
+ * Whether or not the transaction hashes should be batched on each invocation.
11
+ * @default true
12
+ */
13
+ batch?: boolean;
14
+ /**
15
+ * Polling frequency (in ms). Defaults to Client's pollingInterval config.
16
+ * @default client.pollingInterval
17
+ */
18
+ pollingInterval?: number;
19
+ };
20
+ export type WatchContractEventOnLogsParameter<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string, TStrict extends boolean | undefined = undefined> = TAbi extends Abi ? Log<bigint, number, false, ExtractAbiEvent<TAbi, TEventName>, TStrict>[] : Log[];
21
+ export type WatchContractEventOnLogsFn<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string, TStrict extends boolean | undefined = undefined> = (logs: WatchContractEventOnLogsParameter<TAbi, TEventName, TStrict>) => void;
22
+ export type WatchContractEventParameters<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string, TStrict extends boolean | undefined = undefined> = {
23
+ /** The address of the contract. */
24
+ address?: Address | Address[];
25
+ /** Contract ABI. */
26
+ abi: TAbi;
27
+ args?: GetEventArgs<TAbi, TEventName>;
28
+ /** Contract event. */
29
+ eventName?: InferEventName<TAbi, TEventName>;
30
+ /** The callback to call when an error occurred when trying to get for a new block. */
31
+ onError?: (error: Error) => void;
32
+ /** The callback to call when new event logs are received. */
33
+ onLogs: WatchContractEventOnLogsFn<TAbi, TEventName, TStrict>;
34
+ /**
35
+ * Whether or not the logs must match the indexed/non-indexed arguments on `event`.
36
+ * @default false
37
+ */
38
+ strict?: TStrict;
39
+ } & (GetTransportConfig<Transport>['type'] extends 'webSocket' ? {
40
+ batch?: never;
41
+ /**
42
+ * Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`.
43
+ * @default false
44
+ */
45
+ poll?: false;
46
+ pollingInterval?: never;
47
+ } | (PollOptions & {
48
+ /**
49
+ * Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`.
50
+ * @default true
51
+ */
52
+ poll?: true;
53
+ }) : PollOptions & {
54
+ poll?: true;
55
+ });
56
+ export type WatchContractEventReturnType = () => void;
57
+ /**
58
+ * Watches and returns emitted contract event logs.
59
+ *
60
+ * - Docs: https://viem.sh/docs/contract/watchContractEvent.html
61
+ *
62
+ * 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).
63
+ *
64
+ * `watchContractEvent` will attempt to create an [Event Filter](https://viem.sh/docs/contract/createContractEventFilter.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 `watchContractEvent` will fall back to using [`getLogs`](https://viem.sh/docs/actions/public/getLogs) instead.
65
+ *
66
+ * @param client - Client to use
67
+ * @param parameters - {@link WatchContractEventParameters}
68
+ * @returns A function that can be invoked to stop watching for new event logs. {@link WatchContractEventReturnType}
69
+ *
70
+ * @example
71
+ * import { createPublicClient, http, parseAbi } from 'viem'
72
+ * import { mainnet } from 'viem/chains'
73
+ * import { watchContractEvent } from 'viem/contract'
74
+ *
75
+ * const client = createPublicClient({
76
+ * chain: mainnet,
77
+ * transport: http(),
78
+ * })
79
+ * const unwatch = watchContractEvent(client, {
80
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
81
+ * abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']),
82
+ * eventName: 'Transfer',
83
+ * args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' },
84
+ * onLogs: (logs) => console.log(logs),
85
+ * })
86
+ */
87
+ export declare function watchContractEvent<TChain extends Chain | undefined, const TAbi extends Abi | readonly unknown[], TEventName extends string, TStrict extends boolean | undefined = undefined>(client: Client<Transport, TChain>, { abi, address, args, batch, eventName, onError, onLogs, poll: poll_, pollingInterval, strict: strict_, }: WatchContractEventParameters<TAbi, TEventName, TStrict>): WatchContractEventReturnType;
88
+ export {};
89
+ //# 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,EAAY,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAE5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE3E,OAAO,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CAmK9B"}
@@ -0,0 +1,104 @@
1
+ import type { AbiEvent, Address } from 'abitype';
2
+ import type { Client } from '../../clients/createClient.js';
3
+ import type { Transport } from '../../clients/transports/createTransport.js';
4
+ import type { Chain } from '../../types/chain.js';
5
+ import type { MaybeAbiEventName, MaybeExtractEventArgsFromAbi } from '../../types/contract.js';
6
+ import type { Log } from '../../types/log.js';
7
+ import type { GetTransportConfig } from '../../types/transport.js';
8
+ type PollOptions = {
9
+ /**
10
+ * Whether or not the transaction hashes should be batched on each invocation.
11
+ * @default true
12
+ */
13
+ batch?: boolean;
14
+ /**
15
+ * Polling frequency (in ms). Defaults to Client's pollingInterval config.
16
+ * @default client.pollingInterval
17
+ */
18
+ pollingInterval?: number;
19
+ };
20
+ export type WatchEventOnLogsParameter<TAbiEvent extends AbiEvent | undefined = undefined, TAbiEvents extends readonly AbiEvent[] | readonly unknown[] | undefined = TAbiEvent extends AbiEvent ? [TAbiEvent] : undefined, TStrict extends boolean | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = Log<bigint, number, false, TAbiEvent, TStrict, TAbiEvents, TEventName>[];
21
+ export type WatchEventOnLogsFn<TAbiEvent extends AbiEvent | undefined = undefined, TAbiEvents extends readonly AbiEvent[] | readonly unknown[] | undefined = TAbiEvent extends AbiEvent ? [TAbiEvent] : undefined, TStrict extends boolean | undefined = undefined, _EventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = (logs: WatchEventOnLogsParameter<TAbiEvent, TAbiEvents, TStrict, _EventName>) => void;
22
+ export type WatchEventParameters<TAbiEvent extends AbiEvent | undefined = undefined, TAbiEvents extends readonly AbiEvent[] | readonly unknown[] | undefined = TAbiEvent extends AbiEvent ? [TAbiEvent] : undefined, TStrict extends boolean | undefined = undefined, _EventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
23
+ /** The address of the contract. */
24
+ address?: Address | Address[];
25
+ /** The callback to call when an error occurred when trying to get for a new block. */
26
+ onError?: (error: Error) => void;
27
+ /** The callback to call when new event logs are received. */
28
+ onLogs: WatchEventOnLogsFn<TAbiEvent, TAbiEvents, TStrict, _EventName>;
29
+ } & (GetTransportConfig<Transport>['type'] extends 'webSocket' ? {
30
+ batch?: never;
31
+ /**
32
+ * Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`.
33
+ * @default false
34
+ */
35
+ poll?: false;
36
+ pollingInterval?: never;
37
+ } | (PollOptions & {
38
+ /**
39
+ * Whether or not the WebSocket Transport should poll the JSON-RPC, rather than using `eth_subscribe`.
40
+ * @default true
41
+ */
42
+ poll?: true;
43
+ }) : PollOptions & {
44
+ poll?: true;
45
+ }) & ({
46
+ event: TAbiEvent;
47
+ events?: never;
48
+ args?: MaybeExtractEventArgsFromAbi<TAbiEvents, _EventName>;
49
+ /**
50
+ * Whether or not the logs must match the indexed/non-indexed arguments on `event`.
51
+ * @default false
52
+ */
53
+ strict?: TStrict;
54
+ } | {
55
+ event?: never;
56
+ events?: TAbiEvents;
57
+ args?: never;
58
+ /**
59
+ * Whether or not the logs must match the indexed/non-indexed arguments on `event`.
60
+ * @default false
61
+ */
62
+ strict?: TStrict;
63
+ } | {
64
+ event?: never;
65
+ events?: never;
66
+ args?: never;
67
+ strict?: never;
68
+ });
69
+ export type WatchEventReturnType = () => void;
70
+ /**
71
+ * Watches and returns emitted [Event Logs](https://viem.sh/docs/glossary/terms.html#event-log).
72
+ *
73
+ * - Docs: https://viem.sh/docs/actions/public/watchEvent.html
74
+ * - JSON-RPC Methods:
75
+ * - **RPC Provider supports `eth_newFilter`:**
76
+ * - Calls [`eth_newFilter`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter) to create a filter (called on initialize).
77
+ * - On a polling interval, it will call [`eth_getFilterChanges`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getfilterchanges).
78
+ * - **RPC Provider does not support `eth_newFilter`:**
79
+ * - Calls [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs) for each block between the polling interval.
80
+ *
81
+ * 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).
82
+ *
83
+ * `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.html) instead.
84
+ *
85
+ * @param client - Client to use
86
+ * @param parameters - {@link WatchEventParameters}
87
+ * @returns A function that can be invoked to stop watching for new Event Logs. {@link WatchEventReturnType}
88
+ *
89
+ * @example
90
+ * import { createPublicClient, http } from 'viem'
91
+ * import { mainnet } from 'viem/chains'
92
+ * import { watchEvent } from 'viem/public'
93
+ *
94
+ * const client = createPublicClient({
95
+ * chain: mainnet,
96
+ * transport: http(),
97
+ * })
98
+ * const unwatch = watchEvent(client, {
99
+ * onLogs: (logs) => console.log(logs),
100
+ * })
101
+ */
102
+ export declare function watchEvent<TChain extends Chain | undefined, const TAbiEvent extends AbiEvent | undefined = undefined, const TAbiEvents extends readonly AbiEvent[] | readonly unknown[] | undefined = TAbiEvent extends AbiEvent ? [TAbiEvent] : undefined, TStrict extends boolean | undefined = undefined, _EventName extends string | undefined = undefined>(client: Client<Transport, TChain>, { address, args, batch, event, events, onError, onLogs, poll: poll_, pollingInterval, strict: strict_, }: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict>): WatchEventReturnType;
103
+ export {};
104
+ //# sourceMappingURL=watchEvent.d.ts.map