!!!WIP currently dogfooding and tweaking!!!
INSTALL | IMPORT | USE | CONTRIBUTE | DOCS
Easily fetch tokens from popular token indexers.
Currently supports Tezos, but it is designed in a chain agnostic way. If you've got indexers for a chain we can add them!
Works in browser and server.
npm install token-fetch
npm install token-fetch-browser
// import/export
import {factory, providers: {Tezos}} from 'token-fetch';
// CommonJS
const {factory, providers: {Tezos}} = require('token-fetch');
// Browser
const {factory, providers: {Tezos}} = window.TokenFetchJS;
const TeiaIndexer = new Tezos.TeiaRocks('teia-indexer');
const FxhashIndexer = new Tezos.FxhashNative('fxhash-indexer');
const tezosFetcher = factory([TeiaIndexer, FxhashIndexer]);
const {
tokens: pageOneTokens, // Set of token metadata
cursor: pageTwoCursor // Sequential pagination cursor
} = await tezosFetcher.fetchTokens(TOKEN_QUERY);
const {
tokens: pageTwoTokens,
cursor: pageThreeCursor
} = await tezosFetcher.fetchTokens(TOKEN_QUERY, pageTwoCursor);
- Clone
- Improve
- Document
- Test
- PR
All are welcome!