# open-tokenlist

> A package that contains addresses of multiple tokens across multiple blockchains in one place.

Latest version **1.0.1** (published 2021-10-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install open-tokenlist
pnpm add open-tokenlist
yarn add open-tokenlist
bun add open-tokenlist
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-10-20 |
| First published | 2021-10-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 41.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | isamjay007 |

## Links

- npm: https://www.npmjs.com/package/open-tokenlist
- Repository: https://github.com/novon-labs/open-tokenlist
- Homepage: https://github.com/novon-labs/open-tokenlist#readme
- Issues: https://github.com/novon-labs/open-tokenlist/issues
- npm.io page: https://npm.io/package/open-tokenlist

## Recent versions

- 1.0.1 (latest) — 2021-10-20
- 1.0.0 — 2021-10-20

## README

# open-tokenlist

The idea behind creating this repository is to have all of the tokens from different blockchain at one place that can be used in different application to retrieve token information across different blockchain.

## Installation

```bash
npm install open-tokenlist
```

```bash
yarn add open-tokenlist
```

## Examples

### Query available tokens

```typescript
// "CHAINS" is an ENUM that allows to choose from multiple blockchains. eg ethereum, bsc, polygon & optimism
new TokenListProvider(CHAINS.ethereum).resolve().then((tokens) => {
  const tokenList = tokens.filterByTag("stablecoin").getList();
  console.log(tokenList);
});
```

### Render icon for token in React

```typescript jsx
import React, { useEffect, useState } from 'react';
import { TokenListProvider, TokenInfo } from 'open-tokenlist';
export const Icon = (props: { mint: string }) => {
  const [tokenMap, setTokenMap] = useState<Map<string, TokenInfo>>(new Map());
  useEffect(() => {
    new TokenListProvider(CHAINS.bsc).resolve().then(tokens => {
      const tokenList = tokens.filterByTag("stablecoin").getList();
      setTokenMap(tokenList.reduce((map, item) => {
        map.set(item.address, item);
        return map;
      },new Map()));
    });
  }, [setTokenMap]);
  const token = tokenMap.get(props.mint);
  if (!token || !token.address) return null;
  return token.address;
```

## Adding new token

Submit PR with changes to JSON file `src/tokens/bsc.tokenlist.json`
Submit PR with changes to JSON file `src/tokens/polygon.tokenlist.json`
Submit PR with changes to JSON file `src/tokens/ethereum.tokenlist.json`
Submit PR with changes to JSON file `src/tokens/optimism.tokenlist.json`

Please follow the Uniswap Token List specification found here: https://github.com/Uniswap/token-lists

---
_Source: https://npm.io/package/open-tokenlist · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
