Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

support 0.2.2 starship devnet helm chart #3

@0xpatrickdev

Description

@0xpatrickdev

With the renaming of name -> to id in the 0.2.2 starship devnet helm chart, the following error thrown when calling useRegistry and a few other helpers:

 Error: Bad response
      at /../node_modules/@chain-registry/client/main/fetcher.js:20:13
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      
 TypeError: Cannot read properties of undefined (reading 'ports')
      at creditFromFaucet (/../node_modules/starshipjs/hooks.js:55:105)
      at <anonymous> (/../src/setup.test.ts:61:9)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Applying this patch resolves the error:

diff --git a/node_modules/starshipjs/hooks.js b/node_modules/starshipjs/hooks.js
index fb3e3cf..6b6567b 100644
--- a/node_modules/starshipjs/hooks.js
+++ b/node_modules/starshipjs/hooks.js
@@ -14,7 +14,7 @@ const useRegistry = async (configFile) => {
     const registryUrl = `http://localhost:${config.registry.ports.rest}`;
     const urls = [];
     config.chains?.forEach((chain) => {
-        urls.push(`${registryUrl}/chains/${chain.name}`, `${registryUrl}/chains/${chain.name}/assets`);
+        urls.push(`${registryUrl}/chains/${chain.id}`, `${registryUrl}/chains/${chain.id}/assets`);
     });
     config.relayers?.forEach((relayer) => {
         urls.push(`${registryUrl}/ibc/${relayer.chains[0]}/${relayer.chains[1]}`, `${registryUrl}/ibc/${relayer.chains[1]}/${relayer.chains[0]}`);
@@ -35,10 +35,10 @@ const useChain = (chainName) => {
     const chainInfo = registry.getChainInfo(chainName);
     const chainID = chainInfo.chain.chain_id;
     const getRpcEndpoint = () => {
-        return `http://localhost:${config.chains.find((chain) => chain.name === chainID).ports.rpc}`;
+        return `http://localhost:${config.chains.find((chain) => chain.id === chainID).ports.rpc}`;
     };
     const getRestEndpoint = () => {
-        return `http://localhost:${config.chains.find((chain) => chain.name === chainID).ports.rest}`;
+        return `http://localhost:${config.chains.find((chain) => chain.id === chainID).ports.rest}`;
     };
     const getGenesisMnemonic = async () => {
         const url = `http://localhost:${config.registry.ports.rest}/chains/${chainID}/keys`;
@@ -50,7 +50,7 @@ const useChain = (chainName) => {
         return chainInfo.fetcher.getChainAssetList(chainName).assets[0];
     };
     const creditFromFaucet = async (address, denom = null) => {
-        const faucetEndpoint = `http://localhost:${config.chains.find((chain) => chain.name === chainID).ports.faucet}/credit`;
+        const faucetEndpoint = `http://localhost:${config.chains.find((chain) => chain.id === chainID).ports.faucet}/credit`;
         if (!denom) {
             denom = getCoin().base;
         }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions