Skip to content

Commit

Permalink
chore: updates needed for compatibility with nfts in the tui (#1833)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldelucia authored May 9, 2024
2 parents e624e02 + 76836ac commit 26abf50
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions packages/rs-dpp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ all_features = [
"identity-value-conversion",
"identity-json-conversion",
"identity-cbor-conversion",
"index-serde-conversion",
"state-transition-serde-conversion",
"state-transition-value-conversion",
"state-transition-json-conversion",
Expand Down Expand Up @@ -158,6 +159,7 @@ all_features_without_client = [
"identity-value-conversion",
"identity-json-conversion",
"identity-cbor-conversion",
"index-serde-conversion",
"state-transition-serde-conversion",
"state-transition-value-conversion",
"state-transition-json-conversion",
Expand Down Expand Up @@ -224,6 +226,7 @@ identity-cbor-conversion = [
"cbor",
"platform-value-cbor",
]
index-serde-conversion = []
state-transition-serde-conversion = ["data-contract-serde-conversion"]
state-transition-value-conversion = [
"platform-value",
Expand Down
2 changes: 2 additions & 0 deletions packages/rs-dpp/src/data_contract/document_type/index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub mod random_index;

// Indices documentation: https://dashplatform.readme.io/docs/reference-data-contracts#document-indices
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "index-serde-conversion", derive(Serialize, Deserialize))]
pub struct Index {
pub name: String,
pub properties: Vec<IndexProperty>,
Expand Down Expand Up @@ -54,6 +55,7 @@ impl Index {
}

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "index-serde-conversion", derive(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 @@ -1135,9 +1135,10 @@ impl<'a> DriveQuery<'a> {
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

0 comments on commit 26abf50

Please sign in to comment.