Skip to content

Commit

Permalink
fix: fix cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
tuantran1702 committed Jan 19, 2024
1 parent 44c6628 commit ca5e0c0
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
48 changes: 39 additions & 9 deletions cmd/quicksilverd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ import (
"os"
"path/filepath"

confixcmd "cosmossdk.io/tools/confix/cmd"
"github.com/cosmos/cosmos-sdk/client/pruning"
"github.com/cosmos/cosmos-sdk/client/snapshot"
sdk "github.com/cosmos/cosmos-sdk/types"

"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
tmcfg "github.com/cometbft/cometbft/config"
tmcli "github.com/cometbft/cometbft/libs/cli"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
rosettaCmd "github.com/cosmos/rosetta/cmd"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cast"
Expand Down Expand Up @@ -51,6 +58,37 @@ type appCreator struct {
encCfg app.EncodingConfig
}

func initRootCmd(
rootCmd *cobra.Command,
txConfig client.TxConfig,
interfaceRegistry codectypes.InterfaceRegistry,
appCodec codec.Codec,
basicManager module.BasicManager,
ac appCreator,
) {
cfg := sdk.GetConfig()
cfg.Seal()

rootCmd.AddCommand(
genutilcli.InitCmd(basicManager, app.DefaultNodeHome),
debug.Cmd(),
confixcmd.ConfigCommand(),
pruning.Cmd(ac.newApp, app.DefaultNodeHome),
snapshot.Cmd(ac.newApp),
)

server.AddCommands(rootCmd, app.DefaultNodeHome, ac.newApp, ac.appExport, addModuleInitFlags)

// add keybase, auxiliary RPC, query, genesis, and tx child commands
rootCmd.AddCommand(
server.StatusCommand(),
genesisCommand(txConfig, basicManager),
queryCommand(),
txCommand(),
keys.Commands(),
)
}

// NewRootCmd creates a new root command for quicksilverd. It is called once in the
// main function.
func NewRootCmd() (*cobra.Command, app.EncodingConfig) {
Expand Down Expand Up @@ -111,15 +149,9 @@ func NewRootCmd() (*cobra.Command, app.EncodingConfig) {
ac := appCreator{
encCfg: app.MakeEncodingConfig(),
}
initRootCmd(rootCmd, encodingConfig.TxConfig, encodingConfig.InterfaceRegistry, encodingConfig.Marshaler, app.ModuleBasics, ac)
server.AddCommands(rootCmd, app.DefaultNodeHome, ac.newApp, ac.appExport, addModuleInitFlags)

// add keybase, auxiliary RPC, query, and tx child commands
rootCmd.AddCommand(
queryCommand(),
txCommand(),
keys.Commands(),
)

// add rosetta
rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler))

Expand Down Expand Up @@ -189,8 +221,6 @@ func txCommand() *cobra.Command {
authcmd.GetEncodeCommand(),
authcmd.GetDecodeCommand(),
)

app.ModuleBasics.AddTxCommands(cmd)
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")

return cmd
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ module github.com/quicksilver-zone/quicksilver/v7
go 1.21

require (
cosmossdk.io/client/v2 v2.0.0-beta.1
cosmossdk.io/core v0.12.0
cosmossdk.io/errors v1.0.1
cosmossdk.io/log v1.3.0
cosmossdk.io/math v1.2.0
cosmossdk.io/store v1.0.3-0.20240110195214-b3ec5322273f
cosmossdk.io/tools/confix v0.1.0
cosmossdk.io/x/evidence v0.1.0
cosmossdk.io/x/feegrant v0.1.0
cosmossdk.io/x/upgrade v0.1.1
Expand Down Expand Up @@ -61,7 +63,6 @@ require (
cloud.google.com/go/iam v1.1.5 // indirect
cloud.google.com/go/storage v1.35.1 // indirect
cosmossdk.io/api v0.7.2 // indirect
cosmossdk.io/client/v2 v2.0.0-beta.1 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
cosmossdk.io/x/circuit v0.1.0 // indirect
Expand Down Expand Up @@ -121,6 +122,8 @@ require (
github.com/cosmos/iavl v1.0.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
github.com/creachadair/atomicfile v0.3.1 // indirect
github.com/creachadair/tomledit v0.0.24 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/daixiang0/gci v0.11.2 // indirect
github.com/danieljoos/wincred v1.2.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig=
cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0=
cosmossdk.io/store v1.0.3-0.20240110195214-b3ec5322273f h1:8twFj+pKguzbn59sk25av6Pk4Od+qBBA0o2i/kpgnP4=
cosmossdk.io/store v1.0.3-0.20240110195214-b3ec5322273f/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs=
cosmossdk.io/tools/confix v0.1.0 h1:2OOZTtQsDT5e7P3FM5xqM0bPfluAxZlAwxqaDmYBE+E=
cosmossdk.io/tools/confix v0.1.0/go.mod h1:TdXKVYs4gEayav5wM+JHT+kTU2J7fozFNqoVaN+8CdY=
cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs=
cosmossdk.io/x/circuit v0.1.0/go.mod h1:YDzblVE8+E+urPYQq5kq5foRY/IzhXovSYXb4nwd39w=
cosmossdk.io/x/evidence v0.1.0 h1:J6OEyDl1rbykksdGynzPKG5R/zm6TacwW2fbLTW4nCk=
Expand Down Expand Up @@ -451,6 +453,10 @@ github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFg
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creachadair/atomicfile v0.3.1 h1:yQORkHjSYySh/tv5th1dkKcn02NEW5JleB84sjt+W4Q=
github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU=
github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6QKQDhQ=
github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo=
Expand Down

0 comments on commit ca5e0c0

Please sign in to comment.