forked from zeropoolnetwork/zeropool-relayer
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from zkBob/feature/polygon-gasstation
Add polygon gas station
- Loading branch information
Showing
23 changed files
with
194 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './GasPrice' | ||
export * from './types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// GasPrice fields | ||
interface LegacyGasPrice { | ||
gasPrice: string | ||
} | ||
interface EIP1559GasPrice { | ||
maxFeePerGas: string | ||
maxPriorityFeePerGas: string | ||
} | ||
export type GasPriceValue = LegacyGasPrice | EIP1559GasPrice | ||
|
||
// In Gwei | ||
export interface PolygonGSV2Response { | ||
safeLow: { | ||
maxPriorityFee: number | ||
maxFee: number | ||
} | ||
standard: { | ||
maxPriorityFee: number | ||
maxFee: number | ||
} | ||
fast: { | ||
maxPriorityFee: number | ||
maxFee: number | ||
} | ||
estimatedBaseFee: number | ||
blockTime: number | ||
blockNumber: number | ||
} | ||
|
||
export type GasPriceKey = 'instant' | 'fast' | 'standard' | 'low' | ||
export type PolygonGSV2GasPriceKey = 'safeLow' | 'standard' | 'fast' | ||
|
||
// Estimation types | ||
export type EstimationEIP1559 = 'eip1559-gas-estimation' | ||
export type EstimationOracle = 'gas-price-oracle' | ||
export type EstimationWeb3 = 'web3' | ||
export type EstimationPolygonGSV2 = 'polygon-gasstation-v2' | ||
export type EstimationType = EstimationEIP1559 | EstimationOracle | EstimationWeb3 | EstimationPolygonGSV2 | ||
|
||
export type EstimationOracleOptions = { speedType: GasPriceKey; factor: number } | ||
export type EstimationPolygonGSV2Options = { speedType: GasPriceKey } | ||
export type EstimationOptions<ET extends EstimationType> = ET extends EstimationOracle | ||
? EstimationOracleOptions | ||
: ET extends EstimationPolygonGSV2 | ||
? EstimationPolygonGSV2Options | ||
: {} | ||
|
||
export type FetchFunc<ET extends EstimationType> = (_: EstimationOptions<ET>) => Promise<GasPriceValue> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import Web3 from 'web3' | ||
import config from '../config' | ||
import config from '@/config' | ||
|
||
export const web3 = new Web3(config.rpcUrl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.