From 8d592c7f919b5f5d978d9a4cf6c44d1d22e6f636 Mon Sep 17 00:00:00 2001 From: Nagaprasadvr Date: Thu, 28 Nov 2024 12:06:17 +0530 Subject: [PATCH] resolve comments and fix fixtures --- ...sions_tests__fungible_token_get_asset.snap | 56 ------------- ...__fungible_token_get_asset_scenario_1.snap | 2 +- ..._token_extensions_get_asset_scenario1.snap | 63 --------------- ..._token_extensions_get_asset_scenario2.snap | 78 ------------------- .../src/token_metadata/v1_asset.rs | 8 ++ 5 files changed, 9 insertions(+), 198 deletions(-) delete mode 100644 integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__fungible_token_get_asset.snap delete mode 100644 integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__token_extensions_get_asset_scenario1.snap delete mode 100644 integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__token_extensions_get_asset_scenario2.snap diff --git a/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__fungible_token_get_asset.snap b/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__fungible_token_get_asset.snap deleted file mode 100644 index 56928469a..000000000 --- a/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__fungible_token_get_asset.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: integration_tests/tests/integration_tests/fungibles_and_token_extensions_tests.rs -expression: response -snapshot_kind: text ---- -{ - "interface": "Custom", - "id": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "content": { - "$schema": "https://schema.metaplex.com/nft1.0.json", - "json_uri": "", - "files": [], - "metadata": { - "name": "USD Coin", - "symbol": "USDC" - }, - "links": {} - }, - "authorities": [ - { - "address": "2wmVCSfPxGPjrnMMn7rchp4uaeoTqN39mXFC2zhPdri9", - "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": [], - "ownership": { - "frozen": false, - "delegated": false, - "delegate": null, - "ownership_model": "token", - "owner": "" - }, - "mutable": true, - "burnt": false -} diff --git a/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__fungible_token_get_asset_scenario_1.snap b/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__fungible_token_get_asset_scenario_1.snap index 56928469a..16be64a22 100644 --- a/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__fungible_token_get_asset_scenario_1.snap +++ b/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__fungible_token_get_asset_scenario_1.snap @@ -4,7 +4,7 @@ expression: response snapshot_kind: text --- { - "interface": "Custom", + "interface": "FungibleToken", "id": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "content": { "$schema": "https://schema.metaplex.com/nft1.0.json", diff --git a/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__token_extensions_get_asset_scenario1.snap b/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__token_extensions_get_asset_scenario1.snap deleted file mode 100644 index edaf78071..000000000 --- a/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__token_extensions_get_asset_scenario1.snap +++ /dev/null @@ -1,63 +0,0 @@ ---- -source: integration_tests/tests/integration_tests/fungibles_and_token_extensions_tests.rs -expression: response -snapshot_kind: text ---- -{ - "interface": "FungibleToken", - "id": "BPU5vrAHafRuVeK33CgfdwTKSsmC4p6t3aqyav3cFF7Y", - "content": { - "$schema": "https://schema.metaplex.com/nft1.0.json", - "json_uri": "https://acme.com/demo.json", - "files": [], - "metadata": { - "name": "DAS Dev", - "symbol": "DAS" - }, - "links": {} - }, - "authorities": [], - "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": [], - "ownership": { - "frozen": false, - "delegated": false, - "delegate": null, - "ownership_model": "token", - "owner": "" - }, - "mutable": true, - "burnt": false, - "mint_extensions": { - "metadata": { - "uri": "https://acme.com/demo.json", - "mint": "BPU5vrAHafRuVeK33CgfdwTKSsmC4p6t3aqyav3cFF7Y", - "name": "DAS Dev", - "symbol": "DAS", - "update_authority": "Em34oqDQYQZ9b6ycPHD28K47mttrRsdNu1S1pgK6NtPL", - "additional_metadata": [] - }, - "metadata_pointer": { - "authority": "Em34oqDQYQZ9b6ycPHD28K47mttrRsdNu1S1pgK6NtPL", - "metadata_address": "BPU5vrAHafRuVeK33CgfdwTKSsmC4p6t3aqyav3cFF7Y" - } - } -} diff --git a/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__token_extensions_get_asset_scenario2.snap b/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__token_extensions_get_asset_scenario2.snap deleted file mode 100644 index 3ac4fdcb9..000000000 --- a/integration_tests/tests/integration_tests/snapshots/integration_tests__fungibles_and_token_extensions_tests__token_extensions_get_asset_scenario2.snap +++ /dev/null @@ -1,78 +0,0 @@ ---- -source: integration_tests/tests/integration_tests/fungibles_and_token_extensions_tests.rs -expression: response -snapshot_kind: text ---- -{ - "interface": "FungibleToken", - "id": "HVbpJAQGNpkgBaYBZQBR1t7yFdvaYVp2vCQQfKKEN4tM", - "content": { - "$schema": "https://schema.metaplex.com/nft1.0.json", - "json_uri": "https://token-metadata.paxos.com/usdp_metadata/prod/solana/usdp_metadata.json", - "files": [], - "metadata": { - "name": "Pax Dollar", - "symbol": "USDP" - }, - "links": {} - }, - "authorities": [], - "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": [], - "ownership": { - "frozen": false, - "delegated": false, - "delegate": null, - "ownership_model": "token", - "owner": "" - }, - "mutable": true, - "burnt": false, - "mint_extensions": { - "metadata": { - "uri": "https://token-metadata.paxos.com/usdp_metadata/prod/solana/usdp_metadata.json", - "mint": "HVbpJAQGNpkgBaYBZQBR1t7yFdvaYVp2vCQQfKKEN4tM", - "name": "Pax Dollar", - "symbol": "USDP", - "update_authority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk", - "additional_metadata": [] - }, - "transfer_hook": { - "authority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk", - "program_id": null - }, - "metadata_pointer": { - "authority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk", - "metadata_address": "HVbpJAQGNpkgBaYBZQBR1t7yFdvaYVp2vCQQfKKEN4tM" - }, - "permanent_delegate": { - "delegate": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk" - }, - "mint_close_authority": { - "close_authority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk" - }, - "confidential_transfer_mint": { - "authority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk", - "auditor_elgamal_pubkey": null, - "auto_approve_new_accounts": false - } - } -} diff --git a/program_transformers/src/token_metadata/v1_asset.rs b/program_transformers/src/token_metadata/v1_asset.rs index 0781fc2b4..dd40df218 100644 --- a/program_transformers/src/token_metadata/v1_asset.rs +++ b/program_transformers/src/token_metadata/v1_asset.rs @@ -199,6 +199,14 @@ pub async fn save_v1_asset( }; }; + //Map specification asset class based on the supply. + if class == SpecificationAssetClass::Unknown { + class = match supply { + s if s > Decimal::from(1) => SpecificationAssetClass::FungibleToken, + _ => SpecificationAssetClass::Unknown, + }; + }; + if (ownership_type == OwnerType::Single) | (ownership_type == OwnerType::Unknown) { index_token_account_data(conn, mint_pubkey_vec.clone()).await?; }