@chalabi/chain-registry
v0.0.4
Published
<p align="center" width="100%"> <img height="90" src="https://user-images.githubusercontent.com/545047/190171475-b416f99e-2831-4786-9ba3-a7ff4d95b0d3.svg" /> </p>
Readme
chain-registry
The npm package for the Official Cosmos chain registry
npm install chain-registryA unified store of chains info, assets, asset lists, and IBC channels for the Cosmos ecosystem. Get everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
example
Fetch data from chain-registry:
import { assets, chains, ibc } from 'chain-registry';
const assetList = assets.find(({chain_name})=>chain_name==='osmosis');
console.log(assetList);will output:
{
'$schema': '../assetlist.schema.json',
chain_name: 'osmosis',
assets: [
{
description: 'The native token of Osmosis',
denom_units: [Array],
base: 'uosmo',
name: 'Osmosis',
display: 'osmo',
symbol: 'OSMO',
logo_URIs: [Object],
coingecko_id: 'osmosis'
},
{
denom_units: [Array],
base: 'uion',
name: 'Ion',
display: 'ion',
symbol: 'ION',
logo_URIs: [Object],
coingecko_id: 'ion'
}
]
}Dynamically fetch data:
import { ChainRegistryClient } from '@chain-registry/client';
// create an instance of ChainRegistryClient by passing in the chain names
const client = new ChainRegistryClient({
chainNames: [
'osmosis',
'juno',
'stargaze'
]
});
// chain info, assets and ibc data will be downloaded dynamically by invoking fetchUrls method
await client.fetchUrls();
// get chain data
const chain = client.getChain('osmosis');
// get asset list
const assetList = client.getChainAssetList('osmosis');
// get ibc data
const ibcData = client.getChainIbcData('osmosis);
// get asset list (including ibc assets)
const generatedAssetList = client.getGeneratedAssetLists('osmosis);
packages
chain-registry
An npm module for the Official chain-registry for the Cosmos ⚛️
@chain-registry/client
A Client for chain-registry that allows you to dynamically fetch data.
@chain-registry/types
Types for chain-registry.
@chain-registry/keplr
Keplr integration for the chain-registry returning keplr's ChainInfo type from @chain-registry/types Chain type.
@chain-registry/assets
Asset lists for the Cosmos ⚛️
@chain-registry/osmosis
Chain Registry info for Osmosis, including asset lists.
@chain-registry/juno
Chain Registry info for Juno, including asset lists.
@chain-registry/utils
Utility functions for chain-registry.
Developing
Checkout the repository and bootstrap the yarn workspace:
# Clone the repo.
git clone https://github.com/cosmology-tech/chain-registry
yarn
yarn bootstrapBuilding
yarn buildPublishing
First, cd into the root folder of the project:
cd /your/path/to/chain-registrySecond, update the git submodules:
git submodule update --remoteThird, generate the code (this takes a bit since it does some linting):
yarn codegenFinally, commit and publish the code!
git commit -am "new registry updates"
lerna publishRelated
Checkout these related projects:
- @cosmwasm/ts-codegen for generated CosmWasm contract Typescript classes
- @cosmology/telescope a "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs.
- chain-registry an npm module for the official Cosmos chain-registry.
- cosmos-kit A wallet connector for the Cosmos ⚛️
- create-cosmos-app set up a modern Cosmos app by running one command.
- starship a k8s-based unified development environment for Cosmos Ecosystem
Credits
🛠 Built by Cosmology — if you like our tools, please consider delegating to our validator ⚛️
