0.0.4 • Published 3 years ago
cosmos-directory-js v0.0.4
cosmos-directory-js
JavaScript helper library to fetch Cosmos chain registry via cosmos.directory ⛓
Installing
# using npm
npm install cosmos-directory-js
# using yarn
yarn add cosmos-directory-js
Usage
// using commonjs
const { fetchAllChains } = require("cosmos-directory-js");
// using esm
import { fetchAllChains } from "cosmos-directory-js";
// example usages
const { chains } = await fetchAllChains();
const { validators } = await fetchAllValidators();
Custom Endpoint
cosmos-directory-js
uses cosmos.directory as the default endpoint configured at constants.ts
. To override endpoint values, define env values DIRECTORY_CHAINS_ENDPOINT
and DIRECTORY_VALIDATORS_ENDPOINT
.
For example, if you have another cosmos.directory deployed at https://example.com
, replace env values like below:
DIRECTORY_CHAINS_ENDPOINT="https://chains.example.com"
DIRECTORY_VALIDATORS_ENDPOINT="https://validators.example.com"
API
View API documentation page at https://cosmos-directory-js.vercel.app