difftreelog
feat add collection_property and token_property
in: master
4 files changed
pallets/common/src/lib.rsdiffbeforeafterboth59 Properties,59 Properties,60 PropertiesPermissionMap,60 PropertiesPermissionMap,61 PropertyKey,61 PropertyKey,62 PropertyValue,62 PropertyPermission,63 PropertyPermission,63 PropertiesError,64 PropertiesError,64 PropertyKeyPermission,65 PropertyKeyPermission,902 Ok(())903 Ok(())903 }904 }905906 pub fn get_collection_property(collection_id: CollectionId, key: &PropertyKey) -> Option<PropertyValue> {907 Self::collection_properties(collection_id)908 .get(key)909 .cloned()910 }904911905 pub fn bytes_keys_to_property_keys(912 pub fn bytes_keys_to_property_keys(906 keys: Vec<Vec<u8>>,913 keys: Vec<Vec<u8>>,124012471241 fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId>;1248 fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId>;1242 fn const_metadata(&self, token: TokenId) -> Vec<u8>;1249 fn const_metadata(&self, token: TokenId) -> Vec<u8>;1250 fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue>;1243 fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property>;1251 fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property>;1244 /// Amount of unique collection tokens1252 /// Amount of unique collection tokens1245 fn total_supply(&self) -> u32;1253 fn total_supply(&self) -> u32;pallets/fungible/src/common.rsdiffbeforeafterboth21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};22use sp_runtime::ArithmeticError;22use sp_runtime::ArithmeticError;23use sp_std::{vec::Vec, vec};23use sp_std::{vec::Vec, vec};24use up_data_structs::{Property, PropertyKey, PropertyKeyPermission};24use up_data_structs::{Property, PropertyKey, PropertyValue, PropertyKeyPermission};252526use crate::{26use crate::{27 Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,27 Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,319 Vec::new()319 Vec::new()320 }320 }321322 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {323 None324 }321325322 fn token_properties(326 fn token_properties(323 &self,327 &self,pallets/nonfungible/src/common.rsdiffbeforeafterboth19use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};19use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};20use up_data_structs::{20use up_data_structs::{21 TokenId, CreateItemExData, CollectionId, budget::Budget, Property, PropertyKey,21 TokenId, CreateItemExData, CollectionId, budget::Budget, Property, PropertyKey,22 PropertyKeyPermission,22 PropertyKeyPermission, PropertyValue,23};23};24use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};24use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};25use sp_runtime::DispatchError;25use sp_runtime::DispatchError;362 .into_inner()362 .into_inner()363 }363 }364365 fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue> {366 <Pallet<T>>::token_properties((self.id, token_id))367 .get(key)368 .cloned()369 }364370365 fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property> {371 fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property> {366 let properties = <Pallet<T>>::token_properties((self.id, token_id));372 let properties = <Pallet<T>>::token_properties((self.id, token_id));pallets/refungible/src/common.rsdiffbeforeafterboth20use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight};20use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight};21use up_data_structs::{21use up_data_structs::{22 CollectionId, TokenId, CreateItemExData, CreateRefungibleExData, budget::Budget, Property,22 CollectionId, TokenId, CreateItemExData, CreateRefungibleExData, budget::Budget, Property,23 PropertyKey, PropertyKeyPermission,23 PropertyKey, PropertyValue, PropertyKeyPermission,24};24};25use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};25use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};26use sp_runtime::DispatchError;26use sp_runtime::DispatchError;340 .into_inner()340 .into_inner()341 }341 }342343 fn token_property(&self, _token_id: TokenId, _key: &PropertyKey) -> Option<PropertyValue> {344 None345 }342346343 fn token_properties(347 fn token_properties(344 &self,348 &self,