mukan-ignite/ignite/config/chain/v0/config_convert.go
Mukan Erkin Törük 26b204bd04
Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
feat: fork Ignite CLI v29 as Mukan Ignite — remove cosmos-sdk restrictions
2026-05-11 03:31:37 +03:00

65 lines
1.4 KiB
Go

package v0
import (
v1 "github.com/ignite/cli/v29/ignite/config/chain/v1"
"github.com/ignite/cli/v29/ignite/config/chain/version"
)
// ConvertNext converts the current config version to the next one.
func (c *Config) ConvertNext() (version.Converter, error) {
targetCfg := v1.DefaultConfig()
// All the fields in the base config remain the same
targetCfg.Config = c.Config
targetCfg.Version = 1
// There is always only one validator in version 0
validator := v1.Validator{}
validator.Name = c.Validator.Name
validator.Bonded = c.Validator.Staked
validator.Home = c.Init.Home
validator.Client = c.Init.Client
if c.Init.App != nil {
validator.App = c.Init.App
}
if c.Init.Config != nil {
validator.Config = c.Init.Config
}
// The host configuration must be defined in the validators for version 1
servers := v1.Servers{}
if c.Host.P2P != "" {
servers.P2P.Address = c.Host.P2P
}
if c.Host.RPC != "" {
servers.RPC.Address = c.Host.RPC
}
if c.Host.Prof != "" {
servers.RPC.PProfAddress = c.Host.Prof
}
if c.Host.GRPCWeb != "" {
servers.GRPCWeb.Address = c.Host.GRPCWeb
}
if c.Host.GRPC != "" {
servers.GRPC.Address = c.Host.GRPC
}
if c.Host.API != "" {
servers.API.Address = c.Host.API
}
if err := validator.SetServers(servers); err != nil {
return nil, err
}
targetCfg.Validators = append(targetCfg.Validators, validator)
return targetCfg, nil
}