viem 0.0.1-cjs.10 → 0.0.1-sushi.26

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 (532) hide show
  1. package/contract/package.json +4 -0
  2. package/dist/call-ac509982.d.ts +23 -0
  3. package/dist/chain-c4ccb458.d.ts +5 -0
  4. package/dist/{rpc-b77c5aee.d.ts → chain-f16512e8.d.ts} +97 -17
  5. package/dist/chains.d.ts +1303 -74
  6. package/dist/chains.js +81 -85
  7. package/dist/chains.js.map +1 -0
  8. package/dist/chains.mjs +121 -125
  9. package/dist/chains.mjs.map +1 -0
  10. package/dist/chunk-2PFNLP3F.js +192 -0
  11. package/dist/chunk-2PFNLP3F.js.map +1 -0
  12. package/dist/chunk-5ND4P6QL.mjs +192 -0
  13. package/dist/chunk-5ND4P6QL.mjs.map +1 -0
  14. package/dist/{chunk-5ZBNF5WM.js → chunk-NXCI5KQC.js} +769 -359
  15. package/dist/chunk-NXCI5KQC.js.map +1 -0
  16. package/dist/{chunk-HLVCJ7RV.mjs → chunk-O7T5NQLB.mjs} +484 -477
  17. package/dist/chunk-O7T5NQLB.mjs.map +1 -0
  18. package/dist/{chunk-2FDH6XP5.mjs → chunk-SD5X7F4U.mjs} +777 -367
  19. package/dist/chunk-SD5X7F4U.mjs.map +1 -0
  20. package/dist/{chunk-46ZFLVHC.js → chunk-UTL6F7UN.js} +519 -512
  21. package/dist/chunk-UTL6F7UN.js.map +1 -0
  22. package/dist/contract-9e76e561.d.ts +166 -0
  23. package/dist/contract.d.ts +123 -0
  24. package/dist/contract.js +53 -0
  25. package/dist/contract.js.map +1 -0
  26. package/dist/contract.mjs +53 -0
  27. package/dist/contract.mjs.map +1 -0
  28. package/dist/createClient-68ee4bb4.d.ts +62 -0
  29. package/dist/createPublicClient-b732194e.d.ts +19 -0
  30. package/dist/createTestClient-dedf321e.d.ts +34 -0
  31. package/dist/createWalletClient-75813d83.d.ts +30 -0
  32. package/dist/decodeErrorResult-0b934d23.d.ts +16 -0
  33. package/dist/{eip1193-020a6f13.d.ts → eip1193-6f9ba163.d.ts} +12 -9
  34. package/dist/ens.d.ts +82 -0
  35. package/dist/ens.js +216 -0
  36. package/dist/ens.js.map +1 -0
  37. package/dist/ens.mjs +216 -0
  38. package/dist/ens.mjs.map +1 -0
  39. package/dist/getAbiItem-c8e6e7d4.d.ts +97 -0
  40. package/dist/index.d.ts +128 -33
  41. package/dist/index.js +240 -244
  42. package/dist/index.js.map +1 -0
  43. package/dist/index.mjs +257 -261
  44. package/dist/index.mjs.map +1 -0
  45. package/dist/public.d.ts +353 -0
  46. package/dist/public.js +58 -0
  47. package/dist/public.js.map +1 -0
  48. package/dist/public.mjs +58 -0
  49. package/dist/public.mjs.map +1 -0
  50. package/dist/readContract-4f6e2692.d.ts +10 -0
  51. package/dist/rpc-a5a7f376.d.ts +121 -0
  52. package/dist/sendTransaction-e713f90c.d.ts +12 -0
  53. package/dist/test.d.ts +161 -0
  54. package/dist/test.js +264 -0
  55. package/dist/test.js.map +1 -0
  56. package/dist/test.mjs +264 -0
  57. package/dist/test.mjs.map +1 -0
  58. package/dist/transactionReceipt-2a86c7c7.d.ts +26 -0
  59. package/dist/transactionRequest-c7794f5e.d.ts +15 -0
  60. package/dist/utils/index.d.ts +238 -24
  61. package/dist/utils/index.js +27 -2
  62. package/dist/utils/index.js.map +1 -0
  63. package/dist/utils/index.mjs +30 -5
  64. package/dist/utils/index.mjs.map +1 -0
  65. package/dist/wallet.d.ts +42 -0
  66. package/dist/wallet.js +24 -0
  67. package/dist/wallet.js.map +1 -0
  68. package/dist/wallet.mjs +24 -0
  69. package/dist/wallet.mjs.map +1 -0
  70. package/dist/watchEvent-c346c12d.d.ts +41 -0
  71. package/dist/window.d.ts +3 -2
  72. package/dist/window.js +1 -1
  73. package/dist/window.js.map +1 -0
  74. package/dist/window.mjs +1 -0
  75. package/dist/window.mjs.map +1 -0
  76. package/ens/package.json +4 -0
  77. package/package.json +40 -72
  78. package/src/_test/abis.ts +1420 -0
  79. package/src/_test/bench.ts +15 -0
  80. package/src/_test/constants.ts +63 -0
  81. package/src/_test/generated.ts +128 -0
  82. package/src/_test/globalSetup.ts +11 -0
  83. package/src/_test/index.ts +25 -0
  84. package/src/_test/setup.ts +8 -0
  85. package/src/_test/utils.ts +155 -0
  86. package/src/actions/ens/getEnsAddress.bench.ts +26 -0
  87. package/src/actions/ens/getEnsAddress.test.ts +97 -0
  88. package/src/actions/ens/getEnsAddress.ts +122 -0
  89. package/src/actions/ens/getEnsName.bench.ts +30 -0
  90. package/src/actions/ens/getEnsName.test.ts +101 -0
  91. package/src/actions/ens/getEnsName.ts +106 -0
  92. package/src/actions/ens/index.test.ts +12 -0
  93. package/src/actions/ens/index.ts +3 -0
  94. package/src/actions/index.test.ts +81 -0
  95. package/src/actions/index.ts +182 -0
  96. package/src/actions/public/call.bench.ts +48 -0
  97. package/src/actions/public/call.test.ts +99 -0
  98. package/src/actions/public/call.ts +97 -0
  99. package/src/actions/public/createBlockFilter.bench.ts +11 -0
  100. package/src/actions/public/createBlockFilter.test.ts +9 -0
  101. package/src/actions/public/createBlockFilter.ts +14 -0
  102. package/src/actions/public/createContractEventFilter.test.ts +119 -0
  103. package/src/actions/public/createContractEventFilter.ts +69 -0
  104. package/src/actions/public/createEventFilter.test.ts +277 -0
  105. package/src/actions/public/createEventFilter.ts +93 -0
  106. package/src/actions/public/createPendingTransactionFilter.bench.ts +11 -0
  107. package/src/actions/public/createPendingTransactionFilter.test.ts +9 -0
  108. package/src/actions/public/createPendingTransactionFilter.ts +14 -0
  109. package/src/actions/public/estimateGas.bench.ts +46 -0
  110. package/src/actions/public/estimateGas.test.ts +92 -0
  111. package/src/actions/public/estimateGas.ts +61 -0
  112. package/src/actions/public/getBalance.test.ts +83 -0
  113. package/src/actions/public/getBalance.ts +37 -0
  114. package/src/actions/public/getBlock.bench.ts +28 -0
  115. package/src/actions/public/getBlock.test.ts +575 -0
  116. package/src/actions/public/getBlock.ts +65 -0
  117. package/src/actions/public/getBlockNumber.bench.ts +28 -0
  118. package/src/actions/public/getBlockNumber.test.ts +27 -0
  119. package/src/actions/public/getBlockNumber.ts +32 -0
  120. package/src/actions/public/getBlockTransactionCount.bench.ts +15 -0
  121. package/src/actions/public/getBlockTransactionCount.test.ts +57 -0
  122. package/src/actions/public/getBlockTransactionCount.ts +52 -0
  123. package/src/actions/public/getBytecode.test.ts +27 -0
  124. package/src/actions/public/getBytecode.ts +32 -0
  125. package/src/actions/public/getChainId.bench.ts +15 -0
  126. package/src/actions/public/getChainId.test.ts +8 -0
  127. package/src/actions/public/getChainId.ts +7 -0
  128. package/src/actions/public/getFeeHistory.bench.ts +18 -0
  129. package/src/actions/public/getFeeHistory.test.ts +137 -0
  130. package/src/actions/public/getFeeHistory.ts +44 -0
  131. package/src/actions/public/getFilterChanges.bench.ts +13 -0
  132. package/src/actions/public/getFilterChanges.test.ts +383 -0
  133. package/src/actions/public/getFilterChanges.ts +23 -0
  134. package/src/actions/public/getFilterLogs.test.ts +297 -0
  135. package/src/actions/public/getFilterLogs.ts +20 -0
  136. package/src/actions/public/getGasPrice.bench.ts +19 -0
  137. package/src/actions/public/getGasPrice.test.ts +8 -0
  138. package/src/actions/public/getGasPrice.ts +15 -0
  139. package/src/actions/public/getLogs.test.ts +306 -0
  140. package/src/actions/public/getLogs.ts +84 -0
  141. package/src/actions/public/getStorageAt.test.ts +34 -0
  142. package/src/actions/public/getStorageAt.ts +32 -0
  143. package/src/actions/public/getTransaction.bench.ts +33 -0
  144. package/src/actions/public/getTransaction.test.ts +311 -0
  145. package/src/actions/public/getTransaction.ts +95 -0
  146. package/src/actions/public/getTransactionConfirmations.test.ts +69 -0
  147. package/src/actions/public/getTransactionConfirmations.ts +38 -0
  148. package/src/actions/public/getTransactionCount.test.ts +56 -0
  149. package/src/actions/public/getTransactionCount.ts +34 -0
  150. package/src/actions/public/getTransactionReceipt.bench.ts +33 -0
  151. package/src/actions/public/getTransactionReceipt.test.ts +179 -0
  152. package/src/actions/public/getTransactionReceipt.ts +34 -0
  153. package/src/actions/public/index.test.ts +43 -0
  154. package/src/actions/public/index.ts +146 -0
  155. package/src/actions/public/multicall.test.ts +452 -0
  156. package/src/actions/public/multicall.ts +108 -0
  157. package/src/actions/public/readContract.test.ts +328 -0
  158. package/src/actions/public/readContract.ts +73 -0
  159. package/src/actions/public/simulateContract.bench.ts +41 -0
  160. package/src/actions/public/simulateContract.test.ts +410 -0
  161. package/src/actions/public/simulateContract.ts +91 -0
  162. package/src/actions/public/uninstallFilter.bench.ts +13 -0
  163. package/src/actions/public/uninstallFilter.test.ts +65 -0
  164. package/src/actions/public/uninstallFilter.ts +17 -0
  165. package/src/actions/public/waitForTransactionReceipt.test.ts +322 -0
  166. package/src/actions/public/waitForTransactionReceipt.ts +170 -0
  167. package/src/actions/public/watchBlockNumber.test.ts +166 -0
  168. package/src/actions/public/watchBlockNumber.ts +79 -0
  169. package/src/actions/public/watchBlocks.test.ts +210 -0
  170. package/src/actions/public/watchBlocks.ts +114 -0
  171. package/src/actions/public/watchContractEvent.test.ts +305 -0
  172. package/src/actions/public/watchContractEvent.ts +108 -0
  173. package/src/actions/public/watchEvent.test.ts +195 -0
  174. package/src/actions/public/watchEvent.ts +95 -0
  175. package/src/actions/public/watchPendingTransactions.test.ts +116 -0
  176. package/src/actions/public/watchPendingTransactions.ts +74 -0
  177. package/src/actions/test/dropTransaction.test.ts +34 -0
  178. package/src/actions/test/dropTransaction.ts +17 -0
  179. package/src/actions/test/getAutomine.test.ts +14 -0
  180. package/src/actions/test/getAutomine.ts +11 -0
  181. package/src/actions/test/getTxpoolContent.test.ts +45 -0
  182. package/src/actions/test/getTxpoolContent.ts +7 -0
  183. package/src/actions/test/getTxpoolStatus.test.ts +41 -0
  184. package/src/actions/test/getTxpoolStatus.ts +12 -0
  185. package/src/actions/test/impersonateAccount.test.ts +26 -0
  186. package/src/actions/test/impersonateAccount.ts +17 -0
  187. package/src/actions/test/increaseTime.test.ts +18 -0
  188. package/src/actions/test/increaseTime.ts +17 -0
  189. package/src/actions/test/index.test.ts +38 -0
  190. package/src/actions/test/index.ts +77 -0
  191. package/src/actions/test/inspectTxpool.test.ts +50 -0
  192. package/src/actions/test/inspectTxpool.ts +7 -0
  193. package/src/actions/test/mine.test.ts +20 -0
  194. package/src/actions/test/mine.ts +16 -0
  195. package/src/actions/test/removeBlockTimestampInterval.test.ts +23 -0
  196. package/src/actions/test/removeBlockTimestampInterval.ts +7 -0
  197. package/src/actions/test/reset.test.ts +19 -0
  198. package/src/actions/test/reset.ts +18 -0
  199. package/src/actions/test/revert.test.ts +39 -0
  200. package/src/actions/test/revert.ts +14 -0
  201. package/src/actions/test/sendUnsignedTransaction.test.ts +52 -0
  202. package/src/actions/test/sendUnsignedTransaction.ts +19 -0
  203. package/src/actions/test/setAutomine.test.ts +14 -0
  204. package/src/actions/test/setAutomine.ts +8 -0
  205. package/src/actions/test/setBalance.test.ts +29 -0
  206. package/src/actions/test/setBalance.ts +20 -0
  207. package/src/actions/test/setBlockGasLimit.test.ts +21 -0
  208. package/src/actions/test/setBlockGasLimit.ts +17 -0
  209. package/src/actions/test/setBlockTimestampInterval.test.ts +23 -0
  210. package/src/actions/test/setBlockTimestampInterval.ts +16 -0
  211. package/src/actions/test/setCode.test.ts +26 -0
  212. package/src/actions/test/setCode.ts +19 -0
  213. package/src/actions/test/setCoinbase.test.ts +11 -0
  214. package/src/actions/test/setCoinbase.ts +17 -0
  215. package/src/actions/test/setIntervalMining.test.ts +30 -0
  216. package/src/actions/test/setIntervalMining.ts +16 -0
  217. package/src/actions/test/setLoggingEnabled.test.ts +10 -0
  218. package/src/actions/test/setLoggingEnabled.ts +8 -0
  219. package/src/actions/test/setMinGasPrice.test.ts +22 -0
  220. package/src/actions/test/setMinGasPrice.ts +17 -0
  221. package/src/actions/test/setNextBlockBaseFeePerGas.test.ts +23 -0
  222. package/src/actions/test/setNextBlockBaseFeePerGas.ts +17 -0
  223. package/src/actions/test/setNextBlockTimestamp.test.ts +19 -0
  224. package/src/actions/test/setNextBlockTimestamp.ts +17 -0
  225. package/src/actions/test/setNonce.test.ts +28 -0
  226. package/src/actions/test/setNonce.ts +20 -0
  227. package/src/actions/test/setRpcUrl.test.ts +9 -0
  228. package/src/actions/test/setRpcUrl.ts +8 -0
  229. package/src/actions/test/setStorageAt.test.ts +36 -0
  230. package/src/actions/test/setStorageAt.ts +26 -0
  231. package/src/actions/test/snapshot.test.ts +18 -0
  232. package/src/actions/test/snapshot.ts +7 -0
  233. package/src/actions/test/stopImpersonatingAccount.test.ts +29 -0
  234. package/src/actions/test/stopImpersonatingAccount.ts +17 -0
  235. package/src/actions/wallet/addChain.test.ts +14 -0
  236. package/src/actions/wallet/addChain.ts +21 -0
  237. package/src/actions/wallet/deployContract.test.ts +55 -0
  238. package/src/actions/wallet/deployContract.ts +38 -0
  239. package/src/actions/wallet/getAccounts.test.ts +22 -0
  240. package/src/actions/wallet/getAccounts.ts +7 -0
  241. package/src/actions/wallet/getPermissions.test.ts +24 -0
  242. package/src/actions/wallet/getPermissions.ts +9 -0
  243. package/src/actions/wallet/index.test.ts +21 -0
  244. package/src/actions/wallet/index.ts +36 -0
  245. package/src/actions/wallet/requestAccounts.test.ts +13 -0
  246. package/src/actions/wallet/requestAccounts.ts +7 -0
  247. package/src/actions/wallet/requestPermissions.test.ts +26 -0
  248. package/src/actions/wallet/requestPermissions.ts +19 -0
  249. package/src/actions/wallet/sendTransaction.bench.ts +57 -0
  250. package/src/actions/wallet/sendTransaction.test.ts +440 -0
  251. package/src/actions/wallet/sendTransaction.ts +77 -0
  252. package/src/actions/wallet/signMessage.test.ts +61 -0
  253. package/src/actions/wallet/signMessage.ts +35 -0
  254. package/src/actions/wallet/switchChain.test.ts +21 -0
  255. package/src/actions/wallet/switchChain.ts +19 -0
  256. package/src/actions/wallet/watchAsset.test.ts +40 -0
  257. package/src/actions/wallet/watchAsset.ts +16 -0
  258. package/src/actions/wallet/writeContract.test.ts +84 -0
  259. package/src/actions/wallet/writeContract.ts +47 -0
  260. package/src/chains.test.ts +439 -0
  261. package/src/chains.ts +99 -0
  262. package/src/clients/createClient.test.ts +295 -0
  263. package/src/clients/createClient.ts +81 -0
  264. package/src/clients/createPublicClient.test.ts +165 -0
  265. package/src/clients/createPublicClient.ts +49 -0
  266. package/src/clients/createTestClient.test.ts +145 -0
  267. package/src/clients/createTestClient.ts +72 -0
  268. package/src/clients/createWalletClient.test.ts +121 -0
  269. package/src/clients/createWalletClient.ts +54 -0
  270. package/src/clients/index.test.ts +19 -0
  271. package/src/clients/index.ts +31 -0
  272. package/src/clients/transports/createTransport.test.ts +58 -0
  273. package/src/clients/transports/createTransport.ts +48 -0
  274. package/src/clients/transports/custom.test.ts +98 -0
  275. package/src/clients/transports/custom.ts +34 -0
  276. package/src/clients/transports/fallback.test.ts +393 -0
  277. package/src/clients/transports/fallback.ts +58 -0
  278. package/src/clients/transports/http.test.ts +109 -0
  279. package/src/clients/transports/http.ts +51 -0
  280. package/src/clients/transports/index.test.ts +15 -0
  281. package/src/clients/transports/index.ts +17 -0
  282. package/src/clients/transports/webSocket.test.ts +164 -0
  283. package/src/clients/transports/webSocket.ts +118 -0
  284. package/src/constants/abis.test.ts +53 -0
  285. package/src/constants/abis.ts +44 -0
  286. package/src/constants/index.test.ts +14 -0
  287. package/src/constants/index.ts +3 -0
  288. package/src/constants/solidity.test.ts +41 -0
  289. package/src/constants/solidity.ts +35 -0
  290. package/src/contract.test.ts +32 -0
  291. package/src/contract.ts +68 -0
  292. package/src/ens.test.ts +15 -0
  293. package/src/ens.ts +8 -0
  294. package/src/errors/abi.test.ts +81 -0
  295. package/src/errors/abi.ts +254 -0
  296. package/src/errors/address.test.ts +14 -0
  297. package/src/errors/address.ts +9 -0
  298. package/src/errors/base.test.ts +114 -0
  299. package/src/errors/base.ts +57 -0
  300. package/src/errors/block.test.ts +24 -0
  301. package/src/errors/block.ts +18 -0
  302. package/src/errors/chain.test.ts +46 -0
  303. package/src/errors/chain.ts +33 -0
  304. package/src/errors/contract.test.ts +233 -0
  305. package/src/errors/contract.ts +178 -0
  306. package/src/errors/data.ts +20 -0
  307. package/src/errors/encoding.ts +60 -0
  308. package/src/errors/index.ts +82 -0
  309. package/src/errors/log.ts +8 -0
  310. package/src/errors/request.test.ts +330 -0
  311. package/src/errors/request.ts +163 -0
  312. package/src/errors/rpc.test.ts +87 -0
  313. package/src/errors/rpc.ts +113 -0
  314. package/src/errors/transaction.test.ts +83 -0
  315. package/src/errors/transaction.ts +54 -0
  316. package/src/errors/transport.test.ts +11 -0
  317. package/src/errors/transport.ts +12 -0
  318. package/src/index.test.ts +116 -0
  319. package/src/index.ts +132 -0
  320. package/src/public.test.ts +36 -0
  321. package/src/public.ts +76 -0
  322. package/src/test.test.ts +38 -0
  323. package/src/test.ts +52 -0
  324. package/src/types/block.ts +71 -0
  325. package/src/types/chain.ts +6 -0
  326. package/src/types/contract.ts +497 -0
  327. package/src/types/eip1193.ts +1041 -0
  328. package/src/types/fee.ts +47 -0
  329. package/src/types/filter.ts +8 -0
  330. package/src/types/formatter.ts +23 -0
  331. package/src/types/index.ts +84 -0
  332. package/src/types/log.ts +22 -0
  333. package/src/types/misc.ts +5 -0
  334. package/src/types/multicall.ts +82 -0
  335. package/src/types/rpc.ts +35 -0
  336. package/src/types/transaction.ts +145 -0
  337. package/src/types/utils.ts +88 -0
  338. package/src/types/window.ts +9 -0
  339. package/src/utils/abi/decodeAbi.bench.ts +135 -0
  340. package/src/utils/abi/decodeAbi.test.ts +1614 -0
  341. package/src/utils/abi/decodeAbi.ts +300 -0
  342. package/src/utils/abi/decodeDeployData.test.ts +151 -0
  343. package/src/utils/abi/decodeDeployData.ts +44 -0
  344. package/src/utils/abi/decodeErrorResult.test.ts +230 -0
  345. package/src/utils/abi/decodeErrorResult.ts +45 -0
  346. package/src/utils/abi/decodeEventLog.test.ts +542 -0
  347. package/src/utils/abi/decodeEventLog.ts +107 -0
  348. package/src/utils/abi/decodeFunctionData.test.ts +138 -0
  349. package/src/utils/abi/decodeFunctionData.ts +32 -0
  350. package/src/utils/abi/decodeFunctionResult.test.ts +333 -0
  351. package/src/utils/abi/decodeFunctionResult.ts +57 -0
  352. package/src/utils/abi/encodeAbi.bench.ts +163 -0
  353. package/src/utils/abi/encodeAbi.test.ts +1447 -0
  354. package/src/utils/abi/encodeAbi.ts +273 -0
  355. package/src/utils/abi/encodeDeployData.test.ts +124 -0
  356. package/src/utils/abi/encodeDeployData.ts +40 -0
  357. package/src/utils/abi/encodeErrorResult.test.ts +192 -0
  358. package/src/utils/abi/encodeErrorResult.ts +47 -0
  359. package/src/utils/abi/encodeEventTopics.test.ts +345 -0
  360. package/src/utils/abi/encodeEventTopics.ts +75 -0
  361. package/src/utils/abi/encodeFunctionData.test.ts +138 -0
  362. package/src/utils/abi/encodeFunctionData.ts +42 -0
  363. package/src/utils/abi/encodeFunctionResult.test.ts +279 -0
  364. package/src/utils/abi/encodeFunctionResult.ts +41 -0
  365. package/src/utils/abi/formatAbiItem.test.ts +335 -0
  366. package/src/utils/abi/formatAbiItem.ts +41 -0
  367. package/src/utils/abi/formatAbiItemWithArgs.test.ts +291 -0
  368. package/src/utils/abi/formatAbiItemWithArgs.ts +27 -0
  369. package/src/utils/abi/getAbiItem.test.ts +547 -0
  370. package/src/utils/abi/getAbiItem.ts +95 -0
  371. package/src/utils/abi/index.test.ts +24 -0
  372. package/src/utils/abi/index.ts +48 -0
  373. package/src/utils/address/getAddress.bench.ts +22 -0
  374. package/src/utils/address/getAddress.test.ts +46 -0
  375. package/src/utils/address/getAddress.ts +28 -0
  376. package/src/utils/address/getContractAddress.bench.ts +20 -0
  377. package/src/utils/address/getContractAddress.test.ts +78 -0
  378. package/src/utils/address/getContractAddress.ts +59 -0
  379. package/src/utils/address/index.test.ts +17 -0
  380. package/src/utils/address/index.ts +16 -0
  381. package/src/utils/address/isAddress.test.ts +10 -0
  382. package/src/utils/address/isAddress.ts +10 -0
  383. package/src/utils/address/isAddressEqual.test.ts +55 -0
  384. package/src/utils/address/isAddressEqual.ts +6 -0
  385. package/src/utils/buildRequest.test.ts +428 -0
  386. package/src/utils/buildRequest.ts +72 -0
  387. package/src/utils/chain.test.ts +43 -0
  388. package/src/utils/chain.ts +8 -0
  389. package/src/utils/contract/extractFunctionParts.test.ts +109 -0
  390. package/src/utils/contract/extractFunctionParts.ts +27 -0
  391. package/src/utils/contract/getContractError.test.ts +282 -0
  392. package/src/utils/contract/getContractError.ts +58 -0
  393. package/src/utils/contract/index.test.ts +15 -0
  394. package/src/utils/contract/index.ts +8 -0
  395. package/src/utils/data/concat.test.ts +35 -0
  396. package/src/utils/data/concat.ts +34 -0
  397. package/src/utils/data/index.test.ts +23 -0
  398. package/src/utils/data/index.ts +13 -0
  399. package/src/utils/data/isBytes.test.ts +9 -0
  400. package/src/utils/data/isBytes.ts +7 -0
  401. package/src/utils/data/isHex.test.ts +13 -0
  402. package/src/utils/data/isHex.ts +5 -0
  403. package/src/utils/data/pad.bench.ts +30 -0
  404. package/src/utils/data/pad.test.ts +367 -0
  405. package/src/utils/data/pad.ts +53 -0
  406. package/src/utils/data/size.test.ts +18 -0
  407. package/src/utils/data/size.ts +13 -0
  408. package/src/utils/data/slice.test.ts +203 -0
  409. package/src/utils/data/slice.ts +60 -0
  410. package/src/utils/data/trim.bench.ts +34 -0
  411. package/src/utils/data/trim.test.ts +175 -0
  412. package/src/utils/data/trim.ts +33 -0
  413. package/src/utils/encoding/decodeBytes.bench.ts +40 -0
  414. package/src/utils/encoding/decodeBytes.test.ts +144 -0
  415. package/src/utils/encoding/decodeBytes.ts +63 -0
  416. package/src/utils/encoding/decodeHex.bench.ts +24 -0
  417. package/src/utils/encoding/decodeHex.test.ts +167 -0
  418. package/src/utils/encoding/decodeHex.ts +76 -0
  419. package/src/utils/encoding/decodeRlp.bench.ts +34 -0
  420. package/src/utils/encoding/decodeRlp.test.ts +350 -0
  421. package/src/utils/encoding/decodeRlp.ts +121 -0
  422. package/src/utils/encoding/encodeBytes.bench.ts +29 -0
  423. package/src/utils/encoding/encodeBytes.test.ts +676 -0
  424. package/src/utils/encoding/encodeBytes.ts +59 -0
  425. package/src/utils/encoding/encodeHex.bench.ts +49 -0
  426. package/src/utils/encoding/encodeHex.test.ts +232 -0
  427. package/src/utils/encoding/encodeHex.ts +104 -0
  428. package/src/utils/encoding/encodeRlp.bench.ts +54 -0
  429. package/src/utils/encoding/encodeRlp.test.ts +254 -0
  430. package/src/utils/encoding/encodeRlp.ts +48 -0
  431. package/src/utils/encoding/index.test.ts +32 -0
  432. package/src/utils/encoding/index.ts +36 -0
  433. package/src/utils/ens/index.test.ts +14 -0
  434. package/src/utils/ens/index.ts +7 -0
  435. package/src/utils/ens/labelhash.test.ts +55 -0
  436. package/src/utils/ens/labelhash.ts +16 -0
  437. package/src/utils/ens/namehash.test.ts +65 -0
  438. package/src/utils/ens/namehash.ts +28 -0
  439. package/src/utils/ens/normalize.bench.ts +14 -0
  440. package/src/utils/ens/normalize.test.ts +35 -0
  441. package/src/utils/ens/normalize.ts +14 -0
  442. package/src/utils/ens/packetToBytes.test.ts +11 -0
  443. package/src/utils/ens/packetToBytes.ts +29 -0
  444. package/src/utils/formatters/block.bench.ts +51 -0
  445. package/src/utils/formatters/block.test.ts +115 -0
  446. package/src/utils/formatters/block.ts +37 -0
  447. package/src/utils/formatters/extract.test.ts +14 -0
  448. package/src/utils/formatters/extract.ts +18 -0
  449. package/src/utils/formatters/feeHistory.test.ts +66 -0
  450. package/src/utils/formatters/feeHistory.ts +12 -0
  451. package/src/utils/formatters/format.test.ts +93 -0
  452. package/src/utils/formatters/format.ts +90 -0
  453. package/src/utils/formatters/index.test.ts +27 -0
  454. package/src/utils/formatters/index.ts +34 -0
  455. package/src/utils/formatters/log.test.ts +79 -0
  456. package/src/utils/formatters/log.ts +12 -0
  457. package/src/utils/formatters/transaction.test.ts +271 -0
  458. package/src/utils/formatters/transaction.ts +63 -0
  459. package/src/utils/formatters/transactionReceipt.bench.ts +73 -0
  460. package/src/utils/formatters/transactionReceipt.test.ts +151 -0
  461. package/src/utils/formatters/transactionReceipt.ts +63 -0
  462. package/src/utils/formatters/transactionRequest.bench.ts +29 -0
  463. package/src/utils/formatters/transactionRequest.test.ts +237 -0
  464. package/src/utils/formatters/transactionRequest.ts +56 -0
  465. package/src/utils/hash/getEventSignature.test.ts +61 -0
  466. package/src/utils/hash/getEventSignature.ts +4 -0
  467. package/src/utils/hash/getFunctionSignature.test.ts +22 -0
  468. package/src/utils/hash/getFunctionSignature.ts +5 -0
  469. package/src/utils/hash/hashFunction.test.ts +65 -0
  470. package/src/utils/hash/hashFunction.ts +12 -0
  471. package/src/utils/hash/index.test.ts +13 -0
  472. package/src/utils/hash/index.ts +5 -0
  473. package/src/utils/hash/keccak256.test.ts +59 -0
  474. package/src/utils/hash/keccak256.ts +21 -0
  475. package/src/utils/index.test.ts +111 -0
  476. package/src/utils/index.ts +142 -0
  477. package/src/utils/observe.test.ts +176 -0
  478. package/src/utils/observe.ts +66 -0
  479. package/src/utils/poll.test.ts +127 -0
  480. package/src/utils/poll.ts +42 -0
  481. package/src/utils/promise/index.test.ts +14 -0
  482. package/src/utils/promise/index.ts +3 -0
  483. package/src/utils/promise/withCache.test.ts +97 -0
  484. package/src/utils/promise/withCache.ts +73 -0
  485. package/src/utils/promise/withRetry.test.ts +231 -0
  486. package/src/utils/promise/withRetry.ts +61 -0
  487. package/src/utils/promise/withTimeout.test.ts +37 -0
  488. package/src/utils/promise/withTimeout.ts +39 -0
  489. package/src/utils/rpc.test.ts +990 -0
  490. package/src/utils/rpc.ts +294 -0
  491. package/src/utils/stringify.test.ts +13 -0
  492. package/src/utils/stringify.ts +5 -0
  493. package/src/utils/uid.ts +14 -0
  494. package/src/utils/unit/constants.test.ts +22 -0
  495. package/src/utils/unit/constants.ts +12 -0
  496. package/src/utils/unit/formatEther.test.ts +75 -0
  497. package/src/utils/unit/formatEther.ts +6 -0
  498. package/src/utils/unit/formatGwei.test.ts +32 -0
  499. package/src/utils/unit/formatGwei.ts +6 -0
  500. package/src/utils/unit/formatUnit.bench.ts +21 -0
  501. package/src/utils/unit/formatUnit.test.ts +40 -0
  502. package/src/utils/unit/formatUnit.ts +16 -0
  503. package/src/utils/unit/index.test.ts +28 -0
  504. package/src/utils/unit/index.ts +7 -0
  505. package/src/utils/unit/parseEther.test.ts +126 -0
  506. package/src/utils/unit/parseEther.ts +6 -0
  507. package/src/utils/unit/parseGwei.test.ts +50 -0
  508. package/src/utils/unit/parseGwei.ts +6 -0
  509. package/src/utils/unit/parseUnit.bench.ts +21 -0
  510. package/src/utils/unit/parseUnit.test.ts +54 -0
  511. package/src/utils/unit/parseUnit.ts +27 -0
  512. package/src/utils/wait.ts +3 -0
  513. package/src/wallet.test.ts +19 -0
  514. package/src/wallet.ts +23 -0
  515. package/src/window.ts +1 -0
  516. package/wallet/package.json +4 -0
  517. package/actions/package.json +0 -4
  518. package/clients/package.json +0 -4
  519. package/dist/actions/index.d.ts +0 -8
  520. package/dist/actions/index.js +0 -125
  521. package/dist/actions/index.mjs +0 -125
  522. package/dist/chunk-CWCWWGBC.mjs +0 -258
  523. package/dist/chunk-SGTIBKHG.js +0 -258
  524. package/dist/clients/index.d.ts +0 -7
  525. package/dist/clients/index.js +0 -23
  526. package/dist/clients/index.mjs +0 -23
  527. package/dist/createWalletClient-d612fe08.d.ts +0 -130
  528. package/dist/parseGwei-7c87ff41.d.ts +0 -278
  529. package/dist/rpc-26932bae.d.ts +0 -61
  530. package/dist/transactionRequest-08d30731.d.ts +0 -132
  531. package/dist/watchAsset-bc6373f4.d.ts +0 -534
  532. package/dist/webSocket-7f88e9e0.d.ts +0 -83
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var __defProp = Object.defineProperty;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -8,8 +8,8 @@ var __publicField = (obj, key, value) => {
8
8
  // package.json
9
9
  var package_default = {
10
10
  name: "viem",
11
- description: "TypeScript (& JavaScript) Interface for Ethereum",
12
- version: "0.0.1-alpha.9",
11
+ description: "TypeScript Interface for Ethereum",
12
+ version: "0.0.1-alpha.25",
13
13
  scripts: {
14
14
  anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
15
15
  bench: "vitest bench --no-threads",
@@ -18,28 +18,32 @@ var package_default = {
18
18
  changeset: "changeset",
19
19
  "changeset:release": "pnpm build && changeset publish",
20
20
  "changeset:version": "changeset version && pnpm install --lockfile-only",
21
+ "contracts:build": "wagmi generate",
21
22
  dev: "DEV=true tsup",
22
23
  "dev:docs": "pnpm -r --filter site dev",
23
24
  format: "rome format src/ test/ --write",
24
25
  lint: "rome check .",
25
26
  "lint:fix": "pnpm lint --apply-suggested",
26
27
  playground: "pnpm --filter playground-dev dev",
27
- "playground:benchmark": "pnpm --filter playground-benchmark dev",
28
- postinstall: "pnpm dev",
28
+ postinstall: "pnpm dev && pnpm contracts:build",
29
29
  preinstall: "npx only-allow pnpm",
30
+ prepublishOnly: "pnpm ts-node scripts/generate-package-json.ts",
30
31
  prepare: "npx simple-git-hooks",
31
- test: "vitest dev --coverage --no-threads",
32
+ test: "vitest dev --no-threads",
32
33
  "test:ci": "CI=true vitest --coverage --no-threads",
33
34
  "test:ui": "vitest dev --ui --no-threads",
35
+ "ts-node": "node --loader esbuild-register/loader -r esbuild-register",
34
36
  typecheck: "tsc --noEmit"
35
37
  },
36
38
  files: [
37
- "/actions",
38
39
  "/chains",
40
+ "/contract",
39
41
  "/dist",
40
- "/clients",
42
+ "/ens",
43
+ "/src",
41
44
  "/types",
42
45
  "/utils",
46
+ "/wallet",
43
47
  "/window"
44
48
  ],
45
49
  exports: {
@@ -48,26 +52,41 @@ var package_default = {
48
52
  module: "./dist/index.mjs",
49
53
  default: "./dist/index.js"
50
54
  },
51
- "./actions": {
52
- types: "./dist/actions/index.d.ts",
53
- module: "./dist/actions/index.mjs",
54
- default: "./dist/actions/index.js"
55
- },
56
55
  "./chains": {
57
56
  types: "./dist/chains.d.ts",
58
57
  module: "./dist/chains.mjs",
59
58
  default: "./dist/chains.js"
60
59
  },
61
- "./clients": {
62
- types: "./dist/clients/index.d.ts",
63
- module: "./dist/clients/index.mjs",
64
- default: "./dist/clients/index.js"
60
+ "./contract": {
61
+ types: "./dist/contract.d.ts",
62
+ module: "./dist/contract.mjs",
63
+ default: "./dist/contract.js"
64
+ },
65
+ "./ens": {
66
+ types: "./dist/ens.d.ts",
67
+ module: "./dist/ens.mjs",
68
+ default: "./dist/ens.js"
69
+ },
70
+ "./public": {
71
+ types: "./dist/public.d.ts",
72
+ module: "./dist/public.mjs",
73
+ default: "./dist/public.js"
74
+ },
75
+ "./test": {
76
+ types: "./dist/test.d.ts",
77
+ module: "./dist/test.mjs",
78
+ default: "./dist/test.js"
65
79
  },
66
80
  "./utils": {
67
81
  types: "./dist/utils/index.d.ts",
68
82
  module: "./dist/utils/index.mjs",
69
83
  default: "./dist/utils/index.js"
70
84
  },
85
+ "./wallet": {
86
+ types: "./dist/wallet.d.ts",
87
+ module: "./dist/wallet.mjs",
88
+ default: "./dist/wallet.js"
89
+ },
71
90
  "./window": {
72
91
  types: "./dist/window.d.ts",
73
92
  module: "./dist/window.mjs",
@@ -81,35 +100,40 @@ var package_default = {
81
100
  sideEffects: false,
82
101
  dependencies: {
83
102
  "@noble/hashes": "^1.1.2",
84
- "@wagmi/chains": "^0.1.0",
85
- abitype: "^0.2.5"
103
+ "@wagmi/chains": "~0.2.8",
104
+ abitype: "~0.3.0",
105
+ "idna-uts46-hx": "^4.1.2",
106
+ "isomorphic-unfetch": "^4.0.2",
107
+ "isomorphic-ws": "^5.0.0",
108
+ ws: "^8.12.0"
86
109
  },
87
110
  devDependencies: {
88
111
  "@actions/core": "^1.10.0",
89
112
  "@actions/github": "^5.1.1",
113
+ "@adraffy/ens-normalize": "^1.8.9",
90
114
  "@changesets/changelog-github": "^0.4.5",
91
115
  "@changesets/cli": "^2.23.2",
92
- "@testing-library/jest-dom": "^5.16.5",
93
116
  "@types/dedent": "^0.7.0",
94
117
  "@types/fs-extra": "^9.0.13",
95
118
  "@types/node": "^17.0.45",
119
+ "@types/ws": "^8.5.4",
96
120
  "@vitest/coverage-c8": "^0.24.3",
97
121
  "@vitest/ui": "^0.19.1",
122
+ "@wagmi/cli": "^0.1.6",
98
123
  bundlewatch: "^0.3.3",
99
124
  dedent: "^0.7.0",
100
- esbuild: "^0.16.12",
125
+ esbuild: "^0.16.17",
101
126
  "esbuild-register": "^3.4.2",
102
- "essential-eth": "^0.6.2",
103
127
  ethers: "^5.7.2",
128
+ "ethers@6": "npm:ethers@^6.0.2",
104
129
  execa: "^6.1.0",
105
130
  "fs-extra": "^10.1.0",
106
- jsdom: "^20.0.0",
107
131
  rome: "^11.0.0",
108
132
  "simple-git-hooks": "^2.8.1",
109
- tsup: "^6.5.0",
110
- typescript: "^4.9.3",
111
- vite: "^3.0.4",
112
- vitest: "^0.25.2",
133
+ tsup: "^6.6.0",
134
+ typescript: "^4.9.4",
135
+ vite: "^3.2.5",
136
+ vitest: "^0.25.8",
113
137
  web3: "^1.8.1"
114
138
  },
115
139
  license: "MIT",
@@ -135,38 +159,32 @@ var package_default = {
135
159
  }
136
160
  };
137
161
 
138
- // src/utils/stringify.ts
139
- function stringify(value) {
140
- return JSON.stringify(
141
- value,
142
- (_, value2) => typeof value2 === "bigint" ? value2.toString() : value2
143
- );
144
- }
145
-
146
162
  // src/errors/base.ts
147
163
  var version = process.env.TEST ? "1.0.2" : package_default.version;
148
164
  var BaseError = class extends Error {
149
- constructor(humanMessage, args = {}) {
165
+ constructor(shortMessage, args = {}) {
150
166
  const details = args.cause instanceof BaseError ? args.cause.details : _optionalChain([args, 'access', _2 => _2.cause, 'optionalAccess', _3 => _3.message]) ? args.cause.message : args.details;
151
167
  const docsPath5 = args.cause instanceof BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
152
168
  const message = [
153
- humanMessage,
154
- ...docsPath5 ? ["", `Docs: https://viem.sh${docsPath5}`] : [],
169
+ shortMessage || "An error occurred.",
155
170
  "",
171
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
172
+ ...docsPath5 ? [`Docs: https://viem.sh${docsPath5}`] : [],
156
173
  ...details ? [`Details: ${details}`] : [],
157
- `Version: viem@${version}`,
158
- ...args.cause && !(args.cause instanceof BaseError) && Object.keys(args.cause).length > 0 ? [`Internal Error: ${stringify(args.cause)}`] : []
174
+ `Version: viem@${version}`
159
175
  ].join("\n");
160
176
  super(message);
161
- __publicField(this, "humanMessage");
162
177
  __publicField(this, "details");
163
178
  __publicField(this, "docsPath");
179
+ __publicField(this, "metaMessages");
180
+ __publicField(this, "shortMessage");
164
181
  __publicField(this, "name", "ViemError");
165
182
  if (args.cause)
166
183
  this.cause = args.cause;
167
184
  this.details = details;
168
185
  this.docsPath = docsPath5;
169
- this.humanMessage = humanMessage;
186
+ this.metaMessages = args.metaMessages;
187
+ this.shortMessage = shortMessage;
170
188
  }
171
189
  };
172
190
 
@@ -282,7 +300,7 @@ var AbiErrorSignatureNotFoundError = class extends BaseError {
282
300
  [
283
301
  `Encoded error signature "${signature}" not found on ABI.`,
284
302
  "Make sure you are using the correct ABI and that the error exists on it.",
285
- `You can look up the signature "${signature}" here: https://sig.eth.samczsun.com/.`
303
+ `You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`
286
304
  ].join("\n"),
287
305
  {
288
306
  docsPath: docsPath5
@@ -291,6 +309,21 @@ var AbiErrorSignatureNotFoundError = class extends BaseError {
291
309
  __publicField(this, "name", "AbiErrorSignatureNotFoundError");
292
310
  }
293
311
  };
312
+ var AbiEventSignatureNotFoundError = class extends BaseError {
313
+ constructor(signature, { docsPath: docsPath5 }) {
314
+ super(
315
+ [
316
+ `Encoded event signature "${signature}" not found on ABI.`,
317
+ "Make sure you are using the correct ABI and that the event exists on it.",
318
+ `You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`
319
+ ].join("\n"),
320
+ {
321
+ docsPath: docsPath5
322
+ }
323
+ );
324
+ __publicField(this, "name", "AbiEventSignatureNotFoundError");
325
+ }
326
+ };
294
327
  var AbiEventNotFoundError = class extends BaseError {
295
328
  constructor(eventName, { docsPath: docsPath5 }) {
296
329
  super(
@@ -340,7 +373,7 @@ var AbiFunctionSignatureNotFoundError = class extends BaseError {
340
373
  [
341
374
  `Encoded function signature "${signature}" not found on ABI.`,
342
375
  "Make sure you are using the correct ABI and that the function exists on it.",
343
- `You can look up the signature "${signature}" here: https://sig.eth.samczsun.com/.`
376
+ `You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`
344
377
  ].join("\n"),
345
378
  {
346
379
  docsPath: docsPath5
@@ -415,82 +448,226 @@ var BlockNotFoundError = class extends BaseError {
415
448
  }
416
449
  };
417
450
 
451
+ // src/errors/chain.ts
452
+ var ChainDoesNotSupportContract = class extends BaseError {
453
+ constructor({
454
+ blockNumber,
455
+ chain,
456
+ contract
457
+ }) {
458
+ super(
459
+ `Chain "${chain.name}" does not support contract "${contract.name}".`,
460
+ {
461
+ metaMessages: [
462
+ "This could be due to any of the following:",
463
+ ...blockNumber && contract.blockCreated && contract.blockCreated > blockNumber ? [
464
+ `- The contract "${contract.name}" was not deployed until block ${contract.blockCreated} (current block ${blockNumber}).`
465
+ ] : [
466
+ `- The chain does not have the contract "${contract.name}" configured.`
467
+ ]
468
+ ]
469
+ }
470
+ );
471
+ __publicField(this, "name", "ChainDoesNotSupportContract");
472
+ }
473
+ };
474
+
475
+ // src/constants/abis.ts
476
+ var multicall3Abi = [
477
+ {
478
+ inputs: [
479
+ {
480
+ components: [
481
+ {
482
+ name: "target",
483
+ type: "address"
484
+ },
485
+ {
486
+ name: "allowFailure",
487
+ type: "bool"
488
+ },
489
+ {
490
+ name: "callData",
491
+ type: "bytes"
492
+ }
493
+ ],
494
+ name: "calls",
495
+ type: "tuple[]"
496
+ }
497
+ ],
498
+ name: "aggregate3",
499
+ outputs: [
500
+ {
501
+ components: [
502
+ {
503
+ name: "success",
504
+ type: "bool"
505
+ },
506
+ {
507
+ name: "returnData",
508
+ type: "bytes"
509
+ }
510
+ ],
511
+ name: "returnData",
512
+ type: "tuple[]"
513
+ }
514
+ ],
515
+ stateMutability: "view",
516
+ type: "function"
517
+ }
518
+ ];
519
+
520
+ // src/constants/solidity.ts
521
+ var panicReasons = {
522
+ 1: "An `assert` condition failed.",
523
+ 17: "Arithmic operation resulted in underflow or overflow.",
524
+ 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
525
+ 33: "Attempted to convert to an invalid type.",
526
+ 34: "Attempted to access a storage byte array that is incorrectly encoded.",
527
+ 49: "Performed `.pop()` on an empty array",
528
+ 50: "Array index is out of bounds.",
529
+ 65: "Allocated too much memory or created an array which is too large.",
530
+ 81: "Attempted to call a zero-initialized variable of internal function type."
531
+ };
532
+ var solidityError = {
533
+ inputs: [
534
+ {
535
+ name: "message",
536
+ type: "string"
537
+ }
538
+ ],
539
+ name: "Error",
540
+ type: "error"
541
+ };
542
+ var solidityPanic = {
543
+ inputs: [
544
+ {
545
+ name: "reason",
546
+ type: "uint256"
547
+ }
548
+ ],
549
+ name: "Panic",
550
+ type: "error"
551
+ };
552
+
418
553
  // src/errors/contract.ts
419
- var ContractMethodExecutionError = class extends BaseError {
420
- constructor(message, {
554
+ var ContractFunctionExecutionError = class extends BaseError {
555
+ constructor(cause, {
421
556
  abi,
422
557
  args,
423
- cause,
424
558
  contractAddress,
425
- formattedArgs,
559
+ docsPath: docsPath5,
426
560
  functionName,
427
- functionWithParams,
428
561
  sender
429
- } = {}) {
562
+ }) {
563
+ const abiItem = getAbiItem({ abi, args, name: functionName });
564
+ const formattedArgs = abiItem ? formatAbiItemWithArgs({
565
+ abiItem,
566
+ args,
567
+ includeFunctionName: false,
568
+ includeName: false
569
+ }) : void 0;
570
+ const functionWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
430
571
  super(
431
- [
432
- message,
433
- " ",
434
- sender && `Sender: ${sender}`,
435
- contractAddress && `Contract: ${process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
436
- functionWithParams && `Function: ${functionWithParams}`,
437
- formattedArgs && `Arguments: ${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _4 => _4.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`
438
- ].filter(Boolean).join("\n"),
572
+ cause.shortMessage || `An unknown error occurred while executing the contract function "${functionName}".`,
439
573
  {
440
- cause
574
+ cause,
575
+ docsPath: docsPath5,
576
+ metaMessages: [
577
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
578
+ contractAddress && `Contract: ${/* c8 ignore start */
579
+ process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
580
+ functionWithParams && `Function: ${functionWithParams}`,
581
+ formattedArgs && formattedArgs !== "()" && `Arguments: ${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _4 => _4.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`,
582
+ sender && `Sender: ${sender}`
583
+ ].filter(Boolean)
441
584
  }
442
585
  );
443
586
  __publicField(this, "abi");
444
587
  __publicField(this, "args");
588
+ __publicField(this, "cause");
445
589
  __publicField(this, "contractAddress");
446
590
  __publicField(this, "formattedArgs");
447
591
  __publicField(this, "functionName");
448
- __publicField(this, "reason");
449
592
  __publicField(this, "sender");
450
- __publicField(this, "name", "ContractMethodExecutionError");
451
- if (message)
452
- this.reason = message;
593
+ __publicField(this, "name", "ContractFunctionExecutionError");
453
594
  this.abi = abi;
454
595
  this.args = args;
596
+ this.cause = cause;
455
597
  this.contractAddress = contractAddress;
456
598
  this.functionName = functionName;
457
599
  this.sender = sender;
458
600
  }
459
601
  };
460
- var ContractMethodZeroDataError = class extends BaseError {
602
+ var ContractFunctionRevertedError = class extends BaseError {
461
603
  constructor({
462
604
  abi,
463
- args,
464
- cause,
465
- contractAddress,
605
+ data,
466
606
  functionName,
467
- functionWithParams
468
- } = {}) {
607
+ message
608
+ }) {
609
+ let decodedData = void 0;
610
+ let metaMessages;
611
+ let reason;
612
+ if (data && data !== "0x") {
613
+ decodedData = decodeErrorResult({ abi, data });
614
+ const { abiItem, errorName, args: errorArgs } = decodedData;
615
+ if (errorName === "Error") {
616
+ reason = errorArgs[0];
617
+ } else if (errorName === "Panic") {
618
+ const [firstArg] = errorArgs;
619
+ reason = panicReasons[firstArg];
620
+ } else if (errorArgs) {
621
+ const errorWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
622
+ const formattedArgs = abiItem ? formatAbiItemWithArgs({
623
+ abiItem,
624
+ args: errorArgs,
625
+ includeFunctionName: false,
626
+ includeName: false
627
+ }) : void 0;
628
+ metaMessages = [
629
+ errorWithParams ? `Error: ${errorWithParams}` : "",
630
+ formattedArgs && formattedArgs !== "()" ? `Arguments: ${[...Array(_nullishCoalesce(_optionalChain([errorName, 'optionalAccess', _5 => _5.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}` : ""
631
+ ];
632
+ }
633
+ } else if (message)
634
+ reason = message;
469
635
  super(
470
- [
471
- `The contract method "${functionName}" returned no data ("0x"). This could be due to any of the following:`,
472
- `- The contract does not have the function "${functionName}",`,
473
- "- The parameters passed to the contract function may be invalid, or",
474
- "- The address is not a contract.",
475
- " ",
476
- contractAddress && `Contract: ${process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
477
- functionWithParams && `Function: ${functionWithParams}`,
478
- functionWithParams && ` > "0x"`
479
- ].filter(Boolean).join("\n"),
636
+ reason ? [
637
+ `The contract function "${functionName}" reverted with the following reason:`,
638
+ reason
639
+ ].join("\n") : `The contract function "${functionName}" reverted.`,
480
640
  {
481
- cause
641
+ metaMessages
482
642
  }
483
643
  );
484
- __publicField(this, "abi");
485
- __publicField(this, "args");
486
- __publicField(this, "contractAddress");
487
- __publicField(this, "functionName");
488
- __publicField(this, "functionWithParams");
489
- __publicField(this, "name", "ContractMethodZeroDataError");
490
- this.abi = abi;
491
- this.args = args;
492
- this.contractAddress = contractAddress;
493
- this.functionName = functionName;
644
+ __publicField(this, "name", "ContractFunctionRevertedError");
645
+ __publicField(this, "data");
646
+ __publicField(this, "reason");
647
+ this.reason = reason;
648
+ this.data = decodedData;
649
+ }
650
+ };
651
+ var ContractFunctionZeroDataError = class extends BaseError {
652
+ constructor({ functionName }) {
653
+ super(`The contract function "${functionName}" returned no data ("0x").`, {
654
+ metaMessages: [
655
+ "This could be due to any of the following:",
656
+ `- The contract does not have the function "${functionName}",`,
657
+ "- The parameters passed to the contract function may be invalid, or",
658
+ "- The address is not a contract."
659
+ ]
660
+ });
661
+ __publicField(this, "name", "ContractFunctionZeroDataError");
662
+ }
663
+ };
664
+ var RawContractError = class extends BaseError {
665
+ constructor({ data, message }) {
666
+ super(message || "");
667
+ __publicField(this, "code", 3);
668
+ __publicField(this, "name", "RawContractError");
669
+ __publicField(this, "data");
670
+ this.data = data;
494
671
  }
495
672
  };
496
673
 
@@ -568,8 +745,8 @@ var FilterTypeNotSupportedError = class extends BaseError {
568
745
 
569
746
  // src/errors/request.ts
570
747
  var RequestError = class extends BaseError {
571
- constructor(err, { docsPath: docsPath5, humanMessage }) {
572
- super(humanMessage, {
748
+ constructor(err, { docsPath: docsPath5, shortMessage }) {
749
+ super(shortMessage, {
573
750
  cause: err,
574
751
  docsPath: docsPath5
575
752
  });
@@ -577,8 +754,8 @@ var RequestError = class extends BaseError {
577
754
  }
578
755
  };
579
756
  var RpcRequestError = class extends RequestError {
580
- constructor(err, { docsPath: docsPath5, humanMessage }) {
581
- super(err, { docsPath: docsPath5, humanMessage });
757
+ constructor(err, { docsPath: docsPath5, shortMessage }) {
758
+ super(err, { docsPath: docsPath5, shortMessage });
582
759
  __publicField(this, "code");
583
760
  this.code = err.code;
584
761
  this.name = err.name;
@@ -587,7 +764,7 @@ var RpcRequestError = class extends RequestError {
587
764
  var ParseRpcError = class extends RpcRequestError {
588
765
  constructor(err) {
589
766
  super(err, {
590
- humanMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
767
+ shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
591
768
  });
592
769
  __publicField(this, "name", "ParseRpcError");
593
770
  __publicField(this, "code", -32700);
@@ -595,7 +772,7 @@ var ParseRpcError = class extends RpcRequestError {
595
772
  };
596
773
  var InvalidRequestRpcError = class extends RpcRequestError {
597
774
  constructor(err) {
598
- super(err, { humanMessage: "JSON is not a valid request object." });
775
+ super(err, { shortMessage: "JSON is not a valid request object." });
599
776
  __publicField(this, "name", "InvalidRequestRpcError");
600
777
  __publicField(this, "code", -32600);
601
778
  }
@@ -603,7 +780,7 @@ var InvalidRequestRpcError = class extends RpcRequestError {
603
780
  var MethodNotFoundRpcError = class extends RpcRequestError {
604
781
  constructor(err) {
605
782
  super(err, {
606
- humanMessage: "The method does not exist / is not available."
783
+ shortMessage: "The method does not exist / is not available."
607
784
  });
608
785
  __publicField(this, "name", "MethodNotFoundRpcError");
609
786
  __publicField(this, "code", -32601);
@@ -612,7 +789,7 @@ var MethodNotFoundRpcError = class extends RpcRequestError {
612
789
  var InvalidParamsRpcError = class extends RpcRequestError {
613
790
  constructor(err) {
614
791
  super(err, {
615
- humanMessage: [
792
+ shortMessage: [
616
793
  "Invalid parameters were provided to the RPC method.",
617
794
  "Double check you have provided the correct parameters."
618
795
  ].join("\n")
@@ -623,7 +800,7 @@ var InvalidParamsRpcError = class extends RpcRequestError {
623
800
  };
624
801
  var InternalRpcError = class extends RpcRequestError {
625
802
  constructor(err) {
626
- super(err, { humanMessage: "An internal error was received." });
803
+ super(err, { shortMessage: "An internal error was received." });
627
804
  __publicField(this, "name", "InternalRpcError");
628
805
  __publicField(this, "code", -32603);
629
806
  }
@@ -631,7 +808,7 @@ var InternalRpcError = class extends RpcRequestError {
631
808
  var InvalidInputRpcError = class extends RpcRequestError {
632
809
  constructor(err) {
633
810
  super(err, {
634
- humanMessage: [
811
+ shortMessage: [
635
812
  "Missing or invalid parameters.",
636
813
  "Double check you have provided the correct parameters."
637
814
  ].join("\n")
@@ -642,35 +819,35 @@ var InvalidInputRpcError = class extends RpcRequestError {
642
819
  };
643
820
  var ResourceNotFoundRpcError = class extends RpcRequestError {
644
821
  constructor(err) {
645
- super(err, { humanMessage: "Requested resource not found." });
822
+ super(err, { shortMessage: "Requested resource not found." });
646
823
  __publicField(this, "name", "ResourceNotFoundRpcError");
647
824
  __publicField(this, "code", -32001);
648
825
  }
649
826
  };
650
827
  var ResourceUnavailableRpcError = class extends RpcRequestError {
651
828
  constructor(err) {
652
- super(err, { humanMessage: "Requested resource not available." });
829
+ super(err, { shortMessage: "Requested resource not available." });
653
830
  __publicField(this, "name", "ResourceUnavailableRpcError");
654
831
  __publicField(this, "code", -32002);
655
832
  }
656
833
  };
657
834
  var TransactionRejectedRpcError = class extends RpcRequestError {
658
835
  constructor(err) {
659
- super(err, { humanMessage: "Transaction creation failed." });
836
+ super(err, { shortMessage: "Transaction creation failed." });
660
837
  __publicField(this, "name", "TransactionRejectedRpcError");
661
838
  __publicField(this, "code", -32003);
662
839
  }
663
840
  };
664
841
  var MethodNotSupportedRpcError = class extends RpcRequestError {
665
842
  constructor(err) {
666
- super(err, { humanMessage: "Method is not implemented." });
843
+ super(err, { shortMessage: "Method is not implemented." });
667
844
  __publicField(this, "name", "MethodNotSupportedRpcError");
668
845
  __publicField(this, "code", -32004);
669
846
  }
670
847
  };
671
848
  var LimitExceededRpcError = class extends RpcRequestError {
672
849
  constructor(err) {
673
- super(err, { humanMessage: "Request exceeds defined limit." });
850
+ super(err, { shortMessage: "Request exceeds defined limit." });
674
851
  __publicField(this, "name", "LimitExceededRpcError");
675
852
  __publicField(this, "code", -32005);
676
853
  }
@@ -678,7 +855,7 @@ var LimitExceededRpcError = class extends RpcRequestError {
678
855
  var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
679
856
  constructor(err) {
680
857
  super(err, {
681
- humanMessage: "Version of JSON-RPC protocol is not supported."
858
+ shortMessage: "Version of JSON-RPC protocol is not supported."
682
859
  });
683
860
  __publicField(this, "name", "JsonRpcVersionUnsupportedError");
684
861
  __publicField(this, "code", -32006);
@@ -687,7 +864,7 @@ var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
687
864
  var UnknownRpcError = class extends RequestError {
688
865
  constructor(err) {
689
866
  super(err, {
690
- humanMessage: "An unknown RPC error occurred."
867
+ shortMessage: "An unknown RPC error occurred."
691
868
  });
692
869
  __publicField(this, "name", "UnknownRpcError");
693
870
  }
@@ -1242,9 +1419,9 @@ function rlpToBytes(bytes, offset = 0) {
1242
1419
  var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
1243
1420
  function extractFunctionParts(def) {
1244
1421
  const parts = def.match(paramsRegex);
1245
- const type = _optionalChain([parts, 'optionalAccess', _5 => _5[2]]) || void 0;
1246
- const name = _optionalChain([parts, 'optionalAccess', _6 => _6[3]]);
1247
- const params = _optionalChain([parts, 'optionalAccess', _7 => _7[5]]) || void 0;
1422
+ const type = _optionalChain([parts, 'optionalAccess', _6 => _6[2]]) || void 0;
1423
+ const name = _optionalChain([parts, 'optionalAccess', _7 => _7[3]]);
1424
+ const params = _optionalChain([parts, 'optionalAccess', _8 => _8[5]]) || void 0;
1248
1425
  return { type, name, params };
1249
1426
  }
1250
1427
  function extractFunctionName(def) {
@@ -1252,8 +1429,8 @@ function extractFunctionName(def) {
1252
1429
  }
1253
1430
  function extractFunctionParams(def) {
1254
1431
  const params = extractFunctionParts(def).params;
1255
- const splitParams = _optionalChain([params, 'optionalAccess', _8 => _8.split, 'call', _9 => _9(","), 'access', _10 => _10.map, 'call', _11 => _11((x) => x.trim().split(" "))]);
1256
- return _optionalChain([splitParams, 'optionalAccess', _12 => _12.map, 'call', _13 => _13((param) => ({
1432
+ const splitParams = _optionalChain([params, 'optionalAccess', _9 => _9.split, 'call', _10 => _10(","), 'access', _11 => _11.map, 'call', _12 => _12((x) => x.trim().split(" "))]);
1433
+ return _optionalChain([splitParams, 'optionalAccess', _13 => _13.map, 'call', _14 => _14((param) => ({
1257
1434
  type: param[0],
1258
1435
  name: param[1] === "indexed" ? param[2] : param[1],
1259
1436
  ...param[1] === "indexed" ? { indexed: true } : {}
@@ -1264,46 +1441,35 @@ function extractFunctionType(def) {
1264
1441
  }
1265
1442
 
1266
1443
  // src/utils/contract/getContractError.ts
1444
+ var EXECUTION_REVERTED_ERROR_CODE = 3;
1267
1445
  function getContractError(err, {
1268
1446
  abi,
1269
1447
  address,
1270
1448
  args,
1449
+ docsPath: docsPath5,
1271
1450
  functionName,
1272
1451
  sender
1273
1452
  }) {
1274
- const { code, message } = err.cause || {};
1275
- const abiItem = getAbiItem({ abi, name: functionName });
1276
- const formattedArgs = abiItem ? formatAbiItemWithArgs({
1277
- abiItem,
1278
- args,
1279
- includeFunctionName: false,
1280
- includeName: false
1281
- }) : void 0;
1282
- const functionWithParams = abiItem ? formatAbiItemWithParams(abiItem, { includeName: true }) : void 0;
1453
+ const { code, data, message } = err instanceof RawContractError ? err : err.cause || {};
1454
+ let cause = err;
1283
1455
  if (err instanceof AbiDecodingZeroDataError) {
1284
- return new ContractMethodZeroDataError({
1285
- abi,
1286
- args,
1287
- cause: err,
1288
- contractAddress: address,
1289
- functionName,
1290
- functionWithParams
1291
- });
1292
- }
1293
- if (code === 3 || _optionalChain([message, 'optionalAccess', _14 => _14.includes, 'call', _15 => _15("execution reverted")])) {
1294
- const message_ = _optionalChain([message, 'optionalAccess', _16 => _16.replace, 'call', _17 => _17("execution reverted: ", "")]);
1295
- return new ContractMethodExecutionError(message_, {
1456
+ cause = new ContractFunctionZeroDataError({ functionName });
1457
+ } else if (code === EXECUTION_REVERTED_ERROR_CODE && (data || message)) {
1458
+ cause = new ContractFunctionRevertedError({
1296
1459
  abi,
1297
- args,
1298
- cause: err,
1299
- contractAddress: address,
1300
- formattedArgs,
1460
+ data,
1301
1461
  functionName,
1302
- functionWithParams,
1303
- sender
1462
+ message
1304
1463
  });
1305
1464
  }
1306
- return err;
1465
+ return new ContractFunctionExecutionError(cause, {
1466
+ abi,
1467
+ args,
1468
+ contractAddress: address,
1469
+ docsPath: docsPath5,
1470
+ functionName,
1471
+ sender
1472
+ });
1307
1473
  }
1308
1474
 
1309
1475
  // src/utils/hash/keccak256.ts
@@ -1339,7 +1505,7 @@ function checksumAddress(address_) {
1339
1505
  const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
1340
1506
  let address = hexAddress.split("");
1341
1507
  for (let i = 0; i < 40; i += 2) {
1342
- if (_optionalChain([hash2, 'optionalAccess', _18 => _18[i >> 1]]) >> 4 >= 8 && address[i]) {
1508
+ if (_optionalChain([hash2, 'optionalAccess', _15 => _15[i >> 1]]) >> 4 >= 8 && address[i]) {
1343
1509
  address[i] = address[i].toUpperCase();
1344
1510
  }
1345
1511
  if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
@@ -1403,16 +1569,16 @@ function isAddressEqual(a, b) {
1403
1569
  }
1404
1570
 
1405
1571
  // src/utils/abi/encodeAbi.ts
1406
- function encodeAbi({
1407
- params,
1408
- values
1409
- }) {
1572
+ function encodeAbi({ params, values }) {
1410
1573
  if (params.length !== values.length)
1411
1574
  throw new AbiEncodingLengthMismatchError({
1412
1575
  expectedLength: params.length,
1413
1576
  givenLength: values.length
1414
1577
  });
1415
- const preparedParams = prepareParams({ params, values });
1578
+ const preparedParams = prepareParams({
1579
+ params,
1580
+ values
1581
+ });
1416
1582
  const data = encodeParams(preparedParams);
1417
1583
  if (data.length === 0)
1418
1584
  return "0x";
@@ -1529,14 +1695,20 @@ function encodeArray(value, {
1529
1695
  }
1530
1696
  function encodeBytes2(value, { param }) {
1531
1697
  const [_, size_] = param.type.split("bytes");
1532
- if (!size_)
1698
+ if (!size_) {
1699
+ const partsLength = Math.floor(size(value) / 32);
1700
+ const parts = [];
1701
+ for (let i = 0; i < partsLength + 1; i++) {
1702
+ parts.push(padHex(slice(value, i * 32, (i + 1) * 32), { dir: "right" }));
1703
+ }
1533
1704
  return {
1534
1705
  dynamic: true,
1535
1706
  encoded: concat([
1536
1707
  padHex(numberToHex(size(value), { size: 32 })),
1537
- padHex(value, { dir: "right" })
1708
+ ...parts
1538
1709
  ])
1539
1710
  };
1711
+ }
1540
1712
  return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
1541
1713
  }
1542
1714
  function encodeBool(value) {
@@ -1580,14 +1752,14 @@ function encodeTuple(value, { param }) {
1580
1752
  }
1581
1753
  function getArrayComponents(type) {
1582
1754
  const matches = type.match(/^(.*)\[(\d+)?\]$/);
1583
- return matches ? [matches[2] ? Number(matches[2]) : null, matches[1]] : void 0;
1755
+ return matches ? (
1756
+ // Return `null` if the array is dynamic.
1757
+ [matches[2] ? Number(matches[2]) : null, matches[1]]
1758
+ ) : void 0;
1584
1759
  }
1585
1760
 
1586
1761
  // src/utils/abi/decodeAbi.ts
1587
- function decodeAbi({
1588
- data,
1589
- params
1590
- }) {
1762
+ function decodeAbi({ data, params }) {
1591
1763
  if (data === "0x" && params.length > 0)
1592
1764
  throw new AbiDecodingZeroDataError();
1593
1765
  if (size(data) % 32 !== 0)
@@ -1677,7 +1849,7 @@ function decodeArray(data, {
1677
1849
  }
1678
1850
  if (hasDynamicChild(param)) {
1679
1851
  const arrayComponents = getArrayComponents(param.type);
1680
- const dynamicChild = !_optionalChain([arrayComponents, 'optionalAccess', _19 => _19[0]]);
1852
+ const dynamicChild = !_optionalChain([arrayComponents, 'optionalAccess', _16 => _16[0]]);
1681
1853
  let consumed2 = 0;
1682
1854
  let value2 = [];
1683
1855
  for (let i = 0; i < length; ++i) {
@@ -1749,7 +1921,7 @@ function decodeTuple(data, { param, position }) {
1749
1921
  position: consumed
1750
1922
  });
1751
1923
  consumed += decodedChild.consumed;
1752
- value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _20 => _20.name])] = decodedChild.value;
1924
+ value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _17 => _17.name])] = decodedChild.value;
1753
1925
  }
1754
1926
  return { consumed: 32, value };
1755
1927
  }
@@ -1761,7 +1933,7 @@ function decodeTuple(data, { param, position }) {
1761
1933
  position: position + consumed
1762
1934
  });
1763
1935
  consumed += decodedChild.consumed;
1764
- value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _21 => _21.name])] = decodedChild.value;
1936
+ value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _18 => _18.name])] = decodedChild.value;
1765
1937
  }
1766
1938
  return { consumed, value };
1767
1939
  }
@@ -1774,15 +1946,15 @@ function hasDynamicChild(param) {
1774
1946
  if (type.endsWith("[]"))
1775
1947
  return true;
1776
1948
  if (type === "tuple")
1777
- return _optionalChain([param, 'access', _22 => _22.components, 'optionalAccess', _23 => _23.some, 'call', _24 => _24(hasDynamicChild)]);
1949
+ return _optionalChain([param, 'access', _19 => _19.components, 'optionalAccess', _20 => _20.some, 'call', _21 => _21(hasDynamicChild)]);
1778
1950
  const arrayComponents = getArrayComponents(param.type);
1779
1951
  if (arrayComponents && hasDynamicChild({ ...param, type: arrayComponents[1] }))
1780
1952
  return true;
1781
1953
  return false;
1782
1954
  }
1783
1955
 
1784
- // src/utils/abi/formatAbiItemWithParams.ts
1785
- function formatAbiItemWithParams(abiItem, { includeName = false } = {}) {
1956
+ // src/utils/abi/formatAbiItem.ts
1957
+ function formatAbiItem(abiItem, { includeName = false } = {}) {
1786
1958
  if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
1787
1959
  throw new InvalidDefinitionTypeError(abiItem.type);
1788
1960
  return `${abiItem.name}(${getParams(abiItem.inputs, { includeName })})`;
@@ -1803,26 +1975,88 @@ function getParam(param, { includeName }) {
1803
1975
  }
1804
1976
 
1805
1977
  // src/utils/abi/decodeErrorResult.ts
1806
- function decodeErrorResult({ abi, data }) {
1978
+ function decodeErrorResult({
1979
+ abi,
1980
+ data
1981
+ }) {
1807
1982
  const signature = slice(data, 0, 4);
1808
- const description = abi.find(
1809
- (x) => signature === getFunctionSignature(formatAbiItemWithParams(x))
1983
+ if (signature === "0x")
1984
+ throw new AbiDecodingZeroDataError();
1985
+ const abi_ = [...abi || [], solidityError, solidityPanic];
1986
+ const abiItem = abi_.find(
1987
+ (x) => x.type === "error" && signature === getFunctionSignature(formatAbiItem(x))
1810
1988
  );
1811
- if (!description)
1989
+ if (!abiItem)
1812
1990
  throw new AbiErrorSignatureNotFoundError(signature, {
1813
1991
  docsPath: "/docs/contract/decodeErrorResult"
1814
1992
  });
1815
1993
  return {
1816
- errorName: description.name,
1817
- args: "inputs" in description && description.inputs && description.inputs.length > 0 ? decodeAbi({ data: slice(data, 4), params: description.inputs }) : void 0
1994
+ abiItem,
1995
+ args: "inputs" in abiItem && abiItem.inputs && abiItem.inputs.length > 0 ? decodeAbi({ data: slice(data, 4), params: abiItem.inputs }) : void 0,
1996
+ errorName: abiItem.name
1818
1997
  };
1819
1998
  }
1820
1999
 
2000
+ // src/utils/abi/decodeEventLog.ts
2001
+ function decodeEventLog({
2002
+ abi,
2003
+ data,
2004
+ topics
2005
+ }) {
2006
+ const [signature, ...argTopics] = topics;
2007
+ const abiItem = abi.find(
2008
+ (x) => signature === getEventSignature(formatAbiItem(x))
2009
+ );
2010
+ if (!(abiItem && "name" in abiItem))
2011
+ throw new AbiEventSignatureNotFoundError(signature, {
2012
+ docsPath: "/docs/contract/decodeEventLog"
2013
+ });
2014
+ const { name, inputs } = abiItem;
2015
+ const isUnnamed = _optionalChain([inputs, 'optionalAccess', _22 => _22.some, 'call', _23 => _23((x) => !("name" in x && x.name))]);
2016
+ let args = isUnnamed ? [] : {};
2017
+ for (let i = 0; i < inputs.length; i++) {
2018
+ const param = inputs[i];
2019
+ const topic = argTopics[i];
2020
+ if (topic === null)
2021
+ args[param.name || i] = null;
2022
+ if (!topic)
2023
+ continue;
2024
+ if (Array.isArray(topic)) {
2025
+ args[param.name || i] = topic.map((t) => decodeTopic({ param, value: t }));
2026
+ } else {
2027
+ args[param.name || i] = decodeTopic({ param, value: topic });
2028
+ }
2029
+ }
2030
+ if (data) {
2031
+ const params = inputs.filter((x) => !("indexed" in x && x.indexed));
2032
+ const decodedData = decodeAbi({ params, data });
2033
+ if (decodedData) {
2034
+ if (isUnnamed)
2035
+ args = [...args, ...decodedData];
2036
+ else {
2037
+ for (let i = 0; i < params.length; i++) {
2038
+ args[params[i].name] = decodedData[i];
2039
+ }
2040
+ }
2041
+ }
2042
+ }
2043
+ return {
2044
+ eventName: name,
2045
+ args: Object.values(args).length > 0 ? args : void 0
2046
+ };
2047
+ }
2048
+ function decodeTopic({ param, value }) {
2049
+ if (param.type === "string" || param.type === "bytes" || param.type === "tuple" || param.type.match(/^(.*)\[(\d+)?\]$/))
2050
+ return value;
2051
+ const decodedArg = decodeAbi({ params: [param], data: value }) || [];
2052
+ return decodedArg[0];
2053
+ }
2054
+
1821
2055
  // src/utils/abi/decodeFunctionData.ts
1822
2056
  function decodeFunctionData({ abi, data }) {
1823
2057
  const signature = slice(data, 0, 4);
1824
2058
  const description = abi.find(
1825
- (x) => signature === getFunctionSignature(formatAbiItemWithParams(x))
2059
+ (x) => signature === getFunctionSignature(formatAbiItem(x))
1826
2060
  );
1827
2061
  if (!description)
1828
2062
  throw new AbiFunctionSignatureNotFoundError(signature, {
@@ -1834,16 +2068,91 @@ function decodeFunctionData({ abi, data }) {
1834
2068
  };
1835
2069
  }
1836
2070
 
2071
+ // src/utils/abi/getAbiItem.ts
2072
+ function getAbiItem({ abi, args = [], name }) {
2073
+ const abiItems = abi.filter((x) => "name" in x && x.name === name);
2074
+ if (abiItems.length === 0)
2075
+ return void 0;
2076
+ if (abiItems.length === 1)
2077
+ return abiItems[0];
2078
+ for (const abiItem of abiItems) {
2079
+ if (!("inputs" in abiItem))
2080
+ continue;
2081
+ if (!args || args.length === 0) {
2082
+ if (!abiItem.inputs || abiItem.inputs.length === 0)
2083
+ return abiItem;
2084
+ continue;
2085
+ }
2086
+ if (!abiItem.inputs)
2087
+ continue;
2088
+ if (abiItem.inputs.length === 0)
2089
+ continue;
2090
+ const matched = args.every((arg, index) => {
2091
+ const abiParameter = "inputs" in abiItem && abiItem.inputs[index];
2092
+ if (!abiParameter)
2093
+ return false;
2094
+ return isArgOfType(arg, abiParameter);
2095
+ });
2096
+ if (matched)
2097
+ return abiItem;
2098
+ }
2099
+ return abiItems[0];
2100
+ }
2101
+ function isArgOfType(arg, abiParameter) {
2102
+ const argType = typeof arg;
2103
+ const abiParameterType = abiParameter.type;
2104
+ switch (abiParameterType) {
2105
+ case "address":
2106
+ return isAddress(arg);
2107
+ case "bool":
2108
+ return argType === "boolean";
2109
+ case "function":
2110
+ return argType === "string";
2111
+ case "string":
2112
+ return argType === "string";
2113
+ default: {
2114
+ if (abiParameterType === "tuple" && "components" in abiParameter)
2115
+ return Object.values(abiParameter.components).every(
2116
+ (component, index) => {
2117
+ return isArgOfType(
2118
+ Object.values(arg)[index],
2119
+ component
2120
+ );
2121
+ }
2122
+ );
2123
+ if (/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(
2124
+ abiParameterType
2125
+ ))
2126
+ return argType === "number" || argType === "bigint";
2127
+ if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))
2128
+ return argType === "string" || arg instanceof Uint8Array;
2129
+ if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) {
2130
+ return Array.isArray(arg) && arg.every(
2131
+ (x) => isArgOfType(x, {
2132
+ ...abiParameter,
2133
+ // Pop off `[]` or `[M]` from end of type
2134
+ type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, "")
2135
+ })
2136
+ );
2137
+ }
2138
+ return false;
2139
+ }
2140
+ }
2141
+ }
2142
+
1837
2143
  // src/utils/abi/decodeFunctionResult.ts
1838
2144
  var docsPath = "/docs/contract/decodeFunctionResult";
1839
2145
  function decodeFunctionResult({
1840
2146
  abi,
2147
+ args,
1841
2148
  functionName,
1842
2149
  data
1843
2150
  }) {
1844
- const description = abi.find(
1845
- (x) => "name" in x && x.name === functionName
1846
- );
2151
+ const description = getAbiItem({
2152
+ abi,
2153
+ args,
2154
+ name: functionName
2155
+ });
1847
2156
  if (!description)
1848
2157
  throw new AbiFunctionNotFoundError(functionName, { docsPath });
1849
2158
  if (!("outputs" in description))
@@ -1865,7 +2174,9 @@ function encodeDeployData({
1865
2174
  }) {
1866
2175
  if (!args || args.length === 0)
1867
2176
  return bytecode;
1868
- const description = abi.find((x) => "type" in x && x.type === "constructor");
2177
+ const description = abi.find(
2178
+ (x) => "type" in x && x.type === "constructor"
2179
+ );
1869
2180
  if (!description)
1870
2181
  throw new AbiConstructorNotFoundError({ docsPath: docsPath2 });
1871
2182
  if (!("inputs" in description))
@@ -1879,18 +2190,17 @@ function encodeDeployData({
1879
2190
  return concatHex([bytecode, data]);
1880
2191
  }
1881
2192
 
1882
- // src/utils/abi/getAbiItem.ts
1883
- function getAbiItem({ abi, name }) {
1884
- return abi.find((x) => "name" in x && x.name === name);
1885
- }
1886
-
1887
2193
  // src/utils/abi/encodeErrorResult.ts
1888
2194
  var docsPath3 = "/docs/contract/encodeErrorResult";
1889
2195
  function encodeErrorResult({ abi, errorName, args }) {
1890
- const description = getAbiItem({ abi, name: errorName });
2196
+ const description = getAbiItem({
2197
+ abi,
2198
+ args,
2199
+ name: errorName
2200
+ });
1891
2201
  if (!description)
1892
2202
  throw new AbiErrorNotFoundError(errorName, { docsPath: docsPath3 });
1893
- const definition = formatAbiItemWithParams(description);
2203
+ const definition = formatAbiItem(description);
1894
2204
  const signature = getFunctionSignature(definition);
1895
2205
  let data = "0x";
1896
2206
  if (args && args.length > 0) {
@@ -1903,17 +2213,17 @@ function encodeErrorResult({ abi, errorName, args }) {
1903
2213
 
1904
2214
  // src/utils/abi/encodeEventTopics.ts
1905
2215
  function encodeEventTopics({ abi, eventName, args }) {
1906
- const abiItem = getAbiItem({ abi, name: eventName });
2216
+ const abiItem = getAbiItem({ abi, args, name: eventName });
1907
2217
  if (!abiItem)
1908
2218
  throw new AbiEventNotFoundError(eventName, {
1909
2219
  docsPath: "/docs/contract/encodeEventTopics"
1910
2220
  });
1911
- const definition = formatAbiItemWithParams(abiItem);
2221
+ const definition = formatAbiItem(abiItem);
1912
2222
  const signature = getEventSignature(definition);
1913
2223
  let topics = [];
1914
2224
  if (args && "inputs" in abiItem) {
1915
- const args_ = Array.isArray(args) ? args : _nullishCoalesce(_optionalChain([abiItem, 'access', _25 => _25.inputs, 'optionalAccess', _26 => _26.map, 'call', _27 => _27((x) => args[x.name])]), () => ( []));
1916
- topics = _nullishCoalesce(_optionalChain([abiItem, 'access', _28 => _28.inputs, 'optionalAccess', _29 => _29.filter, 'call', _30 => _30((param) => "indexed" in param && param.indexed), 'access', _31 => _31.map, 'call', _32 => _32(
2225
+ const args_ = Array.isArray(args) ? args : _nullishCoalesce(_optionalChain([abiItem, 'access', _24 => _24.inputs, 'optionalAccess', _25 => _25.map, 'call', _26 => _26((x) => args[x.name])]), () => ( []));
2226
+ topics = _nullishCoalesce(_optionalChain([abiItem, 'access', _27 => _27.inputs, 'optionalAccess', _28 => _28.filter, 'call', _29 => _29((param) => "indexed" in param && param.indexed), 'access', _30 => _30.map, 'call', _31 => _31(
1917
2227
  (param, i) => Array.isArray(args_[i]) ? args_[i].map(
1918
2228
  (_, j) => encodeArg({ param, value: args_[i][j] })
1919
2229
  ) : args_[i] ? encodeArg({ param, value: args_[i] }) : null
@@ -1934,12 +2244,16 @@ function encodeArg({
1934
2244
 
1935
2245
  // src/utils/abi/encodeFunctionData.ts
1936
2246
  function encodeFunctionData({ abi, args, functionName }) {
1937
- const description = getAbiItem({ abi, name: functionName });
2247
+ const description = getAbiItem({
2248
+ abi,
2249
+ args,
2250
+ name: functionName
2251
+ });
1938
2252
  if (!description)
1939
2253
  throw new AbiFunctionNotFoundError(functionName, {
1940
2254
  docsPath: "/docs/contract/encodeFunctionData"
1941
2255
  });
1942
- const definition = formatAbiItemWithParams(description);
2256
+ const definition = formatAbiItem(description);
1943
2257
  const signature = getFunctionSignature(definition);
1944
2258
  const data = "inputs" in description && description.inputs ? encodeAbi({
1945
2259
  params: description.inputs,
@@ -1955,7 +2269,9 @@ function encodeFunctionResult({
1955
2269
  functionName,
1956
2270
  result
1957
2271
  }) {
1958
- const description = abi.find((x) => "name" in x && x.name === functionName);
2272
+ const description = abi.find(
2273
+ (x) => "name" in x && x.name === functionName
2274
+ );
1959
2275
  if (!description)
1960
2276
  throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath4 });
1961
2277
  if (!("outputs" in description))
@@ -1984,64 +2300,206 @@ function formatAbiItemWithArgs({
1984
2300
  ).join(", ")})`;
1985
2301
  }
1986
2302
 
2303
+ // src/utils/promise/withCache.ts
2304
+ var promiseCache = /* @__PURE__ */ new Map();
2305
+ var responseCache = /* @__PURE__ */ new Map();
2306
+ function getCache(cacheKey) {
2307
+ const buildCache = (cacheKey2, cache) => ({
2308
+ clear: () => cache.delete(cacheKey2),
2309
+ get: () => cache.get(cacheKey2),
2310
+ set: (data) => cache.set(cacheKey2, data)
2311
+ });
2312
+ const promise = buildCache(cacheKey, promiseCache);
2313
+ const response = buildCache(
2314
+ cacheKey,
2315
+ responseCache
2316
+ );
2317
+ return {
2318
+ clear: () => {
2319
+ promise.clear();
2320
+ response.clear();
2321
+ },
2322
+ promise,
2323
+ response
2324
+ };
2325
+ }
2326
+ async function withCache(fn, { cacheKey, maxAge = Infinity }) {
2327
+ const cache = getCache(cacheKey);
2328
+ const response = cache.response.get();
2329
+ if (response && maxAge > 0) {
2330
+ const age = (/* @__PURE__ */ new Date()).getTime() - response.created.getTime();
2331
+ if (age < maxAge)
2332
+ return response.data;
2333
+ }
2334
+ let promise = cache.promise.get();
2335
+ if (!promise) {
2336
+ promise = fn();
2337
+ cache.promise.set(promise);
2338
+ }
2339
+ const data = await promise;
2340
+ cache.promise.clear();
2341
+ cache.response.set({ created: /* @__PURE__ */ new Date(), data });
2342
+ return data;
2343
+ }
2344
+
2345
+ // src/utils/wait.ts
2346
+ async function wait(time) {
2347
+ return new Promise((res) => setTimeout(res, time));
2348
+ }
2349
+
2350
+ // src/utils/promise/withRetry.ts
2351
+ function withRetry(fn, {
2352
+ delay: delay_ = 100,
2353
+ retryCount = 2,
2354
+ shouldRetryOnResponse = () => false,
2355
+ shouldRetryOnError = () => false
2356
+ } = {}) {
2357
+ return new Promise((resolve, reject) => {
2358
+ const attemptRetry = async ({ count = 0 } = {}) => {
2359
+ const retry = async ({ data } = {}) => {
2360
+ const delay = typeof delay_ === "function" ? delay_({ count, data }) : delay_;
2361
+ if (delay)
2362
+ await wait(delay);
2363
+ attemptRetry({ count: count + 1 });
2364
+ };
2365
+ try {
2366
+ const data = await fn();
2367
+ if (count < retryCount && await shouldRetryOnResponse({ count, data }))
2368
+ return retry({ data });
2369
+ resolve(data);
2370
+ } catch (err) {
2371
+ if (count < retryCount && await shouldRetryOnError({ count, error: err }))
2372
+ return retry();
2373
+ reject(err);
2374
+ }
2375
+ };
2376
+ attemptRetry();
2377
+ });
2378
+ }
2379
+
2380
+ // src/utils/promise/withTimeout.ts
2381
+ function withTimeout(fn, {
2382
+ errorInstance,
2383
+ timeout,
2384
+ signal
2385
+ }) {
2386
+ return new Promise((resolve, reject) => {
2387
+ ;
2388
+ (async () => {
2389
+ let timeoutId;
2390
+ try {
2391
+ const controller = new AbortController();
2392
+ if (timeout > 0) {
2393
+ timeoutId = setTimeout(() => {
2394
+ if (signal) {
2395
+ controller.abort();
2396
+ } else {
2397
+ reject(errorInstance);
2398
+ }
2399
+ }, timeout);
2400
+ }
2401
+ resolve(await fn({ signal: _optionalChain([controller, 'optionalAccess', _32 => _32.signal]) }));
2402
+ } catch (err) {
2403
+ if (err.name === "AbortError")
2404
+ reject(errorInstance);
2405
+ reject(err);
2406
+ } finally {
2407
+ clearTimeout(timeoutId);
2408
+ }
2409
+ })();
2410
+ });
2411
+ }
2412
+
1987
2413
  // src/utils/buildRequest.ts
1988
- function buildRequest(request) {
1989
- return async (args) => {
1990
- try {
1991
- return await request(args);
1992
- } catch (err_) {
1993
- let err = err_;
1994
- if (err.code === -32700)
1995
- throw new ParseRpcError(err);
1996
- if (err.code === -32600)
1997
- throw new InvalidRequestRpcError(err);
1998
- if (err.code === -32601)
1999
- throw new MethodNotFoundRpcError(err);
2000
- if (err.code === -32602)
2001
- throw new InvalidParamsRpcError(err);
2002
- if (err.code === -32603)
2003
- throw new InternalRpcError(err);
2004
- if (err.code === -32e3)
2005
- throw new InvalidInputRpcError(err);
2006
- if (err.code === -32001)
2007
- throw new ResourceNotFoundRpcError(err);
2008
- if (err.code === -32002)
2009
- throw new ResourceUnavailableRpcError(err);
2010
- if (err.code === -32003)
2011
- throw new TransactionRejectedRpcError(err);
2012
- if (err.code === -32004)
2013
- throw new MethodNotSupportedRpcError(err);
2014
- if (err.code === -32005)
2015
- throw new LimitExceededRpcError(err);
2016
- if (err.code === -32006)
2017
- throw new JsonRpcVersionUnsupportedError(err);
2018
- if (err_ instanceof BaseError)
2019
- throw err_;
2020
- throw new UnknownRpcError(err);
2414
+ var isNonDeterministicError = (error) => {
2415
+ if (error instanceof UnknownRpcError)
2416
+ return true;
2417
+ if ("code" in error)
2418
+ return error.code === -32603 || error.code === -32e3 || error.code === -32005;
2419
+ return false;
2420
+ };
2421
+ function buildRequest(request, {
2422
+ retryDelay = 150,
2423
+ retryCount = 3
2424
+ } = {}) {
2425
+ return async (args) => withRetry(
2426
+ async () => {
2427
+ try {
2428
+ return await request(args);
2429
+ } catch (err_) {
2430
+ let err = err_;
2431
+ if (err.code === -32700)
2432
+ throw new ParseRpcError(err);
2433
+ if (err.code === -32600)
2434
+ throw new InvalidRequestRpcError(err);
2435
+ if (err.code === -32601)
2436
+ throw new MethodNotFoundRpcError(err);
2437
+ if (err.code === -32602)
2438
+ throw new InvalidParamsRpcError(err);
2439
+ if (err.code === -32603)
2440
+ throw new InternalRpcError(err);
2441
+ if (err.code === -32e3)
2442
+ throw new InvalidInputRpcError(err);
2443
+ if (err.code === -32001)
2444
+ throw new ResourceNotFoundRpcError(err);
2445
+ if (err.code === -32002)
2446
+ throw new ResourceUnavailableRpcError(err);
2447
+ if (err.code === -32003)
2448
+ throw new TransactionRejectedRpcError(err);
2449
+ if (err.code === -32004)
2450
+ throw new MethodNotSupportedRpcError(err);
2451
+ if (err.code === -32005)
2452
+ throw new LimitExceededRpcError(err);
2453
+ if (err.code === -32006)
2454
+ throw new JsonRpcVersionUnsupportedError(err);
2455
+ if (err_ instanceof BaseError)
2456
+ throw err_;
2457
+ throw new UnknownRpcError(err);
2458
+ }
2459
+ },
2460
+ {
2461
+ delay: ({ count }) => ~~(1 << count) * retryDelay,
2462
+ retryCount,
2463
+ shouldRetryOnError: ({ error }) => isNonDeterministicError(error)
2464
+ }
2465
+ );
2466
+ }
2467
+
2468
+ // src/utils/chain.ts
2469
+ function defineChain(chain) {
2470
+ return chain;
2471
+ }
2472
+
2473
+ // src/utils/formatters/format.ts
2474
+ function format3(data, { formatter }) {
2475
+ return formatter(data);
2476
+ }
2477
+ function defineFormatter({
2478
+ format: format4
2479
+ }) {
2480
+ return ({
2481
+ exclude,
2482
+ format: formatOverride
2483
+ }) => (data) => {
2484
+ const formatted = format4(data);
2485
+ if (exclude) {
2486
+ for (const key of exclude) {
2487
+ delete formatted[key];
2488
+ }
2021
2489
  }
2490
+ return {
2491
+ ...formatted,
2492
+ ..._optionalChain([formatOverride, 'optionalCall', _33 => _33(data)])
2493
+ };
2022
2494
  };
2023
2495
  }
2024
2496
 
2025
- // src/constants.ts
2026
- var etherUnits = {
2027
- gwei: 9,
2028
- wei: 18
2029
- };
2030
- var gweiUnits = {
2031
- ether: -9,
2032
- wei: 9
2033
- };
2034
- var weiUnits = {
2035
- ether: -18,
2036
- gwei: -9
2037
- };
2497
+ // src/utils/formatters/transaction.ts
2038
2498
  var transactionType = {
2039
2499
  "0x0": "legacy",
2040
2500
  "0x1": "eip2930",
2041
2501
  "0x2": "eip1559"
2042
2502
  };
2043
-
2044
- // src/utils/formatters/transaction.ts
2045
2503
  function formatTransaction(transaction) {
2046
2504
  const transaction_ = {
2047
2505
  ...transaction,
@@ -2067,10 +2525,11 @@ function formatTransaction(transaction) {
2067
2525
  }
2068
2526
  return transaction_;
2069
2527
  }
2528
+ var defineTransaction = defineFormatter({ format: formatTransaction });
2070
2529
 
2071
2530
  // src/utils/formatters/block.ts
2072
2531
  function formatBlock(block) {
2073
- const transactions = _optionalChain([block, 'access', _33 => _33.transactions, 'optionalAccess', _34 => _34.map, 'call', _35 => _35((transaction) => {
2532
+ const transactions = _optionalChain([block, 'access', _34 => _34.transactions, 'optionalAccess', _35 => _35.map, 'call', _36 => _36((transaction) => {
2074
2533
  if (typeof transaction === "string")
2075
2534
  return transaction;
2076
2535
  return formatTransaction(transaction);
@@ -2088,6 +2547,21 @@ function formatBlock(block) {
2088
2547
  totalDifficulty: block.totalDifficulty ? BigInt(block.totalDifficulty) : null
2089
2548
  };
2090
2549
  }
2550
+ var defineBlock = defineFormatter({ format: formatBlock });
2551
+
2552
+ // src/utils/formatters/extract.ts
2553
+ function extract(value, { formatter }) {
2554
+ if (!formatter)
2555
+ return {};
2556
+ const keys = Object.keys(formatter({}));
2557
+ return keys.reduce((data, key) => {
2558
+ if (_optionalChain([value, 'optionalAccess', _37 => _37.hasOwnProperty, 'call', _38 => _38(key)])) {
2559
+ ;
2560
+ data[key] = value[key];
2561
+ }
2562
+ return data;
2563
+ }, {});
2564
+ }
2091
2565
 
2092
2566
  // src/utils/formatters/feeHistory.ts
2093
2567
  function formatFeeHistory(feeHistory) {
@@ -2095,17 +2569,12 @@ function formatFeeHistory(feeHistory) {
2095
2569
  baseFeePerGas: feeHistory.baseFeePerGas.map((value) => BigInt(value)),
2096
2570
  gasUsedRatio: feeHistory.gasUsedRatio,
2097
2571
  oldestBlock: BigInt(feeHistory.oldestBlock),
2098
- reward: _optionalChain([feeHistory, 'access', _36 => _36.reward, 'optionalAccess', _37 => _37.map, 'call', _38 => _38(
2572
+ reward: _optionalChain([feeHistory, 'access', _39 => _39.reward, 'optionalAccess', _40 => _40.map, 'call', _41 => _41(
2099
2573
  (reward) => reward.map((value) => BigInt(value))
2100
2574
  )])
2101
2575
  };
2102
2576
  }
2103
2577
 
2104
- // src/utils/formatters/format.ts
2105
- function format3(data, { formatter }) {
2106
- return formatter(data);
2107
- }
2108
-
2109
2578
  // src/utils/formatters/log.ts
2110
2579
  function formatLog(log) {
2111
2580
  return {
@@ -2134,6 +2603,9 @@ function formatTransactionReceipt(transactionReceipt) {
2134
2603
  type: transactionReceipt.type ? transactionType[transactionReceipt.type] : null
2135
2604
  };
2136
2605
  }
2606
+ var defineTransactionReceipt = defineFormatter({
2607
+ format: formatTransactionReceipt
2608
+ });
2137
2609
 
2138
2610
  // src/utils/formatters/transactionRequest.ts
2139
2611
  function formatTransactionRequest(transactionRequest) {
@@ -2147,129 +2619,34 @@ function formatTransactionRequest(transactionRequest) {
2147
2619
  value: typeof transactionRequest.value !== "undefined" ? numberToHex(transactionRequest.value) : void 0
2148
2620
  };
2149
2621
  }
2622
+ var defineTransactionRequest = defineFormatter({
2623
+ format: formatTransactionRequest
2624
+ });
2150
2625
 
2151
- // src/utils/promise/withCache.ts
2152
- var promiseCache = /* @__PURE__ */ new Map();
2153
- var responseCache = /* @__PURE__ */ new Map();
2154
- function getCache(cacheKey) {
2155
- const buildCache = (cacheKey2, cache) => ({
2156
- clear: () => cache.delete(cacheKey2),
2157
- get: () => cache.get(cacheKey2),
2158
- set: (data) => cache.set(cacheKey2, data)
2159
- });
2160
- const promise = buildCache(cacheKey, promiseCache);
2161
- const response = buildCache(
2162
- cacheKey,
2163
- responseCache
2164
- );
2165
- return {
2166
- clear: () => {
2167
- promise.clear();
2168
- response.clear();
2169
- },
2170
- promise,
2171
- response
2172
- };
2173
- }
2174
- async function withCache(fn, { cacheKey, maxAge = Infinity }) {
2175
- const cache = getCache(cacheKey);
2176
- const response = cache.response.get();
2177
- if (response && maxAge > 0) {
2178
- const age = new Date().getTime() - response.created.getTime();
2179
- if (age < maxAge)
2180
- return response.data;
2181
- }
2182
- let promise = cache.promise.get();
2183
- if (!promise) {
2184
- promise = fn();
2185
- cache.promise.set(promise);
2186
- }
2187
- const data = await promise;
2188
- cache.promise.clear();
2189
- cache.response.set({ created: new Date(), data });
2190
- return data;
2191
- }
2192
-
2193
- // src/utils/wait.ts
2194
- async function wait(time) {
2195
- return new Promise((res) => setTimeout(res, time));
2196
- }
2197
-
2198
- // src/utils/promise/withRetry.ts
2199
- function withRetry(fn, {
2200
- delay: delay_ = 100,
2201
- retryCount = 2,
2202
- shouldRetryOnResponse = () => false,
2203
- shouldRetryOnError = () => false
2204
- } = {}) {
2205
- return new Promise((resolve, reject) => {
2206
- const attemptRetry = async ({ count = 0 } = {}) => {
2207
- const retry = async ({ data } = {}) => {
2208
- const delay = typeof delay_ === "function" ? delay_({ count, data }) : delay_;
2209
- if (delay)
2210
- await wait(delay);
2211
- attemptRetry({ count: count + 1 });
2212
- };
2213
- try {
2214
- const data = await fn();
2215
- if (count < retryCount && await shouldRetryOnResponse({ count, data }))
2216
- return retry({ data });
2217
- resolve(data);
2218
- } catch (err) {
2219
- if (count < retryCount && await shouldRetryOnError({ count, error: err }))
2220
- return retry();
2221
- reject(err);
2222
- }
2223
- };
2224
- attemptRetry();
2225
- });
2226
- }
2626
+ // src/utils/rpc.ts
2627
+ var _isomorphicunfetch = require('isomorphic-unfetch'); var _isomorphicunfetch2 = _interopRequireDefault(_isomorphicunfetch);
2628
+ var _isomorphicws = require('isomorphic-ws'); var _isomorphicws2 = _interopRequireDefault(_isomorphicws);
2227
2629
 
2228
- // src/utils/promise/withTimeout.ts
2229
- function withTimeout(fn, {
2230
- errorInstance,
2231
- timeout,
2232
- signal
2233
- }) {
2234
- return new Promise((resolve, reject) => {
2235
- ;
2236
- (async () => {
2237
- let timeoutId;
2238
- try {
2239
- const controller = new AbortController();
2240
- if (timeout > 0) {
2241
- timeoutId = setTimeout(() => {
2242
- if (signal) {
2243
- controller.abort();
2244
- } else {
2245
- reject(errorInstance);
2246
- }
2247
- }, timeout);
2248
- }
2249
- resolve(await fn({ signal: _optionalChain([controller, 'optionalAccess', _39 => _39.signal]) }));
2250
- } catch (err) {
2251
- if (err.name === "AbortError")
2252
- reject(errorInstance);
2253
- reject(err);
2254
- } finally {
2255
- clearTimeout(timeoutId);
2256
- }
2257
- })();
2258
- });
2630
+ // src/utils/stringify.ts
2631
+ function stringify(value) {
2632
+ return JSON.stringify(
2633
+ value,
2634
+ (_, value2) => typeof value2 === "bigint" ? value2.toString() : value2
2635
+ );
2259
2636
  }
2260
2637
 
2261
2638
  // src/utils/rpc.ts
2262
2639
  var id = 0;
2263
2640
  async function http(url, {
2264
2641
  body,
2265
- retryDelay = 100,
2266
- retryCount = 2,
2642
+ retryDelay = 150,
2643
+ retryCount = 3,
2267
2644
  timeout = 0
2268
2645
  }) {
2269
2646
  const response = await withRetry(
2270
2647
  () => withTimeout(
2271
2648
  async ({ signal }) => {
2272
- const response2 = await fetch(url, {
2649
+ const response2 = await _isomorphicunfetch2.default.call(void 0, url, {
2273
2650
  headers: {
2274
2651
  "Content-Type": "application/json"
2275
2652
  },
@@ -2287,10 +2664,10 @@ async function http(url, {
2287
2664
  ),
2288
2665
  {
2289
2666
  delay: ({ count, data: data2 }) => {
2290
- const retryAfter = _optionalChain([data2, 'optionalAccess', _40 => _40.headers, 'access', _41 => _41.get, 'call', _42 => _42("Retry-After")]);
2291
- if (_optionalChain([retryAfter, 'optionalAccess', _43 => _43.match, 'call', _44 => _44(/\d/)]))
2667
+ const retryAfter = _optionalChain([data2, 'optionalAccess', _42 => _42.headers, 'access', _43 => _43.get, 'call', _44 => _44("Retry-After")]);
2668
+ if (_optionalChain([retryAfter, 'optionalAccess', _45 => _45.match, 'call', _46 => _46(/\d/)]))
2292
2669
  return parseInt(retryAfter) * 1e3;
2293
- return ~~((Math.random() + 0.5) * (1 << count)) * retryDelay;
2670
+ return ~~(1 << count) * retryDelay;
2294
2671
  },
2295
2672
  retryCount,
2296
2673
  shouldRetryOnResponse: async ({ data: data2 }) => {
@@ -2303,7 +2680,7 @@ async function http(url, {
2303
2680
  }
2304
2681
  );
2305
2682
  let data;
2306
- if (_optionalChain([response, 'access', _45 => _45.headers, 'access', _46 => _46.get, 'call', _47 => _47("Content-Type"), 'optionalAccess', _48 => _48.startsWith, 'call', _49 => _49("application/json")])) {
2683
+ if (_optionalChain([response, 'access', _47 => _47.headers, 'access', _48 => _48.get, 'call', _49 => _49("Content-Type"), 'optionalAccess', _50 => _50.startsWith, 'call', _51 => _51("application/json")])) {
2307
2684
  data = await response.json();
2308
2685
  } else {
2309
2686
  data = await response.text();
@@ -2328,7 +2705,7 @@ async function getSocket(url_) {
2328
2705
  let socket = sockets.get(urlKey);
2329
2706
  if (socket)
2330
2707
  return socket;
2331
- const webSocket2 = new WebSocket(url);
2708
+ const webSocket2 = new (0, _isomorphicws2.default)(url);
2332
2709
  const requests = /* @__PURE__ */ new Map();
2333
2710
  const subscriptions = /* @__PURE__ */ new Map();
2334
2711
  const onMessage = ({ data }) => {
@@ -2349,7 +2726,7 @@ async function getSocket(url_) {
2349
2726
  };
2350
2727
  webSocket2.addEventListener("close", onClose);
2351
2728
  webSocket2.addEventListener("message", onMessage);
2352
- if (webSocket2.readyState === WebSocket.CONNECTING) {
2729
+ if (webSocket2.readyState === _isomorphicws2.default.CONNECTING) {
2353
2730
  await new Promise((resolve, reject) => {
2354
2731
  if (!webSocket2)
2355
2732
  return;
@@ -2381,15 +2758,15 @@ function webSocket(socket, {
2381
2758
  if (typeof message.id === "number" && id_ !== message.id)
2382
2759
  return;
2383
2760
  if (message.error) {
2384
- _optionalChain([onError, 'optionalCall', _50 => _50(new RpcError({ body, error: message.error, url: socket.url }))]);
2761
+ _optionalChain([onError, 'optionalCall', _52 => _52(new RpcError({ body, error: message.error, url: socket.url }))]);
2385
2762
  } else {
2386
- _optionalChain([onData, 'optionalCall', _51 => _51(message)]);
2763
+ _optionalChain([onData, 'optionalCall', _53 => _53(message)]);
2387
2764
  }
2388
2765
  if (body.method === "eth_subscribe" && typeof message.result === "string") {
2389
2766
  socket.subscriptions.set(message.result, callback);
2390
2767
  }
2391
2768
  if (body.method === "eth_unsubscribe") {
2392
- socket.subscriptions.delete(_optionalChain([body, 'access', _52 => _52.params, 'optionalAccess', _53 => _53[0]]));
2769
+ socket.subscriptions.delete(_optionalChain([body, 'access', _54 => _54.params, 'optionalAccess', _55 => _55[0]]));
2393
2770
  }
2394
2771
  };
2395
2772
  socket.requests.set(id_, callback);
@@ -2420,6 +2797,20 @@ var rpc = {
2420
2797
  webSocketAsync
2421
2798
  };
2422
2799
 
2800
+ // src/utils/unit/constants.ts
2801
+ var etherUnits = {
2802
+ gwei: 9,
2803
+ wei: 18
2804
+ };
2805
+ var gweiUnits = {
2806
+ ether: -9,
2807
+ wei: 9
2808
+ };
2809
+ var weiUnits = {
2810
+ ether: -18,
2811
+ gwei: -9
2812
+ };
2813
+
2423
2814
  // src/utils/unit/formatUnit.ts
2424
2815
  function formatUnit(value, decimals) {
2425
2816
  let display = value.toString();
@@ -2613,4 +3004,23 @@ function parseGwei(ether, unit = "wei") {
2613
3004
 
2614
3005
 
2615
3006
 
2616
- exports.stringify = stringify; exports.BaseError = BaseError; exports.AbiConstructorNotFoundError = AbiConstructorNotFoundError; exports.AbiConstructorParamsNotFoundError = AbiConstructorParamsNotFoundError; exports.AbiDecodingDataSizeInvalidError = AbiDecodingDataSizeInvalidError; exports.AbiEncodingArrayLengthMismatchError = AbiEncodingArrayLengthMismatchError; exports.AbiEncodingLengthMismatchError = AbiEncodingLengthMismatchError; exports.AbiErrorInputsNotFoundError = AbiErrorInputsNotFoundError; exports.AbiErrorNotFoundError = AbiErrorNotFoundError; exports.AbiErrorSignatureNotFoundError = AbiErrorSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.SizeExceedsPaddingSizeError = SizeExceedsPaddingSizeError; exports.DataLengthTooLongError = DataLengthTooLongError; exports.DataLengthTooShortError = DataLengthTooShortError; exports.InvalidBytesBooleanError = InvalidBytesBooleanError; exports.InvalidHexBooleanError = InvalidHexBooleanError; exports.InvalidHexValueError = InvalidHexValueError; exports.OffsetOutOfBoundsError = OffsetOutOfBoundsError; exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError; exports.RequestError = RequestError; exports.RpcRequestError = RpcRequestError; exports.ParseRpcError = ParseRpcError; exports.InvalidRequestRpcError = InvalidRequestRpcError; exports.MethodNotFoundRpcError = MethodNotFoundRpcError; exports.InvalidParamsRpcError = InvalidParamsRpcError; exports.InternalRpcError = InternalRpcError; exports.InvalidInputRpcError = InvalidInputRpcError; exports.ResourceNotFoundRpcError = ResourceNotFoundRpcError; exports.ResourceUnavailableRpcError = ResourceUnavailableRpcError; exports.TransactionRejectedRpcError = TransactionRejectedRpcError; exports.MethodNotSupportedRpcError = MethodNotSupportedRpcError; exports.LimitExceededRpcError = LimitExceededRpcError; exports.JsonRpcVersionUnsupportedError = JsonRpcVersionUnsupportedError; exports.UnknownRpcError = UnknownRpcError; exports.isBytes = isBytes; exports.isHex = isHex; exports.pad = pad; exports.padHex = padHex; exports.padBytes = padBytes; exports.trim = trim; exports.size = size; exports.slice = slice; exports.sliceBytes = sliceBytes; exports.sliceHex = sliceHex; exports.boolToHex = boolToHex; exports.bytesToHex = bytesToHex; exports.encodeHex = encodeHex; exports.numberToHex = numberToHex; exports.stringToHex = stringToHex; exports.boolToBytes = boolToBytes; exports.encodeBytes = encodeBytes; exports.hexToBytes = hexToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.encodeRlp = encodeRlp; exports.decodeHex = decodeHex; exports.hexToBigInt = hexToBigInt; exports.hexToBool = hexToBool; exports.hexToNumber = hexToNumber; exports.hexToString = hexToString; exports.decodeBytes = decodeBytes; exports.bytesToBigint = bytesToBigint; exports.bytesToBool = bytesToBool; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.decodeRlp = decodeRlp; exports.extractFunctionParts = extractFunctionParts; exports.extractFunctionName = extractFunctionName; exports.extractFunctionParams = extractFunctionParams; exports.extractFunctionType = extractFunctionType; exports.getContractError = getContractError; exports.keccak256 = keccak256; exports.getEventSignature = getEventSignature; exports.getFunctionSignature = getFunctionSignature; exports.checksumAddress = checksumAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddress = isAddress; exports.isAddressEqual = isAddressEqual; exports.encodeAbi = encodeAbi; exports.decodeAbi = decodeAbi; exports.formatAbiItemWithParams = formatAbiItemWithParams; exports.decodeErrorResult = decodeErrorResult; exports.decodeFunctionData = decodeFunctionData; exports.decodeFunctionResult = decodeFunctionResult; exports.encodeDeployData = encodeDeployData; exports.getAbiItem = getAbiItem; exports.encodeErrorResult = encodeErrorResult; exports.encodeEventTopics = encodeEventTopics; exports.encodeFunctionData = encodeFunctionData; exports.encodeFunctionResult = encodeFunctionResult; exports.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.buildRequest = buildRequest; exports.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.transactionType = transactionType; exports.formatTransaction = formatTransaction; exports.formatBlock = formatBlock; exports.formatFeeHistory = formatFeeHistory; exports.format = format3; exports.formatLog = formatLog; exports.formatTransactionReceipt = formatTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.getCache = getCache; exports.withCache = withCache; exports.wait = wait; exports.getSocket = getSocket; exports.rpc = rpc; exports.formatUnit = formatUnit; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseUnit = parseUnit; exports.parseEther = parseEther; exports.parseGwei = parseGwei; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.InvalidGasArgumentsError = InvalidGasArgumentsError; exports.TransactionNotFoundError = TransactionNotFoundError; exports.TransactionReceiptNotFoundError = TransactionReceiptNotFoundError; exports.WaitForTransactionReceiptTimeoutError = WaitForTransactionReceiptTimeoutError; exports.UrlRequiredError = UrlRequiredError;
3007
+
3008
+
3009
+
3010
+
3011
+
3012
+
3013
+
3014
+
3015
+
3016
+
3017
+
3018
+
3019
+
3020
+
3021
+
3022
+
3023
+
3024
+
3025
+ exports.BaseError = BaseError; exports.AbiConstructorNotFoundError = AbiConstructorNotFoundError; exports.AbiConstructorParamsNotFoundError = AbiConstructorParamsNotFoundError; exports.AbiDecodingDataSizeInvalidError = AbiDecodingDataSizeInvalidError; exports.AbiDecodingZeroDataError = AbiDecodingZeroDataError; exports.AbiEncodingArrayLengthMismatchError = AbiEncodingArrayLengthMismatchError; exports.AbiEncodingLengthMismatchError = AbiEncodingLengthMismatchError; exports.AbiErrorInputsNotFoundError = AbiErrorInputsNotFoundError; exports.AbiErrorNotFoundError = AbiErrorNotFoundError; exports.AbiErrorSignatureNotFoundError = AbiErrorSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.ChainDoesNotSupportContract = ChainDoesNotSupportContract; exports.multicall3Abi = multicall3Abi; exports.panicReasons = panicReasons; exports.concat = concat; exports.isBytes = isBytes; exports.isHex = isHex; exports.pad = pad; exports.padHex = padHex; exports.padBytes = padBytes; exports.trim = trim; exports.size = size; exports.slice = slice; exports.sliceBytes = sliceBytes; exports.sliceHex = sliceHex; exports.boolToHex = boolToHex; exports.bytesToHex = bytesToHex; exports.encodeHex = encodeHex; exports.numberToHex = numberToHex; exports.stringToHex = stringToHex; exports.boolToBytes = boolToBytes; exports.encodeBytes = encodeBytes; exports.hexToBytes = hexToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.encodeRlp = encodeRlp; exports.decodeHex = decodeHex; exports.hexToBigInt = hexToBigInt; exports.hexToBool = hexToBool; exports.hexToNumber = hexToNumber; exports.hexToString = hexToString; exports.decodeBytes = decodeBytes; exports.bytesToBigint = bytesToBigint; exports.bytesToBool = bytesToBool; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.decodeRlp = decodeRlp; exports.extractFunctionParts = extractFunctionParts; exports.extractFunctionName = extractFunctionName; exports.extractFunctionParams = extractFunctionParams; exports.extractFunctionType = extractFunctionType; exports.getContractError = getContractError; exports.keccak256 = keccak256; exports.getEventSignature = getEventSignature; exports.getFunctionSignature = getFunctionSignature; exports.checksumAddress = checksumAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddress = isAddress; exports.isAddressEqual = isAddressEqual; exports.encodeAbi = encodeAbi; exports.decodeAbi = decodeAbi; exports.formatAbiItem = formatAbiItem; exports.decodeErrorResult = decodeErrorResult; exports.decodeEventLog = decodeEventLog; exports.decodeFunctionData = decodeFunctionData; exports.getAbiItem = getAbiItem; exports.decodeFunctionResult = decodeFunctionResult; exports.encodeDeployData = encodeDeployData; exports.encodeErrorResult = encodeErrorResult; exports.encodeEventTopics = encodeEventTopics; exports.encodeFunctionData = encodeFunctionData; exports.encodeFunctionResult = encodeFunctionResult; exports.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.getCache = getCache; exports.withCache = withCache; exports.wait = wait; exports.isNonDeterministicError = isNonDeterministicError; exports.buildRequest = buildRequest; exports.defineChain = defineChain; exports.format = format3; exports.defineFormatter = defineFormatter; exports.transactionType = transactionType; exports.formatTransaction = formatTransaction; exports.defineTransaction = defineTransaction; exports.formatBlock = formatBlock; exports.defineBlock = defineBlock; exports.extract = extract; exports.formatFeeHistory = formatFeeHistory; exports.formatLog = formatLog; exports.formatTransactionReceipt = formatTransactionReceipt; exports.defineTransactionReceipt = defineTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.defineTransactionRequest = defineTransactionRequest; exports.stringify = stringify; exports.getSocket = getSocket; exports.rpc = rpc; exports.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.formatUnit = formatUnit; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseUnit = parseUnit; exports.parseEther = parseEther; exports.parseGwei = parseGwei; exports.ContractFunctionExecutionError = ContractFunctionExecutionError; exports.ContractFunctionRevertedError = ContractFunctionRevertedError; exports.ContractFunctionZeroDataError = ContractFunctionZeroDataError; exports.RawContractError = RawContractError; exports.SizeExceedsPaddingSizeError = SizeExceedsPaddingSizeError; exports.DataLengthTooLongError = DataLengthTooLongError; exports.DataLengthTooShortError = DataLengthTooShortError; exports.InvalidBytesBooleanError = InvalidBytesBooleanError; exports.InvalidHexBooleanError = InvalidHexBooleanError; exports.InvalidHexValueError = InvalidHexValueError; exports.OffsetOutOfBoundsError = OffsetOutOfBoundsError; exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError; exports.RequestError = RequestError; exports.RpcRequestError = RpcRequestError; exports.ParseRpcError = ParseRpcError; exports.InvalidRequestRpcError = InvalidRequestRpcError; exports.MethodNotFoundRpcError = MethodNotFoundRpcError; exports.InvalidParamsRpcError = InvalidParamsRpcError; exports.InternalRpcError = InternalRpcError; exports.InvalidInputRpcError = InvalidInputRpcError; exports.ResourceNotFoundRpcError = ResourceNotFoundRpcError; exports.ResourceUnavailableRpcError = ResourceUnavailableRpcError; exports.TransactionRejectedRpcError = TransactionRejectedRpcError; exports.MethodNotSupportedRpcError = MethodNotSupportedRpcError; exports.LimitExceededRpcError = LimitExceededRpcError; exports.JsonRpcVersionUnsupportedError = JsonRpcVersionUnsupportedError; exports.UnknownRpcError = UnknownRpcError; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.InvalidGasArgumentsError = InvalidGasArgumentsError; exports.TransactionNotFoundError = TransactionNotFoundError; exports.TransactionReceiptNotFoundError = TransactionReceiptNotFoundError; exports.WaitForTransactionReceiptTimeoutError = WaitForTransactionReceiptTimeoutError; exports.UrlRequiredError = UrlRequiredError;
3026
+ //# sourceMappingURL=chunk-NXCI5KQC.js.map