github.com/cosmos/cosmos-sdk@v0.50.10/x/gov/types/v1/querier.go (about) 1 package v1 2 3 import ( 4 sdk "github.com/cosmos/cosmos-sdk/types" 5 ) 6 7 // query endpoints supported by the governance Querier 8 const ( 9 QueryParams = "params" 10 QueryProposals = "proposals" 11 QueryProposal = "proposal" 12 QueryDeposits = "deposits" 13 QueryDeposit = "deposit" 14 QueryVotes = "votes" 15 QueryVote = "vote" 16 QueryTally = "tally" 17 18 ParamDeposit = "deposit" 19 ParamVoting = "voting" 20 ParamTallying = "tallying" 21 ) 22 23 // QueryProposalParams is used for queries: 24 // - 'custom/gov/proposal' 25 // - 'custom/gov/deposits' 26 // - 'custom/gov/tally' 27 type QueryProposalParams struct { 28 ProposalID uint64 29 } 30 31 // NewQueryProposalParams creates a new instance of QueryProposalParams 32 func NewQueryProposalParams(proposalID uint64) QueryProposalParams { 33 return QueryProposalParams{ 34 ProposalID: proposalID, 35 } 36 } 37 38 // QueryProposalVotesParams is used to query 'custom/gov/votes'. 39 type QueryProposalVotesParams struct { 40 ProposalID uint64 41 Page int 42 Limit int 43 } 44 45 // NewQueryProposalVotesParams creates new instance of the QueryProposalVotesParams. 46 func NewQueryProposalVotesParams(proposalID uint64, page, limit int) QueryProposalVotesParams { 47 return QueryProposalVotesParams{ 48 ProposalID: proposalID, 49 Page: page, 50 Limit: limit, 51 } 52 } 53 54 // QueryDepositParams is used to query 'custom/gov/deposit' 55 type QueryDepositParams struct { 56 ProposalID uint64 57 Depositor sdk.AccAddress 58 } 59 60 // NewQueryDepositParams creates a new instance of QueryDepositParams 61 func NewQueryDepositParams(proposalID uint64, depositor sdk.AccAddress) QueryDepositParams { 62 return QueryDepositParams{ 63 ProposalID: proposalID, 64 Depositor: depositor, 65 } 66 } 67 68 // QueryVoteParams is used to query 'custom/gov/vote' 69 type QueryVoteParams struct { 70 ProposalID uint64 71 Voter sdk.AccAddress 72 } 73 74 // NewQueryVoteParams creates a new instance of QueryVoteParams 75 func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams { 76 return QueryVoteParams{ 77 ProposalID: proposalID, 78 Voter: voter, 79 } 80 } 81 82 // QueryProposalsParams is used to query 'custom/gov/proposals' 83 type QueryProposalsParams struct { 84 Page int 85 Limit int 86 Voter sdk.AccAddress 87 Depositor sdk.AccAddress 88 ProposalStatus ProposalStatus 89 } 90 91 // NewQueryProposalsParams creates a new instance of QueryProposalsParams 92 func NewQueryProposalsParams(page, limit int, status ProposalStatus, voter, depositor sdk.AccAddress) QueryProposalsParams { 93 return QueryProposalsParams{ 94 Page: page, 95 Limit: limit, 96 Voter: voter, 97 Depositor: depositor, 98 ProposalStatus: status, 99 } 100 }