diff --git a/changelog.md b/changelog.md index 76ce80f8d1..573ddfa229 100644 --- a/changelog.md +++ b/changelog.md @@ -11,6 +11,7 @@ - [#3953](https://github.com/ignite/cli/pull/3953) Fix apps `Stdout` is redirected to `Stderr` - [#3863](https://github.com/ignite/cli/pull/3963) Fix breaking issue for app client API when reading app chain info +- [#3969](https://github.com/ignite/cli/pull/3969) Get first config validator using a getter to avoid index errors ## [`v28.2.0`](https://github.com/ignite/cli/releases/tag/v28.2.0) diff --git a/ignite/cmd/chain_debug.go b/ignite/cmd/chain_debug.go index d39d03c4b7..3dcf2d9170 100644 --- a/ignite/cmd/chain_debug.go +++ b/ignite/cmd/chain_debug.go @@ -8,6 +8,7 @@ import ( "github.com/spf13/cobra" cmdmodel "github.com/ignite/cli/v28/ignite/cmd/model" + chainconfig "github.com/ignite/cli/v28/ignite/config/chain" "github.com/ignite/cli/v28/ignite/pkg/chaincmd" "github.com/ignite/cli/v28/ignite/pkg/cliui" "github.com/ignite/cli/v28/ignite/pkg/cliui/icons" @@ -117,8 +118,11 @@ func chainDebug(cmd *cobra.Command, session *cliui.Session) error { return err } - // TODO: Replace by config.FirstValidator when PR #3199 is merged - validator := cfg.Validators[0] + validator, err := chainconfig.FirstValidator(cfg) + if err != nil { + return err + } + servers, err := validator.GetServers() if err != nil { return err diff --git a/ignite/services/chain/chain.go b/ignite/services/chain/chain.go index f4b2ddfb5f..fa21890767 100644 --- a/ignite/services/chain/chain.go +++ b/ignite/services/chain/chain.go @@ -206,7 +206,12 @@ func (c *Chain) RPCPublicAddress() (string, error) { if err != nil { return "", err } - validator := conf.Validators[0] + + validator, err := chainconfig.FirstValidator(conf) + if err != nil { + return "", err + } + servers, err := validator.GetServers() if err != nil { return "", err