Skip to content

nofungible/token-fetch-js

Repository files navigation

TokenFetchJS

!!!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.

Install

npm install token-fetch

npm install token-fetch-browser

Import

// import/export
import {factory, providers: {Tezos}} from 'token-fetch';

// CommonJS
const {factory, providers: {Tezos}} = require('token-fetch');

// Browser
const {factory, providers: {Tezos}} = window.TokenFetchJS;

Use

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

Token query schema

Token metadata schema

Contribute

  • Clone
  • Improve
  • Document
  • Test
  • PR

All are welcome!

About

Easily fetch tokens from popular token indexers.

Resources

Stars

Watchers

Forks

Packages

No packages published