diff --git a/ignite/templates/app/files/app/app.go.plush b/ignite/templates/app/files/app/app.go.plush index 0f400add43..194f2a58f8 100644 --- a/ignite/templates/app/files/app/app.go.plush +++ b/ignite/templates/app/files/app/app.go.plush @@ -33,8 +33,12 @@ import ( consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/x/gov" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" @@ -59,18 +63,6 @@ const ( Name = "<%= BinaryNamePrefix %>" ) -func getGovProposalHandlers() []govclient.ProposalHandler { - var govProposalHandlers []govclient.ProposalHandler - // this line is used by starport scaffolding # stargate/app/govProposalHandlers - - govProposalHandlers = append(govProposalHandlers, - paramsclient.ProposalHandler, - // this line is used by starport scaffolding # stargate/app/govProposalHandler - ) - - return govProposalHandlers -} - var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string @@ -138,6 +130,36 @@ func init() { DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) } +// getGovProposalHandlers return the chain proposal handlers. +func getGovProposalHandlers() []govclient.ProposalHandler { + var govProposalHandlers []govclient.ProposalHandler + // this line is used by starport scaffolding # stargate/app/govProposalHandlers + + govProposalHandlers = append(govProposalHandlers, + paramsclient.ProposalHandler, + // this line is used by starport scaffolding # stargate/app/govProposalHandler + ) + + return govProposalHandlers +} + +// AppConfig returns the default app config. +func AppConfig() depinject.Config { + return depinject.Configs( + appConfig, + // Loads the ao config from a YAML file. + // appconfig.LoadYAML(AppConfigYAML), + depinject.Supply( + // supply custom module basics + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic(getGovProposalHandlers()), + // this line is used by starport scaffolding # stargate/appConfig/moduleBasic + }, + ), + ) +} + // New returns a reference to an initialized App. func New( logger log.Logger, @@ -153,7 +175,7 @@ func New( // merge the AppConfig and other configuration in one config appConfig = depinject.Configs( - AppConfig, + AppConfig(), depinject.Supply( // supply the application options appOpts, diff --git a/ignite/templates/app/files/app/app_config.go.plush b/ignite/templates/app/files/app/app_config.go.plush index bc9b163de9..fcac64e097 100644 --- a/ignite/templates/app/files/app/app_config.go.plush +++ b/ignite/templates/app/files/app/app_config.go.plush @@ -25,24 +25,22 @@ import ( upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1" vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" "cosmossdk.io/core/appconfig" - "cosmossdk.io/depinject" _ "cosmossdk.io/x/circuit" // import for side-effects circuittypes "cosmossdk.io/x/circuit/types" _ "cosmossdk.io/x/evidence" // import for side-effects evidencetypes "cosmossdk.io/x/evidence/types" "cosmossdk.io/x/feegrant" _ "cosmossdk.io/x/feegrant/module" // import for side-effects - _ "cosmossdk.io/x/upgrade" // import for side-effects + _ "cosmossdk.io/x/upgrade" // import for side-effects upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/types/module" _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" "github.com/cosmos/cosmos-sdk/x/authz" _ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects - _ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" @@ -50,13 +48,11 @@ import ( crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/cosmos/cosmos-sdk/x/gov" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/group" _ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects - _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects + _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" _ "github.com/cosmos/cosmos-sdk/x/params" // import for side-effects paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -182,8 +178,8 @@ var ( // govtypes.ModuleName } - // AppConfig application configuration (used by depinject) - AppConfig = depinject.Configs(appconfig.Compose(&appv1alpha1.Config{ + // appConfig application configuration (used by depinject) + appConfig = appconfig.Compose(&appv1alpha1.Config{ Modules: []*appv1alpha1.ModuleConfig{ { Name: runtime.ModuleName, @@ -300,12 +296,5 @@ var ( }, // this line is used by starport scaffolding # stargate/app/moduleConfig }, - }), - depinject.Supply( - // supply custom module basics - map[string]module.AppModuleBasic{ - genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - govtypes.ModuleName: gov.NewAppModuleBasic(getGovProposalHandlers()), - }, - )) + }) ) diff --git a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush index 4096025853..e60eba7ca8 100644 --- a/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush +++ b/ignite/templates/app/files/cmd/{{binaryNamePrefix}}d/cmd/root.go.plush @@ -39,7 +39,7 @@ func NewRootCmd() *cobra.Command { ) if err := depinject.Inject( - depinject.Configs(app.AppConfig, + depinject.Configs(app.AppConfig(), depinject.Supply( log.NewNopLogger(), ),