Skip to main content

Module: assetBridger/assetBridger

AssetBridger

Base for bridging assets from l1 to l2 and back

Extended By

Type parameters

ParameterDescription
DepositParamsObject with information to execute a deposit. For an example, see Erc20Bridger.Erc20DepositParams
WithdrawParamsObject with information to execute a withdraw. For an example, see Erc20Bridger.Erc20WithdrawParams

Constructors

constructor()

new AssetBridger<DepositParams, WithdrawParams>(l2Network): AssetBridger< DepositParams, WithdrawParams >
Throws

ArbSdkError if l2Network does not have a correspondant L1 network in l1Networks

Type parameters
ParameterDescription
DepositParamsObject with information to execute a deposit. For an example, see Erc20Bridger.Erc20DepositParams
WithdrawParamsObject with information to execute a withdraw. For an example, see Erc20Bridger.Erc20WithdrawParams
Parameters
ParameterTypeDescription
l2NetworkL2NetworkL2 network this bridger will operate with
Returns

AssetBridger\< DepositParams, WithdrawParams >

Source

arbitrum-sdk/src/lib/assetBridger/assetBridger.ts:48

Properties

PropertyTypeDescription
readonly l1NetworkL1NetworkL1 network this bridger will operate with
readonly l2NetworkL2NetworkL2 network this bridger will operate with

Methods

checkL1Network()

protected checkL1Network(sop): Promise< void >

Check the signer/provider matches the l1Network

Remarks

Only ethers is allowed for the signer or provider object

Parameters
ParameterTypeDescription
sopSignerOrProviderSigner or Provider from ethers
Returns

Promise\< void >

Source

arbitrum-sdk/src/lib/assetBridger/assetBridger.ts:65


checkL2Network()

protected checkL2Network(sop): Promise< void >

Check the signer/provider matches the l2Network

Remarks

Only ethers is allowed for the signer or provider object

Parameters
ParameterTypeDescription
sopSignerOrProviderSigner or Provider from ethers
Returns

Promise\< void >

Source

arbitrum-sdk/src/lib/assetBridger/assetBridger.ts:77


deposit()

abstract deposit(params): Promise< L1ContractTransaction< L1TransactionReceipt > >

Transfer assets from L1 to L2

Remarks

The actual content of the DepositParams object will depend on the child class used. For example, the parameters needed in Erc20Bridger are different than in EthBridger as the processes to transfer ERC20 assets is different than the process to transfer ETH.

Parameters
ParameterTypeDescription
paramsDepositParamsParameters needed to execute a deposit
Returns

Promise\< L1ContractTransaction\< L1TransactionReceipt > >

Response object for a transaction sent to an L1 contract

Source

arbitrum-sdk/src/lib/assetBridger/assetBridger.ts:92


withdraw()

abstract withdraw(params): Promise< L2ContractTransaction >

Transfer assets from L2 to L1

Remarks

The actual content of the WithdrawParams object will depend on the child class used. For example, the parameters needed in Erc20Bridger are different than in EthBridger as the processes to transfer ERC20 assets is different than the process to transfer ETH.

Parameters
ParameterTypeDescription
paramsWithdrawParamsParameters needed to execute a withdraw
Returns

Promise\< L2ContractTransaction >

Response object for a transaction sent to an L2 contract

Source

arbitrum-sdk/src/lib/assetBridger/assetBridger.ts:105