Skip to content

Commit

Permalink
update hook to use id instead of name
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol1696 committed Jun 7, 2024
1 parent 3f42b8f commit c6a9524
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions clients/js/packages/starshipjs/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface ChainConfig {
}
};
chains: Array<{
id: string;
name: string;
ports: {
rpc: number;
Expand Down
10 changes: 5 additions & 5 deletions clients/js/packages/starshipjs/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const useRegistry = async (configFile: string): Promise<ChainRegistryFetc
const urls: string[] = [];
config.chains?.forEach((chain) => {
urls.push(
`${registryUrl}/chains/${chain.name}`,
`${registryUrl}/chains/${chain.name}/assets`
`${registryUrl}/chains/${chain.id}`,
`${registryUrl}/chains/${chain.id}/assets`
);
});
config.relayers?.forEach((relayer) => {
Expand Down Expand Up @@ -43,12 +43,12 @@ export const useChain = (chainName: string) => {

const getRpcEndpoint = () => {
return `http://localhost:${
config.chains.find((chain) => chain.name === chainID)!.ports.rpc
config.chains.find((chain) => chain.id === chainID)!.ports.rpc
}`;
};
const getRestEndpoint = () => {
return `http://localhost:${
config.chains.find((chain) => chain.name === chainID)!.ports.rest
config.chains.find((chain) => chain.id === chainID)!.ports.rest
}`;
};

Expand All @@ -65,7 +65,7 @@ export const useChain = (chainName: string) => {

const creditFromFaucet = async (address: string, denom: string | null = null) => {
const faucetEndpoint = `http://localhost:${
config.chains.find((chain) => chain.name === chainID)!.ports.faucet
config.chains.find((chain) => chain.id === chainID)!.ports.faucet
}/credit`;
if (!denom) {
denom = getCoin().base;
Expand Down

0 comments on commit c6a9524

Please sign in to comment.