Constructors

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.

List of custom bridges for the given network.

contracts: OEContracts

Contract objects attached to their respective providers and addresses.

depositConfirmationBlocks: number

Number of blocks before a deposit is considered confirmed.

estimateGas: {
    approveERC20: ((l1Token, l2Token, amount, opts?) => Promise<BigNumber>);
    approveNativeToken: ((amount, opts?) => Promise<BigNumber>);
    bridgeERC20: ((l1Token, l2Token, amount, opts?) => Promise<BigNumber>);
    bridgeETH: ((amount, opts?) => Promise<BigNumber>);
    bridgeNativeToken: ((amount, opts?) => Promise<BigNumber>);
    finalizeMessage: ((message, opts?, messageIndex?) => Promise<BigNumber>);
    proveMessage: ((message, opts?, messageIndex?) => Promise<BigNumber>);
    resendMessage: ((message, messageGasLimit, opts?) => Promise<BigNumber>);
    sendMessage: ((message, opts?) => Promise<BigNumber>);
    withdrawERC20: ((l1Token, l2Token, amount, opts?) => Promise<BigNumber>);
    withdrawETH: ((amount, opts?) => Promise<BigNumber>);
    withdrawNativeToken: ((amount, 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

  • approveERC20: ((l1Token, l2Token, amount, opts?) => Promise<BigNumber>)

    Estimates gas required to approve some tokens to deposit into the L2 chain.

    Param: l1Token

    The L1 token address.

    Param: l2Token

    The L2 token address.

    Param: amount

    Amount of the token to approve.

    Param: opts

    Additional options.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Transaction response for the approval transaction.

      • (l1Token, l2Token, amount, opts?): Promise<BigNumber>
      • Estimates gas required to approve some tokens to deposit into the L2 chain.

        Parameters

        • l1Token: AddressLike

          The L1 token address.

        • l2Token: AddressLike

          The L2 token address.

        • amount: NumberLike

          Amount of the token to approve.

        • Optional opts: {
              overrides?: CallOverrides;
          }

          Additional options.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

        Returns Promise<BigNumber>

        Transaction response for the approval transaction.

  • approveNativeToken: ((amount, opts?) => Promise<BigNumber>)

    Estimates gas required to approve L2 Native tokens to deposit into the L2 chain.

    Param: amount

    Amount of the token to approve.

    Param: opts

    Additional options.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Transaction response for the approval transaction.

      • (amount, opts?): Promise<BigNumber>
      • Estimates gas required to approve L2 Native tokens to deposit into the L2 chain.

        Parameters

        • amount: NumberLike

          Amount of the token to approve.

        • Optional opts: {
              overrides?: CallOverrides;
          }

          Additional options.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

        Returns Promise<BigNumber>

        Transaction response for the approval transaction.

  • bridgeERC20: ((l1Token, l2Token, amount, opts?) => Promise<BigNumber>)

    Estimates gas required to deposit some ERC20 tokens into the L2 chain.

    Param: l1Token

    Address of the L1 token.

    Param: l2Token

    Address of the L2 token.

    Param: amount

    Amount to deposit.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L2. Defaults to sender.

    Param: opts.l2GasLimit

    Optional gas limit to use for the transaction on L2.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Gas estimate for the transaction.

      • (l1Token, l2Token, amount, opts?): Promise<BigNumber>
      • Estimates gas required to deposit some ERC20 tokens into the L2 chain.

        Parameters

        • l1Token: AddressLike

          Address of the L1 token.

        • l2Token: AddressLike

          Address of the L2 token.

        • amount: NumberLike

          Amount to deposit.

        • Optional opts: {
              l2GasLimit?: NumberLike;
              overrides?: CallOverrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional l2GasLimit?: NumberLike

            Optional gas limit to use for the transaction on L2.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L2. Defaults to sender.

        Returns Promise<BigNumber>

        Gas estimate for the transaction.

  • bridgeETH: ((amount, opts?) => Promise<BigNumber>)

    Estimates gas required to deposit some ETH into the L2 chain.

    Param: amount

    Amount of ETH to deposit.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L2. Defaults to sender.

    Param: opts.l2GasLimit

    Optional gas limit to use for the transaction on L2.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Gas estimate for the transaction.

      • (amount, opts?): Promise<BigNumber>
      • Estimates gas required to deposit some ETH into the L2 chain.

        Parameters

        • amount: NumberLike

          Amount of ETH to deposit.

        • Optional opts: {
              l2GasLimit?: NumberLike;
              overrides?: CallOverrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional l2GasLimit?: NumberLike

            Optional gas limit to use for the transaction on L2.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L2. Defaults to sender.

        Returns Promise<BigNumber>

        Gas estimate for the transaction.

  • bridgeNativeToken: ((amount, opts?) => Promise<BigNumber>)

    Estimates gas required to deposit some L2 Native Token into the L2 chain.

    Param: amount

    Amount of L2 Native Token to deposit.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L2. Defaults to sender.

    Param: opts.l2GasLimit

    Optional gas limit to use for the transaction on L2.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Gas estimate for the transaction.

      • (amount, opts?): Promise<BigNumber>
      • Estimates gas required to deposit some L2 Native Token into the L2 chain.

        Parameters

        • amount: NumberLike

          Amount of L2 Native Token to deposit.

        • Optional opts: {
              l2GasLimit?: NumberLike;
              overrides?: CallOverrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional l2GasLimit?: NumberLike

            Optional gas limit to use for the transaction on L2.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L2. Defaults to sender.

        Returns Promise<BigNumber>

        Gas estimate for the transaction.

  • finalizeMessage: ((message, opts?, messageIndex?) => Promise<BigNumber>)

    Estimates gas required to finalize a cross chain message. Only applies to L2 to L1 messages.

    Param: message

    Message to generate the finalization transaction for.

    Param: opts

    Additional options.

    Param: opts.overrides

    Optional transaction overrides.

    Param: messageIndex

    The index of the message, if multiple exist from multicall

    Returns

    Gas estimate for the transaction.

      • (message, opts?, messageIndex?): Promise<BigNumber>
      • Estimates gas required to finalize a cross chain message. Only applies to L2 to L1 messages.

        Parameters

        • message: MessageLike

          Message to generate the finalization transaction for.

        • Optional opts: {
              overrides?: CallOverrides;
          }

          Additional options.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

        • messageIndex: number = 0

          The index of the message, if multiple exist from multicall

        Returns Promise<BigNumber>

        Gas estimate for the transaction.

  • proveMessage: ((message, opts?, messageIndex?) => Promise<BigNumber>)

    Estimates gas required to prove a cross chain message. Only applies to L2 to L1 messages.

    Param: message

    Message to generate the proving transaction for.

    Param: opts

    Additional options.

    Param: opts.overrides

    Optional transaction overrides.

    Param: messageIndex

    The index of the message, if multiple exist from multicall

    Returns

    Gas estimate for the transaction.

      • (message, opts?, messageIndex?): Promise<BigNumber>
      • Estimates gas required to prove a cross chain message. Only applies to L2 to L1 messages.

        Parameters

        • message: MessageLike

          Message to generate the proving transaction for.

        • Optional opts: {
              overrides?: CallOverrides;
          }

          Additional options.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

        • messageIndex: number = 0

          The index of the message, if multiple exist from multicall

        Returns Promise<BigNumber>

        Gas estimate for the transaction.

  • resendMessage: ((message, messageGasLimit, opts?) => Promise<BigNumber>)

    Estimates gas required to resend a cross chain message. Only applies to L1 to L2 messages.

    Param: message

    Cross chain message to resend.

    Param: messageGasLimit

    New gas limit to use for the message.

    Param: opts

    Additional options.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Gas estimate for the transaction.

      • (message, messageGasLimit, opts?): Promise<BigNumber>
      • Estimates gas required to resend a cross chain message. Only applies to L1 to L2 messages.

        Parameters

        • message: MessageLike

          Cross chain message to resend.

        • messageGasLimit: NumberLike

          New gas limit to use for the message.

        • Optional opts: {
              overrides?: CallOverrides;
          }

          Additional options.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

        Returns Promise<BigNumber>

        Gas estimate for the transaction.

  • sendMessage: ((message, opts?) => Promise<BigNumber>)

    Estimates gas required to send a cross chain message.

    Param: message

    Cross chain message to send.

    Param: opts

    Additional options.

    Param: opts.l2GasLimit

    Optional gas limit to use for the transaction on L2.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Gas estimate for the transaction.

      • (message, opts?): Promise<BigNumber>
      • Estimates gas required to send a cross chain message.

        Parameters

        • message: CrossChainMessageRequest

          Cross chain message to send.

        • Optional opts: {
              l2GasLimit?: NumberLike;
              overrides?: CallOverrides;
          }

          Additional options.

          • Optional l2GasLimit?: NumberLike

            Optional gas limit to use for the transaction on L2.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

        Returns Promise<BigNumber>

        Gas estimate for the transaction.

  • withdrawERC20: ((l1Token, l2Token, amount, opts?) => Promise<BigNumber>)

    Estimates gas required to withdraw some ERC20 tokens back to the L1 chain.

    Param: l1Token

    Address of the L1 token.

    Param: l2Token

    Address of the L2 token.

    Param: amount

    Amount to withdraw.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L1. Defaults to sender.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Gas estimate for the transaction.

      • (l1Token, l2Token, amount, opts?): Promise<BigNumber>
      • Estimates gas required to withdraw some ERC20 tokens back to the L1 chain.

        Parameters

        • l1Token: AddressLike

          Address of the L1 token.

        • l2Token: AddressLike

          Address of the L2 token.

        • amount: NumberLike

          Amount to withdraw.

        • Optional opts: {
              overrides?: CallOverrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L1. Defaults to sender.

        Returns Promise<BigNumber>

        Gas estimate for the transaction.

  • withdrawETH: ((amount, opts?) => Promise<BigNumber>)

    Estimates gas required to withdraw some ETH back to the L1 chain.

    Param: amount

    Amount of ETH to withdraw.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L1. Defaults to sender.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Gas estimate for the transaction.

      • (amount, opts?): Promise<BigNumber>
      • Estimates gas required to withdraw some ETH back to the L1 chain.

        Parameters

        • amount: NumberLike

          Amount of ETH to withdraw.

        • Optional opts: {
              overrides?: CallOverrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L1. Defaults to sender.

        Returns Promise<BigNumber>

        Gas estimate for the transaction.

  • withdrawNativeToken: ((amount, opts?) => Promise<BigNumber>)

    Estimates gas required to withdraw some L2 Native Token back to the L1 chain.

    Param: amount

    Amount of L2 Native Token to withdraw.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L1. Defaults to sender.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Gas estimate for the transaction.

      • (amount, opts?): Promise<BigNumber>
      • Estimates gas required to withdraw some L2 Native Token back to the L1 chain.

        Parameters

        • amount: NumberLike

          Amount of L2 Native Token to withdraw.

        • Optional opts: {
              overrides?: CallOverrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L1. Defaults to sender.

        Returns Promise<BigNumber>

        Gas estimate for the transaction.

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.

nativeTokenAddress: string

Native Token Address

populateTransaction: {
    approveERC20: ((l1Token, l2Token, amount, opts?) => Promise<TransactionRequest>);
    approveNativeToken: ((amount, opts?) => Promise<TransactionRequest>);
    bridgeERC20: ((l1Token, l2Token, amount, opts?, isEstimatingGas?) => Promise<TransactionRequest>);
    bridgeETH: ((amount, opts?, isEstimatingGas?) => Promise<TransactionRequest>);
    bridgeNativeToken: ((amount, opts?, isEstimatingGas?) => Promise<TransactionRequest>);
    finalizeMessage: ((message, opts?, messageIndex?) => Promise<TransactionRequest>);
    proveMessage: ((message, opts?, messageIndex?) => Promise<TransactionRequest>);
    resendMessage: ((message, messageGasLimit, opts?, messageIndex?) => Promise<TransactionRequest>);
    sendMessage: ((message, opts?) => Promise<TransactionRequest>);
    withdrawERC20: ((l1Token, l2Token, amount, opts?) => Promise<TransactionRequest>);
    withdrawETH: ((amount, opts?) => Promise<TransactionRequest>);
    withdrawNativeToken: ((amount, opts?) => Promise<TransactionRequest>);
} = ...

Object that holds the functions that generate transactions to be signed by the user. Follows the pattern used by ethers.js.

Type declaration

  • approveERC20: ((l1Token, l2Token, amount, opts?) => Promise<TransactionRequest>)

    Generates a transaction for approving some tokens to deposit into the L2 chain.

    Param: l1Token

    The L1 token address.

    Param: l2Token

    The L2 token address.

    Param: amount

    Amount of the token to approve.

    Param: opts

    Additional options.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Transaction response for the approval transaction.

      • (l1Token, l2Token, amount, opts?): Promise<TransactionRequest>
      • Generates a transaction for approving some tokens to deposit into the L2 chain.

        Parameters

        • l1Token: AddressLike

          The L1 token address.

        • l2Token: AddressLike

          The L2 token address.

        • amount: NumberLike

          Amount of the token to approve.

        • Optional opts: {
              overrides?: Overrides;
          }

          Additional options.

          • Optional overrides?: Overrides

            Optional transaction overrides.

        Returns Promise<TransactionRequest>

        Transaction response for the approval transaction.

  • approveNativeToken: ((amount, opts?) => Promise<TransactionRequest>)

    Generates a transaction for approving L2 Native Token tokens to deposit into the L2 chain.

    Param: amount

    Amount of the L2 Native Token to approve.

    Param: opts

    Additional options.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Transaction response for the approval transaction.

      • (amount, opts?): Promise<TransactionRequest>
      • Generates a transaction for approving L2 Native Token tokens to deposit into the L2 chain.

        Parameters

        • amount: NumberLike

          Amount of the L2 Native Token to approve.

        • Optional opts: {
              overrides?: Overrides;
          }

          Additional options.

          • Optional overrides?: Overrides

            Optional transaction overrides.

        Returns Promise<TransactionRequest>

        Transaction response for the approval transaction.

  • bridgeERC20: ((l1Token, l2Token, amount, opts?, isEstimatingGas?) => Promise<TransactionRequest>)

    Generates a transaction for depositing some ERC20 tokens into the L2 chain.

    Param: l1Token

    Address of the L1 token.

    Param: l2Token

    Address of the L2 token.

    Param: amount

    Amount to deposit.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L2. Defaults to sender.

    Param: opts.l2GasLimit

    Optional gas limit to use for the transaction on L2.

    Param: opts.overrides

    Optional transaction overrides.

    Param: isEstimatingGas

    determine to estimate gas.

    Returns

    Transaction that can be signed and executed to deposit the tokens.

      • (l1Token, l2Token, amount, opts?, isEstimatingGas?): Promise<TransactionRequest>
      • Generates a transaction for depositing some ERC20 tokens into the L2 chain.

        Parameters

        • l1Token: AddressLike

          Address of the L1 token.

        • l2Token: AddressLike

          Address of the L2 token.

        • amount: NumberLike

          Amount to deposit.

        • Optional opts: {
              l2GasLimit?: NumberLike;
              overrides?: CallOverrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional l2GasLimit?: NumberLike

            Optional gas limit to use for the transaction on L2.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L2. Defaults to sender.

        • isEstimatingGas: boolean = false

          determine to estimate gas.

        Returns Promise<TransactionRequest>

        Transaction that can be signed and executed to deposit the tokens.

  • bridgeETH: ((amount, opts?, isEstimatingGas?) => Promise<TransactionRequest>)

    Generates a transaction for depositing some ETH into the L2 chain.

    Param: amount

    Amount of ETH to deposit.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L2. Defaults to sender.

    Param: opts.l2GasLimit

    Optional gas limit to use for the transaction on L2.

    Param: opts.overrides

    Optional transaction overrides.

    Param: isEstimatingGas

    Enable estimation gas

    Returns

    Transaction that can be signed and executed to deposit the ETH.

      • (amount, opts?, isEstimatingGas?): Promise<TransactionRequest>
      • Generates a transaction for depositing some ETH into the L2 chain.

        Parameters

        • amount: NumberLike

          Amount of ETH to deposit.

        • Optional opts: {
              l2GasLimit?: NumberLike;
              overrides?: CallOverrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional l2GasLimit?: NumberLike

            Optional gas limit to use for the transaction on L2.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L2. Defaults to sender.

        • isEstimatingGas: boolean = false

          Enable estimation gas

        Returns Promise<TransactionRequest>

        Transaction that can be signed and executed to deposit the ETH.

  • bridgeNativeToken: ((amount, opts?, isEstimatingGas?) => Promise<TransactionRequest>)

    Generates a transaction for depositing some L2 Native Token into the L2 chain.

    Param: amount

    Amount of L2 Native Token to deposit.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L2. Defaults to sender.

    Param: opts.l2GasLimit

    Optional gas limit to use for the transaction on L2.

    Param: opts.overrides

    Optional transaction overrides.

    Param: isEstimatingGas

    Enable estimation gas

    Returns

    Transaction that can be signed and executed to deposit the L2 Native Token.

      • (amount, opts?, isEstimatingGas?): Promise<TransactionRequest>
      • Generates a transaction for depositing some L2 Native Token into the L2 chain.

        Parameters

        • amount: NumberLike

          Amount of L2 Native Token to deposit.

        • Optional opts: {
              l2GasLimit?: NumberLike;
              overrides?: CallOverrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional l2GasLimit?: NumberLike

            Optional gas limit to use for the transaction on L2.

          • Optional overrides?: CallOverrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L2. Defaults to sender.

        • isEstimatingGas: boolean = false

          Enable estimation gas

        Returns Promise<TransactionRequest>

        Transaction that can be signed and executed to deposit the L2 Native Token.

  • finalizeMessage: ((message, opts?, messageIndex?) => Promise<TransactionRequest>)

    Generates a message finalization transaction that can be signed and executed. Only applicable for L2 to L1 messages. Will throw an error if the message has not completed its challenge period yet.

    Param: message

    Message to generate the finalization transaction for.

    Param: opts

    Additional options.

    Param: opts.overrides

    Optional transaction overrides.

    Param: messageIndex

    The index of the message, if multiple exist from multicall

    Returns

    Transaction that can be signed and executed to finalize the message.

      • (message, opts?, messageIndex?): Promise<TransactionRequest>
      • Generates a message finalization transaction that can be signed and executed. Only applicable for L2 to L1 messages. Will throw an error if the message has not completed its challenge period yet.

        Parameters

        • message: MessageLike

          Message to generate the finalization transaction for.

        • Optional opts: {
              overrides?: PayableOverrides;
          }

          Additional options.

          • Optional overrides?: PayableOverrides

            Optional transaction overrides.

        • messageIndex: number = 0

          The index of the message, if multiple exist from multicall

        Returns Promise<TransactionRequest>

        Transaction that can be signed and executed to finalize the message.

  • proveMessage: ((message, opts?, messageIndex?) => Promise<TransactionRequest>)

    Generates a message proving transaction that can be signed and executed. Only applicable for L2 to L1 messages.

    Param: message

    Message to generate the proving transaction for.

    Param: opts

    Additional options.

    Param: opts.overrides

    Optional transaction overrides.

    Param: messageIndex

    The index of the message, if multiple exist from multicall

    Returns

    Transaction that can be signed and executed to prove the message.

      • (message, opts?, messageIndex?): Promise<TransactionRequest>
      • Generates a message proving transaction that can be signed and executed. Only applicable for L2 to L1 messages.

        Parameters

        • message: MessageLike

          Message to generate the proving transaction for.

        • Optional opts: {
              overrides?: PayableOverrides;
          }

          Additional options.

          • Optional overrides?: PayableOverrides

            Optional transaction overrides.

        • messageIndex: number = 0

          The index of the message, if multiple exist from multicall

        Returns Promise<TransactionRequest>

        Transaction that can be signed and executed to prove the message.

  • resendMessage: ((message, messageGasLimit, opts?, messageIndex?) => Promise<TransactionRequest>)

    Generates a transaction that resends a given cross chain message. Only applies to L1 to L2 messages. This transaction can be signed and executed by a signer.

    Param: message

    Cross chain message to resend.

    Param: messageGasLimit

    New gas limit to use for the message.

    Param: opts

    Additional options.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Transaction that can be signed and executed to resend the message.

      • (message, messageGasLimit, opts?, messageIndex?): Promise<TransactionRequest>
      • Generates a transaction that resends a given cross chain message. Only applies to L1 to L2 messages. This transaction can be signed and executed by a signer.

        Parameters

        • message: MessageLike

          Cross chain message to resend.

        • messageGasLimit: NumberLike

          New gas limit to use for the message.

        • Optional opts: {
              overrides?: Overrides;
          }

          Additional options.

          • Optional overrides?: Overrides

            Optional transaction overrides.

        • messageIndex: number = 0

          The index of the withdrawal if multiple are made with multicall

        Returns Promise<TransactionRequest>

        Transaction that can be signed and executed to resend the message.

  • sendMessage: ((message, opts?) => Promise<TransactionRequest>)

    Generates a transaction that sends a given cross chain message. This transaction can be signed and executed by a signer.

    Param: message

    Cross chain message to send.

    Param: opts

    Additional options.

    Param: opts.l2GasLimit

    Optional gas limit to use for the transaction on L2.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Transaction that can be signed and executed to send the message.

      • (message, opts?): Promise<TransactionRequest>
      • Generates a transaction that sends a given cross chain message. This transaction can be signed and executed by a signer.

        Parameters

        • message: CrossChainMessageRequest

          Cross chain message to send.

        • Optional opts: {
              l2GasLimit?: NumberLike;
              overrides?: Overrides;
          }

          Additional options.

          • Optional l2GasLimit?: NumberLike

            Optional gas limit to use for the transaction on L2.

          • Optional overrides?: Overrides

            Optional transaction overrides.

        Returns Promise<TransactionRequest>

        Transaction that can be signed and executed to send the message.

  • withdrawERC20: ((l1Token, l2Token, amount, opts?) => Promise<TransactionRequest>)

    Generates a transaction for withdrawing some ERC20 tokens back to the L1 chain.

    Param: l1Token

    Address of the L1 token.

    Param: l2Token

    Address of the L2 token.

    Param: amount

    Amount to withdraw.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L1. Defaults to sender.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Transaction that can be signed and executed to withdraw the tokens.

      • (l1Token, l2Token, amount, opts?): Promise<TransactionRequest>
      • Generates a transaction for withdrawing some ERC20 tokens back to the L1 chain.

        Parameters

        • l1Token: AddressLike

          Address of the L1 token.

        • l2Token: AddressLike

          Address of the L2 token.

        • amount: NumberLike

          Amount to withdraw.

        • Optional opts: {
              overrides?: Overrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional overrides?: Overrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L1. Defaults to sender.

        Returns Promise<TransactionRequest>

        Transaction that can be signed and executed to withdraw the tokens.

  • withdrawETH: ((amount, opts?) => Promise<TransactionRequest>)

    Generates a transaction for withdrawing some ETH back to the L1 chain.

    Param: amount

    Amount of ETH to withdraw.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L1. Defaults to sender.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Transaction that can be signed and executed to withdraw the ETH.

      • (amount, opts?): Promise<TransactionRequest>
      • Generates a transaction for withdrawing some ETH back to the L1 chain.

        Parameters

        • amount: NumberLike

          Amount of ETH to withdraw.

        • Optional opts: {
              overrides?: Overrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional overrides?: Overrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L1. Defaults to sender.

        Returns Promise<TransactionRequest>

        Transaction that can be signed and executed to withdraw the ETH.

  • withdrawNativeToken: ((amount, opts?) => Promise<TransactionRequest>)

    Generates a transaction for withdrawing some L2 Native Token back to the L1 chain.

    Param: amount

    Amount of L2 Native Token to withdraw.

    Param: opts

    Additional options.

    Param: opts.recipient

    Optional address to receive the funds on L1. Defaults to sender.

    Param: opts.overrides

    Optional transaction overrides.

    Returns

    Transaction that can be signed and executed to withdraw the L2 Native Token.

      • (amount, opts?): Promise<TransactionRequest>
      • Generates a transaction for withdrawing some L2 Native Token back to the L1 chain.

        Parameters

        • amount: NumberLike

          Amount of L2 Native Token to withdraw.

        • Optional opts: {
              overrides?: Overrides;
              recipient?: AddressLike;
          }

          Additional options.

          • Optional overrides?: Overrides

            Optional transaction overrides.

          • Optional recipient?: AddressLike

            Optional address to receive the funds on L1. Defaults to sender.

        Returns Promise<TransactionRequest>

        Transaction that can be signed and executed to withdraw the L2 Native Token.

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

  • Queries the account's approval amount for a given L1 token.

    Parameters

    • l1Token: AddressLike

      The L1 token address.

    • l2Token: AddressLike

      The L2 token address.

    • Optional opts: {
          signer?: Signer;
      }

      Additional options.

      • Optional signer?: Signer

        Optional signer to get the approval for.

    Returns Promise<BigNumber>

    Amount of tokens approved for deposits from the account.

  • Approves a deposit into the L2 chain.

    Parameters

    • l1Token: AddressLike

      The L1 token address.

    • l2Token: AddressLike

      The L2 token address.

    • amount: NumberLike

      Amount of the token to approve.

    • Optional opts: {
          overrides?: Overrides;
          signer?: Signer;
      }

      Additional options.

      • Optional overrides?: Overrides

        Optional transaction overrides.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    Returns Promise<TransactionResponse>

    Transaction response for the approval transaction.

  • Approves a deposit L2 Native Token into the L2 chain.

    Parameters

    • amount: NumberLike

      Amount of the L2 Native Token to approve.

    • Optional opts: {
          overrides?: Overrides;
          signer?: Signer;
      }

      Additional options.

      • Optional overrides?: Overrides

        Optional transaction overrides.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    Returns Promise<TransactionResponse>

    Transaction response for the approval transaction.

  • Deposits some ERC20 tokens into the L2 chain.

    Parameters

    • l1Token: AddressLike

      Address of the L1 token.

    • l2Token: AddressLike

      Address of the L2 token.

    • amount: NumberLike

      Amount to deposit.

    • Optional opts: {
          l2GasLimit?: NumberLike;
          overrides?: CallOverrides;
          recipient?: AddressLike;
          signer?: Signer;
      }

      Additional options.

      • Optional l2GasLimit?: NumberLike

        Optional gas limit to use for the transaction on L2.

      • Optional overrides?: CallOverrides

        Optional transaction overrides.

      • Optional recipient?: AddressLike

        Optional address to receive the funds on L2. Defaults to sender.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    Returns Promise<TransactionResponse>

    Transaction response for the deposit transaction.

  • Deposits some ETH into the L2 chain.

    Parameters

    • amount: NumberLike

      Amount of ETH to deposit (in wei).

    • Optional opts: {
          l2GasLimit?: NumberLike;
          overrides?: Overrides;
          recipient?: AddressLike;
          signer?: Signer;
      }

      Additional options.

      • Optional l2GasLimit?: NumberLike

        Optional gas limit to use for the transaction on L2.

      • Optional overrides?: Overrides

        Optional transaction overrides.

      • Optional recipient?: AddressLike

        Optional address to receive the funds on L2. Defaults to sender.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    Returns Promise<TransactionResponse>

    Transaction response for the deposit transaction.

  • Deposits some L2 Native Token into the L2 chain.

    Parameters

    • amount: NumberLike

      Amount of L2 Native Token to deposit

    • Optional opts: {
          l2GasLimit?: NumberLike;
          overrides?: Overrides;
          recipient?: AddressLike;
          signer?: Signer;
      }

      Additional options.

      • Optional l2GasLimit?: NumberLike

        Optional gas limit to use for the transaction on L2.

      • Optional overrides?: Overrides

        Optional transaction overrides.

      • Optional recipient?: AddressLike

        Optional address to receive the funds on L2. Defaults to sender.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    Returns Promise<TransactionResponse>

    Transaction response for the deposit transaction.

  • Estimates the amount of gas required to fully execute a given message on L2. Only applies to L1 => L2 messages. You would supply this gas limit when sending the message to L2.

    Parameters

    • message: MessageRequestLike

      Message get a gas estimate for.

    • Optional opts: {
          bufferPercent?: number;
          from?: string;
      }

      Options object.

      • Optional bufferPercent?: number

        Percentage of gas to add to the estimate. Defaults to 20.

      • Optional from?: string

        Address to use as the sender.

    • messageIndex: number = 0

    Returns Promise<BigNumber>

    Estimates L2 gas limit.

  • Returns the estimated amount of time before the message can be executed. When this is a message being sent to L1, this will return the estimated time until the message will complete its challenge period. When this is a message being sent to L2, this will return the estimated amount of time until the message will be picked up and executed on L2.

    Parameters

    • message: MessageLike

      Message to estimate the time remaining for.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    • Optional fromBlockOrBlockHash: BlockTag
    • Optional toBlockOrBlockHash: BlockTag

    Returns Promise<number>

    Estimated amount of time remaining (in seconds) before the message can be executed.

  • Finalizes a cross chain message that was sent from L2 to L1. Only applicable for L2 to L1 messages. Will throw an error if the message has not completed its challenge period yet.

    Parameters

    • message: MessageLike

      Message to finalize.

    • Optional opts: {
          overrides?: PayableOverrides;
          signer?: Signer;
      }

      Additional options.

      • Optional overrides?: PayableOverrides

        Optional transaction overrides.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    Returns Promise<TransactionResponse>

    Transaction response for the finalization transaction.

  • 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

    • message: MessageLike

      Message to generate a proof for.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    Returns Promise<BedrockCrossChainMessageProof>

    Proof that can be used to finalize the message.

  • Finds the appropriate bridge adapter for a given L1<>L2 token pair. Will throw if no bridges support the token pair or if more than one bridge supports the token pair.

    Parameters

    Returns Promise<IBridgeAdapter>

    The appropriate bridge adapter for the given token pair.

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

    Returns Promise<number>

    Current challenge period in seconds.

  • Gets all deposits for a given address.

    Parameters

    • address: AddressLike

      Address to search for messages from.

    • opts: {
          fromBlock?: BlockTag;
          toBlock?: BlockTag;
      } = {}

      Options object.

      • Optional fromBlock?: BlockTag

        Block to start searching for messages from. If not provided, will start from the first block (block #0).

      • Optional toBlock?: BlockTag

        Block to stop searching for messages at. If not provided, will stop at the latest known block ("latest").

    Returns Promise<TokenBridgeMessage[]>

    All deposit token bridge messages sent by the given address.

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

    Parameters

    • message: MessageLike

      Message to get the Bedrock output root for.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    Returns Promise<BedrockOutputData>

    Bedrock output root.

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

    Parameters

    • message: MessageLike

      Message to generate a proof for.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    Returns Promise<CrossChainMessageProof>

    Proof that can be used to finalize the message.

  • Finds the receipt of the transaction that executed a particular cross chain message.

    Parameters

    • message: MessageLike

      Message to find the receipt of.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    • Optional fromBlockOrBlockHash: BlockTag

      The start block to use for the query filter on the RECEIVING chain

    • Optional toBlockOrHash: BlockTag

    Returns Promise<MessageReceipt>

    CrossChainMessage receipt including receipt of the transaction that relayed the given message.

  • 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

    • message: MessageLike

      Message to find a state root for.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    Returns Promise<StateRoot>

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

  • Retrieves the status of a particular message as an enum.

    Parameters

    • message: MessageLike

      Cross chain message to check the status of.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    • Optional fromBlockOrBlockHash: BlockTag

      The start block to use for the query filter on the RECEIVING chain

    • Optional toBlockOrBlockHash: BlockTag

      The end block to use for the query filter on the RECEIVING chain

    Returns Promise<MessageStatus>

    Status of the message.

  • Retrieves all cross chain messages sent within a given transaction.

    Parameters

    • transaction: TransactionLike

      Transaction hash or receipt to find messages from.

    • opts: {
          direction?: MessageDirection;
      } = {}

      Options object.

      • Optional direction?: MessageDirection

        Direction to search for messages in. If not provided, will attempt to automatically search both directions under the assumption that a transaction hash will only exist on one chain. If the hash exists on both chains, will throw an error.

    Returns Promise<CrossChainMessage[]>

    All cross chain messages sent within the transaction.

  • 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.

  • Gets all withdrawals for a given address.

    Parameters

    • address: AddressLike

      Address to search for messages from.

    • opts: {
          fromBlock?: BlockTag;
          toBlock?: BlockTag;
      } = {}

      Options object.

      • Optional fromBlock?: BlockTag

        Block to start searching for messages from. If not provided, will start from the first block (block #0).

      • Optional toBlock?: BlockTag

        Block to stop searching for messages at. If not provided, will stop at the latest known block ("latest").

    Returns Promise<TokenBridgeMessage[]>

    All withdrawal token bridge messages sent by the given address.

  • Checks whether a given root claim is valid. Uses the L2 node that the SDK is connected to when verifying the claim. Assumes that the connected L2 node is honest.

    Parameters

    • outputRoot: string

      Output root to verify.

    • l2BlockNumber: number

      L2 block number the root is for.

    Returns Promise<boolean>

    Whether or not the root is valid.

  • Proves a cross chain message that was sent from L2 to L1. Only applicable for L2 to L1 messages.

    Parameters

    • message: MessageLike

      Message to finalize.

    • Optional opts: {
          overrides?: Overrides;
          signer?: Signer;
      }

      Additional options.

      • Optional overrides?: Overrides

        Optional transaction overrides.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    • messageIndex: number = 0

      The index of the withdrawal if multiple are made with multicall

    Returns Promise<TransactionResponse>

    Transaction response for the finalization transaction.

  • Resends a given cross chain message with a different gas limit. Only applies to L1 to L2 messages. If provided an L2 to L1 message, this function will throw an error.

    Parameters

    • message: MessageLike

      Cross chain message to resend.

    • messageGasLimit: NumberLike

      New gas limit to use for the message.

    • Optional opts: {
          overrides?: Overrides;
          signer?: Signer;
      }

      Additional options.

      • Optional overrides?: Overrides

        Optional transaction overrides.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    Returns Promise<TransactionResponse>

    Transaction response for the message resending transaction.

  • Sends a given cross chain message. Where the message is sent depends on the direction attached to the message itself.

    Parameters

    • message: CrossChainMessageRequest

      Cross chain message to send.

    • Optional opts: {
          l2GasLimit?: NumberLike;
          overrides?: Overrides;
          signer?: Signer;
      }

      Additional options.

      • Optional l2GasLimit?: NumberLike

        Optional gas limit to use for the transaction on L2.

      • Optional overrides?: Overrides

        Optional transaction overrides.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    Returns Promise<TransactionResponse>

    Transaction response for the message sending transaction.

  • Transforms a legacy message into its corresponding Bedrock representation.

    Parameters

    • message: MessageLike

      Legacy message to transform.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    Returns Promise<CrossChainMessage>

    Bedrock representation of the message.

  • Resolves a MessageLike into a CrossChainMessage object. Unlike other coercion functions, this function is stateful and requires making additional requests. For now I'm going to keep this function here, but we could consider putting a similar function inside of utils/coercion.ts if people want to use this without having to create an entire CrossChainProvider object.

    Parameters

    • message: MessageLike

      MessageLike to resolve into a CrossChainMessage.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    Returns Promise<CrossChainMessage>

    Message coerced into a CrossChainMessage.

  • Transforms a CrossChainMessenger message into its low-level representation inside the L2ToL1MessagePasser contract on L2.

    Parameters

    • message: MessageLike

      Message to transform.

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    Returns Promise<CoreCrossChainMessage>

    Transformed message.

  • Waits for a message to be executed and returns the receipt of the transaction that executed the given message.

    Parameters

    • message: MessageLike

      Message to wait for.

    • opts: {
          confirmations?: number;
          fromBlockOrBlockHash?: BlockTag;
          pollIntervalMs?: number;
          timeoutMs?: number;
          toBlockOrHash?: BlockTag;
      } = {}

      Options to pass to the waiting function.

      • Optional confirmations?: number

        Number of transaction confirmations to wait for before returning.

      • Optional fromBlockOrBlockHash?: BlockTag

        The start block to use for the query filter on the RECEIVING chain

      • Optional pollIntervalMs?: number

        Number of milliseconds to wait between polling for the receipt.

      • Optional timeoutMs?: number

        Milliseconds to wait before timing out.

      • Optional toBlockOrHash?: BlockTag
    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    Returns Promise<MessageReceipt>

    CrossChainMessage receipt including receipt of the transaction that relayed the given message.

  • Waits until the status of a given message changes to the expected status. Note that if the status of the given message changes to a status that implies the expected status, this will still return. If the status of the message changes to a status that exclues the expected status, this will throw an error.

    Parameters

    • message: MessageLike

      Message to wait for.

    • status: MessageStatus

      Expected status of the message.

    • opts: {
          fromBlockOrBlockHash?: BlockTag;
          pollIntervalMs?: number;
          timeoutMs?: number;
          toBlockOrBlockHash?: BlockTag;
      } = {}

      Options to pass to the waiting function.

      • Optional fromBlockOrBlockHash?: BlockTag

        The start block to use for the query filter on the RECEIVING chain

      • Optional pollIntervalMs?: number

        Number of milliseconds to wait when polling.

      • Optional timeoutMs?: number

        Milliseconds to wait before timing out.

      • Optional toBlockOrBlockHash?: BlockTag

        The end block to use for the query filter on the RECEIVING chain

    • messageIndex: number = 0

      The index of the message, if multiple exist from multicall

    Returns Promise<void>

  • Withdraws some ERC20 tokens back to the L1 chain.

    Parameters

    • l1Token: AddressLike

      Address of the L1 token.

    • l2Token: AddressLike

      Address of the L2 token.

    • amount: NumberLike

      Amount to withdraw.

    • Optional opts: {
          overrides?: Overrides;
          recipient?: AddressLike;
          signer?: Signer;
      }

      Additional options.

      • Optional overrides?: Overrides

        Optional transaction overrides.

      • Optional recipient?: AddressLike

        Optional address to receive the funds on L1. Defaults to sender.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    Returns Promise<TransactionResponse>

    Transaction response for the withdraw transaction.

  • Withdraws some ETH back to the L1 chain.

    Parameters

    • amount: NumberLike

      Amount of ETH to withdraw.

    • Optional opts: {
          overrides?: Overrides;
          recipient?: AddressLike;
          signer?: Signer;
      }

      Additional options.

      • Optional overrides?: Overrides

        Optional transaction overrides.

      • Optional recipient?: AddressLike

        Optional address to receive the funds on L1. Defaults to sender.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    Returns Promise<TransactionResponse>

    Transaction response for the withdraw transaction.

  • Withdraws some L2 Native Token back to the L1 chain.

    Parameters

    • amount: NumberLike

      Amount of L2 Native Token to withdraw.

    • Optional opts: {
          overrides?: Overrides;
          recipient?: AddressLike;
          signer?: Signer;
      }

      Additional options.

      • Optional overrides?: Overrides

        Optional transaction overrides.

      • Optional recipient?: AddressLike

        Optional address to receive the funds on L1. Defaults to sender.

      • Optional signer?: Signer

        Optional signer to use to send the transaction.

    Returns Promise<TransactionResponse>

    Transaction response for the withdrawal transaction.

Generated using TypeDoc