cosmology-tech/chain-registry

FEATURE REQ: query ChainRegistryClient.getChainInfo by chain_id

rayraspberry opened this issue · 0 comments

in circumstances where the chains queried are unknown and the information about a chain needs to be gathered without prior knowledge beyond the chain id , it would be helpful to be able to query by chain_id (osmosis-1 or osmo-test-5, for example)

const chain = unknownData.ChainId; // osmosis-1

const client = new ChainRegistryClient({
    chainNames: [chain]
});
const chainInfo = client.getChainInfo(chain);

chainInfo is returned as follows:

Chain Info: <ref *1> ChainInfo {
  chainName: 'osmosis-1',
  fetcher: ChainRegistryClient {
    urls: [
      'https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis-1/chain.json',
      'https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis-1/assetlist.json'
    ],
    _assetLists: [],
    _chains: [],
    _ibcData: [],
    chainInfoList: [ [Circular *1] ],
    _options: {
      chainNames: [Array],
      baseUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master',
      assetListNames: undefined,
      ibcNamePairs: undefined
    }
  },
  _chain: undefined,
  _assetList: undefined,
  _assetLists: [],
  _ibcData: []
}

the URLs result in 404 NOT FOUND