Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • CrossChainMessenger

Implements

Index

Constructors

Properties

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: { approveERC1155: (l1Token: AddressLike, l2Token: AddressLike, opts?: { overrides?: CallOverrides }) => Promise<BigNumber>; approveERC20: (l1Token: AddressLike, l2Token: AddressLike, amount: NumberLike, opts?: { overrides?: CallOverrides }) => Promise<BigNumber>; approveERC721: (l1Token: AddressLike, l2Token: AddressLike, tokenId: NumberLike, opts?: { overrides?: CallOverrides }) => Promise<BigNumber>; depositERC1155: (l1Token: AddressLike, l2Token: AddressLike, tokenId: NumberLike, amount: NumberLike, opts?: { data?: String; l2GasLimit?: NumberLike; overrides?: CallOverrides; recipient?: AddressLike }) => Promise<BigNumber>; depositERC20: (l1Token: AddressLike, l2Token: AddressLike, amount: NumberLike, opts?: { l2GasLimit?: NumberLike; overrides?: CallOverrides; recipient?: AddressLike }) => Promise<BigNumber>; depositERC721: (l1Token: AddressLike, l2Token: AddressLike, tokenId: NumberLike, opts?: { extra_data?: String; l2GasLimit?: NumberLike; overrides?: CallOverrides; recipient?: AddressLike }) => Promise<BigNumber>; depositETH: (amount: NumberLike, opts?: { l2GasLimit?: NumberLike; overrides?: CallOverrides; recipient?: AddressLike }) => Promise<BigNumber>; finalizeMessage: (message: MessageLike, opts?: { overrides?: CallOverrides }) => Promise<BigNumber>; resendMessage: (message: MessageLike, messageGasLimit: NumberLike, opts?: { overrides?: CallOverrides }) => Promise<BigNumber>; sendMessage: (message: CrossChainMessageRequest, opts?: { l2GasLimit?: NumberLike; overrides?: CallOverrides }) => Promise<BigNumber>; withdrawERC1155: (l1Token: AddressLike, l2Token: AddressLike, tokenId: NumberLike, amount: NumberLike, opts?: { data?: String; overrides?: CallOverrides; recipient?: AddressLike }) => Promise<BigNumber>; withdrawERC20: (l1Token: AddressLike, l2Token: AddressLike, amount: NumberLike, opts?: { overrides?: CallOverrides; recipient?: AddressLike }) => Promise<BigNumber>; withdrawERC721: (l1Token: AddressLike, l2Token: AddressLike, tokenId: NumberLike, opts?: { extra_data?: String; overrides?: CallOverrides; recipient?: AddressLike }) => Promise<BigNumber>; withdrawETH: (amount: NumberLike, opts?: { overrides?: CallOverrides; recipient?: AddressLike }) => 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

getLogsProvider: Provider

Dedicated provider for eth_getLogs

l1BlockTimeSeconds: number

Estimated average L1 block time in seconds.

l1ChainId: number

Chain ID for the L1 network.

l1SignerOrProvider: Signer | Provider

Provider connected to the L1 chain.

l2ChainId: number

Chain ID for the L2 network.

l2SignerOrProvider: Signer | Provider

Provider connected to the L2 chain.

populateTransaction: { approveERC1155: (l1Token: AddressLike, l2Token: AddressLike, opts?: { overrides?: Overrides }) => Promise<TransactionRequest>; approveERC20: (l1Token: AddressLike, l2Token: AddressLike, amount: NumberLike, opts?: { overrides?: Overrides }) => Promise<TransactionRequest>; approveERC721: (l1Token: AddressLike, l2Token: AddressLike, tokenId: NumberLike, opts?: { overrides?: Overrides }) => Promise<TransactionRequest>; depositERC1155: (l1Token: AddressLike, l2Token: AddressLike, tokenId: NumberLike, amount: NumberLike, opts?: { data?: String; l2GasLimit?: NumberLike; ovedrrides?: Overrides; recipient?: AddressLike }) => Promise<TransactionRequest>; depositERC20: (l1Token: AddressLike, l2Token: AddressLike, amount: NumberLike, opts?: { l2GasLimit?: NumberLike; overrides?: Overrides; recipient?: AddressLike }) => Promise<TransactionRequest>; depositERC721: (l1Token: AddressLike, l2Token: AddressLike, tokenId: NumberLike, opts?: { extra_data?: String; l2GasLimit?: NumberLike; overrides?: Overrides; recipient?: AddressLike }) => Promise<TransactionRequest>; depositETH: (amount: NumberLike, opts?: { l2GasLimit?: NumberLike; overrides?: Overrides; recipient?: AddressLike }) => Promise<TransactionRequest>; finalizeMessage: (message: MessageLike, opts?: { overrides?: Overrides }) => Promise<TransactionRequest>; resendMessage: (message: MessageLike, messageGasLimit: NumberLike, opts?: { overrides?: Overrides }) => Promise<TransactionRequest>; sendMessage: (message: CrossChainMessageRequest, opts?: { l2GasLimit?: NumberLike; overrides?: Overrides }) => Promise<TransactionRequest>; withdrawERC1155: (l1Token: AddressLike, l2Token: AddressLike, tokenId: NumberLike, amount: NumberLike, opts?: { overrides?: Overrides; recipient?: AddressLike }) => Promise<TransactionRequest>; withdrawERC20: (l1Token: AddressLike, l2Token: AddressLike, amount: NumberLike, opts?: { overrides?: Overrides; recipient?: AddressLike }) => Promise<TransactionRequest>; withdrawERC721: (l1Token: AddressLike, l2Token: AddressLike, tokenId: NumberLike, opts?: { extra_data?: String; overrides?: Overrides; recipient?: AddressLike }) => Promise<TransactionRequest>; withdrawETH: (amount: NumberLike, opts?: { overrides?: Overrides; recipient?: AddressLike }) => 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

Accessors

  • get l1Provider(): Provider
  • get l1Signer(): Signer
  • get l2Provider(): Provider
  • get l2Signer(): Signer

Methods

  • approveERC1155(l1Token: AddressLike, l2Token: AddressLike, opts?: { overrides?: Overrides; signer?: Signer }): Promise<TransactionResponse>
  • depositETH(amount: NumberLike, opts?: { l2GasLimit?: NumberLike; overrides?: Overrides; recipient?: AddressLike; signer?: Signer }): Promise<TransactionResponse>
  • estimateL2MessageGasLimit(message: MessageRequestLike, opts?: { bufferPercent?: number; from?: string }): Promise<BigNumber>
  • estimateMessageWaitTimeSeconds(message: MessageLike): Promise<number>
  • 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

    Returns Promise<number>

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

  • finalizeMessage(message: MessageLike, opts?: { overrides?: Overrides; signer?: Signer }): Promise<TransactionResponse>
  • 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
    • Optional opts: { overrides?: Overrides; signer?: Signer }
      • Optional overrides?: Overrides
      • Optional signer?: Signer

    Returns Promise<TransactionResponse>

    Transaction response for the finalization transaction.

  • getChallengePeriodSeconds(): Promise<number>
  • getDepositsByAddress(address: AddressLike, opts?: { fromBlock?: BlockTag; toBlock?: BlockTag }): Promise<BridgeMessage[]>
  • getStateBatchAppendedEventByBatchIndex(batchIndex: number): Promise<Event>
  • getStateBatchAppendedEventByTransactionIndex(transactionIndex: number): Promise<Event>
  • getStateRootBatchByTransactionIndex(transactionIndex: number): Promise<StateRootBatch>
  • getWithdrawalsByAddress(address: AddressLike, opts?: { fromBlock?: BlockTag; toBlock?: BlockTag }): Promise<BridgeMessage[]>
  • resendMessage(message: MessageLike, messageGasLimit: NumberLike, opts?: { overrides?: Overrides; signer?: Signer }): Promise<TransactionResponse>
  • 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
    • messageGasLimit: NumberLike
    • Optional opts: { overrides?: Overrides; signer?: Signer }
      • Optional overrides?: Overrides
      • Optional signer?: Signer

    Returns Promise<TransactionResponse>

    Transaction response for the message resending transaction.

  • 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

    Returns Promise<CrossChainMessage>

    Message coerced into a CrossChainMessage.

  • waitForMessageReceipt(message: MessageLike, opts?: { confirmations?: number; pollIntervalMs?: number; timeoutMs?: number }): Promise<MessageReceipt>
  • Waits for a message to be executed and returns the receipt of the transaction that executed the given message.

    Parameters

    • message: MessageLike
    • opts: { confirmations?: number; pollIntervalMs?: number; timeoutMs?: number } = {}
      • Optional confirmations?: number
      • Optional pollIntervalMs?: number
      • Optional timeoutMs?: number

    Returns Promise<MessageReceipt>

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

  • waitForMessageStatus(message: MessageLike, status: MessageStatus, opts?: { pollIntervalMs?: number; timeoutMs?: number }): Promise<void>
  • 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
    • status: MessageStatus
    • opts: { pollIntervalMs?: number; timeoutMs?: number } = {}
      • Optional pollIntervalMs?: number
      • Optional timeoutMs?: number

    Returns Promise<void>

  • withdrawETH(amount: NumberLike, opts?: { overrides?: Overrides; recipient?: AddressLike; signer?: Signer }): Promise<TransactionResponse>

Generated using TypeDoc