10.0.0 • Published 9 months ago

@metamask/eth-token-tracker v10.0.0

Weekly downloads
128
License
ISC
Repository
github
Last release
9 months ago

Eth Token Tracker

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

Installation

yarn add @metamask/eth-token-tracker

Usage

const TokenTracker = require('@metamask/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()

Running tests

yarn install
yarn test
10.0.0

9 months ago

8.0.0

1 year ago

9.0.0

12 months ago

7.0.2

1 year ago

7.0.1

2 years ago

5.0.0

2 years ago

6.0.1

2 years ago

6.0.0

2 years ago

7.0.0

2 years ago

4.1.0

2 years ago

4.0.1

2 years ago

4.0.0

4 years ago

3.1.0

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.0

5 years ago