List of custom bridges for the given network.
Contract objects attached to their respective providers and addresses.
Number of blocks before a deposit is considered confirmed.
Object that holds the functions that estimates the gas required for a given transaction. Follows the pattern used by ethers.js.
Estimates gas required to approve some tokens to deposit into the L2 chain.
The L1 token address.
The L2 token address.
Amount of the token to approve.
Additional options.
Optional transaction overrides.
Transaction response for the approval transaction.
Estimates gas required to approve some tokens to deposit into the L2 chain.
The L1 token address.
The L2 token address.
Token ID.
Additional options.
Optional transaction overrides.
Transaction response for the approval transaction.
Estimates gas required to deposit some ERC20 tokens into the L2 chain.
Address of the L1 token.
Address of the L2 token.
Amount to deposit.
Additional options.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Gas estimate for the transaction.
Estimates gas required to deposit some ERC721 tokens into the L2 chain.
Address of the L1 token.
Address of the L2 token.
Token ID.
Additional options.
Extra data to forward—will not be used to execute any code.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Transaction response for the deposit transaction.
Estimates gas required to deposit some ETH into the L2 chain.
Amount of ETH to deposit.
Additional options.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Gas estimate for the transaction.
Estimates gas required to finalize a cross chain message. Only applies to L2 to L1 messages.
Message to generate the finalization transaction for.
Additional options.
Optional transaction overrides.
Gas estimate for the transaction.
Estimates gas required to resend a cross chain message. Only applies to L1 to L2 messages.
Cross chain message to resend.
New gas limit to use for the message.
Additional options.
Optional transaction overrides.
Gas estimate for the transaction.
Estimates gas required to send a cross chain message.
Cross chain message to send.
Additional options.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Gas estimate for the transaction.
Estimates gas required to withdraw some ERC20 tokens back to the L1 chain.
Address of the L1 token.
Address of the L2 token.
Amount to withdraw.
Additional options.
Optional transaction overrides.
Optional address to receive the funds on L1. Defaults to sender.
Gas estimate for the transaction.
Estimates gas required to withdraw some ERC721 tokens back to the L1 chain.
Address of the L1 token.
Address of the L2 token.
Token ID.
Additional options.
Extra data to forward—will not be used to execute any code.
Optional transaction overrides.
Optional address to receive the funds on L1. Defaults to sender.
Gas estimate for the transaction.
Estimates gas required to withdraw some ETH back to the L1 chain.
Amount of ETH to withdraw.
Additional options.
Optional transaction overrides.
Optional address to receive the funds on L1. Defaults to sender.
Gas estimate for the transaction.
Dedicated provider for eth_getLogs
Estimated average L1 block time in seconds.
Chain ID for the L1 network.
Provider connected to the L1 chain.
Signer connected to the L1 chain.
Provider connected to the L1 chain.
Chain ID for the L2 network.
Provider connected to the L2 chain.
Signer connected to the L2 chain.
Provider connected to the L2 chain.
Object that holds the functions that generate transactions to be signed by the user. Follows the pattern used by ethers.js.
Generates a transaction for approving some tokens to deposit into the L2 chain.
The L1 token address.
The L2 token address.
Amount of the token to approve—should always be 1.
Additional options.
Optional transaction overrides.
Transaction response for the approval transaction.
Generates a transaction for approving some tokens to deposit into the L2 chain.
The L1 token address.
The L2 token address.
Token ID.
Additional options.
Optional transaction overrides.
Transaction response for the approval transaction.
Generates a transaction for depositing some ERC20 tokens into the L2 chain.
Address of the L1 token.
Address of the L2 token.
Amount to deposit.
Additional options.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Transaction that can be signed and executed to deposit the tokens.
Generates a transaction for depositing some ERC721 tokens into the L2 chain.
Address of the L1 token.
Address of the L2 token.
Token ID.
Additional options.
Extra data to forward—will not be used to execute any code.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Transaction response for the deposit transaction.
Generates a transaction for depositing some ETH into the L2 chain.
Amount of ETH to deposit.
Additional options.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Transaction that can be signed and executed to deposit the ETH.
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.
Message to generate the finalization transaction for.
Additional options.
Optional transaction overrides.
Transaction that can be signed and executed to finalize the message.
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.
Cross chain message to resend.
New gas limit to use for the message.
Additional options.
Optional transaction overrides.
Transaction that can be signed and executed to resend the message.
Generates a transaction that sends a given cross chain message. This transaction can be signed and executed by a signer.
Cross chain message to send.
Additional options.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Transaction that can be signed and executed to send the message.
Generates a transaction for withdrawing some ERC20 tokens back to the L1 chain.
Address of the L1 token.
Address of the L2 token.
Amount to withdraw.
Additional options.
Optional transaction overrides.
Optional address to receive the funds on L1. Defaults to sender.
Transaction that can be signed and executed to withdraw the tokens.
Generates a transaction for withdrawing some ERC721 tokens back to the L1 chain.
Address of the L1 token.
Address of the L2 token.
Token ID.
Additional options.
Extra data to forward—will not be used to execute any code.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Transaction response for the deposit transaction.
Generates a transaction for withdrawing some ETH back to the L1 chain.
Amount of ETH to withdraw.
Additional options.
Optional transaction overrides.
Optional address to receive the funds on L1. Defaults to sender.
Transaction that can be signed and executed to withdraw the ETH.
Queries the account's approval amount for a given L1 token.
The L1 token address.
The L2 token address.
Additional options.
Optional signer to get the approval for.
Amount of tokens approved for deposits from the account.
Approves a deposit into the L2 chain.
The L1 token address.
The L2 token address.
Amount of the token to approve.
Additional options.
Optional transaction overrides.
Optional signer to use to send the transaction.
Transaction response for the approval transaction.
Approves a deposit into the L2 chain.
The L1 token address.
The L2 token address.
Token ID.
Additional options.
Optional transaction overrides.
Optional signer to use to send the transaction.
Transaction response for the approval transaction.
Deposits some ERC20 tokens into the L2 chain.
Address of the L1 token.
Address of the L2 token.
Amount to deposit.
Additional options.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Optional signer to use to send the transaction.
Transaction response for the deposit transaction.
Deposits some ERC721 tokens into the L2 chain.
Address of the L1 token.
Address of the L2 token.
Token ID.
Additional options.
Extra data to forward—will not be used to execute any code.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Optional signer to use to send the transaction.
Transaction response for the deposit transaction.
Deposits some ETH into the L2 chain.
Amount of ETH to deposit (in wei).
Additional options.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Optional signer to use to send the transaction.
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.
Message get a gas estimate for.
Options object.
Percentage of gas to add to the estimate. Defaults to 20.
Address to use as the sender.
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.
Message to estimate the time remaining for.
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.
Message to finalize.
Additional options.
Optional transaction overrides.
Optional signer to use to send the transaction.
Transaction response for the finalization transaction.
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.
L1 token address.
L2 token address.
The appropriate bridge adapter for the given token pair.
Queries the current challenge period in seconds from the StateCommitmentChain.
Current challenge period in seconds.
Gets all deposits for a given address.
Address to search for messages from.
Options object.
Block to start searching for messages from. If not provided, will start from the first block (block #0).
Block to stop searching for messages at. If not provided, will stop at the latest known block ("latest").
All deposit token bridge messages sent by the given address.
Generates the proof required to finalize an L2 to L1 message.
Message to generate a proof for.
Proof that can be used to finalize the message.
Finds the receipt of the transaction that executed a particular cross chain message.
Message to find the receipt of.
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.
Message to find a state root for.
State root for the block in which the message was created.
Retrieves the status of a particular message as an enum.
Cross chain message to check the status of.
Status of the message.
Retrieves all cross chain messages sent within a given transaction.
Transaction hash or receipt to find messages from.
Options object.
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.
All cross chain messages sent within the transaction.
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).
Index of the batch to find an event for.
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.
Index of the L2 transaction to find an event for.
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.
Index of the L2 transaction to find a state root batch for.
State root batch for the given transaction index, or null if none exists yet.
Gets all withdrawals for a given address.
Address to search for messages from.
Options object.
Block to start searching for messages from. If not provided, will start from the first block (block #0).
Block to stop searching for messages at. If not provided, will stop at the latest known block ("latest").
All withdrawal token bridge messages sent by the given address.
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.
Cross chain message to resend.
New gas limit to use for the message.
Additional options.
Optional transaction overrides.
Optional signer to use to send the transaction.
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.
Cross chain message to send.
Additional options.
Optional gas limit to use for the transaction on L2.
Optional transaction overrides.
Optional signer to use to send the transaction.
Transaction response for the message sending 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.
MessageLike to resolve into a CrossChainMessage.
Message coerced into a CrossChainMessage.
Waits for a message to be executed and returns the receipt of the transaction that executed the given message.
Message to wait for.
Options to pass to the waiting function.
Number of transaction confirmations to wait for before returning.
Number of milliseconds to wait between polling for the receipt.
Milliseconds to wait before timing out.
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.
Message to wait for.
Expected status of the message.
Options to pass to the waiting function.
Number of milliseconds to wait when polling.
Milliseconds to wait before timing out.
Withdraws some ERC20 tokens back to the L1 chain.
Address of the L1 token.
Address of the L2 token.
Amount to withdraw.
Additional options.
Optional transaction overrides.
Optional address to receive the funds on L1. Defaults to sender.
Optional signer to use to send the transaction.
Transaction response for the withdraw transaction.
Withdraws some ERC721 tokens back to the L1 chain.
Address of the L1 token.
Address of the L2 token.
Token ID.
Additional options.
Extra data to forward—will not be used to execute any code.
Optional transaction overrides.
Optional address to receive the funds on L2. Defaults to sender.
Optional signer to use to send the transaction.
Transaction response for the deposit transaction.
Withdraws some ETH back to the L1 chain.
Amount of ETH to withdraw.
Additional options.
Optional transaction overrides.
Optional address to receive the funds on L1. Defaults to sender.
Optional signer to use to send the transaction.
Transaction response for the withdraw transaction.
Generated using TypeDoc
Handles L1/L2 interactions.