Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ethereum-emissions-calculator

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethereum-emissions-calculator - npm Package Compare versions

Comparing version 1.8.1 to 1.8.2-0

lib/utils/getAddressTransactions.d.ts

24

lib/index.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc