* Refactor CliContext as Context
* Fix lint issues
* Fix goimports
* Fix gov tests
* Resolved ci-lint issues
* Add changelog
* Rename cliCtx to clientCtx
* Fix mocks and routes
* Add changelog
* Update changelog
* Apply suggestions from code review
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
* merge client/rpc/ro{ot,utes}.go
* Update docs
* client/rpc: remove redundant client/rpc.RegisterRPCRoutes
* regenerate mocks
* Update ADRs
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package cli
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
|
"github.com/cosmos/cosmos-sdk/client/tx"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/cosmos/cosmos-sdk/x/slashing/types"
|
|
)
|
|
|
|
// NewTxCmd returns a root CLI command handler for all x/slashing transaction commands.
|
|
func NewTxCmd(clientCtx client.Context) *cobra.Command {
|
|
slashingTxCmd := &cobra.Command{
|
|
Use: types.ModuleName,
|
|
Short: "Slashing transaction subcommands",
|
|
DisableFlagParsing: true,
|
|
SuggestionsMinimumDistance: 2,
|
|
RunE: client.ValidateCmd,
|
|
}
|
|
|
|
slashingTxCmd.AddCommand(NewUnjailTxCmd(clientCtx))
|
|
return slashingTxCmd
|
|
}
|
|
|
|
func NewUnjailTxCmd(clientCtx client.Context) *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "unjail",
|
|
Args: cobra.NoArgs,
|
|
Short: "unjail validator previously jailed for downtime",
|
|
Long: `unjail a jailed validator:
|
|
|
|
$ <appcli> tx slashing unjail --from mykey
|
|
`,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
clientCtx := clientCtx.InitWithInput(cmd.InOrStdin())
|
|
|
|
valAddr := clientCtx.GetFromAddress()
|
|
msg := types.NewMsgUnjail(sdk.ValAddress(valAddr))
|
|
if err := msg.ValidateBasic(); err != nil {
|
|
return err
|
|
}
|
|
|
|
return tx.GenerateOrBroadcastTx(clientCtx, msg)
|
|
},
|
|
}
|
|
return flags.PostCommands(cmd)[0]
|
|
}
|