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

@vinitech-pkg/easy-cripto-logos

v1.0.0

Published

Resolve TrustWallet asset logo URLs for blockchains and tokens via jsDelivr CDN

Readme

@vinitech-pkg/easy-cripto-logos

Resolve logo URLs for blockchains and ERC-20 tokens using the TrustWallet Assets repository served via jsDelivr CDN, pinned to a fixed commit hash — never @master.


Installation

npm install @vinitech-pkg/easy-cripto-logos
pnpm add @vinitech-pkg/easy-cripto-logos
yarn add @vinitech-pkg/easy-cripto-logos

Peer dependency: ethers v6 is required for EIP-55 address checksumming.

npm install ethers@^6

Supported Chains

| Canonical name | Accepted aliases | TrustWallet directory | |----------------|-------------------------------|-----------------------| | ethereum | eth | ethereum | | polygon | matic | polygon | | bsc | bnb, binance-smart-chain | smartchain | | arbitrum | arbitrum-one | arbitrum | | avalanche | avax | avalanchec | | optimism | op | optimism | | tron | trx | tron |

All aliases are case-insensitive. An unsupported value throws an error with the full list of valid options.


Usage

Native token logo

import { getNativeLogoUrl } from "@vinitech-pkg/easy-cripto-logos";

const ethLogo = getNativeLogoUrl({ chain: "ethereum" });
// https://cdn.jsdelivr.net/gh/trustwallet/assets@4eb147bf.../blockchains/ethereum/info/logo.png

const maticLogo = getNativeLogoUrl({ chain: "matic" }); // alias for polygon

ERC-20 token logo

import { getTokenLogoUrl } from "@vinitech-pkg/easy-cripto-logos";

const usdtLogo = getTokenLogoUrl({
  chain: "ethereum",
  address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
});
// Address is automatically converted to EIP-55 checksum format.
// https://cdn.jsdelivr.net/gh/trustwallet/assets@.../blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png

resolveLogo — unified resolver

import { resolveLogo } from "@vinitech-pkg/easy-cripto-logos";

// No address → native token logo
resolveLogo({ chain: "ethereum" });

// Address provided → token logo with checksummed address
resolveLogo({
  chain: "polygon",
  address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
});

// customLogoUrl provided → returned as-is, takes priority over everything
resolveLogo({
  chain: "bsc",
  address: "0x55d398326f99059fF775485246999027B3197955",
  customLogoUrl: "https://my-cdn.example.com/usdt.png",
});
// → "https://my-cdn.example.com/usdt.png"

Priority: customLogoUrl > token (address) > native chain logo.


API Reference

getNativeLogoUrl(options: NativeOptions): string

Returns the CDN URL for a chain's native token logo.

| Parameter | Type | Description | |-----------|----------|------------------------------------------| | chain | string | Chain name or alias (e.g. "eth", "matic") |


getTokenLogoUrl(options: TokenOptions): string

Returns the CDN URL for an ERC-20 token logo. The address is automatically converted to EIP-55 checksum format.

| Parameter | Type | Description | |-----------|----------|--------------------------------------------------| | chain | string | Chain name or alias | | address | string | Token contract address (any casing accepted) |


resolveLogo(input: LogoInput): string

Unified resolver that selects the correct URL based on available inputs.

| Parameter | Type | Description | |-----------------|-----------|------------------------------------------------------------------| | chain | string | Chain name or alias | | address | string? | Token contract address — if provided, returns token logo | | customLogoUrl | string? | Override URL — returned as-is when provided, highest priority |


normalizeChain(chain: string): SupportedChain

Converts any chain name or alias to its canonical SupportedChain value. Throws if the chain is not supported.


toChecksum(address: string): string

Converts an Ethereum address to its EIP-55 checksummed form using ethers.getAddress.


React Example with Fallback

import { resolveLogo } from "@vinitech-pkg/easy-cripto-logos";

interface TokenLogoProps {
  chain: string;
  address?: string;
  customLogoUrl?: string;
  alt: string;
  size?: number;
}

export function TokenLogo({ chain, address, customLogoUrl, alt, size = 32 }: TokenLogoProps) {
  const src = resolveLogo({ chain, address, customLogoUrl });

  return (
    <img
      src={src}
      alt={alt}
      width={size}
      height={size}
      onError={(e) => {
        (e.currentTarget as HTMLImageElement).src = "/fallback-token.png";
      }}
    />
  );
}
// Native token
<TokenLogo chain="ethereum" alt="ETH" />

// ERC-20 token
<TokenLogo chain="polygon" address="0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" alt="USDC" />

// Custom override
<TokenLogo chain="bsc" customLogoUrl="https://my-cdn.example.com/usdt.png" alt="USDT" />

Updating the TrustWallet Commit

All CDN URLs are pinned to a fixed commit hash from the TrustWallet Assets repository. This guarantees URL stability across builds and deployments.

To update to a newer snapshot:

  1. Open https://github.com/trustwallet/assets/commits/master
  2. Click the commit you want to pin and copy the full SHA (40 characters)
  3. Open src/constants.ts and replace the value of TRUSTWALLET_COMMIT:
// src/constants.ts
export const TRUSTWALLET_COMMIT = "YOUR_NEW_COMMIT_SHA_HERE";
  1. Rebuild the package:
npm run build
  1. Publish the new version:
npm publish --access public

Build

npm install
npm run build

Output in dist/:

| File | Format | |-------------------|------------| | index.mjs | ESM | | index.js | CommonJS | | index.d.mts | TS types (ESM) | | index.d.ts | TS types (CJS) |


Publish

npm publish --access public

License

MIT