1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { Provider, TransactionRequest } from '@ethersproject/abstract-provider'
import { BigNumber } from 'ethers'
/**
* Represents an extended version of an normal ethers Provider that returns additional L2 info and
* has special functions for L2-specific interactions.
*/
export interface L2Provider extends Provider {
/**
* Gets the current L1 (data) gas price.
*
* @returns Current L1 data gas price in wei.
*/
getL1GasPrice(): Promise<BigNumber>
/**
* Estimates the L1 (data) gas required for a transaction.
*
* @param tx Transaction to estimate L1 gas for.
* @returns Estimated L1 gas.
*/
estimateL1Gas(tx: TransactionRequest): Promise<BigNumber>
/**
* Estimates the L1 (data) gas cost for a transaction in wei by multiplying the estimated L1 gas
* cost by the current L1 gas price.
*
* @param tx Transaction to estimate L1 gas cost for.
* @returns Estimated L1 gas cost.
*/
estimateL1GasCost(tx: TransactionRequest): Promise<BigNumber>
/**
* Estimates the L2 (execution) gas cost for a transaction in wei by multiplying the estimated L1
* gas cost by the current L2 gas price. This is a simple multiplication of the result of
* getGasPrice and estimateGas for the given transaction request.
*
* @param tx Transaction to estimate L2 gas cost for.
* @returns Estimated L2 gas cost.
*/
estimateL2GasCost(tx: TransactionRequest): Promise<BigNumber>
/**
* Estimates the total gas cost for a transaction in wei by adding the estimated the L1 gas cost
* and the estimated L2 gas cost.
*
* @param tx Transaction to estimate total gas cost for.
* @returns Estimated total gas cost.
*/
estimateTotalGasCost(tx: TransactionRequest): Promise<BigNumber>
}