Some checks failed
Docs Deploy / build_and_deploy (push) Has been cancelled
Generate Docs / cli (push) Has been cancelled
Generate Config Doc / cli (push) Has been cancelled
Go formatting / go-formatting (push) Has been cancelled
Check links / markdown-link-check (push) Has been cancelled
Integration / pre-test (push) Has been cancelled
Integration / test on (push) Has been cancelled
Integration / status (push) Has been cancelled
Lint / Lint Go code (push) Has been cancelled
Test / test (ubuntu-latest) (push) Has been cancelled
71 lines
2 KiB
Go
71 lines
2 KiB
Go
package ignitecmd
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
|
|
"git.cw.tr/mukan-network/mukan-ignite/ignite/pkg/cliui"
|
|
"git.cw.tr/mukan-network/mukan-ignite/ignite/services/chain"
|
|
"git.cw.tr/mukan-network/mukan-ignite/ignite/services/scaffolder"
|
|
)
|
|
|
|
// NewScaffoldChainRegistry returns the command to scaffold the chain registry chain.json and assets.json files.
|
|
func NewScaffoldChainRegistry() *cobra.Command {
|
|
c := &cobra.Command{
|
|
Use: "chain-registry",
|
|
Short: "Configs for the chain registry",
|
|
Long: `Scaffold the chain registry chain.json and assets.json files.
|
|
|
|
The chain registry is a GitHub repo, hosted at https://github.com/cosmos/chain-registry, that
|
|
contains the chain.json and assets.json files of most of chains in the Cosmos ecosystem.
|
|
It is good practices, when creating a new chain, and about to launch a testnet or mainnet, to
|
|
publish the chain's metadata in the chain registry.
|
|
|
|
Read more about the chain.json at https://github.com/cosmos/chain-registry?tab=readme-ov-file#chainjson
|
|
Read more about the assets.json at https://github.com/cosmos/chain-registry?tab=readme-ov-file#assetlists`,
|
|
Args: cobra.NoArgs,
|
|
PreRunE: migrationPreRunHandler,
|
|
RunE: scaffoldChainRegistryFiles,
|
|
}
|
|
|
|
flagSetPath(c)
|
|
flagSetClearCache(c)
|
|
|
|
c.Flags().AddFlagSet(flagSetYes())
|
|
|
|
return c
|
|
}
|
|
|
|
func scaffoldChainRegistryFiles(cmd *cobra.Command, _ []string) error {
|
|
session := cliui.New(
|
|
cliui.StartSpinnerWithText(statusScaffolding),
|
|
cliui.WithoutUserInteraction(getYes(cmd)),
|
|
)
|
|
defer session.End()
|
|
|
|
cfg, _, err := getChainConfig(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
c, err := chain.NewWithHomeFlags(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
appPath := flagGetPath(cmd)
|
|
sc, err := scaffolder.New(cmd.Context(), appPath, cfg.Build.Proto.Path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if err = sc.CreateChainRegistryFiles(c, cfg); err != nil {
|
|
return err
|
|
}
|
|
|
|
// no need for post scaffolding, as we are just creating two files
|
|
// that are not part of the build process
|
|
|
|
session.Printf("🎉 chain-registry files successfully scaffolded\n")
|
|
|
|
return nil
|
|
}
|