Rework the process of loading a genesis.json file to load a starting app state and set of initial transactions to process.
* New function to create genesis account from MsgCreateValidator
* Add arg to PrintUnsignedStdTx() to actually operate in offline mode
* New func processStdTxs()
* Remove gen-tx command
* Cleanup, return validators as they need to be written into genesis.json
* Modify gaiad init to allow auto-create of stdTx
* Remove server/testnet.go
* Don't load node_key.json, which might not be available
* Get the txs through DeliverTx
* Add app.slashingKeeper.AddValidators at the end of genesis
* On InitChain(), Signature's account number must be 0
* Add (tentative?) command to generate {node_key,priv_validator}.json files
* Reintroduce gaiad testnet
* Prompt user for passwords
* Update gaia to work with auth.StdTx
* Remove test_utils, NewTestGaiaAppGenState is now deprecated
* Combine --genesis-format and --generate-only
* Improve sign command's --offline flag documentation
* Moniker must be set
* Call app.slashingKeeper.AddValidators() even if len(txs) == 0
* Refactoring, introduce gaiad init --skip-genesis, code cleanup
* Drop unnecessary workaround to make lcd_tests pass
* Reintroduce gentx
* Simple name changes, GenesisState.Txs -> .GenTxs; OWK -> OverwriteKey; OverwriteKeys -> OverwriteKey
94 lines
2.8 KiB
Go
94 lines
2.8 KiB
Go
package main
|
|
|
|
import (
|
|
"github.com/cosmos/cosmos-sdk/client"
|
|
"github.com/cosmos/cosmos-sdk/client/keys"
|
|
"github.com/cosmos/cosmos-sdk/client/lcd"
|
|
_ "github.com/cosmos/cosmos-sdk/client/lcd/statik"
|
|
"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"
|
|
"github.com/cosmos/cosmos-sdk/version"
|
|
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
|
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
|
|
ibccmd "github.com/cosmos/cosmos-sdk/x/ibc/client/cli"
|
|
slashingcmd "github.com/cosmos/cosmos-sdk/x/slashing/client/cli"
|
|
stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli"
|
|
"github.com/spf13/cobra"
|
|
"github.com/tendermint/tendermint/libs/cli"
|
|
)
|
|
|
|
// rootCmd is the entry point for this binary
|
|
var (
|
|
rootCmd = &cobra.Command{
|
|
Use: "basecli",
|
|
Short: "Basecoin light-client",
|
|
}
|
|
)
|
|
|
|
func main() {
|
|
// disable sorting
|
|
cobra.EnableCommandSorting = false
|
|
|
|
// 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
|
|
rpc.AddCommands(rootCmd)
|
|
rootCmd.AddCommand(client.LineBreak)
|
|
tx.AddCommands(rootCmd, cdc)
|
|
rootCmd.AddCommand(client.LineBreak)
|
|
|
|
// add query/post commands (custom to binary)
|
|
rootCmd.AddCommand(
|
|
client.GetCommands(
|
|
stakecmd.GetCmdQueryValidator("stake", cdc),
|
|
stakecmd.GetCmdQueryValidators("stake", cdc),
|
|
stakecmd.GetCmdQueryDelegation("stake", cdc),
|
|
stakecmd.GetCmdQueryDelegations("stake", cdc),
|
|
stakecmd.GetCmdQueryPool("stake", cdc),
|
|
stakecmd.GetCmdQueryParams("stake", cdc),
|
|
stakecmd.GetCmdQueryUnbondingDelegation("stake", cdc),
|
|
stakecmd.GetCmdQueryUnbondingDelegations("stake", cdc),
|
|
stakecmd.GetCmdQueryRedelegation("stake", cdc),
|
|
stakecmd.GetCmdQueryRedelegations("stake", cdc),
|
|
slashingcmd.GetCmdQuerySigningInfo("slashing", cdc),
|
|
authcmd.GetAccountCmd("acc", cdc, types.GetAccountDecoder(cdc)),
|
|
)...)
|
|
|
|
rootCmd.AddCommand(
|
|
client.PostCommands(
|
|
bankcmd.SendTxCmd(cdc),
|
|
ibccmd.IBCTransferCmd(cdc),
|
|
ibccmd.IBCRelayCmd(cdc),
|
|
stakecmd.GetCmdCreateValidator(cdc),
|
|
stakecmd.GetCmdEditValidator(cdc),
|
|
stakecmd.GetCmdDelegate(cdc),
|
|
stakecmd.GetCmdUnbond("stake", cdc),
|
|
stakecmd.GetCmdRedelegate("stake", cdc),
|
|
slashingcmd.GetCmdUnjail(cdc),
|
|
)...)
|
|
|
|
// add proxy, version and key info
|
|
rootCmd.AddCommand(
|
|
client.LineBreak,
|
|
lcd.ServeCommand(cdc),
|
|
keys.Commands(),
|
|
client.LineBreak,
|
|
version.VersionCmd,
|
|
)
|
|
|
|
// prepare and add flags
|
|
executor := cli.PrepareMainCmd(rootCmd, "BC", app.DefaultCLIHome)
|
|
err := executor.Execute()
|
|
if err != nil {
|
|
// Note: Handle with #870
|
|
panic(err)
|
|
}
|
|
}
|