Skip to content

Commit

Permalink
cli
Browse files Browse the repository at this point in the history
  • Loading branch information
lacsomot committed Oct 23, 2024
1 parent 64fedbf commit 09e9116
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 216 deletions.
209 changes: 0 additions & 209 deletions cmd/realio-networkd/genaccounts.go

This file was deleted.

26 changes: 19 additions & 7 deletions cmd/realio-networkd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
tmcfg "github.com/cometbft/cometbft/config"
tmcli "github.com/cometbft/cometbft/libs/cli"

"github.com/spf13/viper"

"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand All @@ -22,7 +24,6 @@ import (
storetypes "cosmossdk.io/store/types"
confixcmd "cosmossdk.io/tools/confix/cmd"
dbm "github.com/cosmos/cosmos-db"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
rosettacmd "github.com/cosmos/rosetta/cmd"

"github.com/cosmos/cosmos-sdk/baseapp"
Expand All @@ -43,7 +44,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/realiotech/realio-network/types"

ethermintclient "github.com/evmos/os/client"

Expand All @@ -60,11 +60,24 @@ const EnvPrefix = "REALIO"

var ChainID string

var tempDir = func() string {
dir, err := os.MkdirTemp("", "."+app.Name)
if err != nil {
dir = app.DefaultNodeHome
}
defer os.RemoveAll(dir)

return dir
}

// NewRootCmd creates a new root command for simd. It is called once in the
// main function.
func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
opt := baseapp.SetChainID(types.MainnetChainID)
tempApp := app.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, map[int64]bool{}, "test", 5, app.MakeEncodingConfig(), simtestutil.EmptyAppOptions{}, opt)
initAppOptions := viper.New()
tempDir := tempDir()
initAppOptions.Set(flags.FlagHome, tempDir)
// opt := baseapp.SetChainID(types.MainnetChainID)
tempApp := app.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, map[int64]bool{}, "test", 5, app.MakeEncodingConfig(), initAppOptions)
encodingConfig := app.MakeEncodingConfig()
initClientCtx := client.Context{}.
WithCodec(encodingConfig.Codec).
Expand Down Expand Up @@ -133,14 +146,12 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome),
),
genutilcli.Commands(encodingConfig.TxConfig, app.ModuleBasics, app.DefaultNodeHome),
AddGenesisAccountCmd(app.DefaultNodeHome),
tmcli.NewCompletionCmd(rootCmd, true),
NewTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
confixcmd.ConfigCommand(),
pruning.Cmd(a.newApp, app.DefaultNodeHome),
snapshot.Cmd(a.newApp),
server.QueryBlockResultsCmd(),
// this line is used by starport scaffolding # stargate/root/commands
)

Expand Down Expand Up @@ -180,7 +191,7 @@ func queryCommand() *cobra.Command {
server.QueryBlocksCmd(),
authcmd.QueryTxCmd(),
authcmd.QueryTxsByEventsCmd(),
authcmd.GetSimulateCmd(),
server.QueryBlockResultsCmd(),
)

app.ModuleBasics.AddQueryCommands(cmd)
Expand Down Expand Up @@ -208,6 +219,7 @@ func txCommand() *cobra.Command {
authcmd.GetBroadcastCommand(),
authcmd.GetEncodeCommand(),
authcmd.GetDecodeCommand(),
authcmd.GetSimulateCmd(),
flags.LineBreak,
)

Expand Down

0 comments on commit 09e9116

Please sign in to comment.