cli icon indicating copy to clipboard operation
cli copied to clipboard

Implement a command for importing existing modules

Open lumtis opened this issue 3 years ago • 3 comments

Is your feature request related to a problem or issue you encountered? Please describe. From 0.47 Cosmos SDK will support a better module wiring for the app.go and it should enable us to reliably implement a command to support importing existing module into an existing application

https://docs.cosmos.network/main/building-apps/app-go

We can use this task to explore how this command would be implemented

Describe the solution you'd like

I suggest to have the import command under scaffold namespace as it is literally a scaffolding command, we scaffold the import of a module. Eventually it could be argued that the command should reflect the action being perform, if we consider "Ignite is importing a module", it could be ignite import

ignite scaffold import <module_name> <source> [config]

This will set in app.go the begin blocker, the end blocker and the module config:

{
  Name: <name>,
  Config: appconfig.WrapAny(&<source>.Module{
    <config>
  }),
},

It requires a bit more investigation of how config would be set

The source defines the value necessary to retrieve the module, it could be two value:

  • source: the repo URL where the module is located
  • name: the name of the module in x directory (we should give the ability for the user to provide a different name for their own source for the module, so it could be module_name by default but giving the ability through flags to provide a custom module name in the source repo)

We can support module import directly by name for selected set of module from Cosmos SDK, Ignite Modules and Ignite Chain

ignite s import claim
ignite s import monitoring-provider
ignite s import wasm

lumtis avatar Nov 04 '22 13:11 lumtis

I propose we create a repo called ignite/module-registry and allow ignite s import cmd to fetch this repo to get a list of community available modules and also instructions to import them into an existing chain.

ilgooz avatar Nov 07 '22 11:11 ilgooz

I propose we create a repo called ignite/module-registry and allow ignite s import cmd to fetch this repo to get a list of community available modules and also instructions to import them into an existing chain.

Great idea, why not just calling it registry?

lumtis avatar Nov 07 '22 13:11 lumtis

It will be good if we also provide version as optional flag. e.g. evmos or other modules with latest version may break importing. So able to pass exact version might help many users.

amitkarpe avatar Nov 08 '22 08:11 amitkarpe