use-token
[<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)
Last updated 3 months ago by bpierre .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install use-token 
SYNC missed versions from official npm registry.

???? useToken()

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

Usage

Add it to your project:

yarn add use-token

Use it in your React app:

// 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

<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")

Current Tags

  • 0.2.0                                ...           latest (3 months ago)

4 Versions

  • 0.2.0                                ...           3 months ago
  • 0.1.2                                ...           3 months ago
  • 0.1.1                                ...           8 months ago
  • 0.1.0                                ...           8 months ago
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 1
Last Month 3
Dependencies (1)
Dev Dependencies (4)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |