Skip to main content

Module: assetBridger/ethBridger

EthBridger

Bridger for moving ETH back and forth between L1 to L2

Extends

  • AssetBridger\< EthDepositParams | EthDepositToParams | L1ToL2TxReqAndSigner, EthWithdrawParams | L2ToL1TxReqAndSigner >

Properties

PropertyTypeDescription
readonly l1NetworkL1Network | L2NetworkParent chain for the given Arbitrum chain, can be an L1 or an L2
nativeToken?stringIn case of a chain that uses ETH as its native/gas token, this is either undefined or the zero address

In case of a chain that uses an ERC-20 token from the parent chain as its native/gas token, this is the address of said token on the parent chain

Accessors

nativeTokenIsEth

protected get nativeTokenIsEth(): boolean
Source

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

Inherited from

AssetBridger.nativeTokenIsEth

Methods

approveGasToken()

approveGasToken(params): Promise< TransactionResponse >

Approves the custom gas token to be spent by the Inbox on the parent chain.

Parameters
ParameterTypeDescription
paramsWithL1Signer\< ApproveGasTokenParamsOrTxRequest >
Returns

Promise\< TransactionResponse >

Source

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


checkL1Network()

protected checkL1Network(sop): Promise< void >

Check the signer/provider matches the l1Network, throws if not

Parameters
ParameterTypeDescription
sopSignerOrProvider
Returns

Promise\< void >

Inherited from

AssetBridger.checkL1Network

Source

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


checkL2Network()

protected checkL2Network(sop): Promise< void >

Check the signer/provider matches the l2Network, throws if not

Parameters
ParameterTypeDescription
sopSignerOrProvider
Returns

Promise\< void >

Inherited from

AssetBridger.checkL2Network

Source

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


deposit()

deposit(params): Promise< L1EthDepositTransaction >

Deposit ETH from L1 onto L2

Parameters
ParameterTypeDescription
paramsEthDepositParams | L1ToL2TxReqAndSigner
Returns

Promise\< L1EthDepositTransaction >

Overrides

AssetBridger.deposit

Source

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


depositTo()

depositTo(params): Promise< L1ContractCallTransaction >

Deposit ETH from L1 onto a different L2 address

Parameters
ParameterTypeDescription
paramsEthDepositToParams | L1ToL2TransactionRequest & {l1Signer: Signer; overrides: Overrides;} & {l2Provider: Provider;}
Returns

Promise\< L1ContractCallTransaction >

Source

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


getApproveGasTokenRequest()

getApproveGasTokenRequest(params?): Required< Pick< TransactionRequest, "data" | "value" | "to" > >

Creates a transaction request for approving the custom gas token to be spent by the inbox on the parent chain

Parameters
ParameterTypeDescription
params?ApproveGasTokenParams
Returns

Required\< Pick\< TransactionRequest, "data" | "value" | "to" > >

Source

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


getDepositRequest()

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

Gets tx request for depositing ETH or custom gas token

Parameters
ParameterTypeDescription
paramsEthDepositRequestParams
Returns

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

Source

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


getDepositRequestData()

private getDepositRequestData(params): string

Gets transaction calldata for a tx request for depositing ETH or custom gas token

Parameters
ParameterTypeDescription
paramsEthDepositRequestParams
Returns

string

Source

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


getDepositToRequest()

getDepositToRequest(params): Promise< L1ToL2TransactionRequest >

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

Parameters
ParameterTypeDescription
paramsEthDepositToRequestParams
Returns

Promise\< L1ToL2TransactionRequest >

Source

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


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:368


isApproveGasTokenParams()

private isApproveGasTokenParams(params): params is WithL1Signer<ApproveGasTokenParams>

Asserts that the provided argument is of type ApproveGasTokenParams and not ApproveGasTokenTxRequest.

Parameters
ParameterTypeDescription
paramsApproveGasTokenParamsOrTxRequest
Returns

params is WithL1Signer<ApproveGasTokenParams>

Source

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


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:404


fromProvider()

static fromProvider(l2Provider): Promise< EthBridger >

Instantiates a new EthBridger from an L2 Provider

Parameters
ParameterTypeDescription
l2ProviderProvider
Returns

Promise\< EthBridger >

Source

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