Skip to content

Get Poll Result

Get the result of a poll.

Request:

  • requestType is getPollResult
  • poll is the poll ID
  • votingModel (optional, default null)
  • holding (optional, default null)
  • minBalance (optional, default 0)
  • minBalanceModel (required if minBalance > 0, must match votingModel when votingModel > 0)
  • requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
  • requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)

Note: The votingModel, holding, minBalance and minBalanceModel parameters are optional and default to the original values specified when the poll was created . The original values can only be overridden while the votes are still stored in the database, until 1441 blocks after the poll is completed. If votingModel is specified, holding, minBalance and minBalanceModel or the defaults specified above apply, otherwise they are ignored.

Response:

  • poll (S) is the poll ID
  • votingModel (N) is the votingModel used to calculate results (refer to Note above)
  • minBalanceModel (N) is the minBalanceModel used to calculate results (refer to Note above)
  • minBalance (S) is the minBalance used to calculate results (refer to Note above)
  • holding (S) is the asset or currency ID if the voting model uses an asset or currency balance to determine weight, if applicable (refer to Note above)
  • decimals (N) is the number decimal places used by the asset or currency, if applicable
  • finished (B) is true if the poll is complete, false otherwise
  • options (A) is the array of options (answers) of the poll
  • results (A) is an array of result objects with the following fields for each result:
    • weight (S) is the sum of the weight of each account that voted for the corresponding option (answer); an account’s weight is 1 if the voting model is 0, otherwise it is the TQT, asset QNT or currency QNT balance of the account if the voting model is 1, 2 or 3 respectively; however, the weight is 0 if minBalance is not met
    • result (S) is the sum over each account that voted for the corresponding option (answer) of: the product of the account’s weight and the rangeValue selected when the vote was cast.
  • lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
  • requestProcessingTime (N) is the API request processing time (in millisec)