Coder Social home page Coder Social logo

isabella232 / fetch-node-details Goto Github PK

View Code? Open in Web Editor NEW

This project forked from torusresearch/fetch-node-details

0.0 0.0 0.0 4.53 MB

Fetches the node details from torus nodelist smart contract

License: MIT License

JavaScript 15.12% HTML 1.47% Shell 0.29% TypeScript 83.12%

fetch-node-details's Introduction

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 5 formats

  • esm build dist/fetchNodeDetails.esm.js in es6 format
  • commonjs build dist/fetchNodeDetails.cjs.js in es5 format
  • commonjs build dist/fetchNodeDetails-bundled.cjs.js in es5 format with problematic packages bundled (benefits non-webpack users)
  • umd build dist/fetchNodeDetails.umd.min.js in es5 format without polyfilling corejs minified
  • node build dist/fetchNodeDetails-node.js in es5 format

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

The cjs build is 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://unpkg.com/@toruslabs/fetch-node-details"></script>

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").default;

const fetchNodeDetails = new FetchNodeDetails();
fetchNodeDetails.getNodeDetails().then((nodeInfo) => console.log(nodeInfo));
// For Node.js
const FetchNodeDetails = require("@toruslabs/fetch-node-details/dist/fetchNodeDetails-node.js").default;

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

Requirements

  • This package requires a peer dependency of @babel/runtime
  • Node 12+

Local Development

Requires a .env file with the parameters in .env.development

fetch-node-details's People

Contributors

chaitanyapotti avatar dependabot[bot] avatar phuctm97 avatar tetratorus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.