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 🙏

© 2026 – Pkg Stats / Ryan Hefner

solana-token-api

v1.0.2

Published

[![NPM Version](https://img.shields.io/npm/v/solana-token-api.svg)](https://www.npmjs.com/package/solana-token-api) [![NPM Downloads](https://img.shields.io/npm/dm/solana-token-api.svg)](https://www.npmjs.com/package/solana-token-api) [![License](https

Downloads

27

Readme

✨ Solana Token API 🚀

NPM Version NPM Downloads License

The ultimate, easiest way to fetch comprehensive Solana token data for any wallet address!

Tired of juggling multiple APIs and complex setups just to get basic token information like names, symbols, logos, prices, and USD values for a Solana wallet? Look no further! solana-token-api is designed from the ground up for simplicity and power.

With just one single function call, you get everything you need. Seriously, it's that easy.


🤔 Why Choose solana-token-api?

  • ✅ All-in-One Data: Get token name, symbol, logo, current price, amount held, and total valueUSD in a single response.
  • ⚡️ Dead Simple API: Forget complex configurations. Just import getAddressTokens and call it with a wallet address. That's it!
  • 💰 Accurate Pricing: Leverages the powerful Jupiter Price API for reliable, up-to-date token prices.
  • 🖼️ Rich Metadata: Uses the Metaplex standard (@metaplex-foundation/js) to fetch accurate token names, symbols, and logos.
  • 🚀 Built for Solana Developers: Perfect for wallets, portfolio trackers, dashboards, or any application needing quick access to Solana token data.
  • ⚙️ Lightweight & Focused: Does one job and does it exceptionally well.

💾 Installation

# Using npm
npm install solana-token-api @solana/web3.js

# Using yarn
yarn add solana-token-api @solana/web3.js

(Note: @solana/web3.js is a peer dependency, as you'll need it to establish a Connection to the Solana network.)

🚀 Quick Start: Get Token Data in Seconds!

It truly couldn't be simpler. See for yourself:

const { getAddressTokens } = require('solana-token-api');
const { Connection, PublicKey } = require('@solana/web3.js');

const connection = new Connection('https://api.mainnet-beta.solana.com', 'confirmed');

const walletAddress = 'YOUR_SOLANA_WALLET_ADDRESS_HERE'; // Replace with actual address

async function fetchTokenData() {
  try {
    const tokens = await getAddressTokens(connection, walletAddress);
    console.log('Fetched Tokens:', tokens);
  } catch (error) {
    console.error('Error fetching token data:', error);
  }
}

fetchTokenData();

📚 API Reference

getAddressTokens(connection, address)

The one and only function you need to use! Fetches all SPL tokens held by a given Solana wallet address, enriching them with metadata and pricing information.

Parameters:

  • connection: An instance of @solana/web3.js Connection.
  • address: string

Returns:

  • mint: string - The mint address of the token.
  • amount: number - The quantity of the token held by the wallet (parsed UI amount).
  • name: string - The full name of the token (e.g., "USD Coin"). Defaults to "UNKNOWN" if not found.
  • symbol: string - The symbol of the token (e.g., "USDC"). Defaults to "UNKNOWN" if not found.
  • logo: string - A URL to the token's logo image. Defaults to "UNKNOWN" if not found.
  • price: number - The current price of one token in USD. Defaults to "0" if pricing data is unavailable.
  • valueUSD: string - The total value of the tokens held in USD, formatted to two decimal places (e.g., "150.75").

🙌 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page or submit a pull request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.