diff --git a/README.md b/README.md index b1ff4e1..9001e6f 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ const { GasPriceOracle } = require('gas-price-oracle'); ```js const options = { defaultRpc: 'https://api.mycryptoapi.com/eth', + timeout: 10000, }; const oracle = new GasPriceOracle(options); // optional fallbackGasPrices @@ -44,6 +45,9 @@ oracle.gasPrices(fallbackGasPrices).then(gasPrices => { }); ``` +The `gasPrices` method also accepts `median` argument (`true`) by default. For more details see [below](<#Offchain-oracles-only-(get-median-price)>). +Under the hood it's a combination of `fetchMedianGasPriceOffChain`(`fetchGasPricesOffChain`) and `fetchGasPricesOnChain` methods. + ### Offchain oracles only ```js @@ -54,6 +58,18 @@ oracle.fetchGasPricesOffChain().then(gasPrices => { }); ``` +### Offchain oracles only (get median price) + +```js +const oracle = new GasPriceOracle(); + +oracle.fetchMedianGasPriceOffChain().then(gasPrices => { + console.log(gasPrices); // { instant: 50, fast: 21, standard: 10, low: 3 } +}); +``` + +it returns the median gas price of all the oracles configured. + ### Custom RPC URL for onchain oracles ```js