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

@solendprotocol/utl-sdk

v1.4.4

Published

# @solflare-wallet/utl-sdk

Downloads

760

Readme

@solflare-wallet/utl-sdk

SDK used for Unified Token List.

This SDK works by fetching token metadata using a few different strategies: using UTL backend, falling back to token list hosted on publicly available CDN, and fetching Metaplex metadata for everything else.

Contents:

Inspiration for this token list

As the current token list is coming to its end and being archived, the need for new token list was created. Previous token list was based on GitHub repo and anybody could create a PR and introduce their mint/token into that list that was used by whole community. Since PRs were loosely monitored and in huge numbers, that meant that scam tokens could be found inside the list.

Our proposition is creating an open-source transparent Unified Token List (UTL) that combines credible and trusted sources of verified token mints across the community.

Everyone will be able to independently generate the UTL, customize the list and use it or just use a pre-generated one.

Main parts of UTL are:

Installation

$ npm install @solflare-wallet/utl-sdk

Examples

Initialize the library

  1. Use the default configuration (it will create a new Solana web3 connection with public mainnet-beta rpc):
import { Client } from '@solflare-wallet/utl-sdk';

const utl = new Client();
  1. Extend your configuration with other options:
import { Client, UtlConfig } from '@solflare-wallet/utl-sdk';

const config = new UtlConfig({
  /**
   * 101 - mainnet, 102 - testnet, 103 - devnet
   */
  chainId: 101,
  /**
   * number of miliseconds to wait until falling back to CDN
   */
  timeout: 2000,
  /**
   * Solana web3 Connection
   */
  connection: new Connection('https://api.mainnet-beta.solana.com/'),
  /**
   * Backend API url which is used to query tokens
   */
  apiUrl: "https://token-list-api.solana.cloud",
  /**
   * CDN hosted static token list json which is used in case backend is down
   */
  cdnUrl: "https://cdn.jsdelivr.net/gh/solflare-wallet/token-list/solana-tokenlist.json"
});

const utl = new Client(config);

Fetching a single token

import { Client, Token } from '@solflare-wallet/utl-sdk';
import { PublicKey } from '@solana/web3.js';

const utl = new Client();
const token: Token = await utl.fetchMint(new PublicKey("So11111111111111111111111111111111111111112"));

token = {
  address: 'So11111111111111111111111111111111111111112',
  chainId: 101,
  name: 'Wrapped Solana',
  symbol: 'SOL',
  verified: true,
  decimals: 9,
  holders: 100000,
  logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png',
  tags: []
}

Fetching multiple tokens

import { Client, Token } from '@solflare-wallet/utl-sdk';
import { PublicKey } from '@solana/web3.js';

const mints = [
  new PublicKey("So11111111111111111111111111111111111111112"), // WSOL
  new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), // USDC
  new PublicKey("FjWWxNDB2uVjeaKR7nVjFjxTau85wVfAzwbLbpmJot3v") // Fake USDC (fetched from Metaplex metadata)
];

const utl = new Client();
const tokens: Token[] = await utl.fetchMints(mints);

Searching tokens

import { Client, Token } from '@solflare-wallet/utl-sdk';
import { PublicKey } from '@solana/web3.js';

const utl = new Client();
const options = { start: 0, limit: 10 };
const tokens = await utl.searchMints('slrs', options);

tokens = {
  data: [ Token, Token ],
  start: 0,
  limit: 10,
  count: 1234
}