add polygon

This commit is contained in:
Danil Kovtonyuk 2021-06-15 13:26:02 +03:00
parent a508e41652
commit 9b0c229ace
4 changed files with 33 additions and 1 deletions

@ -24,6 +24,12 @@ Current offchain list:
- https://bscgas.info/ - https://bscgas.info/
### Polygon (Matic) Network
Current offchain list:
- https://gasstation-mainnet.matic.network/
## Installation ## Installation
`npm i gas-price-oracle` `npm i gas-price-oracle`

@ -1,6 +1,6 @@
{ {
"name": "gas-price-oracle", "name": "gas-price-oracle",
"version": "0.3.2", "version": "0.3.3",
"description": "Gas Price Oracle library for Ethereum dApps.", "description": "Gas Price Oracle library for Ethereum dApps.",
"main": "lib/index.js", "main": "lib/index.js",
"homepage": "https://github.com/peppersec/gas-price-oracle", "homepage": "https://github.com/peppersec/gas-price-oracle",

@ -1,13 +1,16 @@
import { NetworkConfig } from '../types'; import { NetworkConfig } from '../types';
import mainnetOracles from './mainnet'; import mainnetOracles from './mainnet';
import binanceOracles from './binance'; import binanceOracles from './binance';
import polygonOracles from './polygon';
export enum ChainId { export enum ChainId {
MAINNET = 1, MAINNET = 1,
BINANCE = 56, BINANCE = 56,
POLYGON = 137,
} }
export const networks: NetworkConfig = { export const networks: NetworkConfig = {
[ChainId.MAINNET]: mainnetOracles, [ChainId.MAINNET]: mainnetOracles,
[ChainId.BINANCE]: binanceOracles, [ChainId.BINANCE]: binanceOracles,
[ChainId.POLYGON]: polygonOracles,
}; };

23
src/config/polygon.ts Normal file

@ -0,0 +1,23 @@
import { OffChainOracle, OffChainOracles, OnChainOracles } from '../types';
const maticGasStation: OffChainOracle = {
name: 'maticGasStation',
url: 'https://gasstation-mainnet.matic.network',
instantPropertyName: 'fastest',
fastPropertyName: 'fast',
standardPropertyName: 'standard',
lowPropertyName: 'safeLow',
denominator: 1,
additionalDataProperty: null,
};
export const offChainOracles: OffChainOracles = {
maticGasStation,
};
export const onChainOracles: OnChainOracles = {};
export default {
offChainOracles,
onChainOracles,
};