From 211d68eeba6000ac933b252959d8f9daeb1c898a Mon Sep 17 00:00:00 2001 From: Roman Storm Date: Fri, 13 Mar 2020 10:51:06 -0700 Subject: [PATCH] update fetcher --- config.js | 4 ++-- src/Fetcher.js | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/config.js b/config.js index fada439..a259ea4 100644 --- a/config.js +++ b/config.js @@ -144,8 +144,8 @@ module.exports = { } } }, - defaultGasPrice: 2, - gasOracleUrls: ['https://ethgasstation.info/json/ethgasAPI.json', 'https://gasprice.poa.network/'], + defaultGasPrice: 20, + gasOracleUrls: ['https://ethgasstation.info/json/ethgasAPI.json', 'https://gas-oracle.zoltu.io/'], port: process.env.APP_PORT, relayerServiceFee: Number(process.env.RELAYER_FEE) } \ No newline at end of file diff --git a/src/Fetcher.js b/src/Fetcher.js index 711bf4e..6ef11f6 100644 --- a/src/Fetcher.js +++ b/src/Fetcher.js @@ -56,18 +56,14 @@ class Fetcher { throw new Error('Fetch gasPrice failed') } - if (json.slow) { - this.gasPrices.low = Number(json.slow) / delimiter - } - if (json.safeLow) { - this.gasPrices.low = Number(json.safeLow) / delimiter - } - if (json.standard) { - this.gasPrices.standard = Number(json.standard) / delimiter - } if (json.fast) { this.gasPrices.fast = Number(json.fast) / delimiter } + + if (json.percentile_97) { + this.gasPrices.fast = parseInt(json.percentile_90) + 1 / delimiter + } + console.log('gas price fetch', this.gasPrices) } else { throw Error('Fetch gasPrice failed') }