0.1.2 • Published 4 months ago

@tedcryptoorg/cosmos-directory v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Cosmos Directory

Library to use the Cosmos Directory API.

This library is split into three components:

  • ChainDirectory - Get information about a chain
  • ValidatorDirectory - Get information about a validator
  • CosmosDirectory - Get proxy endpoints to communicate with cosmos chains (e.g.: RPC and REST endpoints)

Install

npm i @tedcryptoorg/cosmos-directory

How to use

import { ChainDirectory } from '@tedcryptoorg/cosmos-directory'
import { ChainsResponse, ChainResponse, Chain } from '@tedcryptoorg/cosmos-directory/dist/types'

// Build your service
const chainDirectory = new ChainDirectory();

// Get all chains
chainDirectory.getAllChains().then((data: ChainsResponse) => {
    data.chains.forEach((chain: Chain) => {
        console.log(chain)
    });
})

// Get a specific chain
chainDirectory.getChainData('cosmoshub').then((data: ChainResponse) => {
  console.log(data);
  console.log(data.chain.assets)
})
import { ValidatorDirectory } from '@tedcryptoorg/cosmos-directory'
import { ValidatorResponse, ChainValidatorResponse } from '@tedcryptoorg/cosmos-directory/dist/types'

// Build your service
const validatorDirectory = new ValidatorDirectory(false); // For testnet use true

// Get a validators from a chain
validatorDirectory.getValidators('cosmoshub').then((data: ChainValidatorResponse) => {
  console.log(data)
})

// Get registry information about a validator using their name
validatorDirectory.getValidator('tedcrypto').then((data: ValidatorResponse) => {
  console.log(data.validator.name); // Tedcrypto
})
0.1.2

4 months ago

0.1.0

9 months ago

0.1.1

9 months ago

0.0.11

11 months ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago