coin-library
v1.1.2
Published
Cryptocurrency and token icons plus bank icons as a reusable asset library
Maintainers
Readme
coin-library
A package of cryptocurrency and token icons plus bank icons you can use in apps and sites. Coins are exposed by name (e.g. bitcoin, ethereum); banks use slug-style names (e.g. amar-bank, bca). Both use a small, consistent API.
Installation
Use locally (no publish):
# From your project
npm install C:\Projects\coin-library
# or
npm install /path/to/coin-libraryAfter publishing to npm:
npm install coin-libraryUsage
Node / bundlers (CommonJS)
const { getPath, getFile, list, count, getBankPath, getBankFile, listBanks, countBanks } = require('coin-library');
// ---- Coins ----
const path = getPath('bitcoin'); // absolute path to coin icon
const file = getFile('ethereum'); // "ethereum.png"
const coins = list(); // [{ name, file, slug }, ...]
console.log(count()); // 659
// ---- Banks ----
const bankPath = getBankPath('amar-bank'); // absolute path to bank icon
const bankFile = getBankFile('bca'); // e.g. "banks/private-banks/bca.png"
const banks = listBanks(); // [{ name, file, slug }, ...]
console.log(countBanks()); // 157ESM
import { getPath, getFile, list, count, getBankPath, getBankFile, listBanks, countBanks } from 'coin-library';
const path = getPath('1inch');
const file = getFile('ethereum');
const all = list();
const bankPath = getBankPath('amar-bank');
const bankFile = getBankFile('bca');
const allBanks = listBanks();TypeScript
Types are included. Import as above; list() returns CoinEntry[], and listBanks() returns BankEntry[] (same shape: name, file, slug).
In the browser
If you bundle the app (Vite, Webpack, etc.), use getPath() or getFile() and point your asset pipeline at the returned path so the PNG is copied or referenced. For a simple setup, use getFile('bitcoin') and serve the node_modules/coin-library/*.png files from your static server at a route like /icons/, then use <img src="/icons/bitcoin.png" />.
Name matching
Coins: matched case-insensitive and by slug (spaces become hyphens). Examples:
getPath('bitcoin')→bitcoin.pnggetPath('Bitcoin')→ samegetPath('binance coin')→binance coin.png(file has a space)
Banks: use slug-style names (lowercase, hyphens). Examples:
getBankPath('amar-bank')→ path to that bank’s PNGgetBankPath('BCA')→ same (case-insensitive)getBankFile('bca-digital')→"banks/private-banks/bca-digital.png"
API
Coins
| Method | Returns | Description |
|------------------|-------------------|------------------------------------------|
| getPath(name) | string \| null | Absolute filesystem path to the coin PNG |
| getFile(name) | string \| null | Relative path (e.g. "icons/bitcoin.png") |
| list() | CoinEntry[] | All coins (name, file, slug) |
| count() | number | Number of coin icons |
Banks
| Method | Returns | Description |
|-----------------------|-------------------|------------------------------------------|
| getBankPath(name) | string \| null | Absolute filesystem path to the bank PNG |
| getBankFile(name) | string \| null | Relative path (e.g. "banks/.../amar-bank.png") |
| listBanks() | BankEntry[] | All banks (name, file, slug) |
| countBanks() | number | Number of bank icons |
Rebuilding the manifest
If you add or remove PNG files in the package, regenerate the manifest:
cd node_modules/coin-library # or your package path
npm run build:manifestOr from the package source:
cd /path/to/coin-library
node build-manifest.jsLicense
MIT
