From 362a4ede28c05da0d011647b6d1c4ed9d831f6df Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Sat, 16 Nov 2024 00:46:14 +0530 Subject: [PATCH 01/12] Search asset token type filter added --- das_api/src/api/api_impl.rs | 2 ++ das_api/src/api/mod.rs | 3 ++- digital_asset_types/src/dao/mod.rs | 19 ++++++++++++++++ digital_asset_types/src/rpc/filter.rs | 31 +++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/das_api/src/api/api_impl.rs b/das_api/src/api/api_impl.rs index 4b55f43d8..fd8814ecf 100644 --- a/das_api/src/api/api_impl.rs +++ b/das_api/src/api/api_impl.rs @@ -374,6 +374,7 @@ impl ApiContract for DasApi { negate, condition_type, interface, + token_type, owner_address, owner_type, creator_address, @@ -433,6 +434,7 @@ impl ApiContract for DasApi { condition_type, specification_version, specification_asset_class, + token_type, owner_address, owner_type, creator_address, diff --git a/das_api/src/api/mod.rs b/das_api/src/api/mod.rs index 2e1da73ca..9e0d02dd7 100644 --- a/das_api/src/api/mod.rs +++ b/das_api/src/api/mod.rs @@ -1,6 +1,6 @@ use crate::error::DasApiError; use async_trait::async_trait; -use digital_asset_types::rpc::filter::{AssetSortDirection, SearchConditionType}; +use digital_asset_types::rpc::filter::{AssetSortDirection, SearchConditionType, TokenTypeClass}; use digital_asset_types::rpc::options::Options; use digital_asset_types::rpc::response::{AssetList, TransactionSignatureList}; use digital_asset_types::rpc::{filter::AssetSorting, response::GetGroupingResponse}; @@ -94,6 +94,7 @@ pub struct SearchAssets { pub negate: Option, pub condition_type: Option, pub interface: Option, + pub token_type : Option, pub owner_address: Option, pub owner_type: Option, pub creator_address: Option, diff --git a/digital_asset_types/src/dao/mod.rs b/digital_asset_types/src/dao/mod.rs index bf1e540ab..5b7c6b568 100644 --- a/digital_asset_types/src/dao/mod.rs +++ b/digital_asset_types/src/dao/mod.rs @@ -2,6 +2,8 @@ mod full_asset; mod generated; pub mod scopes; +use crate::rpc::filter::TokenTypeClass; + use self::sea_orm_active_enums::{ OwnerType, RoyaltyTargetType, SpecificationAssetClass, SpecificationVersions, }; @@ -54,6 +56,7 @@ pub struct SearchAssetsQuery { pub condition_type: Option, pub specification_version: Option, pub specification_asset_class: Option, + pub token_type: Option, pub owner_address: Option>, pub owner_type: Option, pub creator_address: Option>, @@ -93,6 +96,22 @@ impl SearchAssetsQuery { .clone() .map(|x| asset::Column::SpecificationAssetClass.eq(x)), ) + .add_option( + self.token_type.clone().map(|x| match x { + TokenTypeClass::CompressedNft => { + asset::Column::TreeId.is_not_null() + } + TokenTypeClass::Nft | TokenTypeClass::NonFungibleAsset => { + asset::Column::SpecificationAssetClass.eq(TokenTypeClass::Nft) + } + TokenTypeClass::All => { + asset::Column::SpecificationAssetClass.is_not_null() + } + _ => { + asset::Column::SpecificationAssetClass.eq(x) + } + }) + ) .add_option( self.owner_address .to_owned() diff --git a/digital_asset_types/src/rpc/filter.rs b/digital_asset_types/src/rpc/filter.rs index a471f21fb..761ab2a66 100644 --- a/digital_asset_types/src/rpc/filter.rs +++ b/digital_asset_types/src/rpc/filter.rs @@ -1,5 +1,6 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +use sea_orm::entity::prelude::*; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] @@ -31,6 +32,36 @@ pub enum AssetSortBy { None, } +#[derive(Debug, Clone, PartialEq, Eq ,EnumIter, DeriveActiveEnum, Serialize, Deserialize,JsonSchema)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "specification_asset_class" +)] +pub enum TokenTypeClass { + #[sea_orm(string_value = "FUNGIBLE_ASSET")] + FungibleAsset, + #[sea_orm(string_value = "FUNGIBLE_TOKEN")] + FungibleToken, + // #[sea_orm(ignore)] + #[sea_orm(string_value = "NON_FUNGIBLE_ASSET")] + NonFungibleAsset, + #[sea_orm(string_value = "MPL_CORE_ASSET")] + MplCoreAsset, + #[sea_orm(string_value = "MPL_CORE_COLLECTION")] + MplCoreCollection, + #[sea_orm(string_value = "NFT")] + Nft, + #[sea_orm(string_value = "PROGRAMMABLE_NFT")] + ProgrammableNft, + // #[sea_orm(ignore)] + #[sea_orm(string_value = "COMPRESSED_NFT")] + CompressedNft, + // #[sea_orm(ignore)] + #[sea_orm(string_value = "ALL")] + All, +} + #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] pub enum AssetSortDirection { #[serde(rename = "asc")] From 55cee21bb18600fb3192e8c8c401d15bc8c73dfe Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Sat, 16 Nov 2024 17:04:13 +0530 Subject: [PATCH 02/12] Token type class filter improved --- digital_asset_types/src/dao/mod.rs | 13 +++++------ digital_asset_types/src/rpc/filter.rs | 31 +++++---------------------- 2 files changed, 12 insertions(+), 32 deletions(-) diff --git a/digital_asset_types/src/dao/mod.rs b/digital_asset_types/src/dao/mod.rs index 5b7c6b568..3b973ed64 100644 --- a/digital_asset_types/src/dao/mod.rs +++ b/digital_asset_types/src/dao/mod.rs @@ -98,18 +98,19 @@ impl SearchAssetsQuery { ) .add_option( self.token_type.clone().map(|x| match x { - TokenTypeClass::CompressedNft => { + TokenTypeClass::Compressed => { asset::Column::TreeId.is_not_null() } - TokenTypeClass::Nft | TokenTypeClass::NonFungibleAsset => { - asset::Column::SpecificationAssetClass.eq(TokenTypeClass::Nft) + TokenTypeClass::Nft | TokenTypeClass::NonFungible => { + asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) + } + TokenTypeClass::Fungible => { + asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::FungibleAsset) + .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::FungibleToken)) } TokenTypeClass::All => { asset::Column::SpecificationAssetClass.is_not_null() } - _ => { - asset::Column::SpecificationAssetClass.eq(x) - } }) ) .add_option( diff --git a/digital_asset_types/src/rpc/filter.rs b/digital_asset_types/src/rpc/filter.rs index 761ab2a66..1c5854563 100644 --- a/digital_asset_types/src/rpc/filter.rs +++ b/digital_asset_types/src/rpc/filter.rs @@ -32,34 +32,13 @@ pub enum AssetSortBy { None, } -#[derive(Debug, Clone, PartialEq, Eq ,EnumIter, DeriveActiveEnum, Serialize, Deserialize,JsonSchema)] -#[sea_orm( - rs_type = "String", - db_type = "Enum", - enum_name = "specification_asset_class" -)] +#[derive(Debug, Clone, PartialEq, Eq ,EnumIter, Serialize, Deserialize,JsonSchema)] pub enum TokenTypeClass { - #[sea_orm(string_value = "FUNGIBLE_ASSET")] - FungibleAsset, - #[sea_orm(string_value = "FUNGIBLE_TOKEN")] - FungibleToken, - // #[sea_orm(ignore)] - #[sea_orm(string_value = "NON_FUNGIBLE_ASSET")] - NonFungibleAsset, - #[sea_orm(string_value = "MPL_CORE_ASSET")] - MplCoreAsset, - #[sea_orm(string_value = "MPL_CORE_COLLECTION")] - MplCoreCollection, - #[sea_orm(string_value = "NFT")] + Fungible, + NonFungible, + Compressed, Nft, - #[sea_orm(string_value = "PROGRAMMABLE_NFT")] - ProgrammableNft, - // #[sea_orm(ignore)] - #[sea_orm(string_value = "COMPRESSED_NFT")] - CompressedNft, - // #[sea_orm(ignore)] - #[sea_orm(string_value = "ALL")] - All, + All } #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] From 1c716792a2530c0bccfdaa65f3e3f3571f499528 Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Mon, 18 Nov 2024 21:23:28 +0530 Subject: [PATCH 03/12] removed specification_asset_class from SearchAssetQuery cause we now have token_type --- das_api/src/api/api_impl.rs | 2 -- digital_asset_types/src/dao/mod.rs | 6 ------ 2 files changed, 8 deletions(-) diff --git a/das_api/src/api/api_impl.rs b/das_api/src/api/api_impl.rs index fd8814ecf..aca90a6f7 100644 --- a/das_api/src/api/api_impl.rs +++ b/das_api/src/api/api_impl.rs @@ -406,7 +406,6 @@ impl ApiContract for DasApi { let spec: Option<(SpecificationVersions, SpecificationAssetClass)> = interface.map(|x| x.into()); let specification_version = spec.clone().map(|x| x.0); - let specification_asset_class = spec.map(|x| x.1); let condition_type = condition_type.map(|x| match x { SearchConditionType::Any => ConditionType::Any, SearchConditionType::All => ConditionType::All, @@ -433,7 +432,6 @@ impl ApiContract for DasApi { negate, condition_type, specification_version, - specification_asset_class, token_type, owner_address, owner_type, diff --git a/digital_asset_types/src/dao/mod.rs b/digital_asset_types/src/dao/mod.rs index 3b973ed64..84a87efa7 100644 --- a/digital_asset_types/src/dao/mod.rs +++ b/digital_asset_types/src/dao/mod.rs @@ -55,7 +55,6 @@ pub struct SearchAssetsQuery { /// Defaults to [ConditionType::All] pub condition_type: Option, pub specification_version: Option, - pub specification_asset_class: Option, pub token_type: Option, pub owner_address: Option>, pub owner_type: Option, @@ -91,11 +90,6 @@ impl SearchAssetsQuery { .clone() .map(|x| asset::Column::SpecificationVersion.eq(x)), ) - .add_option( - self.specification_asset_class - .clone() - .map(|x| asset::Column::SpecificationAssetClass.eq(x)), - ) .add_option( self.token_type.clone().map(|x| match x { TokenTypeClass::Compressed => { From af75619a9a83ee24f0cb54e1b2768f8d1aa34561 Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Sat, 23 Nov 2024 04:18:56 +0530 Subject: [PATCH 04/12] test file added for token_type_filter --- digital_asset_types/src/dao/mod.rs | 41 ++-- .../tests/integration_tests/main.rs | 1 + .../integration_tests/token_type_test.rs | 187 ++++++++++++++++++ 3 files changed, 212 insertions(+), 17 deletions(-) create mode 100644 integration_tests/tests/integration_tests/token_type_test.rs diff --git a/digital_asset_types/src/dao/mod.rs b/digital_asset_types/src/dao/mod.rs index 84a87efa7..71063bffa 100644 --- a/digital_asset_types/src/dao/mod.rs +++ b/digital_asset_types/src/dao/mod.rs @@ -90,23 +90,30 @@ impl SearchAssetsQuery { .clone() .map(|x| asset::Column::SpecificationVersion.eq(x)), ) - .add_option( - self.token_type.clone().map(|x| match x { - TokenTypeClass::Compressed => { - asset::Column::TreeId.is_not_null() - } - TokenTypeClass::Nft | TokenTypeClass::NonFungible => { - asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) - } - TokenTypeClass::Fungible => { - asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::FungibleAsset) - .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::FungibleToken)) - } - TokenTypeClass::All => { - asset::Column::SpecificationAssetClass.is_not_null() - } - }) - ) + .add_option(self.token_type.clone().map(|x| { + match x { + TokenTypeClass::Compressed => asset::Column::TreeId.is_not_null(), + TokenTypeClass::Nft => { + asset::Column::TreeId.is_null() + .and( + asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) + .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::MplCoreAsset)) + .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::ProgrammableNft)) + ) + }, + TokenTypeClass::NonFungible => { + asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) + .or(asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::ProgrammableNft)) + .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::MplCoreAsset)) + }, + TokenTypeClass::Fungible => asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::FungibleAsset) + .or(asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::FungibleToken)), + TokenTypeClass::All => asset::Column::SpecificationAssetClass.is_not_null(), + } + })) .add_option( self.owner_address .to_owned() diff --git a/integration_tests/tests/integration_tests/main.rs b/integration_tests/tests/integration_tests/main.rs index 399b6e583..83fb3eb8a 100644 --- a/integration_tests/tests/integration_tests/main.rs +++ b/integration_tests/tests/integration_tests/main.rs @@ -5,3 +5,4 @@ mod fungibles_and_token_extensions_tests; mod general_scenario_tests; mod mpl_core_tests; mod regular_nft_tests; +mod token_type_test; diff --git a/integration_tests/tests/integration_tests/token_type_test.rs b/integration_tests/tests/integration_tests/token_type_test.rs new file mode 100644 index 000000000..201462453 --- /dev/null +++ b/integration_tests/tests/integration_tests/token_type_test.rs @@ -0,0 +1,187 @@ +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_search_asset_with_token_type_regular_nft() { + let name = trim_test_name(function_name!()); + let setup = TestSetup::new_with_options( + name.clone(), + TestSetupOptions { + network: Some(Network::Mainnet), + }, + ) + .await; + + let seeds: Vec = seed_nfts([ + "42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB", + "2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2", + ]); + + apply_migrations_and_delete_data(setup.db.clone()).await; + index_seed_events(&setup, seeds.iter().collect_vec()).await; + + let request = r#" + { + "ownerAddress": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g", + "page": 1, + "limit": 2, + "tokenType": "Nft" + } + "#; + + let request: api::SearchAssets = serde_json::from_str(request).unwrap(); + let response = setup.das_api.search_assets(request).await.unwrap(); + insta::assert_json_snapshot!(name, response); +} + + +#[tokio::test] +#[serial] +#[named] +async fn test_search_asset_with_token_type_non_fungible() { + let name = trim_test_name(function_name!()); + let setup = TestSetup::new_with_options( + name.clone(), + TestSetupOptions { + network: Some(Network::Mainnet), + }, + ) + .await; + + let seeds: Vec = seed_nfts([ + "AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk", + "8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo", + ]); + + apply_migrations_and_delete_data(setup.db.clone()).await; + index_seed_events(&setup, seeds.iter().collect_vec()).await; + + let request = r#" + { + "ownerAddress": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g", + "page": 1, + "limit": 2, + "tokenType": "NonFungible" + } + "#; + + let request: api::SearchAssets = serde_json::from_str(request).unwrap(); + let response = setup.das_api.search_assets(request).await.unwrap(); + insta::assert_json_snapshot!(name, response); +} + +#[tokio::test] +#[serial] +#[named] +async fn test_search_asset_with_token_type_compressed() { + let name = trim_test_name(function_name!()); + let setup = TestSetup::new_with_options( + name.clone(), + TestSetupOptions { + network: Some(Network::Mainnet), + }, + ) + .await; + + let seeds: Vec = seed_txns([ + "4nKDSvw2kGpccZWLEPnfdP7J1SEexQFRP3xWc9NBtQ1qQeGu3bu5WnAdpcLbjQ4iyX6BQ5QGF69wevE8ZeeY5poA", + "4URwUGBjbsF7UBUYdSC546tnBy7nD67txsso8D9CR9kGLtbbYh9NkGw15tEp16LLasmJX5VQR4Seh8gDjTrtdpoC", + ]); + + apply_migrations_and_delete_data(setup.db.clone()).await; + index_seed_events(&setup, seeds.iter().collect_vec()).await; + + let request = r#" + { + "ownerAddress": "53VVFtLzzi3nL2p1QF591PAB8rbcbsirYepwUphtHU9Q", + "page": 1, + "limit": 2, + "tokenType": "Compressed" + } + "#; + + let request: api::SearchAssets = serde_json::from_str(request).unwrap(); + let response = setup.das_api.search_assets(request).await.unwrap(); + insta::assert_json_snapshot!(name, response); +} + +#[tokio::test] +#[serial] +#[named] +async fn test_search_asset_with_token_type_all() { + let name = trim_test_name(function_name!()); + let setup = TestSetup::new_with_options( + name.clone(), + TestSetupOptions { + network: Some(Network::Mainnet), + }, + ) + .await; + + let seeds: Vec = seed_nfts([ + "42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB", + "8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo", + ]); + + apply_migrations_and_delete_data(setup.db.clone()).await; + index_seed_events(&setup, seeds.iter().collect_vec()).await; + + let request = r#" + { + "ownerAddress": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g", + "page": 1, + "limit": 2, + "tokenType": "All" + } + "#; + + let request: api::SearchAssets = serde_json::from_str(request).unwrap(); + let response = setup.das_api.search_assets(request).await.unwrap(); + insta::assert_json_snapshot!(name, response); +} + + +#[tokio::test] +#[serial] +#[named] +async fn test_search_asset_with_token_type_fungible() { + let name = trim_test_name(function_name!()); + let setup = TestSetup::new_with_options( + name.clone(), + TestSetupOptions { + network: Some(Network::Mainnet), + }, + ) + .await; + + let seeds: Vec = seed_accounts([ + "7EYnhQoR9YM3N7UoaKRoA44Uy8JeaZV3qyouov87awMs", + "7BajpcYgnxmWK91RhrfsdB3Tm83PcDwPvMC8ZinvtTY6", + "6BRNfDfdq1nKyU1TQiCEQLWyPtD8EwUH9Kt2ahsbidUx", + ]); + + apply_migrations_and_delete_data(setup.db.clone()).await; + index_seed_events(&setup, seeds.iter().collect_vec()).await; + + let request = r#" + { + "ownerAddress": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g", + "page": 1, + "limit": 1, + "tokenType": "Fungible" + } + "#; + + let request: api::SearchAssets = serde_json::from_str(request).unwrap(); + let response = setup.das_api.search_assets(request).await.unwrap(); + insta::assert_json_snapshot!(name, response); +} From bdc874df90ec064b5e6a70089d6e935ff6cb46ec Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Sat, 23 Nov 2024 18:49:28 +0530 Subject: [PATCH 05/12] tests snapshots added --- ...AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB | Bin 0 -> 224 bytes ...SzJpyztTuK124EyPAw2nbF4Vaj2P9MU9vww1QN1k8p | Bin 0 -> 312 bytes ...VGLDmpnYqX5EvTg7i3tpRNEugeaUyDC9HtPSb3V3DS | Bin 0 -> 824 bytes ...77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo | Bin 0 -> 224 bytes ...HQquD7pQFUsBoPpW816CU8zQrQCua9mw4Znh9FyKZJ | Bin 0 -> 824 bytes ...oN9TsoMSKJAp388G752pSUscb8iZwgdH459KSJxbZT | Bin 0 -> 312 bytes ...ackukZJRBkQSufwFnhTkmTzB11Ww8375EDXTwY75wk | Bin 0 -> 312 bytes ...77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo | Bin 0 -> 224 bytes ...6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk | Bin 0 -> 224 bytes ...HQquD7pQFUsBoPpW816CU8zQrQCua9mw4Znh9FyKZJ | Bin 0 -> 824 bytes ...NshcVjEgQ6nSsogWEQjRTr9EaEHJzKcSenqe2kyx5J | Bin 0 -> 824 bytes ...oN9TsoMSKJAp388G752pSUscb8iZwgdH459KSJxbZT | Bin 0 -> 312 bytes ...81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2 | Bin 0 -> 224 bytes ...AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB | Bin 0 -> 224 bytes ...SzJpyztTuK124EyPAw2nbF4Vaj2P9MU9vww1QN1k8p | Bin 0 -> 312 bytes ...VGLDmpnYqX5EvTg7i3tpRNEugeaUyDC9HtPSb3V3DS | Bin 0 -> 824 bytes ...yZ43boZTaP4mJsbTVUpinFJGMQXSMstJvDeatpEo4S | Bin 0 -> 824 bytes ...RjBSW4tnw42qxf3tycTYKki1d4bcETt9AfjEwoHYgy | Bin 0 -> 312 bytes ...81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2 | 2 + ...AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB | 2 + ...77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo | Bin 0 -> 32 bytes ...6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk | 1 + ...bbYh9NkGw15tEp16LLasmJX5VQR4Seh8gDjTrtdpoC | Bin 0 -> 4008 bytes ...Gu3bu5WnAdpcLbjQ4iyX6BQ5QGF69wevE8ZeeY5poA | Bin 0 -> 3240 bytes ...est__search_asset_with_token_type_all.snap | 150 ++++++++++++++++++ ...arch_asset_with_token_type_compressed.snap | 80 ++++++++++ ...ch_asset_with_token_type_non_fungible.snap | 150 ++++++++++++++++++ ...rch_asset_with_token_type_regular_nft.snap | 150 ++++++++++++++++++ 28 files changed, 535 insertions(+) create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_all/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_all/7oSzJpyztTuK124EyPAw2nbF4Vaj2P9MU9vww1QN1k8p create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_all/7sVGLDmpnYqX5EvTg7i3tpRNEugeaUyDC9HtPSb3V3DS create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_all/8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_all/DVHQquD7pQFUsBoPpW816CU8zQrQCua9mw4Znh9FyKZJ create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_all/HboN9TsoMSKJAp388G752pSUscb8iZwgdH459KSJxbZT create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/47ackukZJRBkQSufwFnhTkmTzB11Ww8375EDXTwY75wk create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/DVHQquD7pQFUsBoPpW816CU8zQrQCua9mw4Znh9FyKZJ create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/ELNshcVjEgQ6nSsogWEQjRTr9EaEHJzKcSenqe2kyx5J create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/HboN9TsoMSKJAp388G752pSUscb8iZwgdH459KSJxbZT create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2 create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/7oSzJpyztTuK124EyPAw2nbF4Vaj2P9MU9vww1QN1k8p create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/7sVGLDmpnYqX5EvTg7i3tpRNEugeaUyDC9HtPSb3V3DS create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/CyyZ43boZTaP4mJsbTVUpinFJGMQXSMstJvDeatpEo4S create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/iRjBSW4tnw42qxf3tycTYKki1d4bcETt9AfjEwoHYgy create mode 100644 integration_tests/tests/data/largest_token_account_ids/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2 create mode 100644 integration_tests/tests/data/largest_token_account_ids/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB create mode 100644 integration_tests/tests/data/largest_token_account_ids/8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo/8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo create mode 100644 integration_tests/tests/data/largest_token_account_ids/AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk/AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk create mode 100644 integration_tests/tests/data/transactions/search_asset_with_token_type_compressed/4URwUGBjbsF7UBUYdSC546tnBy7nD67txsso8D9CR9kGLtbbYh9NkGw15tEp16LLasmJX5VQR4Seh8gDjTrtdpoC create mode 100644 integration_tests/tests/data/transactions/search_asset_with_token_type_compressed/4nKDSvw2kGpccZWLEPnfdP7J1SEexQFRP3xWc9NBtQ1qQeGu3bu5WnAdpcLbjQ4iyX6BQ5QGF69wevE8ZeeY5poA create mode 100644 integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_all.snap create mode 100644 integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_compressed.snap create mode 100644 integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_non_fungible.snap create mode 100644 integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_regular_nft.snap diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_all/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB b/integration_tests/tests/data/accounts/search_asset_with_token_type_all/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB new file mode 100644 index 0000000000000000000000000000000000000000..17af7f79ebe3316b830179a5af7a44c447be210a GIT binary patch literal 224 zcmY#jfB*@G30CV|PNgvj4u=ku}ag j-#<*B+9{Lo5w%8=vGMns11}UeF+tq`reGS8#qh8JUISqc literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_all/7sVGLDmpnYqX5EvTg7i3tpRNEugeaUyDC9HtPSb3V3DS b/integration_tests/tests/data/accounts/search_asset_with_token_type_all/7sVGLDmpnYqX5EvTg7i3tpRNEugeaUyDC9HtPSb3V3DS new file mode 100644 index 0000000000000000000000000000000000000000..05f08bf57f34496cd56b7647ef5fdbfc8d8bf1f5 GIT binary patch literal 824 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQOcRy6pJDZPYW44B#S_XiPA~*sUUkaw z$0QS}_f8wvK9uAxNZt7OVvVcC+@ShwmcwTwcH|UGE%>|DbKAu|%s({UG(cu<2?df2 z4F92k5zJ#?cz#MXax#>&oQZ*frA;)<+alfJ!l|1_mmb@6_14^!^V2_i8w3X@G4CwZ zn;xZezaUM&i+|^gz~YFk8R{&Do*&Ad=^b1h{_l0?Ue}wy6o3W?d-`}f`}-*<8(A2e zLM=k3xS(nvVkdx9MoCFQv6a4la!Q_FMruw@er|q#o?d3YenDwcPG+)xaVC(=&nwo? zO)W`GNi0d!2N|uGRh*xPZ18}yzc4Za1Cb$rvzWbc?0z=Y6zR?J$0l4@&165%ZsW@A zwZZjryshVdtJFkW=rea_-ONqRy|)^>;5yW1euxOD+VMP z82&>6Bbdj)pmRnwax#z;1muIn8r#`YudQL3KC$V^vyM&=r77EQ9}SE;J<` z@E-~o!8`_rwlk`clcAjDObiSxZK7e`7U>QbPTf4Z^w_4Wx8|mtpZ?L?AUHUQd1tBK z^r%wFuy-k)Tx)~Er6)O0Uirad>FqQ@1F2Y7nCODWG3quX9CImykh;_ z)RM%M#F9jPkkNWs#rb*21`jy<3nL>i5E=3}i`g5;?q^d?k=`7CY{G@rO!o8aHm=Nm zYhw7{aQ8!9Mg|wBHFoMb*T2|luG}j1C5c%jB>m}1lg{T%e_IkCh;YwiNMU4T{KLq? z$oNG$*X>_}L}*&@iHD8>KiKllT>odLY%%9^@t*2ue5N4`42%qn{xNf#Z)~hNVVCoG geq|2F`yU;dbME;bky-mo-6DRKLeYQ+47D8q00*L|`~Uy| literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_all/HboN9TsoMSKJAp388G752pSUscb8iZwgdH459KSJxbZT b/integration_tests/tests/data/accounts/search_asset_with_token_type_all/HboN9TsoMSKJAp388G752pSUscb8iZwgdH459KSJxbZT new file mode 100644 index 0000000000000000000000000000000000000000..db36302a3c91fc7634a341d620ecc000a8c0046d GIT binary patch literal 312 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQ{I*nc8^hMKhwXnhUHu_5)wSl|;%e_Z zAJ<-ST&T;=dh`|B-ER-Cr!Jg)^YlZvbFVAc$ZTnS8y{^x(W>WbYu$f_l^Q@ZKFG=g zNd|`hP{0W0F);i-qZ&CG%2^5&E0qj;m(t0#HYi+rlJn%1A1s#MP7^dvezr7VM#%kF zzQ3f-n9xt1^_*bWv~DM literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/47ackukZJRBkQSufwFnhTkmTzB11Ww8375EDXTwY75wk b/integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/47ackukZJRBkQSufwFnhTkmTzB11Ww8375EDXTwY75wk new file mode 100644 index 0000000000000000000000000000000000000000..d13dae66e2285b1d13aaa3487aa205e90100356c GIT binary patch literal 312 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQ)N|?!oTgP!pu6<-snC;ee!rW?w7n($ z>1-zP&+pFL{S#-q`|aWN)P<98o_^?d?serFnJukv0PwkY+_lQ~}$=LXN&4Cw+o0y<(08=oH$YOZd0J#2Tq5uE@ literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo b/integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo new file mode 100644 index 0000000000000000000000000000000000000000..eac7068418c72771acaec5275485de440eb7dc65 GIT binary patch literal 224 zcmY#jfB*@G3ZZjryshVdtJFkW=rea_-ONqRy|)^>;5yW1euxOD+VMP z82&>6Bbdj)z^telIT^?a0`fs(jqPly*VeF1pV;)|Sx2Xb(vcYu4Pd{`!_quY8%$C--@zLfJt$Mz;*8OK#2{JRmR}4rp zF#LxCMlg?oVVAsS3xz(|a01_l86Hc$8f literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/DVHQquD7pQFUsBoPpW816CU8zQrQCua9mw4Znh9FyKZJ b/integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/DVHQquD7pQFUsBoPpW816CU8zQrQCua9mw4Znh9FyKZJ new file mode 100644 index 0000000000000000000000000000000000000000..8268e82ec9a70aceaaffdfc58cf4d5cd6d7d3d48 GIT binary patch literal 824 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQ+}X{4RsU1d9o|VrNsRUHkG|?P5S?rm zKAX`}k9l);#!v2o)QyiX*0@^C4XV#(Iea!^M^3TSg1=imw_V)B{6o`C17zlwP$0>` z@E-~o!8`_ra7E3?$xzO6CI$wUHqkI|i*$zzr*0lydTi6xTXR#+Pygs`5FDJuyt7nq zdQ_=o*t?WYuC+no(vzGgul!)K^mdw{aq_dJ0W(7Gzw-U105mw*)5p`<-%ml=(8SCP zY7sKU1yutPI{~CJN=gcft@QPiQ}XmOQgd?hbMy1_^fL4H3rdr6GL!X-Gl67&Ua@{| zYDr>BVo9Pt$Y{N+;`}^hg9n`bg^>{$hz$9g#q5n^_p_;{NNtF0NS8kR1lEkbMlKyn1N#}E>zb%OmM7ZZMq%blv{$XTc zWc;F>>-MifA~Y@d#6!n`A8dJNuKzPrwwUv|cu(~+KGP5e21W)(|CqVWH#XLsu*-Qo gzcPp8{f~~!Irn^z$gKUPZV|sqp=iJZhT0AQ0K!P9CIA2c literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/ELNshcVjEgQ6nSsogWEQjRTr9EaEHJzKcSenqe2kyx5J b/integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/ELNshcVjEgQ6nSsogWEQjRTr9EaEHJzKcSenqe2kyx5J new file mode 100644 index 0000000000000000000000000000000000000000..6d8ed5e48805f6518243fb7c28db93bbee52a7e1 GIT binary patch literal 824 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQJSMm4T9b?W`Mu`TJ0EgBHI{h3|5wGc zV?x``+vbJ4?_=dINZt7OVvVcC+@ShwmcwTwcH|UGE%>|DbKAu|%s({UG(cu<2?df2 z4F92k5zJ#?kW$c$oDAhGXJTMrX%h|ewn%rlaO&pKrN=g1y)`%G{Pd6B2EoBe%sWf< zrbl(&SbyqEOLeJ>N7Kd6C*%cxJYFLt?cy8IvF_)zsp0R+6@Uf@d-`}f`}-* literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/HboN9TsoMSKJAp388G752pSUscb8iZwgdH459KSJxbZT b/integration_tests/tests/data/accounts/search_asset_with_token_type_non_fungible/HboN9TsoMSKJAp388G752pSUscb8iZwgdH459KSJxbZT new file mode 100644 index 0000000000000000000000000000000000000000..f930ec392673087b8728e9f08beb4818ed52e8c2 GIT binary patch literal 312 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQ{I*nc8^hMKhwXnhUHu_5)wSl|;%e_Z zAJ<-ST&T;=dh`|B-ER-Cr!Jg)^YlZvbFVAc$ZTnS8y{^x(W>WbYu$f_l^Q@ZKFG=g zNd|`hP{0W0F)&Mr8keu_J4o lf4+a1KDARO-y>>`BxB?6H3wcOZeoJE0ZhR(B8%Z+0|2KmWZnP( literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2 b/integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2 new file mode 100644 index 0000000000000000000000000000000000000000..a7efd35f9b637a01dae771c91381afed1759300d GIT binary patch literal 224 zcmY#jfB*@G3<-h{K={r2#B>cYu4Pd{`!_quY8%$C--@zLfJt$Mz;*8OK#2{JRmR}4rp zF#LxCMlg?oq5rUE0CVxnGc`-^IUkMqqJ7)(mx)L(dOo&-4zi4*&PMbFb^o zUsC5y6W50P&2v*Z?e(Dg-!s1xGHsu?d=%^9>_~jEP(mAKE{NWe*u5e~WdD7!BWs+0 kzJHiLwNobFBWjH#W8?2N2VN*{VuHE>Ou;lFi{W7d0I0-ab^rhX literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/7sVGLDmpnYqX5EvTg7i3tpRNEugeaUyDC9HtPSb3V3DS b/integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/7sVGLDmpnYqX5EvTg7i3tpRNEugeaUyDC9HtPSb3V3DS new file mode 100644 index 0000000000000000000000000000000000000000..dc785fa4b56f357a3b0e581755487737c9f28e31 GIT binary patch literal 824 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQOcRy6pJDZPYW44B#S_XiPA~*sUUkaw z$0QS}_f8wvK9uAxNZt7OVvVcC+@ShwmcwTwcH|UGE%>|DbKAu|%s({UG(cu<2?df2 z4F92k5zJ#?h(DwmIT^}X&cwjL(k2?_ZISM9;ndBeOOI{3dTVaV`RO0M4T6J{n0J=y zO^?#KUy!EX#lLe#U~xp&40V=6&ktqK^bW2L|M$9cuj|cU3P6K{J$*c#{rwb_jVz2! zp%x)iTu?O-u@gWlqokyu*h*hNIVDdoBQ+-{KQ})=PcJiHzo0ZJCo@^UI1@!f g^DA>W-v8*xoO93jh|Jnw>K5^<6p98sV5sc?0JFKPQvd(} literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/CyyZ43boZTaP4mJsbTVUpinFJGMQXSMstJvDeatpEo4S b/integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/CyyZ43boZTaP4mJsbTVUpinFJGMQXSMstJvDeatpEo4S new file mode 100644 index 0000000000000000000000000000000000000000..a75763c95e67174a7c13151983ca8f226596a2ef GIT binary patch literal 824 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQ+{DQ?!zg9R=8oWJ`Nr>}1Ni4%yjO4A zAMtI?`le^ji>`AQq;7nCvBuS6Zcu$T%i*&TJ93Jp7X01nx$WW}<{z4F8Xz;bgaSzh zhW}8&2<9;`JUFZwIT^}X&cwjL(k2?_ZISM9;ndBeOOI{3dTVaV`RO0M4T6J{n0J=y zO^=e<@zYv%(Q@${ZEjqP(q-PAy7YkcvkLD4``mEz-3Q);D*z1+_Vn>|_V-gzHZij> zg<6D6aY5BU#7+RIjFOUqVk>?9DRWt2jRo+28?Ze_><<1|mcLW-)u?*!^s(Dbkzck4?C+n#q2i-Nu#K zZ%qvU8}5Fn%gEs3w8l<7=lT~r&6QiFz9ccLgrq-RY0~+e>2FKo0}<|d3@MC^jQ<%~ z7#Y7P=eqrCkO)l+KJm~o;0IgYnd|?|lr83bF5Xl9jL$TLfq{{M(LZKx^No!)C+u<_ g&#%nkc>kj#bIv{ABQk4$sawRaQYaemfT6Yn0F%P2GXMYp literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/iRjBSW4tnw42qxf3tycTYKki1d4bcETt9AfjEwoHYgy b/integration_tests/tests/data/accounts/search_asset_with_token_type_regular_nft/iRjBSW4tnw42qxf3tycTYKki1d4bcETt9AfjEwoHYgy new file mode 100644 index 0000000000000000000000000000000000000000..dc89d878f2135367a57358d4e3447ceabbb3b55b GIT binary patch literal 312 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQcaeuNLfm9eaxH?ze~6Qx{IYdHSK-x!09zWVW=vjgK~;Xw~zzweCN|N)4bHA7tf$ zBm={LC}0Hh7#Na{Xhu$ka+U(cWOn?tmR+=5{6?D_*P?Wpcc(5rVEwGZd%!+7+Mr8keu_J4o lf4+a1KDARO-y>>`BxB?6H3wcOZeoJE0ZhR(B8%Z+0|4qGV=Vvx literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/largest_token_account_ids/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2 b/integration_tests/tests/data/largest_token_account_ids/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2 new file mode 100644 index 000000000..3dc3aa9c3 --- /dev/null +++ b/integration_tests/tests/data/largest_token_account_ids/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2/2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2 @@ -0,0 +1,2 @@ + +Ÿ9mRi\꠽] \ No newline at end of file diff --git a/integration_tests/tests/data/largest_token_account_ids/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB b/integration_tests/tests/data/largest_token_account_ids/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB new file mode 100644 index 000000000..c9241fcba --- /dev/null +++ b/integration_tests/tests/data/largest_token_account_ids/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB/42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB @@ -0,0 +1,2 @@ +e 9;:$fEvKA +\%. \ No newline at end of file diff --git a/integration_tests/tests/data/largest_token_account_ids/8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo/8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo b/integration_tests/tests/data/largest_token_account_ids/8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo/8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo new file mode 100644 index 0000000000000000000000000000000000000000..eb66ffa10c0a3dcda1f1eb5fd8a70e7049eb6dbd GIT binary patch literal 32 qcmV+*0N?-ir75-mwavpn`GVE>9F;|U{-b+K-0`i{L7^=N1;y$%s1i5; literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/largest_token_account_ids/AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk/AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk b/integration_tests/tests/data/largest_token_account_ids/AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk/AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk new file mode 100644 index 000000000..7bc1e9a00 --- /dev/null +++ b/integration_tests/tests/data/largest_token_account_ids/AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk/AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk @@ -0,0 +1 @@ +.BQ*pp-Ug> \ No newline at end of file diff --git a/integration_tests/tests/data/transactions/search_asset_with_token_type_compressed/4URwUGBjbsF7UBUYdSC546tnBy7nD67txsso8D9CR9kGLtbbYh9NkGw15tEp16LLasmJX5VQR4Seh8gDjTrtdpoC b/integration_tests/tests/data/transactions/search_asset_with_token_type_compressed/4URwUGBjbsF7UBUYdSC546tnBy7nD67txsso8D9CR9kGLtbbYh9NkGw15tEp16LLasmJX5VQR4Seh8gDjTrtdpoC new file mode 100644 index 0000000000000000000000000000000000000000..a9f81afe7eb5943d62b734b68c5c60f647ea46f0 GIT binary patch literal 4008 zcmd5;c|4T+8h;stlzqufy_O~|idmSM;}phlWX%{`rG{AyW-;?l=oSucMUf)hRHsO% zTRPFAl(K|~xM}06EGI`<>a?Ix&hI6C9DQy+bM&S^AYT9i!!v^6XcrPFaj;_8 zG5lC`Dv@A`2<)P)1ooCzNTfs}B-xXxp5#zR7bGyyFPQ8W>KI``L}(%lOBWZWgulj@ z=)KmHKxYS&xb`7lVuU3UQc?RDfPVwz1IPhXkBp6hZg%X)IqFj`p{9E`hIX0fmA&=D zwqw>=83xhVhP`Iz&c3Gx)TnO01h2}Ed>A9$uWlG0r?G-lXcHi^O;u$e1FMn}Y}XBQ zQ`gCvF;slk1`Y8x>NP+W+MCR42I)w`zM_|HmqJJ+t#FZ|dgm5E!MLEk4uC2IDadH6 z$m%G`VP>f-YALH}YRJ!pppemVALnQR9n@!3U)E+08p^mNecVS`M)#EfFg6Rv_a+-a zF~|c1@}UCF0xg;sAhM`FYRD8cv9c5AQ{In_q3fL!cD2`kTz3OK1d)xZUgS2@bP`7w z<+KiRpTBHuDjIJ)r6uAPpwtM-tgXFu161wDbN1Xd^ z*L0fT{29ytl(=*6jzR$S9%5r&U#i{bUFIR<^9IZ%< zzZzboDu3}68fr|mvgQ~*%!!p-SfY9&>A2mIT_MF{%{}MtL4vn=H$qX`iZdUVtKYzV zpLKmm+Q^=J{w4F-er{`Ni1i}+`nHp9)ewmO9@lb7Haq@i(iIyq?kB_WOr3JNp5hSildv`jG8z zZ5?}~4Xv-SX(dY*wiQ1pvFTQT)8X0e3+l0e9!O#6O;cX#-h0%X`+t8_KX8A}D0PXX znG*5qv*R6I!krl~(COP*5#1&YK4MbJ^9)Wm@<>WP*S1EKPk!+$xgz41;e+Vy>Rk9% zd<`3x_lo>F(E=~|{#t&b-d**cqk(8~aIVm4 zr)^!AC|1lTN$x#ZLO$GjLBU$qU+X0HapSYq5oi@I20&%9`q8lhNRk|AC+g3CY`or8 zB0tWEj+W1XU0i$uzZU-I8)NKG6sBXN4Sf}>rsHq0h^wYH4 zooi`1u0=oYY{Jo(s9&iVEeLSJTWc&RsK8QxCkeA2|~PnnLu9Ke=Z?!V#=c_be=}$OPOp_x|LcKqwRik^@6sy*Yp;lC30A z1(8Gqc^l6XEN1hWJONL@{i41l5%-xsaf zFeQi?M<|Y9idn!QED{TaoaL|tVTuuS&J(cMkuaVF&goA->%wMoU?)_80t3VIr|;WI zIUKeart`M2DKMT4wjp@Bjwg>BjPQjLWYQ4c3e_{1u4fyB@HVqQDWU%Scdje}TjbAT zH~q{eg0T63Ul1lDggLyhFc9tp13(p8G+p0GAVI`Z;0T%!PqrwG8N^080D4n%|26k! zGWR%;`>A*DYie`ydHAbp8{9x5@h`4zG(Mv*^64dJ3M8OhAZYazy{~#FC&{$f@Fy;* z6EB>dl*MHu7GIQ4@5I!6e$DwQF8p8kpbNMRFkWX?m3e6J`Zig;ihGi^zloli>JM)} zrIBl5nA@|IKhs|@F!4o!9naTcpr#C?mfGkPYhAkDxm0)iBTwHfet#?8Pa&qvyr!yS z7v`EWiIFJDbBiv1?w)_*+Av&vUMJgUjVsZXkXqf)OH=N97}pt>hA~jP@!-3+0Y0U2 z`k9u>IaMtOXZmgM?(KcQQD}zI%t&hveKEJ{X~gY?ruiNCix04M=QV5lcWyPhy2Im+ zjZVHb=faqpS^gu*V1ZV*+JyzNMrRJp3r;s*%fcMcC@Mc1r8KgGV!Wdz7cyv|nvc;` zjFa0>xMp$dH^$5hO}pID865;8CbXv1S6I?wr(Iqjs>nm$XR>z1_C^s+d1pAN9Zh1D0mY9(Ut-OpF#r z!9mz%sEZrxJAGMvJ-fSPch{AwA&t=G)NG0kV7|O9uBGx4qS@2=LT*p``8y1k9!bkG z)h+J?vf~mn@ZB!OvaI5t zJDNWf{*y5xdpSeu>k%2Q#Jgj!>fzOnX&bR^{S7(g(n`n08}M1jl?K)w*R4sU|4>(R zoYH&dZ6U>}Gj34ny6y@5NOC4$eeG5s0}aC*c9Z{5WZ&C;?;fs-Y1e7@c=2iz-d!*6 z?gz3#oRaapfeiN*D=wB_&l`InoaO)=0S^jGtYi zT6V?p=1QbeeMR~y&BoknLf1pxo;u7eedAlvky{lmWczm9vA*wc@{DG&BHUPWH96P) Q_r2e85*z8r{{!g zq|%h6C~ll8Ll);3L5t^N1^h5U9HSsf>K_w~^J%$!EL_Ks=vYZARHl(eNwWD&d7+3M z%xCe#!`S}$n4Zf?!LVeOMvW5op)1G=faOmnCWxuw`T8UrKcF=Dw(U=}p9kmRYK06_ zA!v~w^<@A^MaoG>ON^(dRJu zd6+Oa5!DN*s8|>pD~Zht<|Ofwe<6_|2NI|~gxGXjoeMBqRVa&?IQT|b<)z{W`+O3{ zHmrYAyWri2lT_I?Lp+P@{U6({xVIOJc&+X1&d|n|9*XcaO7I7ndq24aWRMY&Lz0=9 z2^>t#$rhGY);6|8oJ2w`jTM-z0}%y*ugDPabO8jh4t_c@L5zXp#++EKdA=V*SOosB zw++?xa2HgJFRkqz$-MXA%gc>VkmH6U6LlXHb9Vuh-sbE&a5vzNJW}kM4N?;<@3$LLXKe>VUs( zf&dV7X1CQcy3_5>i?R3-iQ%O6nmga0XLY>Z6MHQK+hV99!BES8jwLNJ?domHyJ7Kg z_3$#I@Helua$%4H4D)z&Y8yo%k!Ejr@KX+ zhl#Koc`^4Fb4dNokDW{33-@z>%HR8$X4JHDYqmYQW63-(0Hd$^C$gp{&Xe}-{Xp+? zM<29JY+UNOGUxIwaDMeS0d;N<2{}De@jh1VsZ8^u^hE7Yq?h0I5%jLR>uJ|}$C+-g z8p1Zf{4DBlTqthna(!ie@sU=bTFdaSZ+~hT=egxsnY!$aqq|^wK=>iMf#WA0ncW=O zwSRNRl|&nqbS3Abw4tx}FOzuFuLux$rnP4CpU9LSeMFyT)DFyB5fs1CIhUX84GCDc$-cCb!TIq0;Ss^D!^RjBhVz~Td|hORyK zStyS0)AteL=rO%q=0>?!ziH=varlghE1v<`6`K5B&4i zFfpmOqtA?bvu475!lM^NRRN{{r<X8fUOP z)$+gB-0^Z9D?3c7TjE}Kce!%5-={*Xa&+IkiQQ(bTcb%2ZQt zp=}ah`dGf!r3g-lJZxImjw zC=3aXWOJfJGa~(1bgftrCrn1PI;j-XYTD*MdLKurF2Op?Z-{86J|C8$v@fF+V1n7?%|Gx*Kr{xm;^zmXk-LuE5wU>Eq3w&g0lItN2i8EF6@Gi)f- znE?n-rN#4fQe3W91t6$KgQ;Zj2$<<>E_IsnMTfp-)_N|vn3Cfkl}i?tO5^;&xqLA` zC5DT0B?SdSEKin8=SZ_@0tuRwlgw8#3MEC^61JEl!C5p;0Zlutm6RE^n9KcXt50Kbk-D#Sj5|hW*J}ivo~fokXI*GIdI1>Qxbs;Yf&Dp}>qHK;q>^*zfB<7j84_ zzw&?l&(vD9T!km7|LZuB29E>c3vY_poZewmj%jJY4%+Z2IrYvFhXCQ|y$#iS)2KK4 z{yr!uB{K`HAG|f@WGL=2aJRM0TkjgSn}(@K?mhuu1fA#~{&0BL!|w#OF1}3VY+qe< z9VMhkEyK<~;1PCi2J0>T;##|LDr~bV<*?m1_f6W;LP$w0?pe z>6;+_=;~;*%~>p;li?}dMf!Sa4URs4JM8pjT|4u; z8?W5$Aa}ZYbiP?oY_;6!UX{V^bIXGzDeZ5*{rKi}M@jlZnN!J*SdY!*5@#C?c4Dx* jn9Hdal;oIR=oFn+Xk9;idXm@J-9#Q;7Dm+a|Fz!$y1`aO literal 0 HcmV?d00001 diff --git a/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_all.snap b/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_all.snap new file mode 100644 index 000000000..c2df45395 --- /dev/null +++ b/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_all.snap @@ -0,0 +1,150 @@ +--- +source: integration_tests/tests/integration_tests/token_type_test.rs +expression: response +snapshot_kind: text +--- +{ + "total": 2, + "limit": 2, + "page": 1, + "items": [ + { + "interface": "ProgrammableNFT", + "id": "8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://cdn.hellomoon.io/public/silicons/metadata/1466.json", + "files": [], + "metadata": { + "name": "SILICON #1466", + "symbol": "SILI", + "token_standard": "ProgrammableNonFungible" + }, + "links": {} + }, + "authorities": [ + { + "address": "A2QW89tFNDkkdvJv671tdknAyA21u6hvS7HTUyeMWnf3", + "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": "HS1oygRKNBG1nMqjSmaBXSQqQ7apWr14gUU4pW3aDMCP" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.05, + "basis_points": 500, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "8X2e7Lf3wmA9RPHpPH73kmTqqHHyZE9BcED6Y6TWaZCx", + "share": 0, + "verified": true + }, + { + "address": "5bTgyaCCRNCem3DZXxdRREyesduc6adqwks8rRWGXx8D", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": true, + "delegated": true, + "delegate": "D98f1ebFe6kfZTcztLo1iPeKAwogbWHAgXzgSpdRDiu7", + "ownership_model": "single", + "owner": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g" + }, + "supply": null, + "mutable": true, + "burnt": false + }, + { + "interface": "ProgrammableNFT", + "id": "42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://cdn.hellomoon.io/public/silicons/metadata/2835.json", + "files": [], + "metadata": { + "name": "SILICON #2835", + "symbol": "SILI", + "token_standard": "ProgrammableNonFungible" + }, + "links": {} + }, + "authorities": [ + { + "address": "A2QW89tFNDkkdvJv671tdknAyA21u6hvS7HTUyeMWnf3", + "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": "HS1oygRKNBG1nMqjSmaBXSQqQ7apWr14gUU4pW3aDMCP" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.05, + "basis_points": 500, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "8X2e7Lf3wmA9RPHpPH73kmTqqHHyZE9BcED6Y6TWaZCx", + "share": 0, + "verified": true + }, + { + "address": "5bTgyaCCRNCem3DZXxdRREyesduc6adqwks8rRWGXx8D", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": true, + "delegated": true, + "delegate": "D98f1ebFe6kfZTcztLo1iPeKAwogbWHAgXzgSpdRDiu7", + "ownership_model": "single", + "owner": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g" + }, + "supply": null, + "mutable": true, + "burnt": false + } + ] +} diff --git a/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_compressed.snap b/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_compressed.snap new file mode 100644 index 000000000..59c7dbe8d --- /dev/null +++ b/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_compressed.snap @@ -0,0 +1,80 @@ +--- +source: integration_tests/tests/integration_tests/token_type_test.rs +expression: response +snapshot_kind: text +--- +{ + "total": 1, + "limit": 2, + "page": 1, + "items": [ + { + "interface": "V1_NFT", + "id": "7myVr8fEG52mZ3jAwgz88iQRWsuzuVR2nfH8n2AXnBxE", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://arweave.net/S40vvBVuCvZhAWI3kvk3QreUqVAvR0AaUDObOhB8WIY", + "files": [], + "metadata": { + "name": "Golden Azurite", + "symbol": "OEAs", + "token_standard": "NonFungible" + }, + "links": {} + }, + "authorities": [ + { + "address": "EDAR6p4AUbv9SpD1pDm3gxdSAivdqsHxsf6V9pBc532U", + "scopes": [ + "full" + ] + } + ], + "compression": { + "eligible": false, + "compressed": true, + "data_hash": "B2tu4duCUPequnXh7DxbMnLeLcACHbDCQn3g34s5Cvbx", + "creator_hash": "6UiSCAv4r66MALaqhNE7qdTK84qKk1yJqR4UYtT8qEQ1", + "asset_hash": "8EBnZHUKKB2Vdef34H4L3nxYKkf5RPwCkoHBVLAAM2zN", + "tree": "4r2zZHZvC4Se1KUcCcyCM4ZoFQNGZm2M5FMmUypFocAP", + "seq": 39, + "leaf_id": 5 + }, + "grouping": [ + { + "group_key": "collection", + "group_value": "BwwjnxTHeVWdFieDWmoezta19q1NiwcNNyoon9S38bkM" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.05, + "basis_points": 500, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "4gETqgEwFLkXX9yk6qBszA6LMjC2kRyyERXsAr2rwhwf", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": false, + "delegated": false, + "delegate": null, + "ownership_model": "single", + "owner": "53VVFtLzzi3nL2p1QF591PAB8rbcbsirYepwUphtHU9Q" + }, + "supply": { + "print_max_supply": 0, + "print_current_supply": 0, + "edition_nonce": null + }, + "mutable": true, + "burnt": false + } + ] +} diff --git a/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_non_fungible.snap b/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_non_fungible.snap new file mode 100644 index 000000000..0d3cd5134 --- /dev/null +++ b/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_non_fungible.snap @@ -0,0 +1,150 @@ +--- +source: integration_tests/tests/integration_tests/token_type_test.rs +expression: response +snapshot_kind: text +--- +{ + "total": 2, + "limit": 2, + "page": 1, + "items": [ + { + "interface": "ProgrammableNFT", + "id": "AH6VcoSbCGGv8BHeN7K766VUWMcdFRTaXpLvGTLSdAmk", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://cdn.hellomoon.io/public/silicons/metadata/4515.json", + "files": [], + "metadata": { + "name": "SILICON #4515", + "symbol": "SILI", + "token_standard": "ProgrammableNonFungible" + }, + "links": {} + }, + "authorities": [ + { + "address": "A2QW89tFNDkkdvJv671tdknAyA21u6hvS7HTUyeMWnf3", + "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": "HS1oygRKNBG1nMqjSmaBXSQqQ7apWr14gUU4pW3aDMCP" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.05, + "basis_points": 500, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "8X2e7Lf3wmA9RPHpPH73kmTqqHHyZE9BcED6Y6TWaZCx", + "share": 0, + "verified": true + }, + { + "address": "5bTgyaCCRNCem3DZXxdRREyesduc6adqwks8rRWGXx8D", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": true, + "delegated": true, + "delegate": "D98f1ebFe6kfZTcztLo1iPeKAwogbWHAgXzgSpdRDiu7", + "ownership_model": "single", + "owner": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g" + }, + "supply": null, + "mutable": true, + "burnt": false + }, + { + "interface": "ProgrammableNFT", + "id": "8t77ShMViat27Sjphvi1FVPaGrhFcttPAkEnLCFp49Bo", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://cdn.hellomoon.io/public/silicons/metadata/1466.json", + "files": [], + "metadata": { + "name": "SILICON #1466", + "symbol": "SILI", + "token_standard": "ProgrammableNonFungible" + }, + "links": {} + }, + "authorities": [ + { + "address": "A2QW89tFNDkkdvJv671tdknAyA21u6hvS7HTUyeMWnf3", + "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": "HS1oygRKNBG1nMqjSmaBXSQqQ7apWr14gUU4pW3aDMCP" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.05, + "basis_points": 500, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "8X2e7Lf3wmA9RPHpPH73kmTqqHHyZE9BcED6Y6TWaZCx", + "share": 0, + "verified": true + }, + { + "address": "5bTgyaCCRNCem3DZXxdRREyesduc6adqwks8rRWGXx8D", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": true, + "delegated": true, + "delegate": "D98f1ebFe6kfZTcztLo1iPeKAwogbWHAgXzgSpdRDiu7", + "ownership_model": "single", + "owner": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g" + }, + "supply": null, + "mutable": true, + "burnt": false + } + ] +} diff --git a/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_regular_nft.snap b/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_regular_nft.snap new file mode 100644 index 000000000..0fef897f4 --- /dev/null +++ b/integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_regular_nft.snap @@ -0,0 +1,150 @@ +--- +source: integration_tests/tests/integration_tests/token_type_test.rs +expression: response +snapshot_kind: text +--- +{ + "total": 2, + "limit": 2, + "page": 1, + "items": [ + { + "interface": "ProgrammableNFT", + "id": "42AYryUGNmJMe9ycBXZekkYvdTehgbtECHs7SLu5JJTB", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://cdn.hellomoon.io/public/silicons/metadata/2835.json", + "files": [], + "metadata": { + "name": "SILICON #2835", + "symbol": "SILI", + "token_standard": "ProgrammableNonFungible" + }, + "links": {} + }, + "authorities": [ + { + "address": "A2QW89tFNDkkdvJv671tdknAyA21u6hvS7HTUyeMWnf3", + "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": "HS1oygRKNBG1nMqjSmaBXSQqQ7apWr14gUU4pW3aDMCP" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.05, + "basis_points": 500, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "8X2e7Lf3wmA9RPHpPH73kmTqqHHyZE9BcED6Y6TWaZCx", + "share": 0, + "verified": true + }, + { + "address": "5bTgyaCCRNCem3DZXxdRREyesduc6adqwks8rRWGXx8D", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": true, + "delegated": true, + "delegate": "D98f1ebFe6kfZTcztLo1iPeKAwogbWHAgXzgSpdRDiu7", + "ownership_model": "single", + "owner": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g" + }, + "supply": null, + "mutable": true, + "burnt": false + }, + { + "interface": "ProgrammableNFT", + "id": "2w81QrLYTwSDkNwXgCqKAwrC1Tu6R9mh9BHcxys2Bup2", + "content": { + "$schema": "https://schema.metaplex.com/nft1.0.json", + "json_uri": "https://cdn.hellomoon.io/public/silicons/metadata/4685.json", + "files": [], + "metadata": { + "name": "SILICON #4685", + "symbol": "SILI", + "token_standard": "ProgrammableNonFungible" + }, + "links": {} + }, + "authorities": [ + { + "address": "A2QW89tFNDkkdvJv671tdknAyA21u6hvS7HTUyeMWnf3", + "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": "HS1oygRKNBG1nMqjSmaBXSQqQ7apWr14gUU4pW3aDMCP" + } + ], + "royalty": { + "royalty_model": "creators", + "target": null, + "percent": 0.05, + "basis_points": 500, + "primary_sale_happened": true, + "locked": false + }, + "creators": [ + { + "address": "8X2e7Lf3wmA9RPHpPH73kmTqqHHyZE9BcED6Y6TWaZCx", + "share": 0, + "verified": true + }, + { + "address": "5bTgyaCCRNCem3DZXxdRREyesduc6adqwks8rRWGXx8D", + "share": 100, + "verified": false + } + ], + "ownership": { + "frozen": true, + "delegated": true, + "delegate": "D98f1ebFe6kfZTcztLo1iPeKAwogbWHAgXzgSpdRDiu7", + "ownership_model": "single", + "owner": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g" + }, + "supply": null, + "mutable": true, + "burnt": false + } + ] +} From 02a47694806876d98860389d13162280ebe4a0d1 Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Wed, 18 Dec 2024 00:15:02 +0530 Subject: [PATCH 06/12] fix tests and added snapshot for search_assets with token_type fungible --- ...RNfDfdq1nKyU1TQiCEQLWyPtD8EwUH9Kt2ahsbidUx | Bin 0 -> 312 bytes ...ajpcYgnxmWK91RhrfsdB3Tm83PcDwPvMC8ZinvtTY6 | Bin 0 -> 824 bytes ...YnhQoR9YM3N7UoaKRoA44Uy8JeaZV3qyouov87awMs | Bin 0 -> 224 bytes ...est__search_asset_with_token_type_all.snap | 2 - ...search_asset_with_token_type_fungible.snap | 64 ++++++++++++++++++ ...ch_asset_with_token_type_non_fungible.snap | 2 - ...rch_asset_with_token_type_regular_nft.snap | 2 - .../integration_tests/token_type_test.rs | 4 +- 8 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_fungible/6BRNfDfdq1nKyU1TQiCEQLWyPtD8EwUH9Kt2ahsbidUx create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_fungible/7BajpcYgnxmWK91RhrfsdB3Tm83PcDwPvMC8ZinvtTY6 create mode 100644 integration_tests/tests/data/accounts/search_asset_with_token_type_fungible/7EYnhQoR9YM3N7UoaKRoA44Uy8JeaZV3qyouov87awMs create mode 100644 integration_tests/tests/integration_tests/snapshots/integration_tests__token_type_test__search_asset_with_token_type_fungible.snap diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_fungible/6BRNfDfdq1nKyU1TQiCEQLWyPtD8EwUH9Kt2ahsbidUx b/integration_tests/tests/data/accounts/search_asset_with_token_type_fungible/6BRNfDfdq1nKyU1TQiCEQLWyPtD8EwUH9Kt2ahsbidUx new file mode 100644 index 0000000000000000000000000000000000000000..4311dc97f4f9a3322924e4a368d8d9c1c78f803e GIT binary patch literal 312 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQ^!a+$_0g5xjz_QDue^WuW!dxf{hF%2 zHoA{B?^T}N_F*mC-ER-Cr!Jg)^YlZvbFVAc$ZTnS8y{^x(W>WbYu$f_l^Q@ZKFG=g zNd|`hP!RVvMhL`rz7czMG9!q^z_1jEW9H3`U(DI&b+)!q;1Di&efLcpf HAr=(?1vXe^ literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_fungible/7BajpcYgnxmWK91RhrfsdB3Tm83PcDwPvMC8ZinvtTY6 b/integration_tests/tests/data/accounts/search_asset_with_token_type_fungible/7BajpcYgnxmWK91RhrfsdB3Tm83PcDwPvMC8ZinvtTY6 new file mode 100644 index 0000000000000000000000000000000000000000..c732e2f782ff3752c615dd8236c9e0ede0d89fd4 GIT binary patch literal 824 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQjJ_lMFd&sh{5Dh3C!?)gLerkEciEd6 zxUD_YEPgGMV>EX`>c+^a5jYmMLKw4&9U zp0uyC-QyQCZ*Kfz&Ni>JwT%*&)eLR!Rkz)jcsPBM7qdkEzxlRR3P6K`Gjnn(6vDl+ykiT5eY$TjectSB-KuB>u%^GnS}w`G9%jEs!`7=a-<3TPPu E06HRZP5=M^ literal 0 HcmV?d00001 diff --git a/integration_tests/tests/data/accounts/search_asset_with_token_type_fungible/7EYnhQoR9YM3N7UoaKRoA44Uy8JeaZV3qyouov87awMs b/integration_tests/tests/data/accounts/search_asset_with_token_type_fungible/7EYnhQoR9YM3N7UoaKRoA44Uy8JeaZV3qyouov87awMs new file mode 100644 index 0000000000000000000000000000000000000000..3b72653d8fe8289f0abba3cabaeac2255b90bb61 GIT binary patch literal 224 zcmY#jfB*@G34$FTURSP>+0yzpKH7YuRnOPfy8jF-L1zB1-nCp4 zL_ Date: Fri, 20 Dec 2024 19:26:31 +0530 Subject: [PATCH 07/12] search_assets rpc call skipping fungible_tokens bug resolved --- digital_asset_types/src/dao/mod.rs | 39 ++++++++++++++----- .../integration_tests/token_type_test.rs | 3 +- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/digital_asset_types/src/dao/mod.rs b/digital_asset_types/src/dao/mod.rs index 71063bffa..02f2ef263 100644 --- a/digital_asset_types/src/dao/mod.rs +++ b/digital_asset_types/src/dao/mod.rs @@ -166,17 +166,36 @@ impl SearchAssetsQuery { if let Some(o) = self.owner_type.clone() { conditions = conditions.add(asset::Column::OwnerType.eq(o)); } else { - // Default to NFTs - // - // In theory, the owner_type=single check should be sufficient, - // however there is an old bug that has marked some non-NFTs as "single" with supply > 1. - // The supply check guarentees we do not include those. - conditions = conditions.add_option(Some( - asset::Column::OwnerType + match self.token_type { + Some(TokenTypeClass::Fungible) => { + conditions = conditions.add_option(Some( + asset::Column::OwnerType + .eq(OwnerType::Token) + .and((asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::FungibleToken)) + .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::FungibleAsset)) + ), + )); + } + Some(TokenTypeClass::All) => { + conditions = conditions.add_option(Some( + asset::Column::SpecificationAssetClass.is_not_null(), + )); + } + _ => { + // Default to NFTs + // + // In theory, the owner_type=single check should be sufficient, + // however there is an old bug that has marked some non-NFTs as "single" with supply > 1. + // The supply check guarentees we do not include those. + conditions = conditions.add_option(Some( + asset::Column::OwnerType .eq(OwnerType::Single) - .and(asset::Column::Supply.lte(1)), - )); - } + .and(asset::Column::Supply.lte(1)), + )); + } + } + + } if let Some(c) = self.creator_address.to_owned() { conditions = conditions.add(asset_creators::Column::Creator.eq(c)); diff --git a/integration_tests/tests/integration_tests/token_type_test.rs b/integration_tests/tests/integration_tests/token_type_test.rs index 9933f8efe..032861f84 100644 --- a/integration_tests/tests/integration_tests/token_type_test.rs +++ b/integration_tests/tests/integration_tests/token_type_test.rs @@ -176,8 +176,7 @@ async fn test_search_asset_with_token_type_fungible() { { "page": 1, "limit": 1, - "tokenType": "Fungible", - "ownerType" : "token" + "tokenType": "Fungible" } "#; From 6a8f0dc605bf6230ccb72b3f2bea280ca6e3fd7a Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Mon, 23 Dec 2024 14:59:28 +0530 Subject: [PATCH 08/12] not able to search for fungible asset for owner_address in search_assets fun bug fixed --- .../src/dao/extensions/asset.rs | 14 ++++++- digital_asset_types/src/dao/extensions/mod.rs | 1 + .../src/dao/extensions/token_accounts.rs | 26 +++++++++++++ digital_asset_types/src/dao/mod.rs | 37 +++++++++++++------ 4 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 digital_asset_types/src/dao/extensions/token_accounts.rs diff --git a/digital_asset_types/src/dao/extensions/asset.rs b/digital_asset_types/src/dao/extensions/asset.rs index ace692d7e..eeb31fed8 100644 --- a/digital_asset_types/src/dao/extensions/asset.rs +++ b/digital_asset_types/src/dao/extensions/asset.rs @@ -2,10 +2,11 @@ use sea_orm::{EntityTrait, EnumIter, Related, RelationDef, RelationTrait}; use crate::dao::{ asset, asset_authority, asset_creators, asset_data, asset_grouping, - asset_v1_account_attachments, + asset_v1_account_attachments,token_accounts, sea_orm_active_enums::{OwnerType, RoyaltyTargetType}, }; + #[derive(Copy, Clone, Debug, EnumIter)] pub enum Relation { AssetData, @@ -13,6 +14,7 @@ pub enum Relation { AssetAuthority, AssetCreators, AssetGrouping, + TokenAccounts, } impl RelationTrait for Relation { @@ -22,6 +24,10 @@ impl RelationTrait for Relation { .from(asset::Column::AssetData) .to(asset_data::Column::Id) .into(), + Self::TokenAccounts => asset::Entity::belongs_to(token_accounts::Entity) + .from(asset::Column::Id) + .to(token_accounts::Column::Mint) + .into(), Self::AssetV1AccountAttachments => { asset::Entity::has_many(asset_v1_account_attachments::Entity).into() } @@ -62,6 +68,12 @@ impl Related for asset::Entity { } } +impl Related for asset::Entity { + fn to() -> RelationDef { + Relation::TokenAccounts.def() + } +} + impl Default for RoyaltyTargetType { fn default() -> Self { Self::Creators diff --git a/digital_asset_types/src/dao/extensions/mod.rs b/digital_asset_types/src/dao/extensions/mod.rs index bcfc3e130..cdc57c34c 100644 --- a/digital_asset_types/src/dao/extensions/mod.rs +++ b/digital_asset_types/src/dao/extensions/mod.rs @@ -5,3 +5,4 @@ pub mod asset_data; pub mod asset_grouping; pub mod asset_v1_account_attachment; pub mod instruction; +pub mod token_accounts; \ No newline at end of file diff --git a/digital_asset_types/src/dao/extensions/token_accounts.rs b/digital_asset_types/src/dao/extensions/token_accounts.rs new file mode 100644 index 000000000..2027d4556 --- /dev/null +++ b/digital_asset_types/src/dao/extensions/token_accounts.rs @@ -0,0 +1,26 @@ +use sea_orm::{EntityTrait, EnumIter, Related, RelationDef, RelationTrait}; + +use crate::dao::{asset, token_accounts}; + +#[derive(Copy, Clone, Debug, EnumIter)] + +pub enum Relation { + Asset, +} + +impl RelationTrait for Relation { +fn def(&self) -> RelationDef { + match self { + Self::Asset => token_accounts::Entity::belongs_to(asset::Entity) + .from(token_accounts::Column::Mint) + .to(asset::Column::Id) + .into(), + } + } +} + +impl Related for token_accounts::Entity { + fn to() -> RelationDef { + Relation::Asset.def() + } +} \ No newline at end of file diff --git a/digital_asset_types/src/dao/mod.rs b/digital_asset_types/src/dao/mod.rs index 02f2ef263..821b585f1 100644 --- a/digital_asset_types/src/dao/mod.rs +++ b/digital_asset_types/src/dao/mod.rs @@ -92,12 +92,12 @@ impl SearchAssetsQuery { ) .add_option(self.token_type.clone().map(|x| { match x { - TokenTypeClass::Compressed => asset::Column::TreeId.is_not_null(), + TokenTypeClass::Compressed => asset::Column::TreeId.is_not_null(), TokenTypeClass::Nft => { asset::Column::TreeId.is_null() - .and( - asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) - .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::MplCoreAsset)) + .and( + asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) + .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::MplCoreAsset)) .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::ProgrammableNft)) ) }, @@ -107,18 +107,13 @@ impl SearchAssetsQuery { .eq(SpecificationAssetClass::ProgrammableNft)) .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::MplCoreAsset)) }, - TokenTypeClass::Fungible => asset::Column::SpecificationAssetClass - .eq(SpecificationAssetClass::FungibleAsset) + TokenTypeClass::Fungible => asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::FungibleAsset) .or(asset::Column::SpecificationAssetClass .eq(SpecificationAssetClass::FungibleToken)), - TokenTypeClass::All => asset::Column::SpecificationAssetClass.is_not_null(), + TokenTypeClass::All => asset::Column::SpecificationAssetClass.is_not_null(), } })) - .add_option( - self.owner_address - .to_owned() - .map(|x| asset::Column::Owner.eq(x)), - ) .add_option( self.delegate .to_owned() @@ -234,6 +229,24 @@ impl SearchAssetsQuery { joins.push(rel); } + if let Some(o) = self.owner_address.to_owned() { + if self.token_type == Some(TokenTypeClass::Fungible) { + conditions = conditions.add(token_accounts::Column::Owner.eq(o)); + let rel = extensions::token_accounts::Relation::Asset + .def() + .rev() + .on_condition(|left, right| { + Expr::tbl(right, token_accounts::Column::Mint) + .eq(Expr::tbl(left, asset::Column::Id)) + .into_condition() + }); + joins.push(rel); + } else { + conditions = conditions.add(asset::Column::Owner.eq(o)); + } + + } + if let Some(g) = self.grouping.to_owned() { let cond = Condition::all() .add(asset_grouping::Column::GroupKey.eq(g.0)) From db283ecf4235a4f4c7adaa13ea950451ae6b3a8e Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Mon, 23 Dec 2024 15:41:51 +0530 Subject: [PATCH 09/12] fixed search asset compatibility issues --- das_api/src/api/api_impl.rs | 5 ++- digital_asset_types/src/dao/mod.rs | 56 +++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/das_api/src/api/api_impl.rs b/das_api/src/api/api_impl.rs index aca90a6f7..8656e7776 100644 --- a/das_api/src/api/api_impl.rs +++ b/das_api/src/api/api_impl.rs @@ -404,8 +404,9 @@ impl ApiContract for DasApi { // Deserialize search assets query let spec: Option<(SpecificationVersions, SpecificationAssetClass)> = - interface.map(|x| x.into()); + interface.clone().map(|x| x.into()); let specification_version = spec.clone().map(|x| x.0); + let specification_asset_class = spec.map(|x| x.1); let condition_type = condition_type.map(|x| match x { SearchConditionType::Any => ConditionType::Any, SearchConditionType::All => ConditionType::All, @@ -431,7 +432,9 @@ impl ApiContract for DasApi { let saq = SearchAssetsQuery { negate, condition_type, + interface, specification_version, + specification_asset_class, token_type, owner_address, owner_type, diff --git a/digital_asset_types/src/dao/mod.rs b/digital_asset_types/src/dao/mod.rs index 821b585f1..40a276548 100644 --- a/digital_asset_types/src/dao/mod.rs +++ b/digital_asset_types/src/dao/mod.rs @@ -2,7 +2,7 @@ mod full_asset; mod generated; pub mod scopes; -use crate::rpc::filter::TokenTypeClass; +use crate::rpc::{filter::TokenTypeClass, Interface}; use self::sea_orm_active_enums::{ OwnerType, RoyaltyTargetType, SpecificationAssetClass, SpecificationVersions, @@ -54,7 +54,9 @@ pub struct SearchAssetsQuery { pub negate: Option, /// Defaults to [ConditionType::All] pub condition_type: Option, + pub interface: Option, pub specification_version: Option, + pub specification_asset_class: Option, pub token_type: Option, pub owner_address: Option>, pub owner_type: Option, @@ -77,6 +79,24 @@ pub struct SearchAssetsQuery { } impl SearchAssetsQuery { + + pub fn check_owner_address(&self) -> Result<(), DbErr> { + if self.owner_address.is_none() && self.token_type.is_some() { + return Err(DbErr::Custom( + "Must provide `owner_address` when using `token_type` field" + .to_string())); + } + Ok(()) + } + pub fn check_token_type(&self) -> Result<(), DbErr> { + if self.token_type.is_some() && self.interface.is_some() { + return Err(DbErr::Custom( + "`specification_asset_class` is not supported when using `token_type` field" + .to_string())); + } + Ok(()) + } + pub fn conditions(&self) -> Result<(Condition, Vec), DbErr> { let mut conditions = match self.condition_type { // None --> default to all when no option is provided @@ -90,30 +110,34 @@ impl SearchAssetsQuery { .clone() .map(|x| asset::Column::SpecificationVersion.eq(x)), ) - .add_option(self.token_type.clone().map(|x| { - match x { + .add_option({ + self.check_owner_address()?; + match &self.token_type { + Some(x) => Some(match x { TokenTypeClass::Compressed => asset::Column::TreeId.is_not_null(), - TokenTypeClass::Nft => { - asset::Column::TreeId.is_null() + TokenTypeClass::Nft => asset::Column::TreeId.is_null() .and( asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::MplCoreAsset)) + .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::ProgrammableNft)), + ), + TokenTypeClass::NonFungible => asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::ProgrammableNft)) - ) - }, - TokenTypeClass::NonFungible => { - asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) - .or(asset::Column::SpecificationAssetClass - .eq(SpecificationAssetClass::ProgrammableNft)) - .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::MplCoreAsset)) - }, + .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::MplCoreAsset)), TokenTypeClass::Fungible => asset::Column::SpecificationAssetClass .eq(SpecificationAssetClass::FungibleAsset) - .or(asset::Column::SpecificationAssetClass - .eq(SpecificationAssetClass::FungibleToken)), + .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::FungibleToken)), TokenTypeClass::All => asset::Column::SpecificationAssetClass.is_not_null(), + }), + None => None, } - })) + }) + .add_option({ + self.check_token_type()?; + self.specification_asset_class + .clone() + .map(|x| asset::Column::SpecificationAssetClass.eq(x)) + }) .add_option( self.delegate .to_owned() From 0015c2e2e3107184b9643e23b780b3da4886d4ea Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Mon, 23 Dec 2024 17:35:36 +0530 Subject: [PATCH 10/12] owner_type and token_typenot be used together feature added and test improved --- digital_asset_types/src/dao/mod.rs | 18 ++++++++++++++---- .../tests/integration_tests/token_type_test.rs | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/digital_asset_types/src/dao/mod.rs b/digital_asset_types/src/dao/mod.rs index 40a276548..0ba0504b4 100644 --- a/digital_asset_types/src/dao/mod.rs +++ b/digital_asset_types/src/dao/mod.rs @@ -80,7 +80,16 @@ pub struct SearchAssetsQuery { impl SearchAssetsQuery { - pub fn check_owner_address(&self) -> Result<(), DbErr> { + pub fn check_for_onwer_type_and_token_type(&self) -> Result<(), DbErr> { + if self.token_type.is_some() && self.owner_type.is_some() { + return Err(DbErr::Custom( + "`owner_type` is not supported when using `token_type` field" + .to_string())); + } + Ok(()) + } + + pub fn check_for_owner_address_and_token_type(&self) -> Result<(), DbErr> { if self.owner_address.is_none() && self.token_type.is_some() { return Err(DbErr::Custom( "Must provide `owner_address` when using `token_type` field" @@ -88,7 +97,7 @@ impl SearchAssetsQuery { } Ok(()) } - pub fn check_token_type(&self) -> Result<(), DbErr> { + pub fn check_for_token_type_and_interface(&self) -> Result<(), DbErr> { if self.token_type.is_some() && self.interface.is_some() { return Err(DbErr::Custom( "`specification_asset_class` is not supported when using `token_type` field" @@ -111,7 +120,8 @@ impl SearchAssetsQuery { .map(|x| asset::Column::SpecificationVersion.eq(x)), ) .add_option({ - self.check_owner_address()?; + self.check_for_owner_address_and_token_type()?; + self.check_for_onwer_type_and_token_type()?; match &self.token_type { Some(x) => Some(match x { TokenTypeClass::Compressed => asset::Column::TreeId.is_not_null(), @@ -133,7 +143,7 @@ impl SearchAssetsQuery { } }) .add_option({ - self.check_token_type()?; + self.check_for_token_type_and_interface()?; self.specification_asset_class .clone() .map(|x| asset::Column::SpecificationAssetClass.eq(x)) diff --git a/integration_tests/tests/integration_tests/token_type_test.rs b/integration_tests/tests/integration_tests/token_type_test.rs index 032861f84..201462453 100644 --- a/integration_tests/tests/integration_tests/token_type_test.rs +++ b/integration_tests/tests/integration_tests/token_type_test.rs @@ -174,6 +174,7 @@ async fn test_search_asset_with_token_type_fungible() { let request = r#" { + "ownerAddress": "2oerfxddTpK5hWAmCMYB6fr9WvNrjEH54CHCWK8sAq7g", "page": 1, "limit": 1, "tokenType": "Fungible" From 1c1f61975d5403835149d197b181f22584e6725b Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Mon, 23 Dec 2024 22:55:24 +0530 Subject: [PATCH 11/12] fungible assets not showing when token_type is set to all bug fixed --- digital_asset_types/src/dao/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/digital_asset_types/src/dao/mod.rs b/digital_asset_types/src/dao/mod.rs index 0ba0504b4..6a67c5701 100644 --- a/digital_asset_types/src/dao/mod.rs +++ b/digital_asset_types/src/dao/mod.rs @@ -264,7 +264,7 @@ impl SearchAssetsQuery { } if let Some(o) = self.owner_address.to_owned() { - if self.token_type == Some(TokenTypeClass::Fungible) { + if self.token_type == Some(TokenTypeClass::Fungible) || self.token_type == Some(TokenTypeClass::All) { conditions = conditions.add(token_accounts::Column::Owner.eq(o)); let rel = extensions::token_accounts::Relation::Asset .def() From e1ad545db7fdf46517f21bbc5ef092ac963b7b65 Mon Sep 17 00:00:00 2001 From: AhzamAkhtar Date: Wed, 25 Dec 2024 00:15:52 +0530 Subject: [PATCH 12/12] cleanup --- das_api/src/api/mod.rs | 2 +- .../src/dao/extensions/asset.rs | 4 +- digital_asset_types/src/dao/extensions/mod.rs | 2 +- .../src/dao/extensions/token_accounts.rs | 14 +-- digital_asset_types/src/dao/mod.rs | 109 +++++++++--------- digital_asset_types/src/rpc/filter.rs | 6 +- .../integration_tests/token_type_test.rs | 2 - 7 files changed, 70 insertions(+), 69 deletions(-) diff --git a/das_api/src/api/mod.rs b/das_api/src/api/mod.rs index 9e0d02dd7..cbfc18e9a 100644 --- a/das_api/src/api/mod.rs +++ b/das_api/src/api/mod.rs @@ -94,7 +94,7 @@ pub struct SearchAssets { pub negate: Option, pub condition_type: Option, pub interface: Option, - pub token_type : Option, + pub token_type: Option, pub owner_address: Option, pub owner_type: Option, pub creator_address: Option, diff --git a/digital_asset_types/src/dao/extensions/asset.rs b/digital_asset_types/src/dao/extensions/asset.rs index eeb31fed8..1d8e7f1d3 100644 --- a/digital_asset_types/src/dao/extensions/asset.rs +++ b/digital_asset_types/src/dao/extensions/asset.rs @@ -2,11 +2,11 @@ use sea_orm::{EntityTrait, EnumIter, Related, RelationDef, RelationTrait}; use crate::dao::{ asset, asset_authority, asset_creators, asset_data, asset_grouping, - asset_v1_account_attachments,token_accounts, + asset_v1_account_attachments, sea_orm_active_enums::{OwnerType, RoyaltyTargetType}, + token_accounts, }; - #[derive(Copy, Clone, Debug, EnumIter)] pub enum Relation { AssetData, diff --git a/digital_asset_types/src/dao/extensions/mod.rs b/digital_asset_types/src/dao/extensions/mod.rs index cdc57c34c..af3baad66 100644 --- a/digital_asset_types/src/dao/extensions/mod.rs +++ b/digital_asset_types/src/dao/extensions/mod.rs @@ -5,4 +5,4 @@ pub mod asset_data; pub mod asset_grouping; pub mod asset_v1_account_attachment; pub mod instruction; -pub mod token_accounts; \ No newline at end of file +pub mod token_accounts; diff --git a/digital_asset_types/src/dao/extensions/token_accounts.rs b/digital_asset_types/src/dao/extensions/token_accounts.rs index 2027d4556..a8c8f60eb 100644 --- a/digital_asset_types/src/dao/extensions/token_accounts.rs +++ b/digital_asset_types/src/dao/extensions/token_accounts.rs @@ -9,12 +9,12 @@ pub enum Relation { } impl RelationTrait for Relation { -fn def(&self) -> RelationDef { - match self { - Self::Asset => token_accounts::Entity::belongs_to(asset::Entity) - .from(token_accounts::Column::Mint) - .to(asset::Column::Id) - .into(), + fn def(&self) -> RelationDef { + match self { + Self::Asset => token_accounts::Entity::belongs_to(asset::Entity) + .from(token_accounts::Column::Mint) + .to(asset::Column::Id) + .into(), } } } @@ -23,4 +23,4 @@ impl Related for token_accounts::Entity { fn to() -> RelationDef { Relation::Asset.def() } -} \ No newline at end of file +} diff --git a/digital_asset_types/src/dao/mod.rs b/digital_asset_types/src/dao/mod.rs index 6a67c5701..8e6dc4ecb 100644 --- a/digital_asset_types/src/dao/mod.rs +++ b/digital_asset_types/src/dao/mod.rs @@ -79,12 +79,11 @@ pub struct SearchAssetsQuery { } impl SearchAssetsQuery { - pub fn check_for_onwer_type_and_token_type(&self) -> Result<(), DbErr> { if self.token_type.is_some() && self.owner_type.is_some() { return Err(DbErr::Custom( - "`owner_type` is not supported when using `token_type` field" - .to_string())); + "`owner_type` is not supported when using `token_type` field".to_string(), + )); } Ok(()) } @@ -92,8 +91,8 @@ impl SearchAssetsQuery { pub fn check_for_owner_address_and_token_type(&self) -> Result<(), DbErr> { if self.owner_address.is_none() && self.token_type.is_some() { return Err(DbErr::Custom( - "Must provide `owner_address` when using `token_type` field" - .to_string())); + "Must provide `owner_address` when using `token_type` field".to_string(), + )); } Ok(()) } @@ -101,7 +100,8 @@ impl SearchAssetsQuery { if self.token_type.is_some() && self.interface.is_some() { return Err(DbErr::Custom( "`specification_asset_class` is not supported when using `token_type` field" - .to_string())); + .to_string(), + )); } Ok(()) } @@ -122,31 +122,34 @@ impl SearchAssetsQuery { .add_option({ self.check_for_owner_address_and_token_type()?; self.check_for_onwer_type_and_token_type()?; - match &self.token_type { - Some(x) => Some(match x { - TokenTypeClass::Compressed => asset::Column::TreeId.is_not_null(), - TokenTypeClass::Nft => asset::Column::TreeId.is_null() - .and( - asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) - .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::MplCoreAsset)) - .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::ProgrammableNft)), - ), - TokenTypeClass::NonFungible => asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::Nft) - .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::ProgrammableNft)) - .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::MplCoreAsset)), - TokenTypeClass::Fungible => asset::Column::SpecificationAssetClass - .eq(SpecificationAssetClass::FungibleAsset) - .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::FungibleToken)), - TokenTypeClass::All => asset::Column::SpecificationAssetClass.is_not_null(), - }), - None => None, - } + self.token_type.as_ref().map(|x| match x { + TokenTypeClass::Compressed => asset::Column::TreeId.is_not_null(), + TokenTypeClass::Nft => asset::Column::TreeId.is_null().and( + asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::Nft) + .or(asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::MplCoreAsset)) + .or(asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::ProgrammableNft)), + ), + TokenTypeClass::NonFungible => asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::Nft) + .or(asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::ProgrammableNft)) + .or(asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::MplCoreAsset)), + TokenTypeClass::Fungible => asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::FungibleAsset) + .or(asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::FungibleToken)), + TokenTypeClass::All => asset::Column::SpecificationAssetClass.is_not_null(), + }) }) .add_option({ self.check_for_token_type_and_interface()?; self.specification_asset_class - .clone() - .map(|x| asset::Column::SpecificationAssetClass.eq(x)) + .clone() + .map(|x| asset::Column::SpecificationAssetClass.eq(x)) }) .add_option( self.delegate @@ -198,17 +201,17 @@ impl SearchAssetsQuery { match self.token_type { Some(TokenTypeClass::Fungible) => { conditions = conditions.add_option(Some( - asset::Column::OwnerType - .eq(OwnerType::Token) - .and((asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::FungibleToken)) - .or(asset::Column::SpecificationAssetClass.eq(SpecificationAssetClass::FungibleAsset)) - ), - )); + asset::Column::OwnerType.eq(OwnerType::Token).and( + (asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::FungibleToken)) + .or(asset::Column::SpecificationAssetClass + .eq(SpecificationAssetClass::FungibleAsset)), + ), + )); } Some(TokenTypeClass::All) => { - conditions = conditions.add_option(Some( - asset::Column::SpecificationAssetClass.is_not_null(), - )); + conditions = conditions + .add_option(Some(asset::Column::SpecificationAssetClass.is_not_null())); } _ => { // Default to NFTs @@ -217,14 +220,13 @@ impl SearchAssetsQuery { // however there is an old bug that has marked some non-NFTs as "single" with supply > 1. // The supply check guarentees we do not include those. conditions = conditions.add_option(Some( - asset::Column::OwnerType - .eq(OwnerType::Single) - .and(asset::Column::Supply.lte(1)), - )); + asset::Column::OwnerType + .eq(OwnerType::Single) + .and(asset::Column::Supply.lte(1)), + )); } } - - } + } if let Some(c) = self.creator_address.to_owned() { conditions = conditions.add(asset_creators::Column::Creator.eq(c)); @@ -264,21 +266,22 @@ impl SearchAssetsQuery { } if let Some(o) = self.owner_address.to_owned() { - if self.token_type == Some(TokenTypeClass::Fungible) || self.token_type == Some(TokenTypeClass::All) { + if self.token_type == Some(TokenTypeClass::Fungible) + || self.token_type == Some(TokenTypeClass::All) + { conditions = conditions.add(token_accounts::Column::Owner.eq(o)); - let rel = extensions::token_accounts::Relation::Asset - .def() - .rev() - .on_condition(|left, right| { - Expr::tbl(right, token_accounts::Column::Mint) - .eq(Expr::tbl(left, asset::Column::Id)) - .into_condition() - }); - joins.push(rel); + let rel = extensions::token_accounts::Relation::Asset + .def() + .rev() + .on_condition(|left, right| { + Expr::tbl(right, token_accounts::Column::Mint) + .eq(Expr::tbl(left, asset::Column::Id)) + .into_condition() + }); + joins.push(rel); } else { conditions = conditions.add(asset::Column::Owner.eq(o)); } - } if let Some(g) = self.grouping.to_owned() { diff --git a/digital_asset_types/src/rpc/filter.rs b/digital_asset_types/src/rpc/filter.rs index 1c5854563..e90b4a158 100644 --- a/digital_asset_types/src/rpc/filter.rs +++ b/digital_asset_types/src/rpc/filter.rs @@ -1,6 +1,6 @@ use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] @@ -32,13 +32,13 @@ pub enum AssetSortBy { None, } -#[derive(Debug, Clone, PartialEq, Eq ,EnumIter, Serialize, Deserialize,JsonSchema)] +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, Serialize, Deserialize, JsonSchema)] pub enum TokenTypeClass { Fungible, NonFungible, Compressed, Nft, - All + All, } #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] diff --git a/integration_tests/tests/integration_tests/token_type_test.rs b/integration_tests/tests/integration_tests/token_type_test.rs index 201462453..260d92567 100644 --- a/integration_tests/tests/integration_tests/token_type_test.rs +++ b/integration_tests/tests/integration_tests/token_type_test.rs @@ -43,7 +43,6 @@ async fn test_search_asset_with_token_type_regular_nft() { insta::assert_json_snapshot!(name, response); } - #[tokio::test] #[serial] #[named] @@ -149,7 +148,6 @@ async fn test_search_asset_with_token_type_all() { insta::assert_json_snapshot!(name, response); } - #[tokio::test] #[serial] #[named]