-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathtx.go
More file actions
62 lines (52 loc) · 1.46 KB
/
tx.go
File metadata and controls
62 lines (52 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package cli
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/umee-network/umee/v3/x/ibc-rate-limit/types"
)
// GetTxCmd returns the CLI transaction commands for the x/ibc-rate-limit module.
func GetTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: types.ModuleName,
Short: fmt.Sprintf("Transaction commands for the %s module", types.ModuleName),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}
cmd.AddCommand(
SampleTOkenRegistration(),
)
return cmd
}
func SampleTOkenRegistration() *cobra.Command {
cmd := &cobra.Command{
Use: "register",
Args: cobra.NoArgs,
Short: "Supply a specified amount of a supported asset",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
addRateLimits := []types.RateLimit{
{
IbcDenom: "sai",
OutflowLimit: 1234,
Window: 1000,
},
{
IbcDenom: "raj",
OutflowLimit: 1234,
Window: 1000,
},
}
msg := types.NewIbcDenomsRateLimits(clientCtx.FromAddress.String(), "title", "desc", addRateLimits, nil)
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}