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

[mtg-1030] Test for pseudo-static asset type being converted from fungible into NFT #388

Merged
merged 1 commit into from
Jan 29, 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
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,6 @@ jobs:
DATABASE_TEST_URL: "postgres://postgres:[email protected]:5432/postgres"
DEVNET_RPC_URL: ${{ secrets.SOLANA_DEVNET_RPC_URL }}
MAINNET_RPC_URL: ${{ secrets.SOLANA_MAINNET_RPC_URL }}
ECLIPSE_DEVNET_RPC_URL: ${{ secrets.SOLANA_ECLIPSE_DEVNET_RPC_URL }}
ECLIPSE_MAINNET_RPC_URL: ${{ secrets.SOLANA_ECLIPSE_MAINNET_RPC_URL }}
run: cargo test --features integration_tests -- --nocapture
4 changes: 2 additions & 2 deletions integration_tests/src/account_update_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async fn test_account_updates() {

setup.clean_up_data_bases().await;

index_nft(&setup, mint).await;
index_nft_accounts(&setup, get_nft_accounts(&setup, mint).await).await;

let response =
setup.das_api.get_asset(request.clone(), mutexed_tasks.clone()).await.unwrap();
Expand Down Expand Up @@ -217,7 +217,7 @@ async fn test_account_updates() {
for named_update in named_updates.clone() {
setup.clean_up_data_bases().await;

index_nft(&setup, mint).await;
index_nft_accounts(&setup, get_nft_accounts(&setup, mint).await).await;

let other_named_updates = named_updates
.clone()
Expand Down
10 changes: 5 additions & 5 deletions integration_tests/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ impl TestSetup {
let rpc_url = match opts.network.unwrap_or_default() {
Network::Mainnet => std::env::var("MAINNET_RPC_URL").unwrap(),
Network::Devnet => std::env::var("DEVNET_RPC_URL").unwrap(),
Network::EclipseMainnet => std::env::var("ECLIPSE_MAINNET_RPC_URL").unwrap(),
Network::EclipseDevnet => std::env::var("ECLIPSE_DEVNET_RPC_URL").unwrap(),
};
let client = Arc::new(RpcClient::new(rpc_url.to_string()));

Expand Down Expand Up @@ -537,6 +539,8 @@ pub enum Network {
#[default]
Mainnet,
Devnet,
EclipseMainnet,
EclipseDevnet,
}

#[derive(Clone, Copy, Debug)]
Expand All @@ -553,7 +557,7 @@ pub async fn index_seed_events(setup: &TestSetup, events: Vec<&SeedEvent>) {
index_and_sync_account_with_ordered_slot(setup, *account).await;
},
SeedEvent::Nft(mint) => {
index_nft(setup, *mint).await;
index_nft_accounts(setup, get_nft_accounts(setup, *mint).await).await;
},
SeedEvent::Signature(sig) => {
index_transaction(setup, *sig).await;
Expand Down Expand Up @@ -688,10 +692,6 @@ async fn index_token_mint(setup: &TestSetup, mint: Pubkey) {
}
}

pub async fn index_nft(setup: &TestSetup, mint: Pubkey) {
index_nft_accounts(setup, get_nft_accounts(setup, mint).await).await;
}

pub async fn index_nft_accounts(setup: &TestSetup, nft_accounts: NftAccounts) {
for account in [nft_accounts.mint, nft_accounts.metadata, nft_accounts.token] {
index_account(setup, account).await;
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-”¾¨ËdoÖƲIރ±ý@4¼ªz%Ÿx
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ÿ àdŠbéöGOu¨CÞ¥;é*Ò®•kÒ±eóLÇÄ
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ÿ›kT›SV‰³§1«TêVVجî!ÇÑ'6îNG0‚
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Gh£C¬Eـ†Ž;òÈÊl¥å£íSÉ}qÎä 
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8¸õü Ü%v1YJ *¨/hí͛ì¨!Æôß<îÕ
48 changes: 48 additions & 0 deletions integration_tests/src/regular_nft_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,51 @@ async fn get_asset_nft_token_22_with_metadata() {

insta::assert_json_snapshot!(name, response);
}

#[tokio::test]
#[serial]
#[named]
async fn test_requested_non_fungibles_are_non_fungibles() {
let name = trim_test_name(function_name!());
let setup = TestSetup::new_with_options(
name.clone(),
TestSetupOptions { network: Some(Network::EclipseMainnet), clear_db: true },
)
.await;

let seeds = seed_token_mints([
"DvpMQyF8sT6hPBewQf6VrVESw6L1zewPyNit1CSt1tDJ",
"9qA21TR9QTsQeR5sP6L2PytjgxXcVRSyqUY5vRcUogom",
"8WKGo1z9k3PjTsQw5GDQmvAbKwuRGtb4APkCneH8AVY1",
"7ZkXycbrAhVzeB9ngnjcCdjk5bxTJYzscSZMhRRBx3QB",
"75peBtH5MwfA5t9uhr51AYL7MR5DbPJ5xQ7wizzvowUH",
]);

index_seed_events(&setup, seeds.iter().collect_vec()).await;

let request = r#"
{
"limit": 500,
"ownerAddress": "EcxjN4mea6Ah9WSqZhLtSJJCZcxY73Vaz6UVHFZZ5Ttz",
"tokenType": "nonFungible",
"options": {
"showCollectionMetadata": true,
"showGrandTotal": true,
"showInscription": true,
"showNativeBalance": true
}
}"#;

let mutexed_tasks = Arc::new(Mutex::new(JoinSet::new()));

let request: SearchAssets = serde_json::from_str(request).unwrap();
let response = setup.das_api.search_assets(request, mutexed_tasks.clone()).await.unwrap();

response["items"].as_array().unwrap().iter().all(|i| {
let interface = i["interface"].as_str().unwrap();
assert_eq!(interface, "V1_NFT");
true
});

insta::assert_json_snapshot!(name, response);
}
Loading
Loading