JSPM

  • Created
  • Published
  • Downloads 7553
  • Score
    100M100P100Q136026F
  • License MIT

Fetches the node details from torus nodelist smart contract

Package Exports

  • @toruslabs/fetch-node-details

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@toruslabs/fetch-node-details) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Fetch-Node-Details

npm version npm

Introduction

Use this package to fetches details about Torus nodes, from a specified Smart Contract that holds details about the list of nodes & network. This will dynamically get updates about the node list, allowing the front end to continue querying the different set of nodes after migrations.

This utility library serves to find the endpoints and public keys associated with the current set of qualified nodes, which are used for key lookups, key assignments, and key retrievals by other dependent libraries.

Features

  • Multi network support
  • Allows passing in custom provider + contract address for querying node info
  • Caching
  • Typescript compatible. Includes Type definitions
  • All API's return Promises

Installation

Bundling

This module is distributed in 6 formats

  • commonjs build dist/fetchNodeDetails.cjs.js in es5 format
  • esm build dist/fetchNodeDetails.esm.js in es6 format
  • umd build dist/fetchNodeDetails.umd.js in es5 format without polyfilling corejs
  • umd build dist/fetchNodeDetails.umd.min.js in es5 format without polyfilling corejs minified
  • umd build dist/fetchNodeDetails.polyfill.umd.js in es5 format with polyfilling corejs
  • umd build dist/fetchNodeDetails.polyfill.umd.min.js in es5 format with polyfilling corejs minified

By default, the appropriate format is used for your specified usecase You can use a different format (if you know what you're doing) by referencing the correct file

The cjs and esm builds are not polyfilled with core-js. It is upto the user to polyfill based on the browserlist they target

Directly in Browser

CDN's serve the non-core-js polyfilled version by default. You can use a different

jsdeliver

<script src="https://cdn.jsdelivr.net/npm/@toruslabs/fetch-node-details"></script>

unpkg

<script src="https://cdn.jsdelivr.net/npm/@toruslabs/fetch-node-details"></script>

Tips for NUXT

This is a plugin that works only on the client side. So please register it as a ssr-free plugin.

Usage

Add @toruslabs/fetch-node-details to your project:

import FetchNodeDetails from "@toruslabs/fetch-node-details";

const fetchNodeDetails = new FetchNodeDetails();
const nodeInfo = await fetchNodeDetails.getNodeDetails();
const FetchNodeDetails = require("@toruslabs/fetch-node-details");

const fetchNodeDetails = new FetchNodeDetails();
fetchNodeDetails.getNodeDetails().then((nodeInfo) => console.log(nodeInfo));

Requirements

  • Node 10+