Skip to main content

ethBridger

Classes

EthBridger

Bridger for moving ETH back and forth between parent and child chain

Extends

  • AssetBridger<EthDepositParams | EthDepositToParams | ParentToChildTxReqAndSigner, EthWithdrawParams | ChildToParentTxReqAndSigner>

Properties

PropertyModifierTypeDescriptionInherited from
nativeToken?readonlystringIn 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
AssetBridger.nativeToken

Accessors

nativeTokenIsEth
get protected nativeTokenIsEth(): boolean

Whether the chain uses ETH as its native/gas token

Returns

boolean

Source

assetBridger/assetBridger.ts:68

Methods

approveGasToken()
approveGasToken(params: WithParentSigner<ApproveGasTokenParamsOrTxRequest>): Promise<TransactionResponse>

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

Parameters
ParameterTypeDescription
paramsWithParentSigner<ApproveGasTokenParamsOrTxRequest>
Returns

Promise<TransactionResponse>

Source

assetBridger/ethBridger.ts:219

checkChildChain()
protected checkChildChain(sop: SignerOrProvider): Promise<void>

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

Parameters
ParameterTypeDescription
sopSignerOrProvider
Returns

Promise<void>

Inherited from

AssetBridger . checkChildChain

Source

assetBridger/assetBridger.ts:60

checkParentChain()
protected checkParentChain(sop: SignerOrProvider): Promise<void>

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

Parameters
ParameterTypeDescription
sopSignerOrProvider
Returns

Promise<void>

Inherited from

AssetBridger . checkParentChain

Source

assetBridger/assetBridger.ts:49

deposit()
deposit(params: EthDepositParams | ParentToChildTxReqAndSigner): Promise<ParentEthDepositTransaction>

Deposit ETH from Parent onto Child chain

Parameters
ParameterTypeDescription
paramsEthDepositParams | ParentToChildTxReqAndSigner
Returns

Promise<ParentEthDepositTransaction>

Overrides

AssetBridger . deposit

Source

assetBridger/ethBridger.ts:287

depositTo()
depositTo(params: EthDepositToParams | ParentToChildTransactionRequest & object & object): Promise<ParentContractCallTransaction>

Deposit ETH from parent chain onto a different child chain address

Parameters
ParameterTypeDescription
paramsEthDepositToParams | ParentToChildTransactionRequest & object & object
Returns

Promise<ParentContractCallTransaction>

Source

assetBridger/ethBridger.ts:339

getApproveGasTokenRequest()
getApproveGasTokenRequest(params?: ApproveGasTokenParams): 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

assetBridger/ethBridger.ts:191

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

Gets tx request for depositing ETH or custom gas token

Parameters
ParameterTypeDescription
paramsEthDepositRequestParams
Returns

Promise <OmitTyped <ParentToChildTransactionRequest, "retryableData">>

Source

assetBridger/ethBridger.ts:268

getDepositRequestData()
private getDepositRequestData(params: EthDepositRequestParams): string

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

Parameters
ParameterTypeDescription
paramsEthDepositRequestParams
Returns

string

Source

assetBridger/ethBridger.ts:241

getDepositToRequest()
getDepositToRequest(params: EthDepositToRequestParams): Promise<ParentToChildTransactionRequest>

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

Parameters
ParameterTypeDescription
paramsEthDepositToRequestParams
Returns

Promise <ParentToChildTransactionRequest>

Source

assetBridger/ethBridger.ts:312

getWithdrawalRequest()
getWithdrawalRequest(params: EthWithdrawParams): Promise<ChildToParentTransactionRequest>

Get a transaction request for an eth withdrawal

Parameters
ParameterTypeDescription
paramsEthWithdrawParams
Returns

Promise <ChildToParentTransactionRequest>

Source

assetBridger/ethBridger.ts:372

isApproveGasTokenParams()
private isApproveGasTokenParams(params: ApproveGasTokenParamsOrTxRequest): params is WithParentSigner<ApproveGasTokenParams>

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

Parameters
ParameterTypeDescription
paramsApproveGasTokenParamsOrTxRequest
Returns

params is WithParentSigner<ApproveGasTokenParams>

Source

assetBridger/ethBridger.ts:181

withdraw()
withdraw(params: ChildToParentTxReqAndSigner | EthWithdrawParams & object): Promise<ChildContractTransaction>

Withdraw ETH from child chain onto parent chain

Parameters
ParameterTypeDescription
paramsChildToParentTxReqAndSigner | EthWithdrawParams & object
Returns

Promise<ChildContractTransaction>

Overrides

AssetBridger . withdraw

Source

assetBridger/ethBridger.ts:408

fromProvider()
static fromProvider(childProvider: Provider): Promise<EthBridger>

Instantiates a new EthBridger from a child chain Provider

Parameters
ParameterTypeDescription
childProviderProvider
Returns

Promise <EthBridger>

Source

assetBridger/ethBridger.ts:173