github.com/cosmos/cosmos-sdk@v0.50.10/x/gov/autocli.go (about) 1 package gov 2 3 import ( 4 "fmt" 5 6 autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" 7 govv1 "cosmossdk.io/api/cosmos/gov/v1" 8 9 "github.com/cosmos/cosmos-sdk/version" 10 ) 11 12 // AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. 13 func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { 14 return &autocliv1.ModuleOptions{ 15 Query: &autocliv1.ServiceCommandDescriptor{ 16 Service: govv1.Query_ServiceDesc.ServiceName, 17 RpcCommandOptions: []*autocliv1.RpcCommandOptions{ 18 { 19 RpcMethod: "Params", 20 Use: "params", 21 Short: "Query the parameters of the governance process", 22 Long: "Query the parameters of the governance process. Specify specific param types (voting|tallying|deposit) to filter results.", 23 PositionalArgs: []*autocliv1.PositionalArgDescriptor{ 24 {ProtoField: "params_type", Optional: true}, 25 }, 26 }, 27 { 28 RpcMethod: "Proposals", 29 Use: "proposals", 30 Short: "Query proposals with optional filters", 31 Example: fmt.Sprintf("%[1]s query gov proposals --depositor cosmos1...\n%[1]s query gov proposals --voter cosmos1...\n%[1]s query gov proposals --proposal-status (unspecified | deposit-period | voting-period | passed | rejected | failed)", version.AppName), 32 }, 33 { 34 RpcMethod: "Proposal", 35 Use: "proposal [proposal-id]", 36 Alias: []string{"proposer"}, 37 Short: "Query details of a single proposal", 38 Example: fmt.Sprintf("%s query gov proposal 1", version.AppName), 39 PositionalArgs: []*autocliv1.PositionalArgDescriptor{ 40 {ProtoField: "proposal_id"}, 41 }, 42 }, 43 { 44 RpcMethod: "Vote", 45 Use: "vote [proposal-id] [voter-addr]", 46 Short: "Query details of a single vote", 47 Example: fmt.Sprintf("%s query gov vote 1 cosmos1...", version.AppName), 48 PositionalArgs: []*autocliv1.PositionalArgDescriptor{ 49 {ProtoField: "proposal_id"}, 50 {ProtoField: "voter"}, 51 }, 52 }, 53 { 54 RpcMethod: "Votes", 55 Use: "votes [proposal-id]", 56 Short: "Query votes of a single proposal", 57 Example: fmt.Sprintf("%s query gov votes 1", version.AppName), 58 PositionalArgs: []*autocliv1.PositionalArgDescriptor{ 59 {ProtoField: "proposal_id"}, 60 }, 61 }, 62 { 63 RpcMethod: "Deposit", 64 Use: "deposit [proposal-id] [depositer-addr]", 65 Short: "Query details of a deposit", 66 PositionalArgs: []*autocliv1.PositionalArgDescriptor{ 67 {ProtoField: "proposal_id"}, 68 {ProtoField: "depositor"}, 69 }, 70 }, 71 { 72 RpcMethod: "Deposits", 73 Use: "deposits [proposal-id]", 74 Short: "Query deposits on a proposal", 75 PositionalArgs: []*autocliv1.PositionalArgDescriptor{ 76 {ProtoField: "proposal_id"}, 77 }, 78 }, 79 { 80 RpcMethod: "TallyResult", 81 Use: "tally [proposal-id]", 82 Short: "Query the tally of a proposal vote", 83 Example: fmt.Sprintf("%s query gov tally 1", version.AppName), 84 PositionalArgs: []*autocliv1.PositionalArgDescriptor{ 85 {ProtoField: "proposal_id"}, 86 }, 87 }, 88 { 89 RpcMethod: "Constitution", 90 Use: "constitution", 91 Short: "Query the current chain constitution", 92 }, 93 }, 94 EnhanceCustomCommand: true, // We still have manual commands in gov that we want to keep 95 }, 96 Tx: &autocliv1.ServiceCommandDescriptor{ 97 Service: govv1.Msg_ServiceDesc.ServiceName, 98 RpcCommandOptions: []*autocliv1.RpcCommandOptions{ 99 { 100 RpcMethod: "Deposit", 101 Use: "deposit [proposal-id] [deposit]", 102 Short: "Deposit tokens for an active proposal", 103 Long: fmt.Sprintf(`Submit a deposit for an active proposal. You can find the proposal-id by running "%s query gov proposals"`, version.AppName), 104 Example: fmt.Sprintf(`$ %s tx gov deposit 1 10stake --from mykey`, version.AppName), 105 PositionalArgs: []*autocliv1.PositionalArgDescriptor{ 106 {ProtoField: "proposal_id"}, 107 {ProtoField: "amount", Varargs: true}, 108 }, 109 }, 110 { 111 RpcMethod: "CancelProposal", 112 Use: "cancel-proposal [proposal-id]", 113 Short: "Cancel governance proposal before the voting period ends. Must be signed by the proposal creator.", 114 Example: fmt.Sprintf(`$ %s tx gov cancel-proposal 1 --from mykey`, version.AppName), 115 PositionalArgs: []*autocliv1.PositionalArgDescriptor{ 116 {ProtoField: "proposal_id"}, 117 }, 118 }, 119 { 120 RpcMethod: "Vote", 121 Use: "vote [proposal-id] [option]", 122 Short: "Vote for an active proposal, options: yes/no/no-with-veto/abstain", 123 Long: fmt.Sprintf(`Submit a vote for an active proposal. Use the --metadata to optionally give a reason. You can find the proposal-id by running "%s query gov proposals"`, version.AppName), 124 Example: fmt.Sprintf("$ %s tx gov vote 1 yes --from mykey", version.AppName), 125 PositionalArgs: []*autocliv1.PositionalArgDescriptor{ 126 {ProtoField: "proposal_id"}, 127 {ProtoField: "option"}, 128 }, 129 FlagOptions: map[string]*autocliv1.FlagOptions{ 130 "metadata": {Name: "metadata", Usage: "Add a description to the vote"}, 131 }, 132 }, 133 { 134 RpcMethod: "UpdateParams", 135 Skip: true, // skipped because authority gated 136 }, 137 }, 138 EnhanceCustomCommand: false, // use custom commands only until v0.51 139 }, 140 } 141 }