UNPKG

viem

Version:

TypeScript Interface for Ethereum

53 lines 3.13 kB
import type { Client } from '../../clients/createClient.js'; import type { Transport } from '../../clients/transports/createTransport.js'; import type { ErrorType } from '../../errors/utils.js'; import type { Account } from '../../types/account.js'; import type { Chain, DeriveChain, GetChainParameter } from '../../types/chain.js'; import type { TransactionReceipt } from '../../types/transaction.js'; import type { OneOf } from '../../types/utils.js'; import type { GetContractAddressParameter } from '../types/contract.js'; import { type GetPortalVersionErrorType } from './getPortalVersion.js'; import { type GetTimeToNextGameErrorType, type GetTimeToNextGameReturnType } from './getTimeToNextGame.js'; import { type GetTimeToNextL2OutputErrorType, type GetTimeToNextL2OutputParameters, type GetTimeToNextL2OutputReturnType } from './getTimeToNextL2Output.js'; export type GetTimeToProveParameters<chain extends Chain | undefined = Chain | undefined, chainOverride extends Chain | undefined = Chain | undefined, _derivedChain extends Chain | undefined = DeriveChain<chain, chainOverride>> = GetChainParameter<chain, chainOverride> & OneOf<GetContractAddressParameter<_derivedChain, 'l2OutputOracle'> | GetContractAddressParameter<_derivedChain, 'disputeGameFactory' | 'portal'>> & { /** * The buffer to account for discrepancies between non-deterministic time intervals. * @default 1.1 */ intervalBuffer?: GetTimeToNextL2OutputParameters['intervalBuffer'] | undefined; receipt: TransactionReceipt; }; export type GetTimeToProveReturnType = GetTimeToNextGameReturnType | GetTimeToNextL2OutputReturnType; export type GetTimeToProveErrorType = GetPortalVersionErrorType | GetTimeToNextGameErrorType | GetTimeToNextL2OutputErrorType | ErrorType; /** * Returns the time until the withdrawal transaction is ready to prove. Used for the [Withdrawal](/op-stack/guides/withdrawals) flow. * * - Docs: https://viem.sh/op-stack/actions/getTimeToProve * * @param client - Client to use * @param parameters - {@link GetTimeToNextL2OutputParameters} * @returns Time until prove step is ready. {@link GetTimeToNextL2OutputReturnType} * * @example * import { createPublicClient, http } from 'viem' * import { getBlockNumber } from 'viem/actions' * import { mainnet, optimism } from 'viem/chains' * import { getTimeToProve } from 'viem/op-stack' * * const publicClientL1 = createPublicClient({ * chain: mainnet, * transport: http(), * }) * const publicClientL2 = createPublicClient({ * chain: optimism, * transport: http(), * }) * * const receipt = await publicClientL2.getTransactionReceipt({ hash: '0x...' }) * const { period, seconds, timestamp } = await getTimeToProve(publicClientL1, { * receipt, * targetChain: optimism * }) */ export declare function getTimeToProve<chain extends Chain | undefined, account extends Account | undefined, chainOverride extends Chain | undefined = undefined>(client: Client<Transport, chain, account>, parameters: GetTimeToProveParameters<chain, chainOverride>): Promise<GetTimeToProveReturnType>; //# sourceMappingURL=getTimeToProve.d.ts.map