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.
- package/CHANGELOG.md +44 -0
- package/README.md +9 -3
- package/_cjs/actions/ens/getEnsName.js +4 -2
- package/_cjs/actions/ens/getEnsName.js.map +1 -1
- package/_cjs/actions/index.js +16 -2
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/chains/definitions/arbitrumSepolia.js +4 -0
- package/_cjs/chains/definitions/arbitrumSepolia.js.map +1 -1
- package/_cjs/chains/definitions/base.js +5 -0
- package/_cjs/chains/definitions/base.js.map +1 -1
- package/_cjs/chains/definitions/baseGoerli.js +5 -0
- package/_cjs/chains/definitions/baseGoerli.js.map +1 -1
- package/_cjs/chains/definitions/baseSepolia.js +5 -0
- package/_cjs/chains/definitions/baseSepolia.js.map +1 -1
- package/_cjs/chains/definitions/fantomSonicTestnet.js +26 -0
- package/_cjs/chains/definitions/fantomSonicTestnet.js.map +1 -0
- package/_cjs/chains/definitions/optimism.js +5 -0
- package/_cjs/chains/definitions/optimism.js.map +1 -1
- package/_cjs/chains/definitions/optimismGoerli.js +5 -0
- package/_cjs/chains/definitions/optimismGoerli.js.map +1 -1
- package/_cjs/chains/definitions/optimismSepolia.js +5 -0
- package/_cjs/chains/definitions/optimismSepolia.js.map +1 -1
- package/_cjs/chains/definitions/pgn.js +12 -0
- package/_cjs/chains/definitions/pgn.js.map +1 -1
- package/_cjs/chains/definitions/pgnTestnet.js +7 -0
- package/_cjs/chains/definitions/pgnTestnet.js.map +1 -1
- package/_cjs/chains/definitions/zilliqa.js +26 -0
- package/_cjs/chains/definitions/zilliqa.js.map +1 -0
- package/_cjs/chains/definitions/zilliqaTestnet.js +26 -0
- package/_cjs/chains/definitions/zilliqaTestnet.js.map +1 -0
- package/_cjs/chains/definitions/zkSyncSepoliaTestnet.js +35 -0
- package/_cjs/chains/definitions/zkSyncSepoliaTestnet.js.map +1 -0
- package/_cjs/chains/definitions/zkSyncTestnet.js +4 -0
- package/_cjs/chains/definitions/zkSyncTestnet.js.map +1 -1
- package/_cjs/chains/definitions/zora.js +5 -0
- package/_cjs/chains/definitions/zora.js.map +1 -1
- package/_cjs/chains/definitions/zoraSepolia.js +5 -0
- package/_cjs/chains/definitions/zoraSepolia.js.map +1 -1
- package/_cjs/chains/index.js +12 -4
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/chains/opStack/abis.js +366 -1
- package/_cjs/chains/opStack/abis.js.map +1 -1
- package/_cjs/chains/opStack/actions/buildDepositTransaction.js +1 -1
- package/_cjs/chains/opStack/actions/buildDepositTransaction.js.map +1 -1
- package/_cjs/chains/opStack/actions/buildInitiateWithdrawal.js +29 -0
- package/_cjs/chains/opStack/actions/buildInitiateWithdrawal.js.map +1 -0
- package/_cjs/chains/opStack/actions/buildProveWithdrawal.js +39 -0
- package/_cjs/chains/opStack/actions/buildProveWithdrawal.js.map +1 -0
- package/_cjs/chains/opStack/actions/depositTransaction.js +11 -6
- package/_cjs/chains/opStack/actions/depositTransaction.js.map +1 -1
- package/_cjs/chains/opStack/actions/estimateDepositTransactionGas.js +37 -0
- package/_cjs/chains/opStack/actions/estimateDepositTransactionGas.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateFinalizeWithdrawalGas.js +29 -0
- package/_cjs/chains/opStack/actions/estimateFinalizeWithdrawalGas.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateInitiateWithdrawalGas.js +24 -0
- package/_cjs/chains/opStack/actions/estimateInitiateWithdrawalGas.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateProveWithdrawalGas.js +29 -0
- package/_cjs/chains/opStack/actions/estimateProveWithdrawalGas.js.map +1 -0
- package/_cjs/chains/opStack/actions/finalizeWithdrawal.js +33 -0
- package/_cjs/chains/opStack/actions/finalizeWithdrawal.js.map +1 -0
- package/_cjs/chains/opStack/actions/getL2Output.js +30 -0
- package/_cjs/chains/opStack/actions/getL2Output.js.map +1 -0
- package/_cjs/chains/opStack/actions/getTimeToFinalize.js +46 -0
- package/_cjs/chains/opStack/actions/getTimeToFinalize.js.map +1 -0
- package/_cjs/chains/opStack/actions/getTimeToNextL2Output.js +63 -0
- package/_cjs/chains/opStack/actions/getTimeToNextL2Output.js.map +1 -0
- package/_cjs/chains/opStack/actions/getTimeToProve.js +13 -0
- package/_cjs/chains/opStack/actions/getTimeToProve.js.map +1 -0
- package/_cjs/chains/opStack/actions/getWithdrawalStatus.js +71 -0
- package/_cjs/chains/opStack/actions/getWithdrawalStatus.js.map +1 -0
- package/_cjs/chains/opStack/actions/initiateWithdrawal.js +28 -0
- package/_cjs/chains/opStack/actions/initiateWithdrawal.js.map +1 -0
- package/_cjs/chains/opStack/actions/proveWithdrawal.js +33 -0
- package/_cjs/chains/opStack/actions/proveWithdrawal.js.map +1 -0
- package/_cjs/chains/opStack/actions/waitForNextL2Output.js +32 -0
- package/_cjs/chains/opStack/actions/waitForNextL2Output.js.map +1 -0
- package/_cjs/chains/opStack/actions/waitToFinalize.js +11 -0
- package/_cjs/chains/opStack/actions/waitToFinalize.js.map +1 -0
- package/_cjs/chains/opStack/actions/waitToProve.js +21 -0
- package/_cjs/chains/opStack/actions/waitToProve.js.map +1 -0
- package/_cjs/chains/opStack/chains.js +5 -1
- package/_cjs/chains/opStack/chains.js.map +1 -1
- package/_cjs/chains/opStack/decorators/publicL1.js +35 -0
- package/_cjs/chains/opStack/decorators/publicL1.js.map +1 -0
- package/_cjs/chains/opStack/decorators/publicL2.js +5 -1
- package/_cjs/chains/opStack/decorators/publicL2.js.map +1 -1
- package/_cjs/chains/opStack/decorators/walletL1.js +4 -0
- package/_cjs/chains/opStack/decorators/walletL1.js.map +1 -1
- package/_cjs/chains/opStack/decorators/walletL2.js +13 -0
- package/_cjs/chains/opStack/decorators/walletL2.js.map +1 -0
- package/_cjs/chains/opStack/errors/withdrawal.js +17 -0
- package/_cjs/chains/opStack/errors/withdrawal.js.map +1 -0
- package/_cjs/chains/opStack/index.js +43 -15
- package/_cjs/chains/opStack/index.js.map +1 -1
- package/_cjs/chains/opStack/types/deposit.js +3 -0
- package/_cjs/chains/opStack/types/deposit.js.map +1 -0
- package/_cjs/chains/opStack/types/withdrawal.js +3 -0
- package/_cjs/chains/opStack/types/withdrawal.js.map +1 -0
- package/_cjs/chains/opStack/utils/extractWithdrawalMessageLogs.js +14 -0
- package/_cjs/chains/opStack/utils/extractWithdrawalMessageLogs.js.map +1 -0
- package/_cjs/chains/opStack/utils/getL2TransactionHash.js +2 -2
- package/_cjs/chains/opStack/utils/getL2TransactionHash.js.map +1 -1
- package/_cjs/chains/opStack/utils/getWithdrawalHashStorageSlot.js +11 -0
- package/_cjs/chains/opStack/utils/getWithdrawalHashStorageSlot.js.map +1 -0
- package/_cjs/chains/opStack/utils/getWithdrawals.js +10 -0
- package/_cjs/chains/opStack/utils/getWithdrawals.js.map +1 -0
- package/_cjs/chains/opStack/utils/{fromOpaqueData.js → opaqueDataToDepositData.js} +4 -4
- package/_cjs/chains/opStack/utils/opaqueDataToDepositData.js.map +1 -0
- package/_cjs/errors/abi.js +21 -1
- package/_cjs/errors/abi.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/errors/version.js.map +1 -1
- package/_cjs/index.js +10 -2
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/abi/getAbiItem.js +46 -3
- package/_cjs/utils/abi/getAbiItem.js.map +1 -1
- package/_cjs/utils/hash/ripemd160.js +16 -0
- package/_cjs/utils/hash/ripemd160.js.map +1 -0
- package/_cjs/utils/hash/sha256.js +16 -0
- package/_cjs/utils/hash/sha256.js.map +1 -0
- package/_cjs/utils/index.js +5 -1
- package/_cjs/utils/index.js.map +1 -1
- package/_esm/actions/ens/getEnsName.js +4 -2
- package/_esm/actions/ens/getEnsName.js.map +1 -1
- package/_esm/actions/index.js +7 -0
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/chains/definitions/arbitrumSepolia.js +4 -0
- package/_esm/chains/definitions/arbitrumSepolia.js.map +1 -1
- package/_esm/chains/definitions/base.js +5 -0
- package/_esm/chains/definitions/base.js.map +1 -1
- package/_esm/chains/definitions/baseGoerli.js +5 -0
- package/_esm/chains/definitions/baseGoerli.js.map +1 -1
- package/_esm/chains/definitions/baseSepolia.js +5 -0
- package/_esm/chains/definitions/baseSepolia.js.map +1 -1
- package/_esm/chains/definitions/fantomSonicTestnet.js +23 -0
- package/_esm/chains/definitions/fantomSonicTestnet.js.map +1 -0
- package/_esm/chains/definitions/optimism.js +5 -0
- package/_esm/chains/definitions/optimism.js.map +1 -1
- package/_esm/chains/definitions/optimismGoerli.js +5 -0
- package/_esm/chains/definitions/optimismGoerli.js.map +1 -1
- package/_esm/chains/definitions/optimismSepolia.js +5 -0
- package/_esm/chains/definitions/optimismSepolia.js.map +1 -1
- package/_esm/chains/definitions/pgn.js +12 -0
- package/_esm/chains/definitions/pgn.js.map +1 -1
- package/_esm/chains/definitions/pgnTestnet.js +7 -0
- package/_esm/chains/definitions/pgnTestnet.js.map +1 -1
- package/_esm/chains/definitions/zilliqa.js +23 -0
- package/_esm/chains/definitions/zilliqa.js.map +1 -0
- package/_esm/chains/definitions/zilliqaTestnet.js +23 -0
- package/_esm/chains/definitions/zilliqaTestnet.js.map +1 -0
- package/_esm/chains/definitions/zkSyncSepoliaTestnet.js +32 -0
- package/_esm/chains/definitions/zkSyncSepoliaTestnet.js.map +1 -0
- package/_esm/chains/definitions/zkSyncTestnet.js +5 -0
- package/_esm/chains/definitions/zkSyncTestnet.js.map +1 -1
- package/_esm/chains/definitions/zora.js +5 -0
- package/_esm/chains/definitions/zora.js.map +1 -1
- package/_esm/chains/definitions/zoraSepolia.js +5 -0
- package/_esm/chains/definitions/zoraSepolia.js.map +1 -1
- package/_esm/chains/index.js +4 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/chains/opStack/abis.js +365 -0
- package/_esm/chains/opStack/abis.js.map +1 -1
- package/_esm/chains/opStack/actions/buildDepositTransaction.js +2 -2
- package/_esm/chains/opStack/actions/buildDepositTransaction.js.map +1 -1
- package/_esm/chains/opStack/actions/buildInitiateWithdrawal.js +50 -0
- package/_esm/chains/opStack/actions/buildInitiateWithdrawal.js.map +1 -0
- package/_esm/chains/opStack/actions/buildProveWithdrawal.js +59 -0
- package/_esm/chains/opStack/actions/buildProveWithdrawal.js.map +1 -0
- package/_esm/chains/opStack/actions/depositTransaction.js +17 -14
- package/_esm/chains/opStack/actions/depositTransaction.js.map +1 -1
- package/_esm/chains/opStack/actions/estimateDepositTransactionGas.js +62 -0
- package/_esm/chains/opStack/actions/estimateDepositTransactionGas.js.map +1 -0
- package/_esm/chains/opStack/actions/estimateFinalizeWithdrawalGas.js +50 -0
- package/_esm/chains/opStack/actions/estimateFinalizeWithdrawalGas.js.map +1 -0
- package/_esm/chains/opStack/actions/estimateInitiateWithdrawalGas.js +48 -0
- package/_esm/chains/opStack/actions/estimateInitiateWithdrawalGas.js.map +1 -0
- package/_esm/chains/opStack/actions/estimateProveWithdrawalGas.js +53 -0
- package/_esm/chains/opStack/actions/estimateProveWithdrawalGas.js.map +1 -0
- package/_esm/chains/opStack/actions/finalizeWithdrawal.js +53 -0
- package/_esm/chains/opStack/actions/finalizeWithdrawal.js.map +1 -0
- package/_esm/chains/opStack/actions/getL2Output.js +50 -0
- package/_esm/chains/opStack/actions/getL2Output.js.map +1 -0
- package/_esm/chains/opStack/actions/getTimeToFinalize.js +77 -0
- package/_esm/chains/opStack/actions/getTimeToFinalize.js.map +1 -0
- package/_esm/chains/opStack/actions/getTimeToNextL2Output.js +91 -0
- package/_esm/chains/opStack/actions/getTimeToNextL2Output.js.map +1 -0
- package/_esm/chains/opStack/actions/getTimeToProve.js +39 -0
- package/_esm/chains/opStack/actions/getTimeToProve.js.map +1 -0
- package/_esm/chains/opStack/actions/getWithdrawalStatus.js +99 -0
- package/_esm/chains/opStack/actions/getWithdrawalStatus.js.map +1 -0
- package/_esm/chains/opStack/actions/initiateWithdrawal.js +76 -0
- package/_esm/chains/opStack/actions/initiateWithdrawal.js.map +1 -0
- package/_esm/chains/opStack/actions/proveWithdrawal.js +57 -0
- package/_esm/chains/opStack/actions/proveWithdrawal.js.map +1 -0
- package/_esm/chains/opStack/actions/waitForNextL2Output.js +58 -0
- package/_esm/chains/opStack/actions/waitForNextL2Output.js.map +1 -0
- package/_esm/chains/opStack/actions/waitToFinalize.js +41 -0
- package/_esm/chains/opStack/actions/waitToFinalize.js.map +1 -0
- package/_esm/chains/opStack/actions/waitToProve.js +47 -0
- package/_esm/chains/opStack/actions/waitToProve.js.map +1 -0
- package/_esm/chains/opStack/chains.js +2 -0
- package/_esm/chains/opStack/chains.js.map +1 -1
- package/_esm/chains/opStack/decorators/publicL1.js +31 -0
- package/_esm/chains/opStack/decorators/publicL1.js.map +1 -0
- package/_esm/chains/opStack/decorators/publicL2.js +5 -1
- package/_esm/chains/opStack/decorators/publicL2.js.map +1 -1
- package/_esm/chains/opStack/decorators/walletL1.js +4 -0
- package/_esm/chains/opStack/decorators/walletL1.js.map +1 -1
- package/_esm/chains/opStack/decorators/walletL2.js +9 -0
- package/_esm/chains/opStack/decorators/walletL2.js.map +1 -0
- package/_esm/chains/opStack/errors/withdrawal.js +13 -0
- package/_esm/chains/opStack/errors/withdrawal.js.map +1 -0
- package/_esm/chains/opStack/index.js +21 -3
- package/_esm/chains/opStack/index.js.map +1 -1
- package/_esm/chains/opStack/types/deposit.js +2 -0
- package/_esm/chains/opStack/types/deposit.js.map +1 -0
- package/_esm/chains/opStack/types/withdrawal.js +2 -0
- package/_esm/chains/opStack/types/withdrawal.js.map +1 -0
- package/_esm/chains/opStack/utils/extractWithdrawalMessageLogs.js +10 -0
- package/_esm/chains/opStack/utils/extractWithdrawalMessageLogs.js.map +1 -0
- package/_esm/chains/opStack/utils/getL2TransactionHash.js +2 -2
- package/_esm/chains/opStack/utils/getL2TransactionHash.js.map +1 -1
- package/_esm/chains/opStack/utils/getWithdrawalHashStorageSlot.js +7 -0
- package/_esm/chains/opStack/utils/getWithdrawalHashStorageSlot.js.map +1 -0
- package/_esm/chains/opStack/utils/getWithdrawals.js +6 -0
- package/_esm/chains/opStack/utils/getWithdrawals.js.map +1 -0
- package/_esm/chains/opStack/utils/{fromOpaqueData.js → opaqueDataToDepositData.js} +2 -2
- package/_esm/chains/opStack/utils/opaqueDataToDepositData.js.map +1 -0
- package/_esm/errors/abi.js +19 -0
- package/_esm/errors/abi.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/errors/version.js.map +1 -1
- package/_esm/index.js +4 -0
- package/_esm/index.js.map +1 -1
- package/_esm/utils/abi/getAbiItem.js +46 -2
- package/_esm/utils/abi/getAbiItem.js.map +1 -1
- package/_esm/utils/hash/ripemd160.js +12 -0
- package/_esm/utils/hash/ripemd160.js.map +1 -0
- package/_esm/utils/hash/sha256.js +12 -0
- package/_esm/utils/hash/sha256.js.map +1 -0
- package/_esm/utils/index.js +2 -0
- package/_esm/utils/index.js.map +1 -1
- package/_types/actions/ens/getEnsName.d.ts.map +1 -1
- package/_types/actions/index.d.ts +7 -0
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/public/getBlock.d.ts +1 -1
- package/_types/actions/public/getBlock.d.ts.map +1 -1
- package/_types/actions/public/getTransaction.d.ts +1 -1
- package/_types/actions/public/getTransaction.d.ts.map +1 -1
- package/_types/actions/public/getTransactionReceipt.d.ts +1 -1
- package/_types/actions/public/getTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts +5 -5
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/chains/celo/chainConfig.d.ts +180 -180
- package/_types/chains/celo/formatters.d.ts +180 -180
- package/_types/chains/definitions/arbitrumSepolia.d.ts +4 -0
- package/_types/chains/definitions/arbitrumSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/base.d.ts +142 -137
- package/_types/chains/definitions/base.d.ts.map +1 -1
- package/_types/chains/definitions/baseGoerli.d.ts +142 -137
- package/_types/chains/definitions/baseGoerli.d.ts.map +1 -1
- package/_types/chains/definitions/baseSepolia.d.ts +142 -137
- package/_types/chains/definitions/baseSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/celo.d.ts +180 -180
- package/_types/chains/definitions/celoAlfajores.d.ts +180 -180
- package/_types/chains/definitions/celoCannoli.d.ts +180 -180
- package/_types/chains/definitions/fantomSonicTestnet.d.ts +38 -0
- package/_types/chains/definitions/fantomSonicTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/optimism.d.ts +142 -137
- package/_types/chains/definitions/optimism.d.ts.map +1 -1
- package/_types/chains/definitions/optimismGoerli.d.ts +142 -137
- package/_types/chains/definitions/optimismGoerli.d.ts.map +1 -1
- package/_types/chains/definitions/optimismSepolia.d.ts +142 -137
- package/_types/chains/definitions/optimismSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/pgn.d.ts +147 -137
- package/_types/chains/definitions/pgn.d.ts.map +1 -1
- package/_types/chains/definitions/pgnTestnet.d.ts +142 -137
- package/_types/chains/definitions/pgnTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/zilliqa.d.ts +38 -0
- package/_types/chains/definitions/zilliqa.d.ts.map +1 -0
- package/_types/chains/definitions/zilliqaTestnet.d.ts +38 -0
- package/_types/chains/definitions/zilliqaTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/zkSync.d.ts +24 -24
- package/_types/chains/definitions/zkSyncSepoliaTestnet.d.ts +533 -0
- package/_types/chains/definitions/zkSyncSepoliaTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/zkSyncTestnet.d.ts +29 -24
- package/_types/chains/definitions/zkSyncTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/zora.d.ts +142 -137
- package/_types/chains/definitions/zora.d.ts.map +1 -1
- package/_types/chains/definitions/zoraSepolia.d.ts +142 -137
- package/_types/chains/definitions/zoraSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/zoraTestnet.d.ts +137 -137
- package/_types/chains/index.d.ts +5 -1
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/chains/opStack/abis.d.ts +457 -0
- package/_types/chains/opStack/abis.d.ts.map +1 -1
- package/_types/chains/opStack/actions/buildDepositTransaction.d.ts +5 -3
- package/_types/chains/opStack/actions/buildDepositTransaction.d.ts.map +1 -1
- package/_types/chains/opStack/actions/buildInitiateWithdrawal.d.ts +50 -0
- package/_types/chains/opStack/actions/buildInitiateWithdrawal.d.ts.map +1 -0
- package/_types/chains/opStack/actions/buildProveWithdrawal.d.ts +48 -0
- package/_types/chains/opStack/actions/buildProveWithdrawal.d.ts.map +1 -0
- package/_types/chains/opStack/actions/depositTransaction.d.ts +18 -34
- package/_types/chains/opStack/actions/depositTransaction.d.ts.map +1 -1
- package/_types/chains/opStack/actions/estimateDepositTransactionGas.d.ts +50 -0
- package/_types/chains/opStack/actions/estimateDepositTransactionGas.d.ts.map +1 -0
- package/_types/chains/opStack/actions/estimateFinalizeWithdrawalGas.d.ts +45 -0
- package/_types/chains/opStack/actions/estimateFinalizeWithdrawalGas.d.ts.map +1 -0
- package/_types/chains/opStack/actions/estimateInitiateWithdrawalGas.d.ts +51 -0
- package/_types/chains/opStack/actions/estimateInitiateWithdrawalGas.d.ts.map +1 -0
- package/_types/chains/opStack/actions/estimateProveWithdrawalGas.d.ts +63 -0
- package/_types/chains/opStack/actions/estimateProveWithdrawalGas.d.ts.map +1 -0
- package/_types/chains/opStack/actions/finalizeWithdrawal.d.ts +49 -0
- package/_types/chains/opStack/actions/finalizeWithdrawal.d.ts.map +1 -0
- package/_types/chains/opStack/actions/getL2Output.d.ts +44 -0
- package/_types/chains/opStack/actions/getL2Output.d.ts.map +1 -0
- package/_types/chains/opStack/actions/getTimeToFinalize.d.ts +57 -0
- package/_types/chains/opStack/actions/getTimeToFinalize.d.ts.map +1 -0
- package/_types/chains/opStack/actions/getTimeToNextL2Output.d.ts +61 -0
- package/_types/chains/opStack/actions/getTimeToNextL2Output.d.ts.map +1 -0
- package/_types/chains/opStack/actions/getTimeToProve.d.ts +50 -0
- package/_types/chains/opStack/actions/getTimeToProve.d.ts.map +1 -0
- package/_types/chains/opStack/actions/getWithdrawalStatus.d.ts +48 -0
- package/_types/chains/opStack/actions/getWithdrawalStatus.d.ts.map +1 -0
- package/_types/chains/opStack/actions/initiateWithdrawal.d.ts +77 -0
- package/_types/chains/opStack/actions/initiateWithdrawal.d.ts.map +1 -0
- package/_types/chains/opStack/actions/proveWithdrawal.d.ts +67 -0
- package/_types/chains/opStack/actions/proveWithdrawal.d.ts.map +1 -0
- package/_types/chains/opStack/actions/waitForNextL2Output.d.ts +55 -0
- package/_types/chains/opStack/actions/waitForNextL2Output.d.ts.map +1 -0
- package/_types/chains/opStack/actions/waitToFinalize.d.ts +45 -0
- package/_types/chains/opStack/actions/waitToFinalize.d.ts.map +1 -0
- package/_types/chains/opStack/actions/waitToProve.d.ts +55 -0
- package/_types/chains/opStack/actions/waitToProve.d.ts.map +1 -0
- package/_types/chains/opStack/chainConfig.d.ts +136 -136
- package/_types/chains/opStack/chains.d.ts +2 -0
- package/_types/chains/opStack/chains.d.ts.map +1 -1
- package/_types/chains/opStack/decorators/publicL1.d.ts +386 -0
- package/_types/chains/opStack/decorators/publicL1.d.ts.map +1 -0
- package/_types/chains/opStack/decorators/publicL2.d.ts +82 -26
- package/_types/chains/opStack/decorators/publicL2.d.ts.map +1 -1
- package/_types/chains/opStack/decorators/walletL1.d.ts +57 -2
- package/_types/chains/opStack/decorators/walletL1.d.ts.map +1 -1
- package/_types/chains/opStack/decorators/walletL2.d.ts +62 -0
- package/_types/chains/opStack/decorators/walletL2.d.ts.map +1 -0
- package/_types/chains/opStack/errors/withdrawal.d.ts +12 -0
- package/_types/chains/opStack/errors/withdrawal.d.ts.map +1 -0
- package/_types/chains/opStack/formatters.d.ts +136 -136
- package/_types/chains/opStack/index.d.ts +21 -3
- package/_types/chains/opStack/index.d.ts.map +1 -1
- package/_types/chains/opStack/types/deposit.d.ts +25 -0
- package/_types/chains/opStack/types/deposit.d.ts.map +1 -0
- package/_types/chains/opStack/types/withdrawal.d.ts +22 -0
- package/_types/chains/opStack/types/withdrawal.d.ts.map +1 -0
- package/_types/chains/opStack/utils/extractWithdrawalMessageLogs.d.ts +137 -0
- package/_types/chains/opStack/utils/extractWithdrawalMessageLogs.d.ts.map +1 -0
- package/_types/chains/opStack/utils/getWithdrawalHashStorageSlot.d.ts +11 -0
- package/_types/chains/opStack/utils/getWithdrawalHashStorageSlot.d.ts.map +1 -0
- package/_types/chains/opStack/utils/getWithdrawals.d.ts +12 -0
- package/_types/chains/opStack/utils/getWithdrawals.d.ts.map +1 -0
- package/_types/chains/opStack/utils/opaqueDataToDepositData.d.ts +15 -0
- package/_types/chains/opStack/utils/opaqueDataToDepositData.d.ts.map +1 -0
- package/_types/chains/zksync/chainConfig.d.ts +24 -24
- package/_types/chains/zksync/formatters.d.ts +24 -24
- package/_types/clients/decorators/public.d.ts +2 -2
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/clients/decorators/wallet.d.ts +2 -2
- package/_types/clients/decorators/wallet.d.ts.map +1 -1
- package/_types/errors/abi.d.ts +14 -1
- package/_types/errors/abi.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/errors/version.d.ts.map +1 -1
- package/_types/index.d.ts +15 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/types/account.d.ts +1 -1
- package/_types/types/account.d.ts.map +1 -1
- package/_types/types/eip1193.d.ts +12 -0
- package/_types/types/eip1193.d.ts.map +1 -1
- package/_types/utils/abi/getAbiItem.d.ts +2 -1
- package/_types/utils/abi/getAbiItem.d.ts.map +1 -1
- package/_types/utils/formatters/block.d.ts +1 -1
- package/_types/utils/formatters/block.d.ts.map +1 -1
- package/_types/utils/formatters/transaction.d.ts +2 -2
- package/_types/utils/formatters/transaction.d.ts.map +1 -1
- package/_types/utils/formatters/transactionReceipt.d.ts +1 -1
- package/_types/utils/formatters/transactionReceipt.d.ts.map +1 -1
- package/_types/utils/formatters/transactionRequest.d.ts +1 -1
- package/_types/utils/hash/ripemd160.d.ts +11 -0
- package/_types/utils/hash/ripemd160.d.ts.map +1 -0
- package/_types/utils/hash/sha256.d.ts +11 -0
- package/_types/utils/hash/sha256.d.ts.map +1 -0
- package/_types/utils/index.d.ts +2 -0
- package/_types/utils/index.d.ts.map +1 -1
- package/actions/ens/getEnsName.ts +3 -2
- package/actions/index.ts +31 -0
- package/actions/public/getBlock.ts +1 -1
- package/actions/public/getTransaction.ts +1 -1
- package/actions/public/getTransactionReceipt.ts +1 -1
- package/actions/wallet/prepareTransactionRequest.ts +16 -9
- package/chains/definitions/arbitrumSepolia.ts +4 -0
- package/chains/definitions/base.ts +5 -0
- package/chains/definitions/baseGoerli.ts +5 -0
- package/chains/definitions/baseSepolia.ts +5 -0
- package/chains/definitions/fantomSonicTestnet.ts +23 -0
- package/chains/definitions/optimism.ts +5 -0
- package/chains/definitions/optimismGoerli.ts +5 -0
- package/chains/definitions/optimismSepolia.ts +5 -0
- package/chains/definitions/pgn.ts +13 -0
- package/chains/definitions/pgnTestnet.ts +8 -0
- package/chains/definitions/zilliqa.ts +23 -0
- package/chains/definitions/zilliqaTestnet.ts +23 -0
- package/chains/definitions/zkSyncSepoliaTestnet.ts +32 -0
- package/chains/definitions/zkSyncTestnet.ts +5 -0
- package/chains/definitions/zora.ts +5 -0
- package/chains/definitions/zoraSepolia.ts +5 -0
- package/chains/index.ts +9 -0
- package/chains/opStack/abis.ts +367 -0
- package/chains/opStack/actions/buildDepositTransaction.ts +11 -6
- package/chains/opStack/actions/buildInitiateWithdrawal.ts +118 -0
- package/chains/opStack/actions/buildProveWithdrawal.ts +149 -0
- package/chains/opStack/actions/depositTransaction.ts +50 -44
- package/chains/opStack/actions/estimateDepositTransactionGas.ts +138 -0
- package/chains/opStack/actions/estimateFinalizeWithdrawalGas.ts +118 -0
- package/chains/opStack/actions/estimateInitiateWithdrawalGas.ts +118 -0
- package/chains/opStack/actions/estimateProveWithdrawalGas.ts +139 -0
- package/chains/opStack/actions/finalizeWithdrawal.ts +130 -0
- package/chains/opStack/actions/getL2Output.ts +89 -0
- package/chains/opStack/actions/getTimeToFinalize.ts +122 -0
- package/chains/opStack/actions/getTimeToNextL2Output.ts +162 -0
- package/chains/opStack/actions/getTimeToProve.ts +79 -0
- package/chains/opStack/actions/getWithdrawalStatus.ts +152 -0
- package/chains/opStack/actions/initiateWithdrawal.ts +153 -0
- package/chains/opStack/actions/proveWithdrawal.ts +151 -0
- package/chains/opStack/actions/waitForNextL2Output.ts +111 -0
- package/chains/opStack/actions/waitToFinalize.ts +64 -0
- package/chains/opStack/actions/waitToProve.ts +99 -0
- package/chains/opStack/chains.ts +2 -0
- package/chains/opStack/decorators/publicL1.ts +514 -0
- package/chains/opStack/decorators/publicL2.ts +129 -37
- package/chains/opStack/decorators/walletL1.ts +71 -2
- package/chains/opStack/decorators/walletL2.ts +84 -0
- package/chains/opStack/errors/withdrawal.ts +15 -0
- package/chains/opStack/index.ts +112 -21
- package/chains/opStack/types/deposit.ts +28 -0
- package/chains/opStack/types/withdrawal.ts +23 -0
- package/chains/opStack/utils/extractWithdrawalMessageLogs.ts +36 -0
- package/chains/opStack/utils/getL2TransactionHash.ts +2 -2
- package/chains/opStack/utils/getWithdrawalHashStorageSlot.ts +29 -0
- package/chains/opStack/utils/getWithdrawals.ts +25 -0
- package/chains/opStack/utils/{fromOpaqueData.ts → opaqueDataToDepositData.ts} +9 -4
- package/clients/decorators/public.ts +2 -2
- package/clients/decorators/wallet.ts +2 -2
- package/errors/abi.ts +22 -1
- package/errors/version.ts +1 -1
- package/index.ts +40 -0
- package/package.json +1 -1
- package/types/account.ts +1 -1
- package/types/eip1193.ts +12 -0
- package/utils/abi/getAbiItem.ts +71 -2
- package/utils/formatters/block.ts +1 -1
- package/utils/formatters/transaction.ts +1 -1
- package/utils/formatters/transactionReceipt.ts +1 -1
- package/utils/hash/ripemd160.ts +31 -0
- package/utils/hash/sha256.ts +31 -0
- package/utils/index.ts +2 -0
- package/_cjs/chains/opStack/utils/fromOpaqueData.js.map +0 -1
- package/_esm/chains/opStack/utils/fromOpaqueData.js.map +0 -1
- package/_types/chains/opStack/utils/fromOpaqueData.d.ts +0 -15
- package/_types/chains/opStack/utils/fromOpaqueData.d.ts.map +0 -1
- package/chains/celo/package.json +0 -6
- package/chains/opStack/package.json +0 -6
- package/chains/zksync/package.json +0 -6
@@ -0,0 +1,386 @@
|
|
1
|
+
import type { Address } from 'abitype';
|
2
|
+
import type { Client } from '../../../clients/createClient.js';
|
3
|
+
import type { Transport } from '../../../clients/transports/createTransport.js';
|
4
|
+
import type { Account } from '../../../types/account.js';
|
5
|
+
import type { Chain } from '../../../types/chain.js';
|
6
|
+
import { type BuildInitiateWithdrawalParameters, type BuildInitiateWithdrawalReturnType } from '../actions/buildInitiateWithdrawal.js';
|
7
|
+
import { type EstimateDepositTransactionGasParameters, type EstimateDepositTransactionGasReturnType } from '../actions/estimateDepositTransactionGas.js';
|
8
|
+
import { type EstimateFinalizeWithdrawalGasParameters, type EstimateFinalizeWithdrawalGasReturnType } from '../actions/estimateFinalizeWithdrawalGas.js';
|
9
|
+
import { type EstimateProveWithdrawalGasParameters, type EstimateProveWithdrawalGasReturnType } from '../actions/estimateProveWithdrawalGas.js';
|
10
|
+
import { type GetL2OutputParameters, type GetL2OutputReturnType } from '../actions/getL2Output.js';
|
11
|
+
import { type GetTimeToFinalizeParameters, type GetTimeToFinalizeReturnType } from '../actions/getTimeToFinalize.js';
|
12
|
+
import { type GetTimeToNextL2OutputParameters, type GetTimeToNextL2OutputReturnType } from '../actions/getTimeToNextL2Output.js';
|
13
|
+
import { type GetTimeToProveParameters, type GetTimeToProveReturnType } from '../actions/getTimeToProve.js';
|
14
|
+
import { type GetWithdrawalStatusParameters, type GetWithdrawalStatusReturnType } from '../actions/getWithdrawalStatus.js';
|
15
|
+
import { type WaitForNextL2OutputParameters, type WaitForNextL2OutputReturnType } from '../actions/waitForNextL2Output.js';
|
16
|
+
import { type WaitToFinalizeParameters, type WaitToFinalizeReturnType } from '../actions/waitToFinalize.js';
|
17
|
+
import { type WaitToProveParameters, type WaitToProveReturnType } from '../actions/waitToProve.js';
|
18
|
+
export type PublicActionsL1<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = {
|
19
|
+
/**
|
20
|
+
* Prepares parameters for a [deposit transaction](https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md) to be initiated on an L1.
|
21
|
+
*
|
22
|
+
* - Docs: https://viem.sh/op-stack/actions/buildInitiateWithdrawal.html
|
23
|
+
*
|
24
|
+
* @param client - Client to use
|
25
|
+
* @param parameters - {@link BuildInitiateWithdrawalParameters}
|
26
|
+
* @returns Parameters for `depositTransaction`. {@link DepositTransactionReturnType}
|
27
|
+
*
|
28
|
+
* @example
|
29
|
+
* import { createWalletClient, http, parseEther } from 'viem'
|
30
|
+
* import { base } from 'viem/chains'
|
31
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
32
|
+
*
|
33
|
+
* const client = createWalletClient({
|
34
|
+
* chain: base,
|
35
|
+
* transport: http(),
|
36
|
+
* }).extend(publicActionsL1())
|
37
|
+
*
|
38
|
+
* const args = await client.buildInitiateWithdrawal({
|
39
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
40
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
41
|
+
* value: parseEther('1'),
|
42
|
+
* })
|
43
|
+
*/
|
44
|
+
buildInitiateWithdrawal: <chainOverride extends Chain | undefined = undefined, accountOverride extends Account | Address | undefined = undefined>(parameters: BuildInitiateWithdrawalParameters<chain, account, chainOverride, accountOverride>) => Promise<BuildInitiateWithdrawalReturnType<account, accountOverride>>;
|
45
|
+
/**
|
46
|
+
* Estimates gas required to initiate a [deposit transaction](https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md) on an L1, which executes a transaction on L2.
|
47
|
+
*
|
48
|
+
* - Docs: https://viem.sh/op-stack/actions/estimateDepositTransactionGas.html
|
49
|
+
*
|
50
|
+
* @param client - Client to use
|
51
|
+
* @param parameters - {@link EstimateDepositTransactionGasParameters}
|
52
|
+
* @returns The L1 transaction hash. {@link EstimateDepositTransactionGasReturnType}
|
53
|
+
*
|
54
|
+
* @example
|
55
|
+
* import { createPublicClient, custom, parseEther } from 'viem'
|
56
|
+
* import { base, mainnet } from 'viem/chains'
|
57
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
58
|
+
*
|
59
|
+
* const client = createPublicClient({
|
60
|
+
* chain: mainnet,
|
61
|
+
* transport: custom(window.ethereum),
|
62
|
+
* }).extend(publicActionsL1())
|
63
|
+
*
|
64
|
+
* const gas = await client.estimateDepositTransactionGas({
|
65
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
66
|
+
* args: {
|
67
|
+
* gas: 21_000n,
|
68
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
69
|
+
* value: parseEther('1'),
|
70
|
+
* },
|
71
|
+
* targetChain: base,
|
72
|
+
* })
|
73
|
+
*/
|
74
|
+
estimateDepositTransactionGas: <chainOverride extends Chain | undefined = undefined>(parameters: EstimateDepositTransactionGasParameters<chain, account, chainOverride>) => Promise<EstimateDepositTransactionGasReturnType>;
|
75
|
+
/**
|
76
|
+
* Estimates gas required to prove a withdrawal that occurred on an L2.
|
77
|
+
*
|
78
|
+
* - Docs: https://viem.sh/op-stack/actions/estimateProveWithdrawalGas.html
|
79
|
+
*
|
80
|
+
* @param client - Client to use
|
81
|
+
* @param parameters - {@link EstimateProveWithdrawalGasParameters}
|
82
|
+
* @returns Estimated gas. {@link EstimateProveWithdrawalGasReturnType}
|
83
|
+
*
|
84
|
+
* @example
|
85
|
+
* import { createPublicClient, http, parseEther } from 'viem'
|
86
|
+
* import { base, mainnet } from 'viem/chains'
|
87
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
88
|
+
*
|
89
|
+
* const client = createPublicClient({
|
90
|
+
* chain: mainnet,
|
91
|
+
* transport: http(),
|
92
|
+
* }).extend(publicActionsL1())
|
93
|
+
*
|
94
|
+
* const gas = await client.estimateProveWithdrawalGas({
|
95
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
96
|
+
* l2OutputIndex: 4529n,
|
97
|
+
* outputRootProof: { ... },
|
98
|
+
* targetChain: optimism,
|
99
|
+
* withdrawalProof: [ ... ],
|
100
|
+
* withdrawal: { ... },
|
101
|
+
* })
|
102
|
+
*/
|
103
|
+
estimateProveWithdrawalGas: <chainOverride extends Chain | undefined = undefined>(parameters: EstimateProveWithdrawalGasParameters<chain, account, chainOverride>) => Promise<EstimateProveWithdrawalGasReturnType>;
|
104
|
+
/**
|
105
|
+
* Estimates gas required to finalize a withdrawal that occurred on an L2.
|
106
|
+
*
|
107
|
+
* - Docs: https://viem.sh/op-stack/actions/estimateFinalizeWithdrawalGas.html
|
108
|
+
*
|
109
|
+
* @param client - Client to use
|
110
|
+
* @param parameters - {@link EstimateFinalizeWithdrawalGasParameters}
|
111
|
+
* @returns Estimated gas. {@link EstimateFinalizeWithdrawalGasReturnType}
|
112
|
+
*
|
113
|
+
* @example
|
114
|
+
* import { createPublicClient, http, parseEther } from 'viem'
|
115
|
+
* import { base, mainnet } from 'viem/chains'
|
116
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
117
|
+
*
|
118
|
+
* const client = createPublicClient({
|
119
|
+
* chain: mainnet,
|
120
|
+
* transport: http(),
|
121
|
+
* }).extend(publicActionsL1())
|
122
|
+
*
|
123
|
+
* const gas = await client.estimateFinalizeWithdrawalGas({
|
124
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
125
|
+
* targetChain: optimism,
|
126
|
+
* withdrawal: { ... },
|
127
|
+
* })
|
128
|
+
*/
|
129
|
+
estimateFinalizeWithdrawalGas: <chainOverride extends Chain | undefined = undefined>(parameters: EstimateFinalizeWithdrawalGasParameters<chain, account, chainOverride>) => Promise<EstimateFinalizeWithdrawalGasReturnType>;
|
130
|
+
/**
|
131
|
+
* Retrieves the first L2 output proposal that occurred after a provided block number. Used for the [Withdrawal](/op-stack/guides/withdrawals.html) flow.
|
132
|
+
*
|
133
|
+
* - Docs: https://viem.sh/op-stack/actions/getL2Output.html
|
134
|
+
*
|
135
|
+
* @param client - Client to use
|
136
|
+
* @param parameters - {@link GetL2OutputParameters}
|
137
|
+
* @returns The L2 output. {@link GetL2OutputReturnType}
|
138
|
+
*
|
139
|
+
* @example
|
140
|
+
* import { createPublicClient, http } from 'viem'
|
141
|
+
* import { mainnet, optimism } from 'viem/chains'
|
142
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
143
|
+
*
|
144
|
+
* const publicClientL1 = createPublicClient({
|
145
|
+
* chain: mainnet,
|
146
|
+
* transport: http(),
|
147
|
+
* }).extend(publicActionsL1())
|
148
|
+
*
|
149
|
+
* const output = await publicClientL1.getL2Output({
|
150
|
+
* l2BlockNumber: 69420n,
|
151
|
+
* targetChain: optimism
|
152
|
+
* })
|
153
|
+
*/
|
154
|
+
getL2Output: <chainOverride extends Chain | undefined = undefined>(parameters: GetL2OutputParameters<chain, chainOverride>) => Promise<GetL2OutputReturnType>;
|
155
|
+
/**
|
156
|
+
* Returns the time until the withdrawal transaction can be finalized. Used for the [Withdrawal](/op-stack/guides/withdrawals.html) flow.
|
157
|
+
*
|
158
|
+
* - Docs: https://viem.sh/op-stack/actions/getTimeToFinalize.html
|
159
|
+
*
|
160
|
+
* @param client - Client to use
|
161
|
+
* @param parameters - {@link GetTimeToFinalizeParameters}
|
162
|
+
* @returns Time until finalize. {@link GetTimeToFinalizeReturnType}
|
163
|
+
*
|
164
|
+
* @example
|
165
|
+
* import { createPublicClient, http } from 'viem'
|
166
|
+
* import { getBlockNumber } from 'viem/actions'
|
167
|
+
* import { mainnet, optimism } from 'viem/chains'
|
168
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
169
|
+
*
|
170
|
+
* const publicClientL1 = createPublicClient({
|
171
|
+
* chain: mainnet,
|
172
|
+
* transport: http(),
|
173
|
+
* }).extend(publicActionsL1())
|
174
|
+
* const publicClientL2 = createPublicClient({
|
175
|
+
* chain: optimism,
|
176
|
+
* transport: http(),
|
177
|
+
* })
|
178
|
+
*
|
179
|
+
* const receipt = await publicClientL2.getTransactionReceipt({
|
180
|
+
* hash: '0x9a2f4283636ddeb9ac32382961b22c177c9e86dd3b283735c154f897b1a7ff4a',
|
181
|
+
* })
|
182
|
+
*
|
183
|
+
* const [withdrawal] = getWithdrawals(receipt)
|
184
|
+
*
|
185
|
+
* const { seconds } = await publicClientL1.getTimeToFinalize({
|
186
|
+
* withdrawalHash: withdrawal.withdrawalHash,
|
187
|
+
* targetChain: optimism
|
188
|
+
* })
|
189
|
+
*/
|
190
|
+
getTimeToFinalize: <chainOverride extends Chain | undefined = undefined>(parameters: GetTimeToFinalizeParameters<chain, chainOverride>) => Promise<GetTimeToFinalizeReturnType>;
|
191
|
+
/**
|
192
|
+
* Returns the time until the next L2 output (after a provided block number) is submitted. Used for the [Withdrawal](/op-stack/guides/withdrawals.html) flow.
|
193
|
+
*
|
194
|
+
* - Docs: https://viem.sh/op-stack/actions/getTimeToNextL2Output.html
|
195
|
+
*
|
196
|
+
* @param client - Client to use
|
197
|
+
* @param parameters - {@link GetTimeToNextL2OutputParameters}
|
198
|
+
* @returns The L2 transaction hash. {@link GetTimeToNextL2OutputReturnType}
|
199
|
+
*
|
200
|
+
* @example
|
201
|
+
* import { createPublicClient, http } from 'viem'
|
202
|
+
* import { mainnet, optimism } from 'viem/chains'
|
203
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
204
|
+
*
|
205
|
+
* const publicClientL1 = createPublicClient({
|
206
|
+
* chain: mainnet,
|
207
|
+
* transport: http(),
|
208
|
+
* }).extend(publicActionsL1())
|
209
|
+
* const publicClientL2 = createPublicClient({
|
210
|
+
* chain: optimism,
|
211
|
+
* transport: http(),
|
212
|
+
* })
|
213
|
+
*
|
214
|
+
* const l2BlockNumber = await publicClientL2.getBlockNumber()
|
215
|
+
* const { seconds } = await publicClientL1.getTimeToNextL2Output({
|
216
|
+
* l2BlockNumber,
|
217
|
+
* targetChain: optimism
|
218
|
+
* })
|
219
|
+
*/
|
220
|
+
getTimeToNextL2Output: <chainOverride extends Chain | undefined = undefined>(parameters: GetTimeToNextL2OutputParameters<chain, chainOverride>) => Promise<GetTimeToNextL2OutputReturnType>;
|
221
|
+
/**
|
222
|
+
* Returns the time until the withdrawal transaction can be finalized. Used for the [Withdrawal](/op-stack/guides/withdrawals.html) flow.
|
223
|
+
*
|
224
|
+
* - Docs: https://viem.sh/op-stack/actions/getTimeToFinalize.html
|
225
|
+
*
|
226
|
+
* @param client - Client to use
|
227
|
+
* @param parameters - {@link GetTimeToFinalizeParameters}
|
228
|
+
* @returns Time until finalize. {@link GetTimeToFinalizeReturnType}
|
229
|
+
*
|
230
|
+
* @example
|
231
|
+
* import { createPublicClient, http } from 'viem'
|
232
|
+
* import { getBlockNumber } from 'viem/actions'
|
233
|
+
* import { mainnet, optimism } from 'viem/chains'
|
234
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
235
|
+
*
|
236
|
+
* const publicClientL1 = createPublicClient({
|
237
|
+
* chain: mainnet,
|
238
|
+
* transport: http(),
|
239
|
+
* }).extend(publicActionsL1())
|
240
|
+
* const publicClientL2 = createPublicClient({
|
241
|
+
* chain: optimism,
|
242
|
+
* transport: http(),
|
243
|
+
* })
|
244
|
+
*
|
245
|
+
* const receipt = await publicClientL2.getTransactionReceipt({
|
246
|
+
* hash: '0x9a2f4283636ddeb9ac32382961b22c177c9e86dd3b283735c154f897b1a7ff4a',
|
247
|
+
* })
|
248
|
+
*
|
249
|
+
* const [withdrawal] = getWithdrawals(receipt)
|
250
|
+
*
|
251
|
+
* const { seconds } = await publicClientL1.getTimeToFinalize({
|
252
|
+
* withdrawalHash: withdrawal.withdrawalHash,
|
253
|
+
* targetChain: optimism
|
254
|
+
* })
|
255
|
+
*/
|
256
|
+
getTimeToProve: <chainOverride extends Chain | undefined = undefined>(parameters: GetTimeToProveParameters<chain, chainOverride>) => Promise<GetTimeToProveReturnType>;
|
257
|
+
/**
|
258
|
+
* Returns the current status of a withdrawal. Used for the [Withdrawal](/op-stack/guides/withdrawals.html) flow.
|
259
|
+
*
|
260
|
+
* - Docs: https://viem.sh/op-stack/actions/getWithdrawalStatus.html
|
261
|
+
*
|
262
|
+
* @param client - Client to use
|
263
|
+
* @param parameters - {@link GetWithdrawalStatusParameters}
|
264
|
+
* @returns Status of the withdrawal. {@link GetWithdrawalStatusReturnType}
|
265
|
+
*
|
266
|
+
* @example
|
267
|
+
* import { createPublicClient, http } from 'viem'
|
268
|
+
* import { getBlockNumber } from 'viem/actions'
|
269
|
+
* import { mainnet, optimism } from 'viem/chains'
|
270
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
271
|
+
*
|
272
|
+
* const publicClientL1 = createPublicClient({
|
273
|
+
* chain: mainnet,
|
274
|
+
* transport: http(),
|
275
|
+
* }).extend(publicActionsL1())
|
276
|
+
* const publicClientL2 = createPublicClient({
|
277
|
+
* chain: optimism,
|
278
|
+
* transport: http(),
|
279
|
+
* })
|
280
|
+
*
|
281
|
+
* const receipt = await publicClientL2.getTransactionReceipt({ hash: '0x...' })
|
282
|
+
* const status = await publicClientL1.getWithdrawalStatus({
|
283
|
+
* receipt,
|
284
|
+
* targetChain: optimism
|
285
|
+
* })
|
286
|
+
*/
|
287
|
+
getWithdrawalStatus: <chainOverride extends Chain | undefined = undefined>(parameters: GetWithdrawalStatusParameters<chain, chainOverride>) => Promise<GetWithdrawalStatusReturnType>;
|
288
|
+
/**
|
289
|
+
* Waits for the next L2 output (after the provided block number) to be submitted.
|
290
|
+
*
|
291
|
+
* - Docs: https://viem.sh/op-stack/actions/waitForNextL2Output.html
|
292
|
+
*
|
293
|
+
* @param client - Client to use
|
294
|
+
* @param parameters - {@link WaitForNextL2OutputParameters}
|
295
|
+
* @returns The L2 transaction hash. {@link WaitForNextL2OutputReturnType}
|
296
|
+
*
|
297
|
+
* @example
|
298
|
+
* import { createPublicClient, http } from 'viem'
|
299
|
+
* import { mainnet, optimism } from 'viem/chains'
|
300
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
301
|
+
*
|
302
|
+
* const publicClientL1 = createPublicClient({
|
303
|
+
* chain: mainnet,
|
304
|
+
* transport: http(),
|
305
|
+
* }).extend(publicActionsL1())
|
306
|
+
* const publicClientL2 = createPublicClient({
|
307
|
+
* chain: optimism,
|
308
|
+
* transport: http(),
|
309
|
+
* })
|
310
|
+
*
|
311
|
+
* const l2BlockNumber = await getBlockNumber(publicClientL2)
|
312
|
+
* await waitForNextL2Output(publicClientL1, {
|
313
|
+
* l2BlockNumber,
|
314
|
+
* targetChain: optimism
|
315
|
+
* })
|
316
|
+
*/
|
317
|
+
waitForNextL2Output: <chainOverride extends Chain | undefined = undefined>(parameters: WaitForNextL2OutputParameters<chain, chainOverride>) => Promise<WaitForNextL2OutputReturnType>;
|
318
|
+
/**
|
319
|
+
* Waits until the withdrawal transaction can be finalized. Used for the [Withdrawal](/op-stack/guides/withdrawals.html) flow.
|
320
|
+
*
|
321
|
+
* - Docs: https://viem.sh/op-stack/actions/waitToFinalize.html
|
322
|
+
*
|
323
|
+
* @param client - Client to use
|
324
|
+
* @param parameters - {@link WaitToFinalizeParameters}
|
325
|
+
*
|
326
|
+
* @example
|
327
|
+
* import { createPublicClient, http } from 'viem'
|
328
|
+
* import { getBlockNumber } from 'viem/actions'
|
329
|
+
* import { mainnet, optimism } from 'viem/chains'
|
330
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
331
|
+
*
|
332
|
+
* const publicClientL1 = createPublicClient({
|
333
|
+
* chain: mainnet,
|
334
|
+
* transport: http(),
|
335
|
+
* }).extend(publicActionsL1)
|
336
|
+
* const publicClientL2 = createPublicClient({
|
337
|
+
* chain: optimism,
|
338
|
+
* transport: http(),
|
339
|
+
* })
|
340
|
+
*
|
341
|
+
* const receipt = await getTransactionReceipt(publicClientL2, {
|
342
|
+
* hash: '0x9a2f4283636ddeb9ac32382961b22c177c9e86dd3b283735c154f897b1a7ff4a',
|
343
|
+
* })
|
344
|
+
*
|
345
|
+
* const [withdrawal] = getWithdrawals(receipt)
|
346
|
+
*
|
347
|
+
* await publicClientL1.waitToFinalize({
|
348
|
+
* withdrawalHash: withdrawal.withdrawalHash,
|
349
|
+
* targetChain: optimism
|
350
|
+
* })
|
351
|
+
*/
|
352
|
+
waitToFinalize: <chainOverride extends Chain | undefined = undefined>(parameters: WaitToFinalizeParameters<chain, chainOverride>) => Promise<WaitToFinalizeReturnType>;
|
353
|
+
/**
|
354
|
+
* Waits until the L2 withdrawal transaction is provable. Used for the [Withdrawal](/op-stack/guides/withdrawals.html) flow.
|
355
|
+
*
|
356
|
+
* - Docs: https://viem.sh/op-stack/actions/waitToProve.html
|
357
|
+
*
|
358
|
+
* @param client - Client to use
|
359
|
+
* @param parameters - {@link WaitToProveParameters}
|
360
|
+
* @returns The L2 output and withdrawal message. {@link WaitToProveReturnType}
|
361
|
+
*
|
362
|
+
* @example
|
363
|
+
* import { createPublicClient, http } from 'viem'
|
364
|
+
* import { getBlockNumber } from 'viem/actions'
|
365
|
+
* import { mainnet, optimism } from 'viem/chains'
|
366
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
367
|
+
*
|
368
|
+
* const publicClientL1 = createPublicClient({
|
369
|
+
* chain: mainnet,
|
370
|
+
* transport: http(),
|
371
|
+
* }).extend(publicActionsL1)
|
372
|
+
* const publicClientL2 = createPublicClient({
|
373
|
+
* chain: optimism,
|
374
|
+
* transport: http(),
|
375
|
+
* })
|
376
|
+
*
|
377
|
+
* const receipt = await publicClientL2.getTransactionReceipt({ hash: '0x...' })
|
378
|
+
* await publicClientL1.waitToProve({
|
379
|
+
* receipt,
|
380
|
+
* targetChain: optimism
|
381
|
+
* })
|
382
|
+
*/
|
383
|
+
waitToProve: <chainOverride extends Chain | undefined = undefined>(parameters: WaitToProveParameters<chain, chainOverride>) => Promise<WaitToProveReturnType>;
|
384
|
+
};
|
385
|
+
export declare function publicActionsL1(): <TTransport extends Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined>(client: Client<TTransport, TChain, TAccount>) => PublicActionsL1<TChain, TAccount>;
|
386
|
+
//# sourceMappingURL=publicL1.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"publicL1.d.ts","sourceRoot":"","sources":["../../../../chains/opStack/decorators/publicL1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAA;AAC/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EAEvC,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,KAAK,uCAAuC,EAC5C,KAAK,uCAAuC,EAE7C,MAAM,6CAA6C,CAAA;AACpD,OAAO,EACL,KAAK,uCAAuC,EAC5C,KAAK,uCAAuC,EAE7C,MAAM,6CAA6C,CAAA;AACpD,OAAO,EACL,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EAE1C,MAAM,0CAA0C,CAAA;AACjD,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAE3B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAEjC,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EAErC,MAAM,qCAAqC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AS,GAAG,SAAS,EACvE,UAAU,EAAE,6BAA6B,CAAC,KAAK,EAAE,aAAa,CAAC,KAC5D,OAAO,CAAC,6BAA6B,CAAC,CAAA;IAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,mBAAmB,EAAE,CAAC,aAAa,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,EACvE,UAAU,EAAE,6BAA6B,CAAC,KAAK,EAAE,aAAa,CAAC,KAC5D,OAAO,CAAC,6BAA6B,CAAC,CAAA;IAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,cAAc,EAAE,CAAC,aAAa,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,EAClE,UAAU,EAAE,wBAAwB,CAAC,KAAK,EAAE,aAAa,CAAC,KACvD,OAAO,CAAC,wBAAwB,CAAC,CAAA;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,WAAW,EAAE,CAAC,aAAa,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,EAC/D,UAAU,EAAE,qBAAqB,CAAC,KAAK,EAAE,aAAa,CAAC,KACpD,OAAO,CAAC,qBAAqB,CAAC,CAAA;CACpC,CAAA;AAED,wBAAgB,eAAe,wOA0B9B"}
|
@@ -5,15 +5,68 @@ import type { Account } from '../../../types/account.js';
|
|
5
5
|
import type { Chain } from '../../../types/chain.js';
|
6
6
|
import type { ContractFunctionArgs, ContractFunctionName } from '../../../types/contract.js';
|
7
7
|
import { type BuildDepositTransactionParameters, type BuildDepositTransactionReturnType } from '../actions/buildDepositTransaction.js';
|
8
|
+
import { type BuildProveWithdrawalParameters, type BuildProveWithdrawalReturnType } from '../actions/buildProveWithdrawal.js';
|
8
9
|
import { type EstimateContractL1FeeParameters, type EstimateContractL1FeeReturnType } from '../actions/estimateContractL1Fee.js';
|
9
10
|
import { type EstimateContractL1GasParameters, type EstimateContractL1GasReturnType } from '../actions/estimateContractL1Gas.js';
|
10
11
|
import { type EstimateContractTotalFeeParameters, type EstimateContractTotalFeeReturnType } from '../actions/estimateContractTotalFee.js';
|
11
12
|
import { type EstimateContractTotalGasParameters, type EstimateContractTotalGasReturnType } from '../actions/estimateContractTotalGas.js';
|
13
|
+
import { type EstimateInitiateWithdrawalGasParameters, type EstimateInitiateWithdrawalGasReturnType } from '../actions/estimateInitiateWithdrawalGas.js';
|
12
14
|
import { type EstimateL1FeeParameters, type EstimateL1FeeReturnType } from '../actions/estimateL1Fee.js';
|
13
15
|
import { type EstimateL1GasParameters, type EstimateL1GasReturnType } from '../actions/estimateL1Gas.js';
|
14
16
|
import { type EstimateTotalFeeParameters, type EstimateTotalFeeReturnType } from '../actions/estimateTotalFee.js';
|
15
17
|
import { type EstimateTotalGasParameters, type EstimateTotalGasReturnType } from '../actions/estimateTotalGas.js';
|
16
18
|
export type PublicActionsL2<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = {
|
19
|
+
/**
|
20
|
+
* Prepares parameters for a [deposit transaction](https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md) to be initiated on an L1.
|
21
|
+
*
|
22
|
+
* - Docs: https://viem.sh/op-stack/actions/buildDepositTransaction.html
|
23
|
+
*
|
24
|
+
* @param client - Client to use
|
25
|
+
* @param parameters - {@link BuildDepositTransactionParameters}
|
26
|
+
* @returns Parameters for `depositTransaction`. {@link DepositTransactionReturnType}
|
27
|
+
*
|
28
|
+
* @example
|
29
|
+
* import { createWalletClient, http, parseEther } from 'viem'
|
30
|
+
* import { base } from 'viem/chains'
|
31
|
+
* import { publicActionsL2 } from 'viem/op-stack'
|
32
|
+
*
|
33
|
+
* const client = createWalletClient({
|
34
|
+
* chain: base,
|
35
|
+
* transport: http(),
|
36
|
+
* }).extend(publicActionsL2())
|
37
|
+
*
|
38
|
+
* const args = await client.buildDepositTransaction({
|
39
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
40
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
41
|
+
* value: parseEther('1'),
|
42
|
+
* })
|
43
|
+
*/
|
44
|
+
buildDepositTransaction: <chainOverride extends Chain | undefined = undefined, accountOverride extends Account | Address | undefined = undefined>(parameters: BuildDepositTransactionParameters<chain, account, chainOverride, accountOverride>) => Promise<BuildDepositTransactionReturnType<account, accountOverride>>;
|
45
|
+
/**
|
46
|
+
* Builds the transaction that proves a withdrawal was initiated on an L2. Used in the Withdrawal flow.
|
47
|
+
*
|
48
|
+
* - Docs: https://viem.sh/op-stack/actions/buildProveWithdrawal.html
|
49
|
+
*
|
50
|
+
* @param client - Client to use
|
51
|
+
* @param parameters - {@link BuildProveWithdrawalParameters}
|
52
|
+
* @returns The prove withdraw transaction request. {@link BuildProveWithdrawalReturnType}
|
53
|
+
*
|
54
|
+
* @example
|
55
|
+
* import { createPublicClient, http } from 'viem'
|
56
|
+
* import { optimism } from 'viem/chains'
|
57
|
+
* import { publicActionsL2 } from 'viem/op-stack'
|
58
|
+
*
|
59
|
+
* const publicClientL2 = createPublicClient({
|
60
|
+
* chain: optimism,
|
61
|
+
* transport: http(),
|
62
|
+
* }).extend(publicActionsL2())
|
63
|
+
*
|
64
|
+
* const args = await publicClientL2.buildProveWithdrawal({
|
65
|
+
* output: { ... },
|
66
|
+
* withdrawal: { ... },
|
67
|
+
* })
|
68
|
+
*/
|
69
|
+
buildProveWithdrawal: <chainOverride extends Chain | undefined = undefined, accountOverride extends Account | Address | undefined = undefined>(parameters: BuildProveWithdrawalParameters<chain, account, chainOverride, accountOverride>) => Promise<BuildProveWithdrawalReturnType<chain, account, chainOverride, accountOverride>>;
|
17
70
|
/**
|
18
71
|
* Estimates the L1 data fee required to execute an L2 contract write.
|
19
72
|
*
|
@@ -114,6 +167,35 @@ export type PublicActionsL2<chain extends Chain | undefined = Chain | undefined,
|
|
114
167
|
* })
|
115
168
|
*/
|
116
169
|
estimateContractTotalGas: <const abi extends Abi | readonly unknown[], functionName extends ContractFunctionName<abi, 'nonpayable' | 'payable'>, args extends ContractFunctionArgs<abi, 'pure' | 'view', functionName>, chainOverride extends Chain | undefined = undefined>(parameters: EstimateContractTotalGasParameters<abi, functionName, args, chain, account, chainOverride>) => Promise<EstimateContractTotalGasReturnType>;
|
170
|
+
/**
|
171
|
+
* Estimates gas required to initiate a [withdrawal](https://community.optimism.io/docs/protocol/withdrawal-flow/#withdrawal-initiating-transaction) on an L2 to the L1.
|
172
|
+
*
|
173
|
+
* - Docs: https://viem.sh/op-stack/actions/estimateInitiateWithdrawalGas.html
|
174
|
+
*
|
175
|
+
* @param client - Client to use
|
176
|
+
* @param parameters - {@link EstimateInitiateWithdrawalGasParameters}
|
177
|
+
* @returns The gas required. {@link EstimateInitiateWithdrawalGasReturnType}
|
178
|
+
*
|
179
|
+
* @example
|
180
|
+
* import { createPublicClient, http, parseEther } from 'viem'
|
181
|
+
* import { base, mainnet } from 'viem/chains'
|
182
|
+
* import { publicActionsL2 } from 'viem/op-stack'
|
183
|
+
*
|
184
|
+
* const client = createPublicClient({
|
185
|
+
* chain: mainnet,
|
186
|
+
* transport: http(),
|
187
|
+
* }).extend(publicActionsL2())
|
188
|
+
*
|
189
|
+
* const hash = await client.estimateInitiateWithdrawalGas({
|
190
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
191
|
+
* request: {
|
192
|
+
* gas: 21_000n,
|
193
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
194
|
+
* value: parseEther('1'),
|
195
|
+
* },
|
196
|
+
* })
|
197
|
+
*/
|
198
|
+
estimateInitiateWithdrawalGas: <chainOverride extends Chain | undefined = undefined>(parameters: EstimateInitiateWithdrawalGasParameters<chain, account, chainOverride>) => Promise<EstimateInitiateWithdrawalGasReturnType>;
|
117
199
|
/**
|
118
200
|
* Estimates the L1 data fee required to execute an L2 transaction.
|
119
201
|
*
|
@@ -210,32 +292,6 @@ export type PublicActionsL2<chain extends Chain | undefined = Chain | undefined,
|
|
210
292
|
* })
|
211
293
|
*/
|
212
294
|
estimateTotalGas: <chainOverride extends Chain | undefined = undefined>(parameters: EstimateTotalGasParameters<chain, account, chainOverride>) => Promise<EstimateTotalGasReturnType>;
|
213
|
-
/**
|
214
|
-
* Prepares parameters for a [deposit transaction](https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md) to be initiated on an L1.
|
215
|
-
*
|
216
|
-
* - Docs: https://viem.sh/op-stack/actions/buildDepositTransaction.html
|
217
|
-
*
|
218
|
-
* @param client - Client to use
|
219
|
-
* @param parameters - {@link BuildDepositTransactionParameters}
|
220
|
-
* @returns Parameters for `depositTransaction`. {@link DepositTransactionReturnType}
|
221
|
-
*
|
222
|
-
* @example
|
223
|
-
* import { createWalletClient, http, parseEther } from 'viem'
|
224
|
-
* import { base } from 'viem/chains'
|
225
|
-
* import { publicActionsL2 } from 'viem/op-stack'
|
226
|
-
*
|
227
|
-
* const client = createWalletClient({
|
228
|
-
* chain: base,
|
229
|
-
* transport: http(),
|
230
|
-
* }).extend(publicActionsL2())
|
231
|
-
*
|
232
|
-
* const request = await client.buildDepositTransaction({
|
233
|
-
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
234
|
-
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
235
|
-
* value: parseEther('1'),
|
236
|
-
* })
|
237
|
-
*/
|
238
|
-
buildDepositTransaction: <chainOverride extends Chain | undefined = undefined, accountOverride extends Account | Address | undefined = undefined>(parameters: BuildDepositTransactionParameters<chain, account, chainOverride, accountOverride>) => Promise<BuildDepositTransactionReturnType<account, accountOverride>>;
|
239
295
|
};
|
240
296
|
export declare function publicActionsL2(): <TTransport extends Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined>(client: Client<TTransport, TChain, TAccount>) => PublicActionsL2<TChain, TAccount>;
|
241
297
|
//# sourceMappingURL=publicL2.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"publicL2.d.ts","sourceRoot":"","sources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,GAAG,SAAS,EACjE,UAAU,EAAE,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,KAC/D,OAAO,CAAC,uBAAuB,CAAC,CAAA;IACrC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,aAAa,EAAE,CAAC,aAAa,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,EACjE,UAAU,EAAE,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,KAC/D,OAAO,CAAC,uBAAuB,CAAC,CAAA;IACrC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,gBAAgB,EAAE,CAAC,aAAa,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,EACpE,UAAU,EAAE,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,KAClE,OAAO,CAAC,0BAA0B,CAAC,CAAA;IACxC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,gBAAgB,EAAE,CAAC,aAAa,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,EACpE,UAAU,EAAE,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,KAClE,OAAO,CAAC,0BAA0B,CAAC,CAAA;CACzC,CAAA;AAED,wBAAgB,eAAe,wOAyB9B"}
|
@@ -3,6 +3,8 @@ import type { Transport } from '../../../clients/transports/createTransport.js';
|
|
3
3
|
import type { Account } from '../../../types/account.js';
|
4
4
|
import type { Chain } from '../../../types/chain.js';
|
5
5
|
import { type DepositTransactionParameters, type DepositTransactionReturnType } from '../actions/depositTransaction.js';
|
6
|
+
import { type FinalizeWithdrawalParameters, type FinalizeWithdrawalReturnType } from '../actions/finalizeWithdrawal.js';
|
7
|
+
import { type ProveWithdrawalParameters, type ProveWithdrawalReturnType } from '../actions/proveWithdrawal.js';
|
6
8
|
export type WalletActionsL1<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = {
|
7
9
|
/**
|
8
10
|
* Initiates a [deposit transaction](https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md) on an L1, which executes a transaction on L2.
|
@@ -28,7 +30,7 @@ export type WalletActionsL1<chain extends Chain | undefined = Chain | undefined,
|
|
28
30
|
*
|
29
31
|
* const hash = await client.depositTransaction({
|
30
32
|
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
31
|
-
*
|
33
|
+
* request: {
|
32
34
|
* gas: 21_000n,
|
33
35
|
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
34
36
|
* value: parseEther('1'),
|
@@ -50,7 +52,7 @@ export type WalletActionsL1<chain extends Chain | undefined = Chain | undefined,
|
|
50
52
|
* }).extend(walletActionsL1())
|
51
53
|
*
|
52
54
|
* const hash = await client.depositTransaction({
|
53
|
-
*
|
55
|
+
* request: {
|
54
56
|
* gas: 21_000n,
|
55
57
|
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
56
58
|
* value: parseEther('1'),
|
@@ -59,6 +61,59 @@ export type WalletActionsL1<chain extends Chain | undefined = Chain | undefined,
|
|
59
61
|
* })
|
60
62
|
*/
|
61
63
|
depositTransaction: <chainOverride extends Chain | undefined = undefined>(parameters: DepositTransactionParameters<chain, account, chainOverride>) => Promise<DepositTransactionReturnType>;
|
64
|
+
/**
|
65
|
+
* Finalizes a withdrawal that occurred on an L2. Used in the Withdrawal flow.
|
66
|
+
*
|
67
|
+
* - Docs: https://viem.sh/op-stack/actions/finalizeWithdrawal.html
|
68
|
+
*
|
69
|
+
* @param client - Client to use
|
70
|
+
* @param parameters - {@link FinalizeWithdrawalParameters}
|
71
|
+
* @returns The finalize transaction hash. {@link FinalizeWithdrawalReturnType}
|
72
|
+
*
|
73
|
+
* @example
|
74
|
+
* import { createWalletClient, http } from 'viem'
|
75
|
+
* import { mainnet, optimism } from 'viem/chains'
|
76
|
+
* import { walletActionsL1 } from 'viem/op-stack'
|
77
|
+
*
|
78
|
+
* const walletClientL1 = createWalletClient({
|
79
|
+
* chain: mainnet,
|
80
|
+
* transport: http(),
|
81
|
+
* }).extend(walletActionsL1)
|
82
|
+
*
|
83
|
+
* const hash = await walletClientL1.finalizeWithdrawal({
|
84
|
+
* targetChain: optimism,
|
85
|
+
* withdrawal: { ... },
|
86
|
+
* })
|
87
|
+
*/
|
88
|
+
finalizeWithdrawal: <chainOverride extends Chain | undefined = undefined>(parameters: FinalizeWithdrawalParameters<chain, account, chainOverride>) => Promise<FinalizeWithdrawalReturnType>;
|
89
|
+
/**
|
90
|
+
* Proves a withdrawal that occurred on an L2. Used in the Withdrawal flow.
|
91
|
+
*
|
92
|
+
* - Docs: https://viem.sh/op-stack/actions/proveWithdrawal.html
|
93
|
+
*
|
94
|
+
* @param client - Client to use
|
95
|
+
* @param parameters - {@link ProveWithdrawalParameters}
|
96
|
+
* @returns The prove transaction hash. {@link ProveWithdrawalReturnType}
|
97
|
+
*
|
98
|
+
* @example
|
99
|
+
* import { createWalletClient, http } from 'viem'
|
100
|
+
* import { mainnet, optimism } from 'viem/chains'
|
101
|
+
* import { walletActionsL1 } from 'viem/op-stack'
|
102
|
+
*
|
103
|
+
* const walletClientL1 = createWalletClient({
|
104
|
+
* chain: mainnet,
|
105
|
+
* transport: http(),
|
106
|
+
* }).extend(walletActionsL1())
|
107
|
+
*
|
108
|
+
* const hash = await walletClientL1.proveWithdrawal({
|
109
|
+
* l2OutputIndex: 4529n,
|
110
|
+
* outputRootProof: { ... },
|
111
|
+
* targetChain: optimism,
|
112
|
+
* withdrawalProof: [ ... ],
|
113
|
+
* withdrawalTransaction: { ... },
|
114
|
+
* })
|
115
|
+
*/
|
116
|
+
proveWithdrawal: <chainOverride extends Chain | undefined = undefined>(parameters: ProveWithdrawalParameters<chain, account, chainOverride>) => Promise<ProveWithdrawalReturnType>;
|
62
117
|
};
|
63
118
|
export declare function walletActionsL1(): <TTransport extends Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined>(client: Client<TTransport, TChain, TAccount>) => WalletActionsL1<TChain, TAccount>;
|
64
119
|
//# sourceMappingURL=walletL1.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"walletL1.d.ts","sourceRoot":"","sources":["../../../../chains/opStack/decorators/walletL1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAA;AAC/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EAElC,MAAM,kCAAkC,CAAA;
|
1
|
+
{"version":3,"file":"walletL1.d.ts","sourceRoot":"","sources":["../../../../chains/opStack/decorators/walletL1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAA;AAC/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EAElC,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EAElC,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAE/B,MAAM,+BAA+B,CAAA;AAEtC,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACnD,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACvD;IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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