planetmint-go/x/dao/client/cli/tx_init_pop.go
Jürgen Eckel 6a60b78b62
Added PoP Initialization and a Challenge Query (#207)
* added InitPoP message
* added getChallenge query to inspect challenges
* adjusted towards a unique block height identification unit: int64, not uint64
* added challenge param finished to identify challenges that weren't completed but will be part of re-issuance.

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-11-29 13:33:25 +01:00

53 lines
1.1 KiB
Go

package cli
import (
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/planetmint/planetmint-go/x/dao/types"
"github.com/spf13/cast"
"github.com/spf13/cobra"
)
var _ = strconv.Itoa(0)
func CmdInitPop() *cobra.Command {
cmd := &cobra.Command{
Use: "init-pop [initiator] [challenger] [challengee] [height]",
Short: "Broadcast message InitPop",
Args: cobra.ExactArgs(4),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argInitiator := args[0]
argChallenger := args[1]
argChallengee := args[2]
argHeight, err := cast.ToInt64E(args[3])
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgInitPop(
clientCtx.GetFromAddress().String(),
argInitiator,
argChallenger,
argChallengee,
argHeight,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}