Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Bridge

Main class for accessing token bridge methods; inherits methods from L1Bridge and L2Bridge

Hierarchy

  • Bridge

Index

Constructors

Private constructor

Methods

approveToken

  • approveToken(erc20L1Address: string, amount?: BigNumber, overrides?: PayableOverrides): Promise<ContractTransaction>
  • Set allowance for L1 router contract

    Parameters

    • erc20L1Address: string
    • Optional amount: BigNumber
    • Optional overrides: PayableOverrides

    Returns Promise<ContractTransaction>

calculateL2RetryableTransactionHash

  • calculateL2RetryableTransactionHash(inboxSequenceNumber: BigNumber, l2ChainId?: BigNumber): Promise<string>
  • Hash of L2 side of retryable txn; txn gets generated automatically and is formatted as tho user submitted

    Parameters

    • inboxSequenceNumber: BigNumber
    • Optional l2ChainId: BigNumber

    Returns Promise<string>

calculateL2TransactionHash

  • calculateL2TransactionHash(inboxSequenceNumber: BigNumber, l2ChainId?: BigNumber): Promise<string>
  • get hash of regular L2 txn from corresponding inbox sequence number

    Parameters

    • inboxSequenceNumber: BigNumber
    • Optional l2ChainId: BigNumber

    Returns Promise<string>

calculateRetryableAutoRedeemTxnHash

  • calculateRetryableAutoRedeemTxnHash(inboxSequenceNumber: BigNumber, l2ChainId?: BigNumber): Promise<string>
  • Hash of L2 ArbOs generated "auto-redeem" transaction; if it succeeded, a transaction queryable by calculateL2RetryableTransactionHash will then be created

    Parameters

    • inboxSequenceNumber: BigNumber
    • Optional l2ChainId: BigNumber

    Returns Promise<string>

deposit

  • deposit(erc20L1Address: string, amount: BigNumber, retryableGasArgs?: RetryableGasArgs, destinationAddress?: string, overrides?: PayableOverrides): Promise<ContractTransaction>
  • Token deposit; if no value given, calculates and includes minimum necessary value to fund L2 side of execution

    Parameters

    • erc20L1Address: string
    • amount: BigNumber
    • retryableGasArgs: RetryableGasArgs = {}
    • Optional destinationAddress: string
    • Optional overrides: PayableOverrides

    Returns Promise<ContractTransaction>

depositETH

  • depositETH(value: BigNumber, _maxSubmissionPriceIncreaseRatio?: BigNumber, overrides?: PayableOverrides): Promise<ContractTransaction>
  • Deposit ether from L1 to L2.

    Parameters

    • value: BigNumber
    • Optional _maxSubmissionPriceIncreaseRatio: BigNumber
    • Optional overrides: PayableOverrides

    Returns Promise<ContractTransaction>

getGatewayWithdrawEventData

  • getGatewayWithdrawEventData(gatewayAddress: string, destinationAddress?: string): Promise<OutboundTransferInitiatedResult[]>
  • All withdrawals from given gateway

    Parameters

    • gatewayAddress: string
    • Optional destinationAddress: string

    Returns Promise<OutboundTransferInitiatedResult[]>

getL2TxHashByRetryableTicket

  • getL2TxHashByRetryableTicket(l1Transaction: string | ContractReceipt): Promise<string>
  • Convenience method to directly retrieve retryable hash from an l1 transaction

    Parameters

    • l1Transaction: string | ContractReceipt

    Returns Promise<string>

getOutGoingMessageState

  • getOutGoingMessageState(batchNumber: BigNumber, indexInBatch: BigNumber): Promise<OutgoingMessageState>
  • Returns {@link OutgoingMessageState} for given outgoing message

    Parameters

    • batchNumber: BigNumber
    • indexInBatch: BigNumber

    Returns Promise<OutgoingMessageState>

getTokenWithdrawEventData

  • getTokenWithdrawEventData(l1TokenAddress: string, destinationAddress?: string): Promise<OutboundTransferInitiatedResult[]>
  • All withdrawals from given token

    Parameters

    • l1TokenAddress: string
    • Optional destinationAddress: string

    Returns Promise<OutboundTransferInitiatedResult[]>

triggerL2ToL1Transaction

  • triggerL2ToL1Transaction(batchNumber: BigNumber, indexInBatch: BigNumber, singleAttempt?: boolean): Promise<ContractReceipt>
  • Attempt to execute an outbox message; must be confirmed to succeed (i.e., confirmation delay must have passed)

    Parameters

    • batchNumber: BigNumber
    • indexInBatch: BigNumber
    • singleAttempt: boolean = false

    Returns Promise<ContractReceipt>

updateAllTokens

  • updateAllTokens(): Promise<{}>
  • Update state of all tracked tokens (balance, allowance), etc. and returns state

    Returns Promise<{}>

updateTokenData

  • updateTokenData(erc20l1Address: string): Promise<{}>
  • Update target token (balance, allowance), etc. and state

    Parameters

    • erc20l1Address: string

    Returns Promise<{}>

waitForRetryableReceipt

  • waitForRetryableReceipt(seqNum: BigNumber): Promise<TransactionReceipt>
  • Return receipt of retryable transaction after execution

    Parameters

    • seqNum: BigNumber

    Returns Promise<TransactionReceipt>

Generated using TypeDoc