viem 0.0.0-portable-types-20230522163654 → 0.0.0-tmm-sign-typed-data-types.20230619T221425

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 (736) hide show
  1. package/README.md +12 -0
  2. package/dist/cjs/actions/ens/getEnsAddress.js +34 -23
  3. package/dist/cjs/actions/ens/getEnsAddress.js.map +1 -1
  4. package/dist/cjs/actions/getContract.js +22 -16
  5. package/dist/cjs/actions/getContract.js.map +1 -1
  6. package/dist/cjs/actions/public/call.js +1 -1
  7. package/dist/cjs/actions/public/call.js.map +1 -1
  8. package/dist/cjs/actions/public/createContractEventFilter.js +2 -1
  9. package/dist/cjs/actions/public/createContractEventFilter.js.map +1 -1
  10. package/dist/cjs/actions/public/createEventFilter.js +2 -1
  11. package/dist/cjs/actions/public/createEventFilter.js.map +1 -1
  12. package/dist/cjs/actions/public/estimateContractGas.js +1 -1
  13. package/dist/cjs/actions/public/estimateContractGas.js.map +1 -1
  14. package/dist/cjs/actions/public/estimateGas.js +3 -2
  15. package/dist/cjs/actions/public/estimateGas.js.map +1 -1
  16. package/dist/cjs/actions/public/getBlock.js.map +1 -1
  17. package/dist/cjs/actions/public/getBlockTransactionCount.js +1 -1
  18. package/dist/cjs/actions/public/getBlockTransactionCount.js.map +1 -1
  19. package/dist/cjs/actions/public/getChainId.js +3 -1
  20. package/dist/cjs/actions/public/getChainId.js.map +1 -1
  21. package/dist/cjs/actions/public/getFilterChanges.js +15 -3
  22. package/dist/cjs/actions/public/getFilterChanges.js.map +1 -1
  23. package/dist/cjs/actions/public/getFilterLogs.js +14 -2
  24. package/dist/cjs/actions/public/getFilterLogs.js.map +1 -1
  25. package/dist/cjs/actions/public/getGasPrice.js.map +1 -1
  26. package/dist/cjs/actions/public/getLogs.js +15 -3
  27. package/dist/cjs/actions/public/getLogs.js.map +1 -1
  28. package/dist/cjs/actions/public/getTransactionCount.js.map +1 -1
  29. package/dist/cjs/actions/public/verifyTypedData.js +6 -1
  30. package/dist/cjs/actions/public/verifyTypedData.js.map +1 -1
  31. package/dist/cjs/actions/public/watchContractEvent.js +3 -1
  32. package/dist/cjs/actions/public/watchContractEvent.js.map +1 -1
  33. package/dist/cjs/actions/public/watchEvent.js +3 -1
  34. package/dist/cjs/actions/public/watchEvent.js.map +1 -1
  35. package/dist/cjs/actions/test/getAutomine.js +4 -0
  36. package/dist/cjs/actions/test/getAutomine.js.map +1 -1
  37. package/dist/cjs/actions/test/mine.js +10 -4
  38. package/dist/cjs/actions/test/mine.js.map +1 -1
  39. package/dist/cjs/actions/test/sendUnsignedTransaction.js +21 -3
  40. package/dist/cjs/actions/test/sendUnsignedTransaction.js.map +1 -1
  41. package/dist/cjs/actions/test/setAutomine.js +11 -4
  42. package/dist/cjs/actions/test/setAutomine.js.map +1 -1
  43. package/dist/cjs/actions/test/setBalance.js +10 -4
  44. package/dist/cjs/actions/test/setBalance.js.map +1 -1
  45. package/dist/cjs/actions/wallet/sendTransaction.js +1 -1
  46. package/dist/cjs/actions/wallet/sendTransaction.js.map +1 -1
  47. package/dist/cjs/actions/wallet/signMessage.js +8 -1
  48. package/dist/cjs/actions/wallet/signMessage.js.map +1 -1
  49. package/dist/cjs/chains.js +14 -2
  50. package/dist/cjs/chains.js.map +1 -1
  51. package/dist/cjs/clients/createClient.js +1 -1
  52. package/dist/cjs/clients/createClient.js.map +1 -1
  53. package/dist/cjs/clients/createPublicClient.js.map +1 -1
  54. package/dist/cjs/clients/createTestClient.js.map +1 -1
  55. package/dist/cjs/clients/createWalletClient.js.map +1 -1
  56. package/dist/cjs/clients/decorators/public.js.map +1 -1
  57. package/dist/cjs/clients/decorators/test.js.map +1 -1
  58. package/dist/cjs/clients/transports/createTransport.js.map +1 -1
  59. package/dist/cjs/clients/transports/custom.js.map +1 -1
  60. package/dist/cjs/clients/transports/fallback.js.map +1 -1
  61. package/dist/cjs/clients/transports/http.js +25 -7
  62. package/dist/cjs/clients/transports/http.js.map +1 -1
  63. package/dist/cjs/clients/transports/webSocket.js +22 -14
  64. package/dist/cjs/clients/transports/webSocket.js.map +1 -1
  65. package/dist/cjs/errors/abi.js +15 -1
  66. package/dist/cjs/errors/abi.js.map +1 -1
  67. package/dist/cjs/errors/base.js +4 -11
  68. package/dist/cjs/errors/base.js.map +1 -1
  69. package/dist/cjs/errors/request.js.map +1 -1
  70. package/dist/cjs/errors/rpc.js +8 -2
  71. package/dist/cjs/errors/rpc.js.map +1 -1
  72. package/dist/cjs/errors/version.js +1 -1
  73. package/dist/cjs/errors/version.js.map +1 -1
  74. package/dist/cjs/index.js +26 -10
  75. package/dist/cjs/index.js.map +1 -1
  76. package/dist/cjs/types/eip1193.js +3 -3
  77. package/dist/cjs/types/eip1193.js.map +1 -1
  78. package/dist/cjs/utils/abi/decodeEventLog.js +33 -19
  79. package/dist/cjs/utils/abi/decodeEventLog.js.map +1 -1
  80. package/dist/cjs/utils/abi/encodeEventTopics.js +11 -7
  81. package/dist/cjs/utils/abi/encodeEventTopics.js.map +1 -1
  82. package/dist/cjs/utils/abi/getAbiItem.js +2 -0
  83. package/dist/cjs/utils/abi/getAbiItem.js.map +1 -1
  84. package/dist/cjs/utils/buildRequest.js.map +1 -1
  85. package/dist/cjs/utils/encoding/toBytes.js.map +1 -1
  86. package/dist/cjs/utils/encoding/toHex.js.map +1 -1
  87. package/dist/cjs/utils/ens/encodeLabelhash.js +8 -0
  88. package/dist/cjs/utils/ens/encodeLabelhash.js.map +1 -0
  89. package/dist/cjs/utils/ens/encodedLabelToLabelhash.js +18 -0
  90. package/dist/cjs/utils/ens/encodedLabelToLabelhash.js.map +1 -0
  91. package/dist/cjs/utils/ens/labelhash.js +2 -1
  92. package/dist/cjs/utils/ens/labelhash.js.map +1 -1
  93. package/dist/cjs/utils/ens/namehash.js +5 -1
  94. package/dist/cjs/utils/ens/namehash.js.map +1 -1
  95. package/dist/cjs/utils/ens/packetToBytes.js +10 -9
  96. package/dist/cjs/utils/ens/packetToBytes.js.map +1 -1
  97. package/dist/cjs/utils/filters/createFilterRequestScope.js.map +1 -1
  98. package/dist/cjs/utils/formatters/block.js +3 -1
  99. package/dist/cjs/utils/formatters/block.js.map +1 -1
  100. package/dist/cjs/utils/formatters/log.js +2 -2
  101. package/dist/cjs/utils/formatters/transaction.js +3 -1
  102. package/dist/cjs/utils/formatters/transaction.js.map +1 -1
  103. package/dist/cjs/utils/formatters/transactionReceipt.js +1 -1
  104. package/dist/cjs/utils/formatters/transactionReceipt.js.map +1 -1
  105. package/dist/cjs/utils/formatters/transactionRequest.js.map +1 -1
  106. package/dist/cjs/utils/hash/getEventSelector.js +5 -1
  107. package/dist/cjs/utils/hash/getEventSelector.js.map +1 -1
  108. package/dist/cjs/utils/hash/getFunctionSelector.js +5 -1
  109. package/dist/cjs/utils/hash/getFunctionSelector.js.map +1 -1
  110. package/dist/cjs/utils/hash/hashFunction.js +6 -4
  111. package/dist/cjs/utils/hash/hashFunction.js.map +1 -1
  112. package/dist/cjs/utils/index.js.map +1 -1
  113. package/dist/cjs/utils/observe.js.map +1 -1
  114. package/dist/cjs/utils/promise/createBatchScheduler.js.map +1 -1
  115. package/dist/cjs/utils/promise/withCache.js +8 -4
  116. package/dist/cjs/utils/promise/withCache.js.map +1 -1
  117. package/dist/cjs/utils/rpc.js +12 -17
  118. package/dist/cjs/utils/rpc.js.map +1 -1
  119. package/dist/cjs/utils/signature/hashMessage.js +7 -1
  120. package/dist/cjs/utils/signature/hashMessage.js.map +1 -1
  121. package/dist/cjs/utils/transaction/getTransactionType.js.map +1 -1
  122. package/dist/cjs/utils/transaction/prepareRequest.js +1 -2
  123. package/dist/cjs/utils/transaction/prepareRequest.js.map +1 -1
  124. package/dist/cjs/utils/transaction/serializeTransaction.js.map +1 -1
  125. package/dist/cjs/utils/typedData.js.map +1 -1
  126. package/dist/cjs/utils/unit/parseUnits.js +13 -3
  127. package/dist/cjs/utils/unit/parseUnits.js.map +1 -1
  128. package/dist/esm/accounts/generateMnemonic.js +7 -0
  129. package/dist/esm/accounts/generateMnemonic.js.map +1 -1
  130. package/dist/esm/accounts/generatePrivateKey.js +5 -0
  131. package/dist/esm/accounts/generatePrivateKey.js.map +1 -1
  132. package/dist/esm/accounts/hdKeyToAccount.js +5 -0
  133. package/dist/esm/accounts/hdKeyToAccount.js.map +1 -1
  134. package/dist/esm/accounts/mnemonicToAccount.js +5 -0
  135. package/dist/esm/accounts/mnemonicToAccount.js.map +1 -1
  136. package/dist/esm/accounts/privateKeyToAccount.js +5 -0
  137. package/dist/esm/accounts/privateKeyToAccount.js.map +1 -1
  138. package/dist/esm/accounts/toAccount.js +5 -0
  139. package/dist/esm/accounts/toAccount.js.map +1 -1
  140. package/dist/esm/accounts/utils/publicKeyToAddress.js +7 -0
  141. package/dist/esm/accounts/utils/publicKeyToAddress.js.map +1 -1
  142. package/dist/esm/accounts/utils/sign.js +8 -0
  143. package/dist/esm/accounts/utils/sign.js.map +1 -1
  144. package/dist/esm/accounts/utils/signMessage.js +6 -0
  145. package/dist/esm/accounts/utils/signMessage.js.map +1 -1
  146. package/dist/esm/accounts/utils/signTypedData.js +6 -0
  147. package/dist/esm/accounts/utils/signTypedData.js.map +1 -1
  148. package/dist/esm/actions/ens/getEnsAddress.js +62 -23
  149. package/dist/esm/actions/ens/getEnsAddress.js.map +1 -1
  150. package/dist/esm/actions/ens/getEnsAvatar.js +28 -0
  151. package/dist/esm/actions/ens/getEnsAvatar.js.map +1 -1
  152. package/dist/esm/actions/ens/getEnsName.js +27 -0
  153. package/dist/esm/actions/ens/getEnsName.js.map +1 -1
  154. package/dist/esm/actions/ens/getEnsResolver.js +28 -0
  155. package/dist/esm/actions/ens/getEnsResolver.js.map +1 -1
  156. package/dist/esm/actions/ens/getEnsText.js +29 -0
  157. package/dist/esm/actions/ens/getEnsText.js.map +1 -1
  158. package/dist/esm/actions/getContract.js +58 -16
  159. package/dist/esm/actions/getContract.js.map +1 -1
  160. package/dist/esm/actions/public/call.js +32 -1
  161. package/dist/esm/actions/public/call.js.map +1 -1
  162. package/dist/esm/actions/public/createBlockFilter.js +21 -0
  163. package/dist/esm/actions/public/createBlockFilter.js.map +1 -1
  164. package/dist/esm/actions/public/createContractEventFilter.js +24 -1
  165. package/dist/esm/actions/public/createContractEventFilter.js.map +1 -1
  166. package/dist/esm/actions/public/createEventFilter.js +25 -1
  167. package/dist/esm/actions/public/createEventFilter.js.map +1 -1
  168. package/dist/esm/actions/public/createPendingTransactionFilter.js +21 -0
  169. package/dist/esm/actions/public/createPendingTransactionFilter.js.map +1 -1
  170. package/dist/esm/actions/public/estimateContractGas.js +28 -1
  171. package/dist/esm/actions/public/estimateContractGas.js.map +1 -1
  172. package/dist/esm/actions/public/estimateGas.js +29 -2
  173. package/dist/esm/actions/public/estimateGas.js.map +1 -1
  174. package/dist/esm/actions/public/getBalance.js +35 -0
  175. package/dist/esm/actions/public/getBalance.js.map +1 -1
  176. package/dist/esm/actions/public/getBlock.js +24 -0
  177. package/dist/esm/actions/public/getBlock.js.map +1 -1
  178. package/dist/esm/actions/public/getBlockNumber.js +23 -0
  179. package/dist/esm/actions/public/getBlockNumber.js.map +1 -1
  180. package/dist/esm/actions/public/getBlockTransactionCount.js +24 -1
  181. package/dist/esm/actions/public/getBlockTransactionCount.js.map +1 -1
  182. package/dist/esm/actions/public/getBytecode.js +23 -0
  183. package/dist/esm/actions/public/getBytecode.js.map +1 -1
  184. package/dist/esm/actions/public/getChainId.js +24 -1
  185. package/dist/esm/actions/public/getChainId.js.map +1 -1
  186. package/dist/esm/actions/public/getFeeHistory.js +24 -0
  187. package/dist/esm/actions/public/getFeeHistory.js.map +1 -1
  188. package/dist/esm/actions/public/getFilterChanges.js +99 -3
  189. package/dist/esm/actions/public/getFilterChanges.js.map +1 -1
  190. package/dist/esm/actions/public/getFilterLogs.js +43 -2
  191. package/dist/esm/actions/public/getFilterLogs.js.map +1 -1
  192. package/dist/esm/actions/public/getGasPrice.js +20 -0
  193. package/dist/esm/actions/public/getGasPrice.js.map +1 -1
  194. package/dist/esm/actions/public/getLogs.js +39 -3
  195. package/dist/esm/actions/public/getLogs.js.map +1 -1
  196. package/dist/esm/actions/public/getStorageAt.js +24 -0
  197. package/dist/esm/actions/public/getStorageAt.js.map +1 -1
  198. package/dist/esm/actions/public/getTransaction.js +24 -0
  199. package/dist/esm/actions/public/getTransaction.js.map +1 -1
  200. package/dist/esm/actions/public/getTransactionConfirmations.js +24 -0
  201. package/dist/esm/actions/public/getTransactionConfirmations.js.map +1 -1
  202. package/dist/esm/actions/public/getTransactionCount.js +23 -0
  203. package/dist/esm/actions/public/getTransactionCount.js.map +1 -1
  204. package/dist/esm/actions/public/getTransactionReceipt.js +24 -0
  205. package/dist/esm/actions/public/getTransactionReceipt.js.map +1 -1
  206. package/dist/esm/actions/public/multicall.js +40 -0
  207. package/dist/esm/actions/public/multicall.js.map +1 -1
  208. package/dist/esm/actions/public/readContract.js +31 -0
  209. package/dist/esm/actions/public/readContract.js.map +1 -1
  210. package/dist/esm/actions/public/simulateContract.js +31 -0
  211. package/dist/esm/actions/public/simulateContract.js.map +1 -1
  212. package/dist/esm/actions/public/uninstallFilter.js +24 -0
  213. package/dist/esm/actions/public/uninstallFilter.js.map +1 -1
  214. package/dist/esm/actions/public/verifyHash.js +10 -0
  215. package/dist/esm/actions/public/verifyHash.js.map +1 -1
  216. package/dist/esm/actions/public/verifyMessage.js +11 -0
  217. package/dist/esm/actions/public/verifyMessage.js.map +1 -1
  218. package/dist/esm/actions/public/verifyTypedData.js +16 -2
  219. package/dist/esm/actions/public/verifyTypedData.js.map +1 -1
  220. package/dist/esm/actions/public/waitForTransactionReceipt.js +52 -0
  221. package/dist/esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  222. package/dist/esm/actions/public/watchBlockNumber.js +31 -0
  223. package/dist/esm/actions/public/watchBlockNumber.js.map +1 -1
  224. package/dist/esm/actions/public/watchBlocks.js +35 -1
  225. package/dist/esm/actions/public/watchBlocks.js.map +1 -1
  226. package/dist/esm/actions/public/watchContractEvent.js +39 -1
  227. package/dist/esm/actions/public/watchContractEvent.js.map +1 -1
  228. package/dist/esm/actions/public/watchEvent.js +41 -1
  229. package/dist/esm/actions/public/watchEvent.js.map +1 -1
  230. package/dist/esm/actions/public/watchPendingTransactions.js +29 -0
  231. package/dist/esm/actions/public/watchPendingTransactions.js.map +1 -1
  232. package/dist/esm/actions/test/dropTransaction.js +22 -0
  233. package/dist/esm/actions/test/dropTransaction.js.map +1 -1
  234. package/dist/esm/actions/test/getAutomine.js +24 -0
  235. package/dist/esm/actions/test/getAutomine.js.map +1 -1
  236. package/dist/esm/actions/test/getTxpoolContent.js +20 -0
  237. package/dist/esm/actions/test/getTxpoolContent.js.map +1 -1
  238. package/dist/esm/actions/test/getTxpoolStatus.js +20 -0
  239. package/dist/esm/actions/test/getTxpoolStatus.js.map +1 -1
  240. package/dist/esm/actions/test/impersonateAccount.js +22 -0
  241. package/dist/esm/actions/test/impersonateAccount.js.map +1 -1
  242. package/dist/esm/actions/test/increaseTime.js +22 -0
  243. package/dist/esm/actions/test/increaseTime.js.map +1 -1
  244. package/dist/esm/actions/test/inspectTxpool.js +20 -0
  245. package/dist/esm/actions/test/inspectTxpool.js.map +1 -1
  246. package/dist/esm/actions/test/mine.js +30 -4
  247. package/dist/esm/actions/test/mine.js.map +1 -1
  248. package/dist/esm/actions/test/removeBlockTimestampInterval.js +19 -0
  249. package/dist/esm/actions/test/removeBlockTimestampInterval.js.map +1 -1
  250. package/dist/esm/actions/test/reset.js +20 -0
  251. package/dist/esm/actions/test/reset.js.map +1 -1
  252. package/dist/esm/actions/test/revert.js +20 -0
  253. package/dist/esm/actions/test/revert.js.map +1 -1
  254. package/dist/esm/actions/test/sendUnsignedTransaction.js +48 -4
  255. package/dist/esm/actions/test/sendUnsignedTransaction.js.map +1 -1
  256. package/dist/esm/actions/test/setAutomine.js +30 -4
  257. package/dist/esm/actions/test/setAutomine.js.map +1 -1
  258. package/dist/esm/actions/test/setBalance.js +33 -4
  259. package/dist/esm/actions/test/setBalance.js.map +1 -1
  260. package/dist/esm/actions/test/setBlockGasLimit.js +20 -0
  261. package/dist/esm/actions/test/setBlockGasLimit.js.map +1 -1
  262. package/dist/esm/actions/test/setBlockTimestampInterval.js +20 -0
  263. package/dist/esm/actions/test/setBlockTimestampInterval.js.map +1 -1
  264. package/dist/esm/actions/test/setCode.js +23 -0
  265. package/dist/esm/actions/test/setCode.js.map +1 -1
  266. package/dist/esm/actions/test/setCoinbase.js +22 -0
  267. package/dist/esm/actions/test/setCoinbase.js.map +1 -1
  268. package/dist/esm/actions/test/setIntervalMining.js +20 -0
  269. package/dist/esm/actions/test/setIntervalMining.js.map +1 -1
  270. package/dist/esm/actions/test/setLoggingEnabled.js +19 -0
  271. package/dist/esm/actions/test/setLoggingEnabled.js.map +1 -1
  272. package/dist/esm/actions/test/setMinGasPrice.js +24 -0
  273. package/dist/esm/actions/test/setMinGasPrice.js.map +1 -1
  274. package/dist/esm/actions/test/setNextBlockBaseFeePerGas.js +22 -0
  275. package/dist/esm/actions/test/setNextBlockBaseFeePerGas.js.map +1 -1
  276. package/dist/esm/actions/test/setNextBlockTimestamp.js +20 -0
  277. package/dist/esm/actions/test/setNextBlockTimestamp.js.map +1 -1
  278. package/dist/esm/actions/test/setNonce.js +23 -0
  279. package/dist/esm/actions/test/setNonce.js.map +1 -1
  280. package/dist/esm/actions/test/setRpcUrl.js +20 -0
  281. package/dist/esm/actions/test/setRpcUrl.js.map +1 -1
  282. package/dist/esm/actions/test/setStorageAt.js +24 -0
  283. package/dist/esm/actions/test/setStorageAt.js.map +1 -1
  284. package/dist/esm/actions/test/snapshot.js +19 -0
  285. package/dist/esm/actions/test/snapshot.js.map +1 -1
  286. package/dist/esm/actions/test/stopImpersonatingAccount.js +22 -0
  287. package/dist/esm/actions/test/stopImpersonatingAccount.js.map +1 -1
  288. package/dist/esm/actions/wallet/addChain.js +19 -0
  289. package/dist/esm/actions/wallet/addChain.js.map +1 -1
  290. package/dist/esm/actions/wallet/deployContract.js +27 -0
  291. package/dist/esm/actions/wallet/deployContract.js.map +1 -1
  292. package/dist/esm/actions/wallet/getAddresses.js +20 -0
  293. package/dist/esm/actions/wallet/getAddresses.js.map +1 -1
  294. package/dist/esm/actions/wallet/getPermissions.js +20 -0
  295. package/dist/esm/actions/wallet/getPermissions.js.map +1 -1
  296. package/dist/esm/actions/wallet/requestAddresses.js +24 -0
  297. package/dist/esm/actions/wallet/requestAddresses.js.map +1 -1
  298. package/dist/esm/actions/wallet/requestPermissions.js +23 -0
  299. package/dist/esm/actions/wallet/requestPermissions.js.map +1 -1
  300. package/dist/esm/actions/wallet/sendTransaction.js +48 -1
  301. package/dist/esm/actions/wallet/sendTransaction.js.map +1 -1
  302. package/dist/esm/actions/wallet/signMessage.js +55 -2
  303. package/dist/esm/actions/wallet/signMessage.js.map +1 -1
  304. package/dist/esm/actions/wallet/signTypedData.js +100 -0
  305. package/dist/esm/actions/wallet/signTypedData.js.map +1 -1
  306. package/dist/esm/actions/wallet/switchChain.js +20 -0
  307. package/dist/esm/actions/wallet/switchChain.js.map +1 -1
  308. package/dist/esm/actions/wallet/watchAsset.js +28 -0
  309. package/dist/esm/actions/wallet/watchAsset.js.map +1 -1
  310. package/dist/esm/actions/wallet/writeContract.js +50 -0
  311. package/dist/esm/actions/wallet/writeContract.js.map +1 -1
  312. package/dist/esm/chains.js +99 -87
  313. package/dist/esm/chains.js.map +1 -1
  314. package/dist/esm/clients/createClient.js +4 -1
  315. package/dist/esm/clients/createClient.js.map +1 -1
  316. package/dist/esm/clients/createPublicClient.js +19 -0
  317. package/dist/esm/clients/createPublicClient.js.map +1 -1
  318. package/dist/esm/clients/createTestClient.js +23 -0
  319. package/dist/esm/clients/createTestClient.js.map +1 -1
  320. package/dist/esm/clients/createWalletClient.js +36 -0
  321. package/dist/esm/clients/createWalletClient.js.map +1 -1
  322. package/dist/esm/clients/decorators/public.js.map +1 -1
  323. package/dist/esm/clients/decorators/test.js.map +1 -1
  324. package/dist/esm/clients/transports/createTransport.js +3 -0
  325. package/dist/esm/clients/transports/createTransport.js.map +1 -1
  326. package/dist/esm/clients/transports/custom.js +3 -0
  327. package/dist/esm/clients/transports/custom.js.map +1 -1
  328. package/dist/esm/clients/transports/fallback.js +11 -0
  329. package/dist/esm/clients/transports/fallback.js.map +1 -1
  330. package/dist/esm/clients/transports/http.js +31 -8
  331. package/dist/esm/clients/transports/http.js.map +1 -1
  332. package/dist/esm/clients/transports/webSocket.js +28 -15
  333. package/dist/esm/clients/transports/webSocket.js.map +1 -1
  334. package/dist/esm/constants/abis.js +6 -0
  335. package/dist/esm/constants/abis.js.map +1 -1
  336. package/dist/esm/constants/solidity.js +1 -0
  337. package/dist/esm/constants/solidity.js.map +1 -1
  338. package/dist/esm/contract.js +0 -1
  339. package/dist/esm/contract.js.map +1 -1
  340. package/dist/esm/errors/abi.js +15 -1
  341. package/dist/esm/errors/abi.js.map +1 -1
  342. package/dist/esm/errors/base.js +4 -11
  343. package/dist/esm/errors/base.js.map +1 -1
  344. package/dist/esm/errors/node.js +9 -0
  345. package/dist/esm/errors/node.js.map +1 -1
  346. package/dist/esm/errors/request.js.map +1 -1
  347. package/dist/esm/errors/rpc.js +111 -2
  348. package/dist/esm/errors/rpc.js.map +1 -1
  349. package/dist/esm/errors/version.js +1 -1
  350. package/dist/esm/errors/version.js.map +1 -1
  351. package/dist/esm/index.js +2 -51
  352. package/dist/esm/index.js.map +1 -1
  353. package/dist/esm/package.json +1 -1
  354. package/dist/esm/types/account.js +1 -1
  355. package/dist/esm/types/account.js.map +1 -1
  356. package/dist/esm/types/eip1193.js +3 -1
  357. package/dist/esm/types/eip1193.js.map +1 -1
  358. package/dist/esm/utils/abi/decodeAbiParameters.js +29 -0
  359. package/dist/esm/utils/abi/decodeAbiParameters.js.map +1 -1
  360. package/dist/esm/utils/abi/decodeEventLog.js +35 -19
  361. package/dist/esm/utils/abi/decodeEventLog.js.map +1 -1
  362. package/dist/esm/utils/abi/encodeAbiParameters.js +10 -1
  363. package/dist/esm/utils/abi/encodeAbiParameters.js.map +1 -1
  364. package/dist/esm/utils/abi/encodeEventTopics.js +11 -7
  365. package/dist/esm/utils/abi/encodeEventTopics.js.map +1 -1
  366. package/dist/esm/utils/abi/getAbiItem.js +9 -0
  367. package/dist/esm/utils/abi/getAbiItem.js.map +1 -1
  368. package/dist/esm/utils/accounts.js +3 -0
  369. package/dist/esm/utils/accounts.js.map +1 -1
  370. package/dist/esm/utils/buildRequest.js +2 -0
  371. package/dist/esm/utils/buildRequest.js.map +1 -1
  372. package/dist/esm/utils/data/size.js +6 -0
  373. package/dist/esm/utils/data/size.js.map +1 -1
  374. package/dist/esm/utils/data/slice.js +21 -0
  375. package/dist/esm/utils/data/slice.js.map +1 -1
  376. package/dist/esm/utils/encoding/fromBytes.js +79 -0
  377. package/dist/esm/utils/encoding/fromBytes.js.map +1 -1
  378. package/dist/esm/utils/encoding/fromHex.js +106 -0
  379. package/dist/esm/utils/encoding/fromHex.js.map +1 -1
  380. package/dist/esm/utils/encoding/toBytes.js +102 -1
  381. package/dist/esm/utils/encoding/toBytes.js.map +1 -1
  382. package/dist/esm/utils/encoding/toHex.js +108 -2
  383. package/dist/esm/utils/encoding/toHex.js.map +1 -1
  384. package/dist/esm/utils/ens/avatar/parseAvatarRecord.js +6 -2
  385. package/dist/esm/utils/ens/avatar/parseAvatarRecord.js.map +1 -1
  386. package/dist/esm/utils/ens/avatar/utils.js +10 -0
  387. package/dist/esm/utils/ens/avatar/utils.js.map +1 -1
  388. package/dist/esm/utils/ens/encodeLabelhash.js +4 -0
  389. package/dist/esm/utils/ens/encodeLabelhash.js.map +1 -0
  390. package/dist/esm/utils/ens/encodedLabelToLabelhash.js +14 -0
  391. package/dist/esm/utils/ens/encodedLabelToLabelhash.js.map +1 -0
  392. package/dist/esm/utils/ens/labelhash.js +11 -1
  393. package/dist/esm/utils/ens/labelhash.js.map +1 -1
  394. package/dist/esm/utils/ens/namehash.js +18 -2
  395. package/dist/esm/utils/ens/namehash.js.map +1 -1
  396. package/dist/esm/utils/ens/normalize.js +10 -0
  397. package/dist/esm/utils/ens/normalize.js.map +1 -1
  398. package/dist/esm/utils/ens/packetToBytes.js +16 -9
  399. package/dist/esm/utils/ens/packetToBytes.js.map +1 -1
  400. package/dist/esm/utils/filters/createFilterRequestScope.js +5 -0
  401. package/dist/esm/utils/filters/createFilterRequestScope.js.map +1 -1
  402. package/dist/esm/utils/formatters/block.js +4 -1
  403. package/dist/esm/utils/formatters/block.js.map +1 -1
  404. package/dist/esm/utils/formatters/extract.js +3 -0
  405. package/dist/esm/utils/formatters/extract.js.map +1 -1
  406. package/dist/esm/utils/formatters/format.js +3 -0
  407. package/dist/esm/utils/formatters/format.js.map +1 -1
  408. package/dist/esm/utils/formatters/log.js +2 -2
  409. package/dist/esm/utils/formatters/transaction.js +3 -1
  410. package/dist/esm/utils/formatters/transaction.js.map +1 -1
  411. package/dist/esm/utils/formatters/transactionReceipt.js +2 -2
  412. package/dist/esm/utils/formatters/transactionReceipt.js.map +1 -1
  413. package/dist/esm/utils/formatters/transactionRequest.js +1 -1
  414. package/dist/esm/utils/formatters/transactionRequest.js.map +1 -1
  415. package/dist/esm/utils/hash/getEventSelector.js +6 -2
  416. package/dist/esm/utils/hash/getEventSelector.js.map +1 -1
  417. package/dist/esm/utils/hash/getFunctionSelector.js +6 -2
  418. package/dist/esm/utils/hash/getFunctionSelector.js.map +1 -1
  419. package/dist/esm/utils/hash/hashFunction.js +4 -3
  420. package/dist/esm/utils/hash/hashFunction.js.map +1 -1
  421. package/dist/esm/utils/index.js.map +1 -1
  422. package/dist/esm/utils/observe.js +7 -2
  423. package/dist/esm/utils/observe.js.map +1 -1
  424. package/dist/esm/utils/poll.js +3 -0
  425. package/dist/esm/utils/poll.js.map +1 -1
  426. package/dist/esm/utils/promise/createBatchScheduler.js +1 -1
  427. package/dist/esm/utils/promise/createBatchScheduler.js.map +1 -1
  428. package/dist/esm/utils/promise/withCache.js +23 -6
  429. package/dist/esm/utils/promise/withCache.js.map +1 -1
  430. package/dist/esm/utils/regex.js +4 -0
  431. package/dist/esm/utils/regex.js.map +1 -1
  432. package/dist/esm/utils/rpc.js +27 -19
  433. package/dist/esm/utils/rpc.js.map +1 -1
  434. package/dist/esm/utils/signature/hashMessage.js +8 -2
  435. package/dist/esm/utils/signature/hashMessage.js.map +1 -1
  436. package/dist/esm/utils/signature/hashTypedData.js +3 -0
  437. package/dist/esm/utils/signature/hashTypedData.js.map +1 -1
  438. package/dist/esm/utils/signature/recoverPublicKey.js +2 -0
  439. package/dist/esm/utils/signature/recoverPublicKey.js.map +1 -1
  440. package/dist/esm/utils/signature/verifyMessage.js +12 -0
  441. package/dist/esm/utils/signature/verifyMessage.js.map +1 -1
  442. package/dist/esm/utils/signature/verifyTypedData.js +12 -0
  443. package/dist/esm/utils/signature/verifyTypedData.js.map +1 -1
  444. package/dist/esm/utils/transaction/getTransactionType.js.map +1 -1
  445. package/dist/esm/utils/transaction/prepareRequest.js +5 -2
  446. package/dist/esm/utils/transaction/prepareRequest.js.map +1 -1
  447. package/dist/esm/utils/transaction/serializeTransaction.js +4 -2
  448. package/dist/esm/utils/transaction/serializeTransaction.js.map +1 -1
  449. package/dist/esm/utils/typedData.js +4 -0
  450. package/dist/esm/utils/typedData.js.map +1 -1
  451. package/dist/esm/utils/unit/parseUnits.js +15 -3
  452. package/dist/esm/utils/unit/parseUnits.js.map +1 -1
  453. package/dist/types/accounts/types.d.ts +3 -5
  454. package/dist/types/accounts/types.d.ts.map +1 -1
  455. package/dist/types/accounts/utils/signMessage.d.ts +2 -2
  456. package/dist/types/accounts/utils/signMessage.d.ts.map +1 -1
  457. package/dist/types/accounts/utils/signTypedData.d.ts +3 -6
  458. package/dist/types/accounts/utils/signTypedData.d.ts.map +1 -1
  459. package/dist/types/actions/ens/getEnsAddress.d.ts.map +1 -1
  460. package/dist/types/actions/getContract.d.ts +65 -21
  461. package/dist/types/actions/getContract.d.ts.map +1 -1
  462. package/dist/types/actions/public/createBlockFilter.d.ts +1 -1
  463. package/dist/types/actions/public/createContractEventFilter.d.ts +9 -4
  464. package/dist/types/actions/public/createContractEventFilter.d.ts.map +1 -1
  465. package/dist/types/actions/public/createEventFilter.d.ts +18 -6
  466. package/dist/types/actions/public/createEventFilter.d.ts.map +1 -1
  467. package/dist/types/actions/public/createPendingTransactionFilter.d.ts +1 -1
  468. package/dist/types/actions/public/estimateContractGas.d.ts +5 -3
  469. package/dist/types/actions/public/estimateContractGas.d.ts.map +1 -1
  470. package/dist/types/actions/public/estimateGas.d.ts.map +1 -1
  471. package/dist/types/actions/public/getBlockNumber.d.ts +2 -2
  472. package/dist/types/actions/public/getBlockNumber.d.ts.map +1 -1
  473. package/dist/types/actions/public/getChainId.d.ts.map +1 -1
  474. package/dist/types/actions/public/getFilterChanges.d.ts +8 -8
  475. package/dist/types/actions/public/getFilterChanges.d.ts.map +1 -1
  476. package/dist/types/actions/public/getFilterLogs.d.ts +4 -4
  477. package/dist/types/actions/public/getFilterLogs.d.ts.map +1 -1
  478. package/dist/types/actions/public/getLogs.d.ts +10 -4
  479. package/dist/types/actions/public/getLogs.d.ts.map +1 -1
  480. package/dist/types/actions/public/getTransaction.d.ts +1 -1
  481. package/dist/types/actions/public/getTransactionCount.d.ts +1 -1
  482. package/dist/types/actions/public/getTransactionReceipt.d.ts +1 -1
  483. package/dist/types/actions/public/multicall.d.ts +1 -1
  484. package/dist/types/actions/public/readContract.d.ts +2 -2
  485. package/dist/types/actions/public/readContract.d.ts.map +1 -1
  486. package/dist/types/actions/public/simulateContract.d.ts +2 -2
  487. package/dist/types/actions/public/uninstallFilter.d.ts +3 -3
  488. package/dist/types/actions/public/verifyMessage.d.ts +2 -2
  489. package/dist/types/actions/public/verifyMessage.d.ts.map +1 -1
  490. package/dist/types/actions/public/verifyTypedData.d.ts +3 -4
  491. package/dist/types/actions/public/verifyTypedData.d.ts.map +1 -1
  492. package/dist/types/actions/public/watchContractEvent.d.ts +11 -6
  493. package/dist/types/actions/public/watchContractEvent.d.ts.map +1 -1
  494. package/dist/types/actions/public/watchEvent.d.ts +13 -7
  495. package/dist/types/actions/public/watchEvent.d.ts.map +1 -1
  496. package/dist/types/actions/test/getAutomine.d.ts.map +1 -1
  497. package/dist/types/actions/test/mine.d.ts.map +1 -1
  498. package/dist/types/actions/test/sendUnsignedTransaction.d.ts +8 -2
  499. package/dist/types/actions/test/sendUnsignedTransaction.d.ts.map +1 -1
  500. package/dist/types/actions/test/setAutomine.d.ts.map +1 -1
  501. package/dist/types/actions/test/setBalance.d.ts.map +1 -1
  502. package/dist/types/actions/test/setBlockTimestampInterval.d.ts +1 -1
  503. package/dist/types/actions/test/stopImpersonatingAccount.d.ts +1 -1
  504. package/dist/types/actions/wallet/deployContract.d.ts +1 -1
  505. package/dist/types/actions/wallet/signMessage.d.ts +4 -4
  506. package/dist/types/actions/wallet/signMessage.d.ts.map +1 -1
  507. package/dist/types/actions/wallet/signTypedData.d.ts +4 -7
  508. package/dist/types/actions/wallet/signTypedData.d.ts.map +1 -1
  509. package/dist/types/actions/wallet/writeContract.d.ts +3 -3
  510. package/dist/types/chains.d.ts +364 -16
  511. package/dist/types/chains.d.ts.map +1 -1
  512. package/dist/types/clients/createClient.d.ts +5 -5
  513. package/dist/types/clients/createClient.d.ts.map +1 -1
  514. package/dist/types/clients/createPublicClient.d.ts +4 -4
  515. package/dist/types/clients/createPublicClient.d.ts.map +1 -1
  516. package/dist/types/clients/createTestClient.d.ts +4 -4
  517. package/dist/types/clients/createTestClient.d.ts.map +1 -1
  518. package/dist/types/clients/createWalletClient.d.ts +4 -4
  519. package/dist/types/clients/createWalletClient.d.ts.map +1 -1
  520. package/dist/types/clients/decorators/public.d.ts +30 -30
  521. package/dist/types/clients/decorators/public.d.ts.map +1 -1
  522. package/dist/types/clients/decorators/test.d.ts +3 -3
  523. package/dist/types/clients/decorators/test.d.ts.map +1 -1
  524. package/dist/types/clients/decorators/wallet.d.ts +7 -9
  525. package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
  526. package/dist/types/clients/transports/createTransport.d.ts +5 -8
  527. package/dist/types/clients/transports/createTransport.d.ts.map +1 -1
  528. package/dist/types/clients/transports/custom.d.ts +2 -2
  529. package/dist/types/clients/transports/custom.d.ts.map +1 -1
  530. package/dist/types/clients/transports/http.d.ts +11 -0
  531. package/dist/types/clients/transports/http.d.ts.map +1 -1
  532. package/dist/types/clients/transports/webSocket.d.ts.map +1 -1
  533. package/dist/types/contract.d.ts +1 -1
  534. package/dist/types/contract.d.ts.map +1 -1
  535. package/dist/types/errors/abi.d.ts +6 -4
  536. package/dist/types/errors/abi.d.ts.map +1 -1
  537. package/dist/types/errors/base.d.ts +0 -1
  538. package/dist/types/errors/base.d.ts.map +1 -1
  539. package/dist/types/errors/request.d.ts +16 -8
  540. package/dist/types/errors/request.d.ts.map +1 -1
  541. package/dist/types/errors/rpc.d.ts +12 -8
  542. package/dist/types/errors/rpc.d.ts.map +1 -1
  543. package/dist/types/errors/version.d.ts +1 -1
  544. package/dist/types/errors/version.d.ts.map +1 -1
  545. package/dist/types/index.d.ts +56 -53
  546. package/dist/types/index.d.ts.map +1 -1
  547. package/dist/types/types/account.d.ts +1 -1
  548. package/dist/types/types/account.d.ts.map +1 -1
  549. package/dist/types/types/contract.d.ts +11 -6
  550. package/dist/types/types/contract.d.ts.map +1 -1
  551. package/dist/types/types/eip1193.d.ts +1048 -834
  552. package/dist/types/types/eip1193.d.ts.map +1 -1
  553. package/dist/types/types/filter.d.ts +12 -3
  554. package/dist/types/types/filter.d.ts.map +1 -1
  555. package/dist/types/types/log.d.ts +5 -3
  556. package/dist/types/types/log.d.ts.map +1 -1
  557. package/dist/types/types/misc.d.ts +4 -0
  558. package/dist/types/types/misc.d.ts.map +1 -1
  559. package/dist/types/types/rpc.d.ts +1 -1
  560. package/dist/types/types/rpc.d.ts.map +1 -1
  561. package/dist/types/types/transaction.d.ts +14 -5
  562. package/dist/types/types/transaction.d.ts.map +1 -1
  563. package/dist/types/types/typedData.d.ts +17 -29
  564. package/dist/types/types/typedData.d.ts.map +1 -1
  565. package/dist/types/types/utils.d.ts +11 -0
  566. package/dist/types/types/utils.d.ts.map +1 -1
  567. package/dist/types/utils/abi/decodeEventLog.d.ts +6 -5
  568. package/dist/types/utils/abi/decodeEventLog.d.ts.map +1 -1
  569. package/dist/types/utils/abi/encodeEventTopics.d.ts.map +1 -1
  570. package/dist/types/utils/abi/getAbiItem.d.ts.map +1 -1
  571. package/dist/types/utils/buildRequest.d.ts.map +1 -1
  572. package/dist/types/utils/ens/encodeLabelhash.d.ts +3 -0
  573. package/dist/types/utils/ens/encodeLabelhash.d.ts.map +1 -0
  574. package/dist/types/utils/ens/encodedLabelToLabelhash.d.ts +3 -0
  575. package/dist/types/utils/ens/encodedLabelToLabelhash.d.ts.map +1 -0
  576. package/dist/types/utils/ens/labelhash.d.ts.map +1 -1
  577. package/dist/types/utils/ens/namehash.d.ts.map +1 -1
  578. package/dist/types/utils/ens/packetToBytes.d.ts.map +1 -1
  579. package/dist/types/utils/filters/createFilterRequestScope.d.ts +6 -2
  580. package/dist/types/utils/filters/createFilterRequestScope.d.ts.map +1 -1
  581. package/dist/types/utils/formatters/block.d.ts.map +1 -1
  582. package/dist/types/utils/formatters/transaction.d.ts +1 -1
  583. package/dist/types/utils/formatters/transaction.d.ts.map +1 -1
  584. package/dist/types/utils/formatters/transactionReceipt.d.ts.map +1 -1
  585. package/dist/types/utils/hash/getEventSelector.d.ts +2 -1
  586. package/dist/types/utils/hash/getEventSelector.d.ts.map +1 -1
  587. package/dist/types/utils/hash/getFunctionSelector.d.ts +2 -1
  588. package/dist/types/utils/hash/getFunctionSelector.d.ts.map +1 -1
  589. package/dist/types/utils/hash/hashFunction.d.ts +2 -0
  590. package/dist/types/utils/hash/hashFunction.d.ts.map +1 -1
  591. package/dist/types/utils/index.d.ts +1 -1
  592. package/dist/types/utils/index.d.ts.map +1 -1
  593. package/dist/types/utils/observe.d.ts.map +1 -1
  594. package/dist/types/utils/promise/withCache.d.ts.map +1 -1
  595. package/dist/types/utils/rpc.d.ts +18 -10
  596. package/dist/types/utils/rpc.d.ts.map +1 -1
  597. package/dist/types/utils/signature/hashMessage.d.ts +2 -2
  598. package/dist/types/utils/signature/hashMessage.d.ts.map +1 -1
  599. package/dist/types/utils/signature/hashTypedData.d.ts +3 -6
  600. package/dist/types/utils/signature/hashTypedData.d.ts.map +1 -1
  601. package/dist/types/utils/signature/recoverMessageAddress.d.ts +2 -2
  602. package/dist/types/utils/signature/recoverMessageAddress.d.ts.map +1 -1
  603. package/dist/types/utils/signature/recoverTypedDataAddress.d.ts +3 -6
  604. package/dist/types/utils/signature/recoverTypedDataAddress.d.ts.map +1 -1
  605. package/dist/types/utils/signature/verifyTypedData.d.ts +3 -6
  606. package/dist/types/utils/signature/verifyTypedData.d.ts.map +1 -1
  607. package/dist/types/utils/transaction/getTransactionType.d.ts +2 -2
  608. package/dist/types/utils/transaction/getTransactionType.d.ts.map +1 -1
  609. package/dist/types/utils/transaction/prepareRequest.d.ts +1 -1
  610. package/dist/types/utils/transaction/prepareRequest.d.ts.map +1 -1
  611. package/dist/types/utils/typedData.d.ts +2 -3
  612. package/dist/types/utils/typedData.d.ts.map +1 -1
  613. package/dist/types/utils/unit/parseUnits.d.ts.map +1 -1
  614. package/package.json +7 -13
  615. package/src/accounts/types.ts +4 -4
  616. package/src/accounts/utils/signMessage.ts +2 -2
  617. package/src/accounts/utils/signTypedData.ts +4 -4
  618. package/src/actions/ens/getEnsAddress.ts +37 -22
  619. package/src/actions/getContract.ts +133 -69
  620. package/src/actions/public/call.ts +1 -1
  621. package/src/actions/public/createBlockFilter.ts +1 -1
  622. package/src/actions/public/createContractEventFilter.ts +22 -5
  623. package/src/actions/public/createEventFilter.ts +35 -14
  624. package/src/actions/public/createPendingTransactionFilter.ts +1 -1
  625. package/src/actions/public/estimateContractGas.ts +11 -5
  626. package/src/actions/public/estimateGas.ts +4 -3
  627. package/src/actions/public/getBlock.ts +2 -2
  628. package/src/actions/public/getBlockTransactionCount.ts +1 -1
  629. package/src/actions/public/getChainId.ts +3 -1
  630. package/src/actions/public/getFilterChanges.ts +36 -11
  631. package/src/actions/public/getFilterLogs.ts +34 -8
  632. package/src/actions/public/getGasPrice.ts +1 -1
  633. package/src/actions/public/getLogs.ts +39 -10
  634. package/src/actions/public/getTransaction.ts +1 -1
  635. package/src/actions/public/getTransactionCount.ts +2 -2
  636. package/src/actions/public/getTransactionReceipt.ts +1 -1
  637. package/src/actions/public/multicall.ts +1 -1
  638. package/src/actions/public/readContract.ts +2 -2
  639. package/src/actions/public/simulateContract.ts +2 -2
  640. package/src/actions/public/uninstallFilter.ts +3 -3
  641. package/src/actions/public/verifyMessage.ts +2 -2
  642. package/src/actions/public/verifyTypedData.ts +18 -6
  643. package/src/actions/public/watchContractEvent.ts +17 -5
  644. package/src/actions/public/watchEvent.ts +19 -6
  645. package/src/actions/test/getAutomine.ts +4 -0
  646. package/src/actions/test/mine.ts +10 -4
  647. package/src/actions/test/sendUnsignedTransaction.ts +54 -5
  648. package/src/actions/test/setAutomine.ts +8 -4
  649. package/src/actions/test/setBalance.ts +10 -4
  650. package/src/actions/test/setBlockTimestampInterval.ts +1 -1
  651. package/src/actions/test/stopImpersonatingAccount.ts +1 -1
  652. package/src/actions/wallet/deployContract.ts +1 -1
  653. package/src/actions/wallet/sendTransaction.ts +1 -1
  654. package/src/actions/wallet/signMessage.ts +13 -6
  655. package/src/actions/wallet/signTypedData.ts +5 -5
  656. package/src/actions/wallet/writeContract.ts +3 -3
  657. package/src/chains.ts +123 -88
  658. package/src/clients/createClient.ts +13 -11
  659. package/src/clients/createPublicClient.ts +4 -5
  660. package/src/clients/createTestClient.ts +4 -5
  661. package/src/clients/createWalletClient.ts +4 -5
  662. package/src/clients/decorators/public.ts +65 -39
  663. package/src/clients/decorators/test.ts +6 -5
  664. package/src/clients/decorators/wallet.ts +8 -8
  665. package/src/clients/transports/createTransport.ts +5 -9
  666. package/src/clients/transports/custom.ts +1 -2
  667. package/src/clients/transports/fallback.ts +1 -1
  668. package/src/clients/transports/http.ts +44 -7
  669. package/src/clients/transports/webSocket.ts +23 -15
  670. package/src/contract.ts +3 -3
  671. package/src/errors/abi.ts +16 -4
  672. package/src/errors/base.ts +6 -6
  673. package/src/errors/request.ts +4 -4
  674. package/src/errors/rpc.ts +43 -15
  675. package/src/errors/version.ts +1 -1
  676. package/src/index.ts +266 -247
  677. package/src/types/account.ts +9 -9
  678. package/src/types/contract.ts +33 -15
  679. package/src/types/eip1193.ts +1093 -839
  680. package/src/types/filter.ts +15 -3
  681. package/src/types/log.ts +13 -3
  682. package/src/types/misc.ts +6 -0
  683. package/src/types/rpc.ts +1 -1
  684. package/src/types/transaction.ts +24 -6
  685. package/src/types/typedData.ts +36 -45
  686. package/src/types/utils.ts +15 -0
  687. package/src/utils/abi/decodeEventLog.ts +47 -22
  688. package/src/utils/abi/encodeEventTopics.ts +16 -11
  689. package/src/utils/abi/getAbiItem.ts +1 -0
  690. package/src/utils/buildRequest.ts +5 -1
  691. package/src/utils/encoding/toBytes.ts +1 -1
  692. package/src/utils/encoding/toHex.ts +2 -2
  693. package/src/utils/ens/encodeLabelhash.ts +5 -0
  694. package/src/utils/ens/encodedLabelToLabelhash.ts +11 -0
  695. package/src/utils/ens/labelhash.ts +2 -1
  696. package/src/utils/ens/namehash.ts +6 -2
  697. package/src/utils/ens/packetToBytes.ts +12 -8
  698. package/src/utils/filters/createFilterRequestScope.ts +12 -4
  699. package/src/utils/formatters/block.ts +3 -1
  700. package/src/utils/formatters/log.ts +2 -2
  701. package/src/utils/formatters/transaction.ts +3 -1
  702. package/src/utils/formatters/transactionReceipt.ts +4 -2
  703. package/src/utils/formatters/transactionRequest.ts +1 -1
  704. package/src/utils/hash/getEventSelector.ts +6 -2
  705. package/src/utils/hash/getFunctionSelector.ts +6 -2
  706. package/src/utils/hash/hashFunction.ts +6 -2
  707. package/src/utils/index.ts +6 -0
  708. package/src/utils/observe.ts +2 -2
  709. package/src/utils/promise/createBatchScheduler.ts +1 -1
  710. package/src/utils/promise/withCache.ts +13 -11
  711. package/src/utils/rpc.ts +53 -53
  712. package/src/utils/signature/hashMessage.ts +8 -4
  713. package/src/utils/signature/hashTypedData.ts +4 -4
  714. package/src/utils/signature/recoverMessageAddress.ts +2 -2
  715. package/src/utils/signature/recoverTypedDataAddress.ts +4 -4
  716. package/src/utils/signature/verifyTypedData.ts +4 -4
  717. package/src/utils/transaction/getTransactionType.ts +10 -9
  718. package/src/utils/transaction/prepareRequest.ts +1 -2
  719. package/src/utils/transaction/serializeTransaction.ts +3 -3
  720. package/src/utils/typedData.ts +3 -3
  721. package/src/utils/unit/parseUnits.ts +15 -5
  722. package/dist/cjs/adapters/ethers.js +0 -49
  723. package/dist/cjs/adapters/ethers.js.map +0 -1
  724. package/dist/cjs/ethers.js +0 -6
  725. package/dist/cjs/ethers.js.map +0 -1
  726. package/dist/esm/adapters/ethers.js +0 -45
  727. package/dist/esm/adapters/ethers.js.map +0 -1
  728. package/dist/esm/ethers.js +0 -2
  729. package/dist/esm/ethers.js.map +0 -1
  730. package/dist/types/adapters/ethers.d.ts +0 -27
  731. package/dist/types/adapters/ethers.d.ts.map +0 -1
  732. package/dist/types/ethers.d.ts +0 -2
  733. package/dist/types/ethers.d.ts.map +0 -1
  734. package/ethers/package.json +0 -5
  735. package/src/adapters/ethers.ts +0 -94
  736. package/src/ethers.ts +0 -1
@@ -2,12 +2,15 @@ import type { Address } from 'abitype';
2
2
  import type { BlockTag } from './block.js';
3
3
  import type { Hash, Hex, LogTopic } from './misc.js';
4
4
  import type { Quantity, RpcBlock as Block, RpcBlockIdentifier as BlockIdentifier, RpcBlockNumber as BlockNumber, RpcFeeHistory as FeeHistory, RpcLog as Log, RpcTransaction as Transaction, RpcTransactionReceipt as TransactionReceipt, RpcTransactionRequest as TransactionRequest, RpcUncle as Uncle } from './rpc.js';
5
- export type EIP1193Provider = Requests & Events;
6
- export type RpcErrorCode = 4001 | 4100 | 4200 | 4900 | 4901 | -32700 | -32600 | -32601 | -32602 | -32603 | -32000 | -32001 | -32002 | -32003 | -32004 | -32005 | -32006;
7
- export declare class RpcError extends Error {
8
- code: RpcErrorCode | (number & {});
5
+ import type { Prettify } from './utils.js';
6
+ export type EIP1474Methods = [...PublicRpcSchema, ...WalletRpcSchema];
7
+ export type EIP1193Provider = EIP1193Events & {
8
+ request: EIP1193RequestFn<EIP1474Methods>;
9
+ };
10
+ export declare class ProviderRpcError extends Error {
11
+ code: number;
9
12
  details: string;
10
- constructor(code: RpcErrorCode | (number & {}), message: string);
13
+ constructor(code: number, message: string);
11
14
  }
12
15
  export type ProviderConnectInfo = {
13
16
  chainId: string;
@@ -16,19 +19,19 @@ export type ProviderMessage = {
16
19
  type: string;
17
20
  data: unknown;
18
21
  };
19
- export type Events = {
22
+ export type EIP1193Events = {
20
23
  on(event: 'connect', listener: (connectInfo: ProviderConnectInfo) => void): void;
21
- on(event: 'disconnect', listener: (error: RpcError) => void): void;
24
+ on(event: 'disconnect', listener: (error: ProviderRpcError) => void): void;
22
25
  on(event: 'chainChanged', listener: (chainId: string) => void): void;
23
26
  on(event: 'accountsChanged', listener: (accounts: string[]) => void): void;
24
27
  on(event: 'message', listener: (message: ProviderMessage) => void): void;
25
28
  removeListener(event: 'connect', listener: (connectInfo: ProviderConnectInfo) => void): void;
26
- removeListener(event: 'disconnect', listener: (error: RpcError) => void): void;
29
+ removeListener(event: 'disconnect', listener: (error: ProviderRpcError) => void): void;
27
30
  removeListener(event: 'chainChanged', listener: (chainId: string) => void): void;
28
31
  removeListener(event: 'accountsChanged', listener: (accounts: Address[]) => void): void;
29
32
  removeListener(event: 'message', listener: (message: ProviderMessage) => void): void;
30
33
  };
31
- export type Chain = {
34
+ export type AddEthereumChainParameter = {
32
35
  /** A 0x-prefixed hexadecimal string */
33
36
  chainId: string;
34
37
  /** The chain name. */
@@ -76,133 +79,149 @@ export type WatchAssetParams = {
76
79
  image?: string;
77
80
  };
78
81
  };
79
- export type PublicRequests = {
80
- request(args: {
81
- /**
82
- * @description Returns the version of the current client
83
- * @link https://eips.ethereum.org/EIPS/eip-1474
84
- * @example
85
- * provider.request({ method: 'web3_clientVersion' })
86
- * // => 'MetaMask/v1.0.0'
87
- */
88
- method: 'web3_clientVersion';
89
- params?: never;
90
- }): Promise<string>;
91
- request(args: {
92
- /**
93
- * @description Hashes data using the Keccak-256 algorithm
94
- * @link https://eips.ethereum.org/EIPS/eip-1474
95
- * @example
96
- * provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] })
97
- * // => '0xc94770007dda54cF92009BFF0dE90c06F603a09f'
98
- */
99
- method: 'web3_sha3';
100
- params: [data: Hash];
101
- }): Promise<string>;
102
- request(args: {
103
- /**
104
- * @description Determines if this client is listening for new network connections
105
- * @link https://eips.ethereum.org/EIPS/eip-1474
106
- * @example
107
- * provider.request({ method: 'net_listening' })
108
- * // => true
109
- */
110
- method: 'net_listening';
111
- params?: never;
112
- }): Promise<boolean>;
113
- request(args: {
114
- /**
115
- * @description Returns the number of peers currently connected to this client
116
- * @link https://eips.ethereum.org/EIPS/eip-1474
117
- * @example
118
- * provider.request({ method: 'net_peerCount' })
119
- * // => '0x1'
120
- */
121
- method: 'net_peerCount';
122
- params?: never;
123
- }): Promise<Quantity>;
124
- request(args: {
125
- /**
126
- * @description Returns the chain ID associated with the current network
127
- * @link https://eips.ethereum.org/EIPS/eip-1474
128
- * @example
129
- * provider.request({ method: 'net_version' })
130
- * // => '1'
131
- */
132
- method: 'net_version';
133
- params?: never;
134
- }): Promise<Quantity>;
135
- request(args: {
136
- /**
137
- * @description Returns the number of the most recent block seen by this client
138
- * @link https://eips.ethereum.org/EIPS/eip-1474
139
- * @example
140
- * provider.request({ method: 'eth_blockNumber' })
141
- * // => '0x1b4'
142
- * */
143
- method: 'eth_blockNumber';
144
- params?: never;
145
- }): Promise<Quantity>;
146
- request(args: {
147
- /**
148
- * @description Executes a new message call immediately without submitting a transaction to the network
149
- * @link https://eips.ethereum.org/EIPS/eip-1474
150
- * @example
151
- * provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] })
152
- * // => '0x...'
153
- */
154
- method: 'eth_call';
155
- params: [
156
- request: Partial<TransactionRequest>,
157
- block?: BlockNumber | BlockTag | BlockIdentifier
82
+ export type PublicRpcSchema = [
83
+ /**
84
+ * @description Returns the version of the current client
85
+ *
86
+ * @example
87
+ * provider.request({ method: 'web3_clientVersion' })
88
+ * // => 'MetaMask/v1.0.0'
89
+ */
90
+ {
91
+ Method: 'web3_clientVersion';
92
+ Parameters?: never;
93
+ ReturnType: string;
94
+ },
95
+ /**
96
+ * @description Hashes data using the Keccak-256 algorithm
97
+ *
98
+ * @example
99
+ * provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] })
100
+ * // => '0xc94770007dda54cF92009BFF0dE90c06F603a09f'
101
+ */
102
+ {
103
+ Method: 'web3_sha3';
104
+ Parameters: [data: Hash];
105
+ ReturnType: string;
106
+ },
107
+ /**
108
+ * @description Determines if this client is listening for new network connections
109
+ *
110
+ * @example
111
+ * provider.request({ method: 'net_listening' })
112
+ * // => true
113
+ */
114
+ {
115
+ Method: 'net_listening';
116
+ Parameters?: never;
117
+ ReturnType: boolean;
118
+ },
119
+ /**
120
+ * @description Returns the number of peers currently connected to this client
121
+ *
122
+ * @example
123
+ * provider.request({ method: 'net_peerCount' })
124
+ * // => '0x1'
125
+ */
126
+ {
127
+ Method: 'net_peerCount';
128
+ Parameters?: never;
129
+ ReturnType: Quantity;
130
+ },
131
+ /**
132
+ * @description Returns the chain ID associated with the current network
133
+ *
134
+ * @example
135
+ * provider.request({ method: 'net_version' })
136
+ * // => '1'
137
+ */
138
+ {
139
+ Method: 'net_version';
140
+ Parameters?: never;
141
+ ReturnType: Quantity;
142
+ },
143
+ /**
144
+ * @description Returns the number of the most recent block seen by this client
145
+ *
146
+ * @example
147
+ * provider.request({ method: 'eth_blockNumber' })
148
+ * // => '0x1b4'
149
+ */
150
+ {
151
+ Method: 'eth_blockNumber';
152
+ Parameters?: never;
153
+ ReturnType: Quantity;
154
+ },
155
+ /**
156
+ * @description Executes a new message call immediately without submitting a transaction to the network
157
+ *
158
+ * @example
159
+ * provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] })
160
+ * // => '0x...'
161
+ */
162
+ {
163
+ Method: 'eth_call';
164
+ Parameters: [transaction: Partial<TransactionRequest>] | [
165
+ transaction: Partial<TransactionRequest>,
166
+ block: BlockNumber | BlockTag | BlockIdentifier
158
167
  ];
159
- }): Promise<Hex>;
160
- request(args: {
161
- /**
162
- * @description Returns the chain ID associated with the current network
163
- * @example
164
- * provider.request({ method: 'eth_chainId' })
165
- * // => '1'
166
- */
167
- method: 'eth_chainId';
168
- params?: never;
169
- }): Promise<Quantity>;
170
- request(args: {
171
- method: 'eth_coinbase';
172
- params?: never;
173
- }): Promise<Address>;
174
- request(args: {
175
- /**
176
- * @description Estimates the gas necessary to complete a transaction without submitting it to the network
177
- * @link https://eips.ethereum.org/EIPS/eip-1474
178
- * @example
179
- * provider.request({
180
- * method: 'eth_estimateGas',
181
- * params: [{ from: '0x...', to: '0x...', value: '0x...' }]
182
- * })
183
- * // => '0x5208'
184
- * */
185
- method: 'eth_estimateGas';
186
- params: [parameters: TransactionRequest, block?: BlockNumber | BlockTag];
187
- }): Promise<Quantity>;
188
- request(args: {
189
- /**
190
- * @description Returns a collection of historical gas information
191
- * @link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md
192
- * @example
193
- * provider.request({
194
- * method: 'eth_feeHistory',
195
- * params: ['4', 'latest', ['25', '75']]
196
- * })
197
- * // => {
198
- * // oldestBlock: '0x1',
199
- * // baseFeePerGas: ['0x1', '0x2', '0x3', '0x4'],
200
- * // gasUsedRatio: ['0x1', '0x2', '0x3', '0x4'],
201
- * // reward: [['0x1', '0x2'], ['0x3', '0x4'], ['0x5', '0x6'], ['0x7', '0x8']]
202
- * // }
203
- * */
204
- method: 'eth_feeHistory';
205
- params: [
168
+ ReturnType: Hex;
169
+ },
170
+ /**
171
+ * @description Returns the chain ID associated with the current network
172
+ * @example
173
+ * provider.request({ method: 'eth_chainId' })
174
+ * // => '1'
175
+ */
176
+ {
177
+ Method: 'eth_chainId';
178
+ Parameters?: never;
179
+ ReturnType: Quantity;
180
+ },
181
+ /**
182
+ * @description Returns the client coinbase address.
183
+ * @example
184
+ * provider.request({ method: 'eth_coinbase' })
185
+ * // => '0x...'
186
+ */
187
+ {
188
+ Method: 'eth_coinbase';
189
+ Parameters?: never;
190
+ ReturnType: Address;
191
+ },
192
+ /**
193
+ * @description Estimates the gas necessary to complete a transaction without submitting it to the network
194
+ *
195
+ * @example
196
+ * provider.request({
197
+ * method: 'eth_estimateGas',
198
+ * params: [{ from: '0x...', to: '0x...', value: '0x...' }]
199
+ * })
200
+ * // => '0x5208'
201
+ */
202
+ {
203
+ Method: 'eth_estimateGas';
204
+ Parameters: [transaction: TransactionRequest] | [transaction: TransactionRequest, block: BlockNumber | BlockTag];
205
+ ReturnType: Quantity;
206
+ },
207
+ /**
208
+ * @description Returns a collection of historical gas information
209
+ *
210
+ * @example
211
+ * provider.request({
212
+ * method: 'eth_feeHistory',
213
+ * params: ['4', 'latest', ['25', '75']]
214
+ * })
215
+ * // => {
216
+ * // oldestBlock: '0x1',
217
+ * // baseFeePerGas: ['0x1', '0x2', '0x3', '0x4'],
218
+ * // gasUsedRatio: ['0x1', '0x2', '0x3', '0x4'],
219
+ * // reward: [['0x1', '0x2'], ['0x3', '0x4'], ['0x5', '0x6'], ['0x7', '0x8']]
220
+ * // }
221
+ * */
222
+ {
223
+ Method: 'eth_feeHistory';
224
+ Parameters: [
206
225
  /** Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. */
207
226
  blockCount: Quantity,
208
227
  /** Highest number block of the requested range. */
@@ -210,137 +229,153 @@ export type PublicRequests = {
210
229
  /** A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. */
211
230
  rewardPercentiles: number[] | undefined
212
231
  ];
213
- }): Promise<FeeHistory>;
214
- request(args: {
215
- /**
216
- * @description Returns the current price of gas expressed in wei
217
- * @link https://eips.ethereum.org/EIPS/eip-1474
218
- * @example
219
- * provider.request({ method: 'eth_gasPrice' })
220
- * // => '0x09184e72a000'
221
- * */
222
- method: 'eth_gasPrice';
223
- params?: never;
224
- }): Promise<Quantity>;
225
- request(args: {
226
- /**
227
- * @description Returns the balance of an address in wei
228
- * @link https://eips.ethereum.org/EIPS/eip-1474
229
- * @example
230
- * provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] })
231
- * // => '0x12a05...'
232
- * */
233
- method: 'eth_getBalance';
234
- params: [address: Address, block: BlockNumber | BlockTag | BlockIdentifier];
235
- }): Promise<Quantity>;
236
- request(args: {
237
- /**
238
- * @description Returns information about a block specified by hash
239
- * @link https://eips.ethereum.org/EIPS/eip-1474
240
- * @example
241
- * provider.request({ method: 'eth_getBlockByHash', params: ['0x...', true] })
242
- * // => {
243
- * // number: '0x1b4',
244
- * // hash: '0x...',
245
- * // parentHash: '0x...',
246
- * // ...
247
- * // }
248
- * */
249
- method: 'eth_getBlockByHash';
250
- params: [
232
+ ReturnType: FeeHistory;
233
+ },
234
+ /**
235
+ * @description Returns the current price of gas expressed in wei
236
+ *
237
+ * @example
238
+ * provider.request({ method: 'eth_gasPrice' })
239
+ * // => '0x09184e72a000'
240
+ */
241
+ {
242
+ Method: 'eth_gasPrice';
243
+ Parameters?: never;
244
+ ReturnType: Quantity;
245
+ },
246
+ /**
247
+ * @description Returns the balance of an address in wei
248
+ *
249
+ * @example
250
+ * provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] })
251
+ * // => '0x12a05...'
252
+ */
253
+ {
254
+ Method: 'eth_getBalance';
255
+ Parameters: [
256
+ address: Address,
257
+ block: BlockNumber | BlockTag | BlockIdentifier
258
+ ];
259
+ ReturnType: Quantity;
260
+ },
261
+ /**
262
+ * @description Returns information about a block specified by hash
263
+ * @link https://eips.ethereum.org/EIPS/eip-1474
264
+ * @example
265
+ * provider.request({ method: 'eth_getBlockByHash', params: ['0x...', true] })
266
+ * // => {
267
+ * // number: '0x1b4',
268
+ * // hash: '0x...',
269
+ * // parentHash: '0x...',
270
+ * // ...
271
+ * // }
272
+ */
273
+ {
274
+ Method: 'eth_getBlockByHash';
275
+ Parameters: [
251
276
  /** hash of a block */
252
277
  hash: Hash,
253
278
  /** true will pull full transaction objects, false will pull transaction hashes */
254
279
  includeTransactionObjects: boolean
255
280
  ];
256
- }): Promise<Block | null>;
257
- request(args: {
258
- /**
259
- * @description Returns information about a block specified by number
260
- * @link https://eips.ethereum.org/EIPS/eip-1474
261
- * @example
262
- * provider.request({ method: 'eth_getBlockByNumber', params: ['0x1b4', true] })
263
- * // => {
264
- * // number: '0x1b4',
265
- * // hash: '0x...',
266
- * // parentHash: '0x...',
267
- * // ...
268
- * // }
269
- * */
270
- method: 'eth_getBlockByNumber';
271
- params: [
281
+ ReturnType: Block | null;
282
+ },
283
+ /**
284
+ * @description Returns information about a block specified by number
285
+ * @link https://eips.ethereum.org/EIPS/eip-1474
286
+ * @example
287
+ * provider.request({ method: 'eth_getBlockByNumber', params: ['0x1b4', true] })
288
+ * // => {
289
+ * // number: '0x1b4',
290
+ * // hash: '0x...',
291
+ * // parentHash: '0x...',
292
+ * // ...
293
+ * // }
294
+ */
295
+ {
296
+ Method: 'eth_getBlockByNumber';
297
+ Parameters: [
272
298
  /** block number, or one of "latest", "safe", "finalized", "earliest" or "pending" */
273
299
  block: BlockNumber | BlockTag,
274
300
  /** true will pull full transaction objects, false will pull transaction hashes */
275
301
  includeTransactionObjects: boolean
276
302
  ];
277
- }): Promise<Block | null>;
278
- request(args: {
279
- /**
280
- * @description Returns the number of transactions in a block specified by block hash
281
- * @link https://eips.ethereum.org/EIPS/eip-1474
282
- * @example
283
- * provider.request({ method: 'eth_getBlockTransactionCountByHash', params: ['0x...'] })
284
- * // => '0x1'
285
- * */
286
- method: 'eth_getBlockTransactionCountByHash';
287
- params: [hash: Hash];
288
- }): Promise<Quantity>;
289
- request(args: {
290
- /**
291
- * @description Returns the number of transactions in a block specified by block number
292
- * @link https://eips.ethereum.org/EIPS/eip-1474
293
- * @example
294
- * provider.request({ method: 'eth_getBlockTransactionCountByNumber', params: ['0x1b4'] })
295
- * // => '0x1'
296
- * */
297
- method: 'eth_getBlockTransactionCountByNumber';
298
- params: [block: BlockNumber | BlockTag];
299
- }): Promise<Quantity>;
300
- request(args: {
301
- /**
302
- * @description Returns the contract code stored at a given address
303
- * @link https://eips.ethereum.org/EIPS/eip-1474
304
- * @example
305
- * provider.request({ method: 'eth_getCode', params: ['0x...', 'latest'] })
306
- * // => '0x...'
307
- * */
308
- method: 'eth_getCode';
309
- params: [address: Address, block: BlockNumber | BlockTag | BlockIdentifier];
310
- }): Promise<Hex>;
311
- request(args: {
312
- /**
313
- * @description Returns a list of all logs based on filter ID since the last log retrieval
314
- * @link https://eips.ethereum.org/EIPS/eip-1474
315
- * @example
316
- * provider.request({ method: 'eth_getFilterChanges', params: ['0x...'] })
317
- * // => [{ ... }, { ... }]
318
- * */
319
- method: 'eth_getFilterChanges';
320
- params: [filterId: Quantity];
321
- }): Promise<Log[] | Hex[]>;
322
- request(args: {
323
- /**
324
- * @description Returns a list of all logs based on filter ID
325
- * @link https://eips.ethereum.org/EIPS/eip-1474
326
- * @example
327
- * provider.request({ method: 'eth_getFilterLogs', params: ['0x...'] })
328
- * // => [{ ... }, { ... }]
329
- * */
330
- method: 'eth_getFilterLogs';
331
- params: [filterId: Quantity];
332
- }): Promise<Log[]>;
333
- request(args: {
334
- /**
335
- * @description Returns a list of all logs based on a filter object
336
- * @link https://eips.ethereum.org/EIPS/eip-1474
337
- * @example
338
- * provider.request({ method: 'eth_getLogs', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
339
- * // => [{ ... }, { ... }]
340
- * */
341
- method: 'eth_getLogs';
342
- params: [
343
- parameters: {
303
+ ReturnType: Block | null;
304
+ },
305
+ /**
306
+ * @description Returns the number of transactions in a block specified by block hash
307
+ * @link https://eips.ethereum.org/EIPS/eip-1474
308
+ * @example
309
+ * provider.request({ method: 'eth_getBlockTransactionCountByHash', params: ['0x...'] })
310
+ * // => '0x1'
311
+ */
312
+ {
313
+ Method: 'eth_getBlockTransactionCountByHash';
314
+ Parameters: [hash: Hash];
315
+ ReturnType: Quantity;
316
+ },
317
+ /**
318
+ * @description Returns the number of transactions in a block specified by block number
319
+ * @link https://eips.ethereum.org/EIPS/eip-1474
320
+ * @example
321
+ * provider.request({ method: 'eth_getBlockTransactionCountByNumber', params: ['0x1b4'] })
322
+ * // => '0x1'
323
+ */
324
+ {
325
+ Method: 'eth_getBlockTransactionCountByNumber';
326
+ Parameters: [block: BlockNumber | BlockTag];
327
+ ReturnType: Quantity;
328
+ },
329
+ /**
330
+ * @description Returns the contract code stored at a given address
331
+ * @link https://eips.ethereum.org/EIPS/eip-1474
332
+ * @example
333
+ * provider.request({ method: 'eth_getCode', params: ['0x...', 'latest'] })
334
+ * // => '0x...'
335
+ */
336
+ {
337
+ Method: 'eth_getCode';
338
+ Parameters: [
339
+ address: Address,
340
+ block: BlockNumber | BlockTag | BlockIdentifier
341
+ ];
342
+ ReturnType: Hex;
343
+ },
344
+ /**
345
+ * @description Returns a list of all logs based on filter ID since the last log retrieval
346
+ * @link https://eips.ethereum.org/EIPS/eip-1474
347
+ * @example
348
+ * provider.request({ method: 'eth_getFilterChanges', params: ['0x...'] })
349
+ * // => [{ ... }, { ... }]
350
+ */
351
+ {
352
+ Method: 'eth_getFilterChanges';
353
+ Parameters: [filterId: Quantity];
354
+ ReturnType: Log[] | Hex[];
355
+ },
356
+ /**
357
+ * @description Returns a list of all logs based on filter ID
358
+ * @link https://eips.ethereum.org/EIPS/eip-1474
359
+ * @example
360
+ * provider.request({ method: 'eth_getFilterLogs', params: ['0x...'] })
361
+ * // => [{ ... }, { ... }]
362
+ */
363
+ {
364
+ Method: 'eth_getFilterLogs';
365
+ Parameters: [filterId: Quantity];
366
+ ReturnType: Log[];
367
+ },
368
+ /**
369
+ * @description Returns a list of all logs based on a filter object
370
+ * @link https://eips.ethereum.org/EIPS/eip-1474
371
+ * @example
372
+ * provider.request({ method: 'eth_getLogs', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
373
+ * // => [{ ... }, { ... }]
374
+ */
375
+ {
376
+ Method: 'eth_getLogs';
377
+ Parameters: [
378
+ {
344
379
  address?: Address | Address[];
345
380
  topics?: LogTopic[];
346
381
  } & ({
@@ -353,142 +388,157 @@ export type PublicRequests = {
353
388
  blockHash?: Hash;
354
389
  })
355
390
  ];
356
- }): Promise<Log[]>;
357
- request(args: {
358
- /**
359
- * @description Returns the value from a storage position at an address
360
- * @link https://eips.ethereum.org/EIPS/eip-1474
361
- * @example
362
- * provider.request({ method: 'eth_getStorageAt', params: ['0x...', '0x...', 'latest'] })
363
- * // => '0x...'
364
- * */
365
- method: 'eth_getStorageAt';
366
- params: [
391
+ ReturnType: Log[];
392
+ },
393
+ /**
394
+ * @description Returns the value from a storage position at an address
395
+ * @link https://eips.ethereum.org/EIPS/eip-1474
396
+ * @example
397
+ * provider.request({ method: 'eth_getStorageAt', params: ['0x...', '0x...', 'latest'] })
398
+ * // => '0x...'
399
+ */
400
+ {
401
+ Method: 'eth_getStorageAt';
402
+ Parameters: [
367
403
  address: Address,
368
404
  index: Quantity,
369
405
  block: BlockNumber | BlockTag | BlockIdentifier
370
406
  ];
371
- }): Promise<Hex>;
372
- request(args: {
373
- /**
374
- * @description Returns information about a transaction specified by block hash and transaction index
375
- * @link https://eips.ethereum.org/EIPS/eip-1474
376
- * @example
377
- * provider.request({ method: 'eth_getTransactionByBlockHashAndIndex', params: ['0x...', '0x...'] })
378
- * // => { ... }
379
- * */
380
- method: 'eth_getTransactionByBlockHashAndIndex';
381
- params: [hash: Hash, index: Quantity];
382
- }): Promise<Transaction | null>;
383
- request(args: {
384
- /**
385
- * @description Returns information about a transaction specified by block number and transaction index
386
- * @link https://eips.ethereum.org/EIPS/eip-1474
387
- * @example
388
- * provider.request({ method: 'eth_getTransactionByBlockNumberAndIndex', params: ['0x...', '0x...'] })
389
- * // => { ... }
390
- * */
391
- method: 'eth_getTransactionByBlockNumberAndIndex';
392
- params: [block: BlockNumber | BlockTag, index: Quantity];
393
- }): Promise<Transaction | null>;
394
- request(args: {
395
- /**
396
- * @description Returns information about a transaction specified by hash
397
- * @link https://eips.ethereum.org/EIPS/eip-1474
398
- * @example
399
- * provider.request({ method: 'eth_getTransactionByHash', params: ['0x...'] })
400
- * // => { ... }
401
- * */
402
- method: 'eth_getTransactionByHash';
403
- params: [hash: Hash];
404
- }): Promise<Transaction | null>;
405
- request(args: {
406
- /**
407
- * @description Returns the number of transactions sent from an address
408
- * @link https://eips.ethereum.org/EIPS/eip-1474
409
- * @example
410
- * provider.request({ method: 'eth_getTransactionCount', params: ['0x...', 'latest'] })
411
- * // => '0x1'
412
- * */
413
- method: 'eth_getTransactionCount';
414
- params: [address: Address, block: BlockNumber | BlockTag | BlockIdentifier];
415
- }): Promise<Quantity>;
416
- request(args: {
417
- /**
418
- * @description Returns the receipt of a transaction specified by hash
419
- * @link https://eips.ethereum.org/EIPS/eip-1474
420
- * @example
421
- * provider.request({ method: 'eth_getTransactionReceipt', params: ['0x...'] })
422
- * // => { ... }
423
- * */
424
- method: 'eth_getTransactionReceipt';
425
- params: [hash: Hash];
426
- }): Promise<TransactionReceipt | null>;
427
- request(args: {
428
- /**
429
- * @description Returns information about an uncle specified by block hash and uncle index position
430
- * @link https://eips.ethereum.org/EIPS/eip-1474
431
- * @example
432
- * provider.request({ method: 'eth_getUncleByBlockHashAndIndex', params: ['0x...', '0x...'] })
433
- * // => { ... }
434
- * */
435
- method: 'eth_getUncleByBlockHashAndIndex';
436
- params: [hash: Hash, index: Quantity];
437
- }): Promise<Uncle | null>;
438
- request(args: {
439
- /**
440
- * @description Returns information about an uncle specified by block number and uncle index position
441
- * @link https://eips.ethereum.org/EIPS/eip-1474
442
- * @example
443
- * provider.request({ method: 'eth_getUncleByBlockNumberAndIndex', params: ['0x...', '0x...'] })
444
- * // => { ... }
445
- * */
446
- method: 'eth_getUncleByBlockNumberAndIndex';
447
- params: [block: BlockNumber | BlockTag, index: Quantity];
448
- }): Promise<Uncle | null>;
449
- request(args: {
450
- /**
451
- * @description Returns the number of uncles in a block specified by block hash
452
- * @link https://eips.ethereum.org/EIPS/eip-1474
453
- * @example
454
- * provider.request({ method: 'eth_getUncleCountByBlockHash', params: ['0x...'] })
455
- * // => '0x1'
456
- * */
457
- method: 'eth_getUncleCountByBlockHash';
458
- params: [hash: Hash];
459
- }): Promise<Quantity>;
460
- request(args: {
461
- /**
462
- * @description Returns the number of uncles in a block specified by block number
463
- * @link https://eips.ethereum.org/EIPS/eip-1474
464
- * @example
465
- * provider.request({ method: 'eth_getUncleCountByBlockNumber', params: ['0x...'] })
466
- * // => '0x1'
467
- * */
468
- method: 'eth_getUncleCountByBlockNumber';
469
- params: [block: BlockNumber | BlockTag];
470
- }): Promise<Quantity>;
471
- request(args: {
472
- /**
473
- * @description Creates a filter to listen for new blocks that can be used with `eth_getFilterChanges`
474
- * @link https://eips.ethereum.org/EIPS/eip-1474
475
- * @example
476
- * provider.request({ method: 'eth_newBlockFilter' })
477
- * // => '0x1'
478
- * */
479
- method: 'eth_newBlockFilter';
480
- params?: never;
481
- }): Promise<Quantity>;
482
- request(args: {
483
- /**
484
- * @description Creates a filter to listen for specific state changes that can then be used with `eth_getFilterChanges`
485
- * @link https://eips.ethereum.org/EIPS/eip-1474
486
- * @example
487
- * provider.request({ method: 'eth_newFilter', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
488
- * // => '0x1'
489
- * */
490
- method: 'eth_newFilter';
491
- params: [
407
+ ReturnType: Hex;
408
+ },
409
+ /**
410
+ * @description Returns information about a transaction specified by block hash and transaction index
411
+ * @link https://eips.ethereum.org/EIPS/eip-1474
412
+ * @example
413
+ * provider.request({ method: 'eth_getTransactionByBlockHashAndIndex', params: ['0x...', '0x...'] })
414
+ * // => { ... }
415
+ */
416
+ {
417
+ Method: 'eth_getTransactionByBlockHashAndIndex';
418
+ Parameters: [hash: Hash, index: Quantity];
419
+ ReturnType: Transaction | null;
420
+ },
421
+ /**
422
+ * @description Returns information about a transaction specified by block number and transaction index
423
+ * @link https://eips.ethereum.org/EIPS/eip-1474
424
+ * @example
425
+ * provider.request({ method: 'eth_getTransactionByBlockNumberAndIndex', params: ['0x...', '0x...'] })
426
+ * // => { ... }
427
+ */
428
+ {
429
+ Method: 'eth_getTransactionByBlockNumberAndIndex';
430
+ Parameters: [block: BlockNumber | BlockTag, index: Quantity];
431
+ ReturnType: Transaction | null;
432
+ },
433
+ /**
434
+ * @description Returns information about a transaction specified by hash
435
+ * @link https://eips.ethereum.org/EIPS/eip-1474
436
+ * @example
437
+ * provider.request({ method: 'eth_getTransactionByHash', params: ['0x...'] })
438
+ * // => { ... }
439
+ */
440
+ {
441
+ Method: 'eth_getTransactionByHash';
442
+ Parameters: [hash: Hash];
443
+ ReturnType: Transaction | null;
444
+ },
445
+ /**
446
+ * @description Returns the number of transactions sent from an address
447
+ * @link https://eips.ethereum.org/EIPS/eip-1474
448
+ * @example
449
+ * provider.request({ method: 'eth_getTransactionCount', params: ['0x...', 'latest'] })
450
+ * // => '0x1'
451
+ */
452
+ {
453
+ Method: 'eth_getTransactionCount';
454
+ Parameters: [
455
+ address: Address,
456
+ block: BlockNumber | BlockTag | BlockIdentifier
457
+ ];
458
+ ReturnType: Quantity;
459
+ },
460
+ /**
461
+ * @description Returns the receipt of a transaction specified by hash
462
+ * @link https://eips.ethereum.org/EIPS/eip-1474
463
+ * @example
464
+ * provider.request({ method: 'eth_getTransactionReceipt', params: ['0x...'] })
465
+ * // => { ... }
466
+ */
467
+ {
468
+ Method: 'eth_getTransactionReceipt';
469
+ Parameters: [hash: Hash];
470
+ ReturnType: TransactionReceipt | null;
471
+ },
472
+ /**
473
+ * @description Returns information about an uncle specified by block hash and uncle index position
474
+ * @link https://eips.ethereum.org/EIPS/eip-1474
475
+ * @example
476
+ * provider.request({ method: 'eth_getUncleByBlockHashAndIndex', params: ['0x...', '0x...'] })
477
+ * // => { ... }
478
+ */
479
+ {
480
+ Method: 'eth_getUncleByBlockHashAndIndex';
481
+ Parameters: [hash: Hash, index: Quantity];
482
+ ReturnType: Uncle | null;
483
+ },
484
+ /**
485
+ * @description Returns information about an uncle specified by block number and uncle index position
486
+ * @link https://eips.ethereum.org/EIPS/eip-1474
487
+ * @example
488
+ * provider.request({ method: 'eth_getUncleByBlockNumberAndIndex', params: ['0x...', '0x...'] })
489
+ * // => { ... }
490
+ */
491
+ {
492
+ Method: 'eth_getUncleByBlockNumberAndIndex';
493
+ Parameters: [block: BlockNumber | BlockTag, index: Quantity];
494
+ ReturnType: Uncle | null;
495
+ },
496
+ /**
497
+ * @description Returns the number of uncles in a block specified by block hash
498
+ * @link https://eips.ethereum.org/EIPS/eip-1474
499
+ * @example
500
+ * provider.request({ method: 'eth_getUncleCountByBlockHash', params: ['0x...'] })
501
+ * // => '0x1'
502
+ */
503
+ {
504
+ Method: 'eth_getUncleCountByBlockHash';
505
+ Parameters: [hash: Hash];
506
+ ReturnType: Quantity;
507
+ },
508
+ /**
509
+ * @description Returns the number of uncles in a block specified by block number
510
+ * @link https://eips.ethereum.org/EIPS/eip-1474
511
+ * @example
512
+ * provider.request({ method: 'eth_getUncleCountByBlockNumber', params: ['0x...'] })
513
+ * // => '0x1'
514
+ */
515
+ {
516
+ Method: 'eth_getUncleCountByBlockNumber';
517
+ Parameters: [block: BlockNumber | BlockTag];
518
+ ReturnType: Quantity;
519
+ },
520
+ /**
521
+ * @description Creates a filter to listen for new blocks that can be used with `eth_getFilterChanges`
522
+ * @link https://eips.ethereum.org/EIPS/eip-1474
523
+ * @example
524
+ * provider.request({ method: 'eth_newBlockFilter' })
525
+ * // => '0x1'
526
+ */
527
+ {
528
+ Method: 'eth_newBlockFilter';
529
+ Parameters?: never;
530
+ ReturnType: Quantity;
531
+ },
532
+ /**
533
+ * @description Creates a filter to listen for specific state changes that can then be used with `eth_getFilterChanges`
534
+ * @link https://eips.ethereum.org/EIPS/eip-1474
535
+ * @example
536
+ * provider.request({ method: 'eth_newFilter', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
537
+ * // => '0x1'
538
+ */
539
+ {
540
+ Method: 'eth_newFilter';
541
+ Parameters: [
492
542
  filter: {
493
543
  fromBlock?: BlockNumber | BlockTag;
494
544
  toBlock?: BlockNumber | BlockTag;
@@ -496,203 +546,221 @@ export type PublicRequests = {
496
546
  topics?: LogTopic[];
497
547
  }
498
548
  ];
499
- }): Promise<Quantity>;
500
- request(args: {
501
- /**
502
- * @description Creates a filter to listen for new pending transactions that can be used with `eth_getFilterChanges`
503
- * @link https://eips.ethereum.org/EIPS/eip-1474
504
- * @example
505
- * provider.request({ method: 'eth_newPendingTransactionFilter' })
506
- * // => '0x1'
507
- * */
508
- method: 'eth_newPendingTransactionFilter';
509
- params?: never;
510
- }): Promise<Quantity>;
511
- request(args: {
512
- /**
513
- * @description Returns the current Ethereum protocol version
514
- * @link https://eips.ethereum.org/EIPS/eip-1474
515
- * @example
516
- * provider.request({ method: 'eth_protocolVersion' })
517
- * // => '54'
518
- * */
519
- method: 'eth_protocolVersion';
520
- params?: never;
521
- }): Promise<string>;
522
- request(args: {
523
- /**
524
- * @description Sends and already-signed transaction to the network
525
- * @link https://eips.ethereum.org/EIPS/eip-1474
526
- * @example
527
- * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
528
- * // => '0x...'
529
- * */
530
- method: 'eth_sendRawTransaction';
531
- params: [signedTransaction: Hex];
532
- }): Promise<Hex>;
533
- request(args: {
534
- /**
535
- * @description Destroys a filter based on filter ID
536
- * @link https://eips.ethereum.org/EIPS/eip-1474
537
- * @example
538
- * provider.request({ method: 'eth_uninstallFilter', params: ['0x1'] })
539
- * // => true
540
- * */
541
- method: 'eth_uninstallFilter';
542
- params: [
543
- /** ID of the filter to destroy */
544
- filterId: Quantity
545
- ];
546
- }): Promise<boolean>;
547
- };
548
- export type TestRequests<Name extends string> = {
549
- request(args: {
550
- /**
551
- * @description Add information about compiled contracts
552
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_addcompilationresult
553
- */
554
- method: `${Name}_addCompilationResult`;
555
- params: any[];
556
- }): Promise<any>;
557
- request(args: {
558
- /**
559
- * @description Remove a transaction from the mempool
560
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_droptransaction
561
- */
562
- method: `${Name}_dropTransaction`;
563
- params: [hash: Hash];
564
- }): Promise<void>;
565
- request(args: {
566
- /**
567
- * @description Turn on call traces for transactions that are returned to the user when they execute a transaction (instead of just txhash/receipt).
568
- */
569
- method: `${Name}_enableTraces`;
570
- params?: never;
571
- }): Promise<void>;
572
- request(args: {
573
- /**
574
- * @description Impersonate an account or contract address.
575
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_impersonateaccount
576
- */
577
- method: `${Name}_impersonateAccount`;
578
- params: [address: Address];
579
- }): Promise<void>;
580
- request(args: {
581
- /**
582
- * @description Returns true if automatic mining is enabled, and false otherwise. See [Mining Modes](https://hardhat.org/hardhat-network/explanation/mining-modes) to learn more.
583
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_getautomine
584
- */
585
- method: `${Name}_getAutomine`;
586
- }): Promise<boolean>;
587
- request(args: {
588
- /**
589
- * @description Advance the block number of the network by a certain number of blocks
590
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_mine
591
- */
592
- method: `${Name}_mine`;
593
- params: [
549
+ ReturnType: Quantity;
550
+ },
551
+ /**
552
+ * @description Creates a filter to listen for new pending transactions that can be used with `eth_getFilterChanges`
553
+ * @link https://eips.ethereum.org/EIPS/eip-1474
554
+ * @example
555
+ * provider.request({ method: 'eth_newPendingTransactionFilter' })
556
+ * // => '0x1'
557
+ */
558
+ {
559
+ Method: 'eth_newPendingTransactionFilter';
560
+ Parameters?: never;
561
+ ReturnType: Quantity;
562
+ },
563
+ /**
564
+ * @description Returns the current Ethereum protocol version
565
+ * @link https://eips.ethereum.org/EIPS/eip-1474
566
+ * @example
567
+ * provider.request({ method: 'eth_protocolVersion' })
568
+ * // => '54'
569
+ */
570
+ {
571
+ Method: 'eth_protocolVersion';
572
+ Parameters?: never;
573
+ ReturnType: string;
574
+ },
575
+ /**
576
+ * @description Sends and already-signed transaction to the network
577
+ * @link https://eips.ethereum.org/EIPS/eip-1474
578
+ * @example
579
+ * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
580
+ * // => '0x...'
581
+ */
582
+ {
583
+ Method: 'eth_sendRawTransaction';
584
+ Parameters: [signedTransaction: Hex];
585
+ ReturnType: Hash;
586
+ },
587
+ /**
588
+ * @description Destroys a filter based on filter ID
589
+ * @link https://eips.ethereum.org/EIPS/eip-1474
590
+ * @example
591
+ * provider.request({ method: 'eth_uninstallFilter', params: ['0x1'] })
592
+ * // => true
593
+ */
594
+ {
595
+ Method: 'eth_uninstallFilter';
596
+ Parameters: [filterId: Quantity];
597
+ ReturnType: boolean;
598
+ }
599
+ ];
600
+ export type TestRpcSchema<TMode extends string> = [
601
+ /**
602
+ * @description Add information about compiled contracts
603
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_addcompilationresult
604
+ */
605
+ {
606
+ Method: `${TMode}_addCompilationResult`;
607
+ Parameters: any[];
608
+ ReturnType: any;
609
+ },
610
+ /**
611
+ * @description Remove a transaction from the mempool
612
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_droptransaction
613
+ */
614
+ {
615
+ Method: `${TMode}_dropTransaction`;
616
+ Parameters: [hash: Hash];
617
+ ReturnType: void;
618
+ },
619
+ /**
620
+ * @description Turn on call traces for transactions that are returned to the user when they execute a transaction (instead of just txhash/receipt).
621
+ */
622
+ {
623
+ Method: `${TMode}_enableTraces`;
624
+ Parameters?: never;
625
+ ReturnType: void;
626
+ },
627
+ /**
628
+ * @description Impersonate an account or contract address.
629
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_impersonateaccount
630
+ */
631
+ {
632
+ Method: `${TMode}_impersonateAccount`;
633
+ Parameters: [address: Address];
634
+ ReturnType: void;
635
+ },
636
+ /**
637
+ * @description Returns true if automatic mining is enabled, and false otherwise. See [Mining Modes](https://hardhat.org/hardhat-network/explanation/mining-modes) to learn more.
638
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_getautomine
639
+ */
640
+ {
641
+ Method: `${TMode}_getAutomine`;
642
+ Parameters?: never;
643
+ ReturnType: boolean;
644
+ },
645
+ /**
646
+ * @description Advance the block number of the network by a certain number of blocks
647
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_mine
648
+ */
649
+ {
650
+ Method: `${TMode}_mine`;
651
+ Parameters: [
594
652
  /** Number of blocks to mine. */
595
653
  count: Hex,
596
654
  /** Interval between each block in seconds. */
597
655
  interval: Hex | undefined
598
656
  ];
599
- }): Promise<void>;
600
- request(args: {
601
- /**
602
- * @description Resets the fork.
603
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_reset
604
- */
605
- method: `${Name}_reset`;
606
- params: any[];
607
- }): Promise<void>;
608
- request(args: {
609
- /**
610
- * @description Modifies the balance of an account.
611
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setbalance
612
- */
613
- method: `${Name}_setBalance`;
614
- params: [
657
+ ReturnType: void;
658
+ },
659
+ /**
660
+ * @description Resets the fork.
661
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_reset
662
+ */
663
+ {
664
+ Method: `${TMode}_reset`;
665
+ Parameters: any[];
666
+ ReturnType: void;
667
+ },
668
+ /**
669
+ * @description Modifies the balance of an account.
670
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setbalance
671
+ */
672
+ {
673
+ Method: `${TMode}_setBalance`;
674
+ Parameters: [
615
675
  /** The address of the target account. */
616
676
  address: Address,
617
677
  /** Amount to send in wei. */
618
- value: Quantity
678
+ balance: Quantity
619
679
  ];
620
- }): Promise<void>;
621
- request(args: {
622
- /**
623
- * @description Modifies the bytecode stored at an account's address.
624
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcode
625
- */
626
- method: `${Name}_setCode`;
627
- params: [
680
+ ReturnType: void;
681
+ },
682
+ /**
683
+ * @description Modifies the bytecode stored at an account's address.
684
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcode
685
+ */
686
+ {
687
+ Method: `${TMode}_setCode`;
688
+ Parameters: [
628
689
  /** The address of the contract. */
629
690
  address: Address,
630
691
  /** Data bytecode. */
631
692
  data: string
632
693
  ];
633
- }): Promise<void>;
634
- request(args: {
635
- /**
636
- * @description Sets the coinbase address to be used in new blocks.
637
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
638
- */
639
- method: `${Name}_setCoinbase`;
640
- params: [
694
+ ReturnType: void;
695
+ },
696
+ /**
697
+ * @description Sets the coinbase address to be used in new blocks.
698
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
699
+ */
700
+ {
701
+ Method: `${TMode}_setCoinbase`;
702
+ Parameters: [
641
703
  /** The address to set as the coinbase address. */
642
704
  address: Address
643
705
  ];
644
- }): Promise<void>;
645
- request(args: {
646
- /**
647
- * @description Enable or disable logging on the test node network.
648
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
649
- */
650
- method: `${Name}_setLoggingEnabled`;
651
- params: [enabled: boolean];
652
- }): Promise<void>;
653
- request(args: {
654
- /**
655
- * @description Change the minimum gas price accepted by the network (in wei).
656
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setmingasprice
657
- */
658
- method: `${Name}_setMinGasPrice`;
659
- params: [gasPrice: Quantity];
660
- }): Promise<void>;
661
- request(args: {
662
- /**
663
- * @description Sets the base fee of the next block.
664
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnextblockbasefeepergas
665
- */
666
- method: `${Name}_setNextBlockBaseFeePerGas`;
667
- params: [baseFeePerGas: Quantity];
668
- }): Promise<void>;
669
- request(args: {
670
- /**
671
- * @description Modifies an account's nonce by overwriting it.
672
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnonce
673
- */
674
- method: `${Name}_setNonce`;
675
- params: [
706
+ ReturnType: void;
707
+ },
708
+ /**
709
+ * @description Enable or disable logging on the test node network.
710
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase
711
+ */
712
+ {
713
+ Method: `${TMode}_setLoggingEnabled`;
714
+ Parameters: [enabled: boolean];
715
+ ReturnType: void;
716
+ },
717
+ /**
718
+ * @description Change the minimum gas price accepted by the network (in wei).
719
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setmingasprice
720
+ */
721
+ {
722
+ Method: `${TMode}_setMinGasPrice`;
723
+ Parameters: [gasPrice: Quantity];
724
+ ReturnType: void;
725
+ },
726
+ /**
727
+ * @description Sets the base fee of the next block.
728
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnextblockbasefeepergas
729
+ */
730
+ {
731
+ Method: `${TMode}_setNextBlockBaseFeePerGas`;
732
+ Parameters: [baseFeePerGas: Quantity];
733
+ ReturnType: void;
734
+ },
735
+ /**
736
+ * @description Modifies an account's nonce by overwriting it.
737
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnonce
738
+ */
739
+ {
740
+ Method: `${TMode}_setNonce`;
741
+ Parameters: [
676
742
  /** The account address. */
677
743
  address: Address,
678
744
  /** The new nonce. */
679
745
  nonce: Quantity
680
746
  ];
681
- }): Promise<void>;
682
- request(args: {
683
- /**
684
- * @description Sets the backend RPC URL.
685
- */
686
- method: `${Name}_setRpcUrl`;
687
- params: [url: string];
688
- }): Promise<void>;
689
- request(args: {
690
- /**
691
- * @description Writes a single position of an account's storage.
692
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setstorageat
693
- */
694
- method: `${Name}_setStorageAt`;
695
- params: [
747
+ ReturnType: void;
748
+ },
749
+ /**
750
+ * @description Sets the backend RPC URL.
751
+ */
752
+ {
753
+ Method: `${TMode}_setRpcUrl`;
754
+ Parameters: [url: string];
755
+ ReturnType: void;
756
+ },
757
+ /**
758
+ * @description Writes a single position of an account's storage.
759
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setstorageat
760
+ */
761
+ {
762
+ Method: `${TMode}_setStorageAt`;
763
+ Parameters: [
696
764
  /** The account address. */
697
765
  address: Address,
698
766
  /** The storage position index. */
@@ -700,304 +768,450 @@ export type TestRequests<Name extends string> = {
700
768
  /** The storage value. */
701
769
  value: Quantity
702
770
  ];
703
- }): Promise<void>;
704
- request(args: {
705
- /**
706
- * @description Use this method to stop impersonating an account after having previously used impersonateAccount.
707
- * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_stopimpersonatingaccount
708
- */
709
- method: `${Name}_stopImpersonatingAccount`;
710
- params: [
771
+ ReturnType: void;
772
+ },
773
+ /**
774
+ * @description Use this method to stop impersonating an account after having previously used impersonateAccount.
775
+ * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_stopimpersonatingaccount
776
+ */
777
+ {
778
+ Method: `${TMode}_stopImpersonatingAccount`;
779
+ Parameters: [
711
780
  /** The address to stop impersonating. */
712
781
  address: Address
713
782
  ];
714
- }): Promise<void>;
715
- request(args: {
716
- /**
717
- * @description Jump forward in time by the given amount of time, in seconds.
718
- * @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime
719
- */
720
- method: 'evm_increaseTime';
721
- params: [seconds: Quantity];
722
- }): Promise<Quantity>;
723
- request(args: {
724
- /**
725
- * @description Enables or disables, based on the single boolean argument, the automatic mining of new blocks with each new transaction submitted to the network.
726
- * @link https://hardhat.org/hardhat-network/docs/reference#evm_setautomine
727
- */
728
- method: 'evm_setAutomine';
729
- params: [boolean];
730
- }): Promise<void>;
731
- request(args: {
732
- /**
733
- * @description Sets the block's gas limit.
734
- * @link https://hardhat.org/hardhat-network/docs/reference#evm_setblockgaslimit
735
- */
736
- method: 'evm_setBlockGasLimit';
737
- params: [gasLimit: Quantity];
738
- }): Promise<void>;
739
- request(args: {
740
- /**
741
- * @description Similar to `evm_increaseTime` but sets a block timestamp `interval`.
742
- * The timestamp of the next block will be computed as `lastBlock_timestamp` + `interval`
743
- */
744
- method: `${Name}_setBlockTimestampInterval`;
745
- params: [seconds: number];
746
- }): Promise<void>;
747
- request(args: {
748
- /**
749
- * @description Removes `setBlockTimestampInterval` if it exists
750
- */
751
- method: `${Name}_removeBlockTimestampInterval`;
752
- }): Promise<void>;
753
- request(args: {
754
- /**
755
- * @description Enables (with a numeric argument greater than 0) or disables (with a numeric argument equal to 0), the automatic mining of blocks at a regular interval of milliseconds, each of which will include all pending transactions.
756
- * @link https://hardhat.org/hardhat-network/docs/reference#evm_setintervalmining
757
- */
758
- method: 'evm_setIntervalMining';
759
- params: [number];
760
- }): Promise<void>;
761
- request(args: {
762
- /**
763
- * @description Set the timestamp of the next block.
764
- * @link https://hardhat.org/hardhat-network/docs/reference#evm_setnextblocktimestamp
765
- */
766
- method: 'evm_setNextBlockTimestamp';
767
- params: [Quantity];
768
- }): Promise<void>;
769
- request(args: {
770
- /**
771
- * @description Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the id of the snapshot that was created.
772
- * @link https://hardhat.org/hardhat-network/docs/reference#evm_snapshot
773
- */
774
- method: 'evm_snapshot';
775
- params?: never;
776
- }): Promise<Quantity>;
777
- request(args: {
778
- /**
779
- * @description Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to.
780
- */
781
- method: 'evm_revert';
782
- params?: [id: Quantity];
783
- }): Promise<void>;
784
- request(args: {
785
- /**
786
- * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-content
787
- */
788
- method: 'txpool_content';
789
- params?: never;
790
- }): Promise<{
791
- pending: Record<Address, Record<string, Transaction>>;
792
- queued: Record<Address, Record<string, Transaction>>;
793
- }>;
794
- request(args: {
795
- /**
796
- * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
797
- */
798
- method: 'txpool_inspect';
799
- params?: never;
800
- }): Promise<{
801
- pending: Record<Address, Record<string, string>>;
802
- queued: Record<Address, Record<string, string>>;
803
- }>;
804
- request(args: {
805
- /**
806
- * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
807
- */
808
- method: 'txpool_status';
809
- params?: never;
810
- }): Promise<{
811
- pending: Quantity;
812
- queued: Quantity;
813
- }>;
814
- request(args: {
815
- /**
816
- * @description Creates, signs, and sends a new transaction to the network regardless of the signature.
817
- * @link https://eips.ethereum.org/EIPS/eip-1474
818
- * @example
819
- * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
820
- * // => '0x...'
821
- * */
822
- method: 'eth_sendUnsignedTransaction';
823
- params: [request: TransactionRequest];
824
- }): Promise<Hash>;
825
- };
826
- export type SignableRequests = {
827
- request(args: {
828
- /**
829
- * @description Creates, signs, and sends a new transaction to the network
830
- * @link https://eips.ethereum.org/EIPS/eip-1474
831
- * @example
832
- * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
833
- * // => '0x...'
834
- * */
835
- method: 'eth_sendTransaction';
836
- params: [request: TransactionRequest];
837
- }): Promise<Hash>;
838
- request(args: {
839
- /**
840
- * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
841
- * @link https://eips.ethereum.org/EIPS/eip-1474
842
- * @example
843
- * provider.request({ method: 'eth_sign', params: ['0x...', '0x...'] })
844
- * // => '0x...'
845
- * */
846
- method: 'eth_sign';
847
- params: [
783
+ ReturnType: void;
784
+ },
785
+ /**
786
+ * @description Jump forward in time by the given amount of time, in seconds.
787
+ * @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime
788
+ */
789
+ {
790
+ Method: `${TMode}_increaseTime`;
791
+ Parameters: [seconds: number];
792
+ ReturnType: Quantity;
793
+ },
794
+ /**
795
+ * @description Modifies the balance of an account.
796
+ * @link https://ganache.dev/#evm_setAccountBalance
797
+ */
798
+ {
799
+ Method: `evm_setAccountBalance`;
800
+ Parameters: [
801
+ /** The address of the target account. */
802
+ address: Address,
803
+ /** Amount to send in wei. */
804
+ value: Quantity
805
+ ];
806
+ ReturnType: void;
807
+ },
808
+ /**
809
+ * @description Enables or disables, based on the single boolean argument, the automatic mining of new blocks with each new transaction submitted to the network.
810
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setautomine
811
+ */
812
+ {
813
+ Method: `evm_setAutomine`;
814
+ Parameters: [boolean];
815
+ ReturnType: void;
816
+ },
817
+ /**
818
+ * @description Sets the block's gas limit.
819
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setblockgaslimit
820
+ */
821
+ {
822
+ Method: 'evm_setBlockGasLimit';
823
+ Parameters: [gasLimit: Quantity];
824
+ ReturnType: void;
825
+ },
826
+ /**
827
+ * @description Jump forward in time by the given amount of time, in seconds.
828
+ * @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime
829
+ */
830
+ {
831
+ Method: `evm_increaseTime`;
832
+ Parameters: [seconds: Quantity];
833
+ ReturnType: Quantity;
834
+ },
835
+ /**
836
+ * @description Similar to `evm_increaseTime` but sets a block timestamp `interval`.
837
+ * The timestamp of the next block will be computed as `lastBlock_timestamp` + `interval`
838
+ */
839
+ {
840
+ Method: `${TMode}_setBlockTimestampInterval`;
841
+ Parameters: [seconds: number];
842
+ ReturnType: void;
843
+ },
844
+ /**
845
+ * @description Removes `setBlockTimestampInterval` if it exists
846
+ */
847
+ {
848
+ Method: `${TMode}_removeBlockTimestampInterval`;
849
+ Parameters?: never;
850
+ ReturnType: void;
851
+ },
852
+ /**
853
+ * @description Enables (with a numeric argument greater than 0) or disables (with a numeric argument equal to 0), the automatic mining of blocks at a regular interval of milliseconds, each of which will include all pending transactions.
854
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setintervalmining
855
+ */
856
+ {
857
+ Method: 'evm_setIntervalMining';
858
+ Parameters: [number];
859
+ ReturnType: void;
860
+ },
861
+ /**
862
+ * @description Set the timestamp of the next block.
863
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_setnextblocktimestamp
864
+ */
865
+ {
866
+ Method: 'evm_setNextBlockTimestamp';
867
+ Parameters: [Quantity];
868
+ ReturnType: void;
869
+ },
870
+ /**
871
+ * @description Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the id of the snapshot that was created.
872
+ * @link https://hardhat.org/hardhat-network/docs/reference#evm_snapshot
873
+ */
874
+ {
875
+ Method: 'evm_snapshot';
876
+ Parameters?: never;
877
+ ReturnType: Quantity;
878
+ },
879
+ /**
880
+ * @description Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to.
881
+ */
882
+ {
883
+ Method: 'evm_revert';
884
+ Parameters?: [id: Quantity];
885
+ ReturnType: void;
886
+ },
887
+ /**
888
+ * @description Enables the automatic mining of new blocks with each new transaction submitted to the network.
889
+ * @link https://ganache.dev/#miner_start
890
+ */
891
+ {
892
+ Method: 'miner_start';
893
+ Parameters?: never;
894
+ ReturnType: void;
895
+ },
896
+ /**
897
+ * @description Disables the automatic mining of new blocks with each new transaction submitted to the network.
898
+ * @link https://ganache.dev/#miner_stop
899
+ */
900
+ {
901
+ Method: 'miner_stop';
902
+ Parameters?: never;
903
+ ReturnType: void;
904
+ },
905
+ /**
906
+ * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-content
907
+ */
908
+ {
909
+ Method: 'txpool_content';
910
+ Parameters?: never;
911
+ ReturnType: {
912
+ pending: Record<Address, Record<string, Transaction>>;
913
+ queued: Record<Address, Record<string, Transaction>>;
914
+ };
915
+ },
916
+ /**
917
+ * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
918
+ */
919
+ {
920
+ Method: 'txpool_inspect';
921
+ Parameters?: never;
922
+ ReturnType: {
923
+ pending: Record<Address, Record<string, string>>;
924
+ queued: Record<Address, Record<string, string>>;
925
+ };
926
+ },
927
+ /**
928
+ * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect
929
+ */
930
+ {
931
+ Method: 'txpool_status';
932
+ Parameters?: never;
933
+ ReturnType: {
934
+ pending: Quantity;
935
+ queued: Quantity;
936
+ };
937
+ },
938
+ /**
939
+ * @description Returns whether the client is actively mining new blocks.
940
+ * @link https://eips.ethereum.org/EIPS/eip-1474
941
+ * @example
942
+ * provider.request({ method: 'eth_mining' })
943
+ * // => true
944
+ */
945
+ {
946
+ Method: 'eth_mining';
947
+ Parameters?: never;
948
+ ReturnType: boolean;
949
+ },
950
+ /**
951
+ * @description Advance the block number of the network by a certain number of blocks.
952
+ * @link https://ganache.dev/#evm_mine
953
+ */
954
+ {
955
+ Method: 'evm_mine';
956
+ Parameters?: [
957
+ {
958
+ /** Number of blocks to mine. */
959
+ blocks: Hex;
960
+ }
961
+ ];
962
+ ReturnType: void;
963
+ },
964
+ /**
965
+ * @description Creates, signs, and sends a new transaction to the network regardless of the signature.
966
+ * @link https://eips.ethereum.org/EIPS/eip-1474
967
+ * @example
968
+ * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
969
+ * // => '0x...'
970
+ */
971
+ {
972
+ Method: 'eth_sendUnsignedTransaction';
973
+ Parameters: [transaction: TransactionRequest];
974
+ ReturnType: Hash;
975
+ }
976
+ ];
977
+ export type WalletRpcSchema = [
978
+ /**
979
+ * @description Returns a list of addresses owned by this client
980
+ * @link https://eips.ethereum.org/EIPS/eip-1474
981
+ * @example
982
+ * provider.request({ method: 'eth_accounts' })
983
+ * // => ['0x0fB69...']
984
+ */
985
+ {
986
+ Method: 'eth_accounts';
987
+ Parameters?: never;
988
+ ReturnType: Address[];
989
+ },
990
+ /**
991
+ * @description Returns the current chain ID associated with the wallet.
992
+ * @example
993
+ * provider.request({ method: 'eth_chainId' })
994
+ * // => '1'
995
+ */
996
+ {
997
+ Method: 'eth_chainId';
998
+ Parameters?: never;
999
+ ReturnType: Quantity;
1000
+ },
1001
+ /**
1002
+ * @description Estimates the gas necessary to complete a transaction without submitting it to the network
1003
+ *
1004
+ * @example
1005
+ * provider.request({
1006
+ * method: 'eth_estimateGas',
1007
+ * params: [{ from: '0x...', to: '0x...', value: '0x...' }]
1008
+ * })
1009
+ * // => '0x5208'
1010
+ */
1011
+ {
1012
+ Method: 'eth_estimateGas';
1013
+ Parameters: [transaction: TransactionRequest] | [transaction: TransactionRequest, block: BlockNumber | BlockTag];
1014
+ ReturnType: Quantity;
1015
+ },
1016
+ /**
1017
+ * @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear.
1018
+ * @link https://eips.ethereum.org/EIPS/eip-1102
1019
+ * @example
1020
+ * provider.request({ method: 'eth_requestAccounts' }] })
1021
+ * // => ['0x...', '0x...']
1022
+ */
1023
+ {
1024
+ Method: 'eth_requestAccounts';
1025
+ Parameters?: never;
1026
+ ReturnType: Address[];
1027
+ },
1028
+ /**
1029
+ * @description Creates, signs, and sends a new transaction to the network
1030
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1031
+ * @example
1032
+ * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
1033
+ * // => '0x...'
1034
+ */
1035
+ {
1036
+ Method: 'eth_sendTransaction';
1037
+ Parameters: [transaction: TransactionRequest];
1038
+ ReturnType: Hash;
1039
+ },
1040
+ /**
1041
+ * @description Sends and already-signed transaction to the network
1042
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1043
+ * @example
1044
+ * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
1045
+ * // => '0x...'
1046
+ */
1047
+ {
1048
+ Method: 'eth_sendRawTransaction';
1049
+ Parameters: [signedTransaction: Hex];
1050
+ ReturnType: Hash;
1051
+ },
1052
+ /**
1053
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
1054
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1055
+ * @example
1056
+ * provider.request({ method: 'eth_sign', params: ['0x...', '0x...'] })
1057
+ * // => '0x...'
1058
+ */
1059
+ {
1060
+ Method: 'eth_sign';
1061
+ Parameters: [
848
1062
  /** Address to use for signing */
849
1063
  address: Address,
850
1064
  /** Data to sign */
851
1065
  data: Hex
852
1066
  ];
853
- }): Promise<Hex>;
854
- request(args: {
855
- /**
856
- * @description Signs a transaction that can be submitted to the network at a later time using with `eth_sendRawTransaction`
857
- * @link https://eips.ethereum.org/EIPS/eip-1474
858
- * @example
859
- * provider.request({ method: 'eth_signTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
860
- * // => '0x...'
861
- * */
862
- method: 'eth_signTransaction';
863
- params: [request: TransactionRequest];
864
- }): Promise<Hex>;
865
- request(args: {
866
- /**
867
- * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
868
- * @link https://eips.ethereum.org/EIPS/eip-1474
869
- * @example
870
- * provider.request({ method: 'eth_signTypedData_v4', params: [{ from: '0x...', data: [{ type: 'string', name: 'message', value: 'hello world' }] }] })
871
- * // => '0x...'
872
- * */
873
- method: 'eth_signTypedData_v4';
874
- params: [
1067
+ ReturnType: Hex;
1068
+ },
1069
+ /**
1070
+ * @description Signs a transaction that can be submitted to the network at a later time using with `eth_sendRawTransaction`
1071
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1072
+ * @example
1073
+ * provider.request({ method: 'eth_signTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
1074
+ * // => '0x...'
1075
+ */
1076
+ {
1077
+ Method: 'eth_signTransaction';
1078
+ Parameters: [request: TransactionRequest];
1079
+ ReturnType: Hex;
1080
+ },
1081
+ /**
1082
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
1083
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1084
+ * @example
1085
+ * provider.request({ method: 'eth_signTypedData_v4', params: [{ from: '0x...', data: [{ type: 'string', name: 'message', value: 'hello world' }] }] })
1086
+ * // => '0x...'
1087
+ */
1088
+ {
1089
+ Method: 'eth_signTypedData_v4';
1090
+ Parameters: [
875
1091
  /** Address to use for signing */
876
1092
  address: Address,
877
1093
  /** Message to sign containing type information, a domain separator, and data */
878
1094
  message: string
879
1095
  ];
880
- }): Promise<Hex>;
881
- request(args: {
882
- /**
883
- * @description Returns information about the status of this client’s network synchronization
884
- * @link https://eips.ethereum.org/EIPS/eip-1474
885
- * @example
886
- * provider.request({ method: 'eth_syncing' })
887
- * // => { startingBlock: '0x...', currentBlock: '0x...', highestBlock: '0x...' }
888
- * */
889
- method: 'eth_syncing';
890
- params?: never;
891
- }): Promise<NetworkSync | false>;
892
- request(args: {
893
- /**
894
- * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
895
- * @link https://eips.ethereum.org/EIPS/eip-1474
896
- * @example
897
- * provider.request({ method: 'personal_sign', params: ['0x...', '0x...'] })
898
- * // => '0x...'
899
- * */
900
- method: 'personal_sign';
901
- params: [
1096
+ ReturnType: Hex;
1097
+ },
1098
+ /**
1099
+ * @description Returns information about the status of this client’s network synchronization
1100
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1101
+ * @example
1102
+ * provider.request({ method: 'eth_syncing' })
1103
+ * // => { startingBlock: '0x...', currentBlock: '0x...', highestBlock: '0x...' }
1104
+ */
1105
+ {
1106
+ Method: 'eth_syncing';
1107
+ Parameters?: never;
1108
+ ReturnType: NetworkSync | false;
1109
+ },
1110
+ /**
1111
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
1112
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1113
+ * @example
1114
+ * provider.request({ method: 'personal_sign', params: ['0x...', '0x...'] })
1115
+ * // => '0x...'
1116
+ */
1117
+ {
1118
+ Method: 'personal_sign';
1119
+ Parameters: [
902
1120
  /** Data to sign */
903
1121
  data: Hex,
904
1122
  /** Address to use for signing */
905
1123
  address: Address
906
1124
  ];
907
- }): Promise<Hex>;
908
- };
909
- export type WalletRequests = {
910
- request(args: {
911
- /**
912
- * @description Returns a list of addresses owned by this client
913
- * @link https://eips.ethereum.org/EIPS/eip-1474
914
- * @example
915
- * provider.request({ method: 'eth_accounts' })
916
- * // => ['0x0fB69...']
917
- * */
918
- method: 'eth_accounts';
919
- params?: never;
920
- }): Promise<Address[]>;
921
- request(args: {
922
- /**
923
- * @description Returns the current chain ID associated with the wallet.
924
- * @example
925
- * provider.request({ method: 'eth_chainId' })
926
- * // => '1'
927
- */
928
- method: 'eth_chainId';
929
- params?: never;
930
- }): Promise<Quantity>;
931
- request(args: {
932
- /**
933
- * @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear.
934
- * @link https://eips.ethereum.org/EIPS/eip-1102
935
- * @example
936
- * provider.request({ method: 'eth_requestAccounts' })
937
- * // => ['0x...', '0x...']
938
- * */
939
- method: 'eth_requestAccounts';
940
- params?: never;
941
- }): Promise<Address[]>;
942
- request(args: {
943
- /**
944
- * @description Requests the given permissions from the user.
945
- * @link https://eips.ethereum.org/EIPS/eip-2255
946
- * @example
947
- * provider.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] })
948
- * // => { ... }
949
- * */
950
- method: 'wallet_requestPermissions';
951
- params: [permissions: {
1125
+ ReturnType: Hex;
1126
+ },
1127
+ /**
1128
+ * @description Add an Ethereum chain to the wallet.
1129
+ * @link https://eips.ethereum.org/EIPS/eip-3085
1130
+ * @example
1131
+ * provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: 1, rpcUrl: 'https://mainnet.infura.io/v3/...' }] })
1132
+ * // => { ... }
1133
+ */
1134
+ {
1135
+ Method: 'wallet_addEthereumChain';
1136
+ Parameters: [chain: AddEthereumChainParameter];
1137
+ ReturnType: null;
1138
+ },
1139
+ /**
1140
+ * @description Gets the wallets current permissions.
1141
+ * @link https://eips.ethereum.org/EIPS/eip-2255
1142
+ * @example
1143
+ * provider.request({ method: 'wallet_getPermissions' })
1144
+ * // => { ... }
1145
+ */
1146
+ {
1147
+ Method: 'wallet_getPermissions';
1148
+ Parameters?: never;
1149
+ ReturnType: WalletPermission[];
1150
+ },
1151
+ /**
1152
+ * @description Requests the given permissions from the user.
1153
+ * @link https://eips.ethereum.org/EIPS/eip-2255
1154
+ * @example
1155
+ * provider.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] })
1156
+ * // => { ... }
1157
+ */
1158
+ {
1159
+ Method: 'wallet_requestPermissions';
1160
+ Parameters: [permissions: {
952
1161
  eth_accounts: Record<string, any>;
953
1162
  }];
954
- }): Promise<WalletPermission[]>;
955
- request(args: {
956
- /**
957
- * @description Gets the wallets current permissions.
958
- * @link https://eips.ethereum.org/EIPS/eip-2255
959
- * @example
960
- * provider.request({ method: 'wallet_getPermissions' })
961
- * // => { ... }
962
- * */
963
- method: 'wallet_getPermissions';
964
- params?: never;
965
- }): Promise<WalletPermission[]>;
966
- request(args: {
967
- /**
968
- * @description Add an Ethereum chain to the wallet.
969
- * @link https://eips.ethereum.org/EIPS/eip-3085
970
- * @example
971
- * provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: 1, rpcUrl: 'https://mainnet.infura.io/v3/...' }] })
972
- * // => { ... }
973
- */
974
- method: 'wallet_addEthereumChain';
975
- params: [chain: Chain];
976
- }): Promise<null>;
977
- request(args: {
978
- /**
979
- * @description Switch the wallet to the given Ethereum chain.
980
- * @link https://eips.ethereum.org/EIPS/eip-3326
981
- * @example
982
- * provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }] })
983
- * // => { ... }
984
- * */
985
- method: 'wallet_switchEthereumChain';
986
- params: [chain: {
1163
+ ReturnType: WalletPermission[];
1164
+ },
1165
+ /**
1166
+ * @description Switch the wallet to the given Ethereum chain.
1167
+ * @link https://eips.ethereum.org/EIPS/eip-3326
1168
+ * @example
1169
+ * provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }] })
1170
+ * // => { ... }
1171
+ */
1172
+ {
1173
+ Method: 'wallet_switchEthereumChain';
1174
+ Parameters: [chain: {
987
1175
  chainId: string;
988
1176
  }];
989
- }): Promise<null>;
1177
+ ReturnType: null;
1178
+ },
990
1179
  /**
991
1180
  * @description Requests that the user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added.
992
1181
  * @link https://eips.ethereum.org/EIPS/eip-747
993
1182
  * @example
994
1183
  * provider.request({ method: 'wallet_watchAsset' }] })
995
1184
  * // => true
996
- * */
997
- request(args: {
998
- method: 'wallet_watchAsset';
999
- params: WatchAssetParams;
1000
- }): Promise<boolean>;
1185
+ */
1186
+ {
1187
+ Method: 'wallet_watchAsset';
1188
+ Parameters: WatchAssetParams;
1189
+ ReturnType: boolean;
1190
+ }
1191
+ ];
1192
+ export type RpcSchema = readonly {
1193
+ Method: string;
1194
+ Parameters?: unknown;
1195
+ ReturnType: unknown;
1196
+ }[];
1197
+ export type RpcSchemaOverride = Omit<RpcSchema[number], 'Method'>;
1198
+ export type EIP1193Parameters<TRpcSchema extends RpcSchema | undefined = undefined> = TRpcSchema extends RpcSchema ? {
1199
+ [K in keyof TRpcSchema]: Prettify<{
1200
+ method: TRpcSchema[K] extends TRpcSchema[number] ? TRpcSchema[K]['Method'] : never;
1201
+ } & (TRpcSchema[K] extends TRpcSchema[number] ? TRpcSchema[K]['Parameters'] extends undefined ? {
1202
+ params?: never;
1203
+ } : {
1204
+ params: TRpcSchema[K]['Parameters'];
1205
+ } : never)>;
1206
+ }[number] : {
1207
+ method: string;
1208
+ params?: unknown;
1001
1209
  };
1002
- export type Requests = PublicRequests & SignableRequests & WalletRequests;
1210
+ type DerivedRpcSchema<TRpcSchema extends RpcSchema | undefined, TRpcSchemaOverride extends RpcSchemaOverride | undefined> = TRpcSchemaOverride extends RpcSchemaOverride ? [TRpcSchemaOverride & {
1211
+ Method: string;
1212
+ }] : TRpcSchema;
1213
+ export type EIP1193RequestFn<TRpcSchema extends RpcSchema | undefined = undefined> = <TRpcSchemaOverride extends RpcSchemaOverride | undefined = undefined, TParameters extends EIP1193Parameters<DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride>> = EIP1193Parameters<DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride>>, _ReturnType = DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride> extends RpcSchema ? Extract<DerivedRpcSchema<TRpcSchema, TRpcSchemaOverride>[number], {
1214
+ Method: TParameters['method'];
1215
+ }>['ReturnType'] : unknown>(args: TParameters) => Promise<_ReturnType>;
1216
+ export {};
1003
1217
  //# sourceMappingURL=eip1193.d.ts.map