This package has been deprecated

Author message:

This package has been renamed to @metamask/eth-token-tracker, please use the scoped package

eth-token-tracker

1.1.11 • Public • Published

Eth Token Tracker CircleCI

A JS module for tracking Ethereum tokens and their values over time.

Installation

npm install eth-token-tracker -S

Usage

const TokenTracker = require('eth-token-tracker')
 
var tokenTracker = new TokenTracker({
 
  userAddress: addresses[0], // whose balance to track
  provider,                  // a web3-style provider
  pollingInterval: 4000,     // block polling interval (optional)
 
  // Tell it about the tokens to track:
  tokens: [
    {
      address: tokenAddress,
    }
  ],
})
 
// You can use this method to check the state of the tokens
var balances = tokenTracker.serialize()
 
// You can also subscribe to updates
tokenTracker.on('update', function (balances) {
  console.log(`Your balance of ${balances[0].symbol} is ${balances[0].string}`)
})
 
// You can add additional tokens after initialization:
tokenTracker.add({ address: otherTokenAddress })
 
// Make sure to clean up, or it will hold a reference:
tokenTracker.stop()

/eth-token-tracker/

    Package Sidebar

    Install

    npm i eth-token-tracker

    Weekly Downloads

    3

    Version

    1.1.11

    License

    ISC

    Unpacked Size

    52.1 kB

    Total Files

    18

    Last publish

    Collaborators

    • mcmire
    • nicholasellul
    • lgbot
    • naugtur
    • ritave
    • danfinlay
    • kumavis
    • rekmarks
    • metamaskbot
    • gudahtt
    • brad.decker
    • sethkfman