-
Notifications
You must be signed in to change notification settings - Fork 40
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
Remove duplicate results for same asset_ids in get_assets rpc method #227
Open
AhzamAkhtar
wants to merge
3
commits into
metaplex-foundation:main
Choose a base branch
from
rpcpool:das-60-in-get-assets-remove-duplicate-results-for-same-asset-id
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+824 Bytes
...a/accounts/get_assets_with_multiple_same_ids/2ecGsTKbj7FecLwxTHaodZRFwza7m7LamqDG4YjczZMj
Binary file not shown.
Binary file added
BIN
+824 Bytes
...a/accounts/get_assets_with_multiple_same_ids/DZAZ3mGuq7nCYGzUyw4MiA74ysr15EfqLpzCzX2cRVng
Binary file not shown.
Binary file added
BIN
+224 Bytes
...a/accounts/get_assets_with_multiple_same_ids/F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk
Binary file not shown.
Binary file added
BIN
+224 Bytes
...a/accounts/get_assets_with_multiple_same_ids/JEKKtnGvjiZ8GtATnMVgadHU41AuTbFkMW8oD2tdyV9X
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
...ion_tests__test_get_assets_with_multiple_same_ids__get_assets_with_multiple_same_ids.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
--- | ||
source: integration_tests/tests/integration_tests/test_get_assets_with_multiple_same_ids.rs | ||
expression: response | ||
snapshot_kind: text | ||
--- | ||
[ | ||
{ | ||
"interface": "ProgrammableNFT", | ||
"id": "F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk", | ||
"content": { | ||
"$schema": "https://schema.metaplex.com/nft1.0.json", | ||
"json_uri": "https://madlads.s3.us-west-2.amazonaws.com/json/8420.json", | ||
"files": [], | ||
"metadata": { | ||
"name": "Mad Lads #8420", | ||
"symbol": "MAD", | ||
"token_standard": "ProgrammableNonFungible" | ||
}, | ||
"links": {} | ||
}, | ||
"authorities": [ | ||
{ | ||
"address": "2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW", | ||
"scopes": [ | ||
"full" | ||
] | ||
} | ||
], | ||
"compression": { | ||
"eligible": false, | ||
"compressed": false, | ||
"data_hash": "", | ||
"creator_hash": "", | ||
"asset_hash": "", | ||
"tree": "", | ||
"seq": 0, | ||
"leaf_id": 0 | ||
}, | ||
"grouping": [ | ||
{ | ||
"group_key": "collection", | ||
"group_value": "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w" | ||
} | ||
], | ||
"royalty": { | ||
"royalty_model": "creators", | ||
"target": null, | ||
"percent": 0.042, | ||
"basis_points": 420, | ||
"primary_sale_happened": true, | ||
"locked": false | ||
}, | ||
"creators": [ | ||
{ | ||
"address": "5XvhfmRjwXkGp3jHGmaKpqeerNYjkuZZBYLVQYdeVcRv", | ||
"share": 0, | ||
"verified": true | ||
}, | ||
{ | ||
"address": "2RtGg6fsFiiF1EQzHqbd66AhW7R5bWeQGpTbv2UMkCdW", | ||
"share": 100, | ||
"verified": true | ||
} | ||
], | ||
"ownership": { | ||
"frozen": false, | ||
"delegated": false, | ||
"delegate": null, | ||
"ownership_model": "single", | ||
"owner": "" | ||
}, | ||
"supply": null, | ||
"mutable": true, | ||
"burnt": false | ||
}, | ||
{ | ||
"interface": "V1_NFT", | ||
"id": "JEKKtnGvjiZ8GtATnMVgadHU41AuTbFkMW8oD2tdyV9X", | ||
"content": { | ||
"$schema": "https://schema.metaplex.com/nft1.0.json", | ||
"json_uri": "https://nftstorage.link/ipfs/bafkreidgvjw2atmkw2jzkkfi56arfrzaicrebzw5xwfkz3b67fq5gbvlre", | ||
"files": [], | ||
"metadata": { | ||
"name": "TURTLES", | ||
"symbol": "TURTLES", | ||
"token_standard": "NonFungible" | ||
}, | ||
"links": {} | ||
}, | ||
"authorities": [ | ||
{ | ||
"address": "J4tNLYMTegHE9nVjpRM17tf1EYwJnA9Crfn3KytRNcGv", | ||
"scopes": [ | ||
"full" | ||
] | ||
} | ||
], | ||
"compression": { | ||
"eligible": false, | ||
"compressed": false, | ||
"data_hash": "", | ||
"creator_hash": "", | ||
"asset_hash": "", | ||
"tree": "", | ||
"seq": 0, | ||
"leaf_id": 0 | ||
}, | ||
"grouping": [], | ||
"royalty": { | ||
"royalty_model": "creators", | ||
"target": null, | ||
"percent": 0.0, | ||
"basis_points": 0, | ||
"primary_sale_happened": true, | ||
"locked": false | ||
}, | ||
"creators": [ | ||
{ | ||
"address": "J4tNLYMTegHE9nVjpRM17tf1EYwJnA9Crfn3KytRNcGv", | ||
"share": 100, | ||
"verified": true | ||
} | ||
], | ||
"ownership": { | ||
"frozen": false, | ||
"delegated": false, | ||
"delegate": null, | ||
"ownership_model": "single", | ||
"owner": "" | ||
}, | ||
"supply": { | ||
"print_max_supply": 0, | ||
"print_current_supply": 0, | ||
"edition_nonce": 253 | ||
}, | ||
"mutable": false, | ||
"burnt": false | ||
} | ||
] |
42 changes: 42 additions & 0 deletions
42
integration_tests/tests/integration_tests/test_get_assets_with_multiple_same_ids.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use function_name::named; | ||
|
||
use das_api::api::{self, ApiContract}; | ||
|
||
use itertools::Itertools; | ||
|
||
use serial_test::serial; | ||
|
||
use super::common::*; | ||
|
||
#[tokio::test] | ||
#[serial] | ||
#[named] | ||
async fn test_get_assets_with_multiple_same_ids() { | ||
let name = trim_test_name(function_name!()); | ||
let setup = TestSetup::new(name.clone()).await; | ||
|
||
let seeds: Vec<SeedEvent> = seed_accounts([ | ||
"F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk", | ||
"DZAZ3mGuq7nCYGzUyw4MiA74ysr15EfqLpzCzX2cRVng", | ||
"JEKKtnGvjiZ8GtATnMVgadHU41AuTbFkMW8oD2tdyV9X", | ||
"2ecGsTKbj7FecLwxTHaodZRFwza7m7LamqDG4YjczZMj" | ||
]); | ||
|
||
apply_migrations_and_delete_data(setup.db.clone()).await; | ||
index_seed_events(&setup, seeds.iter().collect_vec()).await; | ||
|
||
let request = r#" | ||
{ | ||
"ids": [ | ||
"F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk", | ||
"F9Lw3ki3hJ7PF9HQXsBzoY8GyE6sPoEZZdXJBsTTD2rk", | ||
"JEKKtnGvjiZ8GtATnMVgadHU41AuTbFkMW8oD2tdyV9X", | ||
"JEKKtnGvjiZ8GtATnMVgadHU41AuTbFkMW8oD2tdyV9X" | ||
] | ||
} | ||
"#; | ||
|
||
let request: api::GetAssets = serde_json::from_str(request).unwrap(); | ||
let response = setup.das_api.get_assets(request).await.unwrap(); | ||
insta::assert_json_snapshot!(name, response); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also dont need to use generic now cause now we filtering only ids, which is Vec