From 9c2c88317d94f7233fd19687ad50e98fe4e26db1 Mon Sep 17 00:00:00 2001 From: Hieu Vu Date: Fri, 27 Dec 2024 23:35:17 +0700 Subject: [PATCH] update cli --- x/bridge/client/cli/tx.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/x/bridge/client/cli/tx.go b/x/bridge/client/cli/tx.go index fe38e7c7..d2037342 100644 --- a/x/bridge/client/cli/tx.go +++ b/x/bridge/client/cli/tx.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "time" "github.com/spf13/cobra" @@ -27,6 +28,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdBridgeOut()) cmd.AddCommand(CmdRegisterNewCoins()) cmd.AddCommand(CmdDeregisterCoins()) + cmd.AddCommand(CmdUpdateEpochDuration()) // this line is used by starport scaffolding # 1 return cmd @@ -155,3 +157,32 @@ func CmdRegisterNewCoins() *cobra.Command { return cmd } + +func CmdUpdateEpochDuration() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-epoch-duration [duration]", + Short: "Broadcast message UpdateEpochDuration", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + duration, err := time.ParseDuration(args[0]) + if err != nil { + return err + } + + msg := &types.MsgUpdateEpochDuration{ + Authority: clientCtx.GetFromAddress().String(), + Duration: duration, + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +}