Skip to content

Commit

Permalink
Merge pull request #399 from metaplex-foundation/fix/MTG-1278_on-chai…
Browse files Browse the repository at this point in the history
…n-integration-tests-are-not-working-for-fungible-tokens

MTG-1278 fix on chain integration tests for Fungible tokens
  • Loading branch information
andrii-kl authored Feb 4, 2025
2 parents 33b82d7 + a7f95ab commit 469ea4a
Show file tree
Hide file tree
Showing 30 changed files with 111 additions and 10 deletions.
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.
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.
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 @@
�Kƀ�{�m�w~U�@��]�^Pt�
Expand Down
36 changes: 26 additions & 10 deletions integration_tests/src/regular_nft_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async fn test_reg_get_asset() {

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

let request = r#"
let request = r#"
{
"id": "CMVuYDS9nTeujfTPJb8ik7CRhAqZv4DfjfdamFLkJgxE"
}
Expand Down Expand Up @@ -65,23 +65,23 @@ async fn test_reg_get_asset_batch() {

for (request, individual_test_name) in [
(
r#"
r#"
{
"ids": ["HTKAVZZrDdyecCxzm3WEkCsG1GUmiqKm73PvngfuYRNK", "2NqdYX6kJmMUoChnDXU2UrP9BsoPZivRw3uJG8iDhRRd"]
}
"#,
"only-2",
),
(
r#"
r#"
{
"ids": ["2NqdYX6kJmMUoChnDXU2UrP9BsoPZivRw3uJG8iDhRRd", "5rEeYv8R25b8j6YTHJvYuCKEzq44UCw1Wx1Wx2VPPLz1"]
}
"#,
"only-2-different-2",
),
(
r#"
r#"
{
"ids": [
"2NqdYX6kJmMUoChnDXU2UrP9BsoPZivRw3uJG8iDhRRd",
Expand Down Expand Up @@ -120,7 +120,7 @@ async fn test_reg_get_asset_by_group() {

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

let request = r#"
let request = r#"
{
"groupKey": "collection",
"groupValue": "8Rt3Ayqth4DAiPnW9MDFi63TiQJHmohfTWLMQFHi4KZH",
Expand Down Expand Up @@ -158,7 +158,7 @@ async fn test_reg_search_assets() {

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

let request = r#"
let request = r#"
{
"ownerAddress": "6Cr66AabRYymhZgYQSfTCo6FVpH18wXrMZswAbcErpyX",
"page": 1,
Expand Down Expand Up @@ -188,7 +188,7 @@ async fn test_regular_nft_collection() {

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

let request = r#"
let request = r#"
{
"id": "J1S9H3QjnRtBbbuD4HjPV6RpRhwuk4zKbxsnCHuTgh9w"
}
Expand Down Expand Up @@ -403,12 +403,25 @@ async fn test_requested_non_fungibles_are_non_fungibles() {
)
.await;

let seeds: Vec<SeedEvent> = seed_accounts([
"7qfEt4otpcr1LHPVZ2hjCB1d77wSZJfSDgwiXcUCneaT",
"9cyPkra7ANoDmMM4Abw8rYKxv3aWC3jZUjz8NtWaYo6D",
"JCnRA9ALhDYC5SWhBrw19JVWnDxnrGMYTmkfLsLkbpzV",
"44vjE7bDpwA2nFp5KbjWHjG2RHBWi5z1pP5ehY9t6p8V",
"2TQDwULQDdpisGssKZeRw2qcCTiZnsAmi6cnR89YYxSg",
"4pRQs1xZdASeL65PHTa1C8GnYCWtX18Lx98ofJB3SZNC",
"5ok1Zv557DAnichMsWE4cfURYbr1D2yWfcaqehydHo9R",
]);
index_seed_events(&setup, seeds.iter().collect_vec()).await;

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

index_seed_events(&setup, seeds.iter().collect_vec()).await;
Expand All @@ -431,6 +444,8 @@ async fn test_requested_non_fungibles_are_non_fungibles() {
let request: SearchAssets = serde_json::from_str(request).unwrap();
let response = setup.das_api.search_assets(request, mutexed_tasks.clone()).await.unwrap();

assert_eq!(response["items"].as_array().unwrap().len(), 5);

response["items"].as_array().unwrap().iter().all(|i| {
let interface = i["interface"].as_str().unwrap();
assert_eq!(interface, "V1_NFT");
Expand All @@ -440,8 +455,6 @@ async fn test_requested_non_fungibles_are_non_fungibles() {
insta::assert_json_snapshot!(name, response);
}

//todo Fix in MTG-1278/on-chain-integration-tests-are-not-working-for-fungible-tokens
#[ignore]
#[tokio::test]
#[serial]
#[named]
Expand All @@ -453,7 +466,7 @@ async fn test_requested_fungibles_are_fungibles() {
)
.await;

let seeds: Vec<SeedEvent> = seed_accounts(["EcxjN4mea6Ah9WSqZhLtSJJCZcxY73Vaz6UVHFZZ5Ttz"]);
let seeds: Vec<SeedEvent> = seed_accounts(["7qfEt4otpcr1LHPVZ2hjCB1d77wSZJfSDgwiXcUCneaT"]);
index_seed_events(&setup, seeds.iter().collect_vec()).await;

let seeds = seed_token_mints([
Expand All @@ -463,6 +476,7 @@ async fn test_requested_fungibles_are_fungibles() {
"7ZkXycbrAhVzeB9ngnjcCdjk5bxTJYzscSZMhRRBx3QB",
"75peBtH5MwfA5t9uhr51AYL7MR5DbPJ5xQ7wizzvowUH",
"87K3PtGNihT6dKjxULK25MVapZKXQWN4zXqC1BEshHKd",
"LaihKXA47apnS599tyEyasY2REfEzBNe4heunANhsMx", // Fungible
]);

index_seed_events(&setup, seeds.iter().collect_vec()).await;
Expand All @@ -485,6 +499,8 @@ async fn test_requested_fungibles_are_fungibles() {
let request: SearchAssets = serde_json::from_str(request).unwrap();
let response = setup.das_api.search_assets(request, mutexed_tasks.clone()).await.unwrap();

assert_eq!(response["items"].as_array().unwrap().len(), 1);

response["items"].as_array().unwrap().iter().all(|i| {
let interface = i["interface"].as_str().unwrap();
assert_eq!(interface, "FungibleToken");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
source: integration_tests/src/regular_nft_tests.rs
assertion_line: 338
expression: response
snapshot_kind: text
---
{
"total": 1,
"grand_total": 1,
"limit": 500,
"items": [
{
"interface": "FungibleToken",
"id": "LaihKXA47apnS599tyEyasY2REfEzBNe4heunANhsMx",
"content": {
"$schema": "https://schema.metaplex.com/nft1.0.json",
"json_uri": "https://shdw-drive.genesysgo.net/8p5qCRykwNvzF43HMk15bCfL6xA94GKe6ZRepinmWjDi/laika.png",
"files": [],
"metadata": {
"name": "Laika",
"symbol": "LAIKA",
"token_standard": "Fungible"
},
"links": {}
},
"authorities": [
{
"address": "VALe8acTXrBYfzrZVLZWpCConYeWy1QCe1N54SQ4Dwe",
"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": false,
"locked": false
},
"creators": [
{
"address": "VALe8acTXrBYfzrZVLZWpCConYeWy1QCe1N54SQ4Dwe",
"share": 100,
"verified": true
}
],
"ownership": {
"frozen": false,
"delegated": false,
"delegate": null,
"ownership_model": "token",
"owner": "EcxjN4mea6Ah9WSqZhLtSJJCZcxY73Vaz6UVHFZZ5Ttz"
},
"supply": null,
"mutable": true,
"burnt": false,
"lamports": 10054876,
"executable": false,
"metadata_owner": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
"rent_epoch": 0,
"token_info": {
"balance": 11498799900000,
"supply": 99499899652878324,
"decimals": 5,
"token_program": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"associated_token_address": "7qfEt4otpcr1LHPVZ2hjCB1d77wSZJfSDgwiXcUCneaT"
}
}
],
"cursor": "LaihKXA47apnS599tyEyasY2REfEzBNe4heunANhsMx"
}

0 comments on commit 469ea4a

Please sign in to comment.