diff --git a/README.md b/README.md index 6740b6a..e60f613 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,46 @@ ## Instalation `npm i gas-price-oracle` -## Usage +## Import ```js const { GasPriceOracle } = require('gas-price-oracle'); +``` +## Usage +### Basic +```js const oracle = new GasPriceOracle(); -oracle.fetchGasPrices().then((gas) => { +oracle.gasPrices().then((gas) => { + console.log(gas) +}); +``` + +### Offchain oracles only +```js +const oracle = new GasPriceOracle(); + +oracle.fetchGasPricesOffChain().then((gas) => { + console.log(gas) +}); +``` + +### Custom RPC URL for onchain oracles +```js +const customRpc = 'https://mainnet.infura.io/v3/' +const oracle = new GasPriceOracle(customRpc); + +oracle.fetchGasPricesOnChain().then((gas) => { + console.log(gas) +}); +``` + +### Don't throw an error if oracles are down +```js +oracle.fetchGasPricesOnChain(false).then((gas) => { + console.log(gas) +}); + +oracle.fetchGasPricesOffChain(false).then((gas) => { console.log(gas) }); ``` diff --git a/package.json b/package.json index 38328c3..9b81be4 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,18 @@ { "name": "gas-price-oracle", - "version": "0.1.0", + "version": "0.1.1", "description": "Gas Price Oracle library for Ethereum dApps.", "main": "lib/index.js", "types": "lib/index.d.ts", "prepare": "npm run build", - "prepublishOnly": "npm run lint", + "prepublishOnly": "npm test && npm run lint", "scripts": { "test": "mocha --timeout 30000 -r ts-node/register tests/*.test.ts", "build": "tsc", "lint": "tslint -p tsconfig.json" }, "author": "Alexey Pertsev (https://peppersec.com)", + "keywords": ["Gas", "Gas price", "Ethereum", "Oracle"], "license": "MIT", "devDependencies": { "@types/chai": "^4.2.11",