From 9b0c229acebd5906bbceec2696476eb3b9fc2718 Mon Sep 17 00:00:00 2001 From: Danil Kovtonyuk Date: Tue, 15 Jun 2021 13:26:02 +0300 Subject: [PATCH] add polygon --- README.md | 6 ++++++ package.json | 2 +- src/config/index.ts | 3 +++ src/config/polygon.ts | 23 +++++++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/config/polygon.ts diff --git a/README.md b/README.md index d126eb4..805d33a 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,12 @@ Current offchain list: - https://bscgas.info/ +### Polygon (Matic) Network + +Current offchain list: + +- https://gasstation-mainnet.matic.network/ + ## Installation `npm i gas-price-oracle` diff --git a/package.json b/package.json index 931ea7c..f251a1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gas-price-oracle", - "version": "0.3.2", + "version": "0.3.3", "description": "Gas Price Oracle library for Ethereum dApps.", "main": "lib/index.js", "homepage": "https://github.com/peppersec/gas-price-oracle", diff --git a/src/config/index.ts b/src/config/index.ts index 8ec2bee..0724d40 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,13 +1,16 @@ import { NetworkConfig } from '../types'; import mainnetOracles from './mainnet'; import binanceOracles from './binance'; +import polygonOracles from './polygon'; export enum ChainId { MAINNET = 1, BINANCE = 56, + POLYGON = 137, } export const networks: NetworkConfig = { [ChainId.MAINNET]: mainnetOracles, [ChainId.BINANCE]: binanceOracles, + [ChainId.POLYGON]: polygonOracles, }; diff --git a/src/config/polygon.ts b/src/config/polygon.ts new file mode 100644 index 0000000..d75240a --- /dev/null +++ b/src/config/polygon.ts @@ -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, +};