Skip to content

Commit

Permalink
Revert "refactor(templates): add all ibc commands (#3858)"
Browse files Browse the repository at this point in the history
This reverts commit 3dda9b0.
  • Loading branch information
Pantani authored Dec 25, 2023
1 parent 4bb56d0 commit 68c8e29
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 32 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- [#3827](https://github.com/ignite/cli/pull/3827) Change ignite apps to be able to run in any directory
- [#3831](https://github.com/ignite/cli/pull/3831) Correct ignite app gRPC server stop memory issue
- [#3825](https://github.com/ignite/cli/pull/3825) Fix a minor Keplr type-checking bug in TS client
- [#3836](https://github.com/ignite/cli/pull/3836), [#3858](https://github.com/ignite/cli/pull/3858) Add missing IBC commands for scaffolded chain
- [#3836](https://github.com/ignite/cli/pull/3836) Add missing IBC commands for scaffolded chain
- [#3833](https://github.com/ignite/cli/pull/3833) Improve Cosmos SDK detection to support SDK forks
- [#3849](https://github.com/ignite/cli/pull/3849) Add missing `tx.go` file by default and enable cli if autocli does not exist
- [#3851](https://github.com/ignite/cli/pull/3851) Add missing ibc interfaces to chain client
Expand Down
35 changes: 11 additions & 24 deletions ignite/templates/app/files/app/ibc.go.plush
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package app

import (
"cosmossdk.io/core/appmodule"
storetypes "cosmossdk.io/store/types"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
Expand Down Expand Up @@ -180,27 +180,14 @@ func (app *App) registerIBCModules() {
}
}

// Since the IBC modules don't support dependency injection, we need to
// manually register the modules on the client side.
// This needs to be removed after IBC supports App Wiring.
func RegisterIBC(registry cdctypes.InterfaceRegistry) map[string]appmodule.AppModule {
modules := map[string]appmodule.AppModule{
ibcexported.ModuleName: ibc.AppModule{},
ibctransfertypes.ModuleName: ibctransfer.AppModule{},
ibcfeetypes.ModuleName: ibcfee.AppModule{},
icatypes.ModuleName: icamodule.AppModule{},
capabilitytypes.ModuleName: capability.AppModule{},
ibctm.ModuleName: ibctm.AppModule{},
solomachine.ModuleName: solomachine.AppModule{},
}

for _, module := range modules {
if mod, ok := module.(interface {
RegisterInterfaces(registry cdctypes.InterfaceRegistry)
}); ok {
mod.RegisterInterfaces(registry)
}
}
// RegisterIBC adds the missing IBC modules and interfaces into the module manager.
func RegisterIBC(moduleManager module.BasicManager, registry cdctypes.InterfaceRegistry) {
moduleManager[ibcexported.ModuleName] = ibc.AppModule{}
moduleManager[ibctransfertypes.ModuleName] = ibctransfer.AppModule{}
moduleManager[ibcfeetypes.ModuleName] = ibcfee.AppModule{}
moduleManager[icatypes.ModuleName] = icamodule.AppModule{}
moduleManager[capabilitytypes.ModuleName] = capability.AppModule{}

return modules
}
ibctm.AppModuleBasic{}.RegisterInterfaces(registry)
solomachine.AppModuleBasic{}.RegisterInterfaces(registry)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
ibccmd "github.com/cosmos/ibc-go/v8/modules/core/client/cli"
"github.com/spf13/cobra"
"github.com/spf13/viper"

Expand Down Expand Up @@ -87,6 +88,7 @@ func queryCommand() *cobra.Command {
server.QueryBlocksCmd(),
authcmd.QueryTxCmd(),
server.QueryBlockResultsCmd(),
ibccmd.GetQueryCmd(),
)
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")

Expand All @@ -113,6 +115,7 @@ func txCommand() *cobra.Command {
authcmd.GetEncodeCommand(),
authcmd.GetDecodeCommand(),
authcmd.GetSimulateCmd(),
ibccmd.GetTxCmd(),
)
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func NewRootCmd() *cobra.Command {
); err != nil {
panic(err)
}
// Since the IBC modules don't support dependency injection, we need to
// manually add the modules to the basic manager on the client side.
// This needs to be removed after IBC supports App Wiring.
app.RegisterIBC(moduleBasicManager, clientCtx.InterfaceRegistry)

rootCmd := &cobra.Command{
Use: app.Name + "d",
Expand Down Expand Up @@ -104,13 +108,6 @@ func NewRootCmd() *cobra.Command {
},
}

// Since the IBC modules don't support dependency injection, we need to
// manually register the modules on the client side.
// This needs to be removed after IBC supports App Wiring.
ibcModules := app.RegisterIBC(clientCtx.InterfaceRegistry)
for name, module := range ibcModules {
autoCliOpts.Modules[name] = module
}
initRootCmd(rootCmd, clientCtx.TxConfig, clientCtx.InterfaceRegistry, clientCtx.Codec, moduleBasicManager)

overwriteFlagDefaults(rootCmd, map[string]string{
Expand Down

0 comments on commit 68c8e29

Please sign in to comment.