Commit fd6ea3ee authored by Kelvin Fichter's avatar Kelvin Fichter Committed by smartcontracts

feat(sdk): allow withdrawals or deposits to target

This commit updates the SDK to add support for withdrawing or depositing
to a target address (as opposed to simply depositing or withdrawing to
yourself).
parent 453e8c53
---
'@eth-optimism/sdk': patch
---
Adds support for depositing or withdrawing to a target address
...@@ -100,6 +100,7 @@ export class ETHBridgeAdapter extends StandardBridgeAdapter { ...@@ -100,6 +100,7 @@ export class ETHBridgeAdapter extends StandardBridgeAdapter {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -108,14 +109,26 @@ export class ETHBridgeAdapter extends StandardBridgeAdapter { ...@@ -108,14 +109,26 @@ export class ETHBridgeAdapter extends StandardBridgeAdapter {
throw new Error(`token pair not supported by bridge`) throw new Error(`token pair not supported by bridge`)
} }
return this.l1Bridge.populateTransaction.depositETH( if (opts?.recipient === undefined) {
opts?.l2GasLimit || 200_000, // Default to 200k gas limit. return this.l1Bridge.populateTransaction.depositETH(
'0x', // No data. opts?.l2GasLimit || 200_000, // Default to 200k gas limit.
{ '0x', // No data.
...omit(opts?.overrides || {}, 'value'), {
value: amount, ...omit(opts?.overrides || {}, 'value'),
} value: amount,
) }
)
} else {
return this.l1Bridge.populateTransaction.depositETHTo(
toAddress(opts.recipient),
opts?.l2GasLimit || 200_000, // Default to 200k gas limit.
'0x', // No data.
{
...omit(opts?.overrides || {}, 'value'),
value: amount,
}
)
}
}, },
withdraw: async ( withdraw: async (
...@@ -123,6 +136,7 @@ export class ETHBridgeAdapter extends StandardBridgeAdapter { ...@@ -123,6 +136,7 @@ export class ETHBridgeAdapter extends StandardBridgeAdapter {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionRequest> => { ): Promise<TransactionRequest> => {
...@@ -130,13 +144,24 @@ export class ETHBridgeAdapter extends StandardBridgeAdapter { ...@@ -130,13 +144,24 @@ export class ETHBridgeAdapter extends StandardBridgeAdapter {
throw new Error(`token pair not supported by bridge`) throw new Error(`token pair not supported by bridge`)
} }
return this.l2Bridge.populateTransaction.withdraw( if (opts?.recipient === undefined) {
toAddress(l2Token), return this.l2Bridge.populateTransaction.withdraw(
amount, toAddress(l2Token),
0, // L1 gas not required. amount,
'0x', // No data. 0, // L1 gas not required.
opts?.overrides || {} '0x', // No data.
) opts?.overrides || {}
)
} else {
return this.l2Bridge.populateTransaction.withdrawTo(
toAddress(l2Token),
toAddress(opts.recipient),
amount,
0, // L1 gas not required.
'0x', // No data.
opts?.overrides || {}
)
}
}, },
} }
} }
...@@ -208,6 +208,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter { ...@@ -208,6 +208,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter {
amount: NumberLike, amount: NumberLike,
signer: Signer, signer: Signer,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -223,6 +224,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter { ...@@ -223,6 +224,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter {
amount: NumberLike, amount: NumberLike,
signer: Signer, signer: Signer,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionResponse> { ): Promise<TransactionResponse> {
...@@ -237,6 +239,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter { ...@@ -237,6 +239,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -245,14 +248,26 @@ export class StandardBridgeAdapter implements IBridgeAdapter { ...@@ -245,14 +248,26 @@ export class StandardBridgeAdapter implements IBridgeAdapter {
throw new Error(`token pair not supported by bridge`) throw new Error(`token pair not supported by bridge`)
} }
return this.l1Bridge.populateTransaction.depositERC20( if (opts?.recipient === undefined) {
toAddress(l1Token), return this.l1Bridge.populateTransaction.depositERC20(
toAddress(l2Token), toAddress(l1Token),
amount, toAddress(l2Token),
opts?.l2GasLimit || 200_000, // Default to 200k gas limit. amount,
'0x', // No data. opts?.l2GasLimit || 200_000, // Default to 200k gas limit.
opts?.overrides || {} '0x', // No data.
) opts?.overrides || {}
)
} else {
return this.l1Bridge.populateTransaction.depositERC20To(
toAddress(l1Token),
toAddress(l2Token),
toAddress(opts.recipient),
amount,
opts?.l2GasLimit || 200_000, // Default to 200k gas limit.
'0x', // No data.
opts?.overrides || {}
)
}
}, },
withdraw: async ( withdraw: async (
...@@ -260,6 +275,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter { ...@@ -260,6 +275,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionRequest> => { ): Promise<TransactionRequest> => {
...@@ -267,13 +283,24 @@ export class StandardBridgeAdapter implements IBridgeAdapter { ...@@ -267,13 +283,24 @@ export class StandardBridgeAdapter implements IBridgeAdapter {
throw new Error(`token pair not supported by bridge`) throw new Error(`token pair not supported by bridge`)
} }
return this.l2Bridge.populateTransaction.withdraw( if (opts?.recipient === undefined) {
toAddress(l2Token), return this.l2Bridge.populateTransaction.withdraw(
amount, toAddress(l2Token),
0, // L1 gas not required. amount,
'0x', // No data. 0, // L1 gas not required.
opts?.overrides || {} '0x', // No data.
) opts?.overrides || {}
)
} else {
return this.l2Bridge.populateTransaction.withdrawTo(
toAddress(l2Token),
toAddress(opts.recipient),
amount,
0, // L1 gas not required.
'0x', // No data.
opts?.overrides || {}
)
}
}, },
} }
...@@ -283,6 +310,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter { ...@@ -283,6 +310,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -297,6 +325,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter { ...@@ -297,6 +325,7 @@ export class StandardBridgeAdapter implements IBridgeAdapter {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<BigNumber> => { ): Promise<BigNumber> => {
......
...@@ -815,6 +815,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -815,6 +815,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
public async depositETH( public async depositETH(
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
signer?: Signer signer?: Signer
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
...@@ -828,6 +829,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -828,6 +829,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
public async withdrawETH( public async withdrawETH(
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
signer?: Signer signer?: Signer
overrides?: Overrides overrides?: Overrides
} }
...@@ -842,6 +844,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -842,6 +844,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
signer?: Signer signer?: Signer
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
...@@ -862,6 +865,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -862,6 +865,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
signer?: Signer signer?: Signer
overrides?: Overrides overrides?: Overrides
} }
...@@ -949,6 +953,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -949,6 +953,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
depositETH: async ( depositETH: async (
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -964,6 +969,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -964,6 +969,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
withdrawETH: async ( withdrawETH: async (
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionRequest> => { ): Promise<TransactionRequest> => {
...@@ -980,6 +986,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -980,6 +986,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -993,6 +1000,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -993,6 +1000,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionRequest> => { ): Promise<TransactionRequest> => {
...@@ -1047,6 +1055,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -1047,6 +1055,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
depositETH: async ( depositETH: async (
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -1059,6 +1068,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -1059,6 +1068,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
withdrawETH: async ( withdrawETH: async (
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<BigNumber> => { ): Promise<BigNumber> => {
...@@ -1072,6 +1082,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -1072,6 +1082,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -1091,6 +1102,7 @@ export class CrossChainMessenger implements ICrossChainMessenger { ...@@ -1091,6 +1102,7 @@ export class CrossChainMessenger implements ICrossChainMessenger {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<BigNumber> => { ): Promise<BigNumber> => {
......
...@@ -109,6 +109,7 @@ export interface IBridgeAdapter { ...@@ -109,6 +109,7 @@ export interface IBridgeAdapter {
* @param amount Amount of the token to deposit. * @param amount Amount of the token to deposit.
* @param signer Signer used to sign and send the transaction. * @param signer Signer used to sign and send the transaction.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L2. Defaults to sender.
* @param opts.l2GasLimit Optional gas limit to use for the transaction on L2. * @param opts.l2GasLimit Optional gas limit to use for the transaction on L2.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction response for the deposit transaction. * @returns Transaction response for the deposit transaction.
...@@ -119,6 +120,7 @@ export interface IBridgeAdapter { ...@@ -119,6 +120,7 @@ export interface IBridgeAdapter {
amount: NumberLike, amount: NumberLike,
signer: Signer, signer: Signer,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -132,6 +134,7 @@ export interface IBridgeAdapter { ...@@ -132,6 +134,7 @@ export interface IBridgeAdapter {
* @param amount Amount of the token to withdraw. * @param amount Amount of the token to withdraw.
* @param signer Signer used to sign and send the transaction. * @param signer Signer used to sign and send the transaction.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L1. Defaults to sender.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction response for the withdraw transaction. * @returns Transaction response for the withdraw transaction.
*/ */
...@@ -141,6 +144,7 @@ export interface IBridgeAdapter { ...@@ -141,6 +144,7 @@ export interface IBridgeAdapter {
amount: NumberLike, amount: NumberLike,
signer: Signer, signer: Signer,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionResponse> ): Promise<TransactionResponse>
...@@ -157,6 +161,7 @@ export interface IBridgeAdapter { ...@@ -157,6 +161,7 @@ export interface IBridgeAdapter {
* @param l2Token The L2 token address. * @param l2Token The L2 token address.
* @param amount Amount of the token to deposit. * @param amount Amount of the token to deposit.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L2. Defaults to sender.
* @param opts.l2GasLimit Optional gas limit to use for the transaction on L2. * @param opts.l2GasLimit Optional gas limit to use for the transaction on L2.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction that can be signed and executed to deposit the tokens. * @returns Transaction that can be signed and executed to deposit the tokens.
...@@ -166,6 +171,7 @@ export interface IBridgeAdapter { ...@@ -166,6 +171,7 @@ export interface IBridgeAdapter {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -178,6 +184,7 @@ export interface IBridgeAdapter { ...@@ -178,6 +184,7 @@ export interface IBridgeAdapter {
* @param l2Token The L2 token address. * @param l2Token The L2 token address.
* @param amount Amount of the token to withdraw. * @param amount Amount of the token to withdraw.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L1. Defaults to sender.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction that can be signed and executed to withdraw the tokens. * @returns Transaction that can be signed and executed to withdraw the tokens.
*/ */
...@@ -186,6 +193,7 @@ export interface IBridgeAdapter { ...@@ -186,6 +193,7 @@ export interface IBridgeAdapter {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionRequest> ): Promise<TransactionRequest>
...@@ -203,6 +211,7 @@ export interface IBridgeAdapter { ...@@ -203,6 +211,7 @@ export interface IBridgeAdapter {
* @param l2Token The L2 token address. * @param l2Token The L2 token address.
* @param amount Amount of the token to deposit. * @param amount Amount of the token to deposit.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L2. Defaults to sender.
* @param opts.l2GasLimit Optional gas limit to use for the transaction on L2. * @param opts.l2GasLimit Optional gas limit to use for the transaction on L2.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Gas estimate for the transaction. * @returns Gas estimate for the transaction.
...@@ -212,6 +221,7 @@ export interface IBridgeAdapter { ...@@ -212,6 +221,7 @@ export interface IBridgeAdapter {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -224,6 +234,7 @@ export interface IBridgeAdapter { ...@@ -224,6 +234,7 @@ export interface IBridgeAdapter {
* @param l2Token The L2 token address. * @param l2Token The L2 token address.
* @param amount Amount of the token to withdraw. * @param amount Amount of the token to withdraw.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L1. Defaults to sender.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Gas estimate for the transaction. * @returns Gas estimate for the transaction.
*/ */
...@@ -232,6 +243,7 @@ export interface IBridgeAdapter { ...@@ -232,6 +243,7 @@ export interface IBridgeAdapter {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<BigNumber> ): Promise<BigNumber>
......
...@@ -397,6 +397,7 @@ export interface ICrossChainMessenger { ...@@ -397,6 +397,7 @@ export interface ICrossChainMessenger {
* @param amount Amount of ETH to deposit (in wei). * @param amount Amount of ETH to deposit (in wei).
* @param opts Additional options. * @param opts Additional options.
* @param opts.signer Optional signer to use to send the transaction. * @param opts.signer Optional signer to use to send the transaction.
* @param opts.recipient Optional address to receive the funds on L2. Defaults to sender.
* @param opts.l2GasLimit Optional gas limit to use for the transaction on L2. * @param opts.l2GasLimit Optional gas limit to use for the transaction on L2.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction response for the deposit transaction. * @returns Transaction response for the deposit transaction.
...@@ -405,6 +406,7 @@ export interface ICrossChainMessenger { ...@@ -405,6 +406,7 @@ export interface ICrossChainMessenger {
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
signer?: Signer signer?: Signer
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -416,6 +418,7 @@ export interface ICrossChainMessenger { ...@@ -416,6 +418,7 @@ export interface ICrossChainMessenger {
* @param amount Amount of ETH to withdraw. * @param amount Amount of ETH to withdraw.
* @param opts Additional options. * @param opts Additional options.
* @param opts.signer Optional signer to use to send the transaction. * @param opts.signer Optional signer to use to send the transaction.
* @param opts.recipient Optional address to receive the funds on L1. Defaults to sender.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction response for the withdraw transaction. * @returns Transaction response for the withdraw transaction.
*/ */
...@@ -423,6 +426,7 @@ export interface ICrossChainMessenger { ...@@ -423,6 +426,7 @@ export interface ICrossChainMessenger {
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
signer?: Signer signer?: Signer
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionResponse> ): Promise<TransactionResponse>
...@@ -435,6 +439,7 @@ export interface ICrossChainMessenger { ...@@ -435,6 +439,7 @@ export interface ICrossChainMessenger {
* @param amount Amount to deposit. * @param amount Amount to deposit.
* @param opts Additional options. * @param opts Additional options.
* @param opts.signer Optional signer to use to send the transaction. * @param opts.signer Optional signer to use to send the transaction.
* @param opts.recipient Optional address to receive the funds on L2. Defaults to sender.
* @param opts.l2GasLimit Optional gas limit to use for the transaction on L2. * @param opts.l2GasLimit Optional gas limit to use for the transaction on L2.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction response for the deposit transaction. * @returns Transaction response for the deposit transaction.
...@@ -445,6 +450,7 @@ export interface ICrossChainMessenger { ...@@ -445,6 +450,7 @@ export interface ICrossChainMessenger {
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
signer?: Signer signer?: Signer
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -458,6 +464,7 @@ export interface ICrossChainMessenger { ...@@ -458,6 +464,7 @@ export interface ICrossChainMessenger {
* @param amount Amount to withdraw. * @param amount Amount to withdraw.
* @param opts Additional options. * @param opts Additional options.
* @param opts.signer Optional signer to use to send the transaction. * @param opts.signer Optional signer to use to send the transaction.
* @param opts.recipient Optional address to receive the funds on L1. Defaults to sender.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction response for the withdraw transaction. * @returns Transaction response for the withdraw transaction.
*/ */
...@@ -467,6 +474,7 @@ export interface ICrossChainMessenger { ...@@ -467,6 +474,7 @@ export interface ICrossChainMessenger {
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
signer?: Signer signer?: Signer
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionResponse> ): Promise<TransactionResponse>
...@@ -534,6 +542,7 @@ export interface ICrossChainMessenger { ...@@ -534,6 +542,7 @@ export interface ICrossChainMessenger {
* *
* @param amount Amount of ETH to deposit. * @param amount Amount of ETH to deposit.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L2. Defaults to sender.
* @param opts.l2GasLimit Optional gas limit to use for the transaction on L2. * @param opts.l2GasLimit Optional gas limit to use for the transaction on L2.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction that can be signed and executed to deposit the ETH. * @returns Transaction that can be signed and executed to deposit the ETH.
...@@ -541,6 +550,7 @@ export interface ICrossChainMessenger { ...@@ -541,6 +550,7 @@ export interface ICrossChainMessenger {
depositETH( depositETH(
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -551,12 +561,14 @@ export interface ICrossChainMessenger { ...@@ -551,12 +561,14 @@ export interface ICrossChainMessenger {
* *
* @param amount Amount of ETH to withdraw. * @param amount Amount of ETH to withdraw.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L1. Defaults to sender.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction that can be signed and executed to withdraw the ETH. * @returns Transaction that can be signed and executed to withdraw the ETH.
*/ */
withdrawETH( withdrawETH(
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionRequest> ): Promise<TransactionRequest>
...@@ -568,6 +580,7 @@ export interface ICrossChainMessenger { ...@@ -568,6 +580,7 @@ export interface ICrossChainMessenger {
* @param l2Token Address of the L2 token. * @param l2Token Address of the L2 token.
* @param amount Amount to deposit. * @param amount Amount to deposit.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L2. Defaults to sender.
* @param opts.l2GasLimit Optional gas limit to use for the transaction on L2. * @param opts.l2GasLimit Optional gas limit to use for the transaction on L2.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction that can be signed and executed to deposit the tokens. * @returns Transaction that can be signed and executed to deposit the tokens.
...@@ -577,6 +590,7 @@ export interface ICrossChainMessenger { ...@@ -577,6 +590,7 @@ export interface ICrossChainMessenger {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -589,6 +603,7 @@ export interface ICrossChainMessenger { ...@@ -589,6 +603,7 @@ export interface ICrossChainMessenger {
* @param l2Token Address of the L2 token. * @param l2Token Address of the L2 token.
* @param amount Amount to withdraw. * @param amount Amount to withdraw.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L1. Defaults to sender.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Transaction that can be signed and executed to withdraw the tokens. * @returns Transaction that can be signed and executed to withdraw the tokens.
*/ */
...@@ -597,6 +612,7 @@ export interface ICrossChainMessenger { ...@@ -597,6 +612,7 @@ export interface ICrossChainMessenger {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<TransactionRequest> ): Promise<TransactionRequest>
...@@ -661,6 +677,7 @@ export interface ICrossChainMessenger { ...@@ -661,6 +677,7 @@ export interface ICrossChainMessenger {
* *
* @param amount Amount of ETH to deposit. * @param amount Amount of ETH to deposit.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L2. Defaults to sender.
* @param opts.l2GasLimit Optional gas limit to use for the transaction on L2. * @param opts.l2GasLimit Optional gas limit to use for the transaction on L2.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Gas estimate for the transaction. * @returns Gas estimate for the transaction.
...@@ -668,6 +685,7 @@ export interface ICrossChainMessenger { ...@@ -668,6 +685,7 @@ export interface ICrossChainMessenger {
depositETH( depositETH(
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -678,12 +696,14 @@ export interface ICrossChainMessenger { ...@@ -678,12 +696,14 @@ export interface ICrossChainMessenger {
* *
* @param amount Amount of ETH to withdraw. * @param amount Amount of ETH to withdraw.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L1. Defaults to sender.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Gas estimate for the transaction. * @returns Gas estimate for the transaction.
*/ */
withdrawETH( withdrawETH(
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<BigNumber> ): Promise<BigNumber>
...@@ -695,6 +715,7 @@ export interface ICrossChainMessenger { ...@@ -695,6 +715,7 @@ export interface ICrossChainMessenger {
* @param l2Token Address of the L2 token. * @param l2Token Address of the L2 token.
* @param amount Amount to deposit. * @param amount Amount to deposit.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L2. Defaults to sender.
* @param opts.l2GasLimit Optional gas limit to use for the transaction on L2. * @param opts.l2GasLimit Optional gas limit to use for the transaction on L2.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Gas estimate for the transaction. * @returns Gas estimate for the transaction.
...@@ -704,6 +725,7 @@ export interface ICrossChainMessenger { ...@@ -704,6 +725,7 @@ export interface ICrossChainMessenger {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
l2GasLimit?: NumberLike l2GasLimit?: NumberLike
overrides?: Overrides overrides?: Overrides
} }
...@@ -716,6 +738,7 @@ export interface ICrossChainMessenger { ...@@ -716,6 +738,7 @@ export interface ICrossChainMessenger {
* @param l2Token Address of the L2 token. * @param l2Token Address of the L2 token.
* @param amount Amount to withdraw. * @param amount Amount to withdraw.
* @param opts Additional options. * @param opts Additional options.
* @param opts.recipient Optional address to receive the funds on L1. Defaults to sender.
* @param opts.overrides Optional transaction overrides. * @param opts.overrides Optional transaction overrides.
* @returns Gas estimate for the transaction. * @returns Gas estimate for the transaction.
*/ */
...@@ -724,6 +747,7 @@ export interface ICrossChainMessenger { ...@@ -724,6 +747,7 @@ export interface ICrossChainMessenger {
l2Token: AddressLike, l2Token: AddressLike,
amount: NumberLike, amount: NumberLike,
opts?: { opts?: {
recipient?: AddressLike
overrides?: Overrides overrides?: Overrides
} }
): Promise<BigNumber> ): Promise<BigNumber>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment