Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: updates needed for compatibility with nfts in the tui #1833

Merged
merged 11 commits into from
May 9, 2024
4 changes: 2 additions & 2 deletions packages/rs-dpp/src/data_contract/document_type/index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::{collections::BTreeMap, convert::TryFrom};
pub mod random_index;

// Indices documentation: https://dashplatform.readme.io/docs/reference-data-contracts#document-indices
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pauldelucia marked this conversation as resolved.
Show resolved Hide resolved
pub struct Index {
pub name: String,
pub properties: Vec<IndexProperty>,
Expand Down Expand Up @@ -53,7 +53,7 @@ impl Index {
}
}

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct IndexProperty {
pub name: String,
pub ascending: bool,
Expand Down
2 changes: 1 addition & 1 deletion packages/rs-drive/src/error/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub enum QuerySyntaxError {

/// Where clause on non indexed property error
#[error("where clause on non indexed property error: {0}")]
WhereClauseOnNonIndexedProperty(&'static str),
WhereClauseOnNonIndexedProperty(String),
/// Query is too far from index error
#[error("query is too far from index: {0}")]
QueryTooFarFromIndex(&'static str),
Expand Down
7 changes: 4 additions & 3 deletions packages/rs-drive/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
document::{
document_methods::DocumentMethodsV0,
serialization_traits::DocumentPlatformConversionMethodsV0, Document, DocumentV0Getters,

Check warning on line 24 in packages/rs-drive/src/query/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dash-sdk) / Linting

unused import: `serialization_traits::DocumentPlatformConversionMethodsV0`

warning: unused import: `serialization_traits::DocumentPlatformConversionMethodsV0` --> packages/rs-drive/src/query/mod.rs:24:13 | 24 | serialization_traits::DocumentPlatformConversionMethodsV0, Document, DocumentV0Getters, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
},
platform_value::{btreemap_extensions::BTreeValueRemoveFromMapHelper, Value},
version::PlatformVersion,
Expand All @@ -37,7 +37,7 @@
};

#[cfg(feature = "verify")]
use crate::drive::verify::RootHash;

Check warning on line 40 in packages/rs-drive/src/query/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dash-sdk) / Linting

unused import: `crate::drive::verify::RootHash`

warning: unused import: `crate::drive::verify::RootHash` --> packages/rs-drive/src/query/mod.rs:40:5 | 40 | use crate::drive::verify::RootHash; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#[cfg(feature = "server")]
pub use grovedb::{
Expand Down Expand Up @@ -234,7 +234,7 @@
#[cfg(any(feature = "server", feature = "verify"))]
impl QueryResultEncoding {
/// Encode the value based on the encoding desired
pub fn encode_value(&self, value: &Value) -> Result<Vec<u8>, Error> {

Check warning on line 237 in packages/rs-drive/src/query/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (dash-sdk) / Linting

unused variable: `value`

warning: unused variable: `value` --> packages/rs-drive/src/query/mod.rs:237:32 | 237 | pub fn encode_value(&self, value: &Value) -> Result<Vec<u8>, Error> { | ^^^^^ help: if this is intentional, prefix it with an underscore: `_value` | = note: `#[warn(unused_variables)]` on by default
match self {
#[cfg(feature = "ciborium")]
QueryResultEncoding::CborEncodedQueryResult => {
Expand Down Expand Up @@ -1135,9 +1135,10 @@
platform_version,
)?
.ok_or(Error::Query(
QuerySyntaxError::WhereClauseOnNonIndexedProperty(
"query must be for valid indexes",
),
QuerySyntaxError::WhereClauseOnNonIndexedProperty(format!(
"query must be for valid indexes, valid indexes are: {:?}",
self.document_type.indices()
)),
))?;
if difference > defaults::MAX_INDEX_DIFFERENCE {
return Err(Error::Query(QuerySyntaxError::QueryTooFarFromIndex(
Expand Down
2 changes: 1 addition & 1 deletion packages/rs-drive/src/query/test_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ mod tests {
.find_best_index(platform_version)
.expect_err("expected to not find index");
assert!(
matches!(error, Error::Query(QuerySyntaxError::WhereClauseOnNonIndexedProperty(message)) if message == "query must be for valid indexes")
matches!(error, Error::Query(QuerySyntaxError::WhereClauseOnNonIndexedProperty(message)) if message.contains("query must be for valid indexes"))
)
}
}
4 changes: 2 additions & 2 deletions packages/rs-sdk/src/platform/transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ pub(crate) mod broadcast_identity;
pub mod broadcast_request;
pub(crate) mod context;
pub mod purchase_document;
mod put_contract;
pub mod put_contract;
pub mod put_document;
pub mod put_identity;
pub mod put_settings;
pub mod top_up_identity;
pub mod transfer_document;
mod txid;
mod update_price_of_document;
pub mod update_price_of_document;
pub mod withdraw_from_identity;

pub use context::*;
Expand Down
Loading