Module: assetBridger/ethBridger
EthBridger
Bridger for moving ETH back and forth between L1 to L2
Extends
AssetBridger
\<EthDepositParams
|EthDepositToParams
|L1ToL2TxReqAndSigner
,EthWithdrawParams
|L2ToL1TxReqAndSigner
>
Constructors
constructor()
new EthBridger(l2Network): EthBridger
Throws
ArbSdkError if l2Network
does not have a correspondant L1 network in l1Networks
Parameters
Parameter | Type | Description |
---|---|---|
l2Network | L2Network | L2 network this bridger will operate with |
Returns
Inherited from
Source
arbitrum-sdk/src/lib/assetBridger/assetBridger.ts:48
Properties
Property | Type | Description |
---|---|---|
readonly l1Network | L1Network | L1 network this bridger will operate with |
readonly l2Network | L2Network | L2 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
Parameter | Type | Description |
---|---|---|
sop | SignerOrProvider | Signer or Provider from ethers |
Returns
Promise
\< void
>
Inherited from
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
Parameter | Type | Description |
---|---|---|
sop | SignerOrProvider | Signer or Provider from ethers |
Returns
Promise
\< void
>
Inherited from
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
Parameter | Type | Description |
---|---|---|
params | EthDepositParams | L1ToL2TxReqAndSigner | Parameters 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
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
Parameter | Type | Description |
---|---|---|
params | EthDepositToParams | 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
Parameter | Type | Description |
---|---|---|
params | EthDepositRequestParams | Parameters 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
Parameter | Type | Description |
---|---|---|
params | EthDepositToRequestParams | Parameters 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
Parameter | Type | Description |
---|---|---|
params | EthWithdrawParams |
Returns
Promise
\< L2ToL1TransactionRequest
>
Source
arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:354
withdraw()
withdraw(params): Promise< L2ContractTransaction >
Withdraw ETH from L2 onto L1
Parameters
Parameter | Type | Description |
---|---|---|
params | L2ToL1TxReqAndSigner | EthWithdrawParams & {l2Signer : Signer ;} |
Returns
Promise
\< L2ContractTransaction
>
Overrides
Source
arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:384
fromProvider()
static fromProvider(l2Provider): Promise< EthBridger >
Instantiates a new EthBridger from an L2 provider
Parameters
Parameter | Type | Description |
---|---|---|
l2Provider | Provider | L2 provider |
Returns
Promise
\< EthBridger
>
Source
arbitrum-sdk/src/lib/assetBridger/ethBridger.ts:182
EthWithdrawParams
Parameters to transfer Ether from L2 to L1 (withdraw)
Properties
Property | Type | Description |
---|---|---|
amount | BigNumber | The amount of ETH or tokens to be withdrawn |
destinationAddress | string | The L1 address to receive the value |
from | string | The address of the withdrawal sender |
overrides ? | PayableOverrides | Transaction overrides |
EthDepositParams
EthDepositParams: object;
Parameters to transfer Ether from L1 to L2 (deposit)
Type declaration
Member | Type | Description |
---|---|---|
amount | BigNumber | The amount of ETH to be deposited |
l1Signer | Signer | The L1 signer |
overrides ? | PayableOverrides | Transaction 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
Member | Type | Description |
---|---|---|
destinationAddress | string | L2 address of the account receiving the funds |
l2Provider | Provider | An L2 provider |
retryableGasOverrides ? | GasOverrides | Overrides 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
Member | Type | Description |
---|---|---|
l1Signer | Signer | An L1 signer |
overrides ? | Overrides | Transaction 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
Member | Type | Description |
---|---|---|
l2Signer | Signer | An L2 signer |
overrides ? | Overrides | Transaction overrides |