package cli import ( "github.com/cosmos/cosmos-sdk/client/context" "github.com/cosmos/cosmos-sdk/client/utils" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder" "github.com/cosmos/cosmos-sdk/x/slashing" "os" "github.com/spf13/cobra" ) // GetCmdUnjail implements the create unjail validator command. func GetCmdUnjail(cdc *codec.Codec) *cobra.Command { cmd := &cobra.Command{ Use: "unjail", Args: cobra.NoArgs, Short: "unjail validator previously jailed for downtime", RunE: func(cmd *cobra.Command, args []string) error { txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc) cliCtx := context.NewCLIContext(). WithCodec(cdc). WithAccountDecoder(cdc) valAddr, err := cliCtx.GetFromAddress() if err != nil { return err } msg := slashing.NewMsgUnjail(sdk.ValAddress(valAddr)) if cliCtx.GenerateOnly { return utils.PrintUnsignedStdTx(os.Stdout, txBldr, cliCtx, []sdk.Msg{msg}, false) } return utils.CompleteAndBroadcastTxCli(txBldr, cliCtx, []sdk.Msg{msg}) }, } return cmd }