Skip to main content

Module: assetBridger/ethBridger

EthBridger

Bridger for moving ETH back and forth between L1 to L2

Extends

Constructors

constructor()

new EthBridger(l2Network): EthBridger
Throws

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

Parameters
ParameterTypeDescription
l2NetworkL2NetworkL2 network this bridger will operate with
Returns

EthBridger

Inherited from

AssetBridger.constructor

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 >

Inherited from

AssetBridger.checkL1Network

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 >

Inherited from

AssetBridger.checkL2Network

Source

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


deposit()

deposit(params): Promise< L1EthDepositTransaction >

Deposit ETH from L1 onto L2

Example

This function can be called to create a transaction for an L1 to L2 message to deposit ETH.

const depositParams = {
...
};
const ethBridger = EthBridger.fromProvider(l2Provider);
const depositTransaction = ethBridger.deposit(depositParams);
...
Parameters
ParameterTypeDescription
paramsEthDepositParams | L1ToL2TxReqAndSignerParameters or a Transaction request object to transfer Ether from L1 to L2 (deposit)
Returns

Promise\< L1EthDepositTransaction >

Response object for a transaction sent to an L1 contract

Overrides

AssetBridger.deposit

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:247


depositTo()

depositTo(params): Promise< L1ContractCallTransaction >

Deposit ETH from L1 onto a different L2 address

Example

This function can be called to create a transaction for an L1 to L2 message to deposit ETH to a different address.

const depositParams = {
...
};
const ethBridger = EthBridger.fromProvider(l2Provider);
const depositTransaction = ethBridger.depositTo(depositParams);
...
Parameters
ParameterTypeDescription
paramsEthDepositToParams | L1ToL2TransactionRequest & {l1Signer: Signer; overrides: Overrides;} & {l2Provider: Provider;}Parameters or a Transaction request object to transfer Ether from L1 to a different L2 address (deposit)
Returns

Promise\< L1ContractCallTransaction >

Response object for a transaction sent to an L1 contract

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:325


getDepositRequest()

getDepositRequest(params): Promise< OmitTyped< L1ToL2TransactionRequest, "retryableData" > >

Get a transaction request for an ETH deposit

Example

This function can be called to create a transaction for an L1 to L2 message to deposit ETH.

const depositParams = {
...
};
const ethBridger = EthBridger.fromProvider(l2Provider);
const depositRequestObject = ethBridger.getDepositRequest(depositParams);
...
Parameters
ParameterTypeDescription
paramsEthDepositRequestParamsParameters to create a transaction to transfer Ether from L1 to L2 (deposit)
Returns

Promise\< OmitTyped\< L1ToL2TransactionRequest, "retryableData" > >

Transaction request object (i.e., an object prepared to be sent to the blockchain as a transaction)

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:204


getDepositToRequest()

getDepositToRequest(params): Promise< L1ToL2TransactionRequest >

Get a transaction request for an ETH deposit to a different L2 address using Retryables

Example

This function can be called to create a transaction for an L1 to L2 message to deposit ETH to a different address

const depositParams = {
...
};
const ethBridger = EthBridger.fromProvider(l2Provider);
const depositRequestObject = ethBridger.getDepositToRequest(depositParams);
...
Parameters
ParameterTypeDescription
paramsEthDepositToRequestParamsParameters to create a transaction to transfer Ether from L1 to a different L2 address using Retryables
Returns

Promise\< L1ToL2TransactionRequest >

Transaction request object (i.e., an object prepared to be sent to the blockchain as a transaction)

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:285


getWithdrawalRequest()

getWithdrawalRequest(params): Promise< L2ToL1TransactionRequest >

Get a transaction request for an eth withdrawal

Parameters
ParameterTypeDescription
paramsEthWithdrawParams
Returns

Promise\< L2ToL1TransactionRequest >

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:354


withdraw()

withdraw(params): Promise< L2ContractTransaction >

Withdraw ETH from L2 onto L1

Parameters
ParameterTypeDescription
paramsL2ToL1TxReqAndSigner | EthWithdrawParams & {l2Signer: Signer;}
Returns

Promise\< L2ContractTransaction >

Overrides

AssetBridger.withdraw

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:384


fromProvider()

static fromProvider(l2Provider): Promise< EthBridger >

Instantiates a new EthBridger from an L2 provider

Parameters
ParameterTypeDescription
l2ProviderProviderL2 provider
Returns

Promise\< EthBridger >

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:182


EthWithdrawParams

Parameters to transfer Ether from L2 to L1 (withdraw)

Properties

PropertyTypeDescription
amountBigNumberThe amount of ETH or tokens to be withdrawn
destinationAddressstringThe L1 address to receive the value
fromstringThe address of the withdrawal sender
overrides?PayableOverridesTransaction overrides

EthDepositParams

EthDepositParams: object;

Parameters to transfer Ether from L1 to L2 (deposit)

Type declaration

MemberTypeDescription
amountBigNumberThe amount of ETH to be deposited
l1SignerSignerThe L1 signer
overrides?PayableOverridesTransaction overrides

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:75


EthDepositToParams

EthDepositToParams: EthDepositParams & {destinationAddress: string; l2Provider: Provider; retryableGasOverrides: GasOverrides;}

Parameters to transfer Ether from L1 to L2 (deposit) to a different address. Extends EthDepositParams

MemberTypeDescription
destinationAddressstringL2 address of the account receiving the funds
l2ProviderProviderAn L2 provider
retryableGasOverrides?GasOverridesOverrides for the retryable ticket parameters

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:93


L1ToL2TxReqAndSigner

L1ToL2TxReqAndSigner: L1ToL2TransactionRequest & {l1Signer: Signer; overrides: Overrides;}

Transaction request object for an L1 to L2 message, including an L1 signer. Extends L1ToL2TransactionRequest

MemberTypeDescription
l1SignerSignerAn L1 signer
overrides?OverridesTransaction overrides

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:111


L2ToL1TxReqAndSigner

L2ToL1TxReqAndSigner: L2ToL1TransactionRequest & {l2Signer: Signer; overrides: Overrides;}

Transaction request object for an L2 to L1 message, including an L2 signer. Extends L2ToL1TransactionRequest

MemberTypeDescription
l2SignerSignerAn L2 signer
overrides?OverridesTransaction overrides

Source

arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:125