Queries

Cosmos-SDK Governance module query commands

The query commands allow users to query gov state.

sged query gov --help

Deposit

The deposit command allows users to query a deposit for a given proposal from a given depositor.

sged query gov deposit [proposal-id] [depositer-addr] [flags]

Example:

sged query gov deposit 1 sge1..

Example Output:

amount:
- amount: "100"
  denom: usge
depositor: sge1..
proposal_id: "1"

Deposits

The deposits command allows users to query all deposits for a given proposal.

sged query gov deposits [proposal-id] [flags]

Example:

sged query gov deposits 1

Example Output:

deposits:
- amount:
  - amount: "100"
    denom: usge
  depositor: sge1..
  proposal_id: "1"
pagination:
  next_key: null
  total: "0"

Param

The param command allows users to query a given parameter for the gov module.

sged query gov param [param-type] [flags]

Example:

sged query gov param voting

Example Output:

voting_period: "172800000000000"

params

The params command allows users to query all parameters for the gov module.

sged query gov params [flags]

Example:

sged query gov params

Example Output:

deposit_params:
  max_deposit_period: "172800000000000"
  min_deposit:
  - amount: "10000000"
    denom: usge
tally_params:
  quorum: "0.334000000000000000"
  threshold: "0.500000000000000000"
  veto_threshold: "0.334000000000000000"
voting_params:
  voting_period: "172800000000000"

Proposal

The proposal command allows users to query a given proposal.

sged query gov proposal [proposal-id] [flags]

Example:

sged query gov proposal 1

Example Output:

deposit_end_time: "2022-03-30T11:50:20.819676256Z"
final_tally_result:
  abstain_count: "0"
  no_count: "0"
  no_with_veto_count: "0"
  yes_count: "0"
id: "1"
messages:
- '@type': /cosmos.bank.v1beta1.MsgSend
  amount:
  - amount: "10"
    denom: usge
  from_address: sge1..
  to_address: sge1..
metadata: AQ==
status: PROPOSAL_STATUS_DEPOSIT_PERIOD
submit_time: "2022-03-28T11:50:20.819676256Z"
total_deposit:
- amount: "10"
  denom: usge
voting_end_time: null
voting_start_time: null

Proposals

The proposals command allows users to query all proposals with optional filters.

sged query gov proposals [flags]

Example:

sged query gov proposals

Example Output:

pagination:
  next_key: null
  total: "0"
proposals:
- deposit_end_time: "2022-03-30T11:50:20.819676256Z"
  final_tally_result:
    abstain_count: "0"
    no_count: "0"
    no_with_veto_count: "0"
    yes_count: "0"
  id: "1"
  messages:
  - '@type': /cosmos.bank.v1beta1.MsgSend
    amount:
    - amount: "10"
      denom: usge
    from_address: sge1..
    to_address: sge1..
  metadata: AQ==
  status: PROPOSAL_STATUS_DEPOSIT_PERIOD
  submit_time: "2022-03-28T11:50:20.819676256Z"
  total_deposit:
  - amount: "10"
    denom: usge
  voting_end_time: null
  voting_start_time: null
- deposit_end_time: "2022-03-30T14:02:41.165025015Z"
  final_tally_result:
    abstain_count: "0"
    no_count: "0"
    no_with_veto_count: "0"
    yes_count: "0"
  id: "2"
  messages:
  - '@type': /cosmos.bank.v1beta1.MsgSend
    amount:
    - amount: "10"
      denom: usge
    from_address: sge1..
    to_address: sge1..
  metadata: AQ==
  status: PROPOSAL_STATUS_DEPOSIT_PERIOD
  submit_time: "2022-03-28T14:02:41.165025015Z"
  total_deposit:
  - amount: "10"
    denom: usge
  voting_end_time: null
  voting_start_time: null

Proposer

The proposer command allows users to query the proposer for a given proposal.

sged query gov proposer [proposal-id] [flags]

Example:

sged query gov proposer 1

Example Output:

proposal_id: "1"
proposer: sge1..

Tally

The tally command allows users to query the tally of a given proposal vote.

sged query gov tally [proposal-id] [flags]

Example:

sged query gov tally 1

Example Output:

abstain: "0"
"no": "0"
no_with_veto: "0"
"yes": "1"

Vote

The vote command allows users to query a vote for a given proposal.

sged query gov vote [proposal-id] [voter-addr] [flags]

Example:

sged query gov vote 1 sge1..

Example Output:

option: VOTE_OPTION_YES
options:
- option: VOTE_OPTION_YES
  weight: "1.000000000000000000"
proposal_id: "1"
voter: sge1..

Votes

The votes command allows users to query all votes for a given proposal.

sged query gov votes [proposal-id] [flags]

Example:

sged query gov votes 1

Example Output:

pagination:
  next_key: null
  total: "0"yaaaaaaaaaa
votes:
- option: VOTE_OPTION_YES
  options:
  - option: VOTE_OPTION_YES
    weight: "1.000000000000000000"
  proposal_id: "1"
  voter: sge1..

For detailed information see the original document.

Last updated