Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@chain-registry/utils

Package Overview
Dependencies
Maintainers
1
Versions
257
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chain-registry/utils

Chain Registry Utils

  • 0.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
increased by4.54%
Maintainers
1
Weekly downloads
 
Created
Source

@chain-registry/utils

Utility functions for the chain-registry

Usage

import { ChainRegistry, ChainRegistryOptions } from '@chain-registry/utils';

const options: ChainRegistryOptions = {
  urls: [
    'https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/chain.json',
    'https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/assetlist.json',
    'https://raw.githubusercontent.com/cosmos/chain-registry/master/juno/assetlist.json',
    'https://raw.githubusercontent.com/cosmos/chain-registry/master/secretnetwork/assetlist.json',
    'https://raw.githubusercontent.com/cosmos/chain-registry/master/_IBC/juno-osmosis.json',
    'https://raw.githubusercontent.com/cosmos/chain-registry/master/_IBC/osmosis-secretnetwork.json'
  ]
};
const registry = new ChainRegistry(options);
await registry.fetchUrls();

Fetching Schemata

We currently only support fetching JSON schemas as defined in https://github.com/cosmos/chain-registry. Supported are assetlist.schema.json, chain.schema.json and ibc_data.schema.json.

fetchUrls

You can set the ChainRegistry.urls property and call ChainRegistry.fetchUrls()

registry.urls = [
  // urls to fetch
];
await registry.fetchUrls();

fetch

Or, you can simply call ChainRegistry.fetch()

await registry.fetch('https://some-json-schema.com/some-schema.json');

Asset lists

// generated asset lists
const generated = registry.getGeneratedAssetLists('osmosis');

// you can also get generated assets from ChainInfo object
const chainInfo = registry.getChainInfo('osmosis');
const generatedAssets = chainInfo.assetLists();

Chain info

const chainInfo = registry.getChainInfo('osmosis');

// AssetList[] of the generated assets
chainInfo.assetLists();

// Chain 
chainInfo.chain();

// AssetList[] of the native assets
chainInfo.nativeAssetLists();

FAQs

Package last updated on 31 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc