-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: scaffold chain-registry files #4413
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8673fcb
feat: scaffold chain-registry files
julienrbrt ff370df
Merge branch 'main' into julien/cr
julienrbrt 585bb8d
cl
julienrbrt b56e6f7
Merge branch 'main' into julien/cr
julienrbrt 5db55d2
Merge branch 'main' into julien/cr
julienrbrt 97b308e
cl
julienrbrt 81d201f
updates
julienrbrt 7ff8e68
Merge branch 'main' into julien/cr
julienrbrt ea034ae
updates
julienrbrt ebfed78
Merge branch 'main' into julien/cr
julienrbrt 7d795ed
typo
julienrbrt 79eb59c
renaming
julienrbrt 23da584
Merge branch 'main' into julien/cr
julienrbrt edb7360
finalize chain-registry
julienrbrt 667734c
updates
julienrbrt 341ff8e
lint
julienrbrt 5f5621b
lint
julienrbrt 7af9fc4
Merge branch 'main' into julien/cr
julienrbrt be695a3
Merge branch 'main' into julien/cr
julienrbrt 1627882
typos
julienrbrt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package ignitecmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/ignite/cli/v29/ignite/pkg/cliui" | ||
"github.com/ignite/cli/v29/ignite/services/chain" | ||
"github.com/ignite/cli/v29/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/cosmos-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)) | ||
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.AddChainRegistryFiles(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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should certain fields should be configurable?
For instance:
and then consumed in
scaffoldChainRegistryFiles
And passed down to
AddChainRegistryFiles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't super sure. As youd scaffold this when you need the frontend, and usually it is at devnet. Wanted to keep it KISS. But we can always add if you find it valuable.