Skip to content
On this page

Votes


This function returns voting details of a specific user based on a specific proposal.

It can be used for showing detailed information about a user's vote such as number of votes raised for a specified proposal, reason for voting, did the user support the proposal or not, time of voting etc.

Request parameters

Required body parameters:

NameExample valueComment
limit5Maximum number of proposals to be retrieved
lockedfalseTrue if locked, false otherwise
offset0Offset
orderingSet of parameters based on which the retrieved proposals will be ordered
columncreatedAtOrder by given column name (i.e. createdAt)
directionASCOrder by given direction (ascending or descending)
proposalId6Id of the proposal
supporttrueTrue if voted for, false if voted against the proposal
voter0:99ea964906c807e89ff8e55ba96a86e4d85d8020c8365ded9428777aef4281cdVoter’s address

Response fields explanation

NameExample valueComment
totalCountTotal number of times voter voted for a specific proposal
votes5061664014List of all the votes from a specific voter to the specific proposal
createdAt1654530320Date when the vote was raised
lockedfalseTrue if vote is locked, false otherwise
messageHash0275dde58e1a456e6dbba65aba2f295e2d33812353f0632c9728c084843a3678Hash code of the message
proposalId6Id of the proposal
reason""string""Reason for voting
supporttrueTrue if voter voted for, false if voted against
transactionHash3024c7309609b69cf8ad0f6efc686fb3bf91ccc257261e9063c5cee35ac6f7cfHash code of the transaction
voter0:99ea964906c807e89ff8e55ba96a86e4d85d8020c8365ded9428777aef4281cdVoter’s address
votes5061664014Amount staked for voting

Example

java
app.post('/votes/search', (req, res) => {
 
    axios({
        method: 'post',
        url: `${apiUrl}/votes/search`,
        data: {
            limit: req.body.limit,
            locked: req.body.locked,
            offset: req.body.offset,
            ordering: req.body.ordering,
            proposalId: req.body.proposalId,
            support: req.body.support,
            voter: req.body.voter
        }
    })
    .then(function(response){
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
  })