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

fix(api): reorder cursor and options params in api requests #411

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions entities/src/api_req_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ pub struct GetAssetsByGroup {
pub page: Option<u32>,
pub before: Option<String>,
pub after: Option<String>,
pub cursor: Option<String>,
#[serde(default)]
pub options: GetByMethodsOptions,
pub cursor: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
Expand All @@ -149,9 +149,9 @@ pub struct GetAssetsByOwner {
pub page: Option<u32>,
pub before: Option<String>,
pub after: Option<String>,
pub cursor: Option<String>,
#[serde(default)]
pub options: GetByMethodsOptions,
pub cursor: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
Expand Down Expand Up @@ -192,9 +192,9 @@ pub struct GetAssetsByCreator {
pub page: Option<u32>,
pub before: Option<String>,
pub after: Option<String>,
pub cursor: Option<String>,
#[serde(default)]
pub options: GetByMethodsOptions,
pub cursor: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
Expand All @@ -206,9 +206,9 @@ pub struct GetAssetsByAuthority {
pub page: Option<u32>,
pub before: Option<String>,
pub after: Option<String>,
pub cursor: Option<String>,
#[serde(default)]
pub options: GetByMethodsOptions,
pub cursor: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
Expand Down
26 changes: 26 additions & 0 deletions nft_ingester/tests/api_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,32 @@ mod tests {
);
}

#[test]
fn get_assets_by_authority_params_decode_correctly_with_positional_arguments() {
let request_params = r#"["DASPQfEAVcHp55eFmfstRduMT3dSfoTirFFsMHwUaWaz",null,null,null,null,null,{"showUnverifiedCollections":true},null]"#;
let rpc_params: jsonrpc_core::Params =
serde_json::from_str(request_params).expect("params are valid json");
let params_deserialized: GetAssetsByAuthority = rpc_params
.parse()
.expect("params provided deserialize correctly into GetAssetsByAuthority");
assert_eq!(
params_deserialized,
GetAssetsByAuthority {
authority_address: "DASPQfEAVcHp55eFmfstRduMT3dSfoTirFFsMHwUaWaz".to_owned(),
sort_by: None,
limit: None,
page: None,
before: None,
after: None,
options: GetByMethodsOptions {
show_unverified_collections: true,
..Default::default()
},
cursor: None
}
);
}

#[tokio::test]
#[tracing_test::traced_test]
async fn test_json_middleware() {
Expand Down
Loading