mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00

* add MintAddress to params.proto * ignite scaffold message update-params params:Params --module dao * add dao get and set params * make dao.MsgUpdateParams.Params non-nullable * use GetMintAddress in ante handler * adjust dao e2e test suit for mint address param * change msg creator to authority and set gov module as default in gov proposal * fix staticcheck error * remove depricated config param * fix linter errors Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
49 lines
1019 B
Go
49 lines
1019 B
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/dao/types"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var _ = strconv.Itoa(0)
|
|
|
|
func CmdUpdateParams() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "update-params [params]",
|
|
Short: "Broadcast message update-params",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
|
argParams := new(types.Params)
|
|
err = json.Unmarshal([]byte(args[0]), argParams)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
clientCtx, err := client.GetClientTxContext(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
msg := types.NewMsgUpdateParams(
|
|
clientCtx.GetFromAddress().String(),
|
|
*argParams,
|
|
)
|
|
if err := msg.ValidateBasic(); err != nil {
|
|
return err
|
|
}
|
|
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
|
},
|
|
}
|
|
|
|
flags.AddTxFlagsToCmd(cmd)
|
|
|
|
return cmd
|
|
}
|