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