mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-07-09 05:52:31 +00:00

* 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>
53 lines
1.1 KiB
Go
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
|
|
}
|