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!
npm i endpoint-finder
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
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