cosmos-directory-client
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i cosmos-directory-client

Weekly Downloads

1,274

Version

0.0.6

License

MIT

Unpacked Size

9.33 kB

Total Files

6

Last publish

Collaborators

  • codingki
  • grikomsn