Socket
Socket
Sign inDemoInstall

@brave/eth-token-tracker

Package Overview
Dependencies
136
Maintainers
9
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @brave/eth-token-tracker

A module for tracking Ethereum token balances over block changes.


Version published
Maintainers
9
Install size
21.3 MB
Created

Changelog

Source

[3.1.0] - 2020-11-17

  • Add ability to include tokens with balance errors in update events, behind an option flag (#53)

Readme

Source

Eth Token Tracker CircleCI

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

Installation

npm install '@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()

Keywords

FAQs

Last updated on 04 Feb 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc