viem 0.0.1-alpha.15 → 0.0.1-alpha.16

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 (431) hide show
  1. package/dist/chains.js +6 -5
  2. package/dist/chains.js.map +1 -0
  3. package/dist/chains.mjs +2 -1
  4. package/dist/chains.mjs.map +1 -0
  5. package/dist/{chunk-KGXH5DYI.js → chunk-4XREGFHD.js} +12 -11
  6. package/dist/chunk-4XREGFHD.js.map +1 -0
  7. package/dist/{chunk-PPDHFNFM.mjs → chunk-B7A2CAHU.mjs} +3 -2
  8. package/dist/chunk-B7A2CAHU.mjs.map +1 -0
  9. package/dist/{chunk-QMLDI5JU.js → chunk-EWTLCB3N.js} +3 -1
  10. package/dist/chunk-EWTLCB3N.js.map +1 -0
  11. package/dist/{chunk-PHAG5KUF.mjs → chunk-KCMYVU3Z.mjs} +2 -1
  12. package/dist/chunk-KCMYVU3Z.mjs.map +1 -0
  13. package/dist/{chunk-2HENAFQN.mjs → chunk-KM6AFT2K.mjs} +3 -1
  14. package/dist/chunk-KM6AFT2K.mjs.map +1 -0
  15. package/dist/{chunk-IMYI7Z6M.js → chunk-LQXQPPTU.js} +14 -13
  16. package/dist/chunk-LQXQPPTU.js.map +1 -0
  17. package/dist/{chunk-SX7GPOCZ.mjs → chunk-TSJ3OOJW.mjs} +2 -1
  18. package/dist/chunk-TSJ3OOJW.mjs.map +1 -0
  19. package/dist/{chunk-NYXBQHNJ.mjs → chunk-U7QDLGQL.mjs} +2 -1
  20. package/dist/chunk-U7QDLGQL.mjs.map +1 -0
  21. package/dist/{chunk-HTYEJEWI.js → chunk-WTXKCAG7.js} +50 -49
  22. package/dist/chunk-WTXKCAG7.js.map +1 -0
  23. package/dist/{chunk-EMQSYKNY.js → chunk-XJKOJIX3.js} +12 -11
  24. package/dist/chunk-XJKOJIX3.js.map +1 -0
  25. package/dist/clients/index.js +4 -3
  26. package/dist/clients/index.js.map +1 -0
  27. package/dist/clients/index.mjs +3 -2
  28. package/dist/clients/index.mjs.map +1 -0
  29. package/dist/index.js +7 -6
  30. package/dist/index.js.map +1 -0
  31. package/dist/index.mjs +6 -5
  32. package/dist/index.mjs.map +1 -0
  33. package/dist/public.js +5 -4
  34. package/dist/public.js.map +1 -0
  35. package/dist/public.mjs +4 -3
  36. package/dist/public.mjs.map +1 -0
  37. package/dist/test.js +4 -3
  38. package/dist/test.js.map +1 -0
  39. package/dist/test.mjs +3 -2
  40. package/dist/test.mjs.map +1 -0
  41. package/dist/utils/index.js +3 -2
  42. package/dist/utils/index.js.map +1 -0
  43. package/dist/utils/index.mjs +2 -1
  44. package/dist/utils/index.mjs.map +1 -0
  45. package/dist/wallet.js +4 -3
  46. package/dist/wallet.js.map +1 -0
  47. package/dist/wallet.mjs +3 -2
  48. package/dist/wallet.mjs.map +1 -0
  49. package/dist/window.js +1 -1
  50. package/dist/window.js.map +1 -0
  51. package/dist/window.mjs +1 -0
  52. package/dist/window.mjs.map +1 -0
  53. package/package.json +3 -1
  54. package/src/_test/abis.ts +1225 -0
  55. package/src/_test/bench.ts +15 -0
  56. package/src/_test/constants.ts +63 -0
  57. package/src/_test/globalSetup.ts +11 -0
  58. package/src/_test/index.ts +20 -0
  59. package/src/_test/setup.ts +8 -0
  60. package/src/_test/utils.ts +112 -0
  61. package/src/actions/index.test.ts +72 -0
  62. package/src/actions/index.ts +156 -0
  63. package/src/actions/public/call.bench.ts +48 -0
  64. package/src/actions/public/call.test.ts +99 -0
  65. package/src/actions/public/call.ts +96 -0
  66. package/src/actions/public/callContract.bench.ts +24 -0
  67. package/src/actions/public/callContract.test.ts +285 -0
  68. package/src/actions/public/callContract.ts +80 -0
  69. package/src/actions/public/createBlockFilter.bench.ts +11 -0
  70. package/src/actions/public/createBlockFilter.test.ts +9 -0
  71. package/src/actions/public/createBlockFilter.ts +14 -0
  72. package/src/actions/public/createEventFilter.test.ts +245 -0
  73. package/src/actions/public/createEventFilter.ts +81 -0
  74. package/src/actions/public/createPendingTransactionFilter.bench.ts +11 -0
  75. package/src/actions/public/createPendingTransactionFilter.test.ts +9 -0
  76. package/src/actions/public/createPendingTransactionFilter.ts +14 -0
  77. package/src/actions/public/deployContract.test.ts +56 -0
  78. package/src/actions/public/deployContract.ts +39 -0
  79. package/src/actions/public/estimateGas.bench.ts +46 -0
  80. package/src/actions/public/estimateGas.test.ts +92 -0
  81. package/src/actions/public/estimateGas.ts +61 -0
  82. package/src/actions/public/getBalance.test.ts +83 -0
  83. package/src/actions/public/getBalance.ts +37 -0
  84. package/src/actions/public/getBlock.bench.ts +28 -0
  85. package/src/actions/public/getBlock.test.ts +575 -0
  86. package/src/actions/public/getBlock.ts +66 -0
  87. package/src/actions/public/getBlockNumber.bench.ts +28 -0
  88. package/src/actions/public/getBlockNumber.test.ts +27 -0
  89. package/src/actions/public/getBlockNumber.ts +32 -0
  90. package/src/actions/public/getBlockTransactionCount.bench.ts +15 -0
  91. package/src/actions/public/getBlockTransactionCount.test.ts +57 -0
  92. package/src/actions/public/getBlockTransactionCount.ts +53 -0
  93. package/src/actions/public/getBytecode.test.ts +27 -0
  94. package/src/actions/public/getBytecode.ts +32 -0
  95. package/src/actions/public/getChainId.bench.ts +15 -0
  96. package/src/actions/public/getChainId.test.ts +8 -0
  97. package/src/actions/public/getChainId.ts +7 -0
  98. package/src/actions/public/getFeeHistory.bench.ts +18 -0
  99. package/src/actions/public/getFeeHistory.test.ts +137 -0
  100. package/src/actions/public/getFeeHistory.ts +44 -0
  101. package/src/actions/public/getFilterChanges.bench.ts +13 -0
  102. package/src/actions/public/getFilterChanges.test.ts +187 -0
  103. package/src/actions/public/getFilterChanges.ts +23 -0
  104. package/src/actions/public/getFilterLogs.test.ts +102 -0
  105. package/src/actions/public/getFilterLogs.ts +20 -0
  106. package/src/actions/public/getGasPrice.bench.ts +28 -0
  107. package/src/actions/public/getGasPrice.test.ts +8 -0
  108. package/src/actions/public/getGasPrice.ts +15 -0
  109. package/src/actions/public/getTransaction.bench.ts +33 -0
  110. package/src/actions/public/getTransaction.test.ts +311 -0
  111. package/src/actions/public/getTransaction.ts +96 -0
  112. package/src/actions/public/getTransactionConfirmations.test.ts +69 -0
  113. package/src/actions/public/getTransactionConfirmations.ts +39 -0
  114. package/src/actions/public/getTransactionCount.test.ts +56 -0
  115. package/src/actions/public/getTransactionCount.ts +34 -0
  116. package/src/actions/public/getTransactionReceipt.bench.ts +33 -0
  117. package/src/actions/public/getTransactionReceipt.test.ts +217 -0
  118. package/src/actions/public/getTransactionReceipt.ts +35 -0
  119. package/src/actions/public/index.test.ts +36 -0
  120. package/src/actions/public/index.ts +120 -0
  121. package/src/actions/public/uninstallFilter.bench.ts +13 -0
  122. package/src/actions/public/uninstallFilter.test.ts +65 -0
  123. package/src/actions/public/uninstallFilter.ts +17 -0
  124. package/src/actions/public/waitForTransactionReceipt.test.ts +322 -0
  125. package/src/actions/public/waitForTransactionReceipt.ts +171 -0
  126. package/src/actions/public/watchBlockNumber.test.ts +166 -0
  127. package/src/actions/public/watchBlockNumber.ts +79 -0
  128. package/src/actions/public/watchBlocks.test.ts +185 -0
  129. package/src/actions/public/watchBlocks.ts +95 -0
  130. package/src/actions/public/watchPendingTransactions.test.ts +116 -0
  131. package/src/actions/public/watchPendingTransactions.ts +73 -0
  132. package/src/actions/test/dropTransaction.test.ts +34 -0
  133. package/src/actions/test/dropTransaction.ts +17 -0
  134. package/src/actions/test/getAutomine.test.ts +14 -0
  135. package/src/actions/test/getAutomine.ts +11 -0
  136. package/src/actions/test/getTxpoolContent.test.ts +45 -0
  137. package/src/actions/test/getTxpoolContent.ts +7 -0
  138. package/src/actions/test/getTxpoolStatus.test.ts +41 -0
  139. package/src/actions/test/getTxpoolStatus.ts +12 -0
  140. package/src/actions/test/impersonateAccount.test.ts +28 -0
  141. package/src/actions/test/impersonateAccount.ts +17 -0
  142. package/src/actions/test/increaseTime.test.ts +18 -0
  143. package/src/actions/test/increaseTime.ts +17 -0
  144. package/src/actions/test/index.test.ts +38 -0
  145. package/src/actions/test/index.ts +77 -0
  146. package/src/actions/test/inspectTxpool.test.ts +50 -0
  147. package/src/actions/test/inspectTxpool.ts +7 -0
  148. package/src/actions/test/mine.test.ts +20 -0
  149. package/src/actions/test/mine.ts +16 -0
  150. package/src/actions/test/removeBlockTimestampInterval.test.ts +23 -0
  151. package/src/actions/test/removeBlockTimestampInterval.ts +7 -0
  152. package/src/actions/test/reset.test.ts +19 -0
  153. package/src/actions/test/reset.ts +18 -0
  154. package/src/actions/test/revert.test.ts +39 -0
  155. package/src/actions/test/revert.ts +14 -0
  156. package/src/actions/test/sendUnsignedTransaction.test.ts +52 -0
  157. package/src/actions/test/sendUnsignedTransaction.ts +19 -0
  158. package/src/actions/test/setAutomine.test.ts +14 -0
  159. package/src/actions/test/setAutomine.ts +8 -0
  160. package/src/actions/test/setBalance.test.ts +29 -0
  161. package/src/actions/test/setBalance.ts +20 -0
  162. package/src/actions/test/setBlockGasLimit.test.ts +21 -0
  163. package/src/actions/test/setBlockGasLimit.ts +17 -0
  164. package/src/actions/test/setBlockTimestampInterval.test.ts +23 -0
  165. package/src/actions/test/setBlockTimestampInterval.ts +16 -0
  166. package/src/actions/test/setCode.test.ts +26 -0
  167. package/src/actions/test/setCode.ts +19 -0
  168. package/src/actions/test/setCoinbase.test.ts +11 -0
  169. package/src/actions/test/setCoinbase.ts +17 -0
  170. package/src/actions/test/setIntervalMining.test.ts +30 -0
  171. package/src/actions/test/setIntervalMining.ts +16 -0
  172. package/src/actions/test/setLoggingEnabled.test.ts +10 -0
  173. package/src/actions/test/setLoggingEnabled.ts +8 -0
  174. package/src/actions/test/setMinGasPrice.test.ts +22 -0
  175. package/src/actions/test/setMinGasPrice.ts +17 -0
  176. package/src/actions/test/setNextBlockBaseFeePerGas.test.ts +23 -0
  177. package/src/actions/test/setNextBlockBaseFeePerGas.ts +17 -0
  178. package/src/actions/test/setNextBlockTimestamp.test.ts +19 -0
  179. package/src/actions/test/setNextBlockTimestamp.ts +17 -0
  180. package/src/actions/test/setNonce.test.ts +28 -0
  181. package/src/actions/test/setNonce.ts +20 -0
  182. package/src/actions/test/setRpcUrl.test.ts +9 -0
  183. package/src/actions/test/setRpcUrl.ts +8 -0
  184. package/src/actions/test/setStorageAt.test.ts +36 -0
  185. package/src/actions/test/setStorageAt.ts +26 -0
  186. package/src/actions/test/snapshot.test.ts +18 -0
  187. package/src/actions/test/snapshot.ts +7 -0
  188. package/src/actions/test/stopImpersonatingAccount.test.ts +31 -0
  189. package/src/actions/test/stopImpersonatingAccount.ts +17 -0
  190. package/src/actions/wallet/addChain.test.ts +14 -0
  191. package/src/actions/wallet/addChain.ts +21 -0
  192. package/src/actions/wallet/getAccounts.test.ts +22 -0
  193. package/src/actions/wallet/getAccounts.ts +7 -0
  194. package/src/actions/wallet/getPermissions.test.ts +24 -0
  195. package/src/actions/wallet/getPermissions.ts +9 -0
  196. package/src/actions/wallet/index.test.ts +19 -0
  197. package/src/actions/wallet/index.ts +27 -0
  198. package/src/actions/wallet/requestAccounts.test.ts +13 -0
  199. package/src/actions/wallet/requestAccounts.ts +7 -0
  200. package/src/actions/wallet/requestPermissions.test.ts +26 -0
  201. package/src/actions/wallet/requestPermissions.ts +19 -0
  202. package/src/actions/wallet/sendTransaction.bench.ts +57 -0
  203. package/src/actions/wallet/sendTransaction.test.ts +440 -0
  204. package/src/actions/wallet/sendTransaction.ts +76 -0
  205. package/src/actions/wallet/signMessage.test.ts +62 -0
  206. package/src/actions/wallet/signMessage.ts +35 -0
  207. package/src/actions/wallet/switchChain.test.ts +22 -0
  208. package/src/actions/wallet/switchChain.ts +19 -0
  209. package/src/actions/wallet/watchAsset.test.ts +41 -0
  210. package/src/actions/wallet/watchAsset.ts +16 -0
  211. package/src/chains.test.ts +1134 -0
  212. package/src/chains.ts +167 -0
  213. package/src/clients/createClient.test.ts +295 -0
  214. package/src/clients/createClient.ts +81 -0
  215. package/src/clients/createPublicClient.test.ts +165 -0
  216. package/src/clients/createPublicClient.ts +49 -0
  217. package/src/clients/createTestClient.test.ts +145 -0
  218. package/src/clients/createTestClient.ts +72 -0
  219. package/src/clients/createWalletClient.test.ts +121 -0
  220. package/src/clients/createWalletClient.ts +54 -0
  221. package/src/clients/index.test.ts +19 -0
  222. package/src/clients/index.ts +31 -0
  223. package/src/clients/transports/createTransport.test.ts +58 -0
  224. package/src/clients/transports/createTransport.ts +48 -0
  225. package/src/clients/transports/custom.test.ts +98 -0
  226. package/src/clients/transports/custom.ts +34 -0
  227. package/src/clients/transports/fallback.test.ts +223 -0
  228. package/src/clients/transports/fallback.ts +48 -0
  229. package/src/clients/transports/http.test.ts +110 -0
  230. package/src/clients/transports/http.ts +51 -0
  231. package/src/clients/transports/index.test.ts +15 -0
  232. package/src/clients/transports/index.ts +17 -0
  233. package/src/clients/transports/webSocket.test.ts +164 -0
  234. package/src/clients/transports/webSocket.ts +117 -0
  235. package/src/constants.test.ts +27 -0
  236. package/src/constants.ts +18 -0
  237. package/src/errors/abi.test.ts +83 -0
  238. package/src/errors/abi.ts +238 -0
  239. package/src/errors/address.test.ts +14 -0
  240. package/src/errors/address.ts +9 -0
  241. package/src/errors/base.test.ts +72 -0
  242. package/src/errors/base.ts +57 -0
  243. package/src/errors/block.test.ts +24 -0
  244. package/src/errors/block.ts +18 -0
  245. package/src/errors/contract.ts +125 -0
  246. package/src/errors/data.ts +20 -0
  247. package/src/errors/encoding.ts +60 -0
  248. package/src/errors/index.ts +77 -0
  249. package/src/errors/log.ts +8 -0
  250. package/src/errors/request.test.ts +331 -0
  251. package/src/errors/request.ts +163 -0
  252. package/src/errors/rpc.test.ts +88 -0
  253. package/src/errors/rpc.ts +113 -0
  254. package/src/errors/transaction.test.ts +83 -0
  255. package/src/errors/transaction.ts +54 -0
  256. package/src/errors/transport.test.ts +12 -0
  257. package/src/errors/transport.ts +12 -0
  258. package/src/index.test.ts +208 -0
  259. package/src/index.ts +353 -0
  260. package/src/public.ts +80 -0
  261. package/src/test.ts +51 -0
  262. package/src/types/block.ts +71 -0
  263. package/src/types/contract.ts +327 -0
  264. package/src/types/eip1193.ts +1038 -0
  265. package/src/types/fee.ts +47 -0
  266. package/src/types/filter.ts +8 -0
  267. package/src/types/index.ts +72 -0
  268. package/src/types/log.ts +22 -0
  269. package/src/types/misc.ts +4 -0
  270. package/src/types/rpc.ts +35 -0
  271. package/src/types/transaction.ts +145 -0
  272. package/src/types/utils.ts +67 -0
  273. package/src/types/window.ts +9 -0
  274. package/src/utils/abi/decodeAbi.bench.ts +135 -0
  275. package/src/utils/abi/decodeAbi.test.ts +1615 -0
  276. package/src/utils/abi/decodeAbi.ts +296 -0
  277. package/src/utils/abi/decodeDeployData.test.ts +159 -0
  278. package/src/utils/abi/decodeDeployData.ts +41 -0
  279. package/src/utils/abi/decodeErrorResult.test.ts +130 -0
  280. package/src/utils/abi/decodeErrorResult.ts +28 -0
  281. package/src/utils/abi/decodeFunctionData.test.ts +140 -0
  282. package/src/utils/abi/decodeFunctionData.ts +29 -0
  283. package/src/utils/abi/decodeFunctionResult.test.ts +262 -0
  284. package/src/utils/abi/decodeFunctionResult.ts +53 -0
  285. package/src/utils/abi/encodeAbi.bench.ts +163 -0
  286. package/src/utils/abi/encodeAbi.test.ts +1414 -0
  287. package/src/utils/abi/encodeAbi.ts +258 -0
  288. package/src/utils/abi/encodeDeployData.test.ts +131 -0
  289. package/src/utils/abi/encodeDeployData.ts +37 -0
  290. package/src/utils/abi/encodeErrorResult.test.ts +197 -0
  291. package/src/utils/abi/encodeErrorResult.ts +40 -0
  292. package/src/utils/abi/encodeEventTopics.test.ts +348 -0
  293. package/src/utils/abi/encodeEventTopics.ts +69 -0
  294. package/src/utils/abi/encodeFunctionData.test.ts +140 -0
  295. package/src/utils/abi/encodeFunctionData.ts +38 -0
  296. package/src/utils/abi/encodeFunctionResult.test.ts +284 -0
  297. package/src/utils/abi/encodeFunctionResult.ts +39 -0
  298. package/src/utils/abi/formatAbiItemWithArgs.test.ts +291 -0
  299. package/src/utils/abi/formatAbiItemWithArgs.ts +27 -0
  300. package/src/utils/abi/formatAbiItemWithParams.test.ts +335 -0
  301. package/src/utils/abi/formatAbiItemWithParams.ts +41 -0
  302. package/src/utils/abi/getAbiItem.ts +5 -0
  303. package/src/utils/abi/index.test.ts +23 -0
  304. package/src/utils/abi/index.ts +38 -0
  305. package/src/utils/address/getAddress.bench.ts +22 -0
  306. package/src/utils/address/getAddress.test.ts +46 -0
  307. package/src/utils/address/getAddress.ts +28 -0
  308. package/src/utils/address/getContractAddress.bench.ts +20 -0
  309. package/src/utils/address/getContractAddress.test.ts +78 -0
  310. package/src/utils/address/getContractAddress.ts +59 -0
  311. package/src/utils/address/index.test.ts +17 -0
  312. package/src/utils/address/index.ts +16 -0
  313. package/src/utils/address/isAddress.test.ts +10 -0
  314. package/src/utils/address/isAddress.ts +10 -0
  315. package/src/utils/address/isAddressEqual.test.ts +55 -0
  316. package/src/utils/address/isAddressEqual.ts +6 -0
  317. package/src/utils/buildRequest.test.ts +365 -0
  318. package/src/utils/buildRequest.ts +45 -0
  319. package/src/utils/contract/extractFunctionParts.test.ts +109 -0
  320. package/src/utils/contract/extractFunctionParts.ts +27 -0
  321. package/src/utils/contract/getContractError.test.ts +97 -0
  322. package/src/utils/contract/getContractError.ts +70 -0
  323. package/src/utils/contract/index.test.ts +15 -0
  324. package/src/utils/contract/index.ts +8 -0
  325. package/src/utils/data/concat.test.ts +35 -0
  326. package/src/utils/data/concat.ts +34 -0
  327. package/src/utils/data/index.test.ts +23 -0
  328. package/src/utils/data/index.ts +13 -0
  329. package/src/utils/data/isBytes.test.ts +9 -0
  330. package/src/utils/data/isBytes.ts +7 -0
  331. package/src/utils/data/isHex.test.ts +13 -0
  332. package/src/utils/data/isHex.ts +5 -0
  333. package/src/utils/data/pad.bench.ts +39 -0
  334. package/src/utils/data/pad.test.ts +367 -0
  335. package/src/utils/data/pad.ts +53 -0
  336. package/src/utils/data/size.test.ts +18 -0
  337. package/src/utils/data/size.ts +13 -0
  338. package/src/utils/data/slice.test.ts +203 -0
  339. package/src/utils/data/slice.ts +60 -0
  340. package/src/utils/data/trim.bench.ts +50 -0
  341. package/src/utils/data/trim.test.ts +175 -0
  342. package/src/utils/data/trim.ts +33 -0
  343. package/src/utils/encoding/decodeBytes.bench.ts +40 -0
  344. package/src/utils/encoding/decodeBytes.test.ts +144 -0
  345. package/src/utils/encoding/decodeBytes.ts +63 -0
  346. package/src/utils/encoding/decodeHex.bench.ts +24 -0
  347. package/src/utils/encoding/decodeHex.test.ts +167 -0
  348. package/src/utils/encoding/decodeHex.ts +76 -0
  349. package/src/utils/encoding/decodeRlp.bench.ts +34 -0
  350. package/src/utils/encoding/decodeRlp.test.ts +350 -0
  351. package/src/utils/encoding/decodeRlp.ts +121 -0
  352. package/src/utils/encoding/encodeBytes.bench.ts +41 -0
  353. package/src/utils/encoding/encodeBytes.test.ts +676 -0
  354. package/src/utils/encoding/encodeBytes.ts +59 -0
  355. package/src/utils/encoding/encodeHex.bench.ts +60 -0
  356. package/src/utils/encoding/encodeHex.test.ts +232 -0
  357. package/src/utils/encoding/encodeHex.ts +104 -0
  358. package/src/utils/encoding/encodeRlp.bench.ts +54 -0
  359. package/src/utils/encoding/encodeRlp.test.ts +254 -0
  360. package/src/utils/encoding/encodeRlp.ts +48 -0
  361. package/src/utils/encoding/index.test.ts +32 -0
  362. package/src/utils/encoding/index.ts +36 -0
  363. package/src/utils/formatters/block.bench.ts +51 -0
  364. package/src/utils/formatters/block.test.ts +115 -0
  365. package/src/utils/formatters/block.ts +36 -0
  366. package/src/utils/formatters/extract.test.ts +14 -0
  367. package/src/utils/formatters/extract.ts +18 -0
  368. package/src/utils/formatters/feeHistory.test.ts +66 -0
  369. package/src/utils/formatters/feeHistory.ts +12 -0
  370. package/src/utils/formatters/format.test.ts +93 -0
  371. package/src/utils/formatters/format.ts +53 -0
  372. package/src/utils/formatters/index.test.ts +17 -0
  373. package/src/utils/formatters/index.ts +24 -0
  374. package/src/utils/formatters/log.test.ts +79 -0
  375. package/src/utils/formatters/log.ts +12 -0
  376. package/src/utils/formatters/transaction.test.ts +271 -0
  377. package/src/utils/formatters/transaction.ts +51 -0
  378. package/src/utils/formatters/transactionReceipt.bench.ts +73 -0
  379. package/src/utils/formatters/transactionReceipt.test.ts +151 -0
  380. package/src/utils/formatters/transactionReceipt.ts +54 -0
  381. package/src/utils/formatters/transactionRequest.bench.ts +29 -0
  382. package/src/utils/formatters/transactionRequest.test.ts +237 -0
  383. package/src/utils/formatters/transactionRequest.ts +47 -0
  384. package/src/utils/hash/getEventSignature.test.ts +61 -0
  385. package/src/utils/hash/getEventSignature.ts +4 -0
  386. package/src/utils/hash/getFunctionSignature.test.ts +22 -0
  387. package/src/utils/hash/getFunctionSignature.ts +5 -0
  388. package/src/utils/hash/hashFunction.test.ts +65 -0
  389. package/src/utils/hash/hashFunction.ts +12 -0
  390. package/src/utils/hash/index.test.ts +13 -0
  391. package/src/utils/hash/index.ts +5 -0
  392. package/src/utils/hash/keccak256.test.ts +59 -0
  393. package/src/utils/hash/keccak256.ts +23 -0
  394. package/src/utils/index.test.ts +87 -0
  395. package/src/utils/index.ts +126 -0
  396. package/src/utils/observe.test.ts +176 -0
  397. package/src/utils/observe.ts +66 -0
  398. package/src/utils/poll.test.ts +127 -0
  399. package/src/utils/poll.ts +42 -0
  400. package/src/utils/promise/index.test.ts +14 -0
  401. package/src/utils/promise/index.ts +3 -0
  402. package/src/utils/promise/withCache.test.ts +97 -0
  403. package/src/utils/promise/withCache.ts +73 -0
  404. package/src/utils/promise/withRetry.test.ts +231 -0
  405. package/src/utils/promise/withRetry.ts +61 -0
  406. package/src/utils/promise/withTimeout.test.ts +37 -0
  407. package/src/utils/promise/withTimeout.ts +39 -0
  408. package/src/utils/rpc.test.ts +992 -0
  409. package/src/utils/rpc.ts +292 -0
  410. package/src/utils/stringify.test.ts +13 -0
  411. package/src/utils/stringify.ts +5 -0
  412. package/src/utils/uid.ts +14 -0
  413. package/src/utils/unit/formatEther.test.ts +75 -0
  414. package/src/utils/unit/formatEther.ts +6 -0
  415. package/src/utils/unit/formatGwei.test.ts +32 -0
  416. package/src/utils/unit/formatGwei.ts +6 -0
  417. package/src/utils/unit/formatUnit.bench.ts +26 -0
  418. package/src/utils/unit/formatUnit.test.ts +40 -0
  419. package/src/utils/unit/formatUnit.ts +16 -0
  420. package/src/utils/unit/index.test.ts +16 -0
  421. package/src/utils/unit/index.ts +6 -0
  422. package/src/utils/unit/parseEther.test.ts +126 -0
  423. package/src/utils/unit/parseEther.ts +6 -0
  424. package/src/utils/unit/parseGwei.test.ts +50 -0
  425. package/src/utils/unit/parseGwei.ts +6 -0
  426. package/src/utils/unit/parseUnit.bench.ts +26 -0
  427. package/src/utils/unit/parseUnit.test.ts +54 -0
  428. package/src/utils/unit/parseUnit.ts +27 -0
  429. package/src/utils/wait.ts +3 -0
  430. package/src/wallet.ts +23 -0
  431. package/src/window.ts +1 -0
@@ -0,0 +1,1134 @@
1
+ import { describe, expect, test } from 'vitest'
2
+
3
+ import * as chains from './chains'
4
+
5
+ test('exports chains', () => {
6
+ expect(chains).toMatchInlineSnapshot(`
7
+ {
8
+ "arbitrum": {
9
+ "blockExplorers": {
10
+ "default": {
11
+ "name": "Arbiscan",
12
+ "url": "https://arbiscan.io",
13
+ },
14
+ "etherscan": {
15
+ "name": "Arbiscan",
16
+ "url": "https://arbiscan.io",
17
+ },
18
+ },
19
+ "contracts": {
20
+ "multicall3": {
21
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
22
+ "blockCreated": 7654707,
23
+ },
24
+ },
25
+ "id": 42161,
26
+ "name": "Arbitrum One",
27
+ "nativeCurrency": {
28
+ "decimals": 18,
29
+ "name": "Ether",
30
+ "symbol": "ETH",
31
+ },
32
+ "network": "arbitrum",
33
+ "rpcUrls": {
34
+ "alchemy": {
35
+ "http": [
36
+ "https://arb-mainnet.g.alchemy.com/v2",
37
+ ],
38
+ "webSocket": [
39
+ "wss://arb-mainnet.g.alchemy.com/v2",
40
+ ],
41
+ },
42
+ "default": {
43
+ "http": [
44
+ "https://arb1.arbitrum.io/rpc",
45
+ ],
46
+ },
47
+ "infura": {
48
+ "http": [
49
+ "https://arbitrum-mainnet.infura.io/v3",
50
+ ],
51
+ "webSocket": [
52
+ "wss://arbitrum-mainnet.infura.io/ws/v3",
53
+ ],
54
+ },
55
+ "public": {
56
+ "http": [
57
+ "https://arb1.arbitrum.io/rpc",
58
+ ],
59
+ },
60
+ },
61
+ },
62
+ "arbitrumGoerli": {
63
+ "blockExplorers": {
64
+ "default": {
65
+ "name": "Arbiscan",
66
+ "url": "https://goerli.arbiscan.io/",
67
+ },
68
+ "etherscan": {
69
+ "name": "Arbiscan",
70
+ "url": "https://goerli.arbiscan.io/",
71
+ },
72
+ },
73
+ "contracts": {
74
+ "multicall3": {
75
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
76
+ "blockCreated": 88114,
77
+ },
78
+ },
79
+ "id": 421613,
80
+ "name": "Arbitrum Goerli",
81
+ "nativeCurrency": {
82
+ "decimals": 18,
83
+ "name": "Arbitrum Goerli Ether",
84
+ "symbol": "ETH",
85
+ },
86
+ "network": "arbitrum-goerli",
87
+ "rpcUrls": {
88
+ "alchemy": {
89
+ "http": [
90
+ "https://arb-goerli.g.alchemy.com/v2",
91
+ ],
92
+ "webSocket": [
93
+ "wss://arb-goerli.g.alchemy.com/v2",
94
+ ],
95
+ },
96
+ "default": {
97
+ "http": [
98
+ "https://goerli-rollup.arbitrum.io/rpc",
99
+ ],
100
+ },
101
+ "infura": {
102
+ "http": [
103
+ "https://arbitrum-goerli.infura.io/v3",
104
+ ],
105
+ "webSocket": [
106
+ "wss://arbitrum-goerli.infura.io/ws/v3",
107
+ ],
108
+ },
109
+ "public": {
110
+ "http": [
111
+ "https://goerli-rollup.arbitrum.io/rpc",
112
+ ],
113
+ },
114
+ },
115
+ "testnet": true,
116
+ },
117
+ "avalanche": {
118
+ "blockExplorers": {
119
+ "default": {
120
+ "name": "SnowTrace",
121
+ "url": "https://snowtrace.io",
122
+ },
123
+ "etherscan": {
124
+ "name": "SnowTrace",
125
+ "url": "https://snowtrace.io",
126
+ },
127
+ },
128
+ "contracts": {
129
+ "multicall3": {
130
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
131
+ "blockCreated": 11907934,
132
+ },
133
+ },
134
+ "id": 43114,
135
+ "name": "Avalanche",
136
+ "nativeCurrency": {
137
+ "decimals": 18,
138
+ "name": "Avalanche",
139
+ "symbol": "AVAX",
140
+ },
141
+ "network": "avalanche",
142
+ "rpcUrls": {
143
+ "default": {
144
+ "http": [
145
+ "https://api.avax.network/ext/bc/C/rpc",
146
+ ],
147
+ },
148
+ "public": {
149
+ "http": [
150
+ "https://api.avax.network/ext/bc/C/rpc",
151
+ ],
152
+ },
153
+ },
154
+ },
155
+ "avalancheFuji": {
156
+ "blockExplorers": {
157
+ "default": {
158
+ "name": "SnowTrace",
159
+ "url": "https://testnet.snowtrace.io",
160
+ },
161
+ "etherscan": {
162
+ "name": "SnowTrace",
163
+ "url": "https://testnet.snowtrace.io",
164
+ },
165
+ },
166
+ "contracts": {
167
+ "multicall3": {
168
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
169
+ "blockCreated": 7096959,
170
+ },
171
+ },
172
+ "id": 43113,
173
+ "name": "Avalanche Fuji",
174
+ "nativeCurrency": {
175
+ "decimals": 18,
176
+ "name": "Avalanche Fuji",
177
+ "symbol": "AVAX",
178
+ },
179
+ "network": "avalanche-fuji",
180
+ "rpcUrls": {
181
+ "default": {
182
+ "http": [
183
+ "https://api.avax-test.network/ext/bc/C/rpc",
184
+ ],
185
+ },
186
+ "public": {
187
+ "http": [
188
+ "https://api.avax-test.network/ext/bc/C/rpc",
189
+ ],
190
+ },
191
+ },
192
+ "testnet": true,
193
+ },
194
+ "bsc": {
195
+ "blockExplorers": {
196
+ "default": {
197
+ "name": "BscScan",
198
+ "url": "https://bscscan.com",
199
+ },
200
+ "etherscan": {
201
+ "name": "BscScan",
202
+ "url": "https://bscscan.com",
203
+ },
204
+ },
205
+ "contracts": {
206
+ "multicall3": {
207
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
208
+ "blockCreated": 15921452,
209
+ },
210
+ },
211
+ "id": 56,
212
+ "name": "BNB Smart Chain",
213
+ "nativeCurrency": {
214
+ "decimals": 18,
215
+ "name": "BNB",
216
+ "symbol": "BNB",
217
+ },
218
+ "network": "bsc",
219
+ "rpcUrls": {
220
+ "default": {
221
+ "http": [
222
+ "https://rpc.ankr.com/bsc",
223
+ ],
224
+ },
225
+ "public": {
226
+ "http": [
227
+ "https://rpc.ankr.com/bsc",
228
+ ],
229
+ },
230
+ },
231
+ },
232
+ "bscTestnet": {
233
+ "blockExplorers": {
234
+ "default": {
235
+ "name": "BscScan",
236
+ "url": "https://testnet.bscscan.com",
237
+ },
238
+ "etherscan": {
239
+ "name": "BscScan",
240
+ "url": "https://testnet.bscscan.com",
241
+ },
242
+ },
243
+ "contracts": {
244
+ "multicall3": {
245
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
246
+ "blockCreated": 17422483,
247
+ },
248
+ },
249
+ "id": 97,
250
+ "name": "Binance Smart Chain Testnet",
251
+ "nativeCurrency": {
252
+ "decimals": 18,
253
+ "name": "BNB",
254
+ "symbol": "tBNB",
255
+ },
256
+ "network": "bsc-testnet",
257
+ "rpcUrls": {
258
+ "default": {
259
+ "http": [
260
+ "https://bsc-testnet.public.blastapi.io",
261
+ ],
262
+ },
263
+ "public": {
264
+ "http": [
265
+ "https://bsc-testnet.public.blastapi.io",
266
+ ],
267
+ },
268
+ },
269
+ "testnet": true,
270
+ },
271
+ "celo": {
272
+ "formatters": {
273
+ "block": [Function],
274
+ "transaction": [Function],
275
+ "transactionRequest": [Function],
276
+ },
277
+ "id": 42220,
278
+ "name": "Celo",
279
+ "nativeCurrency": {
280
+ "decimals": 18,
281
+ "name": "Celo",
282
+ "symbol": "CELO",
283
+ },
284
+ "network": "celo",
285
+ "rpcUrls": {
286
+ "default": {
287
+ "http": [
288
+ "https://rpc.ankr.com/celo",
289
+ ],
290
+ },
291
+ "public": {
292
+ "http": [
293
+ "https://rpc.ankr.com/celo",
294
+ ],
295
+ },
296
+ },
297
+ },
298
+ "defineBlock": [Function],
299
+ "defineChain": [Function],
300
+ "defineTransaction": [Function],
301
+ "defineTransactionReceipt": [Function],
302
+ "defineTransactionRequest": [Function],
303
+ "fantom": {
304
+ "blockExplorers": {
305
+ "default": {
306
+ "name": "FTMScan",
307
+ "url": "https://ftmscan.com",
308
+ },
309
+ "etherscan": {
310
+ "name": "FTMScan",
311
+ "url": "https://ftmscan.com",
312
+ },
313
+ },
314
+ "contracts": {
315
+ "multicall3": {
316
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
317
+ "blockCreated": 33001987,
318
+ },
319
+ },
320
+ "id": 250,
321
+ "name": "Fantom",
322
+ "nativeCurrency": {
323
+ "decimals": 18,
324
+ "name": "Fantom",
325
+ "symbol": "FTM",
326
+ },
327
+ "network": "fantom",
328
+ "rpcUrls": {
329
+ "default": {
330
+ "http": [
331
+ "https://rpc.ankr.com/fantom",
332
+ ],
333
+ },
334
+ "public": {
335
+ "http": [
336
+ "https://rpc.ankr.com/fantom",
337
+ ],
338
+ },
339
+ },
340
+ },
341
+ "fantomTestnet": {
342
+ "blockExplorers": {
343
+ "default": {
344
+ "name": "FTMScan",
345
+ "url": "https://testnet.ftmscan.com",
346
+ },
347
+ "etherscan": {
348
+ "name": "FTMScan",
349
+ "url": "https://testnet.ftmscan.com",
350
+ },
351
+ },
352
+ "contracts": {
353
+ "multicall3": {
354
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
355
+ "blockCreated": 8328688,
356
+ },
357
+ },
358
+ "id": 4002,
359
+ "name": "Fantom Testnet",
360
+ "nativeCurrency": {
361
+ "decimals": 18,
362
+ "name": "Fantom",
363
+ "symbol": "FTM",
364
+ },
365
+ "network": "fantom-testnet",
366
+ "rpcUrls": {
367
+ "default": {
368
+ "http": [
369
+ "https://rpc.testnet.fantom.network",
370
+ ],
371
+ },
372
+ "public": {
373
+ "http": [
374
+ "https://rpc.testnet.fantom.network",
375
+ ],
376
+ },
377
+ },
378
+ },
379
+ "foundry": {
380
+ "id": 31337,
381
+ "name": "Foundry",
382
+ "nativeCurrency": {
383
+ "decimals": 18,
384
+ "name": "Ether",
385
+ "symbol": "ETH",
386
+ },
387
+ "network": "foundry",
388
+ "rpcUrls": {
389
+ "default": {
390
+ "http": [
391
+ "http://127.0.0.1:8545",
392
+ ],
393
+ },
394
+ "public": {
395
+ "http": [
396
+ "http://127.0.0.1:8545",
397
+ ],
398
+ },
399
+ },
400
+ },
401
+ "goerli": {
402
+ "blockExplorers": {
403
+ "default": {
404
+ "name": "Etherscan",
405
+ "url": "https://goerli.etherscan.io",
406
+ },
407
+ "etherscan": {
408
+ "name": "Etherscan",
409
+ "url": "https://goerli.etherscan.io",
410
+ },
411
+ },
412
+ "contracts": {
413
+ "ensRegistry": {
414
+ "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
415
+ },
416
+ "multicall3": {
417
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
418
+ "blockCreated": 6507670,
419
+ },
420
+ },
421
+ "id": 5,
422
+ "name": "Goerli",
423
+ "nativeCurrency": {
424
+ "decimals": 18,
425
+ "name": "Goerli Ether",
426
+ "symbol": "ETH",
427
+ },
428
+ "network": "goerli",
429
+ "rpcUrls": {
430
+ "alchemy": {
431
+ "http": [
432
+ "https://eth-goerli.g.alchemy.com/v2",
433
+ ],
434
+ "webSocket": [
435
+ "wss://eth-goerli.g.alchemy.com/v2",
436
+ ],
437
+ },
438
+ "default": {
439
+ "http": [
440
+ "https://rpc.ankr.com/eth_goerli",
441
+ ],
442
+ },
443
+ "infura": {
444
+ "http": [
445
+ "https://goerli.infura.io/v3",
446
+ ],
447
+ "webSocket": [
448
+ "wss://goerli.infura.io/ws/v3",
449
+ ],
450
+ },
451
+ "public": {
452
+ "http": [
453
+ "https://rpc.ankr.com/eth_goerli",
454
+ ],
455
+ },
456
+ },
457
+ "testnet": true,
458
+ },
459
+ "hardhat": {
460
+ "id": 31337,
461
+ "name": "Hardhat",
462
+ "nativeCurrency": {
463
+ "decimals": 18,
464
+ "name": "Ether",
465
+ "symbol": "ETH",
466
+ },
467
+ "network": "hardhat",
468
+ "rpcUrls": {
469
+ "default": {
470
+ "http": [
471
+ "http://127.0.0.1:8545",
472
+ ],
473
+ },
474
+ "public": {
475
+ "http": [
476
+ "http://127.0.0.1:8545",
477
+ ],
478
+ },
479
+ },
480
+ },
481
+ "localhost": {
482
+ "id": 1337,
483
+ "name": "Localhost",
484
+ "nativeCurrency": {
485
+ "decimals": 18,
486
+ "name": "Ether",
487
+ "symbol": "ETH",
488
+ },
489
+ "network": "localhost",
490
+ "rpcUrls": {
491
+ "default": {
492
+ "http": [
493
+ "http://127.0.0.1:8545",
494
+ ],
495
+ },
496
+ "public": {
497
+ "http": [
498
+ "http://127.0.0.1:8545",
499
+ ],
500
+ },
501
+ },
502
+ },
503
+ "mainnet": {
504
+ "blockExplorers": {
505
+ "default": {
506
+ "name": "Etherscan",
507
+ "url": "https://etherscan.io",
508
+ },
509
+ "etherscan": {
510
+ "name": "Etherscan",
511
+ "url": "https://etherscan.io",
512
+ },
513
+ },
514
+ "contracts": {
515
+ "ensRegistry": {
516
+ "address": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
517
+ },
518
+ "multicall3": {
519
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
520
+ "blockCreated": 14353601,
521
+ },
522
+ },
523
+ "id": 1,
524
+ "name": "Ethereum",
525
+ "nativeCurrency": {
526
+ "decimals": 18,
527
+ "name": "Ether",
528
+ "symbol": "ETH",
529
+ },
530
+ "network": "homestead",
531
+ "rpcUrls": {
532
+ "alchemy": {
533
+ "http": [
534
+ "https://eth-mainnet.g.alchemy.com/v2",
535
+ ],
536
+ "webSocket": [
537
+ "wss://eth-mainnet.g.alchemy.com/v2",
538
+ ],
539
+ },
540
+ "default": {
541
+ "http": [
542
+ "https://cloudflare-eth.com",
543
+ ],
544
+ },
545
+ "infura": {
546
+ "http": [
547
+ "https://mainnet.infura.io/v3",
548
+ ],
549
+ "webSocket": [
550
+ "wss://mainnet.infura.io/ws/v3",
551
+ ],
552
+ },
553
+ "public": {
554
+ "http": [
555
+ "https://cloudflare-eth.com",
556
+ ],
557
+ },
558
+ },
559
+ },
560
+ "optimism": {
561
+ "blockExplorers": {
562
+ "default": {
563
+ "name": "Optimism Explorer",
564
+ "url": "https://explorer.optimism.io",
565
+ },
566
+ "etherscan": {
567
+ "name": "Etherscan",
568
+ "url": "https://optimistic.etherscan.io",
569
+ },
570
+ },
571
+ "contracts": {
572
+ "multicall3": {
573
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
574
+ "blockCreated": 4286263,
575
+ },
576
+ },
577
+ "id": 10,
578
+ "name": "Optimism",
579
+ "nativeCurrency": {
580
+ "decimals": 18,
581
+ "name": "Ether",
582
+ "symbol": "ETH",
583
+ },
584
+ "network": "optimism",
585
+ "rpcUrls": {
586
+ "alchemy": {
587
+ "http": [
588
+ "https://opt-mainnet.g.alchemy.com/v2",
589
+ ],
590
+ "webSocket": [
591
+ "wss://opt-mainnet.g.alchemy.com/v2",
592
+ ],
593
+ },
594
+ "default": {
595
+ "http": [
596
+ "https://mainnet.optimism.io",
597
+ ],
598
+ },
599
+ "infura": {
600
+ "http": [
601
+ "https://optimism-mainnet.infura.io/v3",
602
+ ],
603
+ "webSocket": [
604
+ "wss://optimism-mainnet.infura.io/ws/v3",
605
+ ],
606
+ },
607
+ "public": {
608
+ "http": [
609
+ "https://mainnet.optimism.io",
610
+ ],
611
+ },
612
+ },
613
+ },
614
+ "optimismGoerli": {
615
+ "blockExplorers": {
616
+ "default": {
617
+ "name": "Etherscan",
618
+ "url": "https://goerli-optimism.etherscan.io",
619
+ },
620
+ "etherscan": {
621
+ "name": "Etherscan",
622
+ "url": "https://goerli-optimism.etherscan.io",
623
+ },
624
+ },
625
+ "contracts": {
626
+ "multicall3": {
627
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
628
+ "blockCreated": 49461,
629
+ },
630
+ },
631
+ "id": 420,
632
+ "name": "Optimism Goerli",
633
+ "nativeCurrency": {
634
+ "decimals": 18,
635
+ "name": "Goerli Ether",
636
+ "symbol": "ETH",
637
+ },
638
+ "network": "optimism-goerli",
639
+ "rpcUrls": {
640
+ "alchemy": {
641
+ "http": [
642
+ "https://opt-goerli.g.alchemy.com/v2",
643
+ ],
644
+ "webSocket": [
645
+ "wss://opt-goerli.g.alchemy.com/v2",
646
+ ],
647
+ },
648
+ "default": {
649
+ "http": [
650
+ "https://goerli.optimism.io",
651
+ ],
652
+ },
653
+ "infura": {
654
+ "http": [
655
+ "https://optimism-goerli.infura.io/v3",
656
+ ],
657
+ "webSocket": [
658
+ "wss://optimism-goerli.infura.io/ws/v3",
659
+ ],
660
+ },
661
+ "public": {
662
+ "http": [
663
+ "https://goerli.optimism.io",
664
+ ],
665
+ },
666
+ },
667
+ "testnet": true,
668
+ },
669
+ "polygon": {
670
+ "blockExplorers": {
671
+ "default": {
672
+ "name": "PolygonScan",
673
+ "url": "https://polygonscan.com",
674
+ },
675
+ "etherscan": {
676
+ "name": "PolygonScan",
677
+ "url": "https://polygonscan.com",
678
+ },
679
+ },
680
+ "contracts": {
681
+ "multicall3": {
682
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
683
+ "blockCreated": 25770160,
684
+ },
685
+ },
686
+ "id": 137,
687
+ "name": "Polygon",
688
+ "nativeCurrency": {
689
+ "decimals": 18,
690
+ "name": "MATIC",
691
+ "symbol": "MATIC",
692
+ },
693
+ "network": "matic",
694
+ "rpcUrls": {
695
+ "alchemy": {
696
+ "http": [
697
+ "https://polygon-mainnet.g.alchemy.com/v2",
698
+ ],
699
+ "webSocket": [
700
+ "wss://polygon-mainnet.g.alchemy.com/v2",
701
+ ],
702
+ },
703
+ "default": {
704
+ "http": [
705
+ "https://polygon-rpc.com",
706
+ ],
707
+ },
708
+ "infura": {
709
+ "http": [
710
+ "https://polygon-mainnet.infura.io/v3",
711
+ ],
712
+ "webSocket": [
713
+ "wss://polygon-mainnet.infura.io/ws/v3",
714
+ ],
715
+ },
716
+ "public": {
717
+ "http": [
718
+ "https://polygon-rpc.com",
719
+ ],
720
+ },
721
+ },
722
+ },
723
+ "polygonMumbai": {
724
+ "blockExplorers": {
725
+ "default": {
726
+ "name": "PolygonScan",
727
+ "url": "https://mumbai.polygonscan.com",
728
+ },
729
+ "etherscan": {
730
+ "name": "PolygonScan",
731
+ "url": "https://mumbai.polygonscan.com",
732
+ },
733
+ },
734
+ "contracts": {
735
+ "multicall3": {
736
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
737
+ "blockCreated": 25770160,
738
+ },
739
+ },
740
+ "id": 80001,
741
+ "name": "Polygon Mumbai",
742
+ "nativeCurrency": {
743
+ "decimals": 18,
744
+ "name": "MATIC",
745
+ "symbol": "MATIC",
746
+ },
747
+ "network": "maticmum",
748
+ "rpcUrls": {
749
+ "alchemy": {
750
+ "http": [
751
+ "https://polygon-mumbai.g.alchemy.com/v2",
752
+ ],
753
+ "webSocket": [
754
+ "wss://polygon-mumbai.g.alchemy.com/v2",
755
+ ],
756
+ },
757
+ "default": {
758
+ "http": [
759
+ "https://matic-mumbai.chainstacklabs.com",
760
+ ],
761
+ },
762
+ "infura": {
763
+ "http": [
764
+ "https://polygon-mumbai.infura.io/v3",
765
+ ],
766
+ "webSocket": [
767
+ "wss://polygon-mumbai.infura.io/ws/v3",
768
+ ],
769
+ },
770
+ "public": {
771
+ "http": [
772
+ "https://matic-mumbai.chainstacklabs.com",
773
+ ],
774
+ },
775
+ },
776
+ "testnet": true,
777
+ },
778
+ "sepolia": {
779
+ "blockExplorers": {
780
+ "default": {
781
+ "name": "Etherscan",
782
+ "url": "https://sepolia.etherscan.io",
783
+ },
784
+ "etherscan": {
785
+ "name": "Etherscan",
786
+ "url": "https://sepolia.etherscan.io",
787
+ },
788
+ },
789
+ "contracts": {
790
+ "multicall3": {
791
+ "address": "0xca11bde05977b3631167028862be2a173976ca11",
792
+ "blockCreated": 6507670,
793
+ },
794
+ },
795
+ "id": 11155111,
796
+ "name": "Sepolia",
797
+ "nativeCurrency": {
798
+ "decimals": 18,
799
+ "name": "Sepolia Ether",
800
+ "symbol": "SEP",
801
+ },
802
+ "network": "sepolia",
803
+ "rpcUrls": {
804
+ "default": {
805
+ "http": [
806
+ "https://rpc.sepolia.org",
807
+ ],
808
+ },
809
+ "infura": {
810
+ "http": [
811
+ "https://sepolia.infura.io/v3",
812
+ ],
813
+ "webSocket": [
814
+ "wss://sepolia.infura.io/ws/v3",
815
+ ],
816
+ },
817
+ "public": {
818
+ "http": [
819
+ "https://rpc.sepolia.org",
820
+ ],
821
+ },
822
+ },
823
+ "testnet": true,
824
+ },
825
+ }
826
+ `)
827
+ })
828
+
829
+ describe('defineChain', () => {
830
+ test('default', () => {
831
+ expect(
832
+ chains.defineChain({
833
+ id: 42220,
834
+ name: 'Celo',
835
+ network: 'celo',
836
+ nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 },
837
+ rpcUrls: {
838
+ public: { http: ['https://rpc.ankr.com/celo'] },
839
+ default: { http: ['https://rpc.ankr.com/celo'] },
840
+ },
841
+ }),
842
+ ).toMatchInlineSnapshot(`
843
+ {
844
+ "id": 42220,
845
+ "name": "Celo",
846
+ "nativeCurrency": {
847
+ "decimals": 18,
848
+ "name": "Celo",
849
+ "symbol": "CELO",
850
+ },
851
+ "network": "celo",
852
+ "rpcUrls": {
853
+ "default": {
854
+ "http": [
855
+ "https://rpc.ankr.com/celo",
856
+ ],
857
+ },
858
+ "public": {
859
+ "http": [
860
+ "https://rpc.ankr.com/celo",
861
+ ],
862
+ },
863
+ },
864
+ }
865
+ `)
866
+ })
867
+
868
+ test('args: formatters', () => {
869
+ const { block, transaction, transactionRequest } = chains.celo.formatters!
870
+
871
+ expect(
872
+ block({
873
+ baseFeePerGas: '0x0',
874
+ extraData:
875
+ '0xd983010700846765746889676f312e31372e3133856c696e7578000000000000f8ccc0c080b84169807e4d7934803decfde330167e444ec323431e1ff4cd70f40f2e79f24ce91f60340b99f97e3562ee57389e2c72343a74379e0b8b7ca5237ec141e84278bb3e00f8418e3e8af95497b7f6ffe7d3c4cbfbbdb06b26f6f3e913ca2cb7dff23532eaf3eb9f3b06ae75498c88353d279cf58fb0570736e2aa20cf53381722b6485f0f3c8180f8418e3fffffffffffffffffffffffffffb0005d23be939b9f8135e6b1ff283baff985c1b6ccacf2b6aa7fbd8939c4b6178b1d242b574a614b6347182a3b3195258080',
876
+ gasUsed: '0x1',
877
+ hash: '0xac8c9bc3b84e103dc321bbe83b670e425ff68bfc9a333a4f1b1b204ad11c583d',
878
+ logsBloom:
879
+ '0x02004000004200000000000000800020000000000000400002040000002020000000802000000000000180000001000020800000000000000000000000000000000000000022000260000008000800000000000000000000000000000000000000000008000410002100000140000800000044c00200000000400010000800008800000080000000000010000040000000000000000000000000000000800020028000000100000000000000000000002002881000000000000800020000040020900402020000180000000000000040000800000011020090002000400000200010002000001000000000000080000000000000000000000000000004000000',
880
+ miner: '0xe267d978037b89db06c6a5fcf82fad8297e290ff',
881
+ number: '0x2',
882
+ parentHash:
883
+ '0xf6e57c99be5a81167bcb7bdf8d55572235384182c71635857ace2c04d25294ed',
884
+ randomness: {
885
+ committed:
886
+ '0x339714505ecf55eacc2d2568ea53a7424bd0aa40fd710fd6892464d0716da711',
887
+ revealed:
888
+ '0xe10b5f01b0376fdc9151f66992f8c1b990083acabc14ec1b04f6a53ad804db88',
889
+ },
890
+ receiptsRoot:
891
+ '0xca8aabc507534e45c982aa43e38118fc6f9cf222800e3d703a6e299a2e661f2a',
892
+ size: '0x3',
893
+ stateRoot:
894
+ '0x051c8e40ed3d8afabbad5321a4bb6b9d686a8a62d9b696b3e5a5c769c3623d48',
895
+ timestamp: '0x4',
896
+ totalDifficulty: '0x5',
897
+ transactions: [
898
+ '0x487efb864b308ee85afd7ed5954e968457cfe84e71726114b0a44f31fb876e85',
899
+ '0x3aa054b868fb0ce99388d74165b6128a5aca0992a785eb73a84fb7532f02a6a3',
900
+ '0x7273f2bf436b14621094de5694d5aced028666389c7a89f4a863ac33d653cf52',
901
+ '0xe5240102364623faf753498c52102de4a5f9641ceb6f99d9c92b032716e2f8f9',
902
+ '0x92c31e9e4397e08a5abcccd8cc466e73d554be16da1ca7cac6a01b643f806524',
903
+ '0x0acc190dfc0bbc6c9823dc17ff815c94e1494b60f9be9b6e045cbad572fdbdb1',
904
+ '0x27c8cff64388e80b279407758d6801fe0dfe3410bacc7051deddf6c49c16710c',
905
+ '0x6d4e4a0a01b1ebbb8be5cddede5de036779bd230ffc22e465eaa6128bd552ecb',
906
+ '0xa80107ba2f636428883a71b7ce8a23171faf5076bae51e3a68e046c143434ed9',
907
+ '0xcdadac0ee4a8901992ee365b7d251ff567134b007d2ad2d6a2285f7091998d60',
908
+ '0xdff49ec96503acbd0110a8200f0f18b9924978bc5db32ae5c47a0986bcb58b58',
909
+ '0xb0591b97ed1f7779e5cd548a9acfdad535d9073a3879d5bd4e3ff053bce31c5f',
910
+ '0xa58e9da5702648d3f3f81e44952d5072b07b10eb13477a877cf3d957443b5605',
911
+ '0x00d3bf8dc0ed9b62a786ce2fe1bec7de9d0ba286421acd3c4942b055b0741c0c',
912
+ '0xf02343c58c6ef8007e86840e8ac9f8c2a6c52c7877b7554e87711efaab49d50a',
913
+ '0x063f62e3c507eb0102f9dbe887520db4a1d3d34c4279f646bc3fc2c76e074369',
914
+ '0xbeb28f46cc143db996e14fa35591cb5de4dcc92a569422f68f87f3f6a72a0e64',
915
+ '0x9a38f385833a2c1ea159031f12c3e1af4033860c389afb69d77d1b897f37c452',
916
+ '0xae6dbf3554a531e0ad6c51ec1e2201b41859f466dbb0ca3364fa7237fb0c60f3',
917
+ '0x789aca8285c9e0ce2deb306f2c2f0f53df9b3601e295bdc0838a8622bd697be6',
918
+ '0x230ebdcd6c3282992c8793f23eb847f955220f2a6c14bb82b38bc48ccf0cf1c4',
919
+ '0xad7f4b13ac995055b681cb64f90bfe2863582e49d1179b837ebde353117ab2b4',
920
+ '0xe40fc6bbacf5cfc1f6c41f06737d7df6274aef89a9c46bbe4fb8cb8484ffa54b',
921
+ '0xa78f1aa9b1a0a2130477c0ed9df303c033c5c852240689a9ec34347333defa42',
922
+ '0x3b10b4297066dbac52031920159034ef43544b77fc82c5fcc561df7208064b2f',
923
+ '0x5d73e6bb86089544825ca8c8ca2091744b7fd25bdd36a8b4d9941968be76a845',
924
+ '0x2f5d0deb26329807564b18ecbf24d9cb9d802d92369ea48c78fb973e1ea78994',
925
+ '0x086a6ff358bce56bcbc022978b1b84448143ae66de7f9e0c3f7a68bce7664135',
926
+ '0x8f36d90a6da392b377162caa1f81a5f0e3882c48794bea979bf79f119bb9284d',
927
+ '0xe0a475e8a6f9495b00a55d8472b108171bf11a51cb8db131c98c25a17d0ac78c',
928
+ '0x8ba00695bd7b524ff55fbbda3f17c6e93056e6895089de2ee29d58541e11b88f',
929
+ '0xf971ed0462249050dbeaa4a812c2b881957d4225587dcd10c88581ca6b096a36',
930
+ '0x229ab6e46f4be57cb81f8c7b2070f19827e55d4162c72b4abf26e618521eaaee',
931
+ '0x99601bf74f39ef88dabd853b40e86bc9653899a93af85518fe73ecf372578588',
932
+ '0x5deaa0abfd7689d3c33543a3d3b1bebc3dba46acd72246775fabb0bb5561e410',
933
+ '0x413bada477356cdf02680950e2d0368ce3614eccc4a6c245fabd54ee07253f60',
934
+ ],
935
+ transactionsRoot:
936
+ '0xb293e2c4ce20a9eac253241e750a5592c9d3c1b27bf090d0fc2fa4756a038866',
937
+ }),
938
+ ).toMatchInlineSnapshot(`
939
+ {
940
+ "baseFeePerGas": 0n,
941
+ "extraData": "0xd983010700846765746889676f312e31372e3133856c696e7578000000000000f8ccc0c080b84169807e4d7934803decfde330167e444ec323431e1ff4cd70f40f2e79f24ce91f60340b99f97e3562ee57389e2c72343a74379e0b8b7ca5237ec141e84278bb3e00f8418e3e8af95497b7f6ffe7d3c4cbfbbdb06b26f6f3e913ca2cb7dff23532eaf3eb9f3b06ae75498c88353d279cf58fb0570736e2aa20cf53381722b6485f0f3c8180f8418e3fffffffffffffffffffffffffffb0005d23be939b9f8135e6b1ff283baff985c1b6ccacf2b6aa7fbd8939c4b6178b1d242b574a614b6347182a3b3195258080",
942
+ "gasUsed": 1n,
943
+ "hash": "0xac8c9bc3b84e103dc321bbe83b670e425ff68bfc9a333a4f1b1b204ad11c583d",
944
+ "logsBloom": "0x02004000004200000000000000800020000000000000400002040000002020000000802000000000000180000001000020800000000000000000000000000000000000000022000260000008000800000000000000000000000000000000000000000008000410002100000140000800000044c00200000000400010000800008800000080000000000010000040000000000000000000000000000000800020028000000100000000000000000000002002881000000000000800020000040020900402020000180000000000000040000800000011020090002000400000200010002000001000000000000080000000000000000000000000000004000000",
945
+ "miner": "0xe267d978037b89db06c6a5fcf82fad8297e290ff",
946
+ "number": 2n,
947
+ "parentHash": "0xf6e57c99be5a81167bcb7bdf8d55572235384182c71635857ace2c04d25294ed",
948
+ "randomness": {
949
+ "committed": "0x339714505ecf55eacc2d2568ea53a7424bd0aa40fd710fd6892464d0716da711",
950
+ "revealed": "0xe10b5f01b0376fdc9151f66992f8c1b990083acabc14ec1b04f6a53ad804db88",
951
+ },
952
+ "receiptsRoot": "0xca8aabc507534e45c982aa43e38118fc6f9cf222800e3d703a6e299a2e661f2a",
953
+ "size": 3n,
954
+ "stateRoot": "0x051c8e40ed3d8afabbad5321a4bb6b9d686a8a62d9b696b3e5a5c769c3623d48",
955
+ "timestamp": 4n,
956
+ "totalDifficulty": 5n,
957
+ "transactions": [
958
+ "0x487efb864b308ee85afd7ed5954e968457cfe84e71726114b0a44f31fb876e85",
959
+ "0x3aa054b868fb0ce99388d74165b6128a5aca0992a785eb73a84fb7532f02a6a3",
960
+ "0x7273f2bf436b14621094de5694d5aced028666389c7a89f4a863ac33d653cf52",
961
+ "0xe5240102364623faf753498c52102de4a5f9641ceb6f99d9c92b032716e2f8f9",
962
+ "0x92c31e9e4397e08a5abcccd8cc466e73d554be16da1ca7cac6a01b643f806524",
963
+ "0x0acc190dfc0bbc6c9823dc17ff815c94e1494b60f9be9b6e045cbad572fdbdb1",
964
+ "0x27c8cff64388e80b279407758d6801fe0dfe3410bacc7051deddf6c49c16710c",
965
+ "0x6d4e4a0a01b1ebbb8be5cddede5de036779bd230ffc22e465eaa6128bd552ecb",
966
+ "0xa80107ba2f636428883a71b7ce8a23171faf5076bae51e3a68e046c143434ed9",
967
+ "0xcdadac0ee4a8901992ee365b7d251ff567134b007d2ad2d6a2285f7091998d60",
968
+ "0xdff49ec96503acbd0110a8200f0f18b9924978bc5db32ae5c47a0986bcb58b58",
969
+ "0xb0591b97ed1f7779e5cd548a9acfdad535d9073a3879d5bd4e3ff053bce31c5f",
970
+ "0xa58e9da5702648d3f3f81e44952d5072b07b10eb13477a877cf3d957443b5605",
971
+ "0x00d3bf8dc0ed9b62a786ce2fe1bec7de9d0ba286421acd3c4942b055b0741c0c",
972
+ "0xf02343c58c6ef8007e86840e8ac9f8c2a6c52c7877b7554e87711efaab49d50a",
973
+ "0x063f62e3c507eb0102f9dbe887520db4a1d3d34c4279f646bc3fc2c76e074369",
974
+ "0xbeb28f46cc143db996e14fa35591cb5de4dcc92a569422f68f87f3f6a72a0e64",
975
+ "0x9a38f385833a2c1ea159031f12c3e1af4033860c389afb69d77d1b897f37c452",
976
+ "0xae6dbf3554a531e0ad6c51ec1e2201b41859f466dbb0ca3364fa7237fb0c60f3",
977
+ "0x789aca8285c9e0ce2deb306f2c2f0f53df9b3601e295bdc0838a8622bd697be6",
978
+ "0x230ebdcd6c3282992c8793f23eb847f955220f2a6c14bb82b38bc48ccf0cf1c4",
979
+ "0xad7f4b13ac995055b681cb64f90bfe2863582e49d1179b837ebde353117ab2b4",
980
+ "0xe40fc6bbacf5cfc1f6c41f06737d7df6274aef89a9c46bbe4fb8cb8484ffa54b",
981
+ "0xa78f1aa9b1a0a2130477c0ed9df303c033c5c852240689a9ec34347333defa42",
982
+ "0x3b10b4297066dbac52031920159034ef43544b77fc82c5fcc561df7208064b2f",
983
+ "0x5d73e6bb86089544825ca8c8ca2091744b7fd25bdd36a8b4d9941968be76a845",
984
+ "0x2f5d0deb26329807564b18ecbf24d9cb9d802d92369ea48c78fb973e1ea78994",
985
+ "0x086a6ff358bce56bcbc022978b1b84448143ae66de7f9e0c3f7a68bce7664135",
986
+ "0x8f36d90a6da392b377162caa1f81a5f0e3882c48794bea979bf79f119bb9284d",
987
+ "0xe0a475e8a6f9495b00a55d8472b108171bf11a51cb8db131c98c25a17d0ac78c",
988
+ "0x8ba00695bd7b524ff55fbbda3f17c6e93056e6895089de2ee29d58541e11b88f",
989
+ "0xf971ed0462249050dbeaa4a812c2b881957d4225587dcd10c88581ca6b096a36",
990
+ "0x229ab6e46f4be57cb81f8c7b2070f19827e55d4162c72b4abf26e618521eaaee",
991
+ "0x99601bf74f39ef88dabd853b40e86bc9653899a93af85518fe73ecf372578588",
992
+ "0x5deaa0abfd7689d3c33543a3d3b1bebc3dba46acd72246775fabb0bb5561e410",
993
+ "0x413bada477356cdf02680950e2d0368ce3614eccc4a6c245fabd54ee07253f60",
994
+ ],
995
+ "transactionsRoot": "0xb293e2c4ce20a9eac253241e750a5592c9d3c1b27bf090d0fc2fa4756a038866",
996
+ }
997
+ `)
998
+
999
+ expect(
1000
+ transaction({
1001
+ accessList: [],
1002
+ blockHash:
1003
+ '0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d',
1004
+ blockNumber: '0x1',
1005
+ chainId: '0x1',
1006
+ feeCurrency: null,
1007
+ from: '0xa152f8bb749c55e9943a3a0a3111d18ee2b3f94e',
1008
+ gas: '0x2',
1009
+ gasPrice: undefined,
1010
+ gatewayFee: '0x3',
1011
+ gatewayFeeRecipient: null,
1012
+ hash: '0xa4b1f606b66105fa45cb5db23d2f6597075701e7f0e2367f4e6a39d17a8cf98b',
1013
+ input:
1014
+ '0x23b872dd000000000000000000000000a00f99bc38b1ecda1fd70eaa1cd31d576a9f46b0000000000000000000000000f16e9b0d03470827a95cdfd0cb8a8a3b46969b910000000000000000000000000000000000000000000000000000002b3b6fb3d0',
1015
+ maxFeePerGas: '0x4',
1016
+ maxPriorityFeePerGas: '0x5',
1017
+ nonce: '0x6',
1018
+ r: '0x5e49a7bd0534c6b6d3bbe581659424d3747f920d40ce56e48d26e5d94aac32ca',
1019
+ s: '0x1746abe27b7c4f00bda1ec714ac1f7083e9025b6ca3b2248e439a173e4ab55e0',
1020
+ to: '0x15d4c048f83bd7e37d49ea4c83a07267ec4203da',
1021
+ transactionIndex: '0x7',
1022
+ type: '0x2',
1023
+ v: '0x1',
1024
+ value: '0x0',
1025
+ }),
1026
+ ).toMatchInlineSnapshot(`
1027
+ {
1028
+ "accessList": [],
1029
+ "blockHash": "0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d",
1030
+ "blockNumber": 1n,
1031
+ "chainId": "0x1",
1032
+ "feeCurrency": null,
1033
+ "from": "0xa152f8bb749c55e9943a3a0a3111d18ee2b3f94e",
1034
+ "gas": 2n,
1035
+ "gasPrice": undefined,
1036
+ "gatewayFee": 3n,
1037
+ "gatewayFeeRecipient": null,
1038
+ "hash": "0xa4b1f606b66105fa45cb5db23d2f6597075701e7f0e2367f4e6a39d17a8cf98b",
1039
+ "input": "0x23b872dd000000000000000000000000a00f99bc38b1ecda1fd70eaa1cd31d576a9f46b0000000000000000000000000f16e9b0d03470827a95cdfd0cb8a8a3b46969b910000000000000000000000000000000000000000000000000000002b3b6fb3d0",
1040
+ "maxFeePerGas": 4n,
1041
+ "maxPriorityFeePerGas": 5n,
1042
+ "nonce": 6,
1043
+ "r": "0x5e49a7bd0534c6b6d3bbe581659424d3747f920d40ce56e48d26e5d94aac32ca",
1044
+ "s": "0x1746abe27b7c4f00bda1ec714ac1f7083e9025b6ca3b2248e439a173e4ab55e0",
1045
+ "to": "0x15d4c048f83bd7e37d49ea4c83a07267ec4203da",
1046
+ "transactionIndex": 7,
1047
+ "type": "eip1559",
1048
+ "v": 1n,
1049
+ "value": 0n,
1050
+ }
1051
+ `)
1052
+
1053
+ expect(
1054
+ transaction({
1055
+ accessList: [],
1056
+ blockHash:
1057
+ '0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d',
1058
+ blockNumber: '0x1',
1059
+ chainId: '0x1',
1060
+ feeCurrency: null,
1061
+ from: '0xa152f8bb749c55e9943a3a0a3111d18ee2b3f94e',
1062
+ gas: '0x2',
1063
+ gasPrice: undefined,
1064
+ gatewayFee: null,
1065
+ gatewayFeeRecipient: null,
1066
+ hash: '0xa4b1f606b66105fa45cb5db23d2f6597075701e7f0e2367f4e6a39d17a8cf98b',
1067
+ input:
1068
+ '0x23b872dd000000000000000000000000a00f99bc38b1ecda1fd70eaa1cd31d576a9f46b0000000000000000000000000f16e9b0d03470827a95cdfd0cb8a8a3b46969b910000000000000000000000000000000000000000000000000000002b3b6fb3d0',
1069
+ maxFeePerGas: '0x4',
1070
+ maxPriorityFeePerGas: '0x5',
1071
+ nonce: '0x6',
1072
+ r: '0x5e49a7bd0534c6b6d3bbe581659424d3747f920d40ce56e48d26e5d94aac32ca',
1073
+ s: '0x1746abe27b7c4f00bda1ec714ac1f7083e9025b6ca3b2248e439a173e4ab55e0',
1074
+ to: '0x15d4c048f83bd7e37d49ea4c83a07267ec4203da',
1075
+ transactionIndex: '0x7',
1076
+ type: '0x2',
1077
+ v: '0x1',
1078
+ value: '0x0',
1079
+ }),
1080
+ ).toMatchInlineSnapshot(`
1081
+ {
1082
+ "accessList": [],
1083
+ "blockHash": "0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d",
1084
+ "blockNumber": 1n,
1085
+ "chainId": "0x1",
1086
+ "feeCurrency": null,
1087
+ "from": "0xa152f8bb749c55e9943a3a0a3111d18ee2b3f94e",
1088
+ "gas": 2n,
1089
+ "gasPrice": undefined,
1090
+ "gatewayFee": null,
1091
+ "gatewayFeeRecipient": null,
1092
+ "hash": "0xa4b1f606b66105fa45cb5db23d2f6597075701e7f0e2367f4e6a39d17a8cf98b",
1093
+ "input": "0x23b872dd000000000000000000000000a00f99bc38b1ecda1fd70eaa1cd31d576a9f46b0000000000000000000000000f16e9b0d03470827a95cdfd0cb8a8a3b46969b910000000000000000000000000000000000000000000000000000002b3b6fb3d0",
1094
+ "maxFeePerGas": 4n,
1095
+ "maxPriorityFeePerGas": 5n,
1096
+ "nonce": 6,
1097
+ "r": "0x5e49a7bd0534c6b6d3bbe581659424d3747f920d40ce56e48d26e5d94aac32ca",
1098
+ "s": "0x1746abe27b7c4f00bda1ec714ac1f7083e9025b6ca3b2248e439a173e4ab55e0",
1099
+ "to": "0x15d4c048f83bd7e37d49ea4c83a07267ec4203da",
1100
+ "transactionIndex": 7,
1101
+ "type": "eip1559",
1102
+ "v": 1n,
1103
+ "value": 0n,
1104
+ }
1105
+ `)
1106
+
1107
+ expect(
1108
+ transactionRequest({
1109
+ feeCurrency: '0x0f16e9b0d03470827a95cdfd0cb8a8a3b46969b9',
1110
+ from: '0x0f16e9b0d03470827a95cdfd0cb8a8a3b46969b9',
1111
+ gas: 1n,
1112
+ gatewayFee: '0x4',
1113
+ gatewayFeeRecipient: '0x0f16e9b0d03470827a95cdfd0cb8a8a3b46969b9',
1114
+ maxFeePerGas: 2n,
1115
+ maxPriorityFeePerGas: 1n,
1116
+ nonce: 1,
1117
+ value: 1n,
1118
+ }),
1119
+ ).toMatchInlineSnapshot(`
1120
+ {
1121
+ "feeCurrency": "0x0f16e9b0d03470827a95cdfd0cb8a8a3b46969b9",
1122
+ "from": "0x0f16e9b0d03470827a95cdfd0cb8a8a3b46969b9",
1123
+ "gas": "0x1",
1124
+ "gasPrice": undefined,
1125
+ "gatewayFee": "0x4",
1126
+ "gatewayFeeRecipient": "0x0f16e9b0d03470827a95cdfd0cb8a8a3b46969b9",
1127
+ "maxFeePerGas": "0x2",
1128
+ "maxPriorityFeePerGas": "0x1",
1129
+ "nonce": "0x1",
1130
+ "value": "0x1",
1131
+ }
1132
+ `)
1133
+ })
1134
+ })