@morph-l2/sdk • Docs
@morph-l2/sdk / StandardBridgeAdapter
Class: StandardBridgeAdapter
Bridge adapter for any token bridge that uses the standard token bridge interface.
Extended by
Implements
Constructors
new StandardBridgeAdapter()
new StandardBridgeAdapter(
opts
):StandardBridgeAdapter
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
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
>
Implementation of
Source
src/adapters/standard-bridge.ts:405
l1Bridge
l1Bridge:
Contract
L1 bridge contract.
Implementation of
Source
src/adapters/standard-bridge.ts:41
l2Bridge
l2Bridge:
Contract
L2 bridge contract.
Implementation of
Source
src/adapters/standard-bridge.ts:42
messenger
messenger:
CrossChainMessenger
Provider used to make queries related to cross-chain interactions.
Implementation of
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
<TransactionRequest
>
Parameters
• l1Token: AddressLike
• l2Token: AddressLike
• amount: NumberLike
• opts?: IActionOptions
Returns
Promise
<TransactionRequest
>
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
>
Implementation of
IBridgeAdapter
.populateTransaction
Source
src/adapters/standard-bridge.ts:286
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.
Implementation of
Source
src/adapters/standard-bridge.ts:209
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.
Implementation of
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.
Implementation of
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.