eth-gas-reporter
Advanced tools
Comparing version 0.2.15 to 0.2.16
## Changelog: eth-gas-reporter | ||
# 0.2.15 / 2020-02-12 | ||
- Use parser-diligence to parse Solidity 0.6.x | ||
- Add option to show full method signature | ||
# 0.2.14 / 2019-12-01 | ||
@@ -4,0 +9,0 @@ |
@@ -11,2 +11,4 @@ /** | ||
this.currency = options.currency || "eur"; | ||
this.coinmarketcap = | ||
options.coinmarketcap || "d25b5576-a4ee-41be-bb2b-aca2ba3ae5d8"; | ||
this.ethPrice = options.ethPrice || null; | ||
@@ -13,0 +15,0 @@ this.gasPrice = options.gasPrice || null; |
@@ -63,7 +63,9 @@ const ethersABI = require("@ethersproject/abi"); | ||
if (contract.deployed && contract.deployed.transactionHash) { | ||
this.trackNameByAddress(name, contract.deployed.address); | ||
const receipt = this.sync.getTransactionReceipt( | ||
contract.deployed.transactionHash | ||
); | ||
contractInfo.gasData.push(utils.gas(receipt.gasUsed)); | ||
if (receipt) { | ||
this.trackNameByAddress(name, contract.deployed.address); | ||
contractInfo.gasData.push(utils.gas(receipt.gasUsed)); | ||
} | ||
} | ||
@@ -70,0 +72,0 @@ |
@@ -126,6 +126,8 @@ const fs = require("fs"); | ||
const ethgasstation = `https://ethgasstation.info/json/ethgasAPI.json`; | ||
const coinmarketcap = `https://api.coinmarketcap.com/v1/ticker/ethereum/?convert=`; | ||
const coinmarketcap = | ||
`https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/` + | ||
`latest?symbol=ETH&CMC_PRO_API_KEY=${config.coinmarketcap}&convert=`; | ||
const currencyPath = `${coinmarketcap}${config.currency.toUpperCase()}`; | ||
const currencyKey = `price_${config.currency.toLowerCase()}`; | ||
const currencyKey = config.currency.toUpperCase(); | ||
const currencyPath = `${coinmarketcap}${currencyKey}`; | ||
@@ -137,3 +139,3 @@ // Currency market data: coinmarketcap | ||
response = JSON.parse(response); | ||
config.ethPrice = response[0][currencyKey]; | ||
config.ethPrice = response.data.ETH.quote[currencyKey].price.toFixed(2); | ||
} catch (error) { | ||
@@ -140,0 +142,0 @@ config.ethPrice = null; |
{ | ||
"name": "eth-gas-reporter", | ||
"version": "0.2.14", | ||
"version": "0.2.15", | ||
"description": "Mocha reporter which shows gas used per unit test.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
{ | ||
"name": "eth-gas-reporter", | ||
"version": "0.2.15", | ||
"version": "0.2.16", | ||
"description": "Mocha reporter which shows gas used per unit test.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -73,19 +73,28 @@ # eth-gas-reporter | ||
| Option | Type | Default | Description | | ||
| ----------------- | ---------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
:warning: **CoinMarketCap API change** :warning: | ||
Beginning March 2020, CoinMarketCap requires an API key to access currency market | ||
price data. The reporter uses an unprotected free tier key by default (10k reqs/mo). You can get | ||
your own API key [here][55] and set it with the `coinmarketcap` option. | ||
| Option | Type | Default | Description | | ||
| ----------------- | ---------------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| currency | _String_ | 'EUR' | National currency to represent gas costs in. Exchange rates loaded at runtime from the `coinmarketcap` api. Available currency codes can be found [here](https://coinmarketcap.com/api/documentation/v1/#section/Standards-and-Conventions). | | ||
| gasPrice | _Number_ | (varies) | Denominated in `gwei`. Default is loaded at runtime from the `eth gas station` api | | ||
| outputFile | _String_ | stdout | File path to write report output to | | ||
| noColors | _Boolean_ | false | Suppress report color. Useful if you are printing to file b/c terminal colorization corrupts the text. | | ||
| onlyCalledMethods | _Boolean_ | true | Omit methods that are never called from report. | | ||
| rst | _Boolean_ | false | Output with a reStructured text code-block directive. Useful if you want to include report in RTD | | ||
| rstTitle | _String_ | "" | Title for reStructured text header (See Travis for example output) | | ||
| showTimeSpent | _Boolean_ | false | Show the amount of time spent as well as the gas consumed | | ||
| excludeContracts | _String[]_ | [] | Contract names to exclude from report. Ex: `['Migrations']` | | ||
| src | _String_ | "contracts" | Folder in root directory to begin search for `.sol` files. This can also be a path to a subfolder relative to the root, e.g. "planets/annares/contracts" | | ||
| url | _String_ | `web3.currentProvider.host` | RPC client url (ex: "http://localhost:8545") | | ||
| proxyResolver | _Function_ | none | Custom method to resolve identity of methods managed by a proxy contract. | | ||
| artifactType | _Function_ or _String_ | "truffle-v5" | Compilation artifact format to consume. (See [advanced use](https://github.com/cgewecke/eth-gas-reporter/blob/master/docs/advanced.md).) | | ||
| coinmarketcap | _String_ | (unprotected API key) | [API key][55] to use when fetching current market price data. (Use this if you stop seeing price data) | | ||
| gasPrice | _Number_ | (varies) | Denominated in `gwei`. Default is loaded at runtime from the `eth gas station` api | | ||
| outputFile | _String_ | stdout | File path to write report output to | | ||
| noColors | _Boolean_ | false | Suppress report color. Useful if you are printing to file b/c terminal colorization corrupts the text. | | ||
| onlyCalledMethods | _Boolean_ | true | Omit methods that are never called from report. | | ||
| rst | _Boolean_ | false | Output with a reStructured text code-block directive. Useful if you want to include report in RTD | | ||
| rstTitle | _String_ | "" | Title for reStructured text header (See Travis for example output) | | ||
| showTimeSpent | _Boolean_ | false | Show the amount of time spent as well as the gas consumed | | ||
| excludeContracts | _String[]_ | [] | Contract names to exclude from report. Ex: `['Migrations']` | | ||
| src | _String_ | "contracts" | Folder in root directory to begin search for `.sol` files. This can also be a path to a subfolder relative to the root, e.g. "planets/annares/contracts" | | ||
| url | _String_ | `web3.currentProvider.host` | RPC client url (ex: "http://localhost:8545") | | ||
| proxyResolver | _Function_ | none | Custom method to resolve identity of methods managed by a proxy contract. | | ||
| artifactType | _Function_ or _String_ | "truffle-v5" | Compilation artifact format to consume. (See [advanced use](https://github.com/cgewecke/eth-gas-reporter/blob/master/docs/advanced.md).) | | ||
| showMethodSig | _Boolean_ | false | Display complete method signatures. Useful when you have overloaded methods you can't tell apart. | | ||
[55]: https://coinmarketcap.com/api/pricing/ | ||
### Advanced Use | ||
@@ -135,1 +144,2 @@ | ||
- [@gnidan](https://github.com/gnidan) | ||
- [@fodisi](https://github.com/fodisi) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118038
1881
144