github.com/cosmos/cosmos-sdk@v0.50.10/x/genutil/client/cli/commands.go (about)

     1  package cli
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  
     6  	"github.com/cosmos/cosmos-sdk/client"
     7  	"github.com/cosmos/cosmos-sdk/types/module"
     8  	banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
     9  	"github.com/cosmos/cosmos-sdk/x/genutil"
    10  	genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
    11  )
    12  
    13  // GenesisCoreCommand adds core sdk's sub-commands into genesis command.
    14  // Deprecated: use Commands instead.
    15  func GenesisCoreCommand(txConfig client.TxConfig, moduleBasics module.BasicManager, defaultNodeHome string) *cobra.Command {
    16  	return Commands(txConfig, moduleBasics, defaultNodeHome)
    17  }
    18  
    19  // Commands adds core sdk's sub-commands into genesis command.
    20  func Commands(txConfig client.TxConfig, moduleBasics module.BasicManager, defaultNodeHome string) *cobra.Command {
    21  	return CommandsWithCustomMigrationMap(txConfig, moduleBasics, defaultNodeHome, MigrationMap)
    22  }
    23  
    24  // CommandsWithCustomMigrationMap adds core sdk's sub-commands into genesis command with custom migration map.
    25  // This custom migration map can be used by the application to add its own migration map.
    26  func CommandsWithCustomMigrationMap(txConfig client.TxConfig, moduleBasics module.BasicManager, defaultNodeHome string, migrationMap genutiltypes.MigrationMap) *cobra.Command {
    27  	cmd := &cobra.Command{
    28  		Use:                        "genesis",
    29  		Short:                      "Application's genesis-related subcommands",
    30  		DisableFlagParsing:         false,
    31  		SuggestionsMinimumDistance: 2,
    32  		RunE:                       client.ValidateCmd,
    33  	}
    34  	gentxModule := moduleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic)
    35  
    36  	cmd.AddCommand(
    37  		GenTxCmd(moduleBasics, txConfig, banktypes.GenesisBalancesIterator{}, defaultNodeHome, txConfig.SigningContext().ValidatorAddressCodec()),
    38  		MigrateGenesisCmd(migrationMap),
    39  		CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, defaultNodeHome, gentxModule.GenTxValidator, txConfig.SigningContext().ValidatorAddressCodec()),
    40  		ValidateGenesisCmd(moduleBasics),
    41  		AddGenesisAccountCmd(defaultNodeHome, txConfig.SigningContext().AddressCodec()),
    42  		AddBulkGenesisAccountCmd(defaultNodeHome, txConfig.SigningContext().AddressCodec()),
    43  	)
    44  
    45  	return cmd
    46  }