Voting

Voting

class Voting(**kwargs)

Implements the voting api endpoints.

pending_polls(vote_type: int, pubkey_of_member_being_voted_on: hexstr | str, **kwargs) List[PollViewModel]

Gets a list of pending polls.

Parameters:
  • vote_type (VoteKey, optional) – The type of vote to query.

  • pubkey_of_member_being_voted_on (PubKey, optional) – The pubkey to query.

  • **kwargs – Extra keyword arguments.

Returns:

A list of pending polls.

Return type:

List[PollViewModel]

Raises:

APIError – Error thrown by node API. See message for details.

finished_polls(vote_type: int, pubkey_of_member_being_voted_on: hexstr | str, **kwargs) List[PollViewModel]

Gets a list of finished polls.

Parameters:
  • vote_type (VoteKey, optional) – The type of vote to query.

  • pubkey_of_member_being_voted_on (PubKey, optional) – The pubkey to query.

  • **kwargs – Extra keyword arguments.

Returns:

A list of finished polls.

Return type:

List[PollViewModel]

Raises:

APIError – Error thrown by node API. See message for details.

executed_polls(vote_type: int, pubkey_of_member_being_voted_on: hexstr | str, **kwargs) List[PollViewModel]

Gets a list of executed polls.

Parameters:
  • vote_type (VoteKey, optional) – The type of vote to query.

  • pubkey_of_member_being_voted_on (hexstr, str, optional) – The pubkey to query.

  • **kwargs – Extra keyword arguments.

Returns:

A list of executed polls.

Return type:

List[PollViewModel]

Raises:

APIError – Error thrown by node API. See message for details.

whitelisted_hashes(**kwargs) List[WhitelistedHashesModel]

Gets a list of whitelisted hashes.

Parameters:

**kwargs – Extra keyword arguments.

Returns:

A list of whitelisted hashes.

Return type:

List[WhitelistedhashesModel]

Raises:

APIError – Error thrown by node API. See message for details.

schedulevote_whitelisthash(hash_id: uint256 | str, **kwargs) None

Vote to add a hash from whitelist.

Parameters:
  • hash_id (uint256, str) – The hash to whitelist.

  • **kwargs – Extra keyword arguments.

Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

schedulevote_removehash(hash_id: uint256 | str, **kwargs) None

Vote to remove a hash from whitelist.

Parameters:
  • hash_id (uint256, str) – The hash to remove.

  • **kwargs – Extra keyword arguments.

Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

schedulevote_kickmember(pubkey: hexstr | str, **kwargs) None

Vote to remove a hash from whitelist.

Parameters:
  • pubkey (hexstr, str) – The pubkey to vote on kicking.

  • **kwargs – Extra keyword arguments.

Returns:

None

Raises:

APIError – Error thrown by node API. See message for details.

scheduled_votes(**kwargs) List[VotingDataModel]

Gets the scheduled voting data.

Parameters:

**kwargs – Extra keyword arguments.

Returns:

A list of voting data.

Return type:

List[VotingDataModel]

Raises:

APIError – Error thrown by node API. See message for details.

polls_tip(**kwargs) PollsTipModel

Gets the tip of the polls repository.

Parameters:

**kwargs – Extra keyword arguments.

Returns:

The polls repository tip information.

Return type:

PollsTipModel

Raises:

APIError – Error thrown by node API. See message for details.

polls_expired_whitelist(**kwargs) List[PollViewModel]

Retrieves a list of expired whitelist hash polls.

Parameters:

**kwargs – Extra keyword arguments.

Returns:

The list of expired whitelist hash polls.

Return type:

List[PollViewModel]

Raises:

APIError – Error thrown by node API. See message for details.

polls_expired_members(**kwargs) List[PollViewModel]

Retrieves a list of expired member polls.

Parameters:

**kwargs – Extra keyword arguments.

Returns:

The list of expired members polls.

Return type:

List[PollViewModel]

Raises:

APIError – Error thrown by node API. See message for details.

PollViewModel

class PollViewModel(*, IsPending: bool, IsExecuted: bool, Id: int, PollVotedInFavorBlockDataHash: uint256 = None, PollVotedInFavorBlockDataHeight: int = None, PollStartFavorBlockDataHash: uint256 = None, PollStartFavorBlockDataHeight: int = None, PollExecutedBlockDataHash: uint256 = None, PollExecutedBlockDataHeight: int = None, PubKeysHexVotedInFavor: List[PubKey], VotingDataString: str)

A pydantic model for polling data.

is_pending: bool

If true, poll is pending.

is_executed: bool

If true, poll has been executed.

poll_id: int

The poll id.

poll_voted_in_favor_blockdata_hash: uint256 | None

If voted in favor, the block of the vote.

poll_voted_in_favor_blockdata_height: int | None

If voted in favor, the height of the block.

poll_start_favor_blockdata_hash: uint256 | None

The block hash when polling started.

poll_start_favor_blockdata_height: int | None

The block height when polling started.

poll_executed_blockdata_hash: uint256 | None

The block hash when poll was executed, if executed.

poll_executed_blockdata_height: int | None

The block height when poll was executed, if executed.

pubkeys_hex_voted_in_favor: List[PubKey]

A list of pubkeys voting in favor of poll.

voting_data_string: str

Voting data.

VotingDataModel

class VotingDataModel(*, key: PubKey, hash: uint256)

A pydantic model representing voting data.

key: PubKey

The pubkey.

hash: uint256

The hash voted upon.

WhitelistedHashesModel

class WhitelistedHashesModel(*, hash: uint256)

A pydantic model for a whitelisted hash.

hash: uint256

A whitelisted hash.