@morph-l2/sdk • Docs
@morph-l2/sdk / IBridgeAdapter
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.
Properties
estimateGas
estimateGas:
object
Object that holds the functions that estimates the gas required for a given transaction. Follows the pattern used by ethers.js.
approve()
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.
• opts?: IActionOptions
Additional options.
Returns
Promise<BigNumber>
Gas estimate for the transaction.
deposit()
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.
• opts?: IActionOptions
Additional options.
Returns
Promise<BigNumber>
Gas estimate for the transaction.
withdraw()
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.
• opts?: IActionOptions
Additional options.
Returns
Promise<BigNumber>
Gas estimate for the transaction.
Source
src/interfaces/bridge-adapter.ts:221
l1Bridge
l1Bridge:
Contract
L1 bridge contract.
Source
src/interfaces/bridge-adapter.ts:38
l2Bridge
l2Bridge:
Contract
L2 bridge contract.
Source
src/interfaces/bridge-adapter.ts:43
messenger
messenger:
CrossChainMessenger
Provider used to make queries related to cross-chain interactions.
Source
src/interfaces/bridge-adapter.ts:33
populateTransaction
populateTransaction:
object
Object that holds the functions that generate transactions to be signed by the user. Follows the pattern used by ethers.js.
approve()
Generates a transaction for approving some tokens to deposit into the L2 chain.
Parameters
• l1Token: AddressLike
The L1 token address.