viem 2.0.0-beta.5 → 2.0.0-beta.8

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 (1009) hide show
  1. package/CHANGELOG.md +470 -394
  2. package/README.md +52 -46
  3. package/_cjs/accounts/toAccount.js.map +1 -1
  4. package/_cjs/accounts/utils/signTransaction.js.map +1 -1
  5. package/_cjs/actions/ens/getEnsAddress.js +1 -1
  6. package/_cjs/actions/ens/getEnsAddress.js.map +1 -1
  7. package/_cjs/actions/ens/getEnsAvatar.js +1 -1
  8. package/_cjs/actions/ens/getEnsAvatar.js.map +1 -1
  9. package/_cjs/actions/ens/getEnsName.js +1 -1
  10. package/_cjs/actions/ens/getEnsName.js.map +1 -1
  11. package/_cjs/actions/ens/getEnsResolver.js +1 -1
  12. package/_cjs/actions/ens/getEnsResolver.js.map +1 -1
  13. package/_cjs/actions/ens/getEnsText.js +1 -1
  14. package/_cjs/actions/ens/getEnsText.js.map +1 -1
  15. package/_cjs/actions/getContract.js +7 -7
  16. package/_cjs/actions/getContract.js.map +1 -1
  17. package/_cjs/actions/public/call.js.map +1 -1
  18. package/_cjs/actions/public/createContractEventFilter.js +1 -1
  19. package/_cjs/actions/public/createContractEventFilter.js.map +1 -1
  20. package/_cjs/actions/public/createEventFilter.js +1 -1
  21. package/_cjs/actions/public/createEventFilter.js.map +1 -1
  22. package/_cjs/actions/public/estimateContractGas.js +1 -1
  23. package/_cjs/actions/public/estimateContractGas.js.map +1 -1
  24. package/_cjs/actions/public/estimateFeesPerGas.js +6 -3
  25. package/_cjs/actions/public/estimateFeesPerGas.js.map +1 -1
  26. package/_cjs/actions/public/estimateGas.js +3 -8
  27. package/_cjs/actions/public/estimateGas.js.map +1 -1
  28. package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js +6 -4
  29. package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
  30. package/_cjs/actions/public/getBlock.js.map +1 -1
  31. package/_cjs/actions/public/getBlockTransactionCount.js.map +1 -1
  32. package/_cjs/actions/public/getContractEvents.js +1 -1
  33. package/_cjs/actions/public/getContractEvents.js.map +1 -1
  34. package/_cjs/actions/public/getFilterChanges.js +10 -31
  35. package/_cjs/actions/public/getFilterChanges.js.map +1 -1
  36. package/_cjs/actions/public/getFilterLogs.js +8 -29
  37. package/_cjs/actions/public/getFilterLogs.js.map +1 -1
  38. package/_cjs/actions/public/getLogs.js +8 -29
  39. package/_cjs/actions/public/getLogs.js.map +1 -1
  40. package/_cjs/actions/public/getTransaction.js.map +1 -1
  41. package/_cjs/actions/public/getTransactionConfirmations.js +4 -2
  42. package/_cjs/actions/public/getTransactionConfirmations.js.map +1 -1
  43. package/_cjs/actions/public/multicall.js +1 -1
  44. package/_cjs/actions/public/multicall.js.map +1 -1
  45. package/_cjs/actions/public/readContract.js +1 -1
  46. package/_cjs/actions/public/readContract.js.map +1 -1
  47. package/_cjs/actions/public/simulateContract.js +1 -1
  48. package/_cjs/actions/public/simulateContract.js.map +1 -1
  49. package/_cjs/actions/public/verifyHash.js +1 -1
  50. package/_cjs/actions/public/verifyHash.js.map +1 -1
  51. package/_cjs/actions/public/waitForTransactionReceipt.js +18 -8
  52. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  53. package/_cjs/actions/public/watchBlockNumber.js +1 -1
  54. package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
  55. package/_cjs/actions/public/watchBlocks.js +2 -2
  56. package/_cjs/actions/public/watchBlocks.js.map +1 -1
  57. package/_cjs/actions/public/watchContractEvent.js +7 -6
  58. package/_cjs/actions/public/watchContractEvent.js.map +1 -1
  59. package/_cjs/actions/public/watchEvent.js +7 -6
  60. package/_cjs/actions/public/watchEvent.js.map +1 -1
  61. package/_cjs/actions/public/watchPendingTransactions.js +5 -4
  62. package/_cjs/actions/public/watchPendingTransactions.js.map +1 -1
  63. package/_cjs/actions/test/setAutomine.js.map +1 -1
  64. package/_cjs/actions/wallet/addChain.js +1 -1
  65. package/_cjs/actions/wallet/addChain.js.map +1 -1
  66. package/_cjs/actions/wallet/prepareTransactionRequest.js +41 -38
  67. package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
  68. package/_cjs/actions/wallet/requestAddresses.js +1 -1
  69. package/_cjs/actions/wallet/requestAddresses.js.map +1 -1
  70. package/_cjs/actions/wallet/requestPermissions.js +1 -1
  71. package/_cjs/actions/wallet/requestPermissions.js.map +1 -1
  72. package/_cjs/actions/wallet/sendRawTransaction.js +1 -1
  73. package/_cjs/actions/wallet/sendRawTransaction.js.map +1 -1
  74. package/_cjs/actions/wallet/sendTransaction.js +5 -5
  75. package/_cjs/actions/wallet/sendTransaction.js.map +1 -1
  76. package/_cjs/actions/wallet/signMessage.js +1 -1
  77. package/_cjs/actions/wallet/signMessage.js.map +1 -1
  78. package/_cjs/actions/wallet/signTransaction.js +2 -2
  79. package/_cjs/actions/wallet/signTransaction.js.map +1 -1
  80. package/_cjs/actions/wallet/signTypedData.js +1 -1
  81. package/_cjs/actions/wallet/signTypedData.js.map +1 -1
  82. package/_cjs/actions/wallet/switchChain.js +1 -1
  83. package/_cjs/actions/wallet/switchChain.js.map +1 -1
  84. package/_cjs/actions/wallet/watchAsset.js +1 -1
  85. package/_cjs/actions/wallet/watchAsset.js.map +1 -1
  86. package/_cjs/actions/wallet/writeContract.js +6 -3
  87. package/_cjs/actions/wallet/writeContract.js.map +1 -1
  88. package/_cjs/chains/celo/formatters.js.map +1 -1
  89. package/_cjs/chains/celo/parsers.js.map +1 -1
  90. package/_cjs/chains/celo/serializers.js +4 -8
  91. package/_cjs/chains/celo/serializers.js.map +1 -1
  92. package/_cjs/chains/celo/utils.js +6 -4
  93. package/_cjs/chains/celo/utils.js.map +1 -1
  94. package/_cjs/chains/definitions/aurora.js +6 -0
  95. package/_cjs/chains/definitions/aurora.js.map +1 -1
  96. package/_cjs/chains/definitions/base.js +8 -0
  97. package/_cjs/chains/definitions/base.js.map +1 -1
  98. package/_cjs/chains/definitions/baseGoerli.js +7 -1
  99. package/_cjs/chains/definitions/baseGoerli.js.map +1 -1
  100. package/_cjs/chains/definitions/baseSepolia.js +11 -2
  101. package/_cjs/chains/definitions/baseSepolia.js.map +1 -1
  102. package/_cjs/chains/definitions/bscTestnet.js +2 -1
  103. package/_cjs/chains/definitions/bscTestnet.js.map +1 -1
  104. package/_cjs/chains/definitions/confluxESpace.js +1 -0
  105. package/_cjs/chains/definitions/confluxESpace.js.map +1 -1
  106. package/_cjs/chains/definitions/confluxESpaceTestnet.js +34 -0
  107. package/_cjs/chains/definitions/confluxESpaceTestnet.js.map +1 -0
  108. package/_cjs/chains/definitions/filecoin.js +6 -0
  109. package/_cjs/chains/definitions/filecoin.js.map +1 -1
  110. package/_cjs/chains/definitions/klaytn.js +6 -0
  111. package/_cjs/chains/definitions/klaytn.js.map +1 -1
  112. package/_cjs/chains/definitions/klaytnBaobab.js +30 -0
  113. package/_cjs/chains/definitions/klaytnBaobab.js.map +1 -0
  114. package/_cjs/chains/definitions/optimism.js +7 -0
  115. package/_cjs/chains/definitions/optimism.js.map +1 -1
  116. package/_cjs/chains/definitions/optimismGoerli.js +7 -0
  117. package/_cjs/chains/definitions/optimismGoerli.js.map +1 -1
  118. package/_cjs/chains/definitions/optimismSepolia.js +7 -0
  119. package/_cjs/chains/definitions/optimismSepolia.js.map +1 -1
  120. package/_cjs/chains/definitions/pgn.js +37 -0
  121. package/_cjs/chains/definitions/pgn.js.map +1 -0
  122. package/_cjs/chains/definitions/pgnTestnet.js +38 -0
  123. package/_cjs/chains/definitions/pgnTestnet.js.map +1 -0
  124. package/_cjs/chains/definitions/rootstock.js +29 -0
  125. package/_cjs/chains/definitions/rootstock.js.map +1 -0
  126. package/_cjs/chains/definitions/sapphire.js +33 -0
  127. package/_cjs/chains/definitions/sapphire.js.map +1 -0
  128. package/_cjs/chains/definitions/sapphireTestnet.js +28 -0
  129. package/_cjs/chains/definitions/sapphireTestnet.js.map +1 -0
  130. package/_cjs/chains/definitions/shibarium.js +35 -0
  131. package/_cjs/chains/definitions/shibarium.js.map +1 -0
  132. package/_cjs/chains/definitions/shimmer.js +29 -0
  133. package/_cjs/chains/definitions/shimmer.js.map +1 -0
  134. package/_cjs/chains/definitions/shimmerTestnet.js +30 -0
  135. package/_cjs/chains/definitions/shimmerTestnet.js.map +1 -0
  136. package/_cjs/chains/definitions/zora.js +7 -0
  137. package/_cjs/chains/definitions/zora.js.map +1 -1
  138. package/_cjs/chains/definitions/zoraSepolia.js +7 -0
  139. package/_cjs/chains/definitions/zoraSepolia.js.map +1 -1
  140. package/_cjs/chains/definitions/zoraTestnet.js +7 -0
  141. package/_cjs/chains/definitions/zoraTestnet.js.map +1 -1
  142. package/_cjs/chains/index.js +24 -4
  143. package/_cjs/chains/index.js.map +1 -1
  144. package/_cjs/chains/opStack/abis.js +318 -1
  145. package/_cjs/chains/opStack/abis.js.map +1 -1
  146. package/_cjs/chains/opStack/actions/buildDepositTransaction.js +32 -0
  147. package/_cjs/chains/opStack/actions/buildDepositTransaction.js.map +1 -0
  148. package/_cjs/chains/opStack/actions/depositTransaction.js +36 -0
  149. package/_cjs/chains/opStack/actions/depositTransaction.js.map +1 -0
  150. package/_cjs/chains/opStack/actions/estimateContractL1Fee.js.map +1 -1
  151. package/_cjs/chains/opStack/actions/estimateContractL1Gas.js.map +1 -1
  152. package/_cjs/chains/opStack/actions/estimateContractTotalFee.js.map +1 -1
  153. package/_cjs/chains/opStack/actions/estimateContractTotalGas.js.map +1 -1
  154. package/_cjs/chains/opStack/chainConfig.js +2 -0
  155. package/_cjs/chains/opStack/chainConfig.js.map +1 -1
  156. package/_cjs/chains/opStack/chains.js +22 -0
  157. package/_cjs/chains/opStack/chains.js.map +1 -0
  158. package/_cjs/chains/opStack/decorators/{public.js → publicL2.js} +3 -1
  159. package/_cjs/chains/opStack/decorators/publicL2.js.map +1 -0
  160. package/_cjs/chains/opStack/decorators/walletL1.js +13 -0
  161. package/_cjs/chains/opStack/decorators/walletL1.js.map +1 -0
  162. package/_cjs/chains/opStack/formatters.js.map +1 -1
  163. package/_cjs/chains/opStack/index.js +34 -21
  164. package/_cjs/chains/opStack/index.js.map +1 -1
  165. package/_cjs/chains/opStack/parsers.js +55 -0
  166. package/_cjs/chains/opStack/parsers.js.map +1 -0
  167. package/_cjs/chains/opStack/serializers.js +52 -0
  168. package/_cjs/chains/opStack/serializers.js.map +1 -0
  169. package/_cjs/chains/opStack/{types.js → types/block.js} +1 -1
  170. package/_cjs/chains/opStack/types/block.js.map +1 -0
  171. package/_cjs/chains/opStack/types/chain.js +3 -0
  172. package/_cjs/chains/opStack/types/chain.js.map +1 -0
  173. package/_cjs/chains/opStack/types/contract.js +3 -0
  174. package/_cjs/chains/opStack/types/contract.js.map +1 -0
  175. package/_cjs/chains/opStack/types/transaction.js +3 -0
  176. package/_cjs/chains/opStack/types/transaction.js.map +1 -0
  177. package/_cjs/chains/opStack/utils/extractTransactionDepositedLogs.js +14 -0
  178. package/_cjs/chains/opStack/utils/extractTransactionDepositedLogs.js.map +1 -0
  179. package/_cjs/chains/opStack/utils/fromOpaqueData.js +29 -0
  180. package/_cjs/chains/opStack/utils/fromOpaqueData.js.map +1 -0
  181. package/_cjs/chains/opStack/utils/getL2TransactionHash.js +28 -0
  182. package/_cjs/chains/opStack/utils/getL2TransactionHash.js.map +1 -0
  183. package/_cjs/chains/opStack/utils/getL2TransactionHashes.js +11 -0
  184. package/_cjs/chains/opStack/utils/getL2TransactionHashes.js.map +1 -0
  185. package/_cjs/chains/opStack/utils/getSourceHash.js +21 -0
  186. package/_cjs/chains/opStack/utils/getSourceHash.js.map +1 -0
  187. package/_cjs/chains/zksync/serializers.js.map +1 -1
  188. package/_cjs/clients/createWalletClient.js +1 -1
  189. package/_cjs/clients/createWalletClient.js.map +1 -1
  190. package/_cjs/clients/decorators/public.js.map +1 -1
  191. package/_cjs/clients/decorators/wallet.js.map +1 -1
  192. package/_cjs/clients/transports/fallback.js +18 -4
  193. package/_cjs/clients/transports/fallback.js.map +1 -1
  194. package/_cjs/clients/transports/webSocket.js.map +1 -1
  195. package/_cjs/errors/base.js.map +1 -1
  196. package/_cjs/errors/contract.js.map +1 -1
  197. package/_cjs/errors/version.js +1 -1
  198. package/_cjs/index.js.map +1 -1
  199. package/_cjs/utils/abi/decodeAbiParameters.js.map +1 -1
  200. package/_cjs/utils/abi/decodeEventLog.js.map +1 -1
  201. package/_cjs/utils/abi/decodeFunctionData.js.map +1 -1
  202. package/_cjs/utils/abi/decodeFunctionResult.js.map +1 -1
  203. package/_cjs/utils/abi/encodeAbiParameters.js.map +1 -1
  204. package/_cjs/utils/abi/encodeErrorResult.js.map +1 -1
  205. package/_cjs/utils/abi/encodeEventTopics.js.map +1 -1
  206. package/_cjs/utils/abi/encodeFunctionData.js.map +1 -1
  207. package/_cjs/utils/abi/encodeFunctionResult.js.map +1 -1
  208. package/_cjs/utils/abi/encodePacked.js.map +1 -1
  209. package/_cjs/utils/abi/formatAbiItem.js.map +1 -1
  210. package/_cjs/utils/abi/getAbiItem.js.map +1 -1
  211. package/_cjs/utils/abi/parseEventLogs.js +37 -0
  212. package/_cjs/utils/abi/parseEventLogs.js.map +1 -0
  213. package/_cjs/utils/address/getAddress.js.map +1 -1
  214. package/_cjs/utils/address/getContractAddress.js.map +1 -1
  215. package/_cjs/utils/buildRequest.js +101 -82
  216. package/_cjs/utils/buildRequest.js.map +1 -1
  217. package/_cjs/utils/ccip.js +4 -2
  218. package/_cjs/utils/ccip.js.map +1 -1
  219. package/_cjs/utils/data/concat.js.map +1 -1
  220. package/_cjs/utils/data/pad.js.map +1 -1
  221. package/_cjs/utils/data/slice.js.map +1 -1
  222. package/_cjs/utils/data/trim.js.map +1 -1
  223. package/_cjs/utils/encoding/fromBytes.js.map +1 -1
  224. package/_cjs/utils/encoding/fromHex.js.map +1 -1
  225. package/_cjs/utils/encoding/fromRlp.js.map +1 -1
  226. package/_cjs/utils/encoding/toBytes.js +2 -2
  227. package/_cjs/utils/encoding/toBytes.js.map +1 -1
  228. package/_cjs/utils/encoding/toHex.js.map +1 -1
  229. package/_cjs/utils/encoding/toRlp.js +3 -1
  230. package/_cjs/utils/encoding/toRlp.js.map +1 -1
  231. package/_cjs/utils/ens/avatar/parseAvatarRecord.js.map +1 -1
  232. package/_cjs/utils/ens/avatar/utils.js +1 -1
  233. package/_cjs/utils/ens/avatar/utils.js.map +1 -1
  234. package/_cjs/utils/ens/namehash.js.map +1 -1
  235. package/_cjs/utils/ens/packetToBytes.js.map +1 -1
  236. package/_cjs/utils/errors/getContractError.js.map +1 -1
  237. package/_cjs/utils/errors/getNodeError.js +11 -11
  238. package/_cjs/utils/errors/getNodeError.js.map +1 -1
  239. package/_cjs/utils/formatters/block.js.map +1 -1
  240. package/_cjs/utils/formatters/extract.js.map +1 -1
  241. package/_cjs/utils/formatters/formatter.js.map +1 -1
  242. package/_cjs/utils/formatters/transaction.js.map +1 -1
  243. package/_cjs/utils/getAction.js +2 -2
  244. package/_cjs/utils/getAction.js.map +1 -1
  245. package/_cjs/utils/hash/normalizeSignature.js.map +1 -1
  246. package/_cjs/utils/index.js +3 -2
  247. package/_cjs/utils/index.js.map +1 -1
  248. package/_cjs/utils/observe.js +2 -1
  249. package/_cjs/utils/observe.js.map +1 -1
  250. package/_cjs/utils/promise/createBatchScheduler.js +8 -2
  251. package/_cjs/utils/promise/createBatchScheduler.js.map +1 -1
  252. package/_cjs/utils/promise/withCache.js.map +1 -1
  253. package/_cjs/utils/promise/withRetry.js.map +1 -1
  254. package/_cjs/utils/promise/withTimeout.js.map +1 -1
  255. package/_cjs/utils/rpc.js.map +1 -1
  256. package/_cjs/utils/signature/hashTypedData.js.map +1 -1
  257. package/_cjs/utils/signature/signatureToCompactSignature.js.map +1 -1
  258. package/_cjs/utils/transaction/getTransactionType.js.map +1 -1
  259. package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
  260. package/_cjs/utils/transaction/serializeAccessList.js.map +1 -1
  261. package/_cjs/utils/transaction/serializeTransaction.js.map +1 -1
  262. package/_cjs/utils/typedData.js.map +1 -1
  263. package/_cjs/utils/uid.js.map +1 -1
  264. package/_cjs/utils/unit/formatEther.js.map +1 -1
  265. package/_cjs/utils/unit/formatGwei.js.map +1 -1
  266. package/_cjs/utils/unit/formatUnits.js.map +1 -1
  267. package/_cjs/utils/unit/parseEther.js.map +1 -1
  268. package/_cjs/utils/unit/parseGwei.js.map +1 -1
  269. package/_cjs/utils/unit/parseUnits.js.map +1 -1
  270. package/_esm/accounts/toAccount.js.map +1 -1
  271. package/_esm/accounts/utils/signTransaction.js.map +1 -1
  272. package/_esm/actions/ens/getEnsAddress.js +3 -3
  273. package/_esm/actions/ens/getEnsAddress.js.map +1 -1
  274. package/_esm/actions/ens/getEnsAvatar.js +3 -3
  275. package/_esm/actions/ens/getEnsAvatar.js.map +1 -1
  276. package/_esm/actions/ens/getEnsName.js +3 -3
  277. package/_esm/actions/ens/getEnsName.js.map +1 -1
  278. package/_esm/actions/ens/getEnsResolver.js +3 -3
  279. package/_esm/actions/ens/getEnsResolver.js.map +1 -1
  280. package/_esm/actions/ens/getEnsText.js +3 -3
  281. package/_esm/actions/ens/getEnsText.js.map +1 -1
  282. package/_esm/actions/getContract.js +7 -7
  283. package/_esm/actions/getContract.js.map +1 -1
  284. package/_esm/actions/public/call.js.map +1 -1
  285. package/_esm/actions/public/createContractEventFilter.js +1 -1
  286. package/_esm/actions/public/createContractEventFilter.js.map +1 -1
  287. package/_esm/actions/public/createEventFilter.js +1 -1
  288. package/_esm/actions/public/createEventFilter.js.map +1 -1
  289. package/_esm/actions/public/estimateContractGas.js +1 -1
  290. package/_esm/actions/public/estimateContractGas.js.map +1 -1
  291. package/_esm/actions/public/estimateFeesPerGas.js +6 -3
  292. package/_esm/actions/public/estimateFeesPerGas.js.map +1 -1
  293. package/_esm/actions/public/estimateGas.js +3 -8
  294. package/_esm/actions/public/estimateGas.js.map +1 -1
  295. package/_esm/actions/public/estimateMaxPriorityFeePerGas.js +6 -4
  296. package/_esm/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
  297. package/_esm/actions/public/getBlock.js +1 -1
  298. package/_esm/actions/public/getBlock.js.map +1 -1
  299. package/_esm/actions/public/getBlockNumber.js +1 -1
  300. package/_esm/actions/public/getBlockTransactionCount.js.map +1 -1
  301. package/_esm/actions/public/getContractEvents.js +1 -1
  302. package/_esm/actions/public/getContractEvents.js.map +1 -1
  303. package/_esm/actions/public/getFilterChanges.js +11 -33
  304. package/_esm/actions/public/getFilterChanges.js.map +1 -1
  305. package/_esm/actions/public/getFilterLogs.js +9 -31
  306. package/_esm/actions/public/getFilterLogs.js.map +1 -1
  307. package/_esm/actions/public/getLogs.js +10 -32
  308. package/_esm/actions/public/getLogs.js.map +1 -1
  309. package/_esm/actions/public/getTransaction.js +1 -1
  310. package/_esm/actions/public/getTransaction.js.map +1 -1
  311. package/_esm/actions/public/getTransactionConfirmations.js +5 -3
  312. package/_esm/actions/public/getTransactionConfirmations.js.map +1 -1
  313. package/_esm/actions/public/getTransactionReceipt.js +1 -1
  314. package/_esm/actions/public/multicall.js +1 -1
  315. package/_esm/actions/public/multicall.js.map +1 -1
  316. package/_esm/actions/public/readContract.js +2 -2
  317. package/_esm/actions/public/readContract.js.map +1 -1
  318. package/_esm/actions/public/simulateContract.js +2 -2
  319. package/_esm/actions/public/simulateContract.js.map +1 -1
  320. package/_esm/actions/public/verifyHash.js +1 -1
  321. package/_esm/actions/public/verifyHash.js.map +1 -1
  322. package/_esm/actions/public/waitForTransactionReceipt.js +22 -9
  323. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  324. package/_esm/actions/public/watchBlockNumber.js +2 -2
  325. package/_esm/actions/public/watchBlockNumber.js.map +1 -1
  326. package/_esm/actions/public/watchBlocks.js +3 -3
  327. package/_esm/actions/public/watchBlocks.js.map +1 -1
  328. package/_esm/actions/public/watchContractEvent.js +7 -6
  329. package/_esm/actions/public/watchContractEvent.js.map +1 -1
  330. package/_esm/actions/public/watchEvent.js +7 -6
  331. package/_esm/actions/public/watchEvent.js.map +1 -1
  332. package/_esm/actions/public/watchPendingTransactions.js +5 -4
  333. package/_esm/actions/public/watchPendingTransactions.js.map +1 -1
  334. package/_esm/actions/test/setAutomine.js.map +1 -1
  335. package/_esm/actions/wallet/addChain.js +1 -1
  336. package/_esm/actions/wallet/addChain.js.map +1 -1
  337. package/_esm/actions/wallet/deployContract.js +1 -1
  338. package/_esm/actions/wallet/prepareTransactionRequest.js +44 -40
  339. package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
  340. package/_esm/actions/wallet/requestAddresses.js +1 -1
  341. package/_esm/actions/wallet/requestAddresses.js.map +1 -1
  342. package/_esm/actions/wallet/requestPermissions.js +1 -1
  343. package/_esm/actions/wallet/requestPermissions.js.map +1 -1
  344. package/_esm/actions/wallet/sendRawTransaction.js +1 -1
  345. package/_esm/actions/wallet/sendRawTransaction.js.map +1 -1
  346. package/_esm/actions/wallet/sendTransaction.js +6 -6
  347. package/_esm/actions/wallet/sendTransaction.js.map +1 -1
  348. package/_esm/actions/wallet/signMessage.js +1 -1
  349. package/_esm/actions/wallet/signMessage.js.map +1 -1
  350. package/_esm/actions/wallet/signTransaction.js +2 -2
  351. package/_esm/actions/wallet/signTransaction.js.map +1 -1
  352. package/_esm/actions/wallet/signTypedData.js +1 -1
  353. package/_esm/actions/wallet/signTypedData.js.map +1 -1
  354. package/_esm/actions/wallet/switchChain.js +1 -1
  355. package/_esm/actions/wallet/switchChain.js.map +1 -1
  356. package/_esm/actions/wallet/watchAsset.js +1 -1
  357. package/_esm/actions/wallet/watchAsset.js.map +1 -1
  358. package/_esm/actions/wallet/writeContract.js +7 -4
  359. package/_esm/actions/wallet/writeContract.js.map +1 -1
  360. package/_esm/chains/celo/formatters.js.map +1 -1
  361. package/_esm/chains/celo/parsers.js.map +1 -1
  362. package/_esm/chains/celo/serializers.js +4 -8
  363. package/_esm/chains/celo/serializers.js.map +1 -1
  364. package/_esm/chains/celo/utils.js +16 -5
  365. package/_esm/chains/celo/utils.js.map +1 -1
  366. package/_esm/chains/definitions/aurora.js +6 -0
  367. package/_esm/chains/definitions/aurora.js.map +1 -1
  368. package/_esm/chains/definitions/base.js +8 -0
  369. package/_esm/chains/definitions/base.js.map +1 -1
  370. package/_esm/chains/definitions/baseGoerli.js +7 -1
  371. package/_esm/chains/definitions/baseGoerli.js.map +1 -1
  372. package/_esm/chains/definitions/baseSepolia.js +11 -2
  373. package/_esm/chains/definitions/baseSepolia.js.map +1 -1
  374. package/_esm/chains/definitions/bscTestnet.js +2 -1
  375. package/_esm/chains/definitions/bscTestnet.js.map +1 -1
  376. package/_esm/chains/definitions/confluxESpace.js +1 -0
  377. package/_esm/chains/definitions/confluxESpace.js.map +1 -1
  378. package/_esm/chains/definitions/confluxESpaceTestnet.js +31 -0
  379. package/_esm/chains/definitions/confluxESpaceTestnet.js.map +1 -0
  380. package/_esm/chains/definitions/filecoin.js +6 -0
  381. package/_esm/chains/definitions/filecoin.js.map +1 -1
  382. package/_esm/chains/definitions/klaytn.js +6 -0
  383. package/_esm/chains/definitions/klaytn.js.map +1 -1
  384. package/_esm/chains/definitions/klaytnBaobab.js +27 -0
  385. package/_esm/chains/definitions/klaytnBaobab.js.map +1 -0
  386. package/_esm/chains/definitions/optimism.js +7 -0
  387. package/_esm/chains/definitions/optimism.js.map +1 -1
  388. package/_esm/chains/definitions/optimismGoerli.js +7 -0
  389. package/_esm/chains/definitions/optimismGoerli.js.map +1 -1
  390. package/_esm/chains/definitions/optimismSepolia.js +7 -0
  391. package/_esm/chains/definitions/optimismSepolia.js.map +1 -1
  392. package/_esm/chains/definitions/pgn.js +34 -0
  393. package/_esm/chains/definitions/pgn.js.map +1 -0
  394. package/_esm/chains/definitions/pgnTestnet.js +35 -0
  395. package/_esm/chains/definitions/pgnTestnet.js.map +1 -0
  396. package/_esm/chains/definitions/rootstock.js +26 -0
  397. package/_esm/chains/definitions/rootstock.js.map +1 -0
  398. package/_esm/chains/definitions/sapphire.js +30 -0
  399. package/_esm/chains/definitions/sapphire.js.map +1 -0
  400. package/_esm/chains/definitions/sapphireTestnet.js +25 -0
  401. package/_esm/chains/definitions/sapphireTestnet.js.map +1 -0
  402. package/_esm/chains/definitions/shibarium.js +32 -0
  403. package/_esm/chains/definitions/shibarium.js.map +1 -0
  404. package/_esm/chains/definitions/shimmer.js +26 -0
  405. package/_esm/chains/definitions/shimmer.js.map +1 -0
  406. package/_esm/chains/definitions/shimmerTestnet.js +27 -0
  407. package/_esm/chains/definitions/shimmerTestnet.js.map +1 -0
  408. package/_esm/chains/definitions/zora.js +7 -0
  409. package/_esm/chains/definitions/zora.js.map +1 -1
  410. package/_esm/chains/definitions/zoraSepolia.js +7 -0
  411. package/_esm/chains/definitions/zoraSepolia.js.map +1 -1
  412. package/_esm/chains/definitions/zoraTestnet.js +7 -0
  413. package/_esm/chains/definitions/zoraTestnet.js.map +1 -1
  414. package/_esm/chains/index.js +10 -0
  415. package/_esm/chains/index.js.map +1 -1
  416. package/_esm/chains/opStack/abis.js +317 -0
  417. package/_esm/chains/opStack/abis.js.map +1 -1
  418. package/_esm/chains/opStack/actions/buildDepositTransaction.js +54 -0
  419. package/_esm/chains/opStack/actions/buildDepositTransaction.js.map +1 -0
  420. package/_esm/chains/opStack/actions/depositTransaction.js +88 -0
  421. package/_esm/chains/opStack/actions/depositTransaction.js.map +1 -0
  422. package/_esm/chains/opStack/actions/estimateContractL1Fee.js.map +1 -1
  423. package/_esm/chains/opStack/actions/estimateContractL1Gas.js.map +1 -1
  424. package/_esm/chains/opStack/actions/estimateContractTotalFee.js.map +1 -1
  425. package/_esm/chains/opStack/actions/estimateContractTotalGas.js.map +1 -1
  426. package/_esm/chains/opStack/actions/estimateL1Fee.js +1 -1
  427. package/_esm/chains/opStack/actions/estimateL1Fee.js.map +1 -1
  428. package/_esm/chains/opStack/actions/estimateL1Gas.js.map +1 -1
  429. package/_esm/chains/opStack/chainConfig.js +2 -0
  430. package/_esm/chains/opStack/chainConfig.js.map +1 -1
  431. package/_esm/chains/opStack/chains.js +10 -0
  432. package/_esm/chains/opStack/chains.js.map +1 -0
  433. package/_esm/chains/opStack/decorators/{public.js → publicL2.js} +3 -1
  434. package/_esm/chains/opStack/decorators/publicL2.js.map +1 -0
  435. package/_esm/chains/opStack/decorators/walletL1.js +9 -0
  436. package/_esm/chains/opStack/decorators/walletL1.js.map +1 -0
  437. package/_esm/chains/opStack/formatters.js.map +1 -1
  438. package/_esm/chains/opStack/index.js +12 -10
  439. package/_esm/chains/opStack/index.js.map +1 -1
  440. package/_esm/chains/opStack/parsers.js +51 -0
  441. package/_esm/chains/opStack/parsers.js.map +1 -0
  442. package/_esm/chains/opStack/serializers.js +47 -0
  443. package/_esm/chains/opStack/serializers.js.map +1 -0
  444. package/_esm/chains/opStack/types/block.js +2 -0
  445. package/_esm/chains/opStack/types/block.js.map +1 -0
  446. package/_esm/chains/opStack/types/chain.js +2 -0
  447. package/_esm/chains/opStack/types/chain.js.map +1 -0
  448. package/_esm/chains/opStack/types/contract.js +2 -0
  449. package/_esm/chains/opStack/types/contract.js.map +1 -0
  450. package/_esm/chains/opStack/types/transaction.js +2 -0
  451. package/_esm/chains/opStack/types/transaction.js.map +1 -0
  452. package/_esm/chains/opStack/utils/extractTransactionDepositedLogs.js +10 -0
  453. package/_esm/chains/opStack/utils/extractTransactionDepositedLogs.js.map +1 -0
  454. package/_esm/chains/opStack/utils/fromOpaqueData.js +25 -0
  455. package/_esm/chains/opStack/utils/fromOpaqueData.js.map +1 -0
  456. package/_esm/chains/opStack/utils/getL2TransactionHash.js +25 -0
  457. package/_esm/chains/opStack/utils/getL2TransactionHash.js.map +1 -0
  458. package/_esm/chains/opStack/utils/getL2TransactionHashes.js +7 -0
  459. package/_esm/chains/opStack/utils/getL2TransactionHashes.js.map +1 -0
  460. package/_esm/chains/opStack/utils/getSourceHash.js +18 -0
  461. package/_esm/chains/opStack/utils/getSourceHash.js.map +1 -0
  462. package/_esm/chains/zksync/serializers.js +1 -1
  463. package/_esm/chains/zksync/serializers.js.map +1 -1
  464. package/_esm/clients/createWalletClient.js +1 -1
  465. package/_esm/clients/createWalletClient.js.map +1 -1
  466. package/_esm/clients/decorators/public.js.map +1 -1
  467. package/_esm/clients/decorators/wallet.js.map +1 -1
  468. package/_esm/clients/transports/fallback.js +19 -6
  469. package/_esm/clients/transports/fallback.js.map +1 -1
  470. package/_esm/clients/transports/webSocket.js.map +1 -1
  471. package/_esm/errors/base.js.map +1 -1
  472. package/_esm/errors/contract.js.map +1 -1
  473. package/_esm/errors/version.js +1 -1
  474. package/_esm/index.js.map +1 -1
  475. package/_esm/utils/abi/decodeAbiParameters.js.map +1 -1
  476. package/_esm/utils/abi/decodeEventLog.js.map +1 -1
  477. package/_esm/utils/abi/decodeFunctionData.js.map +1 -1
  478. package/_esm/utils/abi/decodeFunctionResult.js.map +1 -1
  479. package/_esm/utils/abi/encodeAbiParameters.js.map +1 -1
  480. package/_esm/utils/abi/encodeErrorResult.js.map +1 -1
  481. package/_esm/utils/abi/encodeEventTopics.js.map +1 -1
  482. package/_esm/utils/abi/encodeFunctionData.js.map +1 -1
  483. package/_esm/utils/abi/encodeFunctionResult.js.map +1 -1
  484. package/_esm/utils/abi/encodePacked.js.map +1 -1
  485. package/_esm/utils/abi/formatAbiItem.js.map +1 -1
  486. package/_esm/utils/abi/getAbiItem.js.map +1 -1
  487. package/_esm/utils/abi/parseEventLogs.js +59 -0
  488. package/_esm/utils/abi/parseEventLogs.js.map +1 -0
  489. package/_esm/utils/address/getAddress.js.map +1 -1
  490. package/_esm/utils/address/getContractAddress.js.map +1 -1
  491. package/_esm/utils/buildRequest.js +129 -102
  492. package/_esm/utils/buildRequest.js.map +1 -1
  493. package/_esm/utils/ccip.js +4 -2
  494. package/_esm/utils/ccip.js.map +1 -1
  495. package/_esm/utils/data/concat.js.map +1 -1
  496. package/_esm/utils/data/pad.js.map +1 -1
  497. package/_esm/utils/data/slice.js.map +1 -1
  498. package/_esm/utils/data/trim.js.map +1 -1
  499. package/_esm/utils/encoding/fromBytes.js.map +1 -1
  500. package/_esm/utils/encoding/fromHex.js.map +1 -1
  501. package/_esm/utils/encoding/fromRlp.js.map +1 -1
  502. package/_esm/utils/encoding/toBytes.js +2 -2
  503. package/_esm/utils/encoding/toBytes.js.map +1 -1
  504. package/_esm/utils/encoding/toHex.js.map +1 -1
  505. package/_esm/utils/encoding/toRlp.js +3 -1
  506. package/_esm/utils/encoding/toRlp.js.map +1 -1
  507. package/_esm/utils/ens/avatar/parseAvatarRecord.js.map +1 -1
  508. package/_esm/utils/ens/avatar/utils.js +1 -1
  509. package/_esm/utils/ens/avatar/utils.js.map +1 -1
  510. package/_esm/utils/ens/namehash.js +1 -1
  511. package/_esm/utils/ens/namehash.js.map +1 -1
  512. package/_esm/utils/ens/normalize.js +2 -2
  513. package/_esm/utils/ens/packetToBytes.js.map +1 -1
  514. package/_esm/utils/errors/getContractError.js.map +1 -1
  515. package/_esm/utils/errors/getNodeError.js +11 -11
  516. package/_esm/utils/errors/getNodeError.js.map +1 -1
  517. package/_esm/utils/formatters/block.js.map +1 -1
  518. package/_esm/utils/formatters/extract.js.map +1 -1
  519. package/_esm/utils/formatters/formatter.js.map +1 -1
  520. package/_esm/utils/formatters/transaction.js.map +1 -1
  521. package/_esm/utils/getAction.js +12 -2
  522. package/_esm/utils/getAction.js.map +1 -1
  523. package/_esm/utils/hash/normalizeSignature.js.map +1 -1
  524. package/_esm/utils/index.js +2 -1
  525. package/_esm/utils/index.js.map +1 -1
  526. package/_esm/utils/observe.js +2 -1
  527. package/_esm/utils/observe.js.map +1 -1
  528. package/_esm/utils/promise/createBatchScheduler.js +8 -2
  529. package/_esm/utils/promise/createBatchScheduler.js.map +1 -1
  530. package/_esm/utils/promise/withCache.js.map +1 -1
  531. package/_esm/utils/promise/withRetry.js.map +1 -1
  532. package/_esm/utils/promise/withTimeout.js.map +1 -1
  533. package/_esm/utils/rpc.js.map +1 -1
  534. package/_esm/utils/signature/hashTypedData.js.map +1 -1
  535. package/_esm/utils/signature/signatureToCompactSignature.js.map +1 -1
  536. package/_esm/utils/transaction/getTransactionType.js.map +1 -1
  537. package/_esm/utils/transaction/parseTransaction.js.map +1 -1
  538. package/_esm/utils/transaction/serializeAccessList.js.map +1 -1
  539. package/_esm/utils/transaction/serializeTransaction.js.map +1 -1
  540. package/_esm/utils/typedData.js.map +1 -1
  541. package/_esm/utils/uid.js.map +1 -1
  542. package/_esm/utils/unit/formatEther.js +11 -0
  543. package/_esm/utils/unit/formatEther.js.map +1 -1
  544. package/_esm/utils/unit/formatGwei.js +11 -0
  545. package/_esm/utils/unit/formatGwei.js.map +1 -1
  546. package/_esm/utils/unit/formatUnits.js +11 -0
  547. package/_esm/utils/unit/formatUnits.js.map +1 -1
  548. package/_esm/utils/unit/parseEther.js +11 -0
  549. package/_esm/utils/unit/parseEther.js.map +1 -1
  550. package/_esm/utils/unit/parseGwei.js +11 -0
  551. package/_esm/utils/unit/parseGwei.js.map +1 -1
  552. package/_esm/utils/unit/parseUnits.js +11 -0
  553. package/_esm/utils/unit/parseUnits.js.map +1 -1
  554. package/_types/accounts/utils/signTransaction.d.ts.map +1 -1
  555. package/_types/actions/ens/getEnsAddress.d.ts +2 -2
  556. package/_types/actions/ens/getEnsAddress.d.ts.map +1 -1
  557. package/_types/actions/ens/getEnsAvatar.d.ts +2 -2
  558. package/_types/actions/ens/getEnsAvatar.d.ts.map +1 -1
  559. package/_types/actions/ens/getEnsName.d.ts +2 -2
  560. package/_types/actions/ens/getEnsName.d.ts.map +1 -1
  561. package/_types/actions/ens/getEnsResolver.d.ts +2 -2
  562. package/_types/actions/ens/getEnsResolver.d.ts.map +1 -1
  563. package/_types/actions/ens/getEnsText.d.ts +2 -2
  564. package/_types/actions/ens/getEnsText.d.ts.map +1 -1
  565. package/_types/actions/getContract.d.ts +5 -5
  566. package/_types/actions/getContract.d.ts.map +1 -1
  567. package/_types/actions/public/createContractEventFilter.d.ts.map +1 -1
  568. package/_types/actions/public/estimateContractGas.d.ts +2 -2
  569. package/_types/actions/public/estimateContractGas.d.ts.map +1 -1
  570. package/_types/actions/public/estimateFeesPerGas.d.ts +2 -2
  571. package/_types/actions/public/estimateFeesPerGas.d.ts.map +1 -1
  572. package/_types/actions/public/estimateGas.d.ts +5 -3
  573. package/_types/actions/public/estimateGas.d.ts.map +1 -1
  574. package/_types/actions/public/estimateMaxPriorityFeePerGas.d.ts +2 -2
  575. package/_types/actions/public/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
  576. package/_types/actions/public/getBlock.d.ts +1 -1
  577. package/_types/actions/public/getBlockNumber.d.ts +1 -1
  578. package/_types/actions/public/getContractEvents.d.ts.map +1 -1
  579. package/_types/actions/public/getFilterChanges.d.ts.map +1 -1
  580. package/_types/actions/public/getFilterLogs.d.ts.map +1 -1
  581. package/_types/actions/public/getLogs.d.ts +1 -1
  582. package/_types/actions/public/getLogs.d.ts.map +1 -1
  583. package/_types/actions/public/getTransaction.d.ts +1 -1
  584. package/_types/actions/public/getTransactionConfirmations.d.ts +1 -1
  585. package/_types/actions/public/getTransactionConfirmations.d.ts.map +1 -1
  586. package/_types/actions/public/getTransactionReceipt.d.ts +1 -1
  587. package/_types/actions/public/multicall.d.ts.map +1 -1
  588. package/_types/actions/public/readContract.d.ts +1 -1
  589. package/_types/actions/public/readContract.d.ts.map +1 -1
  590. package/_types/actions/public/simulateContract.d.ts +4 -4
  591. package/_types/actions/public/simulateContract.d.ts.map +1 -1
  592. package/_types/actions/public/verifyHash.d.ts.map +1 -1
  593. package/_types/actions/public/waitForTransactionReceipt.d.ts +1 -1
  594. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  595. package/_types/actions/public/watchBlockNumber.d.ts +1 -1
  596. package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
  597. package/_types/actions/public/watchBlocks.d.ts +1 -1
  598. package/_types/actions/public/watchBlocks.d.ts.map +1 -1
  599. package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
  600. package/_types/actions/public/watchEvent.d.ts.map +1 -1
  601. package/_types/actions/public/watchPendingTransactions.d.ts.map +1 -1
  602. package/_types/actions/wallet/addChain.d.ts.map +1 -1
  603. package/_types/actions/wallet/deployContract.d.ts +3 -3
  604. package/_types/actions/wallet/deployContract.d.ts.map +1 -1
  605. package/_types/actions/wallet/prepareTransactionRequest.d.ts +19 -7
  606. package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
  607. package/_types/actions/wallet/requestAddresses.d.ts.map +1 -1
  608. package/_types/actions/wallet/requestPermissions.d.ts.map +1 -1
  609. package/_types/actions/wallet/sendRawTransaction.d.ts.map +1 -1
  610. package/_types/actions/wallet/sendTransaction.d.ts +4 -4
  611. package/_types/actions/wallet/sendTransaction.d.ts.map +1 -1
  612. package/_types/actions/wallet/signMessage.d.ts.map +1 -1
  613. package/_types/actions/wallet/signTransaction.d.ts +2 -2
  614. package/_types/actions/wallet/signTransaction.d.ts.map +1 -1
  615. package/_types/actions/wallet/signTypedData.d.ts.map +1 -1
  616. package/_types/actions/wallet/switchChain.d.ts.map +1 -1
  617. package/_types/actions/wallet/watchAsset.d.ts.map +1 -1
  618. package/_types/actions/wallet/writeContract.d.ts +4 -4
  619. package/_types/actions/wallet/writeContract.d.ts.map +1 -1
  620. package/_types/chains/celo/chainConfig.d.ts +7 -7
  621. package/_types/chains/celo/formatters.d.ts +7 -7
  622. package/_types/chains/celo/parsers.d.ts.map +1 -1
  623. package/_types/chains/celo/serializers.d.ts.map +1 -1
  624. package/_types/chains/celo/utils.d.ts.map +1 -1
  625. package/_types/chains/definitions/aurora.d.ts +6 -8
  626. package/_types/chains/definitions/aurora.d.ts.map +1 -1
  627. package/_types/chains/definitions/auroraTestnet.d.ts +1 -1
  628. package/_types/chains/definitions/base.d.ts +17 -9
  629. package/_types/chains/definitions/base.d.ts.map +1 -1
  630. package/_types/chains/definitions/baseGoerli.d.ts +15 -8
  631. package/_types/chains/definitions/baseGoerli.d.ts.map +1 -1
  632. package/_types/chains/definitions/baseSepolia.d.ts +16 -8
  633. package/_types/chains/definitions/baseSepolia.d.ts.map +1 -1
  634. package/_types/chains/definitions/bearNetworkChainMainnet.d.ts +1 -1
  635. package/_types/chains/definitions/bearNetworkChainTestnet.d.ts +1 -1
  636. package/_types/chains/definitions/bronos.d.ts +1 -1
  637. package/_types/chains/definitions/bronosTestnet.d.ts +1 -1
  638. package/_types/chains/definitions/bscTestnet.d.ts +4 -1
  639. package/_types/chains/definitions/bscTestnet.d.ts.map +1 -1
  640. package/_types/chains/definitions/bxn.d.ts +1 -1
  641. package/_types/chains/definitions/bxnTestnet.d.ts +1 -1
  642. package/_types/chains/definitions/celo.d.ts +7 -7
  643. package/_types/chains/definitions/celoAlfajores.d.ts +7 -7
  644. package/_types/chains/definitions/celoCannoli.d.ts +7 -7
  645. package/_types/chains/definitions/chiliz.d.ts +1 -1
  646. package/_types/chains/definitions/classic.d.ts +1 -1
  647. package/_types/chains/definitions/confluxESpace.d.ts +1 -0
  648. package/_types/chains/definitions/confluxESpace.d.ts.map +1 -1
  649. package/_types/chains/definitions/confluxESpaceTestnet.d.ts +38 -0
  650. package/_types/chains/definitions/confluxESpaceTestnet.d.ts.map +1 -0
  651. package/_types/chains/definitions/dfk.d.ts +1 -1
  652. package/_types/chains/definitions/dogechain.d.ts +1 -1
  653. package/_types/chains/definitions/edgewareTestnet.d.ts +1 -1
  654. package/_types/chains/definitions/ekta.d.ts +1 -1
  655. package/_types/chains/definitions/ektaTestnet.d.ts +1 -1
  656. package/_types/chains/definitions/evmos.d.ts +1 -1
  657. package/_types/chains/definitions/evmosTestnet.d.ts +1 -1
  658. package/_types/chains/definitions/fibo.d.ts +1 -1
  659. package/_types/chains/definitions/filecoin.d.ts +6 -8
  660. package/_types/chains/definitions/filecoin.d.ts.map +1 -1
  661. package/_types/chains/definitions/filecoinCalibration.d.ts +1 -1
  662. package/_types/chains/definitions/filecoinHyperspace.d.ts +1 -1
  663. package/_types/chains/definitions/flare.d.ts +1 -1
  664. package/_types/chains/definitions/flareTestnet.d.ts +1 -1
  665. package/_types/chains/definitions/foundry.d.ts +1 -1
  666. package/_types/chains/definitions/fuseSparknet.d.ts +1 -1
  667. package/_types/chains/definitions/haqqMainnet.d.ts +1 -1
  668. package/_types/chains/definitions/haqqTestedge2.d.ts +1 -1
  669. package/_types/chains/definitions/hardhat.d.ts +1 -1
  670. package/_types/chains/definitions/iotex.d.ts +1 -1
  671. package/_types/chains/definitions/iotexTestnet.d.ts +1 -1
  672. package/_types/chains/definitions/klaytn.d.ts +6 -8
  673. package/_types/chains/definitions/klaytn.d.ts.map +1 -1
  674. package/_types/chains/definitions/klaytnBaobab.d.ts +40 -0
  675. package/_types/chains/definitions/klaytnBaobab.d.ts.map +1 -0
  676. package/_types/chains/definitions/kroma.d.ts +1 -1
  677. package/_types/chains/definitions/kromaSepolia.d.ts +1 -1
  678. package/_types/chains/definitions/localhost.d.ts +1 -1
  679. package/_types/chains/definitions/lukso.d.ts +1 -1
  680. package/_types/chains/definitions/mantleTestnet.d.ts +1 -1
  681. package/_types/chains/definitions/meter.d.ts +1 -1
  682. package/_types/chains/definitions/meterTestnet.d.ts +1 -1
  683. package/_types/chains/definitions/moonbeamDev.d.ts +1 -1
  684. package/_types/chains/definitions/oasys.d.ts +1 -1
  685. package/_types/chains/definitions/optimism.d.ts +16 -9
  686. package/_types/chains/definitions/optimism.d.ts.map +1 -1
  687. package/_types/chains/definitions/optimismGoerli.d.ts +16 -9
  688. package/_types/chains/definitions/optimismGoerli.d.ts.map +1 -1
  689. package/_types/chains/definitions/optimismSepolia.d.ts +16 -9
  690. package/_types/chains/definitions/optimismSepolia.d.ts.map +1 -1
  691. package/_types/chains/definitions/pgn.d.ts +555 -0
  692. package/_types/chains/definitions/pgn.d.ts.map +1 -0
  693. package/_types/chains/definitions/pgnTestnet.d.ts +555 -0
  694. package/_types/chains/definitions/pgnTestnet.d.ts.map +1 -0
  695. package/_types/chains/definitions/qMainnet.d.ts +1 -1
  696. package/_types/chains/definitions/qTestnet.d.ts +1 -1
  697. package/_types/chains/definitions/rootstock.d.ts +40 -0
  698. package/_types/chains/definitions/rootstock.d.ts.map +1 -0
  699. package/_types/chains/definitions/sapphire.d.ts +38 -0
  700. package/_types/chains/definitions/sapphire.d.ts.map +1 -0
  701. package/_types/chains/definitions/sapphireTestnet.d.ts +40 -0
  702. package/_types/chains/definitions/sapphireTestnet.d.ts.map +1 -0
  703. package/_types/chains/definitions/scrollTestnet.d.ts +1 -1
  704. package/_types/chains/definitions/shardeumSphinx.d.ts +1 -1
  705. package/_types/chains/definitions/shibarium.d.ts +40 -0
  706. package/_types/chains/definitions/shibarium.d.ts.map +1 -0
  707. package/_types/chains/definitions/shimmer.d.ts +38 -0
  708. package/_types/chains/definitions/shimmer.d.ts.map +1 -0
  709. package/_types/chains/definitions/shimmerTestnet.d.ts +38 -0
  710. package/_types/chains/definitions/shimmerTestnet.d.ts.map +1 -0
  711. package/_types/chains/definitions/songbird.d.ts +1 -1
  712. package/_types/chains/definitions/songbirdTestnet.d.ts +1 -1
  713. package/_types/chains/definitions/spicy.d.ts +1 -1
  714. package/_types/chains/definitions/taikoJolnir.d.ts +1 -1
  715. package/_types/chains/definitions/taikoTestnetSepolia.d.ts +1 -1
  716. package/_types/chains/definitions/taraxa.d.ts +1 -1
  717. package/_types/chains/definitions/taraxaTestnet.d.ts +1 -1
  718. package/_types/chains/definitions/telosTestnet.d.ts +1 -1
  719. package/_types/chains/definitions/tenet.d.ts +1 -1
  720. package/_types/chains/definitions/thunderTestnet.d.ts +1 -1
  721. package/_types/chains/definitions/vechain.d.ts +1 -1
  722. package/_types/chains/definitions/xdc.d.ts +1 -1
  723. package/_types/chains/definitions/xdcTestnet.d.ts +1 -1
  724. package/_types/chains/definitions/zetachainAthensTestnet.d.ts +1 -1
  725. package/_types/chains/definitions/zhejiang.d.ts +1 -1
  726. package/_types/chains/definitions/zora.d.ts +16 -9
  727. package/_types/chains/definitions/zora.d.ts.map +1 -1
  728. package/_types/chains/definitions/zoraSepolia.d.ts +16 -9
  729. package/_types/chains/definitions/zoraSepolia.d.ts.map +1 -1
  730. package/_types/chains/definitions/zoraTestnet.d.ts +16 -9
  731. package/_types/chains/definitions/zoraTestnet.d.ts.map +1 -1
  732. package/_types/chains/index.d.ts +13 -2
  733. package/_types/chains/index.d.ts.map +1 -1
  734. package/_types/chains/opStack/abis.d.ts +435 -0
  735. package/_types/chains/opStack/abis.d.ts.map +1 -1
  736. package/_types/chains/opStack/actions/buildDepositTransaction.d.ts +63 -0
  737. package/_types/chains/opStack/actions/buildDepositTransaction.d.ts.map +1 -0
  738. package/_types/chains/opStack/actions/depositTransaction.d.ts +96 -0
  739. package/_types/chains/opStack/actions/depositTransaction.d.ts.map +1 -0
  740. package/_types/chains/opStack/actions/estimateL1Fee.d.ts +3 -3
  741. package/_types/chains/opStack/actions/estimateL1Fee.d.ts.map +1 -1
  742. package/_types/chains/opStack/actions/estimateL1Gas.d.ts +2 -2
  743. package/_types/chains/opStack/actions/estimateL1Gas.d.ts.map +1 -1
  744. package/_types/chains/opStack/chainConfig.d.ts +14 -11
  745. package/_types/chains/opStack/chainConfig.d.ts.map +1 -1
  746. package/_types/chains/opStack/chains.d.ts +10 -0
  747. package/_types/chains/opStack/chains.d.ts.map +1 -0
  748. package/_types/chains/opStack/decorators/{public.d.ts → publicL2.d.ts} +31 -4
  749. package/_types/chains/opStack/decorators/publicL2.d.ts.map +1 -0
  750. package/_types/chains/opStack/decorators/walletL1.d.ts +64 -0
  751. package/_types/chains/opStack/decorators/walletL1.d.ts.map +1 -0
  752. package/_types/chains/opStack/formatters.d.ts +9 -8
  753. package/_types/chains/opStack/formatters.d.ts.map +1 -1
  754. package/_types/chains/opStack/index.d.ts +14 -11
  755. package/_types/chains/opStack/index.d.ts.map +1 -1
  756. package/_types/chains/opStack/parsers.d.ts +8 -0
  757. package/_types/chains/opStack/parsers.d.ts.map +1 -0
  758. package/_types/chains/opStack/serializers.d.ts +12 -0
  759. package/_types/chains/opStack/serializers.d.ts.map +1 -0
  760. package/_types/chains/opStack/types/block.d.ts +13 -0
  761. package/_types/chains/opStack/types/block.d.ts.map +1 -0
  762. package/_types/chains/opStack/types/chain.d.ts +9 -0
  763. package/_types/chains/opStack/types/chain.d.ts.map +1 -0
  764. package/_types/chains/opStack/types/contract.d.ts +13 -0
  765. package/_types/chains/opStack/types/contract.d.ts.map +1 -0
  766. package/_types/chains/opStack/{types.d.ts → types/transaction.d.ts} +21 -14
  767. package/_types/chains/opStack/types/transaction.d.ts.map +1 -0
  768. package/_types/chains/opStack/utils/extractTransactionDepositedLogs.d.ts +446 -0
  769. package/_types/chains/opStack/utils/extractTransactionDepositedLogs.d.ts.map +1 -0
  770. package/_types/chains/opStack/utils/fromOpaqueData.d.ts +15 -0
  771. package/_types/chains/opStack/utils/fromOpaqueData.d.ts.map +1 -0
  772. package/_types/chains/opStack/utils/getL2TransactionHash.d.ts +12 -0
  773. package/_types/chains/opStack/utils/getL2TransactionHash.d.ts.map +1 -0
  774. package/_types/chains/opStack/utils/getL2TransactionHashes.d.ts +11 -0
  775. package/_types/chains/opStack/utils/getL2TransactionHashes.d.ts.map +1 -0
  776. package/_types/chains/opStack/utils/getSourceHash.d.ts +28 -0
  777. package/_types/chains/opStack/utils/getSourceHash.d.ts.map +1 -0
  778. package/_types/clients/createClient.d.ts +1 -1
  779. package/_types/clients/decorators/public.d.ts +25 -25
  780. package/_types/clients/decorators/public.d.ts.map +1 -1
  781. package/_types/clients/decorators/wallet.d.ts +6 -6
  782. package/_types/clients/decorators/wallet.d.ts.map +1 -1
  783. package/_types/clients/transports/fallback.d.ts.map +1 -1
  784. package/_types/errors/estimateGas.d.ts +1 -1
  785. package/_types/errors/estimateGas.d.ts.map +1 -1
  786. package/_types/errors/version.d.ts +1 -1
  787. package/_types/index.d.ts +1 -1
  788. package/_types/index.d.ts.map +1 -1
  789. package/_types/types/account.d.ts +6 -3
  790. package/_types/types/account.d.ts.map +1 -1
  791. package/_types/types/chain.d.ts +12 -15
  792. package/_types/types/chain.d.ts.map +1 -1
  793. package/_types/types/contract.d.ts.map +1 -1
  794. package/_types/types/eip1193.d.ts +5 -1
  795. package/_types/types/eip1193.d.ts.map +1 -1
  796. package/_types/types/ens.d.ts +1 -1
  797. package/_types/types/ens.d.ts.map +1 -1
  798. package/_types/types/filter.d.ts.map +1 -1
  799. package/_types/types/log.d.ts.map +1 -1
  800. package/_types/types/multicall.d.ts.map +1 -1
  801. package/_types/types/rpc.d.ts.map +1 -1
  802. package/_types/types/transaction.d.ts.map +1 -1
  803. package/_types/types/utils.d.ts +17 -1
  804. package/_types/types/utils.d.ts.map +1 -1
  805. package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
  806. package/_types/utils/abi/decodeFunctionData.d.ts.map +1 -1
  807. package/_types/utils/abi/decodeFunctionResult.d.ts.map +1 -1
  808. package/_types/utils/abi/encodeDeployData.d.ts.map +1 -1
  809. package/_types/utils/abi/encodeErrorResult.d.ts.map +1 -1
  810. package/_types/utils/abi/encodeEventTopics.d.ts.map +1 -1
  811. package/_types/utils/abi/encodeFunctionData.d.ts.map +1 -1
  812. package/_types/utils/abi/encodeFunctionResult.d.ts.map +1 -1
  813. package/_types/utils/abi/parseEventLogs.d.ts +43 -0
  814. package/_types/utils/abi/parseEventLogs.d.ts.map +1 -0
  815. package/_types/utils/buildRequest.d.ts +3 -6
  816. package/_types/utils/buildRequest.d.ts.map +1 -1
  817. package/_types/utils/ccip.d.ts.map +1 -1
  818. package/_types/utils/encoding/fromBytes.d.ts.map +1 -1
  819. package/_types/utils/encoding/fromHex.d.ts.map +1 -1
  820. package/_types/utils/ens/avatar/utils.d.ts.map +1 -1
  821. package/_types/utils/ens/namehash.d.ts +1 -1
  822. package/_types/utils/ens/normalize.d.ts +2 -2
  823. package/_types/utils/errors/getNodeError.d.ts.map +1 -1
  824. package/_types/utils/formatters/block.d.ts +3 -7
  825. package/_types/utils/formatters/block.d.ts.map +1 -1
  826. package/_types/utils/formatters/formatter.d.ts +1 -1
  827. package/_types/utils/formatters/transaction.d.ts +3 -7
  828. package/_types/utils/formatters/transaction.d.ts.map +1 -1
  829. package/_types/utils/formatters/transactionReceipt.d.ts +1 -1
  830. package/_types/utils/formatters/transactionRequest.d.ts +1 -1
  831. package/_types/utils/getAction.d.ts +8 -1
  832. package/_types/utils/getAction.d.ts.map +1 -1
  833. package/_types/utils/index.d.ts +2 -1
  834. package/_types/utils/index.d.ts.map +1 -1
  835. package/_types/utils/promise/createBatchScheduler.d.ts.map +1 -1
  836. package/_types/utils/transaction/getSerializedTransactionType.d.ts.map +1 -1
  837. package/_types/utils/transaction/getTransactionType.d.ts.map +1 -1
  838. package/_types/utils/transaction/serializeTransaction.d.ts.map +1 -1
  839. package/_types/utils/unit/formatEther.d.ts +11 -0
  840. package/_types/utils/unit/formatEther.d.ts.map +1 -1
  841. package/_types/utils/unit/formatGwei.d.ts +11 -0
  842. package/_types/utils/unit/formatGwei.d.ts.map +1 -1
  843. package/_types/utils/unit/formatUnits.d.ts +11 -0
  844. package/_types/utils/unit/formatUnits.d.ts.map +1 -1
  845. package/_types/utils/unit/parseEther.d.ts +11 -0
  846. package/_types/utils/unit/parseEther.d.ts.map +1 -1
  847. package/_types/utils/unit/parseGwei.d.ts +11 -0
  848. package/_types/utils/unit/parseGwei.d.ts.map +1 -1
  849. package/_types/utils/unit/parseUnits.d.ts +11 -0
  850. package/_types/utils/unit/parseUnits.d.ts.map +1 -1
  851. package/accounts/utils/signTransaction.ts +4 -2
  852. package/actions/ens/getEnsAddress.ts +3 -2
  853. package/actions/ens/getEnsAvatar.ts +3 -2
  854. package/actions/ens/getEnsName.ts +3 -2
  855. package/actions/ens/getEnsResolver.ts +3 -2
  856. package/actions/ens/getEnsText.ts +3 -2
  857. package/actions/getContract.ts +12 -11
  858. package/actions/public/createContractEventFilter.ts +7 -7
  859. package/actions/public/createEventFilter.ts +1 -1
  860. package/actions/public/estimateContractGas.ts +3 -9
  861. package/actions/public/estimateFeesPerGas.ts +8 -5
  862. package/actions/public/estimateGas.ts +8 -14
  863. package/actions/public/estimateMaxPriorityFeePerGas.ts +10 -6
  864. package/actions/public/getBlock.ts +1 -1
  865. package/actions/public/getBlockNumber.ts +1 -1
  866. package/actions/public/getContractEvents.ts +1 -0
  867. package/actions/public/getFilterChanges.ts +30 -39
  868. package/actions/public/getFilterLogs.ts +17 -38
  869. package/actions/public/getLogs.ts +16 -38
  870. package/actions/public/getTransaction.ts +1 -1
  871. package/actions/public/getTransactionConfirmations.ts +5 -3
  872. package/actions/public/getTransactionReceipt.ts +1 -1
  873. package/actions/public/multicall.ts +1 -0
  874. package/actions/public/readContract.ts +2 -1
  875. package/actions/public/simulateContract.ts +8 -5
  876. package/actions/public/verifyHash.ts +1 -0
  877. package/actions/public/waitForTransactionReceipt.ts +40 -13
  878. package/actions/public/watchBlockNumber.ts +2 -1
  879. package/actions/public/watchBlocks.ts +3 -1
  880. package/actions/public/watchContractEvent.ts +19 -4
  881. package/actions/public/watchEvent.ts +19 -4
  882. package/actions/public/watchPendingTransactions.ts +13 -3
  883. package/actions/wallet/addChain.ts +17 -14
  884. package/actions/wallet/deployContract.ts +3 -3
  885. package/actions/wallet/prepareTransactionRequest.ts +130 -67
  886. package/actions/wallet/requestAddresses.ts +4 -1
  887. package/actions/wallet/requestPermissions.ts +7 -4
  888. package/actions/wallet/sendRawTransaction.ts +7 -4
  889. package/actions/wallet/sendTransaction.ts +19 -16
  890. package/actions/wallet/signMessage.ts +7 -4
  891. package/actions/wallet/signTransaction.ts +23 -19
  892. package/actions/wallet/signTypedData.ts +7 -4
  893. package/actions/wallet/switchChain.ts +11 -8
  894. package/actions/wallet/watchAsset.ts +7 -4
  895. package/actions/wallet/writeContract.ts +21 -12
  896. package/chains/celo/parsers.ts +3 -3
  897. package/chains/celo/serializers.ts +4 -8
  898. package/chains/celo/utils.ts +16 -3
  899. package/chains/definitions/aurora.ts +6 -0
  900. package/chains/definitions/base.ts +9 -0
  901. package/chains/definitions/baseGoerli.ts +8 -1
  902. package/chains/definitions/baseSepolia.ts +12 -2
  903. package/chains/definitions/bscTestnet.ts +2 -1
  904. package/chains/definitions/confluxESpace.ts +1 -0
  905. package/chains/definitions/confluxESpaceTestnet.ts +31 -0
  906. package/chains/definitions/filecoin.ts +6 -0
  907. package/chains/definitions/klaytn.ts +6 -0
  908. package/chains/definitions/klaytnBaobab.ts +27 -0
  909. package/chains/definitions/optimism.ts +8 -0
  910. package/chains/definitions/optimismGoerli.ts +8 -0
  911. package/chains/definitions/optimismSepolia.ts +8 -0
  912. package/chains/definitions/pgn.ts +34 -0
  913. package/chains/definitions/pgnTestnet.ts +35 -0
  914. package/chains/definitions/rootstock.ts +26 -0
  915. package/chains/definitions/sapphire.ts +30 -0
  916. package/chains/definitions/sapphireTestnet.ts +25 -0
  917. package/chains/definitions/shibarium.ts +32 -0
  918. package/chains/definitions/shimmer.ts +26 -0
  919. package/chains/definitions/shimmerTestnet.ts +27 -0
  920. package/chains/definitions/zora.ts +8 -0
  921. package/chains/definitions/zoraSepolia.ts +8 -0
  922. package/chains/definitions/zoraTestnet.ts +8 -0
  923. package/chains/index.ts +15 -3
  924. package/chains/opStack/abis.ts +318 -0
  925. package/chains/opStack/actions/buildDepositTransaction.ts +151 -0
  926. package/chains/opStack/actions/depositTransaction.ts +171 -0
  927. package/chains/opStack/actions/estimateL1Fee.ts +3 -3
  928. package/chains/opStack/actions/estimateL1Gas.ts +2 -2
  929. package/chains/opStack/chainConfig.ts +2 -0
  930. package/chains/opStack/chains.ts +9 -0
  931. package/chains/opStack/decorators/{public.ts → publicL2.ts} +47 -4
  932. package/chains/opStack/decorators/walletL1.ts +86 -0
  933. package/chains/opStack/formatters.ts +3 -1
  934. package/chains/opStack/index.ts +77 -12
  935. package/chains/opStack/parsers.ts +88 -0
  936. package/chains/opStack/serializers.ts +88 -0
  937. package/chains/opStack/types/block.ts +34 -0
  938. package/chains/opStack/types/chain.ts +7 -0
  939. package/chains/opStack/types/contract.ts +17 -0
  940. package/chains/opStack/{types.ts → types/transaction.ts} +39 -33
  941. package/chains/opStack/utils/extractTransactionDepositedLogs.ts +36 -0
  942. package/chains/opStack/utils/fromOpaqueData.ts +40 -0
  943. package/chains/opStack/utils/getL2TransactionHash.ts +52 -0
  944. package/chains/opStack/utils/getL2TransactionHashes.ts +21 -0
  945. package/chains/opStack/utils/getSourceHash.ts +61 -0
  946. package/clients/createClient.ts +1 -1
  947. package/clients/createWalletClient.ts +1 -1
  948. package/clients/decorators/public.ts +42 -31
  949. package/clients/decorators/wallet.ts +26 -7
  950. package/clients/transports/fallback.ts +24 -6
  951. package/errors/base.ts +2 -2
  952. package/errors/estimateGas.ts +1 -1
  953. package/errors/version.ts +1 -1
  954. package/index.ts +2 -1
  955. package/package.json +15 -37
  956. package/types/account.ts +11 -2
  957. package/types/chain.ts +23 -12
  958. package/types/contract.ts +64 -64
  959. package/types/eip1193.ts +8 -0
  960. package/types/ens.ts +1 -1
  961. package/types/filter.ts +12 -12
  962. package/types/log.ts +4 -4
  963. package/types/multicall.ts +66 -61
  964. package/types/rpc.ts +1 -1
  965. package/types/transaction.ts +4 -4
  966. package/types/utils.ts +26 -7
  967. package/utils/abi/decodeEventLog.ts +2 -1
  968. package/utils/abi/decodeFunctionData.ts +2 -1
  969. package/utils/abi/decodeFunctionResult.ts +2 -2
  970. package/utils/abi/encodeDeployData.ts +2 -2
  971. package/utils/abi/encodeErrorResult.ts +2 -2
  972. package/utils/abi/encodeEventTopics.ts +6 -6
  973. package/utils/abi/encodeFunctionData.ts +2 -2
  974. package/utils/abi/encodeFunctionResult.ts +2 -2
  975. package/utils/abi/parseEventLogs.ts +129 -0
  976. package/utils/buildRequest.ts +46 -41
  977. package/utils/ccip.ts +4 -3
  978. package/utils/encoding/fromBytes.ts +8 -8
  979. package/utils/encoding/fromHex.ts +8 -8
  980. package/utils/encoding/toBytes.ts +2 -2
  981. package/utils/encoding/toRlp.ts +3 -1
  982. package/utils/ens/avatar/utils.ts +3 -1
  983. package/utils/ens/namehash.ts +1 -1
  984. package/utils/ens/normalize.ts +2 -2
  985. package/utils/errors/getContractError.ts +2 -2
  986. package/utils/errors/getNodeError.ts +12 -11
  987. package/utils/formatters/block.ts +2 -4
  988. package/utils/formatters/formatter.ts +1 -1
  989. package/utils/formatters/transaction.ts +2 -4
  990. package/utils/getAction.ts +11 -1
  991. package/utils/index.ts +6 -2
  992. package/utils/observe.ts +1 -1
  993. package/utils/promise/createBatchScheduler.ts +8 -4
  994. package/utils/transaction/getSerializedTransactionType.ts +2 -2
  995. package/utils/transaction/getTransactionType.ts +2 -1
  996. package/utils/transaction/serializeTransaction.ts +6 -3
  997. package/utils/unit/formatEther.ts +11 -0
  998. package/utils/unit/formatGwei.ts +11 -0
  999. package/utils/unit/formatUnits.ts +11 -0
  1000. package/utils/unit/parseEther.ts +11 -0
  1001. package/utils/unit/parseGwei.ts +11 -0
  1002. package/utils/unit/parseUnits.ts +11 -0
  1003. package/_cjs/chains/opStack/decorators/public.js.map +0 -1
  1004. package/_cjs/chains/opStack/types.js.map +0 -1
  1005. package/_esm/chains/opStack/decorators/public.js.map +0 -1
  1006. package/_esm/chains/opStack/types.js +0 -2
  1007. package/_esm/chains/opStack/types.js.map +0 -1
  1008. package/_types/chains/opStack/decorators/public.d.ts.map +0 -1
  1009. package/_types/chains/opStack/types.d.ts.map +0 -1
@@ -0,0 +1,171 @@
1
+ import type { Address } from 'abitype'
2
+ import {
3
+ type WriteContractErrorType,
4
+ writeContract,
5
+ } from '../../../actions/wallet/writeContract.js'
6
+ import type { Client } from '../../../clients/createClient.js'
7
+ import type { Transport } from '../../../clients/transports/createTransport.js'
8
+ import { zeroAddress } from '../../../constants/address.js'
9
+ import type { ErrorType } from '../../../errors/utils.js'
10
+ import type { Account, GetAccountParameter } from '../../../types/account.js'
11
+ import type {
12
+ Chain,
13
+ DeriveChain,
14
+ GetChainParameter,
15
+ } from '../../../types/chain.js'
16
+ import type { Hash, Hex } from '../../../types/misc.js'
17
+ import type { UnionEvaluate, UnionOmit } from '../../../types/utils.js'
18
+ import type { FormattedTransactionRequest } from '../../../utils/formatters/transactionRequest.js'
19
+ import { portalAbi } from '../abis.js'
20
+ import type { GetContractAddressParameter } from '../types/contract.js'
21
+
22
+ export type DepositTransactionParameters<
23
+ chain extends Chain | undefined = Chain | undefined,
24
+ account extends Account | undefined = Account | undefined,
25
+ chainOverride extends Chain | undefined = Chain | undefined,
26
+ _derivedChain extends Chain | undefined = DeriveChain<chain, chainOverride>,
27
+ > = UnionEvaluate<
28
+ UnionOmit<
29
+ FormattedTransactionRequest<_derivedChain>,
30
+ | 'accessList'
31
+ | 'data'
32
+ | 'from'
33
+ | 'gas'
34
+ | 'gasPrice'
35
+ | 'to'
36
+ | 'type'
37
+ | 'value'
38
+ >
39
+ > &
40
+ GetAccountParameter<account, Account | Address> &
41
+ GetChainParameter<chain, chainOverride> &
42
+ GetContractAddressParameter<_derivedChain, 'portal'> & {
43
+ /** Arguments supplied to the L2 transaction. */
44
+ args: {
45
+ /** Gas limit for transaction execution on the L2. */
46
+ gas: bigint
47
+ /** Value in wei to mint (deposit) on the L2. Debited from the caller's L1 balance. */
48
+ mint?: bigint
49
+ /** Value in wei sent with this transaction on the L2. Debited from the caller's L2 balance. */
50
+ value?: bigint
51
+ } & (
52
+ | {
53
+ /** Encoded contract method & arguments. */
54
+ data?: Hex
55
+ /** Whether or not this is a contract deployment transaction. */
56
+ isCreation?: false
57
+ /** L2 Transaction recipient. */
58
+ to?: Address
59
+ }
60
+ | {
61
+ /** Contract deployment bytecode. Required for contract deployment transactions. */
62
+ data: Hex
63
+ /** Whether or not this is a contract deployment transaction. */
64
+ isCreation: true
65
+ /** L2 Transaction recipient. Cannot exist for contract deployment transactions. */
66
+ to?: never
67
+ }
68
+ )
69
+ }
70
+ export type DepositTransactionReturnType = Hash
71
+ export type DepositTransactionErrorType = WriteContractErrorType | ErrorType
72
+
73
+ /**
74
+ * Initiates a [deposit transaction](https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md) on an L1, which executes a transaction on L2.
75
+ *
76
+ * Internally performs a contract write to the [`depositTransaction` function](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L1/OptimismPortal.sol#L378)
77
+ * on the [Optimism Portal contract](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L1/OptimismPortal.sol).
78
+ *
79
+ * - Docs: https://viem.sh/op-stack/actions/depositTransaction.html
80
+ *
81
+ * @param client - Client to use
82
+ * @param parameters - {@link DepositTransactionParameters}
83
+ * @returns The L1 transaction hash. {@link DepositTransactionReturnType}
84
+ *
85
+ * @example
86
+ * import { createWalletClient, custom, parseEther } from 'viem'
87
+ * import { base, mainnet } from 'viem/chains'
88
+ * import { walletActionsL1 } from 'viem/op-stack'
89
+ * import { depositTransaction } from 'viem/wallet'
90
+ *
91
+ * const client = createWalletClient({
92
+ * chain: mainnet,
93
+ * transport: custom(window.ethereum),
94
+ * }).extend(walletActionsL1())
95
+ *
96
+ * const hash = await depositTransaction(client, {
97
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
98
+ * args: {
99
+ * gas: 21_000n,
100
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
101
+ * value: parseEther('1'),
102
+ * },
103
+ * targetChain: base,
104
+ * })
105
+ *
106
+ * @example
107
+ * // Account Hoisting
108
+ * import { createWalletClient, http } from 'viem'
109
+ * import { privateKeyToAccount } from 'viem/accounts'
110
+ * import { base, mainnet } from 'viem/chains'
111
+ * import { walletActionsL1 } from 'viem/op-stack'
112
+ * import { depositTransaction } from 'viem/wallet'
113
+ *
114
+ * const client = createWalletClient({
115
+ * account: privateKeyToAccount('0x…'),
116
+ * chain: mainnet,
117
+ * transport: http(),
118
+ * }).extend(walletActionsL1())
119
+ *
120
+ * const hash = await depositTransaction(client, {
121
+ * args: {
122
+ * gas: 21_000n,
123
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
124
+ * value: parseEther('1'),
125
+ * },
126
+ * targetChain: base,
127
+ * })
128
+ */
129
+ export function depositTransaction<
130
+ chain extends Chain | undefined,
131
+ account extends Account | undefined,
132
+ chainOverride extends Chain | undefined = undefined,
133
+ >(
134
+ client: Client<Transport, chain, account>,
135
+ args: DepositTransactionParameters<chain, account, chainOverride>,
136
+ ) {
137
+ const {
138
+ account,
139
+ args: { data = '0x', gas, isCreation = false, mint, to = '0x', value },
140
+ chain = client.chain,
141
+ maxFeePerGas,
142
+ maxPriorityFeePerGas,
143
+ nonce,
144
+ targetChain,
145
+ } = args
146
+
147
+ const portalAddress = (() => {
148
+ if (args.portalAddress) return args.portalAddress
149
+ if (chain) return targetChain!.contracts.portal[chain.id].address
150
+ return Object.values(targetChain!.contracts.portal)[0].address
151
+ })()
152
+
153
+ return writeContract(client, {
154
+ account,
155
+ abi: portalAbi,
156
+ address: portalAddress,
157
+ chain,
158
+ functionName: 'depositTransaction',
159
+ args: [
160
+ isCreation ? zeroAddress : to,
161
+ value ?? mint ?? 0n,
162
+ gas,
163
+ isCreation,
164
+ data,
165
+ ],
166
+ maxFeePerGas,
167
+ maxPriorityFeePerGas,
168
+ nonce,
169
+ value: mint,
170
+ } as any)
171
+ }
@@ -15,7 +15,7 @@ import type { Transport } from '../../../clients/transports/createTransport.js'
15
15
  import { maxInt256 } from '../../../constants/number.js'
16
16
  import type { ErrorType } from '../../../errors/utils.js'
17
17
  import type { Account, GetAccountParameter } from '../../../types/account.js'
18
- import { type Chain, type GetChain } from '../../../types/chain.js'
18
+ import { type Chain, type GetChainParameter } from '../../../types/chain.js'
19
19
  import type { Signature } from '../../../types/misc.js'
20
20
  import type { TransactionRequestEIP1559 } from '../../../types/transaction.js'
21
21
  import type { RequestErrorType } from '../../../utils/buildRequest.js'
@@ -39,7 +39,7 @@ export type EstimateL1FeeParameters<
39
39
  TChainOverride extends Chain | undefined = undefined,
40
40
  > = Omit<TransactionRequestEIP1559, 'from'> &
41
41
  GetAccountParameter<TAccount> &
42
- GetChain<TChain, TChainOverride> & {
42
+ GetChainParameter<TChain, TChainOverride> & {
43
43
  /** Gas price oracle address. */
44
44
  gasPriceOracleAddress?: Address
45
45
  }
@@ -62,7 +62,7 @@ const stubSignature = {
62
62
  } as const satisfies Signature
63
63
 
64
64
  /**
65
- * Estimates the L1 fee required to execute an L2 transaction.
65
+ * Estimates the L1 data fee required to execute an L2 transaction.
66
66
  *
67
67
  * @param client - Client to use
68
68
  * @param parameters - {@link EstimateL1FeeParameters}
@@ -15,7 +15,7 @@ import type { Transport } from '../../../clients/transports/createTransport.js'
15
15
  import { maxInt256 } from '../../../constants/number.js'
16
16
  import type { ErrorType } from '../../../errors/utils.js'
17
17
  import type { Account, GetAccountParameter } from '../../../types/account.js'
18
- import { type Chain, type GetChain } from '../../../types/chain.js'
18
+ import { type Chain, type GetChainParameter } from '../../../types/chain.js'
19
19
  import type { Signature } from '../../../types/misc.js'
20
20
  import type { TransactionRequestEIP1559 } from '../../../types/transaction.js'
21
21
  import type { RequestErrorType } from '../../../utils/buildRequest.js'
@@ -39,7 +39,7 @@ export type EstimateL1GasParameters<
39
39
  TChainOverride extends Chain | undefined = Chain | undefined,
40
40
  > = Omit<TransactionRequestEIP1559, 'from'> &
41
41
  GetAccountParameter<TAccount> &
42
- GetChain<TChain, TChainOverride> & {
42
+ GetChainParameter<TChain, TChainOverride> & {
43
43
  /** Gas price oracle address. */
44
44
  gasPriceOracleAddress?: Address
45
45
  }
@@ -1,7 +1,9 @@
1
1
  import { contracts } from './contracts.js'
2
2
  import { formatters } from './formatters.js'
3
+ import { serializers } from './serializers.js'
3
4
 
4
5
  export const chainConfig = {
5
6
  contracts,
6
7
  formatters,
8
+ serializers,
7
9
  } as const
@@ -0,0 +1,9 @@
1
+ export { base } from '../definitions/base.js'
2
+ export { baseGoerli } from '../definitions/baseGoerli.js'
3
+ export { baseSepolia } from '../definitions/baseSepolia.js'
4
+ export { optimism } from '../definitions/optimism.js'
5
+ export { optimismGoerli } from '../definitions/optimismGoerli.js'
6
+ export { optimismSepolia } from '../definitions/optimismSepolia.js'
7
+ export { zora } from '../definitions/zora.js'
8
+ export { zoraSepolia } from '../definitions/zoraSepolia.js'
9
+ export { zoraTestnet } from '../definitions/zoraTestnet.js'
@@ -1,4 +1,4 @@
1
- import type { Abi } from 'abitype'
1
+ import type { Abi, Address } from 'abitype'
2
2
  import type { Client } from '../../../clients/createClient.js'
3
3
  import type { Transport } from '../../../clients/transports/createTransport.js'
4
4
  import type { Account } from '../../../types/account.js'
@@ -7,6 +7,11 @@ import type {
7
7
  ContractFunctionArgs,
8
8
  ContractFunctionName,
9
9
  } from '../../../types/contract.js'
10
+ import {
11
+ type BuildDepositTransactionParameters,
12
+ type BuildDepositTransactionReturnType,
13
+ buildDepositTransaction,
14
+ } from '../actions/buildDepositTransaction.js'
10
15
  import {
11
16
  type EstimateContractL1FeeParameters,
12
17
  type EstimateContractL1FeeReturnType,
@@ -48,7 +53,7 @@ import {
48
53
  estimateTotalGas,
49
54
  } from '../actions/estimateTotalGas.js'
50
55
 
51
- export type publicActionsL2<
56
+ export type PublicActionsL2<
52
57
  chain extends Chain | undefined = Chain | undefined,
53
58
  account extends Account | undefined = Account | undefined,
54
59
  > = {
@@ -312,15 +317,52 @@ export type publicActionsL2<
312
317
  estimateTotalGas: <chainOverride extends Chain | undefined = undefined>(
313
318
  parameters: EstimateTotalGasParameters<chain, account, chainOverride>,
314
319
  ) => Promise<EstimateTotalGasReturnType>
320
+ /**
321
+ * Prepares parameters for a [deposit transaction](https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md) to be initiated on an L1.
322
+ *
323
+ * - Docs: https://viem.sh/op-stack/actions/buildDepositTransaction.html
324
+ *
325
+ * @param client - Client to use
326
+ * @param parameters - {@link BuildDepositTransactionParameters}
327
+ * @returns Parameters for `depositTransaction`. {@link DepositTransactionReturnType}
328
+ *
329
+ * @example
330
+ * import { createWalletClient, http, parseEther } from 'viem'
331
+ * import { base } from 'viem/chains'
332
+ * import { publicActionsL2 } from 'viem/op-stack'
333
+ *
334
+ * const client = createWalletClient({
335
+ * chain: base,
336
+ * transport: http(),
337
+ * }).extend(publicActionsL2())
338
+ *
339
+ * const request = await client.buildDepositTransaction({
340
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
341
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
342
+ * value: parseEther('1'),
343
+ * })
344
+ */
345
+ buildDepositTransaction: <
346
+ chainOverride extends Chain | undefined = undefined,
347
+ accountOverride extends Account | Address | undefined = undefined,
348
+ >(
349
+ parameters: BuildDepositTransactionParameters<
350
+ chain,
351
+ account,
352
+ chainOverride,
353
+ accountOverride
354
+ >,
355
+ ) => Promise<BuildDepositTransactionReturnType<account, accountOverride>>
315
356
  }
316
357
 
317
358
  export function publicActionsL2() {
318
359
  return <
360
+ TTransport extends Transport,
319
361
  TChain extends Chain | undefined = Chain | undefined,
320
362
  TAccount extends Account | undefined = Account | undefined,
321
363
  >(
322
- client: Client<Transport, TChain, TAccount>,
323
- ): publicActionsL2<TChain, TAccount> => {
364
+ client: Client<TTransport, TChain, TAccount>,
365
+ ): PublicActionsL2<TChain, TAccount> => {
324
366
  return {
325
367
  estimateContractL1Fee: (args) => estimateContractL1Fee(client, args),
326
368
  estimateContractL1Gas: (args) => estimateContractL1Gas(client, args),
@@ -332,6 +374,7 @@ export function publicActionsL2() {
332
374
  estimateL1Gas: (args) => estimateL1Gas(client, args),
333
375
  estimateTotalFee: (args) => estimateTotalFee(client, args),
334
376
  estimateTotalGas: (args) => estimateTotalGas(client, args),
377
+ buildDepositTransaction: (args) => buildDepositTransaction(client, args),
335
378
  }
336
379
  }
337
380
  }
@@ -0,0 +1,86 @@
1
+ import type { Client } from '../../../clients/createClient.js'
2
+ import type { Transport } from '../../../clients/transports/createTransport.js'
3
+ import type { Account } from '../../../types/account.js'
4
+ import type { Chain } from '../../../types/chain.js'
5
+ import {
6
+ type DepositTransactionParameters,
7
+ type DepositTransactionReturnType,
8
+ depositTransaction,
9
+ } from '../actions/depositTransaction.js'
10
+
11
+ export type WalletActionsL1<
12
+ chain extends Chain | undefined = Chain | undefined,
13
+ account extends Account | undefined = Account | undefined,
14
+ > = {
15
+ /**
16
+ * Initiates a [deposit transaction](https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md) on an L1, which executes a transaction on L2.
17
+ *
18
+ * Internally performs a contract write to the [`depositTransaction` function](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L1/OptimismPortal.sol#L378)
19
+ * on the [Optimism Portal contract](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L1/OptimismPortal.sol).
20
+ *
21
+ * - Docs: https://viem.sh/op-stack/actions/depositTransaction.html
22
+ *
23
+ * @param client - Client to use
24
+ * @param parameters - {@link DepositTransactionParameters}
25
+ * @returns The L1 transaction hash. {@link DepositTransactionReturnType}
26
+ *
27
+ * @example
28
+ * import { createWalletClient, custom, parseEther } from 'viem'
29
+ * import { base, mainnet } from 'viem/chains'
30
+ * import { walletActionsL1 } from 'viem/op-stack'
31
+ *
32
+ * const client = createWalletClient({
33
+ * chain: mainnet,
34
+ * transport: custom(window.ethereum),
35
+ * }).extend(walletActionsL1())
36
+ *
37
+ * const hash = await client.depositTransaction({
38
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
39
+ * args: {
40
+ * gas: 21_000n,
41
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
42
+ * value: parseEther('1'),
43
+ * },
44
+ * targetChain: base,
45
+ * })
46
+ *
47
+ * @example
48
+ * // Account Hoisting
49
+ * import { createWalletClient, http } from 'viem'
50
+ * import { privateKeyToAccount } from 'viem/accounts'
51
+ * import { base, mainnet } from 'viem/chains'
52
+ * import { walletActionsL1 } from 'viem/op-stack'
53
+ *
54
+ * const client = createWalletClient({
55
+ * account: privateKeyToAccount('0x…'),
56
+ * chain: mainnet,
57
+ * transport: http(),
58
+ * }).extend(walletActionsL1())
59
+ *
60
+ * const hash = await client.depositTransaction({
61
+ * args: {
62
+ * gas: 21_000n,
63
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
64
+ * value: parseEther('1'),
65
+ * },
66
+ * targetChain: base,
67
+ * })
68
+ */
69
+ depositTransaction: <chainOverride extends Chain | undefined = undefined>(
70
+ parameters: DepositTransactionParameters<chain, account, chainOverride>,
71
+ ) => Promise<DepositTransactionReturnType>
72
+ }
73
+
74
+ export function walletActionsL1() {
75
+ return <
76
+ TTransport extends Transport,
77
+ TChain extends Chain | undefined = Chain | undefined,
78
+ TAccount extends Account | undefined = Account | undefined,
79
+ >(
80
+ client: Client<TTransport, TChain, TAccount>,
81
+ ): WalletActionsL1<TChain, TAccount> => {
82
+ return {
83
+ depositTransaction: (args) => depositTransaction(client, args),
84
+ }
85
+ }
86
+ }
@@ -11,11 +11,13 @@ import { defineTransactionReceipt } from '../../utils/formatters/transactionRece
11
11
  import type {
12
12
  OpStackBlockOverrides,
13
13
  OpStackRpcBlockOverrides,
14
+ } from './types/block.js'
15
+ import type {
14
16
  OpStackRpcTransaction,
15
17
  OpStackRpcTransactionReceiptOverrides,
16
18
  OpStackTransaction,
17
19
  OpStackTransactionReceiptOverrides,
18
- } from './types.js'
20
+ } from './types/transaction.js'
19
21
 
20
22
  export const formatters = {
21
23
  block: /*#__PURE__*/ defineBlock({
@@ -1,3 +1,9 @@
1
+ export {
2
+ depositTransaction,
3
+ type DepositTransactionErrorType,
4
+ type DepositTransactionParameters,
5
+ type DepositTransactionReturnType,
6
+ } from './actions/depositTransaction.js'
1
7
  export {
2
8
  estimateContractL1Fee,
3
9
  type EstimateContractL1FeeErrorType,
@@ -46,27 +52,51 @@ export {
46
52
  type EstimateTotalGasParameters,
47
53
  type EstimateTotalGasReturnType,
48
54
  } from './actions/estimateTotalGas.js'
55
+ export {
56
+ buildDepositTransaction,
57
+ type BuildDepositTransactionErrorType,
58
+ type BuildDepositTransactionParameters,
59
+ type BuildDepositTransactionReturnType,
60
+ } from './actions/buildDepositTransaction.js'
49
61
 
50
62
  export { chainConfig } from './chainConfig.js'
51
63
 
52
- export { publicActionsL2 } from './decorators/public.js'
64
+ export {
65
+ base,
66
+ baseGoerli,
67
+ baseSepolia,
68
+ optimism,
69
+ optimismGoerli,
70
+ optimismSepolia,
71
+ zora,
72
+ zoraSepolia,
73
+ zoraTestnet,
74
+ } from './chains.js'
75
+
76
+ export { publicActionsL2, type PublicActionsL2 } from './decorators/publicL2.js'
77
+ export { walletActionsL1, type WalletActionsL1 } from './decorators/walletL1.js'
78
+
79
+ export {
80
+ parseTransaction,
81
+ type ParseTransactionErrorType,
82
+ type ParseTransactionReturnType,
83
+ } from './parsers.js'
53
84
 
54
- export { base } from '../definitions/base.js'
55
- export { baseGoerli } from '../definitions/baseGoerli.js'
56
- export { baseSepolia } from '../definitions/baseSepolia.js'
57
- export { optimism } from '../definitions/optimism.js'
58
- export { optimismGoerli } from '../definitions/optimismGoerli.js'
59
- export { optimismSepolia } from '../definitions/optimismSepolia.js'
60
- export { zora } from '../definitions/zora.js'
61
- export { zoraSepolia } from '../definitions/zoraSepolia.js'
62
- export { zoraTestnet } from '../definitions/zoraTestnet.js'
85
+ export {
86
+ serializeTransaction,
87
+ serializers,
88
+ type SerializeTransactionErrorType,
89
+ type SerializeTransactionReturnType,
90
+ } from './serializers.js'
63
91
 
64
92
  export type {
65
93
  OpStackBlock,
66
94
  OpStackBlockOverrides,
67
- OpStackDepositTransaction,
68
95
  OpStackRpcBlock,
69
96
  OpStackRpcBlockOverrides,
97
+ } from './types/block.js'
98
+ export type {
99
+ OpStackDepositTransaction,
70
100
  OpStackRpcDepositTransaction,
71
101
  OpStackRpcTransaction,
72
102
  OpStackRpcTransactionReceipt,
@@ -74,4 +104,39 @@ export type {
74
104
  OpStackTransaction,
75
105
  OpStackTransactionReceipt,
76
106
  OpStackTransactionReceiptOverrides,
77
- } from './types.js'
107
+ } from './types/transaction.js'
108
+
109
+ export {
110
+ extractTransactionDepositedLogs,
111
+ type ExtractTransactionDepositedLogsErrorType,
112
+ type ExtractTransactionDepositedLogsParameters,
113
+ type ExtractTransactionDepositedLogsReturnType,
114
+ } from './utils/extractTransactionDepositedLogs.js'
115
+
116
+ export {
117
+ fromOpaqueData,
118
+ type FromOpaqueDataErrorType,
119
+ type FromOpaqueDataParameters,
120
+ type FromOpaqueDataReturnType,
121
+ } from './utils/fromOpaqueData.js'
122
+
123
+ export {
124
+ getL2TransactionHash,
125
+ type GetL2TransactionHashErrorType,
126
+ type GetL2TransactionHashParameters,
127
+ type GetL2TransactionHashReturnType,
128
+ } from './utils/getL2TransactionHash.js'
129
+
130
+ export {
131
+ getL2TransactionHashes,
132
+ type GetL2TransactionHashesErrorType,
133
+ type GetL2TransactionHashesParameters,
134
+ type GetL2TransactionHashesReturnType,
135
+ } from './utils/getL2TransactionHashes.js'
136
+
137
+ export {
138
+ getSourceHash,
139
+ type GetSourceHashErrorType,
140
+ type GetSourceHashParameters,
141
+ type GetSourceHashReturnType,
142
+ } from './utils/getSourceHash.js'
@@ -0,0 +1,88 @@
1
+ import { InvalidSerializedTransactionError } from '../../errors/transaction.js'
2
+ import type { ErrorType } from '../../errors/utils.js'
3
+ import { isHex } from '../../utils/data/isHex.js'
4
+ import { sliceHex } from '../../utils/data/slice.js'
5
+ import { hexToBigInt, hexToBool } from '../../utils/encoding/fromHex.js'
6
+ import type { GetSerializedTransactionType } from '../../utils/transaction/getSerializedTransactionType.js'
7
+ import {
8
+ type ParseTransactionErrorType as ParseTransactionErrorType_,
9
+ type ParseTransactionReturnType as ParseTransactionReturnType_,
10
+ parseTransaction as parseTransaction_,
11
+ toTransactionArray,
12
+ } from '../../utils/transaction/parseTransaction.js'
13
+ import { assertTransactionDeposit } from './serializers.js'
14
+ import type {
15
+ OpStackTransactionSerialized,
16
+ OpStackTransactionType,
17
+ TransactionSerializableDeposit,
18
+ TransactionSerializedDeposit,
19
+ } from './types/transaction.js'
20
+
21
+ export type ParseTransactionReturnType<
22
+ TSerialized extends
23
+ OpStackTransactionSerialized = OpStackTransactionSerialized,
24
+ TType extends
25
+ OpStackTransactionType = GetSerializedTransactionType<TSerialized>,
26
+ > = TSerialized extends TransactionSerializedDeposit
27
+ ? TransactionSerializableDeposit
28
+ : ParseTransactionReturnType_<TSerialized, TType>
29
+
30
+ export type ParseTransactionErrorType = ParseTransactionErrorType_ | ErrorType
31
+
32
+ export function parseTransaction<
33
+ TSerialized extends OpStackTransactionSerialized,
34
+ >(serializedTransaction: TSerialized): ParseTransactionReturnType<TSerialized> {
35
+ const serializedType = sliceHex(serializedTransaction, 0, 1)
36
+
37
+ if (serializedType === '0x7e')
38
+ return parseTransactionDeposit(
39
+ serializedTransaction as TransactionSerializedDeposit,
40
+ ) as ParseTransactionReturnType<TSerialized>
41
+
42
+ return parseTransaction_(
43
+ serializedTransaction,
44
+ ) as ParseTransactionReturnType<TSerialized>
45
+ }
46
+
47
+ function parseTransactionDeposit(
48
+ serializedTransaction: TransactionSerializedDeposit,
49
+ ): ParseTransactionReturnType<TransactionSerializedDeposit> {
50
+ const transactionArray = toTransactionArray(serializedTransaction)
51
+
52
+ const [sourceHash, from, to, mint, value, gas, isSystemTx, data] =
53
+ transactionArray
54
+
55
+ if (transactionArray.length !== 8 || !isHex(sourceHash) || !isHex(from))
56
+ throw new InvalidSerializedTransactionError({
57
+ attributes: {
58
+ sourceHash,
59
+ from,
60
+ gas,
61
+ to,
62
+ mint,
63
+ value,
64
+ isSystemTx,
65
+ data,
66
+ },
67
+ serializedTransaction,
68
+ type: 'deposit',
69
+ })
70
+
71
+ const transaction: TransactionSerializableDeposit = {
72
+ sourceHash,
73
+ from,
74
+ type: 'deposit',
75
+ }
76
+
77
+ if (isHex(gas) && gas !== '0x') transaction.gas = hexToBigInt(gas)
78
+ if (isHex(to) && to !== '0x') transaction.to = to
79
+ if (isHex(mint) && mint !== '0x') transaction.mint = hexToBigInt(mint)
80
+ if (isHex(value) && value !== '0x') transaction.value = hexToBigInt(value)
81
+ if (isHex(isSystemTx) && isSystemTx !== '0x')
82
+ transaction.isSystemTx = hexToBool(isSystemTx)
83
+ if (isHex(data) && data !== '0x') transaction.data = data
84
+
85
+ assertTransactionDeposit(transaction)
86
+
87
+ return transaction
88
+ }