0.0.6 • Published 2 years ago

cosmos-directory-client v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

npm/v npm/dt stars

cosmos-directory-client

JavaScript client for fetching cosmos.directory endpoints 🛵

Installing

# using npm
npm install cosmos-directory-client

# using yarn
yarn add cosmos-directory-client

# using pnpm
pnpm add cosmos-directory-client

Basic example

Creating client

You can create the directory client via class or using helper functions:

import { DirectoryClient, createClient, createTestnetClient } from "cosmos-directory-client";

const client = new DirectoryClient({ ... });
const clientAlt = createClient({ ... });
const testnetClient = createTestnetClient({ ... });

All clients defaults to https://cosmos.directory and https://testcosmos.directory for testnet client. You can pass optional arguments on instantiation.

Using client

All fetcher functions uses the built-in fetch object. You can pass custom fetch implementation when instantiating the client.

const { chains } = await client.fetchChains();
const { chain } = await client.fetchChain("juno");
const { chains } = await client.fetchStatus();
const { validators } = await client.fetchValidators();
const { validator } = await client.fetchValidator("frens");

API

View library APIs via paka.dev: https://paka.dev/npm/cosmos-directory-client

License

MIT License, Copyright (c) 2022 Strangelove Ventures