mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-05-22 06:46:39 +00:00

This is the quasi-standard and fixes the error below: ``` $ go get -u github.com/planetmint/planetmint-go@v0.1.0 go: github.com/planetmint/planetmint-go@v0.1.0: parsing go.mod: module declares its path as: planetmint-go but was required as: github.com/planetmint/planetmint-go ``` Signed-off-by: Julian Strobl <jmastr@mailbox.org>
48 lines
1.0 KiB
Go
48 lines
1.0 KiB
Go
package cli
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"encoding/json"
|
|
"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/machine/types"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var _ = strconv.Itoa(0)
|
|
|
|
func CmdAttestMachine() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "attest-machine [machine]",
|
|
Short: "Broadcast message attest-machine",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
|
argMachine := new(types.Machine)
|
|
err = json.Unmarshal([]byte(args[0]), argMachine)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
clientCtx, err := client.GetClientTxContext(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
msg := types.NewMsgAttestMachine(
|
|
clientCtx.GetFromAddress().String(),
|
|
argMachine,
|
|
)
|
|
if err := msg.ValidateBasic(); err != nil {
|
|
return err
|
|
}
|
|
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
|
},
|
|
}
|
|
|
|
flags.AddTxFlagsToCmd(cmd)
|
|
|
|
return cmd
|
|
}
|