-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optionally display collection metadata of groups
When caller includes display option of show_collection_metadata asset data info will be included in the group area of the response.
- Loading branch information
1 parent
313cb5f
commit 6a2a2c1
Showing
12 changed files
with
222 additions
and
23 deletions.
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
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
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
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
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
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
...t_asset_with_show_collection_metadata_option/7fXKY9tPpvYsdbSNyesUqo27WYC6ZsBEULdtngGHqLCK
Binary file not shown.
Binary file added
BIN
+312 Bytes
...t_asset_with_show_collection_metadata_option/8Xv3SpX94HHf32Apg4TeSeS3i2p6wuXeE8FBZr168Hti
Binary file not shown.
Binary file added
BIN
+224 Bytes
...t_asset_with_show_collection_metadata_option/AH6wj7T8Ke5nbukjtcobjjs1CDWUcQxndtnLkKAdrSrM
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
50 changes: 50 additions & 0 deletions
50
integration_tests/tests/integration_tests/show_collection_metadata_option_tests.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,50 @@ | ||
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_asset_with_show_collection_metadata_option() { | ||
let name = trim_test_name(function_name!()); | ||
|
||
let setup = TestSetup::new_with_options( | ||
name.clone(), | ||
TestSetupOptions { | ||
network: Some(Network::Mainnet), | ||
}, | ||
) | ||
.await; | ||
|
||
let seeds: Vec<SeedEvent> = seed_accounts([ | ||
"AH6wj7T8Ke5nbukjtcobjjs1CDWUcQxndtnLkKAdrSrM", | ||
"7fXKY9tPpvYsdbSNyesUqo27WYC6ZsBEULdtngGHqLCK", | ||
"8Xv3SpX94HHf32Apg4TeSeS3i2p6wuXeE8FBZr168Hti", | ||
]); | ||
|
||
apply_migrations_and_delete_data(setup.db.clone()).await; | ||
|
||
index_seed_events(&setup, seeds.iter().collect_vec()).await; | ||
|
||
let request = r#" | ||
{ | ||
"id": "AH6wj7T8Ke5nbukjtcobjjs1CDWUcQxndtnLkKAdrSrM", | ||
"displayOptions" : { | ||
"showCollectionMetadata": true | ||
} | ||
} | ||
"#; | ||
|
||
let request: api::GetAsset = serde_json::from_str(request).unwrap(); | ||
|
||
let response = setup.das_api.get_asset(request).await.unwrap(); | ||
|
||
insta::assert_json_snapshot!(name, response); | ||
} |
73 changes: 73 additions & 0 deletions
73
...how_collection_metadata_option_tests__get_asset_with_show_collection_metadata_option.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,73 @@ | ||
--- | ||
source: integration_tests/tests/integration_tests/show_collection_metadata_option_tests.rs | ||
expression: response | ||
--- | ||
{ | ||
"interface": "ProgrammableNFT", | ||
"id": "AH6wj7T8Ke5nbukjtcobjjs1CDWUcQxndtnLkKAdrSrM", | ||
"content": { | ||
"$schema": "https://schema.metaplex.com/nft1.0.json", | ||
"json_uri": "https://madlads.s3.us-west-2.amazonaws.com/json/1983.json", | ||
"files": [], | ||
"metadata": { | ||
"name": "Mad Lads #1983", | ||
"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", | ||
"collection_metadata": {} | ||
} | ||
], | ||
"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": "GqPnSDXwp4JFtKS7YZ2HERgBbYLKpKVYy9TpVunzLRa9" | ||
}, | ||
"mutable": true, | ||
"burnt": false | ||
} |