Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b0c229ace | ||
|
|
a508e41652 |
@@ -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.1",
|
"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",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { OffChainOracle, OffChainOracles, OnChainOracles } from '../types';
|
|||||||
const bscgas: OffChainOracle = {
|
const bscgas: OffChainOracle = {
|
||||||
name: 'bscgas',
|
name: 'bscgas',
|
||||||
url: 'https://bscgas.info/gas',
|
url: 'https://bscgas.info/gas',
|
||||||
instantPropertyName: 'imediate',
|
instantPropertyName: 'instant',
|
||||||
fastPropertyName: 'fast',
|
fastPropertyName: 'fast',
|
||||||
standardPropertyName: 'standard',
|
standardPropertyName: 'standard',
|
||||||
lowPropertyName: 'slow',
|
lowPropertyName: 'slow',
|
||||||
|
|||||||
@@ -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
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,
|
||||||
|
};
|
||||||
@@ -207,9 +207,6 @@ describe('fetchMedianGasPriceOffChain', function () {
|
|||||||
|
|
||||||
describe('askOracle', function () {
|
describe('askOracle', function () {
|
||||||
it('all oracles should answer', async function () {
|
it('all oracles should answer', async function () {
|
||||||
// TODO: remove after fix POA
|
|
||||||
delete offChainOracles['poa'];
|
|
||||||
|
|
||||||
for (const o of Object.values(offChainOracles) as Array<OffChainOracle>) {
|
for (const o of Object.values(offChainOracles) as Array<OffChainOracle>) {
|
||||||
try {
|
try {
|
||||||
const gas: GasPrice = await oracle.askOracle(o);
|
const gas: GasPrice = await oracle.askOracle(o);
|
||||||
|
|||||||
Reference in New Issue
Block a user