From 7684d44e8be59c32980b57e23b2d96ae66b1a1f1 Mon Sep 17 00:00:00 2001 From: Anil Date: Fri, 7 Jul 2023 15:50:25 +0200 Subject: [PATCH] use the name given by the user to generate the fetch URL --- cmd/chains.go | 2 +- cregistry/chain_info.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/chains.go b/cmd/chains.go index 53404cabe..0c492c799 100644 --- a/cmd/chains.go +++ b/cmd/chains.go @@ -447,7 +447,7 @@ func addChainsFromRegistry(ctx context.Context, a *appState, chains []string) er continue } - chainConfig, err := chainInfo.GetChainConfig(ctx) + chainConfig, err := chainInfo.GetChainConfig(ctx, chain) if err != nil { a.log.Warn( "Error generating chain config", diff --git a/cregistry/chain_info.go b/cregistry/chain_info.go index 4d49017f0..7309296e2 100644 --- a/cregistry/chain_info.go +++ b/cregistry/chain_info.go @@ -206,8 +206,8 @@ func (c ChainInfo) GetRandomRPCEndpoint(ctx context.Context) (string, error) { } // GetAssetList returns the asset metadata from the cosmos chain registry for this particular chain. -func (c ChainInfo) GetAssetList(ctx context.Context) (AssetList, error) { - chainRegURL := fmt.Sprintf("https://raw.githubusercontent.com/cosmos/chain-registry/master/%s/assetlist.json", c.ChainName) +func (c ChainInfo) GetAssetList(ctx context.Context, name string) (AssetList, error) { + chainRegURL := fmt.Sprintf("https://raw.githubusercontent.com/cosmos/chain-registry/master/%s/assetlist.json", name) res, err := http.Get(chainRegURL) if err != nil { @@ -236,11 +236,11 @@ func (c ChainInfo) GetAssetList(ctx context.Context) (AssetList, error) { // GetChainConfig returns a CosmosProviderConfig composed from the details found in the cosmos chain registry for // this particular chain. -func (c ChainInfo) GetChainConfig(ctx context.Context) (*cosmos.CosmosProviderConfig, error) { +func (c ChainInfo) GetChainConfig(ctx context.Context, name string) (*cosmos.CosmosProviderConfig, error) { debug := viper.GetBool("debug") home := viper.GetString("home") - assetList, err := c.GetAssetList(ctx) + assetList, err := c.GetAssetList(ctx, name) if err != nil { return nil, err }