npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

asset-tracker

v1.6.0

Published

Asset tracker to track all your multichain assets.

Downloads

2

Readme

Asset Tracker

Asset tracker is a one-stop library for the user to track their assets and holdings across multiple EVM and Non EVM chains.

This library will be updated continuously with more and more chain support and increasing granularity of data.

Installation and Usage

Installation

Install the library by running the command,

npm install --save asset-tracker

Import the library into your project using,

const assetTracker = require('asset-tracker');

Initialization

This library comes with 2 different classes. One is EVM and other is nonEVM with each class catering to their own set of chains and functionality.

Initialize the classes

// Initialize the EVM class
const tracker = new assetTracker.EVM(evmChain);

// Initialize the non EVM class
const tracker = new assetTracker.nonEVM(nonEvmChain);

Methods

Get Native Asset Balance

Returns the native asset balance of the initialized chain.

const nativeAssetbalance = await tracker.getNativeAssetBalance(address);
  • address (required) - Address for which the native asset balance is to be fetched. Can be a contract address or an EOA.

Discover Fungible Assets

Scans the address for any fungible asset balances and returns the same.

const fungibleAssets = await tracker.discoverFungibleAssets(address);
  • address (required) - Address for which the list of fungible assets is to be checked.

Discover Non Fungible Assets (NFTs)

Scans the address for any non fungible assets and returns the same.

const nonFungibleAssets = await tracker.discoverNonFungibleAssets(address);
  • address (required) - Address for which the list of non fungible assets is to be checked.

Get the list of transactions

Returns the list of transactions for the specified address. The function also accepts an option parameter type which accepts the values incoming or outgoing to filter out the transactions.

const transactions = await tracker.getTransactions({ address, page, limit, type });
  • address (required) - Address for which the list of transactions is to be fetched.
  • page (required) - Page number for pagination.
  • limit (required) - Number of results to be returned in every page for pagination.
  • type (optional. default = all) - Parameter to filter out the incoming or outgoing transactions. Defaults to all.

Get the token details for a particular fungible token address

Returns the basic info about a particular fungible asset.

const fungibleAssetInfo = await tracker.getFungibleTokenDetails(contractAddress);
  • contractAddress (required) - Contract address of the fungible token.

Get the token details for a particular non fungible (NFT) token address

Returns the basic info about a particular non fungible asset.

const nonFungibleAssetInfo = await tracker.getNFTDetails(contractAddress);
  • contractAddress (required) - Contract address of the non fungible token.

Switch Chains

Switch between different supported chains. Once the chain is switched, all the subsequent functions will work for this new chain.

switchChain(chainName);
  • chainName (required) - Name of the new chain to be switched.

Get Supported Chains (filter by function name)

This function will return the list of all the supported chains. The user can pass an optional parameter functionName which will return all the chains that supports this particular functionality.

getSupportedChains(functionName);
  • functionName (optional. defaults to all) - Name of the function to be checked for chain support.

Get Native Asset Details

This function will return the details of the native asset of the chain initialized.

getNativeAssetDetails();

Note Please note that currently, this library only supports EVM chains. Will soon be adding support for non EVM chains.