Skip to content

Commit

Permalink
feat(cli): merge crosschain cmd from v4
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code committed May 17, 2023
1 parent 46e096e commit 8c9b7b7
Show file tree
Hide file tree
Showing 21 changed files with 686 additions and 492 deletions.
2 changes: 2 additions & 0 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (
avalanchetypes "github.com/functionx/fx-core/v3/x/avalanche/types"
"github.com/functionx/fx-core/v3/x/bsc"
bsctypes "github.com/functionx/fx-core/v3/x/bsc/types"
crosschainclient "github.com/functionx/fx-core/v3/x/crosschain/client"
crosschaintypes "github.com/functionx/fx-core/v3/x/crosschain/types"
"github.com/functionx/fx-core/v3/x/erc20"
erc20client "github.com/functionx/fx-core/v3/x/erc20/client"
Expand Down Expand Up @@ -118,6 +119,7 @@ var ModuleBasics = module.NewBasicManager(
erc20client.RegisterERC20ProposalHandler,
erc20client.ToggleTokenConversionProposalHandler,
erc20client.UpdateDenomAliasProposalHandler,
crosschainclient.UpdateChainOraclesProposalHandler,
}...),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
Expand Down
21 changes: 19 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ import (
fxcfg "github.com/functionx/fx-core/v3/server/config"
"github.com/functionx/fx-core/v3/server/grpc/base/gasprice"
fxtypes "github.com/functionx/fx-core/v3/types"
avalanchecli "github.com/functionx/fx-core/v3/x/avalanche/client/cli"
bsccli "github.com/functionx/fx-core/v3/x/bsc/client/cli"
crosschaincli "github.com/functionx/fx-core/v3/x/crosschain/client/cli"
ethcli "github.com/functionx/fx-core/v3/x/eth/client/cli"
polygoncli "github.com/functionx/fx-core/v3/x/polygon/client/cli"
troncli "github.com/functionx/fx-core/v3/x/tron/client/cli"
)

// NewRootCmd creates a new root command for simd. It is called once in the
Expand Down Expand Up @@ -157,7 +162,13 @@ func queryCommand() *cobra.Command {
cli.QueryValidatorByConsAddr(),
cli.QueryBlockResultsCmd(),
gasprice.QueryCmd(),
crosschaincli.GetQueryCmd(),
crosschaincli.GetQueryCmd(
avalanchecli.GetQueryCmd(),
bsccli.GetQueryCmd(),
ethcli.GetQueryCmd(),
polygoncli.GetQueryCmd(),
troncli.GetQueryCmd(),
),
)

app.ModuleBasics.AddQueryCommands(cmd)
Expand All @@ -184,7 +195,13 @@ func txCommand() *cobra.Command {
authcmd.GetBroadcastCommand(),
authcmd.GetEncodeCommand(),
authcmd.GetDecodeCommand(),
crosschaincli.GetTxCmd(),
crosschaincli.GetTxCmd(
avalanchecli.GetTxCmd(),
bsccli.GetTxCmd(),
ethcli.GetTxCmd(),
polygoncli.GetTxCmd(),
troncli.GetTxCmd(),
),
)

app.ModuleBasics.AddTxCommands(cmd)
Expand Down
21 changes: 21 additions & 0 deletions x/avalanche/client/cli/query.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cli

import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"

"github.com/functionx/fx-core/v3/x/avalanche/types"
"github.com/functionx/fx-core/v3/x/crosschain/client/cli"
)

func GetQueryCmd() *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: "Querying commands for the avalanche module",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(cli.GetQuerySubCmds(types.ModuleName)...)
return cmd
}
21 changes: 21 additions & 0 deletions x/avalanche/client/cli/tx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cli

import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"

"github.com/functionx/fx-core/v3/x/avalanche/types"
"github.com/functionx/fx-core/v3/x/crosschain/client/cli"
)

func GetTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: "Avalanche transaction subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(cli.GetTxSubCmds(types.ModuleName)...)
return cmd
}
5 changes: 3 additions & 2 deletions x/avalanche/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"

"github.com/functionx/fx-core/v3/x/avalanche/client/cli"
"github.com/functionx/fx-core/v3/x/avalanche/types"
crosschainkeeper "github.com/functionx/fx-core/v3/x/crosschain/keeper"
crosschaintypes "github.com/functionx/fx-core/v3/x/crosschain/types"
Expand Down Expand Up @@ -61,12 +62,12 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.Ser

// GetQueryCmd implements app module basic
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return nil
return cli.GetQueryCmd()
}

// GetTxCmd implements app module basic
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return nil
return cli.GetTxCmd()
}

// RegisterInterfaces implements app bmodule basic
Expand Down
21 changes: 21 additions & 0 deletions x/bsc/client/cli/query.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cli

import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"

"github.com/functionx/fx-core/v3/x/bsc/types"
"github.com/functionx/fx-core/v3/x/crosschain/client/cli"
)

func GetQueryCmd() *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: "Querying commands for the bsc module",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(cli.GetQuerySubCmds(types.ModuleName)...)
return cmd
}
21 changes: 21 additions & 0 deletions x/bsc/client/cli/tx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cli

import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"

"github.com/functionx/fx-core/v3/x/bsc/types"
"github.com/functionx/fx-core/v3/x/crosschain/client/cli"
)

func GetTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: "BSC transaction subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(cli.GetTxSubCmds(types.ModuleName)...)
return cmd
}
5 changes: 3 additions & 2 deletions x/bsc/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"

"github.com/functionx/fx-core/v3/x/bsc/client/cli"
"github.com/functionx/fx-core/v3/x/bsc/types"
crosschainkeeper "github.com/functionx/fx-core/v3/x/crosschain/keeper"
crosschaintypes "github.com/functionx/fx-core/v3/x/crosschain/types"
Expand Down Expand Up @@ -61,12 +62,12 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.Ser

// GetQueryCmd implements app module basic
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return nil
return cli.GetQueryCmd()
}

// GetTxCmd implements app module basic
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return nil
return cli.GetTxCmd()
}

// RegisterInterfaces implements app bmodule basic
Expand Down
Loading

0 comments on commit 8c9b7b7

Please sign in to comment.