EAC Counter
A library that fetches the amount of ETH (and USD) transferred using the Ethereum Alarm Clock.
Installation
npm install eac-counter
Usage
import EacCounter from 'eac-counter';
const eacCounter = new EacCounter({
nomicsApiKey: '<nomics_api_key>',
etherscanApiKey: '<etherscan_api_key>',
});
await eacCounter.enableUSDFetching();
const { eth, usd } = await eacCounter.getTotalTransferred();
console.log(eth);
console.log(usd);
Browser usage
To use this library in the browser, download and import the browser-compatible file into your HTML file.
<script src="eac-counter.browser.js"></script>
This will expose the EacCounter
to the window object. You can then use the following code to fetch the counter:
const eacCounter = new EacCounter({
nomicsApiKey: '<nomics_api_key>',
etherscanApiKey: '<etherscan_api_key>',
});
eacCounter.enableUSDFetching().then(function () {
eacCounter.getTotalTransferred().then(function (value) {
console.log(value.eth);
console.log(value.usd);
});
});