npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tokenrunners/sdk

v1.8.0

Published

A client facing SDK library for interacting with the token runners application and the blockchain.

Readme

Token Runners SDK

A client facing SDK library for interacting with the token runners application and the blockchain.

Installing

Install the following packages in your project

npm i --save @tokenrunners/[email protected]
npm i --save-dev @tokenrunners/plugin

The webpack plugin

Create a file called webpack.config.js on the root of your project, this guide assumes you're using nullstack.

const [ server, client ] = require('nullstack/webpack.config');
const { applyTokenRunnersSDKPlugin } = require('@tokenrunners/plugin')

module.exports = applyTokenRunnersSDKPlugin([server, client])

Usage

Connect to a wallet


import TokenRunners, { NetworkType, WalletType } from '@tokenrunners/sdk'

const tokenRunnersSdk = new TokenRunners({
  settings: {
    baseURL: 'http://tokenrunners.localhost:3000',
  },
})

async function login() {

  const { token } = await tokenRunnersSdk.connect({
    // blockchain network type
    network: NetworkType.Ethereum,
    // wallet type to use
    walletType: WalletType.Metamask,
  });

  console.log('logged in', token);

}

login();

Disconnecting from a wallet

Assuming we already have the token runners instance and the imports above

async function logout() {

  await tokenRunnersSdk.disconnect({
    // blockchain network type
    network: NetworkType.Ethereum,
    // wallet type to use
    walletType: WalletType.Metamask,
  });

}

logout();

Fetch Store data

In order to fetch the store data and its available filters, you can use this function.

It uses the store url set on initialization as a way to identify the store.

async function fetchStore() {

  const result = await tokenRunnersSdk.fetchStore();

  console.log(result)

}

fetchStore();

Fetch Available NFTs For Sale

This function paginates the nfts that are available for sale on the specified store.

All parameters are optional.

async function fetchNfts() {

  const result = await tokenRunnersSdk.fetchNfts({
    // page?: number; // page number
    // limit?: number; // limit per page
    // collections?: Array<string>; // array of collection ids
    // traits?: Array<string>; // array of trait ids
    // sort?: string; // the sort field
    // order?: number; // the sorting order
    // user?: string; // filters by the owner user id
    // template_id?: string; // filters through the template id
  });

  console.log(result)

}

fetchNfts();

Fetch NFTs Owned by the Current User

This function paginates the nfts that the currently signed in user owns.

All parameters are optional.

async function fetchMyNfts() {

  const result = await tokenRunnersSdk.fetchMyNfts({
    // page?: number; // page number
    // limit?: number; // limit per page
    // collections?: Array<string>; // array of collection ids
    // traits?: Array<string>; // array of trait ids
    // sort?: string; // the sort field
    // order?: number; // the sorting order
    // template_id?: string; // filters through the template id
  });

  console.log(result)

}

fetchMyNfts();

Fetch single NFT

This function fetches a single NFT based on a given template id.

async function fetchOneNft() {

  const result = await tokenRunnersSdk.fetchOneNft({
    // id: string; // Template object id
  });

  console.log(result)

}

fetchOneNft();

Fetch Current User Data

This function fetches the current signed in user data.

async function fetchUser() {

  const result = await tokenRunnersSdk.fetchUser();

  console.log(result)

}

fetchUser();

Patch Current User Data

This function allows you to update the current user data.

async function patchUser() {

  const result = await tokenRunnersSdk.patchUser({
    // firstName?: string;
    // lastName?: string;
    // country?: string;
    // about?: string;
    // emailNotification?: boolean;
    // email?: string;
    // avatarTemplateId?: string;
    // oldPassword?: string;
    // newPassword?: string;
    // confirmPassword?: string;
  });

  console.log(result)

}

patchUser();

Fetch Wallet Balance

This function fetches the current wallet or specified wallet account balance.

async function getBalance() {

  const result = await tokenRunnersSdk.getBalance({
    // addr?: string // wallet address, optional if connected.
  });

  console.log(result)

}

getBalance();

Purchase Token

This function purchases a specified listing in the blockchain.

It uses the currently connected wallet to complete the purchase.

It resolves once the app is updated with the purchase.

It returns the token data and the transaction receipt.

This function can be called for the following solutions:

  • purchase a single token that is being listed.
  • blind purchase one or more tokens in a listing.
  • pre-sale blind purchase one or more tokens in a listing.
async function purchase(listingID) {

  const { tokens, transaction } = await tokenRunnersSdk.purchase({ listingID });

  console.log({ token, transaction })

}

purchase();

Fetch Available Listings

This function paginates the available listings for a store

All parameters are optional.

async function fetchListings() {

  const result = await tokenRunnersSdk.fetchListings({
    // page?: number; // page number
    // limit?: number; // limit per page
    // presale?: boolean; // filters presale listings
    // blindsale?: boolean; // filters blind sale listings (more than 1 token)
  });

  console.log(result)

}

fetchListings();

Fetch single listing

This function fetches a specified listing.

async function fetchListing() {

  const result = await tokenRunnersSdk.fetchListing({
    listingID: 1, // the listing resource id on chain
  });

  console.log(result)

}

fetchListing();

Subscribe user/wallet event

this function adds a on user event subscription to know when a wallet changes

async function subscribeOnUser() {

  const result = await tokenRunnersSdk.onUser(({ wallet, user }) => {
    console.log(wallet, user)
  });

}

subscribeOnUser();