git.delta.rocks / unique-network / refs/commits / 0e74039449d0

difftreelog

doc(rmrk): adjusted for clarity

Farhad Hakimov2022-07-22parent: #287a010.patch.diff
in: master

4 files changed

modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -48,7 +48,43 @@
 //! - Docs: <https://docs.rmrk.app/getting-started/>
 //! - FAQ: <https://coda.io/@rmrk/faq>
 //! - Substrate code repository: <https://github.com/rmrk-team/rmrk-substrate>
-//! - RMRK spec repository: <https://github.com/rmrk-team/rmrk-spec>
+//! - RMRK specification repository: <https://github.com/rmrk-team/rmrk-spec>
+//! 
+//! ## Terminology
+//! 
+//! For more information on RMRK, see RMRK's own documentation.
+//! 
+//! ### Intro to RMRK
+//! 
+//! - **Resource:** Additional piece of metadata of an NFT usually serving to add 
+//! a piece of media on top of the root metadata (NFT's own), be it a different wing 
+//! on the root template bird or something entirely unrelated.
+//! 
+//! - **Base:** A list of possible "components" - Parts, a combination of which can 
+//! be appended/equipped to/on an NFT.
+//! 
+//! - **Part:** Something that, together with other Parts, can constitute an NFT. 
+//! Parts are defined in the Base to which they belong. Parts can be either 
+//! of the `slot` type or `fixed` type. Slots are intended for equippables.
+//! Note that "part of something" and "Part of a Base" can be easily confused, 
+//! and in this documentation these words are distinguished by the capital letter.
+//! 
+//! - **Theme:** Named objects of variable => value pairs which get interpolated into 
+//! the Base's `themable` Parts. Themes can hold any value, but are often represented 
+//! in RMRK's examples as colors applied to visible Parts.
+//! 
+//! ### Peculiarities in Unique
+//! 
+//! - **Scoped properties:** Properties that are normally obscured from users. 
+//! Their purpose is to contain structured metadata that was not included in the Unique standard 
+//! for collections and tokens, meant to be operated on by proxies and other outliers. 
+//! Scoped properties are prefixed with `some-scope:`, where `some-scope` is 
+//! an arbitrary keyword, like "rmrk", and `:` is an unacceptable symbol in user-defined 
+//! properties, which, along with other safeguards, makes them impossible to tamper with.
+//! 
+//! - **Auxiliary properties:** A slightly different structure of properties, 
+//! trading universality of use for more convenient storage, writes and access. 
+//! Meant to be inaccessible to end users.
 //!
 //! ## Proxy Implementation
 //!
@@ -74,17 +110,17 @@
 //!
 //! Many of RMRK's native parameters are stored as scoped properties of a collection
 //! or an NFT on the chain. Scoped properties are prefixed with `rmrk:`, where `:`
-//! is an unacceptable symbol in user-defined proeprties, which, along with other safeguards,
+//! is an unacceptable symbol in user-defined properties, which, along with other safeguards,
 //! makes them impossible to tamper with.
 //!
-//! ### Collection and NFT Types
+//! ### Collection and NFT Types, and Base, Parts and Themes Handling
 //!
 //! RMRK introduces the concept of a Base, which is a catalgoue of Parts,
 //! possible components of an NFT. Due to its similarity with the functionality
 //! of a token collection, a Base is stored and handled as one, and the Base's Parts and Themes
 //! are the collection's NFTs. See [`CollectionType`](pallet_rmrk_core::misc::CollectionType) and
 //! [`NftType`](pallet_rmrk_core::misc::NftType).
-//!
+//! 
 //! ## Interface
 //!
 //! ### Dispatchables
@@ -276,9 +312,9 @@
 		/* RMRK compatible events */
 		/// Only destroying collections without tokens is allowed.
 		CollectionNotEmpty,
-		/// Could not find an ID for a collection. It is likely there were too many collections created on the chain.
+		/// Could not find an ID for a collection. It is likely there were too many collections created on the chain, causing an overflow.
 		NoAvailableCollectionId,
-		/// Token does not exist, or there is no suitable ID for it, likely too many tokens were created in a collection.
+		/// Token does not exist, or there is no suitable ID for it, likely too many tokens were created in a collection, causing an overflow.
 		NoAvailableNftId,
 		/// Collection does not exist, has a wrong type, or does not map to a Unique ID.
 		CollectionUnknown,
@@ -301,7 +337,7 @@
 		CannotRejectNonPendingNft,
 		/// Resource is not pending for the operation.
 		ResourceNotPending,
-		/// Could not find an ID for the resource. Is is likely there were too many resources created on an NFT.
+		/// Could not find an ID for the resource. It is likely there were too many resources created on an NFT, causing an overflow.
 		NoAvailableResourceId,
 	}
 
@@ -587,8 +623,9 @@
 		/// # Arguments:
 		/// - `collection_id`: RMRK ID of the collection in which the NFT to burn belongs to.
 		/// - `nft_id`: ID of the NFT to be destroyed.
-		/// - `max_burns`: Maximum number of tokens to burn, used for nesting. The transaction
+		/// - `max_burns`: Maximum number of tokens to burn, assuming nesting. The transaction
 		/// is reverted if there are more tokens to burn in the nesting tree than this number.
+		/// This is primarily a mechanism of transaction weight control.
 		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::burn_nft(*max_burns))]
 		pub fn burn_nft(
@@ -1165,11 +1202,7 @@
 
 		/// Create and set/propose a basic resource for an NFT.
 		///
-		/// A resource is considered a part of an NFT, an additional piece of metadata
-		/// usually serving to add a piece of media on top of the root metadata, be it
-		/// a different wing on the root template bird or something entirely unrelated.
-		/// A basic resource is the simplest, lacking a base or composables.
-		///
+		/// A basic resource is the simplest, lacking a Base and anything that comes with it.
 		/// See RMRK docs for more information and examples.
 		///
 		/// # Permissions:
@@ -1211,11 +1244,7 @@
 
 		/// Create and set/propose a composable resource for an NFT.
 		///
-		/// A resource is considered a part of an NFT, an additional piece of metadata
-		/// usually serving to add a piece of media on top of the root metadata, be it
-		/// a different wing on the root template bird or something entirely unrelated.
-		/// A composable resource links to a base and has a subset of its parts it is composed of.
-		///
+		/// A composable resource links to a Base and has a subset of its Parts it is composed of.
 		/// See RMRK docs for more information and examples.
 		///
 		/// # Permissions:
@@ -1277,11 +1306,7 @@
 
 		/// Create and set/propose a slot resource for an NFT.
 		///
-		/// A resource is considered a part of an NFT, an additional piece of metadata
-		/// usually serving to add a piece of media on top of the root metadata, be it
-		/// a different wing on the root template bird or something entirely unrelated.
-		/// A slot resource links to a base and a slot in it which it now occupies.
-		///
+		/// A slot resource links to a Base and a slot ID in it which it can fit into.
 		/// See RMRK docs for more information and examples.
 		///
 		/// # Permissions:
@@ -1575,6 +1600,8 @@
 
 	/// Get incremented resource ID from within an NFT's properties and store the new latest ID.
 	/// Thus, the returned resource ID should be used.
+	/// 
+	/// Resource IDs are unique only across an NFT.
 	fn acquire_next_resource_id(
 		collection_id: CollectionId,
 		nft_id: TokenId,
@@ -1693,8 +1720,8 @@
 		Ok(())
 	}
 
-	/// Remove one usage of a base from an NFT's property of associated bases. The base will stay, however,
-	/// if the count of resources using the base is still non-zero.
+	/// Remove a Base ID from an NFT if they are associated. 
+	/// The Base itself is deleted if the number of associated NFTs reaches 0.
 	fn remove_associated_base_id(
 		collection_id: CollectionId,
 		nft_id: TokenId,
@@ -1837,9 +1864,9 @@
 		Self::decode_property_value(&Self::get_collection_property(collection_id, key)?)
 	}
 
-	/// Get the type of a collection stored in it as a scoped property.
+	/// Get the type of a collection stored as a scoped property.
 	///
-	/// RMRK Core proxy differentiates between regular collections as well as RMRK bases as collections.
+	/// RMRK Core proxy differentiates between regular collections as well as RMRK Bases as collections.
 	pub fn get_collection_type(
 		collection_id: CollectionId,
 	) -> Result<misc::CollectionType, DispatchError> {
@@ -1921,9 +1948,9 @@
 		<TokenData<T>>::contains_key((collection_id, nft_id))
 	}
 
-	/// Get the type of an NFT stored in it as a scoped property.
+	/// Get the type of an NFT stored as a scoped property.
 	///
-	/// RMRK Core proxy differentiates between regular NFTs, and RMRK parts and themes.
+	/// RMRK Core proxy differentiates between regular NFTs, and RMRK Parts and Themes.
 	pub fn get_nft_type(
 		collection_id: CollectionId,
 		token_id: TokenId,
@@ -2013,8 +2040,8 @@
 			})
 	}
 
-	/// Get all non-scoped properties from a collection or a token, and apply some transformation
-	/// to each key-value pair.
+	/// Get all non-scoped properties from a collection or a token, and apply some transformation,
+	/// supplied by `mapper`, to each key-value pair.
 	pub fn iterate_user_properties<Key, Value, R, Mapper>(
 		collection_id: CollectionId,
 		token_id: Option<TokenId>,
modifiedpallets/proxy-rmrk-core/src/rpc.rsdiffbeforeafterboth
before · pallets/proxy-rmrk-core/src/rpc.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/>.1617//! Realizations of RMRK RPCs (remote procedure calls) related to the Core pallet.1819use super::*;2021/// Get the latest created collection ID.22pub fn last_collection_idx<T: Config>() -> Result<RmrkCollectionId, DispatchError> {23	Ok(<Pallet<T>>::last_collection_idx())24}2526/// Get collection info by ID.27pub fn collection_by_id<T: Config>(28	collection_id: RmrkCollectionId,29) -> Result<Option<RmrkCollectionInfo<T::AccountId>>, DispatchError> {30	let (collection, collection_id) = match <Pallet<T>>::get_typed_nft_collection_mapped(31		collection_id,32		misc::CollectionType::Regular,33	) {34		Ok(c) => c,35		Err(_) => return Ok(None),36	};3738	let nfts_count = collection.total_supply();3940	Ok(Some(RmrkCollectionInfo {41		issuer: collection.owner.clone(),42		metadata: <Pallet<T>>::get_collection_property_decoded(43			collection_id,44			RmrkProperty::Metadata,45		)?,46		max: collection.limits.token_limit,47		symbol: <Pallet<T>>::rebind(&collection.token_prefix)?,48		nfts_count,49	}))50}5152/// Get NFT info by collection and NFT IDs.53pub fn nft_by_id<T: Config>(54	collection_id: RmrkCollectionId,55	nft_by_id: RmrkNftId,56) -> Result<Option<RmrkInstanceInfo<T::AccountId>>, DispatchError> {57	let (collection, collection_id) = match <Pallet<T>>::get_typed_nft_collection_mapped(58		collection_id,59		misc::CollectionType::Regular,60	) {61		Ok(c) => c,62		Err(_) => return Ok(None),63	};6465	let nft_id = TokenId(nft_by_id);66	if !<Pallet<T>>::nft_exists(collection_id, nft_id) {67		return Ok(None);68	}6970	let owner = match collection.token_owner(nft_id) {71		Some(owner) => match T::CrossTokenAddressMapping::address_to_token(&owner) {72			Some((col, tok)) => {73				let rmrk_collection = <Pallet<T>>::rmrk_collection_id(col)?;7475				RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(rmrk_collection, tok.0)76			}77			None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone()),78		},79		None => return Ok(None),80	};8182	Ok(Some(RmrkInstanceInfo {83		owner: owner,84		royalty: <Pallet<T>>::get_nft_property_decoded(85			collection_id,86			nft_id,87			RmrkProperty::RoyaltyInfo,88		)?,89		metadata: <Pallet<T>>::get_nft_property_decoded(90			collection_id,91			nft_id,92			RmrkProperty::Metadata,93		)?,94		equipped: <Pallet<T>>::get_nft_property_decoded(95			collection_id,96			nft_id,97			RmrkProperty::Equipped,98		)?,99		pending: <Pallet<T>>::get_nft_property_decoded(100			collection_id,101			nft_id,102			RmrkProperty::PendingNftAccept,103		)?,104	}))105}106107/// Get tokens owned by an account in a collection.108pub fn account_tokens<T: Config>(109	account_id: T::AccountId,110	collection_id: RmrkCollectionId,111) -> Result<Vec<RmrkNftId>, DispatchError> {112	let cross_account_id = CrossAccountId::from_sub(account_id);113114	let (collection, collection_id) = match <Pallet<T>>::get_typed_nft_collection_mapped(115		collection_id,116		misc::CollectionType::Regular,117	) {118		Ok(c) => c,119		Err(_) => return Ok(Vec::new()),120	};121122	let tokens = collection123		.account_tokens(cross_account_id)124		.into_iter()125		.filter(|token| {126			let is_pending = <Pallet<T>>::get_nft_property_decoded(127				collection_id,128				*token,129				RmrkProperty::PendingNftAccept,130			)131			.unwrap_or(true);132133			!is_pending134		})135		.map(|token| token.0)136		.collect();137138	Ok(tokens)139}140141/// Get tokens nested in an NFT - its direct children (not the children's children).142pub fn nft_children<T: Config>(143	collection_id: RmrkCollectionId,144	nft_id: RmrkNftId,145) -> Result<Vec<RmrkNftChild>, DispatchError> {146	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {147		Ok(id) => id,148		Err(_) => return Ok(Vec::new()),149	};150	let nft_id = TokenId(nft_id);151	if !<Pallet<T>>::nft_exists(collection_id, nft_id) {152		return Ok(Vec::new());153	}154155	Ok(156		pallet_nonfungible::TokenChildren::<T>::iter_prefix((collection_id, nft_id))157			.filter_map(|((child_collection, child_token), _)| {158				let rmrk_child_collection =159					<Pallet<T>>::rmrk_collection_id(child_collection).ok()?;160161				Some(RmrkNftChild {162					collection_id: rmrk_child_collection,163					nft_id: child_token.0,164				})165			})166			.chain(167				<Pallet<T>>::iterate_pending_children(collection_id, nft_id)?.map(168					|(child_collection, child_nft_id)| RmrkNftChild {169						collection_id: child_collection,170						nft_id: child_nft_id,171					},172				),173			)174			.collect(),175	)176}177178/// Get collection properties, created by the user - not the proxy-specific properties.179pub fn collection_properties<T: Config>(180	collection_id: RmrkCollectionId,181	filter_keys: Option<Vec<RmrkPropertyKey>>,182) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {183	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {184		Ok(id) => id,185		Err(_) => return Ok(Vec::new()),186	};187	if <Pallet<T>>::ensure_collection_type(collection_id, misc::CollectionType::Regular).is_err() {188		return Ok(Vec::new());189	}190191	let properties = <Pallet<T>>::filter_user_properties(192		collection_id,193		/* token_id = */ None,194		filter_keys,195		|key, value| RmrkPropertyInfo { key, value },196	)?;197198	Ok(properties)199}200201/// Get NFT properties, created by the user - not the proxy-specific properties.202pub fn nft_properties<T: Config>(203	collection_id: RmrkCollectionId,204	nft_id: RmrkNftId,205	filter_keys: Option<Vec<RmrkPropertyKey>>,206) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {207	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {208		Ok(id) => id,209		Err(_) => return Ok(Vec::new()),210	};211	let token_id = TokenId(nft_id);212213	if <Pallet<T>>::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {214		return Ok(Vec::new());215	}216217	let properties = <Pallet<T>>::filter_user_properties(218		collection_id,219		Some(token_id),220		filter_keys,221		|key, value| RmrkPropertyInfo { key, value },222	)?;223224	Ok(properties)225}226227/// Get data of resources of an NFT.228pub fn nft_resources<T: Config>(229	collection_id: RmrkCollectionId,230	nft_id: RmrkNftId,231) -> Result<Vec<RmrkResourceInfo>, DispatchError> {232	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {233		Ok(id) => id,234		Err(_) => return Ok(Vec::new()),235	};236	if <Pallet<T>>::ensure_collection_type(collection_id, misc::CollectionType::Regular).is_err() {237		return Ok(Vec::new());238	}239240	let nft_id = TokenId(nft_id);241	if <Pallet<T>>::ensure_nft_type(collection_id, nft_id, NftType::Regular).is_err() {242		return Ok(Vec::new());243	}244245	let resources = <pallet_nonfungible::Pallet<T>>::iterate_token_aux_properties(246		collection_id,247		nft_id,248		PropertyScope::Rmrk,249	)250	.filter_map(|(key, value)| {251		if !is_valid_key_prefix(&key, RESOURCE_ID_PREFIX) {252			return None;253		}254255		let resource_info: RmrkResourceInfo = <Pallet<T>>::decode_property_value(&value).ok()?;256257		Some(resource_info)258	})259	.collect();260261	Ok(resources)262}263264/// Get the priority of a resource in an NFT.265pub fn nft_resource_priority<T: Config>(266	collection_id: RmrkCollectionId,267	nft_id: RmrkNftId,268	resource_id: RmrkResourceId,269) -> Result<Option<u32>, DispatchError> {270	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {271		Ok(id) => id,272		Err(_) => return Ok(None),273	};274	if <Pallet<T>>::ensure_collection_type(collection_id, misc::CollectionType::Regular).is_err() {275		return Ok(None);276	}277278	let nft_id = TokenId(nft_id);279	if <Pallet<T>>::ensure_nft_type(collection_id, nft_id, NftType::Regular).is_err() {280		return Ok(None);281	}282283	let priorities: Vec<_> = <Pallet<T>>::get_nft_property_decoded(284		collection_id,285		nft_id,286		RmrkProperty::ResourcePriorities,287	)?;288	Ok(priorities289		.into_iter()290		.enumerate()291		.find(|(_, id)| *id == resource_id)292		.map(|(priority, _): (usize, RmrkResourceId)| priority as u32))293}
after · pallets/proxy-rmrk-core/src/rpc.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/>.1617//! Realizations of RMRK RPCs (remote procedure calls) related to the Core pallet.1819use super::*;2021/// Get the latest created collection ID.22pub fn last_collection_idx<T: Config>() -> Result<RmrkCollectionId, DispatchError> {23	Ok(<Pallet<T>>::last_collection_idx())24}2526/// Get collection info by ID.27pub fn collection_by_id<T: Config>(28	collection_id: RmrkCollectionId,29) -> Result<Option<RmrkCollectionInfo<T::AccountId>>, DispatchError> {30	let (collection, collection_id) = match <Pallet<T>>::get_typed_nft_collection_mapped(31		collection_id,32		misc::CollectionType::Regular,33	) {34		Ok(c) => c,35		Err(_) => return Ok(None),36	};3738	let nfts_count = collection.total_supply();3940	Ok(Some(RmrkCollectionInfo {41		issuer: collection.owner.clone(),42		metadata: <Pallet<T>>::get_collection_property_decoded(43			collection_id,44			RmrkProperty::Metadata,45		)?,46		max: collection.limits.token_limit,47		symbol: <Pallet<T>>::rebind(&collection.token_prefix)?,48		nfts_count,49	}))50}5152/// Get NFT info by collection and NFT IDs.53pub fn nft_by_id<T: Config>(54	collection_id: RmrkCollectionId,55	nft_by_id: RmrkNftId,56) -> Result<Option<RmrkInstanceInfo<T::AccountId>>, DispatchError> {57	let (collection, collection_id) = match <Pallet<T>>::get_typed_nft_collection_mapped(58		collection_id,59		misc::CollectionType::Regular,60	) {61		Ok(c) => c,62		Err(_) => return Ok(None),63	};6465	let nft_id = TokenId(nft_by_id);66	if !<Pallet<T>>::nft_exists(collection_id, nft_id) {67		return Ok(None);68	}6970	let owner = match collection.token_owner(nft_id) {71		Some(owner) => match T::CrossTokenAddressMapping::address_to_token(&owner) {72			Some((col, tok)) => {73				let rmrk_collection = <Pallet<T>>::rmrk_collection_id(col)?;7475				RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(rmrk_collection, tok.0)76			}77			None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone()),78		},79		None => return Ok(None),80	};8182	Ok(Some(RmrkInstanceInfo {83		owner: owner,84		royalty: <Pallet<T>>::get_nft_property_decoded(85			collection_id,86			nft_id,87			RmrkProperty::RoyaltyInfo,88		)?,89		metadata: <Pallet<T>>::get_nft_property_decoded(90			collection_id,91			nft_id,92			RmrkProperty::Metadata,93		)?,94		equipped: <Pallet<T>>::get_nft_property_decoded(95			collection_id,96			nft_id,97			RmrkProperty::Equipped,98		)?,99		pending: <Pallet<T>>::get_nft_property_decoded(100			collection_id,101			nft_id,102			RmrkProperty::PendingNftAccept,103		)?,104	}))105}106107/// Get tokens owned by an account in a collection.108pub fn account_tokens<T: Config>(109	account_id: T::AccountId,110	collection_id: RmrkCollectionId,111) -> Result<Vec<RmrkNftId>, DispatchError> {112	let cross_account_id = CrossAccountId::from_sub(account_id);113114	let (collection, collection_id) = match <Pallet<T>>::get_typed_nft_collection_mapped(115		collection_id,116		misc::CollectionType::Regular,117	) {118		Ok(c) => c,119		Err(_) => return Ok(Vec::new()),120	};121122	let tokens = collection123		.account_tokens(cross_account_id)124		.into_iter()125		.filter(|token| {126			let is_pending = <Pallet<T>>::get_nft_property_decoded(127				collection_id,128				*token,129				RmrkProperty::PendingNftAccept,130			)131			.unwrap_or(true);132133			!is_pending134		})135		.map(|token| token.0)136		.collect();137138	Ok(tokens)139}140141/// Get tokens nested in an NFT - its direct children (not the children's children).142pub fn nft_children<T: Config>(143	collection_id: RmrkCollectionId,144	nft_id: RmrkNftId,145) -> Result<Vec<RmrkNftChild>, DispatchError> {146	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {147		Ok(id) => id,148		Err(_) => return Ok(Vec::new()),149	};150	let nft_id = TokenId(nft_id);151	if !<Pallet<T>>::nft_exists(collection_id, nft_id) {152		return Ok(Vec::new());153	}154155	Ok(156		pallet_nonfungible::TokenChildren::<T>::iter_prefix((collection_id, nft_id))157			.filter_map(|((child_collection, child_token), _)| {158				let rmrk_child_collection =159					<Pallet<T>>::rmrk_collection_id(child_collection).ok()?;160161				Some(RmrkNftChild {162					collection_id: rmrk_child_collection,163					nft_id: child_token.0,164				})165			})166			.chain(167				<Pallet<T>>::iterate_pending_children(collection_id, nft_id)?.map(168					|(child_collection, child_nft_id)| RmrkNftChild {169						collection_id: child_collection,170						nft_id: child_nft_id,171					},172				),173			)174			.collect(),175	)176}177178/// Get collection properties, created by the user - not the proxy-specific properties.179pub fn collection_properties<T: Config>(180	collection_id: RmrkCollectionId,181	filter_keys: Option<Vec<RmrkPropertyKey>>,182) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {183	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {184		Ok(id) => id,185		Err(_) => return Ok(Vec::new()),186	};187	if <Pallet<T>>::ensure_collection_type(collection_id, misc::CollectionType::Regular).is_err() {188		return Ok(Vec::new());189	}190191	let properties = <Pallet<T>>::filter_user_properties(192		collection_id,193		/* token_id = */ None,194		filter_keys,195		|key, value| RmrkPropertyInfo { key, value },196	)?;197198	Ok(properties)199}200201/// Get NFT properties, created by the user - not the proxy-specific properties.202pub fn nft_properties<T: Config>(203	collection_id: RmrkCollectionId,204	nft_id: RmrkNftId,205	filter_keys: Option<Vec<RmrkPropertyKey>>,206) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {207	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {208		Ok(id) => id,209		Err(_) => return Ok(Vec::new()),210	};211	let token_id = TokenId(nft_id);212213	if <Pallet<T>>::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {214		return Ok(Vec::new());215	}216217	let properties = <Pallet<T>>::filter_user_properties(218		collection_id,219		Some(token_id),220		filter_keys,221		|key, value| RmrkPropertyInfo { key, value },222	)?;223224	Ok(properties)225}226227/// Get full information on each resource of an NFT, including pending.228pub fn nft_resources<T: Config>(229	collection_id: RmrkCollectionId,230	nft_id: RmrkNftId,231) -> Result<Vec<RmrkResourceInfo>, DispatchError> {232	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {233		Ok(id) => id,234		Err(_) => return Ok(Vec::new()),235	};236	if <Pallet<T>>::ensure_collection_type(collection_id, misc::CollectionType::Regular).is_err() {237		return Ok(Vec::new());238	}239240	let nft_id = TokenId(nft_id);241	if <Pallet<T>>::ensure_nft_type(collection_id, nft_id, NftType::Regular).is_err() {242		return Ok(Vec::new());243	}244245	let resources = <pallet_nonfungible::Pallet<T>>::iterate_token_aux_properties(246		collection_id,247		nft_id,248		PropertyScope::Rmrk,249	)250	.filter_map(|(key, value)| {251		if !is_valid_key_prefix(&key, RESOURCE_ID_PREFIX) {252			return None;253		}254255		let resource_info: RmrkResourceInfo = <Pallet<T>>::decode_property_value(&value).ok()?;256257		Some(resource_info)258	})259	.collect();260261	Ok(resources)262}263264/// Get the priority of a resource in an NFT.265pub fn nft_resource_priority<T: Config>(266	collection_id: RmrkCollectionId,267	nft_id: RmrkNftId,268	resource_id: RmrkResourceId,269) -> Result<Option<u32>, DispatchError> {270	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {271		Ok(id) => id,272		Err(_) => return Ok(None),273	};274	if <Pallet<T>>::ensure_collection_type(collection_id, misc::CollectionType::Regular).is_err() {275		return Ok(None);276	}277278	let nft_id = TokenId(nft_id);279	if <Pallet<T>>::ensure_nft_type(collection_id, nft_id, NftType::Regular).is_err() {280		return Ok(None);281	}282283	let priorities: Vec<_> = <Pallet<T>>::get_nft_property_decoded(284		collection_id,285		nft_id,286		RmrkProperty::ResourcePriorities,287	)?;288	Ok(priorities289		.into_iter()290		.enumerate()291		.find(|(_, id)| *id == resource_id)292		.map(|(priority, _): (usize, RmrkResourceId)| priority as u32))293}
modifiedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-equip/src/lib.rs
+++ b/pallets/proxy-rmrk-equip/src/lib.rs
@@ -30,7 +30,7 @@
 //! of solutions based on RMRK.
 //!
 //! RMRK Equip itself contains functionality to equip NFTs, and work with Bases,
-//! Parts, and Themes.
+//! Parts, and Themes. See [Proxy Implementation](#proxy-implementation) for details.
 //!
 //! Equip Proxy is responsible for a more specific area of RMRK, and heavily relies on the Core.
 //! For a more foundational description of proxy implementation, please refer to [`pallet_rmrk_core`].
@@ -52,6 +52,42 @@
 //! - FAQ: <https://coda.io/@rmrk/faq>
 //! - Substrate code repository: <https://github.com/rmrk-team/rmrk-substrate>
 //! - RMRK spec repository: <https://github.com/rmrk-team/rmrk-spec>
+//! 
+//! ## Terminology
+//! 
+//! For more information on RMRK, see RMRK's own documentation.
+//! 
+//! ### Intro to RMRK
+//! 
+//! - **Resource:** Additional piece of metadata of an NFT usually serving to add 
+//! a piece of media on top of the root metadata (NFT's own), be it a different wing 
+//! on the root template bird or something entirely unrelated.
+//! 
+//! - **Base:** A list of possible "components" - Parts, a combination of which can 
+//! be appended/equipped to/on an NFT.
+//! 
+//! - **Part:** Something that, together with other Parts, can constitute an NFT. 
+//! Parts are defined in the Base to which they belong. Parts can be either 
+//! of the `slot` type or `fixed` type. Slots are intended for equippables.
+//! Note that "part of something" and "Part of a Base" can be easily confused, 
+//! and in this documentation these words are distinguished by the capital letter.
+//! 
+//! - **Theme:** Named objects of variable => value pairs which get interpolated into 
+//! the Base's `themable` Parts. Themes can hold any value, but are often represented 
+//! in RMRK's examples as colors applied to visible Parts.
+//! 
+//! ### Peculiarities in Unique
+//! 
+//! - **Scoped properties:** Properties that are normally obscured from users. 
+//! Their purpose is to contain structured metadata that was not included in the Unique standard 
+//! for collections and tokens, meant to be operated on by proxies and other outliers. 
+//! Scoped properties are prefixed with `some-scope:`, where `some-scope` is 
+//! an arbitrary keyword, like "rmrk", and `:` is an unacceptable symbol in user-defined 
+//! properties, which, along with other safeguards, makes them impossible to tamper with.
+//! 
+//! - **Auxiliary properties:** A slightly different structure of properties, 
+//! trading universality of use for more convenient storage, writes and access. 
+//! Meant to be inaccessible to end users.
 //!
 //! ## Proxy Implementation
 //!
@@ -77,10 +113,10 @@
 //!
 //! Many of RMRK's native parameters are stored as scoped properties of a collection
 //! or an NFT on the chain. Scoped properties are prefixed with `rmrk:`, where `:`
-//! is an unacceptable symbol in user-defined proeprties, which, along with other safeguards,
+//! is an unacceptable symbol in user-defined properties, which, along with other safeguards,
 //! makes them impossible to tamper with.
 //!
-//! ### Collection and NFT Types
+//! ### Collection and NFT Types, and Base, Parts and Themes Handling
 //!
 //! RMRK introduces the concept of a Base, which is a catalgoue of Parts,
 //! possible components of an NFT. Due to its similarity with the functionality
@@ -134,13 +170,13 @@
 		type WeightInfo: WeightInfo;
 	}
 
-	/// Map of a base ID and a part ID to an NFT in the base collection serving as the part.
+	/// Map of a Base ID and a Part ID to an NFT in the Base collection serving as the Part.
 	#[pallet::storage]
 	#[pallet::getter(fn internal_part_id)]
 	pub type InernalPartId<T: Config> =
 		StorageDoubleMap<_, Twox64Concat, CollectionId, Twox64Concat, RmrkPartId, TokenId>;
 
-	/// Checkmark that a base has a Theme NFT named "default".
+	/// Checkmark that a Base has a Theme NFT named "default".
 	#[pallet::storage]
 	#[pallet::getter(fn base_has_default_theme)]
 	pub type BaseHasDefaultTheme<T: Config> =
@@ -167,17 +203,17 @@
 	pub enum Error<T> {
 		/// No permission to perform action.
 		PermissionError,
-		/// Could not find an ID for a base collection. It is likely there were too many collections created on the chain.
+		/// Could not find an ID for a Base collection. It is likely there were too many collections created on the chain, causing an overflow.
 		NoAvailableBaseId,
-		/// Could not find a suitable ID for a part, likely too many part tokens were created in the base.
+		/// Could not find a suitable ID for a Part, likely too many Part tokens were created in the Base, causing an overflow
 		NoAvailablePartId,
 		/// Base collection linked to this ID does not exist.
 		BaseDoesntExist,
-		/// No theme named "default" is associated with the Base.
+		/// No Theme named "default" is associated with the Base.
 		NeedsDefaultThemeFirst,
 		/// Part linked to this ID does not exist.
 		PartDoesntExist,
-		/// Cannot assign equippables to a fixed part.
+		/// Cannot assign equippables to a fixed Part.
 		NoEquippableOnFixedPart,
 	}
 
@@ -185,15 +221,15 @@
 	impl<T: Config> Pallet<T> {
 		/// Create a new Base.
 		///
-		/// Modeled after the [base interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/base.md)
+		/// Modeled after the [Base interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/base.md)
 		///
 		/// # Permissions
-		/// - Anyone - will be assigned as the issuer of the base.
+		/// - Anyone - will be assigned as the issuer of the Base.
 		///
 		/// # Arguments:
 		/// - `base_type`: Arbitrary media type, e.g. "svg".
 		/// - `symbol`: Arbitrary client-chosen symbol.
-		/// - `parts`: Array of Fixed and Slot parts composing the base,
+		/// - `parts`: Array of Fixed and Slot Parts composing the Base,
 		/// confined in length by [`RmrkPartsLimit`](up_data_structs::RmrkPartsLimit).
 		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::create_base(parts.len() as u32))]
@@ -254,7 +290,7 @@
 		/// Add a Theme to a Base.
 		/// A Theme named "default" is required prior to adding other Themes.
 		///
-		/// Modeled after [themeadd interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/themeadd.md).
+		/// Modeled after [Themeadd interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/themeadd.md).
 		///
 		/// # Permissions:
 		/// - Base issuer
@@ -379,8 +415,7 @@
 }
 
 impl<T: Config> Pallet<T> {
-	/// Create or renew an NFT serving as a part, setting its properties
-	/// to those of the part.
+	/// Create or renew an NFT serving as a Part.
 	fn create_part(
 		sender: &T::CrossAccountId,
 		collection: &NonfungibleHandle<T>,
@@ -444,7 +479,7 @@
 		Ok(())
 	}
 
-	/// Ensure that the collection under the base ID is a base collection,
+	/// Ensure that the collection under the Base ID is a Base collection,
 	/// and fetch it.
 	fn get_base(base_id: CollectionId) -> Result<NonfungibleHandle<T>, DispatchError> {
 		let collection =
modifiedprimitives/rmrk-traits/src/resource.rsdiffbeforeafterboth
--- a/primitives/rmrk-traits/src/resource.rs
+++ b/primitives/rmrk-traits/src/resource.rs
@@ -151,13 +151,13 @@
 		"#)
 )]
 pub struct ResourceInfo<BoundedString, BoundedParts> {
-	/// id is a 5-character string of reasonable uniqueness.
-	/// The combination of base ID and resource id should be unique across the entire RMRK
-	/// ecosystem which
+	/// ID a unique identifier for a resource across all those of a single NFT.
+	/// The combination of a collection ID, an NFT ID, and the resource ID must be 
+	/// unique across the entire RMRK ecosystem.
 	//#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
 	pub id: ResourceId,
 
-	/// Resource
+	/// Resource type and the accordingly structured data stored
 	pub resource: ResourceTypes<BoundedString, BoundedParts>,
 
 	/// If resource is sent to non-rootowned NFT, pending will be false and need to be accepted