viem 2.0.0-beta.8 → 2.0.0-rc.0

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 (474) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +9 -3
  3. package/_cjs/actions/ens/getEnsName.js +4 -2
  4. package/_cjs/actions/ens/getEnsName.js.map +1 -1
  5. package/_cjs/actions/index.js +16 -2
  6. package/_cjs/actions/index.js.map +1 -1
  7. package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
  8. package/_cjs/chains/definitions/arbitrumSepolia.js +4 -0
  9. package/_cjs/chains/definitions/arbitrumSepolia.js.map +1 -1
  10. package/_cjs/chains/definitions/base.js +5 -0
  11. package/_cjs/chains/definitions/base.js.map +1 -1
  12. package/_cjs/chains/definitions/baseGoerli.js +5 -0
  13. package/_cjs/chains/definitions/baseGoerli.js.map +1 -1
  14. package/_cjs/chains/definitions/baseSepolia.js +5 -0
  15. package/_cjs/chains/definitions/baseSepolia.js.map +1 -1
  16. package/_cjs/chains/definitions/fantomSonicTestnet.js +26 -0
  17. package/_cjs/chains/definitions/fantomSonicTestnet.js.map +1 -0
  18. package/_cjs/chains/definitions/optimism.js +5 -0
  19. package/_cjs/chains/definitions/optimism.js.map +1 -1
  20. package/_cjs/chains/definitions/optimismGoerli.js +5 -0
  21. package/_cjs/chains/definitions/optimismGoerli.js.map +1 -1
  22. package/_cjs/chains/definitions/optimismSepolia.js +5 -0
  23. package/_cjs/chains/definitions/optimismSepolia.js.map +1 -1
  24. package/_cjs/chains/definitions/pgn.js +12 -0
  25. package/_cjs/chains/definitions/pgn.js.map +1 -1
  26. package/_cjs/chains/definitions/pgnTestnet.js +7 -0
  27. package/_cjs/chains/definitions/pgnTestnet.js.map +1 -1
  28. package/_cjs/chains/definitions/zilliqa.js +26 -0
  29. package/_cjs/chains/definitions/zilliqa.js.map +1 -0
  30. package/_cjs/chains/definitions/zilliqaTestnet.js +26 -0
  31. package/_cjs/chains/definitions/zilliqaTestnet.js.map +1 -0
  32. package/_cjs/chains/definitions/zkSyncSepoliaTestnet.js +35 -0
  33. package/_cjs/chains/definitions/zkSyncSepoliaTestnet.js.map +1 -0
  34. package/_cjs/chains/definitions/zkSyncTestnet.js +4 -0
  35. package/_cjs/chains/definitions/zkSyncTestnet.js.map +1 -1
  36. package/_cjs/chains/definitions/zora.js +5 -0
  37. package/_cjs/chains/definitions/zora.js.map +1 -1
  38. package/_cjs/chains/definitions/zoraSepolia.js +5 -0
  39. package/_cjs/chains/definitions/zoraSepolia.js.map +1 -1
  40. package/_cjs/chains/index.js +12 -4
  41. package/_cjs/chains/index.js.map +1 -1
  42. package/_cjs/chains/opStack/abis.js +366 -1
  43. package/_cjs/chains/opStack/abis.js.map +1 -1
  44. package/_cjs/chains/opStack/actions/buildDepositTransaction.js +1 -1
  45. package/_cjs/chains/opStack/actions/buildDepositTransaction.js.map +1 -1
  46. package/_cjs/chains/opStack/actions/buildInitiateWithdrawal.js +29 -0
  47. package/_cjs/chains/opStack/actions/buildInitiateWithdrawal.js.map +1 -0
  48. package/_cjs/chains/opStack/actions/buildProveWithdrawal.js +39 -0
  49. package/_cjs/chains/opStack/actions/buildProveWithdrawal.js.map +1 -0
  50. package/_cjs/chains/opStack/actions/depositTransaction.js +11 -6
  51. package/_cjs/chains/opStack/actions/depositTransaction.js.map +1 -1
  52. package/_cjs/chains/opStack/actions/estimateDepositTransactionGas.js +37 -0
  53. package/_cjs/chains/opStack/actions/estimateDepositTransactionGas.js.map +1 -0
  54. package/_cjs/chains/opStack/actions/estimateFinalizeWithdrawalGas.js +29 -0
  55. package/_cjs/chains/opStack/actions/estimateFinalizeWithdrawalGas.js.map +1 -0
  56. package/_cjs/chains/opStack/actions/estimateInitiateWithdrawalGas.js +24 -0
  57. package/_cjs/chains/opStack/actions/estimateInitiateWithdrawalGas.js.map +1 -0
  58. package/_cjs/chains/opStack/actions/estimateProveWithdrawalGas.js +29 -0
  59. package/_cjs/chains/opStack/actions/estimateProveWithdrawalGas.js.map +1 -0
  60. package/_cjs/chains/opStack/actions/finalizeWithdrawal.js +33 -0
  61. package/_cjs/chains/opStack/actions/finalizeWithdrawal.js.map +1 -0
  62. package/_cjs/chains/opStack/actions/getL2Output.js +30 -0
  63. package/_cjs/chains/opStack/actions/getL2Output.js.map +1 -0
  64. package/_cjs/chains/opStack/actions/getTimeToFinalize.js +46 -0
  65. package/_cjs/chains/opStack/actions/getTimeToFinalize.js.map +1 -0
  66. package/_cjs/chains/opStack/actions/getTimeToNextL2Output.js +63 -0
  67. package/_cjs/chains/opStack/actions/getTimeToNextL2Output.js.map +1 -0
  68. package/_cjs/chains/opStack/actions/getTimeToProve.js +13 -0
  69. package/_cjs/chains/opStack/actions/getTimeToProve.js.map +1 -0
  70. package/_cjs/chains/opStack/actions/getWithdrawalStatus.js +71 -0
  71. package/_cjs/chains/opStack/actions/getWithdrawalStatus.js.map +1 -0
  72. package/_cjs/chains/opStack/actions/initiateWithdrawal.js +28 -0
  73. package/_cjs/chains/opStack/actions/initiateWithdrawal.js.map +1 -0
  74. package/_cjs/chains/opStack/actions/proveWithdrawal.js +33 -0
  75. package/_cjs/chains/opStack/actions/proveWithdrawal.js.map +1 -0
  76. package/_cjs/chains/opStack/actions/waitForNextL2Output.js +32 -0
  77. package/_cjs/chains/opStack/actions/waitForNextL2Output.js.map +1 -0
  78. package/_cjs/chains/opStack/actions/waitToFinalize.js +11 -0
  79. package/_cjs/chains/opStack/actions/waitToFinalize.js.map +1 -0
  80. package/_cjs/chains/opStack/actions/waitToProve.js +21 -0
  81. package/_cjs/chains/opStack/actions/waitToProve.js.map +1 -0
  82. package/_cjs/chains/opStack/chains.js +5 -1
  83. package/_cjs/chains/opStack/chains.js.map +1 -1
  84. package/_cjs/chains/opStack/decorators/publicL1.js +35 -0
  85. package/_cjs/chains/opStack/decorators/publicL1.js.map +1 -0
  86. package/_cjs/chains/opStack/decorators/publicL2.js +5 -1
  87. package/_cjs/chains/opStack/decorators/publicL2.js.map +1 -1
  88. package/_cjs/chains/opStack/decorators/walletL1.js +4 -0
  89. package/_cjs/chains/opStack/decorators/walletL1.js.map +1 -1
  90. package/_cjs/chains/opStack/decorators/walletL2.js +13 -0
  91. package/_cjs/chains/opStack/decorators/walletL2.js.map +1 -0
  92. package/_cjs/chains/opStack/errors/withdrawal.js +17 -0
  93. package/_cjs/chains/opStack/errors/withdrawal.js.map +1 -0
  94. package/_cjs/chains/opStack/index.js +43 -15
  95. package/_cjs/chains/opStack/index.js.map +1 -1
  96. package/_cjs/chains/opStack/types/deposit.js +3 -0
  97. package/_cjs/chains/opStack/types/deposit.js.map +1 -0
  98. package/_cjs/chains/opStack/types/withdrawal.js +3 -0
  99. package/_cjs/chains/opStack/types/withdrawal.js.map +1 -0
  100. package/_cjs/chains/opStack/utils/extractWithdrawalMessageLogs.js +14 -0
  101. package/_cjs/chains/opStack/utils/extractWithdrawalMessageLogs.js.map +1 -0
  102. package/_cjs/chains/opStack/utils/getL2TransactionHash.js +2 -2
  103. package/_cjs/chains/opStack/utils/getL2TransactionHash.js.map +1 -1
  104. package/_cjs/chains/opStack/utils/getWithdrawalHashStorageSlot.js +11 -0
  105. package/_cjs/chains/opStack/utils/getWithdrawalHashStorageSlot.js.map +1 -0
  106. package/_cjs/chains/opStack/utils/getWithdrawals.js +10 -0
  107. package/_cjs/chains/opStack/utils/getWithdrawals.js.map +1 -0
  108. package/_cjs/chains/opStack/utils/{fromOpaqueData.js → opaqueDataToDepositData.js} +4 -4
  109. package/_cjs/chains/opStack/utils/opaqueDataToDepositData.js.map +1 -0
  110. package/_cjs/errors/abi.js +21 -1
  111. package/_cjs/errors/abi.js.map +1 -1
  112. package/_cjs/errors/version.js +1 -1
  113. package/_cjs/errors/version.js.map +1 -1
  114. package/_cjs/index.js +10 -2
  115. package/_cjs/index.js.map +1 -1
  116. package/_cjs/utils/abi/getAbiItem.js +46 -3
  117. package/_cjs/utils/abi/getAbiItem.js.map +1 -1
  118. package/_cjs/utils/hash/ripemd160.js +16 -0
  119. package/_cjs/utils/hash/ripemd160.js.map +1 -0
  120. package/_cjs/utils/hash/sha256.js +16 -0
  121. package/_cjs/utils/hash/sha256.js.map +1 -0
  122. package/_cjs/utils/index.js +5 -1
  123. package/_cjs/utils/index.js.map +1 -1
  124. package/_esm/actions/ens/getEnsName.js +4 -2
  125. package/_esm/actions/ens/getEnsName.js.map +1 -1
  126. package/_esm/actions/index.js +7 -0
  127. package/_esm/actions/index.js.map +1 -1
  128. package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
  129. package/_esm/chains/definitions/arbitrumSepolia.js +4 -0
  130. package/_esm/chains/definitions/arbitrumSepolia.js.map +1 -1
  131. package/_esm/chains/definitions/base.js +5 -0
  132. package/_esm/chains/definitions/base.js.map +1 -1
  133. package/_esm/chains/definitions/baseGoerli.js +5 -0
  134. package/_esm/chains/definitions/baseGoerli.js.map +1 -1
  135. package/_esm/chains/definitions/baseSepolia.js +5 -0
  136. package/_esm/chains/definitions/baseSepolia.js.map +1 -1
  137. package/_esm/chains/definitions/fantomSonicTestnet.js +23 -0
  138. package/_esm/chains/definitions/fantomSonicTestnet.js.map +1 -0
  139. package/_esm/chains/definitions/optimism.js +5 -0
  140. package/_esm/chains/definitions/optimism.js.map +1 -1
  141. package/_esm/chains/definitions/optimismGoerli.js +5 -0
  142. package/_esm/chains/definitions/optimismGoerli.js.map +1 -1
  143. package/_esm/chains/definitions/optimismSepolia.js +5 -0
  144. package/_esm/chains/definitions/optimismSepolia.js.map +1 -1
  145. package/_esm/chains/definitions/pgn.js +12 -0
  146. package/_esm/chains/definitions/pgn.js.map +1 -1
  147. package/_esm/chains/definitions/pgnTestnet.js +7 -0
  148. package/_esm/chains/definitions/pgnTestnet.js.map +1 -1
  149. package/_esm/chains/definitions/zilliqa.js +23 -0
  150. package/_esm/chains/definitions/zilliqa.js.map +1 -0
  151. package/_esm/chains/definitions/zilliqaTestnet.js +23 -0
  152. package/_esm/chains/definitions/zilliqaTestnet.js.map +1 -0
  153. package/_esm/chains/definitions/zkSyncSepoliaTestnet.js +32 -0
  154. package/_esm/chains/definitions/zkSyncSepoliaTestnet.js.map +1 -0
  155. package/_esm/chains/definitions/zkSyncTestnet.js +5 -0
  156. package/_esm/chains/definitions/zkSyncTestnet.js.map +1 -1
  157. package/_esm/chains/definitions/zora.js +5 -0
  158. package/_esm/chains/definitions/zora.js.map +1 -1
  159. package/_esm/chains/definitions/zoraSepolia.js +5 -0
  160. package/_esm/chains/definitions/zoraSepolia.js.map +1 -1
  161. package/_esm/chains/index.js +4 -0
  162. package/_esm/chains/index.js.map +1 -1
  163. package/_esm/chains/opStack/abis.js +365 -0
  164. package/_esm/chains/opStack/abis.js.map +1 -1
  165. package/_esm/chains/opStack/actions/buildDepositTransaction.js +2 -2
  166. package/_esm/chains/opStack/actions/buildDepositTransaction.js.map +1 -1
  167. package/_esm/chains/opStack/actions/buildInitiateWithdrawal.js +50 -0
  168. package/_esm/chains/opStack/actions/buildInitiateWithdrawal.js.map +1 -0
  169. package/_esm/chains/opStack/actions/buildProveWithdrawal.js +59 -0
  170. package/_esm/chains/opStack/actions/buildProveWithdrawal.js.map +1 -0
  171. package/_esm/chains/opStack/actions/depositTransaction.js +17 -14
  172. package/_esm/chains/opStack/actions/depositTransaction.js.map +1 -1
  173. package/_esm/chains/opStack/actions/estimateDepositTransactionGas.js +62 -0
  174. package/_esm/chains/opStack/actions/estimateDepositTransactionGas.js.map +1 -0
  175. package/_esm/chains/opStack/actions/estimateFinalizeWithdrawalGas.js +50 -0
  176. package/_esm/chains/opStack/actions/estimateFinalizeWithdrawalGas.js.map +1 -0
  177. package/_esm/chains/opStack/actions/estimateInitiateWithdrawalGas.js +48 -0
  178. package/_esm/chains/opStack/actions/estimateInitiateWithdrawalGas.js.map +1 -0
  179. package/_esm/chains/opStack/actions/estimateProveWithdrawalGas.js +53 -0
  180. package/_esm/chains/opStack/actions/estimateProveWithdrawalGas.js.map +1 -0
  181. package/_esm/chains/opStack/actions/finalizeWithdrawal.js +53 -0
  182. package/_esm/chains/opStack/actions/finalizeWithdrawal.js.map +1 -0
  183. package/_esm/chains/opStack/actions/getL2Output.js +50 -0
  184. package/_esm/chains/opStack/actions/getL2Output.js.map +1 -0
  185. package/_esm/chains/opStack/actions/getTimeToFinalize.js +77 -0
  186. package/_esm/chains/opStack/actions/getTimeToFinalize.js.map +1 -0
  187. package/_esm/chains/opStack/actions/getTimeToNextL2Output.js +91 -0
  188. package/_esm/chains/opStack/actions/getTimeToNextL2Output.js.map +1 -0
  189. package/_esm/chains/opStack/actions/getTimeToProve.js +39 -0
  190. package/_esm/chains/opStack/actions/getTimeToProve.js.map +1 -0
  191. package/_esm/chains/opStack/actions/getWithdrawalStatus.js +99 -0
  192. package/_esm/chains/opStack/actions/getWithdrawalStatus.js.map +1 -0
  193. package/_esm/chains/opStack/actions/initiateWithdrawal.js +76 -0
  194. package/_esm/chains/opStack/actions/initiateWithdrawal.js.map +1 -0
  195. package/_esm/chains/opStack/actions/proveWithdrawal.js +57 -0
  196. package/_esm/chains/opStack/actions/proveWithdrawal.js.map +1 -0
  197. package/_esm/chains/opStack/actions/waitForNextL2Output.js +58 -0
  198. package/_esm/chains/opStack/actions/waitForNextL2Output.js.map +1 -0
  199. package/_esm/chains/opStack/actions/waitToFinalize.js +41 -0
  200. package/_esm/chains/opStack/actions/waitToFinalize.js.map +1 -0
  201. package/_esm/chains/opStack/actions/waitToProve.js +47 -0
  202. package/_esm/chains/opStack/actions/waitToProve.js.map +1 -0
  203. package/_esm/chains/opStack/chains.js +2 -0
  204. package/_esm/chains/opStack/chains.js.map +1 -1
  205. package/_esm/chains/opStack/decorators/publicL1.js +31 -0
  206. package/_esm/chains/opStack/decorators/publicL1.js.map +1 -0
  207. package/_esm/chains/opStack/decorators/publicL2.js +5 -1
  208. package/_esm/chains/opStack/decorators/publicL2.js.map +1 -1
  209. package/_esm/chains/opStack/decorators/walletL1.js +4 -0
  210. package/_esm/chains/opStack/decorators/walletL1.js.map +1 -1
  211. package/_esm/chains/opStack/decorators/walletL2.js +9 -0
  212. package/_esm/chains/opStack/decorators/walletL2.js.map +1 -0
  213. package/_esm/chains/opStack/errors/withdrawal.js +13 -0
  214. package/_esm/chains/opStack/errors/withdrawal.js.map +1 -0
  215. package/_esm/chains/opStack/index.js +21 -3
  216. package/_esm/chains/opStack/index.js.map +1 -1
  217. package/_esm/chains/opStack/types/deposit.js +2 -0
  218. package/_esm/chains/opStack/types/deposit.js.map +1 -0
  219. package/_esm/chains/opStack/types/withdrawal.js +2 -0
  220. package/_esm/chains/opStack/types/withdrawal.js.map +1 -0
  221. package/_esm/chains/opStack/utils/extractWithdrawalMessageLogs.js +10 -0
  222. package/_esm/chains/opStack/utils/extractWithdrawalMessageLogs.js.map +1 -0
  223. package/_esm/chains/opStack/utils/getL2TransactionHash.js +2 -2
  224. package/_esm/chains/opStack/utils/getL2TransactionHash.js.map +1 -1
  225. package/_esm/chains/opStack/utils/getWithdrawalHashStorageSlot.js +7 -0
  226. package/_esm/chains/opStack/utils/getWithdrawalHashStorageSlot.js.map +1 -0
  227. package/_esm/chains/opStack/utils/getWithdrawals.js +6 -0
  228. package/_esm/chains/opStack/utils/getWithdrawals.js.map +1 -0
  229. package/_esm/chains/opStack/utils/{fromOpaqueData.js → opaqueDataToDepositData.js} +2 -2
  230. package/_esm/chains/opStack/utils/opaqueDataToDepositData.js.map +1 -0
  231. package/_esm/errors/abi.js +19 -0
  232. package/_esm/errors/abi.js.map +1 -1
  233. package/_esm/errors/version.js +1 -1
  234. package/_esm/errors/version.js.map +1 -1
  235. package/_esm/index.js +4 -0
  236. package/_esm/index.js.map +1 -1
  237. package/_esm/utils/abi/getAbiItem.js +46 -2
  238. package/_esm/utils/abi/getAbiItem.js.map +1 -1
  239. package/_esm/utils/hash/ripemd160.js +12 -0
  240. package/_esm/utils/hash/ripemd160.js.map +1 -0
  241. package/_esm/utils/hash/sha256.js +12 -0
  242. package/_esm/utils/hash/sha256.js.map +1 -0
  243. package/_esm/utils/index.js +2 -0
  244. package/_esm/utils/index.js.map +1 -1
  245. package/_types/actions/ens/getEnsName.d.ts.map +1 -1
  246. package/_types/actions/index.d.ts +7 -0
  247. package/_types/actions/index.d.ts.map +1 -1
  248. package/_types/actions/public/getBlock.d.ts +1 -1
  249. package/_types/actions/public/getBlock.d.ts.map +1 -1
  250. package/_types/actions/public/getTransaction.d.ts +1 -1
  251. package/_types/actions/public/getTransaction.d.ts.map +1 -1
  252. package/_types/actions/public/getTransactionReceipt.d.ts +1 -1
  253. package/_types/actions/public/getTransactionReceipt.d.ts.map +1 -1
  254. package/_types/actions/wallet/prepareTransactionRequest.d.ts +5 -5
  255. package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
  256. package/_types/chains/celo/chainConfig.d.ts +180 -180
  257. package/_types/chains/celo/formatters.d.ts +180 -180
  258. package/_types/chains/definitions/arbitrumSepolia.d.ts +4 -0
  259. package/_types/chains/definitions/arbitrumSepolia.d.ts.map +1 -1
  260. package/_types/chains/definitions/base.d.ts +142 -137
  261. package/_types/chains/definitions/base.d.ts.map +1 -1
  262. package/_types/chains/definitions/baseGoerli.d.ts +142 -137
  263. package/_types/chains/definitions/baseGoerli.d.ts.map +1 -1
  264. package/_types/chains/definitions/baseSepolia.d.ts +142 -137
  265. package/_types/chains/definitions/baseSepolia.d.ts.map +1 -1
  266. package/_types/chains/definitions/celo.d.ts +180 -180
  267. package/_types/chains/definitions/celoAlfajores.d.ts +180 -180
  268. package/_types/chains/definitions/celoCannoli.d.ts +180 -180
  269. package/_types/chains/definitions/fantomSonicTestnet.d.ts +38 -0
  270. package/_types/chains/definitions/fantomSonicTestnet.d.ts.map +1 -0
  271. package/_types/chains/definitions/optimism.d.ts +142 -137
  272. package/_types/chains/definitions/optimism.d.ts.map +1 -1
  273. package/_types/chains/definitions/optimismGoerli.d.ts +142 -137
  274. package/_types/chains/definitions/optimismGoerli.d.ts.map +1 -1
  275. package/_types/chains/definitions/optimismSepolia.d.ts +142 -137
  276. package/_types/chains/definitions/optimismSepolia.d.ts.map +1 -1
  277. package/_types/chains/definitions/pgn.d.ts +147 -137
  278. package/_types/chains/definitions/pgn.d.ts.map +1 -1
  279. package/_types/chains/definitions/pgnTestnet.d.ts +142 -137
  280. package/_types/chains/definitions/pgnTestnet.d.ts.map +1 -1
  281. package/_types/chains/definitions/zilliqa.d.ts +38 -0
  282. package/_types/chains/definitions/zilliqa.d.ts.map +1 -0
  283. package/_types/chains/definitions/zilliqaTestnet.d.ts +38 -0
  284. package/_types/chains/definitions/zilliqaTestnet.d.ts.map +1 -0
  285. package/_types/chains/definitions/zkSync.d.ts +24 -24
  286. package/_types/chains/definitions/zkSyncSepoliaTestnet.d.ts +533 -0
  287. package/_types/chains/definitions/zkSyncSepoliaTestnet.d.ts.map +1 -0
  288. package/_types/chains/definitions/zkSyncTestnet.d.ts +29 -24
  289. package/_types/chains/definitions/zkSyncTestnet.d.ts.map +1 -1
  290. package/_types/chains/definitions/zora.d.ts +142 -137
  291. package/_types/chains/definitions/zora.d.ts.map +1 -1
  292. package/_types/chains/definitions/zoraSepolia.d.ts +142 -137
  293. package/_types/chains/definitions/zoraSepolia.d.ts.map +1 -1
  294. package/_types/chains/definitions/zoraTestnet.d.ts +137 -137
  295. package/_types/chains/index.d.ts +5 -1
  296. package/_types/chains/index.d.ts.map +1 -1
  297. package/_types/chains/opStack/abis.d.ts +457 -0
  298. package/_types/chains/opStack/abis.d.ts.map +1 -1
  299. package/_types/chains/opStack/actions/buildDepositTransaction.d.ts +5 -3
  300. package/_types/chains/opStack/actions/buildDepositTransaction.d.ts.map +1 -1
  301. package/_types/chains/opStack/actions/buildInitiateWithdrawal.d.ts +50 -0
  302. package/_types/chains/opStack/actions/buildInitiateWithdrawal.d.ts.map +1 -0
  303. package/_types/chains/opStack/actions/buildProveWithdrawal.d.ts +48 -0
  304. package/_types/chains/opStack/actions/buildProveWithdrawal.d.ts.map +1 -0
  305. package/_types/chains/opStack/actions/depositTransaction.d.ts +18 -34
  306. package/_types/chains/opStack/actions/depositTransaction.d.ts.map +1 -1
  307. package/_types/chains/opStack/actions/estimateDepositTransactionGas.d.ts +50 -0
  308. package/_types/chains/opStack/actions/estimateDepositTransactionGas.d.ts.map +1 -0
  309. package/_types/chains/opStack/actions/estimateFinalizeWithdrawalGas.d.ts +45 -0
  310. package/_types/chains/opStack/actions/estimateFinalizeWithdrawalGas.d.ts.map +1 -0
  311. package/_types/chains/opStack/actions/estimateInitiateWithdrawalGas.d.ts +51 -0
  312. package/_types/chains/opStack/actions/estimateInitiateWithdrawalGas.d.ts.map +1 -0
  313. package/_types/chains/opStack/actions/estimateProveWithdrawalGas.d.ts +63 -0
  314. package/_types/chains/opStack/actions/estimateProveWithdrawalGas.d.ts.map +1 -0
  315. package/_types/chains/opStack/actions/finalizeWithdrawal.d.ts +49 -0
  316. package/_types/chains/opStack/actions/finalizeWithdrawal.d.ts.map +1 -0
  317. package/_types/chains/opStack/actions/getL2Output.d.ts +44 -0
  318. package/_types/chains/opStack/actions/getL2Output.d.ts.map +1 -0
  319. package/_types/chains/opStack/actions/getTimeToFinalize.d.ts +57 -0
  320. package/_types/chains/opStack/actions/getTimeToFinalize.d.ts.map +1 -0
  321. package/_types/chains/opStack/actions/getTimeToNextL2Output.d.ts +61 -0
  322. package/_types/chains/opStack/actions/getTimeToNextL2Output.d.ts.map +1 -0
  323. package/_types/chains/opStack/actions/getTimeToProve.d.ts +50 -0
  324. package/_types/chains/opStack/actions/getTimeToProve.d.ts.map +1 -0
  325. package/_types/chains/opStack/actions/getWithdrawalStatus.d.ts +48 -0
  326. package/_types/chains/opStack/actions/getWithdrawalStatus.d.ts.map +1 -0
  327. package/_types/chains/opStack/actions/initiateWithdrawal.d.ts +77 -0
  328. package/_types/chains/opStack/actions/initiateWithdrawal.d.ts.map +1 -0
  329. package/_types/chains/opStack/actions/proveWithdrawal.d.ts +67 -0
  330. package/_types/chains/opStack/actions/proveWithdrawal.d.ts.map +1 -0
  331. package/_types/chains/opStack/actions/waitForNextL2Output.d.ts +55 -0
  332. package/_types/chains/opStack/actions/waitForNextL2Output.d.ts.map +1 -0
  333. package/_types/chains/opStack/actions/waitToFinalize.d.ts +45 -0
  334. package/_types/chains/opStack/actions/waitToFinalize.d.ts.map +1 -0
  335. package/_types/chains/opStack/actions/waitToProve.d.ts +55 -0
  336. package/_types/chains/opStack/actions/waitToProve.d.ts.map +1 -0
  337. package/_types/chains/opStack/chainConfig.d.ts +136 -136
  338. package/_types/chains/opStack/chains.d.ts +2 -0
  339. package/_types/chains/opStack/chains.d.ts.map +1 -1
  340. package/_types/chains/opStack/decorators/publicL1.d.ts +386 -0
  341. package/_types/chains/opStack/decorators/publicL1.d.ts.map +1 -0
  342. package/_types/chains/opStack/decorators/publicL2.d.ts +82 -26
  343. package/_types/chains/opStack/decorators/publicL2.d.ts.map +1 -1
  344. package/_types/chains/opStack/decorators/walletL1.d.ts +57 -2
  345. package/_types/chains/opStack/decorators/walletL1.d.ts.map +1 -1
  346. package/_types/chains/opStack/decorators/walletL2.d.ts +62 -0
  347. package/_types/chains/opStack/decorators/walletL2.d.ts.map +1 -0
  348. package/_types/chains/opStack/errors/withdrawal.d.ts +12 -0
  349. package/_types/chains/opStack/errors/withdrawal.d.ts.map +1 -0
  350. package/_types/chains/opStack/formatters.d.ts +136 -136
  351. package/_types/chains/opStack/index.d.ts +21 -3
  352. package/_types/chains/opStack/index.d.ts.map +1 -1
  353. package/_types/chains/opStack/types/deposit.d.ts +25 -0
  354. package/_types/chains/opStack/types/deposit.d.ts.map +1 -0
  355. package/_types/chains/opStack/types/withdrawal.d.ts +22 -0
  356. package/_types/chains/opStack/types/withdrawal.d.ts.map +1 -0
  357. package/_types/chains/opStack/utils/extractWithdrawalMessageLogs.d.ts +137 -0
  358. package/_types/chains/opStack/utils/extractWithdrawalMessageLogs.d.ts.map +1 -0
  359. package/_types/chains/opStack/utils/getWithdrawalHashStorageSlot.d.ts +11 -0
  360. package/_types/chains/opStack/utils/getWithdrawalHashStorageSlot.d.ts.map +1 -0
  361. package/_types/chains/opStack/utils/getWithdrawals.d.ts +12 -0
  362. package/_types/chains/opStack/utils/getWithdrawals.d.ts.map +1 -0
  363. package/_types/chains/opStack/utils/opaqueDataToDepositData.d.ts +15 -0
  364. package/_types/chains/opStack/utils/opaqueDataToDepositData.d.ts.map +1 -0
  365. package/_types/chains/zksync/chainConfig.d.ts +24 -24
  366. package/_types/chains/zksync/formatters.d.ts +24 -24
  367. package/_types/clients/decorators/public.d.ts +2 -2
  368. package/_types/clients/decorators/public.d.ts.map +1 -1
  369. package/_types/clients/decorators/wallet.d.ts +2 -2
  370. package/_types/clients/decorators/wallet.d.ts.map +1 -1
  371. package/_types/errors/abi.d.ts +14 -1
  372. package/_types/errors/abi.d.ts.map +1 -1
  373. package/_types/errors/version.d.ts +1 -1
  374. package/_types/errors/version.d.ts.map +1 -1
  375. package/_types/index.d.ts +15 -1
  376. package/_types/index.d.ts.map +1 -1
  377. package/_types/types/account.d.ts +1 -1
  378. package/_types/types/account.d.ts.map +1 -1
  379. package/_types/types/eip1193.d.ts +12 -0
  380. package/_types/types/eip1193.d.ts.map +1 -1
  381. package/_types/utils/abi/getAbiItem.d.ts +2 -1
  382. package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
  383. package/_types/utils/formatters/block.d.ts +1 -1
  384. package/_types/utils/formatters/block.d.ts.map +1 -1
  385. package/_types/utils/formatters/transaction.d.ts +2 -2
  386. package/_types/utils/formatters/transaction.d.ts.map +1 -1
  387. package/_types/utils/formatters/transactionReceipt.d.ts +1 -1
  388. package/_types/utils/formatters/transactionReceipt.d.ts.map +1 -1
  389. package/_types/utils/formatters/transactionRequest.d.ts +1 -1
  390. package/_types/utils/hash/ripemd160.d.ts +11 -0
  391. package/_types/utils/hash/ripemd160.d.ts.map +1 -0
  392. package/_types/utils/hash/sha256.d.ts +11 -0
  393. package/_types/utils/hash/sha256.d.ts.map +1 -0
  394. package/_types/utils/index.d.ts +2 -0
  395. package/_types/utils/index.d.ts.map +1 -1
  396. package/actions/ens/getEnsName.ts +3 -2
  397. package/actions/index.ts +31 -0
  398. package/actions/public/getBlock.ts +1 -1
  399. package/actions/public/getTransaction.ts +1 -1
  400. package/actions/public/getTransactionReceipt.ts +1 -1
  401. package/actions/wallet/prepareTransactionRequest.ts +16 -9
  402. package/chains/definitions/arbitrumSepolia.ts +4 -0
  403. package/chains/definitions/base.ts +5 -0
  404. package/chains/definitions/baseGoerli.ts +5 -0
  405. package/chains/definitions/baseSepolia.ts +5 -0
  406. package/chains/definitions/fantomSonicTestnet.ts +23 -0
  407. package/chains/definitions/optimism.ts +5 -0
  408. package/chains/definitions/optimismGoerli.ts +5 -0
  409. package/chains/definitions/optimismSepolia.ts +5 -0
  410. package/chains/definitions/pgn.ts +13 -0
  411. package/chains/definitions/pgnTestnet.ts +8 -0
  412. package/chains/definitions/zilliqa.ts +23 -0
  413. package/chains/definitions/zilliqaTestnet.ts +23 -0
  414. package/chains/definitions/zkSyncSepoliaTestnet.ts +32 -0
  415. package/chains/definitions/zkSyncTestnet.ts +5 -0
  416. package/chains/definitions/zora.ts +5 -0
  417. package/chains/definitions/zoraSepolia.ts +5 -0
  418. package/chains/index.ts +9 -0
  419. package/chains/opStack/abis.ts +367 -0
  420. package/chains/opStack/actions/buildDepositTransaction.ts +11 -6
  421. package/chains/opStack/actions/buildInitiateWithdrawal.ts +118 -0
  422. package/chains/opStack/actions/buildProveWithdrawal.ts +149 -0
  423. package/chains/opStack/actions/depositTransaction.ts +50 -44
  424. package/chains/opStack/actions/estimateDepositTransactionGas.ts +138 -0
  425. package/chains/opStack/actions/estimateFinalizeWithdrawalGas.ts +118 -0
  426. package/chains/opStack/actions/estimateInitiateWithdrawalGas.ts +118 -0
  427. package/chains/opStack/actions/estimateProveWithdrawalGas.ts +139 -0
  428. package/chains/opStack/actions/finalizeWithdrawal.ts +130 -0
  429. package/chains/opStack/actions/getL2Output.ts +89 -0
  430. package/chains/opStack/actions/getTimeToFinalize.ts +122 -0
  431. package/chains/opStack/actions/getTimeToNextL2Output.ts +162 -0
  432. package/chains/opStack/actions/getTimeToProve.ts +79 -0
  433. package/chains/opStack/actions/getWithdrawalStatus.ts +152 -0
  434. package/chains/opStack/actions/initiateWithdrawal.ts +153 -0
  435. package/chains/opStack/actions/proveWithdrawal.ts +151 -0
  436. package/chains/opStack/actions/waitForNextL2Output.ts +111 -0
  437. package/chains/opStack/actions/waitToFinalize.ts +64 -0
  438. package/chains/opStack/actions/waitToProve.ts +99 -0
  439. package/chains/opStack/chains.ts +2 -0
  440. package/chains/opStack/decorators/publicL1.ts +514 -0
  441. package/chains/opStack/decorators/publicL2.ts +129 -37
  442. package/chains/opStack/decorators/walletL1.ts +71 -2
  443. package/chains/opStack/decorators/walletL2.ts +84 -0
  444. package/chains/opStack/errors/withdrawal.ts +15 -0
  445. package/chains/opStack/index.ts +112 -21
  446. package/chains/opStack/types/deposit.ts +28 -0
  447. package/chains/opStack/types/withdrawal.ts +23 -0
  448. package/chains/opStack/utils/extractWithdrawalMessageLogs.ts +36 -0
  449. package/chains/opStack/utils/getL2TransactionHash.ts +2 -2
  450. package/chains/opStack/utils/getWithdrawalHashStorageSlot.ts +29 -0
  451. package/chains/opStack/utils/getWithdrawals.ts +25 -0
  452. package/chains/opStack/utils/{fromOpaqueData.ts → opaqueDataToDepositData.ts} +9 -4
  453. package/clients/decorators/public.ts +2 -2
  454. package/clients/decorators/wallet.ts +2 -2
  455. package/errors/abi.ts +22 -1
  456. package/errors/version.ts +1 -1
  457. package/index.ts +40 -0
  458. package/package.json +1 -1
  459. package/types/account.ts +1 -1
  460. package/types/eip1193.ts +12 -0
  461. package/utils/abi/getAbiItem.ts +71 -2
  462. package/utils/formatters/block.ts +1 -1
  463. package/utils/formatters/transaction.ts +1 -1
  464. package/utils/formatters/transactionReceipt.ts +1 -1
  465. package/utils/hash/ripemd160.ts +31 -0
  466. package/utils/hash/sha256.ts +31 -0
  467. package/utils/index.ts +2 -0
  468. package/_cjs/chains/opStack/utils/fromOpaqueData.js.map +0 -1
  469. package/_esm/chains/opStack/utils/fromOpaqueData.js.map +0 -1
  470. package/_types/chains/opStack/utils/fromOpaqueData.d.ts +0 -15
  471. package/_types/chains/opStack/utils/fromOpaqueData.d.ts.map +0 -1
  472. package/chains/celo/package.json +0 -6
  473. package/chains/opStack/package.json +0 -6
  474. package/chains/zksync/package.json +0 -6
@@ -4,17 +4,21 @@ exports.depositTransaction = void 0;
4
4
  const writeContract_js_1 = require("../../../actions/wallet/writeContract.js");
5
5
  const address_js_1 = require("../../../constants/address.js");
6
6
  const abis_js_1 = require("../abis.js");
7
- function depositTransaction(client, args) {
8
- const { account, args: { data = '0x', gas, isCreation = false, mint, to = '0x', value }, chain = client.chain, maxFeePerGas, maxPriorityFeePerGas, nonce, targetChain, } = args;
7
+ const estimateDepositTransactionGas_js_1 = require("./estimateDepositTransactionGas.js");
8
+ async function depositTransaction(client, parameters) {
9
+ const { account, chain = client.chain, gas, maxFeePerGas, maxPriorityFeePerGas, nonce, request: { data = '0x', gas: l2Gas, isCreation = false, mint, to = '0x', value, }, targetChain, } = parameters;
9
10
  const portalAddress = (() => {
10
- if (args.portalAddress)
11
- return args.portalAddress;
11
+ if (parameters.portalAddress)
12
+ return parameters.portalAddress;
12
13
  if (chain)
13
14
  return targetChain.contracts.portal[chain.id].address;
14
15
  return Object.values(targetChain.contracts.portal)[0].address;
15
16
  })();
17
+ const gas_ = typeof gas !== 'number' && gas !== null
18
+ ? await (0, estimateDepositTransactionGas_js_1.estimateDepositTransactionGas)(client, parameters)
19
+ : undefined;
16
20
  return (0, writeContract_js_1.writeContract)(client, {
17
- account,
21
+ account: account,
18
22
  abi: abis_js_1.portalAbi,
19
23
  address: portalAddress,
20
24
  chain,
@@ -22,7 +26,7 @@ function depositTransaction(client, args) {
22
26
  args: [
23
27
  isCreation ? address_js_1.zeroAddress : to,
24
28
  value ?? mint ?? 0n,
25
- gas,
29
+ l2Gas,
26
30
  isCreation,
27
31
  data,
28
32
  ],
@@ -30,6 +34,7 @@ function depositTransaction(client, args) {
30
34
  maxPriorityFeePerGas,
31
35
  nonce,
32
36
  value: mint,
37
+ gas: gas_,
33
38
  });
34
39
  }
35
40
  exports.depositTransaction = depositTransaction;
@@ -1 +1 @@
1
- {"version":3,"file":"depositTransaction.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/depositTransaction.ts"],"names":[],"mappings":";;;AACA,+EAGiD;AAGjD,8DAA2D;AAW3D,wCAAsC;AA8GtC,SAAgB,kBAAkB,CAKhC,MAAyC,EACzC,IAAiE;IAEjE,MAAM,EACJ,OAAO,EACP,IAAI,EAAE,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,EAAE,UAAU,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,EACtE,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,WAAW,GACZ,GAAG,IAAI,CAAA;IAER,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,IAAI,CAAC,aAAa;YAAE,OAAO,IAAI,CAAC,aAAa,CAAA;QACjD,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACjE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAChE,CAAC,CAAC,EAAE,CAAA;IAEJ,OAAO,IAAA,gCAAa,EAAC,MAAM,EAAE;QAC3B,OAAO;QACP,GAAG,EAAE,mBAAS;QACd,OAAO,EAAE,aAAa;QACtB,KAAK;QACL,YAAY,EAAE,oBAAoB;QAClC,IAAI,EAAE;YACJ,UAAU,CAAC,CAAC,CAAC,wBAAW,CAAC,CAAC,CAAC,EAAE;YAC7B,KAAK,IAAI,IAAI,IAAI,EAAE;YACnB,GAAG;YACH,UAAU;YACV,IAAI;SACL;QACD,YAAY;QACZ,oBAAoB;QACpB,KAAK;QACL,KAAK,EAAE,IAAI;KACL,CAAC,CAAA;AACX,CAAC;AA1CD,gDA0CC"}
1
+ {"version":3,"file":"depositTransaction.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/depositTransaction.ts"],"names":[],"mappings":";;;AACA,+EAIiD;AAGjD,8DAA2D;AAW3D,wCAAsC;AAGtC,yFAI2C;AA2FpC,KAAK,UAAU,kBAAkB,CAKtC,MAAyC,EACzC,UAAuE;IAEvE,MAAM,EACJ,OAAO,EACP,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,GAAG,EACH,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,OAAO,EAAE,EACP,IAAI,GAAG,IAAI,EACX,GAAG,EAAE,KAAK,EACV,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,EAAE,GAAG,IAAI,EACT,KAAK,GACN,EACD,WAAW,GACZ,GAAG,UAAU,CAAA;IAEd,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,UAAU,CAAC,aAAa;YAAE,OAAO,UAAU,CAAC,aAAa,CAAA;QAC7D,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACjE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAChE,CAAC,CAAC,EAAE,CAAA;IAEJ,MAAM,IAAI,GACR,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QACrC,CAAC,CAAC,MAAM,IAAA,gEAA6B,EACjC,MAAM,EACN,UAAqD,CACtD;QACH,CAAC,CAAC,SAAS,CAAA;IAEf,OAAO,IAAA,gCAAa,EAAC,MAAM,EAAE;QAC3B,OAAO,EAAE,OAAQ;QACjB,GAAG,EAAE,mBAAS;QACd,OAAO,EAAE,aAAa;QACtB,KAAK;QACL,YAAY,EAAE,oBAAoB;QAClC,IAAI,EAAE;YACJ,UAAU,CAAC,CAAC,CAAC,wBAAW,CAAC,CAAC,CAAC,EAAE;YAC7B,KAAK,IAAI,IAAI,IAAI,EAAE;YACnB,KAAK;YACL,UAAU;YACV,IAAI;SACL;QACD,YAAY;QACZ,oBAAoB;QACpB,KAAK;QACL,KAAK,EAAE,IAAI;QACX,GAAG,EAAE,IAAI;KAC+B,CAAC,CAAA;AAC7C,CAAC;AA3DD,gDA2DC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.estimateDepositTransactionGas = void 0;
4
+ const estimateContractGas_js_1 = require("../../../actions/public/estimateContractGas.js");
5
+ const address_js_1 = require("../../../constants/address.js");
6
+ const abis_js_1 = require("../abis.js");
7
+ async function estimateDepositTransactionGas(client, parameters) {
8
+ const { account, chain = client.chain, gas, maxFeePerGas, maxPriorityFeePerGas, nonce, request: { data = '0x', gas: l2Gas, isCreation = false, mint, to = '0x', value, }, targetChain, } = parameters;
9
+ const portalAddress = (() => {
10
+ if (parameters.portalAddress)
11
+ return parameters.portalAddress;
12
+ if (chain)
13
+ return targetChain.contracts.portal[chain.id].address;
14
+ return Object.values(targetChain.contracts.portal)[0].address;
15
+ })();
16
+ return (0, estimateContractGas_js_1.estimateContractGas)(client, {
17
+ account,
18
+ abi: abis_js_1.portalAbi,
19
+ address: portalAddress,
20
+ chain,
21
+ functionName: 'depositTransaction',
22
+ args: [
23
+ isCreation ? address_js_1.zeroAddress : to,
24
+ value ?? mint ?? 0n,
25
+ l2Gas,
26
+ isCreation,
27
+ data,
28
+ ],
29
+ gas,
30
+ maxFeePerGas,
31
+ maxPriorityFeePerGas,
32
+ nonce,
33
+ value: mint,
34
+ });
35
+ }
36
+ exports.estimateDepositTransactionGas = estimateDepositTransactionGas;
37
+ //# sourceMappingURL=estimateDepositTransactionGas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimateDepositTransactionGas.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/estimateDepositTransactionGas.ts"],"names":[],"mappings":";;;AACA,2FAIuD;AAGvD,8DAA2D;AAU3D,wCAAsC;AAgE/B,KAAK,UAAU,6BAA6B,CAKjD,MAAyC,EACzC,UAIC;IAED,MAAM,EACJ,OAAO,EACP,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,GAAG,EACH,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,OAAO,EAAE,EACP,IAAI,GAAG,IAAI,EACX,GAAG,EAAE,KAAK,EACV,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,EAAE,GAAG,IAAI,EACT,KAAK,GACN,EACD,WAAW,GACZ,GAAG,UAAU,CAAA;IAEd,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,UAAU,CAAC,aAAa;YAAE,OAAO,UAAU,CAAC,aAAa,CAAA;QAC7D,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACjE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAChE,CAAC,CAAC,EAAE,CAAA;IAEJ,OAAO,IAAA,4CAAmB,EAAC,MAAM,EAAE;QACjC,OAAO;QACP,GAAG,EAAE,mBAAS;QACd,OAAO,EAAE,aAAa;QACtB,KAAK;QACL,YAAY,EAAE,oBAAoB;QAClC,IAAI,EAAE;YACJ,UAAU,CAAC,CAAC,CAAC,wBAAW,CAAC,CAAC,CAAC,EAAE;YAC7B,KAAK,IAAI,IAAI,IAAI,EAAE;YACnB,KAAK;YACL,UAAU;YACV,IAAI;SACL;QACD,GAAG;QACH,YAAY;QACZ,oBAAoB;QACpB,KAAK;QACL,KAAK,EAAE,IAAI;KACqB,CAAC,CAAA;AACrC,CAAC;AAvDD,sEAuDC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.estimateFinalizeWithdrawalGas = void 0;
4
+ const estimateContractGas_js_1 = require("../../../actions/public/estimateContractGas.js");
5
+ const abis_js_1 = require("../abis.js");
6
+ async function estimateFinalizeWithdrawalGas(client, parameters) {
7
+ const { account, chain = client.chain, gas, maxFeePerGas, maxPriorityFeePerGas, nonce, targetChain, withdrawal, } = parameters;
8
+ const portalAddress = (() => {
9
+ if (parameters.portalAddress)
10
+ return parameters.portalAddress;
11
+ if (chain)
12
+ return targetChain.contracts.portal[chain.id].address;
13
+ return Object.values(targetChain.contracts.portal)[0].address;
14
+ })();
15
+ return (0, estimateContractGas_js_1.estimateContractGas)(client, {
16
+ account,
17
+ abi: abis_js_1.portalAbi,
18
+ address: portalAddress,
19
+ chain,
20
+ functionName: 'finalizeWithdrawalTransaction',
21
+ args: [withdrawal],
22
+ gas,
23
+ maxFeePerGas,
24
+ maxPriorityFeePerGas,
25
+ nonce,
26
+ });
27
+ }
28
+ exports.estimateFinalizeWithdrawalGas = estimateFinalizeWithdrawalGas;
29
+ //# sourceMappingURL=estimateFinalizeWithdrawalGas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimateFinalizeWithdrawalGas.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/estimateFinalizeWithdrawalGas.ts"],"names":[],"mappings":";;;AACA,2FAIuD;AAYvD,wCAAsC;AA2D/B,KAAK,UAAU,6BAA6B,CAKjD,MAAyC,EACzC,UAIC;IAED,MAAM,EACJ,OAAO,EACP,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,GAAG,EACH,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,WAAW,EACX,UAAU,GACX,GAAG,UAAU,CAAA;IAEd,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,UAAU,CAAC,aAAa;YAAE,OAAO,UAAU,CAAC,aAAa,CAAA;QAC7D,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACjE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAChE,CAAC,CAAC,EAAE,CAAA;IAEJ,OAAO,IAAA,4CAAmB,EAAC,MAAM,EAAE;QACjC,OAAO;QACP,GAAG,EAAE,mBAAS;QACd,OAAO,EAAE,aAAa;QACtB,KAAK;QACL,YAAY,EAAE,+BAA+B;QAC7C,IAAI,EAAE,CAAC,UAAU,CAAC;QAClB,GAAG;QACH,YAAY;QACZ,oBAAoB;QACpB,KAAK;KAC2B,CAAC,CAAA;AACrC,CAAC;AAzCD,sEAyCC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.estimateInitiateWithdrawalGas = void 0;
4
+ const estimateContractGas_js_1 = require("../../../actions/public/estimateContractGas.js");
5
+ const abis_js_1 = require("../abis.js");
6
+ const contracts_js_1 = require("../contracts.js");
7
+ async function estimateInitiateWithdrawalGas(client, parameters) {
8
+ const { account, chain = client.chain, gas, maxFeePerGas, maxPriorityFeePerGas, nonce, request: { data = '0x', gas: l1Gas, to, value }, } = parameters;
9
+ return (0, estimateContractGas_js_1.estimateContractGas)(client, {
10
+ account,
11
+ abi: abis_js_1.l2ToL1MessagePasserAbi,
12
+ address: contracts_js_1.contracts.l2ToL1MessagePasser.address,
13
+ chain,
14
+ functionName: 'initiateWithdrawal',
15
+ args: [to, l1Gas, data],
16
+ gas,
17
+ maxFeePerGas,
18
+ maxPriorityFeePerGas,
19
+ nonce,
20
+ value,
21
+ });
22
+ }
23
+ exports.estimateInitiateWithdrawalGas = estimateInitiateWithdrawalGas;
24
+ //# sourceMappingURL=estimateInitiateWithdrawalGas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimateInitiateWithdrawalGas.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/estimateInitiateWithdrawalGas.ts"],"names":[],"mappings":";;;AACA,2FAIuD;AAYvD,wCAAmD;AACnD,kDAA2C;AAgEpC,KAAK,UAAU,6BAA6B,CAKjD,MAAyC,EACzC,UAIC;IAED,MAAM,EACJ,OAAO,EACP,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,GAAG,EACH,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,OAAO,EAAE,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAChD,GAAG,UAAU,CAAA;IAEd,OAAO,IAAA,4CAAmB,EAAC,MAAM,EAAE;QACjC,OAAO;QACP,GAAG,EAAE,gCAAsB;QAC3B,OAAO,EAAE,wBAAS,CAAC,mBAAmB,CAAC,OAAO;QAC9C,KAAK;QACL,YAAY,EAAE,oBAAoB;QAClC,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC;QACvB,GAAG;QACH,YAAY;QACZ,oBAAoB;QACpB,KAAK;QACL,KAAK;KAC2B,CAAC,CAAA;AACrC,CAAC;AAnCD,sEAmCC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.estimateProveWithdrawalGas = void 0;
4
+ const estimateContractGas_js_1 = require("../../../actions/public/estimateContractGas.js");
5
+ const abis_js_1 = require("../abis.js");
6
+ async function estimateProveWithdrawalGas(client, parameters) {
7
+ const { account, chain = client.chain, gas, l2OutputIndex, maxFeePerGas, maxPriorityFeePerGas, nonce, outputRootProof, targetChain, withdrawalProof, withdrawal, } = parameters;
8
+ const portalAddress = (() => {
9
+ if (parameters.portalAddress)
10
+ return parameters.portalAddress;
11
+ if (chain)
12
+ return targetChain.contracts.portal[chain.id].address;
13
+ return Object.values(targetChain.contracts.portal)[0].address;
14
+ })();
15
+ return (0, estimateContractGas_js_1.estimateContractGas)(client, {
16
+ account,
17
+ abi: abis_js_1.portalAbi,
18
+ address: portalAddress,
19
+ chain,
20
+ functionName: 'proveWithdrawalTransaction',
21
+ args: [withdrawal, l2OutputIndex, outputRootProof, withdrawalProof],
22
+ gas,
23
+ maxFeePerGas,
24
+ maxPriorityFeePerGas,
25
+ nonce,
26
+ });
27
+ }
28
+ exports.estimateProveWithdrawalGas = estimateProveWithdrawalGas;
29
+ //# sourceMappingURL=estimateProveWithdrawalGas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimateProveWithdrawalGas.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/estimateProveWithdrawalGas.ts"],"names":[],"mappings":";;;AACA,2FAIuD;AAavD,wCAAsC;AA4E/B,KAAK,UAAU,0BAA0B,CAK9C,MAAyC,EACzC,UAIC;IAED,MAAM,EACJ,OAAO,EACP,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,GAAG,EACH,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,eAAe,EACf,WAAW,EACX,eAAe,EACf,UAAU,GACX,GAAG,UAAU,CAAA;IAEd,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,UAAU,CAAC,aAAa;YAAE,OAAO,UAAU,CAAC,aAAa,CAAA;QAC7D,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACjE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAChE,CAAC,CAAC,EAAE,CAAA;IAEJ,OAAO,IAAA,4CAAmB,EAAC,MAAM,EAAE;QACjC,OAAO;QACP,GAAG,EAAE,mBAAS;QACd,OAAO,EAAE,aAAa;QACtB,KAAK;QACL,YAAY,EAAE,4BAA4B;QAC1C,IAAI,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,CAAC;QACnE,GAAG;QACH,YAAY;QACZ,oBAAoB;QACpB,KAAK;KAC2B,CAAC,CAAA;AACrC,CAAC;AA5CD,gEA4CC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.finalizeWithdrawal = void 0;
4
+ const writeContract_js_1 = require("../../../actions/wallet/writeContract.js");
5
+ const abis_js_1 = require("../abis.js");
6
+ const estimateFinalizeWithdrawalGas_js_1 = require("./estimateFinalizeWithdrawalGas.js");
7
+ async function finalizeWithdrawal(client, parameters) {
8
+ const { account, chain = client.chain, gas, maxFeePerGas, maxPriorityFeePerGas, nonce, targetChain, withdrawal, } = parameters;
9
+ const portalAddress = (() => {
10
+ if (parameters.portalAddress)
11
+ return parameters.portalAddress;
12
+ if (chain)
13
+ return targetChain.contracts.portal[chain.id].address;
14
+ return Object.values(targetChain.contracts.portal)[0].address;
15
+ })();
16
+ const gas_ = typeof gas !== 'number' && gas !== null
17
+ ? await (0, estimateFinalizeWithdrawalGas_js_1.estimateFinalizeWithdrawalGas)(client, parameters)
18
+ : undefined;
19
+ return (0, writeContract_js_1.writeContract)(client, {
20
+ account,
21
+ abi: abis_js_1.portalAbi,
22
+ address: portalAddress,
23
+ chain,
24
+ functionName: 'finalizeWithdrawalTransaction',
25
+ args: [withdrawal],
26
+ gas: gas_,
27
+ maxFeePerGas,
28
+ maxPriorityFeePerGas,
29
+ nonce,
30
+ });
31
+ }
32
+ exports.finalizeWithdrawal = finalizeWithdrawal;
33
+ //# sourceMappingURL=finalizeWithdrawal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finalizeWithdrawal.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/finalizeWithdrawal.ts"],"names":[],"mappings":";;;AACA,+EAGiD;AAajD,wCAAsC;AAGtC,yFAI2C;AA4DpC,KAAK,UAAU,kBAAkB,CAKtC,MAAyC,EACzC,UAAuE;IAEvE,MAAM,EACJ,OAAO,EACP,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,GAAG,EACH,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,WAAW,EACX,UAAU,GACX,GAAG,UAAU,CAAA;IAEd,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,UAAU,CAAC,aAAa;YAAE,OAAO,UAAU,CAAC,aAAa,CAAA;QAC7D,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACjE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAChE,CAAC,CAAC,EAAE,CAAA;IAEJ,MAAM,IAAI,GACR,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QACrC,CAAC,CAAC,MAAM,IAAA,gEAA6B,EACjC,MAAM,EACN,UAAqD,CACtD;QACH,CAAC,CAAC,SAAS,CAAA;IAEf,OAAO,IAAA,gCAAa,EAAC,MAAM,EAAE;QAC3B,OAAO;QACP,GAAG,EAAE,mBAAS;QACd,OAAO,EAAE,aAAa;QACtB,KAAK;QACL,YAAY,EAAE,+BAA+B;QAC7C,IAAI,EAAE,CAAC,UAAU,CAAC;QAClB,GAAG,EAAE,IAAI;QACT,YAAY;QACZ,oBAAoB;QACpB,KAAK;KACN,CAAC,CAAA;AACJ,CAAC;AA7CD,gDA6CC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getL2Output = void 0;
4
+ const readContract_js_1 = require("../../../actions/public/readContract.js");
5
+ const abis_js_1 = require("../abis.js");
6
+ async function getL2Output(client, parameters) {
7
+ const { chain = client.chain, l2BlockNumber, targetChain } = parameters;
8
+ const l2OutputOracleAddress = (() => {
9
+ if (parameters.l2OutputOracleAddress)
10
+ return parameters.l2OutputOracleAddress;
11
+ if (chain)
12
+ return targetChain.contracts.l2OutputOracle[chain.id].address;
13
+ return Object.values(targetChain.contracts.l2OutputOracle)[0].address;
14
+ })();
15
+ const outputIndex = await (0, readContract_js_1.readContract)(client, {
16
+ address: l2OutputOracleAddress,
17
+ abi: abis_js_1.l2OutputOracleAbi,
18
+ functionName: 'getL2OutputIndexAfter',
19
+ args: [l2BlockNumber],
20
+ });
21
+ const output = await (0, readContract_js_1.readContract)(client, {
22
+ address: l2OutputOracleAddress,
23
+ abi: abis_js_1.l2OutputOracleAbi,
24
+ functionName: 'getL2Output',
25
+ args: [outputIndex],
26
+ });
27
+ return { outputIndex, ...output };
28
+ }
29
+ exports.getL2Output = getL2Output;
30
+ //# sourceMappingURL=getL2Output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getL2Output.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/getL2Output.ts"],"names":[],"mappings":";;;AAAA,6EAGgD;AAWhD,wCAA8C;AA2CvC,KAAK,UAAU,WAAW,CAK/B,MAAyC,EACzC,UAAuD;IAEvD,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,UAAU,CAAA;IAEvE,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE;QAClC,IAAI,UAAU,CAAC,qBAAqB;YAClC,OAAO,UAAU,CAAC,qBAAqB,CAAA;QACzC,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACzE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IACxE,CAAC,CAAC,EAAE,CAAA;IAEJ,MAAM,WAAW,GAAG,MAAM,IAAA,8BAAY,EAAC,MAAM,EAAE;QAC7C,OAAO,EAAE,qBAAqB;QAC9B,GAAG,EAAE,2BAAiB;QACtB,YAAY,EAAE,uBAAuB;QACrC,IAAI,EAAE,CAAC,aAAa,CAAC;KACtB,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,MAAM,IAAA,8BAAY,EAAC,MAAM,EAAE;QACxC,OAAO,EAAE,qBAAqB;QAC9B,GAAG,EAAE,2BAAiB;QACtB,YAAY,EAAE,aAAa;QAC3B,IAAI,EAAE,CAAC,WAAW,CAAC;KACpB,CAAC,CAAA;IAEF,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CAAA;AACnC,CAAC;AA/BD,kCA+BC"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTimeToFinalize = void 0;
4
+ const multicall_js_1 = require("../../../actions/public/multicall.js");
5
+ const abis_js_1 = require("../abis.js");
6
+ const buffer = 10;
7
+ async function getTimeToFinalize(client, parameters) {
8
+ const { chain = client.chain, withdrawalHash, targetChain } = parameters;
9
+ const l2OutputOracleAddress = (() => {
10
+ if (parameters.l2OutputOracleAddress)
11
+ return parameters.l2OutputOracleAddress;
12
+ if (chain)
13
+ return targetChain.contracts.l2OutputOracle[chain.id].address;
14
+ return Object.values(targetChain.contracts.l2OutputOracle)[0].address;
15
+ })();
16
+ const portalAddress = (() => {
17
+ if (parameters.portalAddress)
18
+ return parameters.portalAddress;
19
+ if (chain)
20
+ return targetChain.contracts.portal[chain.id].address;
21
+ return Object.values(targetChain.contracts.portal)[0].address;
22
+ })();
23
+ const [[_outputRoot, proveTimestamp, _l2OutputIndex], period] = await (0, multicall_js_1.multicall)(client, {
24
+ allowFailure: false,
25
+ contracts: [
26
+ {
27
+ abi: abis_js_1.portalAbi,
28
+ address: portalAddress,
29
+ functionName: 'provenWithdrawals',
30
+ args: [withdrawalHash],
31
+ },
32
+ {
33
+ abi: abis_js_1.l2OutputOracleAbi,
34
+ address: l2OutputOracleAddress,
35
+ functionName: 'FINALIZATION_PERIOD_SECONDS',
36
+ },
37
+ ],
38
+ });
39
+ const secondsSinceProven = Date.now() / 1000 - Number(proveTimestamp);
40
+ const secondsToFinalize = Number(period) - secondsSinceProven;
41
+ const seconds = Math.floor(secondsToFinalize < 0 ? 0 : secondsToFinalize + buffer);
42
+ const timestamp = Date.now() + seconds * 1000;
43
+ return { period: Number(period), seconds, timestamp };
44
+ }
45
+ exports.getTimeToFinalize = getTimeToFinalize;
46
+ //# sourceMappingURL=getTimeToFinalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTimeToFinalize.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/getTimeToFinalize.ts"],"names":[],"mappings":";;;AAAA,uEAG6C;AAW7C,wCAAyD;AAqBzD,MAAM,MAAM,GAAG,EAAE,CAAA;AAqCV,KAAK,UAAU,iBAAiB,CAKrC,MAAyC,EACzC,UAA6D;IAE7D,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,UAAU,CAAA;IAExE,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE;QAClC,IAAI,UAAU,CAAC,qBAAqB;YAClC,OAAO,UAAU,CAAC,qBAAqB,CAAA;QACzC,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACzE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IACxE,CAAC,CAAC,EAAE,CAAA;IACJ,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,UAAU,CAAC,aAAa;YAAE,OAAO,UAAU,CAAC,aAAa,CAAA;QAC7D,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACjE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAChE,CAAC,CAAC,EAAE,CAAA;IAEJ,MAAM,CAAC,CAAC,WAAW,EAAE,cAAc,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,GAC3D,MAAM,IAAA,wBAAS,EAAC,MAAM,EAAE;QACtB,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE;YACT;gBACE,GAAG,EAAE,mBAAS;gBACd,OAAO,EAAE,aAAa;gBACtB,YAAY,EAAE,mBAAmB;gBACjC,IAAI,EAAE,CAAC,cAAc,CAAC;aACvB;YACD;gBACE,GAAG,EAAE,2BAAiB;gBACtB,OAAO,EAAE,qBAAqB;gBAC9B,YAAY,EAAE,6BAA6B;aAC5C;SACF;KACF,CAAC,CAAA;IAEJ,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;IACrE,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,kBAAkB,CAAA;IAE7D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,GAAG,MAAM,CACvD,CAAA;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,GAAG,IAAI,CAAA;IAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;AACvD,CAAC;AAjDD,8CAiDC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTimeToNextL2Output = void 0;
4
+ const multicall_js_1 = require("../../../actions/public/multicall.js");
5
+ const readContract_js_1 = require("../../../actions/public/readContract.js");
6
+ const abis_js_1 = require("../abis.js");
7
+ async function getTimeToNextL2Output(client, parameters) {
8
+ const { intervalBuffer = 1.1, chain = client.chain, l2BlockNumber, targetChain, } = parameters;
9
+ const l2OutputOracleAddress = (() => {
10
+ if (parameters.l2OutputOracleAddress)
11
+ return parameters.l2OutputOracleAddress;
12
+ if (chain)
13
+ return targetChain.contracts.l2OutputOracle[chain.id].address;
14
+ return Object.values(targetChain.contracts.l2OutputOracle)[0].address;
15
+ })();
16
+ const [latestOutputIndex, blockTime, blockInterval] = await (0, multicall_js_1.multicall)(client, {
17
+ allowFailure: false,
18
+ contracts: [
19
+ {
20
+ abi: abis_js_1.l2OutputOracleAbi,
21
+ address: l2OutputOracleAddress,
22
+ functionName: 'latestOutputIndex',
23
+ },
24
+ {
25
+ abi: abis_js_1.l2OutputOracleAbi,
26
+ address: l2OutputOracleAddress,
27
+ functionName: 'L2_BLOCK_TIME',
28
+ },
29
+ {
30
+ abi: abis_js_1.l2OutputOracleAbi,
31
+ address: l2OutputOracleAddress,
32
+ functionName: 'SUBMISSION_INTERVAL',
33
+ },
34
+ ],
35
+ });
36
+ const latestOutput = await (0, readContract_js_1.readContract)(client, {
37
+ abi: abis_js_1.l2OutputOracleAbi,
38
+ address: l2OutputOracleAddress,
39
+ functionName: 'getL2Output',
40
+ args: [latestOutputIndex],
41
+ });
42
+ const latestOutputTimestamp = Number(latestOutput.timestamp) * 1000;
43
+ const interval = Number(blockInterval * blockTime);
44
+ const intervalWithBuffer = Math.ceil(interval * intervalBuffer);
45
+ const now = Date.now();
46
+ const seconds = (() => {
47
+ if (now < latestOutputTimestamp)
48
+ return 0;
49
+ if (latestOutput.l2BlockNumber > l2BlockNumber)
50
+ return 0;
51
+ const elapsedBlocks = Number(l2BlockNumber - latestOutput.l2BlockNumber);
52
+ const elapsed = Math.ceil((now - latestOutputTimestamp) / 1000);
53
+ const secondsToNextOutput = intervalWithBuffer - (elapsed % intervalWithBuffer);
54
+ return elapsedBlocks < blockInterval
55
+ ? secondsToNextOutput
56
+ : Math.floor(elapsedBlocks / Number(blockInterval)) * intervalWithBuffer +
57
+ secondsToNextOutput;
58
+ })();
59
+ const timestamp = seconds > 0 ? now + seconds * 1000 : undefined;
60
+ return { interval, seconds, timestamp };
61
+ }
62
+ exports.getTimeToNextL2Output = getTimeToNextL2Output;
63
+ //# sourceMappingURL=getTimeToNextL2Output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTimeToNextL2Output.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/getTimeToNextL2Output.ts"],"names":[],"mappings":";;;AAAA,uEAG6C;AAC7C,6EAGgD;AAUhD,wCAA8C;AA+DvC,KAAK,UAAU,qBAAqB,CAKzC,MAAyC,EACzC,UAAiE;IAEjE,MAAM,EACJ,cAAc,GAAG,GAAG,EACpB,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,aAAa,EACb,WAAW,GACZ,GAAG,UAAU,CAAA;IAEd,MAAM,qBAAqB,GAAG,CAAC,GAAG,EAAE;QAClC,IAAI,UAAU,CAAC,qBAAqB;YAClC,OAAO,UAAU,CAAC,qBAAqB,CAAA;QACzC,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACzE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IACxE,CAAC,CAAC,EAAE,CAAA;IAEJ,MAAM,CAAC,iBAAiB,EAAE,SAAS,EAAE,aAAa,CAAC,GAAG,MAAM,IAAA,wBAAS,EACnE,MAAM,EACN;QACE,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE;YACT;gBACE,GAAG,EAAE,2BAAiB;gBACtB,OAAO,EAAE,qBAAqB;gBAC9B,YAAY,EAAE,mBAAmB;aAClC;YACD;gBACE,GAAG,EAAE,2BAAiB;gBACtB,OAAO,EAAE,qBAAqB;gBAC9B,YAAY,EAAE,eAAe;aAC9B;YACD;gBACE,GAAG,EAAE,2BAAiB;gBACtB,OAAO,EAAE,qBAAqB;gBAC9B,YAAY,EAAE,qBAAqB;aACpC;SACF;KACF,CACF,CAAA;IACD,MAAM,YAAY,GAAG,MAAM,IAAA,8BAAY,EAAC,MAAM,EAAE;QAC9C,GAAG,EAAE,2BAAiB;QACtB,OAAO,EAAE,qBAAqB;QAC9B,YAAY,EAAE,aAAa;QAC3B,IAAI,EAAE,CAAC,iBAAiB,CAAC;KAC1B,CAAC,CAAA;IACF,MAAM,qBAAqB,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;IAEnE,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC,CAAA;IAClD,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,CAAA;IAE/D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAEtB,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE;QAGpB,IAAI,GAAG,GAAG,qBAAqB;YAAE,OAAO,CAAC,CAAA;QAIzC,IAAI,YAAY,CAAC,aAAa,GAAG,aAAa;YAAE,OAAO,CAAC,CAAA;QAExD,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC,CAAA;QAExE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,qBAAqB,CAAC,GAAG,IAAI,CAAC,CAAA;QAC/D,MAAM,mBAAmB,GACvB,kBAAkB,GAAG,CAAC,OAAO,GAAG,kBAAkB,CAAC,CAAA;QACrD,OAAO,aAAa,GAAG,aAAa;YAClC,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,kBAAkB;gBACpE,mBAAmB,CAAA;IAC3B,CAAC,CAAC,EAAE,CAAA;IAEJ,MAAM,SAAS,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;IAEhE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;AACzC,CAAC;AAjFD,sDAiFC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTimeToProve = void 0;
4
+ const getTimeToNextL2Output_js_1 = require("./getTimeToNextL2Output.js");
5
+ async function getTimeToProve(client, parameters) {
6
+ const { receipt } = parameters;
7
+ return (0, getTimeToNextL2Output_js_1.getTimeToNextL2Output)(client, {
8
+ ...parameters,
9
+ l2BlockNumber: receipt.blockNumber,
10
+ });
11
+ }
12
+ exports.getTimeToProve = getTimeToProve;
13
+ //# sourceMappingURL=getTimeToProve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTimeToProve.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/getTimeToProve.ts"],"names":[],"mappings":";;;AAWA,yEAKmC;AAgD5B,KAAK,UAAU,cAAc,CAKlC,MAAyC,EACzC,UAA0D;IAE1D,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAA;IAE9B,OAAO,IAAA,gDAAqB,EAAC,MAAM,EAAE;QACnC,GAAG,UAAU;QACb,aAAa,EAAE,OAAO,CAAC,WAAW;KACnC,CAAC,CAAA;AACJ,CAAC;AAdD,wCAcC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWithdrawalStatus = void 0;
4
+ const readContract_js_1 = require("../../../actions/public/readContract.js");
5
+ const contract_js_1 = require("../../../errors/contract.js");
6
+ const abis_js_1 = require("../abis.js");
7
+ const withdrawal_js_1 = require("../errors/withdrawal.js");
8
+ const getWithdrawals_js_1 = require("../utils/getWithdrawals.js");
9
+ const getL2Output_js_1 = require("./getL2Output.js");
10
+ const getTimeToFinalize_js_1 = require("./getTimeToFinalize.js");
11
+ async function getWithdrawalStatus(client, parameters) {
12
+ const { chain = client.chain, receipt, targetChain } = parameters;
13
+ const portalAddress = (() => {
14
+ if (parameters.portalAddress)
15
+ return parameters.portalAddress;
16
+ if (chain)
17
+ return targetChain.contracts.portal[chain.id].address;
18
+ return Object.values(targetChain.contracts.portal)[0].address;
19
+ })();
20
+ const [withdrawal] = (0, getWithdrawals_js_1.getWithdrawals)(receipt);
21
+ if (!withdrawal)
22
+ throw new withdrawal_js_1.ReceiptContainsNoWithdrawalsError({
23
+ hash: receipt.transactionHash,
24
+ });
25
+ const [outputResult, proveResult, finalizedResult, timeToFinalizeResult] = await Promise.allSettled([
26
+ (0, getL2Output_js_1.getL2Output)(client, {
27
+ ...parameters,
28
+ l2BlockNumber: receipt.blockNumber,
29
+ }),
30
+ (0, readContract_js_1.readContract)(client, {
31
+ abi: abis_js_1.portalAbi,
32
+ address: portalAddress,
33
+ functionName: 'provenWithdrawals',
34
+ args: [withdrawal.withdrawalHash],
35
+ }),
36
+ (0, readContract_js_1.readContract)(client, {
37
+ abi: abis_js_1.portalAbi,
38
+ address: portalAddress,
39
+ functionName: 'finalizedWithdrawals',
40
+ args: [withdrawal.withdrawalHash],
41
+ }),
42
+ (0, getTimeToFinalize_js_1.getTimeToFinalize)(client, {
43
+ ...parameters,
44
+ withdrawalHash: withdrawal.withdrawalHash,
45
+ }),
46
+ ]);
47
+ if (outputResult.status === 'rejected') {
48
+ const error = outputResult.reason;
49
+ if (error.cause instanceof contract_js_1.ContractFunctionRevertedError &&
50
+ error.cause.data?.args?.[0] ===
51
+ 'L2OutputOracle: cannot get output for a block that has not been proposed')
52
+ return 'waiting-to-prove';
53
+ throw error;
54
+ }
55
+ if (proveResult.status === 'rejected')
56
+ throw proveResult.reason;
57
+ if (finalizedResult.status === 'rejected')
58
+ throw finalizedResult.reason;
59
+ if (timeToFinalizeResult.status === 'rejected')
60
+ throw timeToFinalizeResult.reason;
61
+ const [_, proveTimestamp] = proveResult.value;
62
+ if (!proveTimestamp)
63
+ return 'ready-to-prove';
64
+ const finalized = finalizedResult.value;
65
+ if (finalized)
66
+ return 'finalized';
67
+ const { seconds } = timeToFinalizeResult.value;
68
+ return seconds > 0 ? 'waiting-to-finalize' : 'ready-to-finalize';
69
+ }
70
+ exports.getWithdrawalStatus = getWithdrawalStatus;
71
+ //# sourceMappingURL=getWithdrawalStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWithdrawalStatus.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/getWithdrawalStatus.ts"],"names":[],"mappings":";;;AAAA,6EAGgD;AAGhD,6DAA2E;AAS3E,wCAAsC;AACtC,2DAA2E;AAE3E,kEAGmC;AACnC,qDAAyE;AACzE,iEAG+B;AAqDxB,KAAK,UAAU,mBAAmB,CAKvC,MAAyC,EACzC,UAA+D;IAE/D,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,UAAU,CAAA;IAEjE,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,UAAU,CAAC,aAAa;YAAE,OAAO,UAAU,CAAC,aAAa,CAAA;QAC7D,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACjE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAChE,CAAC,CAAC,EAAE,CAAA;IAEJ,MAAM,CAAC,UAAU,CAAC,GAAG,IAAA,kCAAc,EAAC,OAAO,CAAC,CAAA;IAE5C,IAAI,CAAC,UAAU;QACb,MAAM,IAAI,iDAAiC,CAAC;YAC1C,IAAI,EAAE,OAAO,CAAC,eAAe;SAC9B,CAAC,CAAA;IAEJ,MAAM,CAAC,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,oBAAoB,CAAC,GACtE,MAAM,OAAO,CAAC,UAAU,CAAC;QACvB,IAAA,4BAAW,EAAC,MAAM,EAAE;YAClB,GAAG,UAAU;YACb,aAAa,EAAE,OAAO,CAAC,WAAW;SACnC,CAAC;QACF,IAAA,8BAAY,EAAC,MAAM,EAAE;YACnB,GAAG,EAAE,mBAAS;YACd,OAAO,EAAE,aAAa;YACtB,YAAY,EAAE,mBAAmB;YACjC,IAAI,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC;SAClC,CAAC;QACF,IAAA,8BAAY,EAAC,MAAM,EAAE;YACnB,GAAG,EAAE,mBAAS;YACd,OAAO,EAAE,aAAa;YACtB,YAAY,EAAE,sBAAsB;YACpC,IAAI,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC;SAClC,CAAC;QACF,IAAA,wCAAiB,EAAC,MAAM,EAAE;YACxB,GAAG,UAAU;YACb,cAAc,EAAE,UAAU,CAAC,cAAc;SAC1C,CAAC;KACH,CAAC,CAAA;IAIJ,IAAI,YAAY,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,YAAY,CAAC,MAA8B,CAAA;QACzD,IACE,KAAK,CAAC,KAAK,YAAY,2CAA6B;YACpD,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;gBACzB,0EAA0E;YAE5E,OAAO,kBAAkB,CAAA;QAC3B,MAAM,KAAK,CAAA;IACb,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,KAAK,UAAU;QAAE,MAAM,WAAW,CAAC,MAAM,CAAA;IAC/D,IAAI,eAAe,CAAC,MAAM,KAAK,UAAU;QAAE,MAAM,eAAe,CAAC,MAAM,CAAA;IACvE,IAAI,oBAAoB,CAAC,MAAM,KAAK,UAAU;QAC5C,MAAM,oBAAoB,CAAC,MAAM,CAAA;IAEnC,MAAM,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,WAAW,CAAC,KAAK,CAAA;IAC7C,IAAI,CAAC,cAAc;QAAE,OAAO,gBAAgB,CAAA;IAE5C,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAA;IACvC,IAAI,SAAS;QAAE,OAAO,WAAW,CAAA;IAEjC,MAAM,EAAE,OAAO,EAAE,GAAG,oBAAoB,CAAC,KAAK,CAAA;IAC9C,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,mBAAmB,CAAA;AAClE,CAAC;AAxED,kDAwEC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initiateWithdrawal = void 0;
4
+ const writeContract_js_1 = require("../../../actions/wallet/writeContract.js");
5
+ const abis_js_1 = require("../abis.js");
6
+ const contracts_js_1 = require("../contracts.js");
7
+ const estimateInitiateWithdrawalGas_js_1 = require("./estimateInitiateWithdrawalGas.js");
8
+ async function initiateWithdrawal(client, parameters) {
9
+ const { account, chain = client.chain, gas, maxFeePerGas, maxPriorityFeePerGas, nonce, request: { data = '0x', gas: l1Gas, to, value }, } = parameters;
10
+ const gas_ = typeof gas !== 'number' && gas !== null
11
+ ? await (0, estimateInitiateWithdrawalGas_js_1.estimateInitiateWithdrawalGas)(client, parameters)
12
+ : undefined;
13
+ return (0, writeContract_js_1.writeContract)(client, {
14
+ account: account,
15
+ abi: abis_js_1.l2ToL1MessagePasserAbi,
16
+ address: contracts_js_1.contracts.l2ToL1MessagePasser.address,
17
+ chain,
18
+ functionName: 'initiateWithdrawal',
19
+ args: [to, l1Gas, data],
20
+ gas: gas_,
21
+ maxFeePerGas,
22
+ maxPriorityFeePerGas,
23
+ nonce,
24
+ value,
25
+ });
26
+ }
27
+ exports.initiateWithdrawal = initiateWithdrawal;
28
+ //# sourceMappingURL=initiateWithdrawal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initiateWithdrawal.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/initiateWithdrawal.ts"],"names":[],"mappings":";;;AACA,+EAIiD;AAajD,wCAAmD;AACnD,kDAA2C;AAE3C,yFAI2C;AAwFpC,KAAK,UAAU,kBAAkB,CAKtC,MAAyC,EACzC,UAAuE;IAEvE,MAAM,EACJ,OAAO,EACP,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,GAAG,EACH,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,OAAO,EAAE,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAChD,GAAG,UAAU,CAAA;IAEd,MAAM,IAAI,GACR,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QACrC,CAAC,CAAC,MAAM,IAAA,gEAA6B,EACjC,MAAM,EACN,UAAqD,CACtD;QACH,CAAC,CAAC,SAAS,CAAA;IAEf,OAAO,IAAA,gCAAa,EAAC,MAAM,EAAE;QAC3B,OAAO,EAAE,OAAQ;QACjB,GAAG,EAAE,gCAAsB;QAC3B,OAAO,EAAE,wBAAS,CAAC,mBAAmB,CAAC,OAAO;QAC9C,KAAK;QACL,YAAY,EAAE,oBAAoB;QAClC,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC;QACvB,GAAG,EAAE,IAAI;QACT,YAAY;QACZ,oBAAoB;QACpB,KAAK;QACL,KAAK;KACmC,CAAC,CAAA;AAC7C,CAAC;AAvCD,gDAuCC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.proveWithdrawal = void 0;
4
+ const writeContract_js_1 = require("../../../actions/wallet/writeContract.js");
5
+ const abis_js_1 = require("../abis.js");
6
+ const estimateProveWithdrawalGas_js_1 = require("./estimateProveWithdrawalGas.js");
7
+ async function proveWithdrawal(client, parameters) {
8
+ const { account, chain = client.chain, gas, l2OutputIndex, maxFeePerGas, maxPriorityFeePerGas, nonce, outputRootProof, targetChain, withdrawalProof, withdrawal, } = parameters;
9
+ const portalAddress = (() => {
10
+ if (parameters.portalAddress)
11
+ return parameters.portalAddress;
12
+ if (chain)
13
+ return targetChain.contracts.portal[chain.id].address;
14
+ return Object.values(targetChain.contracts.portal)[0].address;
15
+ })();
16
+ const gas_ = typeof gas !== 'number' && gas !== null
17
+ ? await (0, estimateProveWithdrawalGas_js_1.estimateProveWithdrawalGas)(client, parameters)
18
+ : undefined;
19
+ return (0, writeContract_js_1.writeContract)(client, {
20
+ account,
21
+ abi: abis_js_1.portalAbi,
22
+ address: portalAddress,
23
+ chain,
24
+ functionName: 'proveWithdrawalTransaction',
25
+ args: [withdrawal, l2OutputIndex, outputRootProof, withdrawalProof],
26
+ gas: gas_,
27
+ maxFeePerGas,
28
+ maxPriorityFeePerGas,
29
+ nonce,
30
+ });
31
+ }
32
+ exports.proveWithdrawal = proveWithdrawal;
33
+ //# sourceMappingURL=proveWithdrawal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proveWithdrawal.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/proveWithdrawal.ts"],"names":[],"mappings":";;;AACA,+EAGiD;AAajD,wCAAsC;AAEtC,mFAIwC;AA+EjC,KAAK,UAAU,eAAe,CAKnC,MAAyC,EACzC,UAAoE;IAEpE,MAAM,EACJ,OAAO,EACP,KAAK,GAAG,MAAM,CAAC,KAAK,EACpB,GAAG,EACH,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,eAAe,EACf,WAAW,EACX,eAAe,EACf,UAAU,GACX,GAAG,UAAU,CAAA;IAEd,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,UAAU,CAAC,aAAa;YAAE,OAAO,UAAU,CAAC,aAAa,CAAA;QAC7D,IAAI,KAAK;YAAE,OAAO,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;QACjE,OAAO,MAAM,CAAC,MAAM,CAAC,WAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAChE,CAAC,CAAC,EAAE,CAAA;IAEJ,MAAM,IAAI,GACR,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QACrC,CAAC,CAAC,MAAM,IAAA,0DAA0B,EAC9B,MAAM,EACN,UAAkD,CACnD;QACH,CAAC,CAAC,SAAS,CAAA;IAEf,OAAO,IAAA,gCAAa,EAAC,MAAM,EAAE;QAC3B,OAAO;QACP,GAAG,EAAE,mBAAS;QACd,OAAO,EAAE,aAAa;QACtB,KAAK;QACL,YAAY,EAAE,4BAA4B;QAC1C,IAAI,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,CAAC;QACnE,GAAG,EAAE,IAAI;QACT,YAAY;QACZ,oBAAoB;QACpB,KAAK;KACN,CAAC,CAAA;AACJ,CAAC;AAhDD,0CAgDC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.waitForNextL2Output = void 0;
4
+ const contract_js_1 = require("../../../errors/contract.js");
5
+ const poll_js_1 = require("../../../utils/poll.js");
6
+ const getL2Output_js_1 = require("./getL2Output.js");
7
+ const getTimeToNextL2Output_js_1 = require("./getTimeToNextL2Output.js");
8
+ async function waitForNextL2Output(client, parameters) {
9
+ const { pollingInterval = client.pollingInterval } = parameters;
10
+ const { seconds } = await (0, getTimeToNextL2Output_js_1.getTimeToNextL2Output)(client, parameters);
11
+ return new Promise((resolve, reject) => {
12
+ (0, poll_js_1.poll)(async ({ unpoll }) => {
13
+ try {
14
+ const output = await (0, getL2Output_js_1.getL2Output)(client, parameters);
15
+ unpoll();
16
+ resolve(output);
17
+ }
18
+ catch (e) {
19
+ const error = e;
20
+ if (!(error.cause instanceof contract_js_1.ContractFunctionRevertedError)) {
21
+ unpoll();
22
+ reject(e);
23
+ }
24
+ }
25
+ }, {
26
+ interval: pollingInterval,
27
+ initialWaitTime: async () => seconds * 1000,
28
+ });
29
+ });
30
+ }
31
+ exports.waitForNextL2Output = waitForNextL2Output;
32
+ //# sourceMappingURL=waitForNextL2Output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waitForNextL2Output.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/waitForNextL2Output.ts"],"names":[],"mappings":";;;AAEA,6DAA2E;AAQ3E,oDAA6C;AAE7C,qDAIyB;AACzB,yEAImC;AAwD5B,KAAK,UAAU,mBAAmB,CAKvC,MAAyC,EACzC,UAA+D;IAE/D,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC,eAAe,EAAE,GAAG,UAAU,CAAA;IAE/D,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,gDAAqB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAEnE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAA,cAAI,EACF,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACnB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAA,4BAAW,EAAC,MAAM,EAAE,UAAU,CAAC,CAAA;gBACpD,MAAM,EAAE,CAAA;gBACR,OAAO,CAAC,MAAM,CAAC,CAAA;YACjB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,KAAK,GAAG,CAAyB,CAAA;gBACvC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,YAAY,2CAA6B,CAAC,EAAE,CAAC;oBAC5D,MAAM,EAAE,CAAA;oBACR,MAAM,CAAC,CAAC,CAAC,CAAA;gBACX,CAAC;YACH,CAAC;QACH,CAAC,EACD;YACE,QAAQ,EAAE,eAAe;YACzB,eAAe,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,GAAG,IAAI;SAC5C,CACF,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAjCD,kDAiCC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.waitToFinalize = void 0;
4
+ const wait_js_1 = require("../../../utils/wait.js");
5
+ const getTimeToFinalize_js_1 = require("./getTimeToFinalize.js");
6
+ async function waitToFinalize(client, parameters) {
7
+ const { seconds } = await (0, getTimeToFinalize_js_1.getTimeToFinalize)(client, parameters);
8
+ await (0, wait_js_1.wait)(seconds * 1000);
9
+ }
10
+ exports.waitToFinalize = waitToFinalize;
11
+ //# sourceMappingURL=waitToFinalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waitToFinalize.js","sourceRoot":"","sources":["../../../../chains/opStack/actions/waitToFinalize.ts"],"names":[],"mappings":";;;AAKA,oDAA6C;AAC7C,iEAI+B;AA2CxB,KAAK,UAAU,cAAc,CAKlC,MAAyC,EACzC,UAA0D;IAE1D,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,wCAAiB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC/D,MAAM,IAAA,cAAI,EAAC,OAAO,GAAG,IAAI,CAAC,CAAA;AAC5B,CAAC;AAVD,wCAUC"}