@morph-l2/sdk • Docs
@morph-l2/sdk / ETHBridgeAdapter
Class: ETHBridgeAdapter
Bridge adapter for the ETH bridge.
Extends
Constructors
new ETHBridgeAdapter()
new ETHBridgeAdapter(
opts
):ETHBridgeAdapter
Creates a StandardBridgeAdapter instance.
Parameters
• opts
Options for the adapter.
• opts.l1Bridge: AddressLike
L1 bridge contract.
• opts.l2Bridge: AddressLike
L2 bridge contract.
• opts.messenger: CrossChainMessenger
Provider used to make queries related to cross-chain interactions.
Returns
Inherited from
StandardBridgeAdapter
.constructor
Source
src/adapters/standard-bridge.ts:52
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()
approve: (
l1Token
,l2Token
,amount
,opts
?) =>Promise
<BigNumber
>
Parameters
• l1Token: AddressLike
• l2Token: AddressLike
• amount: NumberLike
• opts?: IActionOptions
Returns
Promise
<BigNumber
>
deposit()
deposit: (
l1Token
,l2Token
,amount
,opts
?) =>Promise
<BigNumber
>
Parameters
• l1Token: AddressLike
• l2Token: AddressLike
• amount: NumberLike
• opts?: IActionOptions
Returns
Promise
<BigNumber
>
withdraw()
withdraw: (
l1Token
,l2Token
,amount
,opts
?) =>Promise
<BigNumber
>
Parameters
• l1Token: AddressLike
• l2Token: AddressLike
• amount: NumberLike
• opts?: IActionOptions
Returns
Promise
<BigNumber
>
Inherited from
StandardBridgeAdapter
.estimateGas
Source
src/adapters/standard-bridge.ts:405
l1Bridge
l1Bridge:
Contract
L1 bridge contract.
Inherited from
StandardBridgeAdapter
.l1Bridge
Source
src/adapters/standard-bridge.ts:41
l2Bridge
l2Bridge:
Contract
L2 bridge contract.
Inherited from
StandardBridgeAdapter
.l2Bridge
Source
src/adapters/standard-bridge.ts:42
messenger
messenger:
CrossChainMessenger
Provider used to make queries related to cross-chain interactions.
Inherited from
StandardBridgeAdapter
.messenger
Source
src/adapters/standard-bridge.ts:40
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()
approve: (
l1Token
,l2Token
,amount
,opts
?) =>Promise
<never
>
Parameters
• l1Token: AddressLike
• l2Token: AddressLike
• amount: NumberLike
• opts?: IActionOptions
Returns
Promise
<never
>
deposit()
deposit: (
l1Token
,l2Token
,amount
,opts
) =>Promise
<TransactionRequest
>
Parameters
• l1Token: AddressLike
• l2Token: AddressLike
• amount: NumberLike
• opts: IActionOptions
Returns
Promise
<TransactionRequest
>
withdraw()
withdraw: (
l1Token
,l2Token
,amount
,opts
) =>Promise
<TransactionRequest
>
Parameters
• l1Token: AddressLike
• l2Token: AddressLike
• amount: NumberLike
• opts: IActionOptions
Returns
Promise
<TransactionRequest
>
Overrides
StandardBridgeAdapter
.populateTransaction
Source
src/adapters/eth-bridge.ts:116
Methods
approval()
approval(
l1Token
,l2Token
,opts
?):Promise
<BigNumber
>
Queries the account's approval amount for a given L1 token.
Parameters
• l1Token: AddressLike
The L1 token address.
• l2Token: AddressLike
The L2 token address.
• opts?: IActionOptions
Additional options.
Returns
Promise
<BigNumber
>
Amount of tokens approved for deposits from the account.
Overrides
StandardBridgeAdapter
.approval
Source
src/adapters/eth-bridge.ts:22
approve()
approve(
l1Token
,l2Token
,amount
,signer
,opts
?):Promise
<TransactionResponse
>
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.
• opts?: IActionOptions
Additional options.
Returns
Promise
<TransactionResponse
>
Transaction response for the approval transaction.
Inherited from
Source
src/adapters/standard-bridge.ts:250
deposit()
deposit(
l1Token
,l2Token
,amount
,signer
,opts
?):Promise
<TransactionResponse
>
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.
• opts?: IActionOptions
Additional options.
Returns
Promise
<TransactionResponse
>
Transaction response for the deposit transaction.
Inherited from
Source
src/adapters/standard-bridge.ts:262
getDepositsByAddress()
getDepositsByAddress(
address
,opts
?):Promise
<TokenBridgeMessage
[]>
Gets all deposits for a given address.
Parameters
• address: AddressLike
Address to search for messages from.
• opts?
Options object.
• opts.fromBlock?: BlockTag
• opts.toBlock?: BlockTag
Returns
Promise
<TokenBridgeMessage
[]>
All deposit token bridge messages sent by the given address.
Overrides
StandardBridgeAdapter
.getDepositsByAddress
Source
src/adapters/eth-bridge.ts:30
getWithdrawalsByAddress()
getWithdrawalsByAddress(
address
,opts
?):Promise
<TokenBridgeMessage
[]>
Gets all withdrawals for a given address.
Parameters
• address: AddressLike
Address to search for messages from.