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-1278 fix on chain integration tests for Fungible tokens #399

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
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 @@ -241,12 +241,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 @@ -269,6 +282,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 @@ -278,8 +293,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 @@ -291,7 +304,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 @@ -301,6 +314,7 @@ async fn test_requested_fungibles_are_fungibles() {
"7ZkXycbrAhVzeB9ngnjcCdjk5bxTJYzscSZMhRRBx3QB",
"75peBtH5MwfA5t9uhr51AYL7MR5DbPJ5xQ7wizzvowUH",
"87K3PtGNihT6dKjxULK25MVapZKXQWN4zXqC1BEshHKd",
"LaihKXA47apnS599tyEyasY2REfEzBNe4heunANhsMx", // Fungible
]);

index_seed_events(&setup, seeds.iter().collect_vec()).await;
Expand All @@ -323,6 +337,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"
}
Loading