git.delta.rocks / unique-network / refs/commits / 7db537d352ab

difftreelog

fix property keys are optional in RPC

Daniel Shiposha2022-05-19parent: #0391082.patch.diff
in: master

7 files changed

modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -76,7 +76,7 @@
 	fn collection_properties(
 		&self,
 		collection: CollectionId,
-		keys: Vec<String>,
+		keys: Option<Vec<String>>,
 		at: Option<BlockHash>,
 	) -> Result<Vec<Property>>;
 
@@ -85,7 +85,7 @@
 		&self,
 		collection: CollectionId,
 		token_id: TokenId,
-		properties: Vec<String>,
+		keys: Option<Vec<String>>,
 		at: Option<BlockHash>,
 	) -> Result<Vec<Property>>;
 
@@ -93,7 +93,7 @@
 	fn property_permissions(
 		&self,
 		collection: CollectionId,
-		keys: Vec<String>,
+		keys: Option<Vec<String>>,
 		at: Option<BlockHash>,
 	) -> Result<Vec<PropertyKeyPermission>>;
 
@@ -102,7 +102,7 @@
 		&self,
 		collection: CollectionId,
 		token_id: TokenId,
-		keys: Vec<String>,
+		keys: Option<Vec<String>>,
 		at: Option<BlockHash>,
 	) -> Result<TokenData<CrossAccountId>>;
 
@@ -277,7 +277,7 @@
 		collection: CollectionId,
 
 		#[map(|keys| string_keys_to_bytes_keys(keys))]
-		keys: Vec<String>
+		keys: Option<Vec<String>>
 	) -> Vec<Property>);
 
 	pass_method!(token_properties(
@@ -285,14 +285,14 @@
 		token_id: TokenId,
 
 		#[map(|keys| string_keys_to_bytes_keys(keys))]
-		properties: Vec<String>
+		keys: Option<Vec<String>>
 	) -> Vec<Property>);
 
 	pass_method!(property_permissions(
 		collection: CollectionId,
 
 		#[map(|keys| string_keys_to_bytes_keys(keys))]
-		keys: Vec<String>
+		keys: Option<Vec<String>>
 	) -> Vec<PropertyKeyPermission>);
 
 	pass_method!(token_data(
@@ -300,7 +300,7 @@
 		token_id: TokenId,
 
 		#[map(|keys| string_keys_to_bytes_keys(keys))]
-		keys: Vec<String>,
+		keys: Option<Vec<String>>,
 	) -> TokenData<CrossAccountId>);
 
 	pass_method!(total_supply(collection: CollectionId) -> u32);
@@ -318,6 +318,8 @@
 	pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>);
 }
 
-fn string_keys_to_bytes_keys(keys: Vec<String>) -> Vec<Vec<u8>> {
-	keys.into_iter().map(|key| key.into_bytes()).collect()
+fn string_keys_to_bytes_keys(keys: Option<Vec<String>>) -> Option<Vec<Vec<u8>>> {
+	keys.map(|keys| {
+		keys.into_iter().map(|key| key.into_bytes()).collect()
+	})
 }
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -845,31 +845,39 @@
 
 	pub fn filter_collection_properties(
 		collection_id: CollectionId,
-		keys: Vec<PropertyKey>,
+		keys: Option<Vec<PropertyKey>>,
 	) -> Result<Vec<Property>, DispatchError> {
 		let properties = Self::collection_properties(collection_id);
 
-		let properties = keys
-			.into_iter()
+		let properties = keys.map(|keys| {
+			keys.into_iter()
 			.filter_map(|key| {
 				properties.get(&key).map(|value| Property {
 					key,
 					value: value.clone(),
 				})
 			})
-			.collect();
+			.collect()
+		}).unwrap_or(
+			properties.iter()
+				.map(|(key, value)| Property {
+					key: key.clone(),
+					value: value.clone(),
+				})
+				.collect()
+		);
 
 		Ok(properties)
 	}
 
 	pub fn filter_property_permissions(
 		collection_id: CollectionId,
-		keys: Vec<PropertyKey>,
+		keys: Option<Vec<PropertyKey>>,
 	) -> Result<Vec<PropertyKeyPermission>, DispatchError> {
 		let permissions = Self::property_permissions(collection_id);
 
-		let key_permissions = keys
-			.into_iter()
+		let key_permissions = keys.map(|keys| {
+			keys.into_iter()
 			.filter_map(|key| {
 				permissions
 					.get(&key)
@@ -878,7 +886,15 @@
 						permission: permission.clone(),
 					})
 			})
-			.collect();
+			.collect()
+		}).unwrap_or(
+			permissions.iter()
+				.map(|(key, permission)| PropertyKeyPermission {
+					key: key.clone(),
+					permission: permission.clone(),
+				})
+				.collect()
+		);
 
 		Ok(key_permissions)
 	}
@@ -1148,7 +1164,7 @@
 
 	fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId>;
 	fn const_metadata(&self, token: TokenId) -> Vec<u8>;
-	fn token_properties(&self, token_id: TokenId, keys: Vec<PropertyKey>) -> Vec<Property>;
+	fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property>;
 	/// Amount of unique collection tokens
 	fn total_supply(&self) -> u32;
 	/// Amount of different tokens account has (Applicable to nonfungible/refungible)
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
before · pallets/fungible/src/common.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};20use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget};21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};22use sp_runtime::ArithmeticError;23use sp_std::{vec::Vec, vec};24use up_data_structs::{Property, PropertyKey, PropertyKeyPermission};2526use crate::{27	Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,28};2930pub struct CommonWeights<T: Config>(PhantomData<T>);31impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {32	fn create_item() -> Weight {33		<SelfWeightOf<T>>::create_item()34	}3536	fn create_multiple_items(_amount: u32) -> Weight {37		Self::create_item()38	}3940	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {41		match data {42			CreateItemExData::Fungible(f) => {43				<SelfWeightOf<T>>::create_multiple_items_ex(f.len() as u32)44			}45			_ => 0,46		}47	}4849	fn burn_item() -> Weight {50		<SelfWeightOf<T>>::burn_item()51	}5253	fn set_collection_properties(amount: u32) -> Weight {54		<SelfWeightOf<T>>::set_collection_properties(amount)55	}5657	fn delete_collection_properties(amount: u32) -> Weight {58		<SelfWeightOf<T>>::delete_collection_properties(amount)59	}6061	fn set_token_properties(amount: u32) -> Weight {62		<SelfWeightOf<T>>::set_token_properties(amount)63	}6465	fn delete_token_properties(amount: u32) -> Weight {66		<SelfWeightOf<T>>::delete_token_properties(amount)67	}6869	fn set_property_permissions(amount: u32) -> Weight {70		<SelfWeightOf<T>>::set_property_permissions(amount)71	}7273	fn transfer() -> Weight {74		<SelfWeightOf<T>>::transfer()75	}7677	fn approve() -> Weight {78		<SelfWeightOf<T>>::approve()79	}8081	fn transfer_from() -> Weight {82		<SelfWeightOf<T>>::transfer_from()83	}8485	fn burn_from() -> Weight {86		<SelfWeightOf<T>>::burn_from()87	}88}8990impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {91	fn create_item(92		&self,93		sender: T::CrossAccountId,94		to: T::CrossAccountId,95		data: up_data_structs::CreateItemData,96		nesting_budget: &dyn Budget,97	) -> DispatchResultWithPostInfo {98		match data {99			up_data_structs::CreateItemData::Fungible(data) => with_weight(100				<Pallet<T>>::create_item(self, &sender, (to, data.value), nesting_budget),101				<CommonWeights<T>>::create_item(),102			),103			_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),104		}105	}106107	fn create_multiple_items(108		&self,109		sender: T::CrossAccountId,110		to: T::CrossAccountId,111		data: Vec<up_data_structs::CreateItemData>,112		nesting_budget: &dyn Budget,113	) -> DispatchResultWithPostInfo {114		let mut sum: u128 = 0;115		for data in data {116			match data {117				up_data_structs::CreateItemData::Fungible(data) => {118					sum = sum119						.checked_add(data.value)120						.ok_or(ArithmeticError::Overflow)?;121				}122				_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),123			}124		}125126		with_weight(127			<Pallet<T>>::create_item(self, &sender, (to, sum), nesting_budget),128			<CommonWeights<T>>::create_item(),129		)130	}131132	fn create_multiple_items_ex(133		&self,134		sender: <T>::CrossAccountId,135		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,136		nesting_budget: &dyn Budget,137	) -> DispatchResultWithPostInfo {138		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);139		let data = match data {140			up_data_structs::CreateItemExData::Fungible(f) => f,141			_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),142		};143144		with_weight(145			<Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),146			weight,147		)148	}149150	fn burn_item(151		&self,152		sender: T::CrossAccountId,153		token: TokenId,154		amount: u128,155	) -> DispatchResultWithPostInfo {156		ensure!(157			token == TokenId::default(),158			<Error<T>>::FungibleItemsHaveNoId159		);160161		with_weight(162			<Pallet<T>>::burn(self, &sender, amount),163			<CommonWeights<T>>::burn_item(),164		)165	}166167	fn transfer(168		&self,169		from: T::CrossAccountId,170		to: T::CrossAccountId,171		token: TokenId,172		amount: u128,173		nesting_budget: &dyn Budget,174	) -> DispatchResultWithPostInfo {175		ensure!(176			token == TokenId::default(),177			<Error<T>>::FungibleItemsHaveNoId178		);179180		with_weight(181			<Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget),182			<CommonWeights<T>>::transfer(),183		)184	}185186	fn approve(187		&self,188		sender: T::CrossAccountId,189		spender: T::CrossAccountId,190		token: TokenId,191		amount: u128,192	) -> DispatchResultWithPostInfo {193		ensure!(194			token == TokenId::default(),195			<Error<T>>::FungibleItemsHaveNoId196		);197198		with_weight(199			<Pallet<T>>::set_allowance(self, &sender, &spender, amount),200			<CommonWeights<T>>::approve(),201		)202	}203204	fn transfer_from(205		&self,206		sender: T::CrossAccountId,207		from: T::CrossAccountId,208		to: T::CrossAccountId,209		token: TokenId,210		amount: u128,211		nesting_budget: &dyn Budget,212	) -> DispatchResultWithPostInfo {213		ensure!(214			token == TokenId::default(),215			<Error<T>>::FungibleItemsHaveNoId216		);217218		with_weight(219			<Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget),220			<CommonWeights<T>>::transfer_from(),221		)222	}223224	fn burn_from(225		&self,226		sender: T::CrossAccountId,227		from: T::CrossAccountId,228		token: TokenId,229		amount: u128,230		nesting_budget: &dyn Budget,231	) -> DispatchResultWithPostInfo {232		ensure!(233			token == TokenId::default(),234			<Error<T>>::FungibleItemsHaveNoId235		);236237		with_weight(238			<Pallet<T>>::burn_from(self, &sender, &from, amount, nesting_budget),239			<CommonWeights<T>>::burn_from(),240		)241	}242243	fn set_collection_properties(244		&self,245		_sender: T::CrossAccountId,246		_property: Vec<Property>,247	) -> DispatchResultWithPostInfo {248		fail!(<Error<T>>::SettingPropertiesNotAllowed)249	}250251	fn delete_collection_properties(252		&self,253		_sender: &T::CrossAccountId,254		_property_keys: Vec<PropertyKey>,255	) -> DispatchResultWithPostInfo {256		fail!(<Error<T>>::SettingPropertiesNotAllowed)257	}258259	fn set_token_properties(260		&self,261		_sender: T::CrossAccountId,262		_token_id: TokenId,263		_property: Vec<Property>,264	) -> DispatchResultWithPostInfo {265		fail!(<Error<T>>::SettingPropertiesNotAllowed)266	}267268	fn set_property_permissions(269		&self,270		_sender: &T::CrossAccountId,271		_property_permissions: Vec<PropertyKeyPermission>,272	) -> DispatchResultWithPostInfo {273		fail!(<Error<T>>::SettingPropertiesNotAllowed)274	}275276	fn delete_token_properties(277		&self,278		_sender: T::CrossAccountId,279		_token_id: TokenId,280		_property_keys: Vec<PropertyKey>,281	) -> DispatchResultWithPostInfo {282		fail!(<Error<T>>::SettingPropertiesNotAllowed)283	}284285	fn check_nesting(286		&self,287		_sender: <T>::CrossAccountId,288		_from: (CollectionId, TokenId),289		_under: TokenId,290		_budget: &dyn Budget,291	) -> sp_runtime::DispatchResult {292		fail!(<Error<T>>::FungibleDisallowsNesting)293	}294295	fn collection_tokens(&self) -> Vec<TokenId> {296		vec![TokenId::default()]297	}298299	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {300		if <Balance<T>>::get((self.id, account)) != 0 {301			vec![TokenId::default()]302		} else {303			vec![]304		}305	}306307	fn token_exists(&self, token: TokenId) -> bool {308		token == TokenId::default()309	}310311	fn last_token_id(&self) -> TokenId {312		TokenId::default()313	}314315	fn token_owner(&self, _token: TokenId) -> Option<T::CrossAccountId> {316		None317	}318	fn const_metadata(&self, _token: TokenId) -> Vec<u8> {319		Vec::new()320	}321322	fn token_properties(&self, _token_id: TokenId, _keys: Vec<PropertyKey>) -> Vec<Property> {323		Vec::new()324	}325326	fn total_supply(&self) -> u32 {327		1328	}329330	fn account_balance(&self, account: T::CrossAccountId) -> u32 {331		if <Balance<T>>::get((self.id, account)) != 0 {332			1333		} else {334			0335		}336	}337338	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {339		if token != TokenId::default() {340			return 0;341		}342		<Balance<T>>::get((self.id, account))343	}344345	fn allowance(346		&self,347		sender: T::CrossAccountId,348		spender: T::CrossAccountId,349		token: TokenId,350	) -> u128 {351		if token != TokenId::default() {352			return 0;353		}354		<Allowance<T>>::get((self.id, sender, spender))355	}356}
after · pallets/fungible/src/common.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};20use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget};21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};22use sp_runtime::ArithmeticError;23use sp_std::{vec::Vec, vec};24use up_data_structs::{Property, PropertyKey, PropertyKeyPermission};2526use crate::{27	Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf, weights::WeightInfo,28};2930pub struct CommonWeights<T: Config>(PhantomData<T>);31impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {32	fn create_item() -> Weight {33		<SelfWeightOf<T>>::create_item()34	}3536	fn create_multiple_items(_amount: u32) -> Weight {37		Self::create_item()38	}3940	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {41		match data {42			CreateItemExData::Fungible(f) => {43				<SelfWeightOf<T>>::create_multiple_items_ex(f.len() as u32)44			}45			_ => 0,46		}47	}4849	fn burn_item() -> Weight {50		<SelfWeightOf<T>>::burn_item()51	}5253	fn set_collection_properties(amount: u32) -> Weight {54		<SelfWeightOf<T>>::set_collection_properties(amount)55	}5657	fn delete_collection_properties(amount: u32) -> Weight {58		<SelfWeightOf<T>>::delete_collection_properties(amount)59	}6061	fn set_token_properties(amount: u32) -> Weight {62		<SelfWeightOf<T>>::set_token_properties(amount)63	}6465	fn delete_token_properties(amount: u32) -> Weight {66		<SelfWeightOf<T>>::delete_token_properties(amount)67	}6869	fn set_property_permissions(amount: u32) -> Weight {70		<SelfWeightOf<T>>::set_property_permissions(amount)71	}7273	fn transfer() -> Weight {74		<SelfWeightOf<T>>::transfer()75	}7677	fn approve() -> Weight {78		<SelfWeightOf<T>>::approve()79	}8081	fn transfer_from() -> Weight {82		<SelfWeightOf<T>>::transfer_from()83	}8485	fn burn_from() -> Weight {86		<SelfWeightOf<T>>::burn_from()87	}88}8990impl<T: Config> CommonCollectionOperations<T> for FungibleHandle<T> {91	fn create_item(92		&self,93		sender: T::CrossAccountId,94		to: T::CrossAccountId,95		data: up_data_structs::CreateItemData,96		nesting_budget: &dyn Budget,97	) -> DispatchResultWithPostInfo {98		match data {99			up_data_structs::CreateItemData::Fungible(data) => with_weight(100				<Pallet<T>>::create_item(self, &sender, (to, data.value), nesting_budget),101				<CommonWeights<T>>::create_item(),102			),103			_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),104		}105	}106107	fn create_multiple_items(108		&self,109		sender: T::CrossAccountId,110		to: T::CrossAccountId,111		data: Vec<up_data_structs::CreateItemData>,112		nesting_budget: &dyn Budget,113	) -> DispatchResultWithPostInfo {114		let mut sum: u128 = 0;115		for data in data {116			match data {117				up_data_structs::CreateItemData::Fungible(data) => {118					sum = sum119						.checked_add(data.value)120						.ok_or(ArithmeticError::Overflow)?;121				}122				_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),123			}124		}125126		with_weight(127			<Pallet<T>>::create_item(self, &sender, (to, sum), nesting_budget),128			<CommonWeights<T>>::create_item(),129		)130	}131132	fn create_multiple_items_ex(133		&self,134		sender: <T>::CrossAccountId,135		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,136		nesting_budget: &dyn Budget,137	) -> DispatchResultWithPostInfo {138		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);139		let data = match data {140			up_data_structs::CreateItemExData::Fungible(f) => f,141			_ => fail!(<Error<T>>::NotFungibleDataUsedToMintFungibleCollectionToken),142		};143144		with_weight(145			<Pallet<T>>::create_multiple_items(self, &sender, data.into_inner(), nesting_budget),146			weight,147		)148	}149150	fn burn_item(151		&self,152		sender: T::CrossAccountId,153		token: TokenId,154		amount: u128,155	) -> DispatchResultWithPostInfo {156		ensure!(157			token == TokenId::default(),158			<Error<T>>::FungibleItemsHaveNoId159		);160161		with_weight(162			<Pallet<T>>::burn(self, &sender, amount),163			<CommonWeights<T>>::burn_item(),164		)165	}166167	fn transfer(168		&self,169		from: T::CrossAccountId,170		to: T::CrossAccountId,171		token: TokenId,172		amount: u128,173		nesting_budget: &dyn Budget,174	) -> DispatchResultWithPostInfo {175		ensure!(176			token == TokenId::default(),177			<Error<T>>::FungibleItemsHaveNoId178		);179180		with_weight(181			<Pallet<T>>::transfer(self, &from, &to, amount, nesting_budget),182			<CommonWeights<T>>::transfer(),183		)184	}185186	fn approve(187		&self,188		sender: T::CrossAccountId,189		spender: T::CrossAccountId,190		token: TokenId,191		amount: u128,192	) -> DispatchResultWithPostInfo {193		ensure!(194			token == TokenId::default(),195			<Error<T>>::FungibleItemsHaveNoId196		);197198		with_weight(199			<Pallet<T>>::set_allowance(self, &sender, &spender, amount),200			<CommonWeights<T>>::approve(),201		)202	}203204	fn transfer_from(205		&self,206		sender: T::CrossAccountId,207		from: T::CrossAccountId,208		to: T::CrossAccountId,209		token: TokenId,210		amount: u128,211		nesting_budget: &dyn Budget,212	) -> DispatchResultWithPostInfo {213		ensure!(214			token == TokenId::default(),215			<Error<T>>::FungibleItemsHaveNoId216		);217218		with_weight(219			<Pallet<T>>::transfer_from(self, &sender, &from, &to, amount, nesting_budget),220			<CommonWeights<T>>::transfer_from(),221		)222	}223224	fn burn_from(225		&self,226		sender: T::CrossAccountId,227		from: T::CrossAccountId,228		token: TokenId,229		amount: u128,230		nesting_budget: &dyn Budget,231	) -> DispatchResultWithPostInfo {232		ensure!(233			token == TokenId::default(),234			<Error<T>>::FungibleItemsHaveNoId235		);236237		with_weight(238			<Pallet<T>>::burn_from(self, &sender, &from, amount, nesting_budget),239			<CommonWeights<T>>::burn_from(),240		)241	}242243	fn set_collection_properties(244		&self,245		_sender: T::CrossAccountId,246		_property: Vec<Property>,247	) -> DispatchResultWithPostInfo {248		fail!(<Error<T>>::SettingPropertiesNotAllowed)249	}250251	fn delete_collection_properties(252		&self,253		_sender: &T::CrossAccountId,254		_property_keys: Vec<PropertyKey>,255	) -> DispatchResultWithPostInfo {256		fail!(<Error<T>>::SettingPropertiesNotAllowed)257	}258259	fn set_token_properties(260		&self,261		_sender: T::CrossAccountId,262		_token_id: TokenId,263		_property: Vec<Property>,264	) -> DispatchResultWithPostInfo {265		fail!(<Error<T>>::SettingPropertiesNotAllowed)266	}267268	fn set_property_permissions(269		&self,270		_sender: &T::CrossAccountId,271		_property_permissions: Vec<PropertyKeyPermission>,272	) -> DispatchResultWithPostInfo {273		fail!(<Error<T>>::SettingPropertiesNotAllowed)274	}275276	fn delete_token_properties(277		&self,278		_sender: T::CrossAccountId,279		_token_id: TokenId,280		_property_keys: Vec<PropertyKey>,281	) -> DispatchResultWithPostInfo {282		fail!(<Error<T>>::SettingPropertiesNotAllowed)283	}284285	fn check_nesting(286		&self,287		_sender: <T>::CrossAccountId,288		_from: (CollectionId, TokenId),289		_under: TokenId,290		_budget: &dyn Budget,291	) -> sp_runtime::DispatchResult {292		fail!(<Error<T>>::FungibleDisallowsNesting)293	}294295	fn collection_tokens(&self) -> Vec<TokenId> {296		vec![TokenId::default()]297	}298299	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {300		if <Balance<T>>::get((self.id, account)) != 0 {301			vec![TokenId::default()]302		} else {303			vec![]304		}305	}306307	fn token_exists(&self, token: TokenId) -> bool {308		token == TokenId::default()309	}310311	fn last_token_id(&self) -> TokenId {312		TokenId::default()313	}314315	fn token_owner(&self, _token: TokenId) -> Option<T::CrossAccountId> {316		None317	}318	fn const_metadata(&self, _token: TokenId) -> Vec<u8> {319		Vec::new()320	}321322	fn token_properties(&self, _token_id: TokenId, _keys: Option<Vec<PropertyKey>>) -> Vec<Property> {323		Vec::new()324	}325326	fn total_supply(&self) -> u32 {327		1328	}329330	fn account_balance(&self, account: T::CrossAccountId) -> u32 {331		if <Balance<T>>::get((self.id, account)) != 0 {332			1333		} else {334			0335		}336	}337338	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {339		if token != TokenId::default() {340			return 0;341		}342		<Balance<T>>::get((self.id, account))343	}344345	fn allowance(346		&self,347		sender: T::CrossAccountId,348		spender: T::CrossAccountId,349		token: TokenId,350	) -> u128 {351		if token != TokenId::default() {352			return 0;353		}354		<Allowance<T>>::get((self.id, sender, spender))355	}356}
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -362,10 +362,11 @@
 			.into_inner()
 	}
 
-	fn token_properties(&self, token_id: TokenId, keys: Vec<PropertyKey>) -> Vec<Property> {
+	fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property> {
 		let properties = <Pallet<T>>::token_properties((self.id, token_id));
 
-		keys.into_iter()
+		keys.map(|keys| {
+			keys.into_iter()
 			.filter_map(|key| {
 				properties.get(&key).map(|value| Property {
 					key,
@@ -373,6 +374,13 @@
 				})
 			})
 			.collect()
+		}).unwrap_or(
+			properties.iter().map(|(key, value)| Property {
+				key: key.clone(),
+				value: value.clone(),
+			})
+			.collect()
+		)
 	}
 
 	fn total_supply(&self) -> u32 {
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -340,7 +340,7 @@
 			.into_inner()
 	}
 
-	fn token_properties(&self, _token_id: TokenId, _keys: Vec<PropertyKey>) -> Vec<Property> {
+	fn token_properties(&self, _token_id: TokenId, _keys: Option<Vec<PropertyKey>>) -> Vec<Property> {
 		Vec::new()
 	}
 
modifiedprimitives/rpc/src/lib.rsdiffbeforeafterboth
--- a/primitives/rpc/src/lib.rs
+++ b/primitives/rpc/src/lib.rs
@@ -43,20 +43,24 @@
 		fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>>;
 		fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>>;
 
-		fn collection_properties(collection: CollectionId, properties: Vec<Vec<u8>>) -> Result<Vec<Property>>;
+		fn collection_properties(collection: CollectionId, properties: Option<Vec<Vec<u8>>>) -> Result<Vec<Property>>;
 
 		fn token_properties(
 			collection: CollectionId,
 			token_id: TokenId,
-			properties: Vec<Vec<u8>>
+			properties: Option<Vec<Vec<u8>>>
 		) -> Result<Vec<Property>>;
 
 		fn property_permissions(
 			collection: CollectionId,
-			properties: Vec<Vec<u8>>
+			properties: Option<Vec<Vec<u8>>>
 		) -> Result<Vec<PropertyKeyPermission>>;
 
-		fn token_data(collection: CollectionId, token_id: TokenId, keys: Vec<Vec<u8>>) -> Result<TokenData<CrossAccountId>>;
+		fn token_data(
+			collection: CollectionId,
+			token_id: TokenId,
+			keys: Option<Vec<Vec<u8>>>
+		) -> Result<TokenData<CrossAccountId>>;
 
 		fn total_supply(collection: CollectionId) -> Result<u32>;
 		fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32>;
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/src/runtime_apis.rs
+++ b/runtime/common/src/runtime_apis.rs
@@ -35,9 +35,11 @@
 
                 fn collection_properties(
                     collection: CollectionId,
-                    keys: Vec<Vec<u8>>
+                    keys: Option<Vec<Vec<u8>>>
                 ) -> Result<Vec<Property>, DispatchError> {
-                    let keys = pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)?;
+                    let keys = keys.map(
+                        |keys| pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)
+                    ).transpose()?;
 
                     pallet_common::Pallet::<Runtime>::filter_collection_properties(collection, keys)
                 }
@@ -45,17 +47,22 @@
                 fn token_properties(
                     collection: CollectionId,
                     token_id: TokenId,
-                    keys: Vec<Vec<u8>>
+                    keys: Option<Vec<Vec<u8>>>
                 ) -> Result<Vec<Property>, DispatchError> {
-                    let keys = pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)?;
+                    let keys = keys.map(
+                        |keys| pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)
+                    ).transpose()?;
+
                     dispatch_unique_runtime!(collection.token_properties(token_id, keys))
                 }
 
                 fn property_permissions(
                     collection: CollectionId,
-                    keys: Vec<Vec<u8>>
+                    keys: Option<Vec<Vec<u8>>>
                 ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {
-                    let keys = pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)?;
+                    let keys = keys.map(
+                        |keys| pallet_common::Pallet::<Runtime>::bytes_keys_to_property_keys(keys)
+                    ).transpose()?;
 
                     pallet_common::Pallet::<Runtime>::filter_property_permissions(collection, keys)
                 }
@@ -63,7 +70,7 @@
                 fn token_data(
                     collection: CollectionId,
                     token_id: TokenId,
-                    keys: Vec<Vec<u8>>
+                    keys: Option<Vec<Vec<u8>>>
                 ) -> Result<TokenData<CrossAccountId>, DispatchError> {
                     let token_data = TokenData {
                         const_data: Self::const_metadata(collection, token_id)?,