-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add showFungible option flag to das #215
Open
Nagaprasadvr
wants to merge
21
commits into
metaplex-foundation:main
Choose a base branch
from
rpcpool:das-46-show-fungibles-rpc-option
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 3 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2524c1b
Token extensions Indexing support
niks3089 0b5a545
fix: register token extensions parser with program transform. add int…
kespinola d1855e0
WIP : token extensions
Nagaprasadvr db11fd6
chore: cleanup
Nagaprasadvr c22c4c2
fix: token extensions integration tests
Nagaprasadvr 08a7ba1
change is_non_fungible condition checks
Nagaprasadvr 76cd8a7
chore: cleanup
Nagaprasadvr ab179cd
WIP : showFungible
Nagaprasadvr 2de5bc0
chore: cleanup
Nagaprasadvr 6d708a6
resolve comments
Nagaprasadvr 6aa175d
fix tests and snapshots
Nagaprasadvr bb2f67e
add more scenarios
Nagaprasadvr 45cefbc
add integration tests for showFungible
Nagaprasadvr fc78fa4
resolve commenst and add token_accounts for indexing in test fixtures
Nagaprasadvr 8d592c7
resolve comments and fix fixtures
Nagaprasadvr 2c483c5
chore : resolve comments
Nagaprasadvr 1a4e5f7
GetAssetByOwner skipping fungible-assets when using show_fungible opt…
AhzamAkhtar a213893
Added coverage to show token_info in other rpc calls (#200)
AhzamAkhtar 497ef03
pull indexing fungibles and token extensions branch
Nagaprasadvr 6625889
fix tests
Nagaprasadvr c9f376b
remove showing token_acc data inside asset data
Nagaprasadvr 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
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
...unts/get_asset_with_show_fungible_scenario_1/7z6b5TE4WX4mgcQjuNBTDxK4SE75sbgEg5WWJwoUeie8
Binary file not shown.
Binary file added
BIN
+224 Bytes
...unts/get_asset_with_show_fungible_scenario_1/Ca84nWhQu41DMRnjdhRrLZty1i9txepMhAhz5qLLGcBw
Binary file not shown.
Binary file added
BIN
+824 Bytes
...unts/get_asset_with_show_fungible_scenario_2/7fXKY9tPpvYsdbSNyesUqo27WYC6ZsBEULdtngGHqLCK
Binary file not shown.
Binary file added
BIN
+224 Bytes
...unts/get_asset_with_show_fungible_scenario_2/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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ mod common; | |
mod general_scenario_tests; | ||
mod mpl_core_tests; | ||
mod regular_nft_tests; | ||
mod show_fungible_flag_tests; |
82 changes: 82 additions & 0 deletions
82
integration_tests/tests/integration_tests/show_fungible_flag_tests.rs
Nagaprasadvr marked this conversation as resolved.
Show resolved
Hide resolved
|
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,82 @@ | ||
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_fungible_scenario_1() { | ||
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([ | ||
"Ca84nWhQu41DMRnjdhRrLZty1i9txepMhAhz5qLLGcBw", | ||
"7z6b5TE4WX4mgcQjuNBTDxK4SE75sbgEg5WWJwoUeie8", | ||
]); | ||
|
||
apply_migrations_and_delete_data(setup.db.clone()).await; | ||
index_seed_events(&setup, seeds.iter().collect_vec()).await; | ||
|
||
let request = r#" | ||
{ | ||
"id": "Ca84nWhQu41DMRnjdhRrLZty1i9txepMhAhz5qLLGcBw", | ||
"displayOptions": { | ||
"showFungible": 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); | ||
} | ||
|
||
#[tokio::test] | ||
#[serial] | ||
#[named] | ||
async fn test_get_asset_with_show_fungible_scenario_2() { | ||
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", | ||
]); | ||
|
||
apply_migrations_and_delete_data(setup.db.clone()).await; | ||
index_seed_events(&setup, seeds.iter().collect_vec()).await; | ||
|
||
let request = r#" | ||
{ | ||
"id": "AH6wj7T8Ke5nbukjtcobjjs1CDWUcQxndtnLkKAdrSrM", | ||
"displayOptions": { | ||
"showFungible": 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); | ||
} |
81 changes: 81 additions & 0 deletions
81
...integration_tests__show_fungible_flag_tests__get_asset_with_show_fungible_scenario_1.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,81 @@ | ||
--- | ||
source: integration_tests/tests/integration_tests/show_fungible_flag_tests.rs | ||
expression: response | ||
snapshot_kind: text | ||
--- | ||
{ | ||
"interface": "ProgrammableNFT", | ||
"id": "Ca84nWhQu41DMRnjdhRrLZty1i9txepMhAhz5qLLGcBw", | ||
"content": { | ||
"$schema": "https://schema.metaplex.com/nft1.0.json", | ||
"json_uri": "https://nftstorage.link/ipfs/bafkreibmdapcawep5fb77lvcuvoivft3w3wsnc4qworrntjbg6abc5vwti", | ||
"files": [], | ||
"metadata": { | ||
"name": "Claynosaurz #1096", | ||
"symbol": "DINO", | ||
"token_standard": "ProgrammableNonFungible" | ||
}, | ||
"links": {} | ||
}, | ||
"authorities": [ | ||
{ | ||
"address": "B7B2g3WbdZMDV3YcDGRGhEt5KyWqDJZFwRR8zpWVEkUF", | ||
"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": "6mszaj17KSfVqADrQj3o4W3zoLMTykgmV37W4QadCczK" | ||
} | ||
], | ||
"royalty": { | ||
"royalty_model": "creators", | ||
"target": null, | ||
"percent": 0.05, | ||
"basis_points": 500, | ||
"primary_sale_happened": true, | ||
"locked": false | ||
}, | ||
"creators": [ | ||
{ | ||
"address": "AoebZtN5iKpVyUBc82aouWhugVknLzjUmEEUezxviYNo", | ||
"share": 0, | ||
"verified": true | ||
}, | ||
{ | ||
"address": "36tfiBtaDGjAMKd6smPacHQhe4MXycLL6f9ww9CD1naT", | ||
"share": 100, | ||
"verified": false | ||
} | ||
], | ||
"ownership": { | ||
"frozen": false, | ||
"delegated": false, | ||
"delegate": null, | ||
"ownership_model": "single", | ||
"owner": "" | ||
}, | ||
Nagaprasadvr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"supply": null, | ||
"mutable": true, | ||
"burnt": false, | ||
"token_info": { | ||
"supply": 1, | ||
"decimals": 0, | ||
"token_program": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", | ||
"mint_authority": "EwSfdqoZPBW6JJN1SBkM2pPgpihDVbByuxKdmiXurxYF", | ||
"freeze_authority": "EwSfdqoZPBW6JJN1SBkM2pPgpihDVbByuxKdmiXurxYF" | ||
} | ||
} |
Oops, something went wrong.
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.
Can this be done by joining in this info into the asset query so there aren't 2 round trips to the db?
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.
currently we can use find_with_related for only 2 models