💰 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' { const token = return <div> <h1>tokenname</h1> <img = = /> </div> } // Wrap everything in <UseTokenProvider /> <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"
)