cosmos-sdk/examples/basecoin/cmd/basecli/main.go

85 lines
2.2 KiB
Go
Raw Normal View History

2018-02-22 06:33:34 -08:00
package main
import (
"os"
2018-02-22 06:33:34 -08:00
"github.com/cosmos/cosmos-sdk/client"
2018-02-22 08:20:25 -08:00
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/lcd"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/examples/basecoin/app"
"github.com/cosmos/cosmos-sdk/examples/basecoin/types"
2018-02-22 06:33:34 -08:00
"github.com/cosmos/cosmos-sdk/version"
2018-04-27 17:36:11 -07:00
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
2018-04-25 07:18:06 -07:00
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
ibccmd "github.com/cosmos/cosmos-sdk/x/ibc/client/cli"
stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/cli"
2018-02-22 06:33:34 -08:00
)
2018-04-05 03:41:11 -07:00
// rootCmd is the entry point for this binary
2018-02-22 06:33:34 -08:00
var (
2018-04-05 03:41:11 -07:00
rootCmd = &cobra.Command{
2018-02-22 06:33:34 -08:00
Use: "basecli",
Short: "Basecoin light-client",
}
)
func main() {
// disable sorting
cobra.EnableCommandSorting = false
2018-02-28 17:57:38 -08:00
// get the codec
cdc := app.MakeCodec()
// TODO: Setup keybase, viper object, etc. to be passed into
// the below functions and eliminate global vars, like we do
// with the cdc.
// add standard rpc, and tx commands
2018-04-05 03:41:11 -07:00
rpc.AddCommands(rootCmd)
rootCmd.AddCommand(client.LineBreak)
tx.AddCommands(rootCmd, cdc)
rootCmd.AddCommand(client.LineBreak)
2018-02-22 09:15:01 -08:00
// add query/post commands (custom to binary)
2018-04-27 08:14:08 -07:00
rootCmd.AddCommand(
client.GetCommands(
Merge PR #1119: Unbonding, Redelegation * stake/fees spec updates * staking overview.md revisions, moving files * docs reorganization * staking spec state revisions * transaction stake updates * complete staking spec update * WIP adding unbonding/redelegation commands * added msg types for unbonding, redelegation * stake sub-package reorg * working stake reorg * modify lcd tests to not use hardcoded json strings * add description update * index keys * key managment for unbonding redelegation complete * update stake errors * completed handleMsgCompleteUnbonding fn * updated to use begin/complete unbonding/redelegation * fix token shares bug * develop docs into unbonding * got non-tests compiling after merge develop * working fixing tests * PrivlegedKeeper -> PrivilegedKeeper * tests compile * fix some tests * fixing tests * remove PrivilegedKeeper * get unbonding bug * only rpc sig verification failed tests now * move percent unbonding/redelegation to the CLI and out of handler logic * remove min unbonding height * add lcd txs * add pool sanity checks, fix a buncha tests * fix ante. set lcd log to debug (#1322) * redelegation tests, adding query functionality for bonds * add self-delegations at genesis ref #1165 * PR comments (mostly) addressed * cleanup, added Query LCD functionality * test cleanup/fixes * fix governance test * SlashValidatorSet -> ValidatorSet * changelog * stake lcd fix * x/auth: fix chainID in ante * fix lcd test * fix lint, update lint make command for spelling * lowercase error string * don't expose coinkeeper in staking * remove a few duplicate lines in changelog * chain_id in stake lcd tests * added transient redelegation * 'transient' => 'transitive' * Re-add nolint instruction * Fix tiny linter error
2018-06-26 19:00:12 -07:00
stakecmd.GetCmdQueryValidator("stake", cdc),
stakecmd.GetCmdQueryValidators("stake", cdc),
stakecmd.GetCmdQueryDelegation("stake", cdc),
stakecmd.GetCmdQueryDelegations("stake", cdc),
2018-04-27 08:14:08 -07:00
authcmd.GetAccountCmd("acc", cdc, types.GetAccountDecoder(cdc)),
)...)
2018-04-05 03:41:11 -07:00
rootCmd.AddCommand(
client.PostCommands(
2018-02-28 17:57:38 -08:00
bankcmd.SendTxCmd(cdc),
ibccmd.IBCTransferCmd(cdc),
2018-03-18 08:24:48 -07:00
ibccmd.IBCRelayCmd(cdc),
2018-05-31 12:22:46 -07:00
stakecmd.GetCmdCreateValidator(cdc),
stakecmd.GetCmdEditValidator(cdc),
stakecmd.GetCmdDelegate(cdc),
Merge PR #1119: Unbonding, Redelegation * stake/fees spec updates * staking overview.md revisions, moving files * docs reorganization * staking spec state revisions * transaction stake updates * complete staking spec update * WIP adding unbonding/redelegation commands * added msg types for unbonding, redelegation * stake sub-package reorg * working stake reorg * modify lcd tests to not use hardcoded json strings * add description update * index keys * key managment for unbonding redelegation complete * update stake errors * completed handleMsgCompleteUnbonding fn * updated to use begin/complete unbonding/redelegation * fix token shares bug * develop docs into unbonding * got non-tests compiling after merge develop * working fixing tests * PrivlegedKeeper -> PrivilegedKeeper * tests compile * fix some tests * fixing tests * remove PrivilegedKeeper * get unbonding bug * only rpc sig verification failed tests now * move percent unbonding/redelegation to the CLI and out of handler logic * remove min unbonding height * add lcd txs * add pool sanity checks, fix a buncha tests * fix ante. set lcd log to debug (#1322) * redelegation tests, adding query functionality for bonds * add self-delegations at genesis ref #1165 * PR comments (mostly) addressed * cleanup, added Query LCD functionality * test cleanup/fixes * fix governance test * SlashValidatorSet -> ValidatorSet * changelog * stake lcd fix * x/auth: fix chainID in ante * fix lcd test * fix lint, update lint make command for spelling * lowercase error string * don't expose coinkeeper in staking * remove a few duplicate lines in changelog * chain_id in stake lcd tests * added transient redelegation * 'transient' => 'transitive' * Re-add nolint instruction * Fix tiny linter error
2018-06-26 19:00:12 -07:00
stakecmd.GetCmdUnbond("stake", cdc),
2018-03-18 08:24:48 -07:00
)...)
2018-02-22 06:33:34 -08:00
// add proxy, version and key info
2018-04-05 03:41:11 -07:00
rootCmd.AddCommand(
client.LineBreak,
lcd.ServeCommand(cdc),
2018-02-22 08:20:25 -08:00
keys.Commands(),
client.LineBreak,
2018-02-22 06:33:34 -08:00
version.VersionCmd,
)
// prepare and add flags
2018-04-05 03:41:11 -07:00
executor := cli.PrepareMainCmd(rootCmd, "BC", os.ExpandEnv("$HOME/.basecli"))
err := executor.Execute()
if err != nil {
// Note: Handle with #870
panic(err)
}
2018-02-22 06:33:34 -08:00
}