endpoint-finder

1.2.12 • Public • Published
cosmos

Node.js CI Jest Codacy Security Scan

Table of Contents

  1. How it works
  2. Install
  3. Usage
  4. Units test

How it works

For cosmos dapp developers, the use of RPC and LCD endpoints are very important! A problem arises... Endpoints are not always available and it is important to always have a list of available endpoints available.

This package will allow you to append the endpoints of any chain lister on chain-registry (thanks to Pyramation for the lib chain-registry)

The return will necessarily be an endpoint in http 200 status!

Install:

npm i endpoint-finder

Usage:

List all chains supported:

import endpointFinder from 'endpoint-finder'

let initChains = new endpointFinder()

// List all chains supported
initChains.listChains().then(function(result) {
  console.log(result)
})

Get last valid LCD:

import endpointFinder from 'endpoint-finder'
 
let getChainEndpoint = new endpointFinder('bitcanna')

// Get last valid LCD 
getChainEndpoint.getLcd().then(function(result) {
  console.log(result)
})

Return: https://lcd.bitcanna.io

Get last valid RPC:

import endpointFinder from 'endpoint-finder'
 
let getChainEndpoint = new endpointFinder('bitcanna')

// Get last valid RPC 
getChainEndpoint.getRpc().then(function(result) {
  console.log(result)
})

Return: https://rpc.bitcanna.io

Units test

You can find the tests in the file test/index.spec.ts

npm run test

or

yarn test

If you have any ideas for improvement, open a discussion here

/endpoint-finder/

    Package Sidebar

    Install

    npm i endpoint-finder

    Weekly Downloads

    3

    Version

    1.2.12

    License

    ISC

    Unpacked Size

    23.4 kB

    Total Files

    13

    Last publish

    Collaborators

    • atmoner