# use-token

> [](https://www.npmjs.com/package/use-token) [](https://bundlephobia.com/result?p=use-token)

Latest version **0.2.0** (published 2020-07-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-token
pnpm add use-token
yarn add use-token
bun add use-token
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2020-07-23 |
| First published | 2020-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | Aragon Association |
| Maintainers | andy-hook, aragon-ci, bingen, bpierre, evalir, facuspagnuolo, gabrielg, izqui, luisivan, sohkai |

## Links

- npm: https://www.npmjs.com/package/use-token
- Repository: https://github.com/aragon/use-token
- Homepage: https://github.com/aragon/use-token#readme
- npm.io page: https://npm.io/package/use-token

## Dependencies (1)

- [js-sha3](https://npm.io/package/js-sha3.md) ^0.8.0

## Recent versions

- 0.2.0 (latest) — 2020-07-23
- 0.1.2 — 2020-07-23
- 0.1.1 — 2020-02-22
- 0.1.0 — 2020-02-22

## README

# 💰 useToken()

[<img src="https://img.shields.io/npm/v/use-token" alt="" />](https://www.npmjs.com/package/use-token) [<img src="https://img.shields.io/bundlephobia/minzip/use-token" alt="" />](https://bundlephobia.com/result?p=use-token)

useToken() allows to get information related to a token on Ethereum (for now; other networks will follow).

## Usage

Add it to your project:

```console
yarn add use-token
```

Use it in your React app:

```jsx
// App.js

import React from 'react'
import { useToken, UseTokenProvider } from 'use-token'

function App() {
  const token = useToken('0xcD62b1C403fa761BAadFC74C525ce2B51780b184')

  return (
    <div>
      <h1>{token.name}</h1>
      <img src={token.iconUrl} alt={token.symbol} />
    </div>
  )
}

// Wrap everything in <UseTokenProvider />
export default () => (
  <UseTokenProvider>
    <App />
  </UseTokenProvider>
)
```

## API

### &lt;UseTokenProvider />

This is the provider component. It should be placed above any component using useToken().

### useToken()

This is the hook to be used throughout the app. It takes the address of the token as a parameter, and returns an object representing the token, containing:

- `iconUrl`: URL of the icon.
- `symbol`: The symbol of the token (e.g. `"ANJ"`)
- `name`: The name of the token (e.g. `"Aragon Network Juror"`)

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