Skip to content

Npm package that allows you to retrieve the valid LCD/RPC (http status 200) of any cosmos chain from the chain-registry.

License

Notifications You must be signed in to change notification settings

atmoner/endpoint-finder

Repository files navigation

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

About

Npm package that allows you to retrieve the valid LCD/RPC (http status 200) of any cosmos chain from the chain-registry.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published