ethereum-emissions-calculator
Advanced tools
Comparing version 1.8.1 to 1.8.2-0
@@ -16,3 +16,3 @@ "use strict"; | ||
const getSumGasUsed_1 = require("./utils/getSumGasUsed"); | ||
const getTransactions_1 = require("./utils/getTransactions"); | ||
const getAddressTransactions_1 = require("./utils/getAddressTransactions"); | ||
const validateCalculatorOptions_1 = require("./utils/validateCalculatorOptions"); | ||
@@ -29,10 +29,11 @@ /** | ||
validateCalculatorOptions_1.validateCalculatorOptions(options); | ||
const transactions = yield getTransactions_1.getTransactions(options); | ||
const filteredTransactions = filterValidOutgoingTransactions_1.filterValidOutgoingTransactions(transactions, options.address); | ||
const totalGasUsed = getSumGasUsed_1.getSumGasUsed(filteredTransactions); | ||
const { transactions, done } = yield getAddressTransactions_1.getAddressTransactions(options); | ||
const filteredTxns = filterValidOutgoingTransactions_1.filterValidOutgoingTransactions(transactions, options.address); | ||
const gasUsed = getSumGasUsed_1.getSumGasUsed(filteredTxns); | ||
return { | ||
transactionType: options.transactionType, | ||
kgCO2: Math.round(totalGasUsed * KG_CO2_PER_GAS), | ||
transactionsCount: filteredTransactions.length, | ||
gasUsed: totalGasUsed, | ||
kgCO2: Math.round(gasUsed * KG_CO2_PER_GAS), | ||
transactionsCount: filteredTxns.length, | ||
gasUsed, | ||
done, | ||
}; | ||
@@ -46,12 +47,13 @@ }); | ||
validateCalculatorOptions_1.validateCalculatorOptions(options); | ||
const transactions = yield getTransactions_1.getTransactions(options); | ||
const { transactions, done } = yield getAddressTransactions_1.getAddressTransactions(options); | ||
const filteredTransactions = filterValidTransactions_1.filterValidTransactions(transactions); | ||
const totalGasUsed = getSumGasUsed_1.getSumGasUsed(filteredTransactions); | ||
const gasUsed = getSumGasUsed_1.getSumGasUsed(filteredTransactions); | ||
return { | ||
transactionType: options.transactionType, | ||
kgCO2: Math.round(totalGasUsed * KG_CO2_PER_GAS), | ||
kgCO2: Math.round(gasUsed * KG_CO2_PER_GAS), | ||
transactionsCount: filteredTransactions.length, | ||
gasUsed: totalGasUsed, | ||
gasUsed, | ||
done, | ||
}; | ||
}); | ||
exports.calculateContractEmissions = calculateContractEmissions; |
@@ -57,2 +57,4 @@ /** This is the API response for a normal, internal, token or NFT transaction query */ | ||
gasUsed: number; | ||
/** False means the 10k limit was hit, so only the most recent 10k transactions were analyzed. */ | ||
done: boolean; | ||
} |
{ | ||
"name": "ethereum-emissions-calculator", | ||
"version": "1.8.1", | ||
"version": "1.8.2-0", | ||
"description": "TypeScript utils to calculate the CO2 emissions of an Ethereum wallet. Powered by the Etherscan.io API.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
22758
25
356
1