-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix oracle prometheus server to be finished properly * fix slasing cli
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package cli | ||
|
||
import ( | ||
"cosmossdk.io/core/address" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/client/tx" | ||
"github.com/cosmos/cosmos-sdk/x/slashing/types" | ||
) | ||
|
||
// NewTxCmd returns a root CLI command handler for all x/slashing transaction commands. | ||
func NewTxCmd(vc address.Codec) *cobra.Command { | ||
slashingTxCmd := &cobra.Command{ | ||
Use: types.ModuleName, | ||
Short: "Slashing transaction subcommands", | ||
DisableFlagParsing: true, | ||
SuggestionsMinimumDistance: 2, | ||
RunE: client.ValidateCmd, | ||
} | ||
|
||
slashingTxCmd.AddCommand(NewUnjailTxCmd(vc)) | ||
return slashingTxCmd | ||
} | ||
|
||
// NewUnjailTxCmd returns a CLI command handler for creating a MsgUnjail transaction. | ||
func NewUnjailTxCmd(vc address.Codec) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "unjail", | ||
Args: cobra.NoArgs, | ||
Short: "unjail validator previously jailed for downtime", | ||
Long: `unjail a jailed validator: | ||
$ <appd> tx slashing unjail --from mykey | ||
`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
valAddr := clientCtx.GetFromAddress() | ||
valAddrStr, err := vc.BytesToString(valAddr) | ||
if err != nil { | ||
return err | ||
|
||
} | ||
|
||
msg := types.NewMsgUnjail(valAddrStr) | ||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) | ||
}, | ||
} | ||
|
||
flags.AddTxFlagsToCmd(cmd) | ||
|
||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters