forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautocli.go
134 lines (129 loc) · 5.64 KB
/
autocli.go
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package bank
import (
"fmt"
"strings"
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
"github.com/cosmos/cosmos-sdk/version"
)
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
return &autocliv1.ModuleOptions{
Query: &autocliv1.ServiceCommandDescriptor{
Service: bankv1beta1.Query_ServiceDesc.ServiceName,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "Balance",
Use: "balance <address> <denom>",
Short: "Query an account balance by address and denom",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}, {ProtoField: "denom"}},
},
{
RpcMethod: "AllBalances",
Use: "balances <address>",
Short: "Query for account balances by address",
Long: "Query the total balance of an account or of a specific denomination.",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}},
},
{
RpcMethod: "SpendableBalances",
Use: "spendable-balances <address>",
Short: "Query for account spendable balances by address",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}},
},
{
RpcMethod: "SpendableBalanceByDenom",
Use: "spendable-balance <address> <denom>",
Short: "Query the spendable balance of a single denom for a single account.",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}, {ProtoField: "denom"}},
},
{
RpcMethod: "TotalSupply",
Use: "total-supply",
Alias: []string{"total"},
Short: "Query the total supply of coins of the chain",
Long: "Query total supply of coins that are held by accounts in the chain. To query for the total supply of a specific coin denomination use --denom flag.",
},
{
RpcMethod: "SupplyOf",
Use: "total-supply-of <denom>",
Short: "Query the supply of a single coin denom",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "denom"}},
},
{
RpcMethod: "Params",
Use: "params",
Short: "Query the current bank parameters",
},
{
RpcMethod: "DenomMetadata",
Use: "denom-metadata <denom>",
Short: "Query the client metadata of a given coin denomination",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "denom"}},
},
{
RpcMethod: "DenomsMetadata",
Use: "denoms-metadata",
Short: "Query the client metadata for all registered coin denominations",
},
{
RpcMethod: "DenomOwners",
Use: "denom-owners <denom>",
Short: "Query for all account addresses that own a particular token denomination.",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "denom"}},
},
{
RpcMethod: "SendEnabled",
Use: "send-enabled <denom1>...",
Short: "Query for send enabled entries",
Long: strings.TrimSpace(`Query for send enabled entries that have been specifically set.
To look up one or more specific denoms, supply them as arguments to this command.
To look up all denoms, do not provide any arguments.`,
),
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "denoms", Varargs: true}},
},
},
},
Tx: &autocliv1.ServiceCommandDescriptor{
Service: bankv1beta1.Msg_ServiceDesc.ServiceName,
EnhanceCustomCommand: true,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "Send",
Use: "send <from_key_or_address> <to_address> <amount>...",
Short: "Send funds from one account to another.",
Long: `Send funds from one account to another.
Note, the '--from' flag is ignored as it is implied from [from_key_or_address].
When using '--dry-run' a key name cannot be used, only a bech32 address.
Note: multiple coins can be send by space separated.`,
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "from_address"}, {ProtoField: "to_address"}, {ProtoField: "amount", Varargs: true}},
},
{
RpcMethod: "Burn",
Use: "burn <from_key_or_address> <amount>",
Short: "Burns the amount specified from the given account.",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "from_address"}, {ProtoField: "amount", Varargs: true}},
},
{
RpcMethod: "UpdateParams",
Use: "update-params-proposal <params>",
Short: "Submit a proposal to update bank module params. Note: the entire params must be provided.",
Example: fmt.Sprintf(`%s tx bank update-params-proposal '{ "default_send_enabled": true }'`, version.AppName),
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}},
GovProposal: true,
},
{
RpcMethod: "SetSendEnabled",
Use: "set-send-enabled-proposal <send_enabled>",
Short: "Submit a proposal to set/update/delete send enabled entries",
Example: fmt.Sprintf(`%s tx bank set-send-enabled-proposal '{"denom":"stake","enabled":true}'`, version.AppName),
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "send_enabled", Varargs: true}},
FlagOptions: map[string]*autocliv1.FlagOptions{
"use_default_for": {Name: "use-default-for", Usage: "Use default for the given denom (delete a send enabled entry)"},
},
GovProposal: true,
},
},
},
}
}