Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IBridgeAdapter

Represents an adapter for an L1<>L2 token bridge. Each custom bridge currently needs its own adapter because the bridge interface is not standardized. This may change in the future.

Hierarchy

  • IBridgeAdapter

Implemented by

Index

Properties

estimateGas: { approve: any; deposit: any; withdraw: any }

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

Type declaration

  • approve:function
    • 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>

      Gas estimate for the transaction.

  • deposit:function
    • Estimates gas required to deposit some tokens into the L2 chain.

      Parameters

      • l1Token: AddressLike

        The L1 token address.

      • l2Token: AddressLike

        The L2 token address.

      • amount: NumberLike

        Amount of the 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.

  • withdraw:function
    • Estimates gas required to withdraw some tokens back to the L1 chain.

      Parameters

      • l1Token: AddressLike

        The L1 token address.

      • l2Token: AddressLike

        The L2 token address.

      • amount: NumberLike

        Amount of the 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.

l1Bridge: Contract

L1 bridge contract.

l2Bridge: Contract

L2 bridge contract.

Provider used to make queries related to cross-chain interactions.

populateTransaction: { approve: any; deposit: any; withdraw: any }

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

Type declaration

  • approve:function
    • 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 that can be signed and executed to deposit the tokens.

  • deposit:function
    • Generates a transaction for depositing some tokens into the L2 chain.

      Parameters

      • l1Token: AddressLike

        The L1 token address.

      • l2Token: AddressLike

        The L2 token address.

      • amount: NumberLike

        Amount of the token to deposit.

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

        Additional options.

        • Optional l2GasLimit?: NumberLike

          Optional gas limit to use for the transaction on L2.

        • Optional overrides?: PayableOverrides

          Optional transaction overrides.

        • Optional recipient?: AddressLike

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

      Returns Promise<TransactionRequest>

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

  • withdraw:function
    • Generates a transaction for withdrawing some tokens back to the L1 chain.

      Parameters

      • l1Token: AddressLike

        The L1 token address.

      • l2Token: AddressLike

        The L2 token address.

      • amount: NumberLike

        Amount of the 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 tokens.

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.

    • signer: Signer

      Signer to query 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.

    • signer: Signer

      Signer used to sign and send the transaction.

    • Optional opts: { overrides?: Overrides }

      Additional options.

      • Optional overrides?: Overrides

        Optional transaction overrides.

    Returns Promise<TransactionResponse>

    Transaction response for the approval transaction.

  • Deposits some tokens into the L2 chain.

    Parameters

    • l1Token: AddressLike

      The L1 token address.

    • l2Token: AddressLike

      The L2 token address.

    • amount: NumberLike

      Amount of the token to deposit.

    • signer: Signer

      Signer used to sign and send the transaction.

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

      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.

    Returns Promise<TransactionResponse>

    Transaction response for the deposit transaction.

  • Gets all deposits for a given address.

    Parameters

    • address: AddressLike

      Address to search for messages from.

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

  • Gets all withdrawals for a given address.

    Parameters

    • address: AddressLike

      Address to search for messages from.

    • Optional 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 the given token pair is supported by the bridge.

    Parameters

    Returns Promise<boolean>

    Whether the given token pair is supported by the bridge.

  • Withdraws some tokens back to the L1 chain.

    Parameters

    • l1Token: AddressLike

      The L1 token address.

    • l2Token: AddressLike

      The L2 token address.

    • amount: NumberLike

      Amount of the token to withdraw.

    • signer: Signer

      Signer used to sign and send the transaction.

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

    Transaction response for the withdraw transaction.

Generated using TypeDoc