Constructors

  • Creates a new CrossChainProvider instance.

    Parameters

    Returns Portals

Properties

_outputCache: {
    root: string;
    valid: boolean;
}[] = []

Cache for output root validation. Output roots are expensive to verify, so we cache them.

Type declaration

  • root: string
  • valid: boolean
bedrock: boolean

Whether or not Bedrock compatibility is enabled.

contracts: OEContracts

Contract objects attached to their respective providers and addresses.

depositConfirmationBlocks: number

Number of blocks before a deposit is considered confirmed.

estimateGas: {
    depositTransaction: ((request) => Promise<BigNumber>);
    finalizeWithdrawalTransaction: ((message) => Promise<BigNumber>);
    initiateWithdrawal: ((request) => Promise<BigNumber>);
    proveWithdrawalTransaction: ((message, opts?) => Promise<BigNumber>);
} = ...

Object that holds the functions that estimates the gas required for a given transaction. Follows the pattern used by ethers.js.

Type declaration

  • depositTransaction: ((request) => Promise<BigNumber>)
  • finalizeWithdrawalTransaction: ((message) => Promise<BigNumber>)
  • initiateWithdrawal: ((request) => Promise<BigNumber>)
  • proveWithdrawalTransaction: ((message, opts?) => Promise<BigNumber>)
      • (message, opts?): Promise<BigNumber>
      • Parameters

        • message: WithdrawalMessageInfo
        • Optional opts: {
              overrides?: PayableOverrides;
          }
          • Optional overrides?: PayableOverrides

        Returns Promise<BigNumber>

l1BlockTimeSeconds: number

Estimated average L1 block time in seconds.

l1ChainId: number

Chain ID for the L1 network.

l1SignerOrProvider: Provider | Signer

Provider connected to the L1 chain.

l2ChainId: number

Chain ID for the L2 network.

l2SignerOrProvider: Provider | Signer

Provider connected to the L2 chain.

populateTransaction: {
    depositTransaction: ((request) => Promise<TransactionRequest>);
    finalizeWithdrawalTransaction: ((message) => Promise<TransactionRequest>);
    initiateWithdrawal: ((request) => Promise<TransactionRequest>);
    proveWithdrawalTransaction: ((message, opts?) => Promise<TransactionRequest>);
} = ...

Type declaration

  • depositTransaction: ((request) => Promise<TransactionRequest>)
  • finalizeWithdrawalTransaction: ((message) => Promise<TransactionRequest>)
      • (message): Promise<TransactionRequest>
      • Parameters

        Returns Promise<TransactionRequest>

  • initiateWithdrawal: ((request) => Promise<TransactionRequest>)
  • proveWithdrawalTransaction: ((message, opts?) => Promise<TransactionRequest>)
      • (message, opts?): Promise<TransactionRequest>
      • Parameters

        • message: WithdrawalMessageInfo
        • Optional opts: {
              overrides?: PayableOverrides;
          }
          • Optional overrides?: PayableOverrides

        Returns Promise<TransactionRequest>

Accessors

  • get l1Provider(): Provider
  • Provider connected to the L1 chain.

    Returns Provider

  • get l1Signer(): Signer
  • Signer connected to the L1 chain.

    Returns Signer

  • get l2Provider(): Provider
  • Provider connected to the L2 chain.

    Returns Provider

  • get l2Signer(): Signer
  • Signer connected to the L2 chain.

    Returns Signer

Methods

  • Parameters

    • txReceipt: TransactionReceipt

    Returns Promise<string>

  • Parameters

    Returns Promise<TransactionResponse>

  • Parameters

    Returns Promise<TransactionResponse>

  • Parameters

    • transactionHash: string
    • Optional opts: {
          signer?: Signer;
      }
      • Optional signer?: Signer

    Returns Promise<TransactionResponse>

  • Uses portal version to determine if the messenger is using fpac contracts. Better not to cache this value as it will change during the fpac upgrade and we want clients to automatically begin using the new logic without throwing any errors.

    Returns Promise<boolean>

    Whether or not the messenger is using fpac contracts.

  • Generates the bedrock proof required to finalize an L2 to L1 message.

    Parameters

    Returns Promise<BedrockCrossChainMessageProof>

    Proof that can be used to finalize the message.

  • Queries the current challenge period in seconds from the StateCommitmentChain.

    Returns Promise<number>

    Current challenge period in seconds.

  • Parameters

    • withdrawalHash: string

    Returns Promise<boolean>

  • Returns Promise<number>

  • Parameters

    • txReceipt: TransactionReceipt

    Returns Promise<MessageStatus>

  • Parameters

    • txReceipt: TransactionReceipt

    Returns Promise<MessageStatus>

  • Returns the Bedrock output root that corresponds to the given message.

    Parameters

    • l2BlockNumber: number

    Returns Promise<BedrockOutputData>

    Bedrock output root.

  • Returns the state root that corresponds to a given message. This is the state root for the block in which the transaction was included, as published to the StateCommitmentChain. If the state root for the given message has not been published yet, this function returns null.

    Parameters

    • transactionHash: string

    Returns Promise<StateRoot>

    State root for the block in which the message was created.

  • Parameters

    • txReceipt: TransactionReceipt

    Returns Promise<MessageStatus>

  • Queries the OptimismPortal contract's provenWithdrawals mapping for a ProvenWithdrawal that matches the passed withdrawalHash

    Parameters

    • withdrawalHash: string

    Returns Promise<ProvenWithdrawal>

    A ProvenWithdrawal object

    Bedrock

    Note: This function is bedrock-specific.

  • Returns the StateBatchAppended event that was emitted when the batch with a given index was created. Returns null if no such event exists (the batch has not been submitted).

    Parameters

    • batchIndex: number

      Index of the batch to find an event for.

    Returns Promise<Event>

    StateBatchAppended event for the batch, or null if no such batch exists.

  • Returns the StateBatchAppended event for the batch that includes the transaction with the given index. Returns null if no such event exists.

    Parameters

    • transactionIndex: number

      Index of the L2 transaction to find an event for.

    Returns Promise<Event>

    StateBatchAppended event for the batch that includes the given transaction by index.

  • Returns information about the state root batch that included the state root for the given transaction by index. Returns null if no such state root has been published yet.

    Parameters

    • transactionIndex: number

      Index of the L2 transaction to find a state root batch for.

    Returns Promise<StateRootBatch>

    State root batch for the given transaction index, or null if none exists yet.

  • Parameters

    Returns Promise<TransactionResponse>

  • Parameters

    • outputRoot: string
    • l2BlockNumber: number

    Returns Promise<boolean>

  • Parameters

    Returns Promise<TransactionResponse>

  • Parameters

    • transactionHash: string
    • Optional opts: {
          signer?: Signer;
      }
      • Optional signer?: Signer

    Returns Promise<TransactionResponse>

  • Parameters

    • txReceipt: TransactionReceipt
    • status: MessageStatus
    • Optional opts: {
          pollIntervalMs?: number;
          timeoutMs?: number;
      }
      • Optional pollIntervalMs?: number
      • Optional timeoutMs?: number

    Returns Promise<void>

Generated using TypeDoc