Skip to content

Commit

Permalink
chore(sdk): vote poll queries encoding (#2334)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer authored Nov 15, 2024
1 parent b9f3c7a commit a78c7b0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::fees::op::LowLevelDriveOperation;
#[cfg(feature = "server")]
use crate::query::GroveError;
use crate::query::Query;
use bincode::{Decode, Encode};
#[cfg(feature = "server")]
use dpp::block::block_info::BlockInfo;
use dpp::identifier::Identifier;
Expand All @@ -27,7 +28,7 @@ use grovedb::{PathQuery, SizedQuery};
use platform_version::version::PlatformVersion;

/// Vote Poll Drive Query struct
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Clone, Encode, Decode)]
pub struct ContestedDocumentVotePollVotesDriveQuery {
/// What vote poll are we asking for?
pub vote_poll: ContestedDocumentResourceVotePoll,
Expand Down
5 changes: 3 additions & 2 deletions packages/rs-drive/src/query/vote_poll_vote_state_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::error::Error;
use crate::fees::op::LowLevelDriveOperation;
#[cfg(feature = "server")]
use crate::query::GroveError;
use bincode::{Decode, Encode};
use dpp::block::block_info::BlockInfo;
use dpp::data_contract::DataContract;
use dpp::identifier::Identifier;
Expand All @@ -36,7 +37,7 @@ use platform_version::version::PlatformVersion;
///
/// This enum defines the various types of results that can be returned when querying the drive
/// for contested document vote poll information.
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Clone, Copy, Encode, Decode)]
pub enum ContestedDocumentVotePollDriveQueryResultType {
/// The documents associated with the vote poll are returned in the query result.
Documents,
Expand Down Expand Up @@ -90,7 +91,7 @@ impl TryFrom<i32> for ContestedDocumentVotePollDriveQueryResultType {
}

/// Vote Poll Drive Query struct
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Clone, Encode, Decode)]
pub struct ContestedDocumentVotePollDriveQuery {
/// What vote poll are we asking for?
pub vote_poll: ContestedDocumentResourceVotePoll,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::fees::op::LowLevelDriveOperation;
use crate::query::GroveError;
use crate::query::Query;
use crate::util::object_size_info::DataContractResolvedInfo;
use bincode::{Decode, Encode};
#[cfg(feature = "server")]
use dpp::block::block_info::BlockInfo;
use dpp::data_contract::accessors::v0::DataContractV0Getters;
Expand All @@ -32,7 +33,7 @@ use grovedb::{PathQuery, SizedQuery};
use platform_version::version::PlatformVersion;

/// Vote Poll Drive Query struct
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Clone, Encode, Decode)]
pub struct VotePollsByDocumentTypeQuery {
/// The contract information associated with the document.
pub contract_id: Identifier,
Expand Down
3 changes: 2 additions & 1 deletion packages/rs-drive/src/query/vote_polls_by_end_date_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::fees::op::LowLevelDriveOperation;
use crate::query::GroveError;
use crate::query::Query;
use crate::util::common::encode::{decode_u64, encode_u64};
use bincode::{Decode, Encode};
#[cfg(feature = "server")]
use dpp::block::block_info::BlockInfo;
#[cfg(feature = "server")]
Expand All @@ -29,7 +30,7 @@ use platform_version::version::PlatformVersion;
use std::collections::BTreeMap;

/// Vote Poll Drive Query struct
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Clone, Encode, Decode)]
pub struct VotePollsByEndDateDriveQuery {
/// What is the start time we are asking for
pub start_time: Option<(TimestampMillis, TimestampIncluded)>,
Expand Down
3 changes: 2 additions & 1 deletion packages/rs-drive/src/query/vote_query.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use crate::drive::votes::paths::vote_contested_resource_identity_votes_tree_path_for_identity_vec;
use crate::error::Error;
use crate::query::Query;
use bincode::{Decode, Encode};
use dpp::identifier::Identifier;
use dpp::voting::vote_polls::VotePoll;
use grovedb::{PathQuery, SizedQuery};

/// Vote Drive Query struct
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Clone, Encode, Decode)]
pub struct IdentityBasedVoteDriveQuery {
/// The identity who would have made the vote
pub identity_id: Identifier,
Expand Down

0 comments on commit a78c7b0

Please sign in to comment.