git.delta.rocks / unique-network / refs/commits / d4f7a1e6b1bd

difftreelog

Merge pull request #427 from UniqueNetwork/doc/architectural-changes

Yaroslav Bolyukin2022-07-22parents: #281e817 #2bb23d8.patch.diff
in: master

19 files changed

modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -42,6 +42,7 @@
 #[rpc(server)]
 #[async_trait]
 pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {
+	/// Get tokens owned by account.
 	#[method(name = "unique_accountTokens")]
 	fn account_tokens(
 		&self,
@@ -49,12 +50,16 @@
 		account: CrossAccountId,
 		at: Option<BlockHash>,
 	) -> Result<Vec<TokenId>>;
+
+	/// Get tokens contained within a collection.
 	#[method(name = "unique_collectionTokens")]
 	fn collection_tokens(
 		&self,
 		collection: CollectionId,
 		at: Option<BlockHash>,
 	) -> Result<Vec<TokenId>>;
+
+	/// Check if the token exists.
 	#[method(name = "unique_tokenExists")]
 	fn token_exists(
 		&self,
@@ -63,6 +68,7 @@
 		at: Option<BlockHash>,
 	) -> Result<bool>;
 
+	/// Get the token owner.
 	#[method(name = "unique_tokenOwner")]
 	fn token_owner(
 		&self,
@@ -80,6 +86,7 @@
 		at: Option<BlockHash>,
 	) -> Result<Vec<CrossAccountId>>;
 
+	/// Get the topmost token owner in the hierarchy of a possibly nested token.
 	#[method(name = "unique_topmostTokenOwner")]
 	fn topmost_token_owner(
 		&self,
@@ -87,6 +94,8 @@
 		token: TokenId,
 		at: Option<BlockHash>,
 	) -> Result<Option<CrossAccountId>>;
+
+	/// Get tokens nested directly into the token.
 	#[method(name = "unique_tokenChildren")]
 	fn token_children(
 		&self,
@@ -95,6 +104,7 @@
 		at: Option<BlockHash>,
 	) -> Result<Vec<TokenChild>>;
 
+	/// Get collection properties, optionally limited to the provided keys.
 	#[method(name = "unique_collectionProperties")]
 	fn collection_properties(
 		&self,
@@ -103,6 +113,7 @@
 		at: Option<BlockHash>,
 	) -> Result<Vec<Property>>;
 
+	/// Get token properties, optionally limited to the provided keys.
 	#[method(name = "unique_tokenProperties")]
 	fn token_properties(
 		&self,
@@ -112,6 +123,7 @@
 		at: Option<BlockHash>,
 	) -> Result<Vec<Property>>;
 
+	/// Get property permissions, optionally limited to the provided keys.
 	#[method(name = "unique_propertyPermissions")]
 	fn property_permissions(
 		&self,
@@ -120,6 +132,7 @@
 		at: Option<BlockHash>,
 	) -> Result<Vec<PropertyKeyPermission>>;
 
+	/// Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT.
 	#[method(name = "unique_tokenData")]
 	fn token_data(
 		&self,
@@ -129,8 +142,11 @@
 		at: Option<BlockHash>,
 	) -> Result<TokenData<CrossAccountId>>;
 
+	/// Get the amount of distinctive tokens present in a collection.
 	#[method(name = "unique_totalSupply")]
 	fn total_supply(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;
+
+	/// Get the amount of any user tokens owned by an account.
 	#[method(name = "unique_accountBalance")]
 	fn account_balance(
 		&self,
@@ -138,6 +154,8 @@
 		account: CrossAccountId,
 		at: Option<BlockHash>,
 	) -> Result<u32>;
+
+	/// Get the amount of a specific token owned by an account.
 	#[method(name = "unique_balance")]
 	fn balance(
 		&self,
@@ -146,6 +164,8 @@
 		token: TokenId,
 		at: Option<BlockHash>,
 	) -> Result<String>;
+
+	/// Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor.
 	#[method(name = "unique_allowance")]
 	fn allowance(
 		&self,
@@ -156,18 +176,23 @@
 		at: Option<BlockHash>,
 	) -> Result<String>;
 
+	/// Get the list of admin accounts of a collection.
 	#[method(name = "unique_adminlist")]
 	fn adminlist(
 		&self,
 		collection: CollectionId,
 		at: Option<BlockHash>,
 	) -> Result<Vec<CrossAccountId>>;
+
+	/// Get the list of accounts allowed to operate within a collection.
 	#[method(name = "unique_allowlist")]
 	fn allowlist(
 		&self,
 		collection: CollectionId,
 		at: Option<BlockHash>,
 	) -> Result<Vec<CrossAccountId>>;
+
+	/// Check if a user is allowed to operate within a collection.
 	#[method(name = "unique_allowed")]
 	fn allowed(
 		&self,
@@ -175,17 +200,24 @@
 		user: CrossAccountId,
 		at: Option<BlockHash>,
 	) -> Result<bool>;
+
+	/// Get the last token ID created in a collection.
 	#[method(name = "unique_lastTokenId")]
 	fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;
+
+	/// Get collection info by the specified ID.
 	#[method(name = "unique_collectionById")]
 	fn collection_by_id(
 		&self,
 		collection: CollectionId,
 		at: Option<BlockHash>,
 	) -> Result<Option<RpcCollection<AccountId>>>;
+
+	/// Get chain stats about collections.
 	#[method(name = "unique_collectionStats")]
 	fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;
 
+	/// Get the number of blocks until sponsoring a transaction is available.
 	#[method(name = "unique_nextSponsored")]
 	fn next_sponsored(
 		&self,
@@ -195,6 +227,7 @@
 		at: Option<BlockHash>,
 	) -> Result<Option<u64>>;
 
+	/// Get effective collection limits. If not explicitly set, get the chain defaults.
 	#[method(name = "unique_effectiveCollectionLimits")]
 	fn effective_collection_limits(
 		&self,
@@ -202,6 +235,7 @@
 		at: Option<BlockHash>,
 	) -> Result<Option<CollectionLimits>>;
 
+	/// Get the total amount of pieces of an RFT.
 	#[method(name = "unique_totalPieces")]
 	fn total_pieces(
 		&self,
@@ -228,20 +262,20 @@
 		Theme,
 	>
 	{
+		/// Get the latest created collection ID.
 		#[method(name = "rmrk_lastCollectionIdx")]
-		/// Get the latest created collection id
 		fn last_collection_idx(&self, at: Option<BlockHash>) -> Result<RmrkCollectionId>;
 
+		/// Get collection info by ID.
 		#[method(name = "rmrk_collectionById")]
-		/// Get collection by id
 		fn collection_by_id(
 			&self,
 			id: RmrkCollectionId,
 			at: Option<BlockHash>,
 		) -> Result<Option<CollectionInfo>>;
 
+		/// Get NFT info by collection and NFT IDs.
 		#[method(name = "rmrk_nftById")]
-		/// Get NFT by collection id and NFT id
 		fn nft_by_id(
 			&self,
 			collection_id: RmrkCollectionId,
@@ -249,8 +283,8 @@
 			at: Option<BlockHash>,
 		) -> Result<Option<NftInfo>>;
 
+		/// Get tokens owned by an account in a collection.
 		#[method(name = "rmrk_accountTokens")]
-		/// Get tokens owned by an account in a collection
 		fn account_tokens(
 			&self,
 			account_id: AccountId,
@@ -258,8 +292,8 @@
 			at: Option<BlockHash>,
 		) -> Result<Vec<RmrkNftId>>;
 
+		/// Get tokens nested in an NFT - its direct children (not the children's children).
 		#[method(name = "rmrk_nftChildren")]
-		/// Get NFT children
 		fn nft_children(
 			&self,
 			collection_id: RmrkCollectionId,
@@ -267,8 +301,8 @@
 			at: Option<BlockHash>,
 		) -> Result<Vec<RmrkNftChild>>;
 
+		/// Get collection properties, created by the user - not the proxy-specific properties.
 		#[method(name = "rmrk_collectionProperties")]
-		/// Get collection properties
 		fn collection_properties(
 			&self,
 			collection_id: RmrkCollectionId,
@@ -276,8 +310,8 @@
 			at: Option<BlockHash>,
 		) -> Result<Vec<PropertyInfo>>;
 
+		/// Get NFT properties, created by the user - not the proxy-specific properties.
 		#[method(name = "rmrk_nftProperties")]
-		/// Get NFT properties
 		fn nft_properties(
 			&self,
 			collection_id: RmrkCollectionId,
@@ -286,8 +320,8 @@
 			at: Option<BlockHash>,
 		) -> Result<Vec<PropertyInfo>>;
 
+		/// Get data of resources of an NFT.
 		#[method(name = "rmrk_nftResources")]
-		/// Get NFT resources
 		fn nft_resources(
 			&self,
 			collection_id: RmrkCollectionId,
@@ -295,8 +329,8 @@
 			at: Option<BlockHash>,
 		) -> Result<Vec<ResourceInfo>>;
 
+		/// Get the priority of a resource in an NFT.
 		#[method(name = "rmrk_nftResourcePriority")]
-		/// Get NFT resource priority
 		fn nft_resource_priority(
 			&self,
 			collection_id: RmrkCollectionId,
@@ -305,14 +339,15 @@
 			at: Option<BlockHash>,
 		) -> Result<Option<u32>>;
 
+		/// Get base info by its ID.
 		#[method(name = "rmrk_base")]
-		/// Get base info
 		fn base(&self, base_id: RmrkBaseId, at: Option<BlockHash>) -> Result<Option<BaseInfo>>;
 
+		/// Get all parts of a base.
 		#[method(name = "rmrk_baseParts")]
-		/// Get all Base's parts
 		fn base_parts(&self, base_id: RmrkBaseId, at: Option<BlockHash>) -> Result<Vec<PartType>>;
 
+		/// Get the theme names belonging to a base.
 		#[method(name = "rmrk_themeNames")]
 		fn theme_names(
 			&self,
@@ -320,6 +355,7 @@
 			at: Option<BlockHash>,
 		) -> Result<Vec<RmrkThemeName>>;
 
+		/// Get theme info, including properties, optionally limited to the provided keys.
 		#[method(name = "rmrk_themes")]
 		fn theme(
 			&self,
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -441,7 +441,7 @@
 			u128,
 		),
 
-		/// The colletion property has been set.
+		/// The colletion property has been added or edited.
 		CollectionPropertySet(
 			/// Id of collection to which property has been set.
 			CollectionId,
@@ -457,7 +457,7 @@
 			PropertyKey,
 		),
 
-		/// The token property has been set.
+		/// The token property has been added or edited.
 		TokenPropertySet(
 			/// Identifier of the collection whose token has the property set.
 			CollectionId,
@@ -477,9 +477,9 @@
 			PropertyKey,
 		),
 
-		/// The colletion property permission has been set.
+		/// The token property permission of a collection has been set.
 		PropertyPermissionSet(
-			/// Id of collection to which property permission has been set.
+			/// ID of collection to which property permission has been set.
 			CollectionId,
 			/// The property permission that was set.
 			PropertyKey,
@@ -524,26 +524,26 @@
 		/// Metadata flag frozen
 		MetadataFlagFrozen,
 
-		/// Item not exists.
+		/// Item does not exist
 		TokenNotFound,
-		/// Item balance not enough.
+		/// Item is balance not enough
 		TokenValueTooLow,
-		/// Requested value more than approved.
+		/// Requested value is more than the approved
 		ApprovedValueTooLow,
 		/// Tried to approve more than owned
 		CantApproveMoreThanOwned,
 
 		/// Can't transfer tokens to ethereum zero address
 		AddressIsZero,
-		/// Target collection doesn't supports this operation
+		/// Target collection doesn't support this operation
 		UnsupportedOperation,
 
-		/// Not sufficient funds to perform action
+		/// Insufficient funds to perform an action
 		NotSufficientFounds,
 
-		/// User not passed nesting rule
+		/// User does not satisfy the nesting rule
 		UserIsNotAllowedToNest,
-		/// Only tokens from specific collections may nest tokens under this
+		/// Only tokens from specific collections may nest tokens under this one
 		SourceCollectionIsNotAllowedToNest,
 
 		/// Tried to store more data than allowed in collection field
@@ -558,7 +558,7 @@
 		/// Property key is too long
 		PropertyKeyIsTooLong,
 
-		/// Only ASCII letters, digits, and '_', '-' are allowed
+		/// Only ASCII letters, digits, and symbols `_`, `-`, and `.` are allowed
 		InvalidCharacterInPropertyKey,
 
 		/// Empty property keys are forbidden
@@ -571,7 +571,7 @@
 		CollectionIsInternal,
 	}
 
-	/// Storage of the count of created collections.
+	/// Storage of the count of created collections. Essentially contains the last collection ID.
 	#[pallet::storage]
 	pub type CreatedCollectionCount<T> = StorageValue<Value = CollectionId, QueryKind = ValueQuery>;
 
@@ -600,7 +600,7 @@
 		OnEmpty = up_data_structs::CollectionProperties,
 	>;
 
-	/// Storage of collection properties permissions.
+	/// Storage of token property permissions of a collection.
 	#[pallet::storage]
 	#[pallet::getter(fn property_permissions)]
 	pub type CollectionPropertyPermissions<T> = StorageMap<
@@ -610,7 +610,7 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Storage of collection admins count.
+	/// Storage of the amount of collection admins.
 	#[pallet::storage]
 	pub type AdminAmount<T> = StorageMap<
 		Hasher = Blake2_128Concat,
@@ -619,7 +619,7 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// List of collection admins
+	/// List of collection admins.
 	#[pallet::storage]
 	pub type IsAdmin<T: Config> = StorageNMap<
 		Key = (
@@ -630,7 +630,7 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Allowlisted collection users
+	/// Allowlisted collection users.
 	#[pallet::storage]
 	pub type Allowlist<T: Config> = StorageNMap<
 		Key = (
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -119,8 +119,7 @@
 	pub enum Error<T> {
 		/// Not Fungible item data used to mint in Fungible collection.
 		NotFungibleDataUsedToMintFungibleCollectionToken,
-		/// Not default id passed as TokenId argument.
-		/// The default value of TokenId for Fungible collection is 0.
+		/// Fungible tokens hold no ID, and the default value of TokenId for Fungible collection is 0.
 		FungibleItemsHaveNoId,
 		/// Tried to set data for fungible item.
 		FungibleItemsDontHaveData,
@@ -157,7 +156,7 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Storage for delegated assets.
+	/// Storage for assets delegated to a limited extent to other users.
 	#[pallet::storage]
 	pub type Allowance<T: Config> = StorageNMap<
 		Key = (
@@ -172,7 +171,6 @@
 
 /// Wrapper around untyped collection handle, asserting inner collection is of fungible type.
 /// Required for interaction with Fungible collections, type safety and implementation [`solidity_interface`][`evm_coder::solidity_interface`].
-
 pub struct FungibleHandle<T: Config>(pallet_common::CollectionHandle<T>);
 
 /// Implementation of methods required for dispatching during runtime.
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -21,7 +21,7 @@
 //! - [`Config`]
 //! - [`NonfungibleHandle`]
 //! - [`Pallet`]
-//! - [`CommonWeights`]
+//! - [`CommonWeights`](common::CommonWeights)
 //!
 //! ## Overview
 //!
@@ -130,6 +130,8 @@
 pub type CreateItemData<T> = CreateNftExData<<T as pallet_evm::account::Config>::CrossAccountId>;
 pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
 
+/// Token data, stored independently from other data used to describe it
+/// for the convenience of database access. Notably contains the owner account address.
 #[struct_versioning::versioned(version = 2, upper)]
 #[derive(Encode, Decode, TypeInfo, MaxEncodedLen)]
 pub struct ItemData<CrossAccountId> {
@@ -176,17 +178,17 @@
 	#[pallet::generate_store(pub(super) trait Store)]
 	pub struct Pallet<T>(_);
 
-	/// Amount of tokens minted for collection.
+	/// Total amount of minted tokens in a collection.
 	#[pallet::storage]
 	pub type TokensMinted<T: Config> =
 		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
 
-	/// Amount of burnt tokens for collection.
+	/// Amount of burnt tokens in a collection.
 	#[pallet::storage]
 	pub type TokensBurnt<T: Config> =
 		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
 
-	/// Custom data serialized to bytes for token.
+	/// Token data, used to partially describe a token.
 	#[pallet::storage]
 	pub type TokenData<T: Config> = StorageNMap<
 		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
@@ -194,7 +196,7 @@
 		QueryKind = OptionQuery,
 	>;
 
-	/// Key-Value map stored for token.
+	/// Map of key-value pairs, describing the metadata of a token.
 	#[pallet::storage]
 	#[pallet::getter(fn token_properties)]
 	pub type TokenProperties<T: Config> = StorageNMap<
@@ -204,7 +206,14 @@
 		OnEmpty = up_data_structs::TokenProperties,
 	>;
 
-	/// Custom data that is serialized to bytes and attached to a token property.
+	/// Custom data of a token that is serialized to bytes,
+	/// primarily reserved for on-chain operations,
+	/// normally obscured from the external users.
+	///
+	/// Auxiliary properties are slightly different from
+	/// usual [`TokenProperties`] due to an unlimited number
+	/// and separately stored and written-to key-value pairs.
+	///
 	/// Currently used to store RMRK data.
 	#[pallet::storage]
 	#[pallet::getter(fn token_aux_property)]
@@ -244,7 +253,7 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Amount of tokens owned by account.
+	/// Amount of tokens owned by an account in a collection.
 	#[pallet::storage]
 	pub type AccountBalance<T: Config> = StorageNMap<
 		Key = (
@@ -255,7 +264,7 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Allowance set by an owner for a spender for a token.
+	/// Allowance set by a token owner for another user to perform one of certain transactions on a token.
 	#[pallet::storage]
 	pub type Allowance<T: Config> = StorageNMap<
 		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
@@ -263,6 +272,7 @@
 		QueryKind = OptionQuery,
 	>;
 
+	/// Upgrade from the old schema to properties.
 	#[pallet::hooks]
 	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
 		fn on_runtime_upgrade() -> Weight {
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -21,7 +21,7 @@
 //! - [`Config`]
 //! - [`RefungibleHandle`]
 //! - [`Pallet`]
-//! - [`CommonWeights`]
+//! - [`CommonWeights`](common::CommonWeights)
 //!
 //! ## Overview
 //!
@@ -119,6 +119,8 @@
 pub mod weights;
 pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
 
+/// Token data, stored independently from other data used to describe it
+/// for the convenience of database access. Notably contains the token metadata.
 #[struct_versioning::versioned(version = 2, upper)]
 #[derive(Encode, Decode, Default, TypeInfo, MaxEncodedLen)]
 pub struct ItemData {
@@ -143,13 +145,13 @@
 	pub enum Error<T> {
 		/// Not Refungible item data used to mint in Refungible collection.
 		NotRefungibleDataUsedToMintFungibleCollectionToken,
-		/// Maximum refungibility exceeded
+		/// Maximum refungibility exceeded.
 		WrongRefungiblePieces,
-		/// Refungible token can't be repartitioned by user who isn't owns all pieces
+		/// Refungible token can't be repartitioned by user who isn't owns all pieces.
 		RepartitionWhileNotOwningAllPieces,
-		/// Refungible token can't nest other tokens
+		/// Refungible token can't nest other tokens.
 		RefungibleDisallowsNesting,
-		/// Setting item properties is not allowed
+		/// Setting item properties is not allowed.
 		SettingPropertiesNotAllowed,
 	}
 
@@ -167,17 +169,17 @@
 	#[pallet::generate_store(pub(super) trait Store)]
 	pub struct Pallet<T>(_);
 
-	/// Amount of tokens minted for collection
+	/// Total amount of minted tokens in a collection.
 	#[pallet::storage]
 	pub type TokensMinted<T: Config> =
 		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
 
-	/// Amount of burnt tokens for collection
+	/// Amount of tokens burnt in a collection.
 	#[pallet::storage]
 	pub type TokensBurnt<T: Config> =
 		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
 
-	/// Custom data serialized to bytes for token
+	/// Token data, used to partially describe a token.
 	#[pallet::storage]
 	pub type TokenData<T: Config> = StorageNMap<
 		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
@@ -185,6 +187,7 @@
 		QueryKind = ValueQuery,
 	>;
 
+	/// Amount of pieces a refungible token is split into.
 	#[pallet::storage]
 	#[pallet::getter(fn token_properties)]
 	pub type TokenProperties<T: Config> = StorageNMap<
@@ -202,7 +205,7 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Used to enumerate tokens owned by account
+	/// Used to enumerate tokens owned by account.
 	#[pallet::storage]
 	pub type Owned<T: Config> = StorageNMap<
 		Key = (
@@ -214,7 +217,7 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Amount of tokens owned by account
+	/// Amount of tokens (not pieces) partially owned by an account within a collection.
 	#[pallet::storage]
 	pub type AccountBalance<T: Config> = StorageNMap<
 		Key = (
@@ -226,7 +229,7 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Amount of token pieces owned by account
+	/// Amount of token pieces owned by account.
 	#[pallet::storage]
 	pub type Balance<T: Config> = StorageNMap<
 		Key = (
@@ -239,7 +242,7 @@
 		QueryKind = ValueQuery,
 	>;
 
-	/// Allowance set by an owner for a spender for a token
+	/// Allowance set by a token owner for another user to perform one of certain transactions on a number of pieces of a token.
 	#[pallet::storage]
 	pub type Allowance<T: Config> = StorageNMap<
 		Key = (
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -24,7 +24,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-// 	http://www.apache.org/licenses/LICENSE-2.0
+// 	<http://www.apache.org/licenses/LICENSE-2.0>
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -50,7 +50,7 @@
 //! Also possible to book a call with a certain frequency.
 //!
 //! Key differences from the original pallet:
-//! https://crates.io/crates/pallet-scheduler
+//! <https://crates.io/crates/pallet-scheduler>
 //! Schedule Id restricted by 16 bytes. Identificator for booked call.
 //! Priority limited by HARD DEADLINE (<= 63). Calls over maximum weight don't include to block.
 //! The maximum weight that may be scheduled per block for any dispatchables of less priority than `schedule::HARD_DEADLINE`.
@@ -267,6 +267,7 @@
 
 	/// A Scheduler-Runtime interface for finer payment handling.
 	pub trait DispatchCall<T: frame_system::Config + Config, SelfContainedSignedInfo> {
+		/// Reserve (lock) the maximum spendings on a call, calculated from its weight and the repetition count.
 		fn reserve_balance(
 			id: ScheduledId,
 			sponsor: <T as frame_system::Config>::AccountId,
@@ -274,7 +275,7 @@
 			count: u32,
 		) -> Result<(), DispatchError>;
 
-		/// Unlock centain amount from payer
+		/// Unreserve (unlock) a certain amount from the payer's reserved funds, returning the change.
 		fn pay_for_call(
 			id: ScheduledId,
 			sponsor: <T as frame_system::Config>::AccountId,
@@ -290,6 +291,7 @@
 			TransactionValidityError,
 		>;
 
+		/// Release unspent reserved funds in case of a schedule cancel.
 		fn cancel_reserve(
 			id: ScheduledId,
 			sponsor: <T as frame_system::Config>::AccountId,
@@ -494,9 +496,8 @@
 					Agenda::<T>::append(wake, Some(s));
 				}
 			}
-			/// Weight should be 0, because transaction already paid
+			// Total weight should be 0, because the transaction is already paid for
 			0
-			//total_weight
 		}
 	}
 
modifiedpallets/structure/src/lib.rsdiffbeforeafterboth
--- a/pallets/structure/src/lib.rs
+++ b/pallets/structure/src/lib.rs
@@ -78,19 +78,19 @@
 
 	#[pallet::error]
 	pub enum Error<T> {
-		/// While searched for owner, got already checked account
+		/// While nesting, encountered an already checked account, detecting a loop.
 		OuroborosDetected,
-		/// While searched for owner, encountered depth limit
+		/// While nesting, reached the depth limit of nesting, exceeding the provided budget.
 		DepthLimit,
-		/// While iterating over children, encountered breadth limit
+		/// While nesting, reached the breadth limit of nesting, exceeding the provided budget.
 		BreadthLimit,
-		/// While searched for owner, found token owner by not-yet-existing token
+		/// Couldn't find the token owner that is itself a token.
 		TokenNotFound,
 	}
 
 	#[pallet::event]
 	pub enum Event<T> {
-		/// Executed call on behalf of token
+		/// Executed call on behalf of the token.
 		Executed(DispatchResult),
 	}
 
@@ -126,11 +126,11 @@
 
 #[derive(PartialEq)]
 pub enum Parent<CrossAccountId> {
-	/// Token owned by normal account
+	/// Token owned by a normal account.
 	User(CrossAccountId),
-	/// Passed token not found
+	/// Could not find the token provided as the owner.
 	TokenNotFound,
-	/// Token owner is another token (target token still may not exist)
+	/// Token owner is another token (still, the target token may not exist).
 	Token(CollectionId, TokenId),
 }
 
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -14,6 +14,8 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+//! Implementation of CollectionHelpers contract.
+
 use core::marker::PhantomData;
 use evm_coder::{execution::*, generate_stubgen, solidity_interface, weight, types::*};
 use ethereum as _;
@@ -33,7 +35,8 @@
 use sp_std::vec::Vec;
 use alloc::format;
 
-struct EvmCollectionHelpers<T: Config>(SubstrateRecorder<T>);
+/// See [`CollectionHelpersCall`]
+pub struct EvmCollectionHelpers<T: Config>(SubstrateRecorder<T>);
 impl<T: Config> WithRecorder<T> for EvmCollectionHelpers<T> {
 	fn recorder(&self) -> &SubstrateRecorder<T> {
 		&self.0
@@ -44,8 +47,14 @@
 	}
 }
 
+/// @title Contract, which allows users to operate with collections
 #[solidity_interface(name = "CollectionHelpers", events(CollectionHelpersEvents))]
 impl<T: Config + pallet_nonfungible::Config> EvmCollectionHelpers<T> {
+	/// Create an NFT collection
+	/// @param name Name of the collection
+	/// @param description Informative description of the collection
+	/// @param token_prefix Token prefix to represent the collection tokens in UI and user applications
+	/// @return address Address of the newly created collection
 	#[weight(<SelfWeightOf<T>>::create_collection())]
 	fn create_nonfungible_collection(
 		&mut self,
@@ -100,6 +109,9 @@
 		Ok(address)
 	}
 
+	/// Check if a collection exists
+	/// @param collection_address Address of the collection in question
+	/// @return bool Does the collection exist?
 	fn is_collection_exist(&self, _caller: caller, collection_address: address) -> Result<bool> {
 		if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) {
 			let collection_id = id;
@@ -110,6 +122,7 @@
 	}
 }
 
+/// Implements [`OnMethodCall`], which delegates call to [`EvmCollectionHelpers`]
 pub struct CollectionHelpersOnMethodCall<T: Config>(PhantomData<*const T>);
 impl<T: Config + pallet_nonfungible::Config> OnMethodCall<T> for CollectionHelpersOnMethodCall<T> {
 	fn is_reserved(contract: &sp_core::H160) -> bool {
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -14,6 +14,55 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+//! # Unique Pallet
+//!
+//! A pallet governing Unique transactions.
+//!
+//! - [`Config`]
+//! - [`Call`]
+//! - [`Pallet`]
+//!
+//! ## Overview
+//!
+//! The Unique pallet's purpose is to be the primary interface between
+//! external users and the inner structure of the Unique chains.
+//!
+//! It also contains an implementation of [`CollectionHelpers`][`eth`],
+//! an Ethereum contract dealing with collection operations.
+//!
+//! ## Interface
+//!
+//! ### Dispatchables
+//!
+//! - `create_collection` - Create a collection of tokens. **Deprecated**, use `create_collection_ex`.
+//! - `create_collection_ex` - Create a collection of tokens with explicit parameters.
+//! - `destroy_collection` - Destroy a collection if no tokens exist within.
+//! - `add_to_allow_list` - Add an address to allow list.
+//! - `remove_from_allow_list` - Remove an address from allow list.
+//! - `change_collection_owner` - Change the owner of the collection.
+//! - `add_collection_admin` - Add an admin to a collection.
+//! - `remove_collection_admin` - Remove admin of a collection.
+//! - `set_collection_sponsor` - Invite a new collection sponsor.
+//! - `confirm_sponsorship` - Confirm own sponsorship of a collection, becoming the sponsor.
+//! - `remove_collection_sponsor` - Remove a sponsor from a collection.
+//! - `create_item` - Create an item within a collection.
+//! - `create_multiple_items` - Create multiple items within a collection.
+//! - `set_collection_properties` - Add or change collection properties.
+//! - `delete_collection_properties` - Delete specified collection properties.
+//! - `set_token_properties` - Add or change token properties.
+//! - `delete_token_properties` - Delete token properties.
+//! - `set_token_property_permissions` - Add or change token property permissions of a collection.
+//! - `create_multiple_items_ex` - Create multiple items within a collection with explicitly specified initial parameters.
+//! - `set_transfers_enabled_flag` - Completely allow or disallow transfers for a particular collection.
+//! - `burn_item` - Destroy an item.
+//! - `burn_from` - Destroy an item on behalf of the owner as a non-owner account.
+//! - `transfer` - Change ownership of the token.
+//! - `transfer_from` - Change ownership of the token on behalf of the owner as a non-owner account.
+//! - `approve` - Allow a non-permissioned address to transfer or burn an item.
+//! - `set_collection_limits` - Set specific limits of a collection.
+//! - `set_collection_permissions` - Set specific permissions of a collection.
+//! - `repartition` - Re-partition a refungible token, while owning all of its parts.
+
 #![recursion_limit = "1024"]
 #![cfg_attr(not(feature = "std"), no_std)]
 #![allow(
@@ -54,28 +103,35 @@
 pub mod weights;
 use weights::WeightInfo;
 
-const NESTING_BUDGET: u32 = 5;
+/// Maximum number of levels of depth in the token nesting tree.
+pub const NESTING_BUDGET: u32 = 5;
 
 decl_error! {
-	/// Error for non-fungible-token module.
+	/// Errors for the common Unique transactions.
 	pub enum Error for Module<T: Config> {
-		/// Decimal_points parameter must be lower than MAX_DECIMAL_POINTS constant, currently it is 30.
+		/// Decimal_points parameter must be lower than [`up_data_structs::MAX_DECIMAL_POINTS`].
 		CollectionDecimalPointLimitExceeded,
 		/// This address is not set as sponsor, use setCollectionSponsor first.
 		ConfirmUnsetSponsorFail,
 		/// Length of items properties must be greater than 0.
 		EmptyArgument,
-		/// Repertition is only supported by refungible collection
+		/// Repertition is only supported by refungible collection.
 		RepartitionCalledOnNonRefungibleCollection,
 	}
 }
 
+/// Configuration trait of this pallet.
 pub trait Config: system::Config + pallet_common::Config + Sized + TypeInfo {
+	/// Overarching event type.
 	type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
 
 	/// Weight information for extrinsics in this pallet.
 	type WeightInfo: WeightInfo;
+
+	/// Weight information for common pallet operations.
 	type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;
+
+	/// Weight info information for extra refungible pallet operations.
 	type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo;
 }
 
@@ -88,80 +144,68 @@
 		/// Collection sponsor was removed
 		///
 		/// # Arguments
-		///
-		/// * collection_id: Globally unique collection identifier.
+		/// * collection_id: ID of the affected collection.
 		CollectionSponsorRemoved(CollectionId),
 
 		/// Collection admin was added
 		///
 		/// # Arguments
-		///
-		/// * collection_id: Globally unique collection identifier.
-		///
-		/// * admin:  Admin address.
+		/// * collection_id: ID of the affected collection.
+		/// * admin: Admin address.
 		CollectionAdminAdded(CollectionId, CrossAccountId),
 
-		/// Collection owned was change
+		/// Collection owned was changed
 		///
 		/// # Arguments
-		///
-		/// * collection_id: Globally unique collection identifier.
-		///
-		/// * owner:  New owner address.
+		/// * collection_id: ID of the affected collection.
+		/// * owner: New owner address.
 		CollectionOwnedChanged(CollectionId, AccountId),
 
 		/// Collection sponsor was set
 		///
 		/// # Arguments
-		///
-		/// * collection_id: Globally unique collection identifier.
-		///
-		/// * owner:  New sponsor address.
+		/// * collection_id: ID of the affected collection.
+		/// * owner: New sponsor address.
 		CollectionSponsorSet(CollectionId, AccountId),
 
 		/// New sponsor was confirm
 		///
 		/// # Arguments
-		///
-		/// * collection_id: Globally unique collection identifier.
-		///
-		/// * sponsor:  New sponsor address.
+		/// * collection_id: ID of the affected collection.
+		/// * sponsor: New sponsor address.
 		SponsorshipConfirmed(CollectionId, AccountId),
 
 		/// Collection admin was removed
 		///
 		/// # Arguments
-		///
-		/// * collection_id: Globally unique collection identifier.
-		///
-		/// * admin:  Admin address.
+		/// * collection_id: ID of the affected collection.
+		/// * admin: Removed admin address.
 		CollectionAdminRemoved(CollectionId, CrossAccountId),
 
-		/// Address was remove from allow list
+		/// Address was removed from the allow list
 		///
 		/// # Arguments
-		///
-		/// * collection_id: Globally unique collection identifier.
-		///
-		/// * user:  Address.
+		/// * collection_id: ID of the affected collection.
+		/// * user: Address of the removed account.
 		AllowListAddressRemoved(CollectionId, CrossAccountId),
 
-		/// Address was add to allow list
+		/// Address was added to the allow list
 		///
 		/// # Arguments
-		///
-		/// * collection_id: Globally unique collection identifier.
-		///
-		/// * user:  Address.
+		/// * collection_id: ID of the affected collection.
+		/// * user: Address of the added account.
 		AllowListAddressAdded(CollectionId, CrossAccountId),
 
-		/// Collection limits was set
+		/// Collection limits were set
 		///
 		/// # Arguments
-		///
-		/// * collection_id: Globally unique collection identifier.
+		/// * collection_id: ID of the affected collection.
 		CollectionLimitSet(CollectionId),
 
+		/// Collection permissions were set
+		///
+		/// # Arguments
+		/// * collection_id: ID of the affected collection.
 		CollectionPermissionSet(CollectionId),
 	}
 }
@@ -198,7 +242,7 @@
 		ChainVersion: u64;
 		//#endregion
 
-		//#region Tokens transfer rate limit baskets
+		//#region Tokens transfer sponosoring rate limit baskets
 		/// (Collection id (controlled?2), who created (real))
 		/// TODO: Off chain worker should remove from this map when collection gets removed
 		pub CreateItemBasket get(fn create_item_basket): map hasher(blake2_128_concat) (CollectionId, T::AccountId) => Option<T::BlockNumber>;
@@ -214,16 +258,20 @@
 		/// Collection id (controlled?2), token id (controlled?2)
 		#[deprecated]
 		pub VariableMetaDataBasket get(fn variable_meta_data_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;
+		/// Last sponsoring of token property setting // todo:doc rephrase this and the following
 		pub TokenPropertyBasket get(fn token_property_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;
 
-		/// Approval sponsoring
+		/// Last sponsoring of NFT approval in a collection
 		pub NftApproveBasket get(fn nft_approve_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;
+		/// Last sponsoring of fungible tokens approval in a collection
 		pub FungibleApproveBasket get(fn fungible_approve_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(twox_64_concat) T::AccountId => Option<T::BlockNumber>;
+		/// Last sponsoring of RFT approval in a collection
 		pub RefungibleApproveBasket get(fn refungible_approve_basket): nmap hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId, hasher(twox_64_concat) T::AccountId => Option<T::BlockNumber>;
 	}
 }
 
 decl_module! {
+	/// Type alias to Pallet, to be used by construct_runtime.
 	pub struct Module<T: Config> for enum Call
 	where
 		origin: T::Origin
@@ -244,30 +292,38 @@
 			0
 		}
 
-		/// This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner of the collection is set to the address that signed the transaction and can be changed later.
-		///
-		/// # Permissions
+		/// Create a collection of tokens.
 		///
-		/// * Anyone.
+		/// Each Token may have multiple properties encoded as an array of bytes
+		/// of certain length. The initial owner of the collection is set
+		/// to the address that signed the transaction and can be changed later.
 		///
-		/// # Arguments
+		/// Prefer the more advanced [`create_collection_ex`][`Pallet::create_collection_ex`] instead.
 		///
-		/// * collection_name: UTF-16 string with collection name (limit 64 characters), will be stored as zero-terminated.
+		/// # Permissions
 		///
-		/// * collection_description: UTF-16 string with collection description (limit 256 characters), will be stored as zero-terminated.
+		/// * Anyone - becomes the owner of the new collection.
 		///
-		/// * token_prefix: UTF-8 string with token prefix.
+		/// # Arguments
 		///
-		/// * mode: [CollectionMode] collection type and type dependent data.
+		/// * `collection_name`: Wide-character string with collection name
+		/// (limit [`MAX_COLLECTION_NAME_LENGTH`]).
+		/// * `collection_description`: Wide-character string with collection description
+		/// (limit [`MAX_COLLECTION_DESCRIPTION_LENGTH`]).
+		/// * `token_prefix`: Byte string containing the token prefix to mark a collection
+		/// to which a token belongs (limit [`MAX_TOKEN_PREFIX_LENGTH`]).
+		/// * `mode`: Type of items stored in the collection and type dependent data.
 		// returns collection ID
 		#[weight = <SelfWeightOf<T>>::create_collection()]
 		#[transactional]
-		#[deprecated]
-		pub fn create_collection(origin,
-								 collection_name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,
-								 collection_description: BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>,
-								 token_prefix: BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>,
-								 mode: CollectionMode) -> DispatchResult  {
+		#[deprecated(note = "`create_collection_ex` is more up-to-date and advanced, prefer it instead")]
+		pub fn create_collection(
+			origin,
+			collection_name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,
+			collection_description: BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>,
+			token_prefix: BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>,
+			mode: CollectionMode
+		) -> DispatchResult {
 			let data: CreateCollectionData<T::AccountId> = CreateCollectionData {
 				name: collection_name,
 				description: collection_description,
@@ -278,9 +334,17 @@
 			Self::create_collection_ex(origin, data)
 		}
 
-		/// This method creates a collection
+		/// Create a collection with explicit parameters.
+		///
+		/// Prefer it to the deprecated [`create_collection`][`Pallet::create_collection`] method.
+		///
+		/// # Permissions
+		///
+		/// * Anyone - becomes the owner of the new collection.
 		///
-		/// Prefer it to deprecated [`created_collection`] method
+		/// # Arguments
+		///
+		/// * `data`: Explicit data of a collection used for its creation.
 		#[weight = <SelfWeightOf<T>>::create_collection()]
 		#[transactional]
 		pub fn create_collection_ex(origin, data: CreateCollectionData<T::AccountId>) -> DispatchResult {
@@ -293,15 +357,15 @@
 			Ok(())
 		}
 
-		/// Destroys collection if no tokens within this collection
+		/// Destroy a collection if no tokens exist within.
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner.
+		/// * Collection owner
 		///
 		/// # Arguments
 		///
-		/// * collection_id: collection to destroy.
+		/// * `collection_id`: Collection to destroy.
 		#[weight = <SelfWeightOf<T>>::destroy_collection()]
 		#[transactional]
 		pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {
@@ -328,14 +392,13 @@
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner
-		/// * Collection Admin
+		/// * Collection owner
+		/// * Collection admin
 		///
 		/// # Arguments
 		///
-		/// * collection_id.
-		///
-		/// * address.
+		/// * `collection_id`: ID of the modified collection.
+		/// * `address`: ID of the address to be added to the allowlist.
 		#[weight = <SelfWeightOf<T>>::add_to_allow_list()]
 		#[transactional]
 		pub fn add_to_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
@@ -363,14 +426,13 @@
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner
-		/// * Collection Admin
+		/// * Collection owner
+		/// * Collection admin
 		///
 		/// # Arguments
 		///
-		/// * collection_id.
-		///
-		/// * address.
+		/// * `collection_id`: ID of the modified collection.
+		/// * `address`: ID of the address to be removed from the allowlist.
 		#[weight = <SelfWeightOf<T>>::remove_from_allow_list()]
 		#[transactional]
 		pub fn remove_from_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
@@ -398,13 +460,12 @@
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner.
+		/// * Collection owner
 		///
 		/// # Arguments
 		///
-		/// * collection_id.
-		///
-		/// * new_owner.
+		/// * `collection_id`: ID of the modified collection.
+		/// * `new_owner`: ID of the account that will become the owner.
 		#[weight = <SelfWeightOf<T>>::change_collection_owner()]
 		#[transactional]
 		pub fn change_collection_owner(origin, collection_id: CollectionId, new_owner: T::AccountId) -> DispatchResult {
@@ -424,46 +485,51 @@
 			target_collection.save()
 		}
 
-		/// Adds an admin of the Collection.
-		/// NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.
+		/// Add an admin to a collection.
 		///
+		/// NFT Collection can be controlled by multiple admin addresses
+		/// (some which can also be servers, for example). Admins can issue
+		/// and burn NFTs, as well as add and remove other admins,
+		/// but cannot change NFT or Collection ownership.
+		///
 		/// # Permissions
 		///
-		/// * Collection Owner.
-		/// * Collection Admin.
+		/// * Collection owner
+		/// * Collection admin
 		///
 		/// # Arguments
 		///
-		/// * collection_id: ID of the Collection to add admin for.
-		///
-		/// * new_admin_id: Address of new admin to add.
+		/// * `collection_id`: ID of the Collection to add an admin for.
+		/// * `new_admin`: Address of new admin to add.
 		#[weight = <SelfWeightOf<T>>::add_collection_admin()]
 		#[transactional]
-		pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin_id: T::CrossAccountId) -> DispatchResult {
+		pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin: T::CrossAccountId) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let collection = <CollectionHandle<T>>::try_get(collection_id)?;
 			collection.check_is_internal()?;
 
 			<Pallet<T>>::deposit_event(Event::<T>::CollectionAdminAdded(
 				collection_id,
-				new_admin_id.clone()
+				new_admin.clone()
 			));
 
-			<PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin_id, true)
+			<PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin, true)
 		}
 
-		/// Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.
+		/// Remove admin of a collection.
+		///
+		/// An admin address can remove itself. List of admins may become empty,
+		/// in which case only Collection Owner will be able to add an Admin.
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner.
-		/// * Collection Admin.
+		/// * Collection owner
+		/// * Collection admin
 		///
 		/// # Arguments
 		///
-		/// * collection_id: ID of the Collection to remove admin for.
-		///
-		/// * account_id: Address of admin to remove.
+		/// * `collection_id`: ID of the collection to remove the admin for.
+		/// * `account_id`: Address of the admin to remove.
 		#[weight = <SelfWeightOf<T>>::remove_collection_admin()]
 		#[transactional]
 		pub fn remove_collection_admin(origin, collection_id: CollectionId, account_id: T::CrossAccountId) -> DispatchResult {
@@ -479,15 +545,19 @@
 			<PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)
 		}
 
+		/// Set (invite) a new collection sponsor.
+		///
+		/// If successful, confirmation from the sponsor-to-be will be pending.
+		///
 		/// # Permissions
 		///
-		/// * Collection Owner
+		/// * Collection owner
+		/// * Collection admin
 		///
 		/// # Arguments
 		///
-		/// * collection_id.
-		///
-		/// * new_sponsor.
+		/// * `collection_id`: ID of the modified collection.
+		/// * `new_sponsor`: ID of the account of the sponsor-to-be.
 		#[weight = <SelfWeightOf<T>>::set_collection_sponsor()]
 		#[transactional]
 		pub fn set_collection_sponsor(origin, collection_id: CollectionId, new_sponsor: T::AccountId) -> DispatchResult {
@@ -507,13 +577,19 @@
 			target_collection.save()
 		}
 
+		/// Confirm own sponsorship of a collection, becoming the sponsor.
+		///
+		/// An invitation must be pending, see [`set_collection_sponsor`][`Pallet::set_collection_sponsor`].
+		/// Sponsor can pay the fees of a transaction instead of the sender,
+		/// but only within specified limits.
+		///
 		/// # Permissions
 		///
-		/// * Sponsor.
+		/// * Sponsor-to-be
 		///
 		/// # Arguments
 		///
-		/// * collection_id.
+		/// * `collection_id`: ID of the collection with the pending sponsor.
 		#[weight = <SelfWeightOf<T>>::confirm_sponsorship()]
 		#[transactional]
 		pub fn confirm_sponsorship(origin, collection_id: CollectionId) -> DispatchResult {
@@ -534,15 +610,15 @@
 			target_collection.save()
 		}
 
-		/// Switch back to pay-per-own-transaction model.
+		/// Remove a collection's a sponsor, making everyone pay for their own transactions.
 		///
 		/// # Permissions
 		///
-		/// * Collection owner.
+		/// * Collection owner
 		///
 		/// # Arguments
 		///
-		/// * collection_id.
+		/// * `collection_id`: ID of the collection with the sponsor to remove.
 		#[weight = <SelfWeightOf<T>>::remove_collection_sponsor()]
 		#[transactional]
 		pub fn remove_collection_sponsor(origin, collection_id: CollectionId) -> DispatchResult {
@@ -560,24 +636,24 @@
 			target_collection.save()
 		}
 
-		/// This method creates a concrete instance of NFT Collection created with CreateCollection method.
+		/// Mint an item within a collection.
+		///
+		/// A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner.
-		/// * Collection Admin.
+		/// * Collection owner
+		/// * Collection admin
 		/// * Anyone if
 		///     * Allow List is enabled, and
 		///     * Address is added to allow list, and
-		///     * MintPermission is enabled (see SetMintPermission method)
+		///     * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])
 		///
 		/// # Arguments
-		///
-		/// * collection_id: ID of the collection.
 		///
-		/// * owner: Address, initial owner of the NFT.
-		///
-		/// * data: Token data to store on chain.
+		/// * `collection_id`: ID of the collection to which an item would belong.
+		/// * `owner`: Address of the initial owner of the item.
+		/// * `data`: Token data describing the item to store on chain.
 		#[weight = T::CommonWeightInfo::create_item()]
 		#[transactional]
 		pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResultWithPostInfo {
@@ -587,24 +663,24 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.create_item(sender, owner, data, &budget))
 		}
 
-		/// This method creates multiple items in a collection created with CreateCollection method.
+		/// Create multiple items within a collection.
 		///
+		/// A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].
+		///
 		/// # Permissions
 		///
-		/// * Collection Owner.
-		/// * Collection Admin.
+		/// * Collection owner
+		/// * Collection admin
 		/// * Anyone if
 		///     * Allow List is enabled, and
-		///     * Address is added to allow list, and
-		///     * MintPermission is enabled (see SetMintPermission method)
+		///     * Address is added to the allow list, and
+		///     * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])
 		///
 		/// # Arguments
 		///
-		/// * collection_id: ID of the collection.
-		///
-		/// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
-		///
-		/// * owner: Address, initial owner of the NFT.
+		/// * `collection_id`: ID of the collection to which the tokens would belong.
+		/// * `owner`: Address of the initial owner of the tokens.
+		/// * `items_data`: Vector of data describing each item to be created.
 		#[weight = T::CommonWeightInfo::create_multiple_items(&items_data)]
 		#[transactional]
 		pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResultWithPostInfo {
@@ -615,6 +691,18 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.create_multiple_items(sender, owner, items_data, &budget))
 		}
 
+		/// Add or change collection properties.
+		///
+		/// # Permissions
+		///
+		/// * Collection owner
+		/// * Collection admin
+		///
+		/// # Arguments
+		///
+		/// * `collection_id`: ID of the modified collection.
+		/// * `properties`: Vector of key-value pairs stored as the collection's metadata.
+		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[weight = T::CommonWeightInfo::set_collection_properties(properties.len() as u32)]
 		#[transactional]
 		pub fn set_collection_properties(
@@ -629,6 +717,18 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.set_collection_properties(sender, properties))
 		}
 
+		/// Delete specified collection properties.
+		///
+		/// # Permissions
+		///
+		/// * Collection Owner
+		/// * Collection Admin
+		///
+		/// # Arguments
+		///
+		/// * `collection_id`: ID of the modified collection.
+		/// * `property_keys`: Vector of keys of the properties to be deleted.
+		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[weight = T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32)]
 		#[transactional]
 		pub fn delete_collection_properties(
@@ -643,6 +743,24 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.delete_collection_properties(&sender, property_keys))
 		}
 
+		/// Add or change token properties according to collection's permissions.
+		/// Currently properties only work with NFTs.
+		///
+		/// # Permissions
+		///
+		/// * Depends on collection's token property permissions and specified property mutability:
+		/// 	* Collection owner
+		/// 	* Collection admin
+		/// 	* Token owner
+		///
+		/// See [`set_token_property_permissions`][`Pallet::set_token_property_permissions`].
+		///
+		/// # Arguments
+		///
+		/// * `collection_id: ID of the collection to which the token belongs.
+		/// * `token_id`: ID of the modified token.
+		/// * `properties`: Vector of key-value pairs stored as the token's metadata.
+		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]
 		#[transactional]
 		pub fn set_token_properties(
@@ -659,6 +777,21 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.set_token_properties(sender, token_id, properties, &budget))
 		}
 
+		/// Delete specified token properties. Currently properties only work with NFTs.
+		///
+		/// # Permissions
+		///
+		/// * Depends on collection's token property permissions and specified property mutability:
+		/// 	* Collection owner
+		/// 	* Collection admin
+		/// 	* Token owner
+		///
+		/// # Arguments
+		///
+		/// * `collection_id`: ID of the collection to which the token belongs.
+		/// * `token_id`: ID of the modified token.
+		/// * `property_keys`: Vector of keys of the properties to be deleted.
+		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[weight = T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32)]
 		#[transactional]
 		pub fn delete_token_properties(
@@ -675,6 +808,21 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, property_keys, &budget))
 		}
 
+		/// Add or change token property permissions of a collection.
+		///
+		/// Without a permission for a particular key, a property with that key
+		/// cannot be created in a token.
+		///
+		/// # Permissions
+		///
+		/// * Collection owner
+		/// * Collection admin
+		///
+		/// # Arguments
+		///
+		/// * `collection_id`: ID of the modified collection.
+		/// * `property_permissions`: Vector of permissions for property keys.
+		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[weight = T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32)]
 		#[transactional]
 		pub fn set_token_property_permissions(
@@ -689,6 +837,21 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.set_token_property_permissions(&sender, property_permissions))
 		}
 
+		/// Create multiple items within a collection with explicitly specified initial parameters.
+		///
+		/// # Permissions
+		///
+		/// * Collection owner
+		/// * Collection admin
+		/// * Anyone if
+		///     * Allow List is enabled, and
+		///     * Address is added to allow list, and
+		///     * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])
+		///
+		/// # Arguments
+		///
+		/// * `collection_id`: ID of the collection to which the tokens would belong.
+		/// * `data`: Explicit item creation data.
 		#[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]
 		#[transactional]
 		pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {
@@ -698,17 +861,16 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.create_multiple_items_ex(sender, data, &budget))
 		}
 
-		/// Set transfers_enabled value for particular collection
+		/// Completely allow or disallow transfers for a particular collection.
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner.
+		/// * Collection owner
 		///
 		/// # Arguments
 		///
-		/// * collection_id: ID of the collection.
-		///
-		/// * value: New flag value.
+		/// * `collection_id`: ID of the collection.
+		/// * `value`: New value of the flag, are transfers allowed?
 		#[weight = <SelfWeightOf<T>>::set_transfers_enabled_flag()]
 		#[transactional]
 		pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {
@@ -723,19 +885,22 @@
 			target_collection.save()
 		}
 
-		/// Destroys a concrete instance of NFT.
+		/// Destroy an item.
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner.
-		/// * Collection Admin.
-		/// * Current NFT Owner.
+		/// * Collection owner
+		/// * Collection admin
+		/// * Current item owner
 		///
 		/// # Arguments
 		///
-		/// * collection_id: ID of the collection.
-		///
-		/// * item_id: ID of NFT to burn.
+		/// * `collection_id`: ID of the collection to which the item belongs.
+		/// * `item_id`: ID of item to burn.
+		/// * `value`: Number of pieces of the item to destroy.
+		/// 	* Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+		///     * Fungible Mode: The desired number of pieces to burn.
+		///     * Re-Fungible Mode: The desired number of pieces to burn.
 		#[weight = T::CommonWeightInfo::burn_item()]
 		#[transactional]
 		pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
@@ -752,22 +917,29 @@
 			Ok(post_info)
 		}
 
-		/// Destroys a concrete instance of NFT on behalf of the owner
-		/// See also: [`approve`]
+		/// Destroy a token on behalf of the owner as a non-owner account.
+		///
+		/// See also: [`approve`][`Pallet::approve`].
+		///
+		/// After this method executes, one approval is removed from the total so that
+		/// the approved address will not be able to transfer this item again from this owner.
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner.
-		/// * Collection Admin.
-		/// * Current NFT Owner.
+		/// * Collection owner
+		/// * Collection admin
+		/// * Current token owner
+		/// * Address approved by current item owner
 		///
 		/// # Arguments
 		///
-		/// * collection_id: ID of the collection.
-		///
-		/// * item_id: ID of NFT to burn.
-		///
-		/// * from: owner of item
+		/// * `from`: The owner of the burning item.
+		/// * `collection_id`: ID of the collection to which the item belongs.
+		/// * `item_id`: ID of item to burn.
+		/// * `value`: Number of pieces to burn.
+		/// 	* Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+		///     * Fungible Mode: The desired number of pieces to burn.
+		///     * Re-Fungible Mode: The desired number of pieces to burn.
 		#[weight = T::CommonWeightInfo::burn_from()]
 		#[transactional]
 		pub fn burn_from(origin, collection_id: CollectionId, from: T::CrossAccountId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
@@ -781,25 +953,23 @@
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner
-		/// * Collection Admin
-		/// * Current NFT owner
+		/// * Collection owner
+		/// * Collection admin
+		/// * Current token owner
 		///
 		/// # Arguments
-		///
-		/// * recipient: Address of token recipient.
 		///
-		/// * collection_id.
-		///
-		/// * item_id: ID of the item
+		/// * `recipient`: Address of token recipient.
+		/// * `collection_id`: ID of the collection the item belongs to.
+		/// * `item_id`: ID of the item.
 		///     * Non-Fungible Mode: Required.
 		///     * Fungible Mode: Ignored.
 		///     * Re-Fungible Mode: Required.
 		///
-		/// * value: Amount to transfer.
-		///     * Non-Fungible Mode: Ignored
-		///     * Fungible Mode: Must specify transferred amount
-		///     * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)
+		/// * `value`: Amount to transfer.
+		/// 	* Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+		///     * Fungible Mode: The desired number of pieces to transfer.
+		///     * Re-Fungible Mode: The desired number of pieces to transfer.
 		#[weight = T::CommonWeightInfo::transfer()]
 		#[transactional]
 		pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
@@ -809,21 +979,21 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.transfer(sender, recipient, item_id, value, &budget))
 		}
 
-		/// Set, change, or remove approved address to transfer the ownership of the NFT.
+		/// Allow a non-permissioned address to transfer or burn an item.
 		///
 		/// # Permissions
 		///
-		/// * Collection Owner
-		/// * Collection Admin
-		/// * Current NFT owner
+		/// * Collection owner
+		/// * Collection admin
+		/// * Current item owner
 		///
 		/// # Arguments
 		///
-		/// * approved: Address that is approved to transfer this NFT or zero (if needed to remove approval).
-		///
-		/// * collection_id.
-		///
-		/// * item_id: ID of the item.
+		/// * `spender`: Account to be approved to make specific transactions on non-owned tokens.
+		/// * `collection_id`: ID of the collection the item belongs to.
+		/// * `item_id`: ID of the item transactions on which are now approved.
+		/// * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).
+		/// Set to 0 to revoke the approval.
 		#[weight = T::CommonWeightInfo::approve()]
 		#[transactional]
 		pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResultWithPostInfo {
@@ -832,25 +1002,30 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.approve(sender, spender, item_id, amount))
 		}
 
-		/// Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.
+		/// Change ownership of an item on behalf of the owner as a non-owner account.
 		///
-		/// # Permissions
-		/// * Collection Owner
-		/// * Collection Admin
-		/// * Current NFT owner
-		/// * Address approved by current NFT owner
+		/// See the [`approve`][`Pallet::approve`] method for additional information.
 		///
-		/// # Arguments
+		/// After this method executes, one approval is removed from the total so that
+		/// the approved address will not be able to transfer this item again from this owner.
 		///
-		/// * from: Address that owns token.
+		/// # Permissions
 		///
-		/// * recipient: Address of token recipient.
+		/// * Collection owner
+		/// * Collection admin
+		/// * Current item owner
+		/// * Address approved by current item owner
 		///
-		/// * collection_id.
+		/// # Arguments
 		///
-		/// * item_id: ID of the item.
-		///
-		/// * value: Amount to transfer.
+		/// * `from`: Address that currently owns the token.
+		/// * `recipient`: Address of the new token-owner-to-be.
+		/// * `collection_id`: ID of the collection the item.
+		/// * `item_id`: ID of the item to be transferred.
+		/// * `value`: Amount to transfer.
+		/// 	* Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+		///     * Fungible Mode: The desired number of pieces to transfer.
+		///     * Re-Fungible Mode: The desired number of pieces to transfer.
 		#[weight = T::CommonWeightInfo::transfer_from()]
 		#[transactional]
 		pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResultWithPostInfo {
@@ -860,6 +1035,18 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.transfer_from(sender, from, recipient, item_id, value, &budget))
 		}
 
+		/// Set specific limits of a collection. Empty, or None fields mean chain default.
+		///
+		/// # Permissions
+		///
+		/// * Collection owner
+		/// * Collection admin
+		///
+		/// # Arguments
+		///
+		/// * `collection_id`: ID of the modified collection.
+		/// * `new_limit`: New limits of the collection. Fields that are not set (None)
+		/// will not overwrite the old ones.
 		#[weight = <SelfWeightOf<T>>::set_collection_limits()]
 		#[transactional]
 		pub fn set_collection_limits(
@@ -882,12 +1069,24 @@
 			target_collection.save()
 		}
 
+		/// Set specific permissions of a collection. Empty, or None fields mean chain default.
+		///
+		/// # Permissions
+		///
+		/// * Collection owner
+		/// * Collection admin
+		///
+		/// # Arguments
+		///
+		/// * `collection_id`: ID of the modified collection.
+		/// * `new_permission`: New permissions of the collection. Fields that are not set (None)
+		/// will not overwrite the old ones.
 		#[weight = <SelfWeightOf<T>>::set_collection_limits()]
 		#[transactional]
 		pub fn set_collection_permissions(
 			origin,
 			collection_id: CollectionId,
-			new_limit: CollectionPermissions,
+			new_permission: CollectionPermissions,
 		) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
@@ -895,7 +1094,7 @@
 			target_collection.check_is_owner_or_admin(&sender)?;
 			let old_limit = &target_collection.permissions;
 
-			target_collection.permissions = <PalletCommon<T>>::clamp_permissions(target_collection.mode.clone(), &old_limit, new_limit)?;
+			target_collection.permissions = <PalletCommon<T>>::clamp_permissions(target_collection.mode.clone(), &old_limit, new_permission)?;
 
 			<Pallet<T>>::deposit_event(Event::<T>::CollectionPermissionSet(
 				collection_id
@@ -904,18 +1103,29 @@
 			target_collection.save()
 		}
 
+		/// Re-partition a refungible token, while owning all of its parts/pieces.
+		///
+		/// # Permissions
+		///
+		/// * Token owner (must own every part)
+		///
+		/// # Arguments
+		///
+		/// * `collection_id`: ID of the collection the RFT belongs to.
+		/// * `token_id`: ID of the RFT.
+		/// * `amount`: New number of parts/pieces into which the token shall be partitioned.
 		#[weight = T::RefungibleExtensionsWeightInfo::repartition()]
 		#[transactional]
 		pub fn repartition(
 			origin,
 			collection_id: CollectionId,
-			token: TokenId,
+			token_id: TokenId,
 			amount: u128,
 		) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			dispatch_tx::<T, _>(collection_id, |d| {
 				if let Some(refungible_extensions) = d.refungible_extensions() {
-					refungible_extensions.repartition(&sender, token, amount)
+					refungible_extensions.repartition(&sender, token_id, amount)
 				} else {
 					fail!(<Error<T>>::RepartitionCalledOnNonRefungibleCollection)
 				}
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
before · primitives/data-structs/src/lib.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#![cfg_attr(not(feature = "std"), no_std)]1819use core::{20	convert::{TryFrom, TryInto},21	fmt,22};23use frame_support::{24	storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet},25	traits::Get,26	parameter_types,27};2829#[cfg(feature = "serde")]30use serde::{Serialize, Deserialize};3132use sp_core::U256;33use sp_runtime::{ArithmeticError, sp_std::prelude::Vec, Permill};34use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};35use frame_support::{BoundedVec, traits::ConstU32};36use derivative::Derivative;37use scale_info::TypeInfo;3839// RMRK40use rmrk_traits::{41	CollectionInfo, NftInfo, ResourceInfo, PropertyInfo, BaseInfo, PartType, Theme, ThemeProperty,42	ResourceTypes, BasicResource, ComposableResource, SlotResource, EquippableList,43};44pub use rmrk_traits::{45	primitives::{46		CollectionId as RmrkCollectionId, NftId as RmrkNftId, BaseId as RmrkBaseId,47		SlotId as RmrkSlotId, PartId as RmrkPartId, ResourceId as RmrkResourceId,48	},49	NftChild as RmrkNftChild, AccountIdOrCollectionNftTuple as RmrkAccountIdOrCollectionNftTuple,50	FixedPart as RmrkFixedPart, SlotPart as RmrkSlotPart,51};5253mod bounded;54pub mod budget;55pub mod mapping;56mod migration;5758pub const MAX_DECIMAL_POINTS: DecimalPoints = 30;59pub const MAX_REFUNGIBLE_PIECES: u128 = 1_000_000_000_000_000_000_000;60pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;6162pub const MAX_TOKEN_OWNERSHIP: u32 = if cfg!(not(feature = "limit-testing")) {63	100_00064} else {65	1066};67pub const COLLECTION_NUMBER_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {68	100_00069} else {70	1071};72pub const CUSTOM_DATA_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {73	204874} else {75	1076};77pub const COLLECTION_ADMINS_LIMIT: u32 = 5;78pub const COLLECTION_TOKEN_LIMIT: u32 = u32::MAX;79pub const ACCOUNT_TOKEN_OWNERSHIP_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {80	1_000_00081} else {82	1083};8485// Timeouts for item types in passed blocks86pub const NFT_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;87pub const FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;88pub const REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;8990pub const SPONSOR_APPROVE_TIMEOUT: u32 = 5;9192// Schema limits93pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 8192;94pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 8192;95pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 32768;9697pub const COLLECTION_FIELD_LIMIT: u32 = CONST_ON_CHAIN_SCHEMA_LIMIT;9899pub const MAX_COLLECTION_NAME_LENGTH: u32 = 64;100pub const MAX_COLLECTION_DESCRIPTION_LENGTH: u32 = 256;101pub const MAX_TOKEN_PREFIX_LENGTH: u32 = 16;102103pub const MAX_PROPERTY_KEY_LENGTH: u32 = 256;104pub const MAX_PROPERTY_VALUE_LENGTH: u32 = 32768;105pub const MAX_PROPERTIES_PER_ITEM: u32 = 64;106107pub const MAX_AUX_PROPERTY_VALUE_LENGTH: u32 = 2048;108109pub const MAX_COLLECTION_PROPERTIES_SIZE: u32 = 40960;110pub const MAX_TOKEN_PROPERTIES_SIZE: u32 = 32768;111112/// How much items can be created per single113/// create_many call114pub const MAX_ITEMS_PER_BATCH: u32 = 200;115116pub type CustomDataLimit = ConstU32<CUSTOM_DATA_LIMIT>;117118#[derive(119	Encode,120	Decode,121	PartialEq,122	Eq,123	PartialOrd,124	Ord,125	Clone,126	Copy,127	Debug,128	Default,129	TypeInfo,130	MaxEncodedLen,131)]132#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]133pub struct CollectionId(pub u32);134impl EncodeLike<u32> for CollectionId {}135impl EncodeLike<CollectionId> for u32 {}136137#[derive(138	Encode,139	Decode,140	PartialEq,141	Eq,142	PartialOrd,143	Ord,144	Clone,145	Copy,146	Debug,147	Default,148	TypeInfo,149	MaxEncodedLen,150)]151#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]152pub struct TokenId(pub u32);153impl EncodeLike<u32> for TokenId {}154impl EncodeLike<TokenId> for u32 {}155156impl TokenId {157	pub fn try_next(self) -> Result<TokenId, ArithmeticError> {158		self.0159			.checked_add(1)160			.ok_or(ArithmeticError::Overflow)161			.map(Self)162	}163}164165impl From<TokenId> for U256 {166	fn from(t: TokenId) -> Self {167		t.0.into()168	}169}170171impl TryFrom<U256> for TokenId {172	type Error = &'static str;173174	fn try_from(value: U256) -> Result<Self, Self::Error> {175		Ok(TokenId(value.try_into().map_err(|_| "too large token id")?))176	}177}178179#[derive(Encode, Decode, Clone, PartialEq, TypeInfo)]180#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]181pub struct TokenData<CrossAccountId> {182	pub properties: Vec<Property>,183	pub owner: Option<CrossAccountId>,184	pub pieces: u128,185}186187pub struct OverflowError;188impl From<OverflowError> for &'static str {189	fn from(_: OverflowError) -> Self {190		"overflow occured"191	}192}193194pub type DecimalPoints = u8;195196#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]197#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]198pub enum CollectionMode {199	NFT,200	// decimal points201	Fungible(DecimalPoints),202	ReFungible,203}204205impl CollectionMode {206	pub fn id(&self) -> u8 {207		match self {208			CollectionMode::NFT => 1,209			CollectionMode::Fungible(_) => 2,210			CollectionMode::ReFungible => 3,211		}212	}213}214215pub trait SponsoringResolve<AccountId, Call> {216	fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>;217}218219#[derive(Encode, Decode, Eq, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen)]220#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]221pub enum AccessMode {222	Normal,223	AllowList,224}225impl Default for AccessMode {226	fn default() -> Self {227		Self::Normal228	}229}230231#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]232#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]233pub enum SchemaVersion {234	ImageURL,235	Unique,236}237impl Default for SchemaVersion {238	fn default() -> Self {239		Self::ImageURL240	}241}242243#[derive(Encode, Decode, Default, Debug, Clone, PartialEq, TypeInfo)]244#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]245pub struct Ownership<AccountId> {246	pub owner: AccountId,247	pub fraction: u128,248}249250#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]251#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]252pub enum SponsorshipState<AccountId> {253	/// The fees are applied to the transaction sender254	Disabled,255	Unconfirmed(AccountId),256	/// Transactions are sponsored by specified account257	Confirmed(AccountId),258}259260impl<AccountId> SponsorshipState<AccountId> {261	pub fn sponsor(&self) -> Option<&AccountId> {262		match self {263			Self::Confirmed(sponsor) => Some(sponsor),264			_ => None,265		}266	}267268	pub fn pending_sponsor(&self) -> Option<&AccountId> {269		match self {270			Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),271			_ => None,272		}273	}274275	pub fn confirmed(&self) -> bool {276		matches!(self, Self::Confirmed(_))277	}278}279280impl<T> Default for SponsorshipState<T> {281	fn default() -> Self {282		Self::Disabled283	}284}285286/// Used in storage287#[struct_versioning::versioned(version = 2, upper)]288#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen)]289pub struct Collection<AccountId> {290	pub owner: AccountId,291	pub mode: CollectionMode,292	#[version(..2)]293	pub access: AccessMode,294	pub name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,295	pub description: BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>,296	pub token_prefix: BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>,297298	#[version(..2)]299	pub mint_mode: bool,300301	#[version(..2)]302	pub offchain_schema: BoundedVec<u8, ConstU32<OFFCHAIN_SCHEMA_LIMIT>>,303304	#[version(..2)]305	pub schema_version: SchemaVersion,306	pub sponsorship: SponsorshipState<AccountId>,307308	pub limits: CollectionLimits,309310	#[version(2.., upper(Default::default()))]311	pub permissions: CollectionPermissions,312313	/// Marks that this collection is not "unique", and managed from external.314	#[version(2.., upper(false))]315	pub external_collection: bool,316317	#[version(..2)]318	pub variable_on_chain_schema: BoundedVec<u8, ConstU32<VARIABLE_ON_CHAIN_SCHEMA_LIMIT>>,319320	#[version(..2)]321	pub const_on_chain_schema: BoundedVec<u8, ConstU32<CONST_ON_CHAIN_SCHEMA_LIMIT>>,322323	#[version(..2)]324	pub meta_update_permission: MetaUpdatePermission,325}326327/// Used in RPC calls328#[derive(Encode, Decode, Clone, PartialEq, TypeInfo)]329#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]330pub struct RpcCollection<AccountId> {331	pub owner: AccountId,332	pub mode: CollectionMode,333	pub name: Vec<u16>,334	pub description: Vec<u16>,335	pub token_prefix: Vec<u8>,336	pub sponsorship: SponsorshipState<AccountId>,337	pub limits: CollectionLimits,338	pub permissions: CollectionPermissions,339	pub token_property_permissions: Vec<PropertyKeyPermission>,340	pub properties: Vec<Property>,341	pub read_only: bool,342}343344#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Derivative, MaxEncodedLen)]345#[derivative(Debug, Default(bound = ""))]346pub struct CreateCollectionData<AccountId> {347	#[derivative(Default(value = "CollectionMode::NFT"))]348	pub mode: CollectionMode,349	pub access: Option<AccessMode>,350	pub name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,351	pub description: BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>,352	pub token_prefix: BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>,353	pub pending_sponsor: Option<AccountId>,354	pub limits: Option<CollectionLimits>,355	pub permissions: Option<CollectionPermissions>,356	pub token_property_permissions: CollectionPropertiesPermissionsVec,357	pub properties: CollectionPropertiesVec,358}359360pub type CollectionPropertiesPermissionsVec =361	BoundedVec<PropertyKeyPermission, ConstU32<MAX_PROPERTIES_PER_ITEM>>;362363pub type CollectionPropertiesVec = BoundedVec<Property, ConstU32<MAX_PROPERTIES_PER_ITEM>>;364365/// All fields are wrapped in `Option`s, where None means chain default366// When adding/removing fields from this struct - don't forget to also update clamp_limits367#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]368#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]369pub struct CollectionLimits {370	pub account_token_ownership_limit: Option<u32>,371	pub sponsored_data_size: Option<u32>,372373	/// FIXME should we delete this or repurpose it?374	/// None - setVariableMetadata is not sponsored375	/// Some(v) - setVariableMetadata is sponsored376	///           if there is v block between txs377	pub sponsored_data_rate_limit: Option<SponsoringRateLimit>,378	pub token_limit: Option<u32>,379380	// Timeouts for item types in passed blocks381	pub sponsor_transfer_timeout: Option<u32>,382	pub sponsor_approve_timeout: Option<u32>,383	pub owner_can_transfer: Option<bool>,384	pub owner_can_destroy: Option<bool>,385	pub transfers_enabled: Option<bool>,386}387388impl CollectionLimits {389	pub fn account_token_ownership_limit(&self) -> u32 {390		self.account_token_ownership_limit391			.unwrap_or(ACCOUNT_TOKEN_OWNERSHIP_LIMIT)392			.min(MAX_TOKEN_OWNERSHIP)393	}394	pub fn sponsored_data_size(&self) -> u32 {395		self.sponsored_data_size396			.unwrap_or(CUSTOM_DATA_LIMIT)397			.min(CUSTOM_DATA_LIMIT)398	}399	pub fn token_limit(&self) -> u32 {400		self.token_limit401			.unwrap_or(COLLECTION_TOKEN_LIMIT)402			.min(COLLECTION_TOKEN_LIMIT)403	}404	pub fn sponsor_transfer_timeout(&self, default: u32) -> u32 {405		self.sponsor_transfer_timeout406			.unwrap_or(default)407			.min(MAX_SPONSOR_TIMEOUT)408	}409	pub fn sponsor_approve_timeout(&self) -> u32 {410		self.sponsor_approve_timeout411			.unwrap_or(SPONSOR_APPROVE_TIMEOUT)412			.min(MAX_SPONSOR_TIMEOUT)413	}414	pub fn owner_can_transfer(&self) -> bool {415		self.owner_can_transfer.unwrap_or(false)416	}417	pub fn owner_can_transfer_instaled(&self) -> bool {418		self.owner_can_transfer.is_some()419	}420	pub fn owner_can_destroy(&self) -> bool {421		self.owner_can_destroy.unwrap_or(true)422	}423	pub fn transfers_enabled(&self) -> bool {424		self.transfers_enabled.unwrap_or(true)425	}426	pub fn sponsored_data_rate_limit(&self) -> Option<u32> {427		match self428			.sponsored_data_rate_limit429			.unwrap_or(SponsoringRateLimit::SponsoringDisabled)430		{431			SponsoringRateLimit::SponsoringDisabled => None,432			SponsoringRateLimit::Blocks(v) => Some(v.min(MAX_SPONSOR_TIMEOUT)),433		}434	}435}436437// When adding/removing fields from this struct - don't forget to also update clamp_limits438#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]439#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]440pub struct CollectionPermissions {441	pub access: Option<AccessMode>,442	pub mint_mode: Option<bool>,443	pub nesting: Option<NestingPermissions>,444}445446impl CollectionPermissions {447	pub fn access(&self) -> AccessMode {448		self.access.unwrap_or(AccessMode::Normal)449	}450	pub fn mint_mode(&self) -> bool {451		self.mint_mode.unwrap_or(false)452	}453	pub fn nesting(&self) -> &NestingPermissions {454		static DEFAULT: NestingPermissions = NestingPermissions {455			token_owner: false,456			collection_admin: false,457			restricted: None,458			#[cfg(feature = "runtime-benchmarks")]459			permissive: false,460		};461		self.nesting.as_ref().unwrap_or(&DEFAULT)462	}463}464465type OwnerRestrictedSetInner = BoundedBTreeSet<CollectionId, ConstU32<16>>;466467#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative)]468#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]469#[derivative(Debug)]470pub struct OwnerRestrictedSet(471	#[cfg_attr(feature = "serde1", serde(with = "bounded::set_serde"))]472	#[derivative(Debug(format_with = "bounded::set_debug"))]473	pub OwnerRestrictedSetInner,474);475impl OwnerRestrictedSet {476	pub fn new() -> Self {477		Self(Default::default())478	}479}480impl core::ops::Deref for OwnerRestrictedSet {481	type Target = OwnerRestrictedSetInner;482	fn deref(&self) -> &Self::Target {483		&self.0484	}485}486impl core::ops::DerefMut for OwnerRestrictedSet {487	fn deref_mut(&mut self) -> &mut Self::Target {488		&mut self.0489	}490}491492#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative)]493#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]494#[derivative(Debug)]495pub struct NestingPermissions {496	/// Owner of token can nest tokens under it497	pub token_owner: bool,498	/// Admin of token collection can nest tokens under token499	pub collection_admin: bool,500	/// If set - only tokens from specified collections can be nested501	pub restricted: Option<OwnerRestrictedSet>,502503	#[cfg(feature = "runtime-benchmarks")]504	/// Anyone can nest tokens, mutually exclusive with `token_owner`, `admin`505	pub permissive: bool,506}507508#[derive(Encode, Decode, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen)]509#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]510pub enum SponsoringRateLimit {511	SponsoringDisabled,512	Blocks(u32),513}514515#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]516#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]517#[derivative(Debug)]518pub struct CreateNftData {519	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]520	#[derivative(Debug(format_with = "bounded::vec_debug"))]521	pub properties: CollectionPropertiesVec,522}523524#[derive(Encode, Decode, MaxEncodedLen, Default, Debug, Clone, PartialEq, TypeInfo)]525#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]526pub struct CreateFungibleData {527	pub value: u128,528}529530#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]531#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]532#[derivative(Debug)]533pub struct CreateReFungibleData {534	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]535	#[derivative(Debug(format_with = "bounded::vec_debug"))]536	pub const_data: BoundedVec<u8, CustomDataLimit>,537538	pub pieces: u128,539540	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]541	#[derivative(Debug(format_with = "bounded::vec_debug"))]542	pub properties: CollectionPropertiesVec,543}544545#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]546#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]547pub enum MetaUpdatePermission {548	ItemOwner,549	Admin,550	None,551}552553#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]554#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]555pub enum CreateItemData {556	NFT(CreateNftData),557	Fungible(CreateFungibleData),558	ReFungible(CreateReFungibleData),559}560561#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]562#[derivative(Debug)]563pub struct CreateNftExData<CrossAccountId> {564	#[derivative(Debug(format_with = "bounded::vec_debug"))]565	pub properties: CollectionPropertiesVec,566	pub owner: CrossAccountId,567}568569#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]570#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]571pub struct CreateRefungibleExData<CrossAccountId> {572	#[derivative(Debug(format_with = "bounded::vec_debug"))]573	pub const_data: BoundedVec<u8, CustomDataLimit>,574	#[derivative(Debug(format_with = "bounded::map_debug"))]575	pub users: BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,576	#[derivative(Debug(format_with = "bounded::vec_debug"))]577	pub properties: CollectionPropertiesVec,578}579580#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]581#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]582pub enum CreateItemExData<CrossAccountId> {583	NFT(584		#[derivative(Debug(format_with = "bounded::vec_debug"))]585		BoundedVec<CreateNftExData<CrossAccountId>, ConstU32<MAX_ITEMS_PER_BATCH>>,586	),587	Fungible(588		#[derivative(Debug(format_with = "bounded::map_debug"))]589		BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,590	),591	/// Many tokens, each may have only one owner592	RefungibleMultipleItems(593		#[derivative(Debug(format_with = "bounded::vec_debug"))]594		BoundedVec<CreateRefungibleExData<CrossAccountId>, ConstU32<MAX_ITEMS_PER_BATCH>>,595	),596	/// Single token, which may have many owners597	RefungibleMultipleOwners(CreateRefungibleExData<CrossAccountId>),598}599600impl CreateItemData {601	pub fn data_size(&self) -> usize {602		match self {603			CreateItemData::ReFungible(data) => data.const_data.len(),604			_ => 0,605		}606	}607}608609impl From<CreateNftData> for CreateItemData {610	fn from(item: CreateNftData) -> Self {611		CreateItemData::NFT(item)612	}613}614615impl From<CreateReFungibleData> for CreateItemData {616	fn from(item: CreateReFungibleData) -> Self {617		CreateItemData::ReFungible(item)618	}619}620621impl From<CreateFungibleData> for CreateItemData {622	fn from(item: CreateFungibleData) -> Self {623		CreateItemData::Fungible(item)624	}625}626627#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]628#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]629// todo possibly rename to be used generally as an address pair630pub struct TokenChild {631	pub token: TokenId,632	pub collection: CollectionId,633}634635#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]636#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]637pub struct CollectionStats {638	pub created: u32,639	pub destroyed: u32,640	pub alive: u32,641}642643#[derive(Encode, Decode, Clone, Debug)]644#[cfg_attr(feature = "std", derive(PartialEq))]645pub struct PhantomType<T>(core::marker::PhantomData<T>);646647impl<T: TypeInfo + 'static> TypeInfo for PhantomType<T> {648	type Identity = PhantomType<T>;649650	fn type_info() -> scale_info::Type {651		use scale_info::{652			Type, Path,653			build::{FieldsBuilder, UnnamedFields},654			type_params,655		};656		Type::builder()657			.path(Path::new("up_data_structs", "PhantomType"))658			.type_params(type_params!(T))659			.composite(<FieldsBuilder<UnnamedFields>>::default().field(|b| b.ty::<[T; 0]>()))660	}661}662impl<T> MaxEncodedLen for PhantomType<T> {663	fn max_encoded_len() -> usize {664		0665	}666}667668pub type BoundedBytes<S> = BoundedVec<u8, S>;669670pub type AuxPropertyValue = BoundedBytes<ConstU32<MAX_AUX_PROPERTY_VALUE_LENGTH>>;671672pub type PropertyKey = BoundedBytes<ConstU32<MAX_PROPERTY_KEY_LENGTH>>;673pub type PropertyValue = BoundedBytes<ConstU32<MAX_PROPERTY_VALUE_LENGTH>>;674675#[derive(Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone)]676#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]677pub struct PropertyPermission {678	pub mutable: bool,679	pub collection_admin: bool,680	pub token_owner: bool,681}682683impl PropertyPermission {684	pub fn none() -> Self {685		Self {686			mutable: true,687			collection_admin: false,688			token_owner: false,689		}690	}691}692693#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, MaxEncodedLen)]694#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]695pub struct Property {696	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]697	pub key: PropertyKey,698699	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]700	pub value: PropertyValue,701}702703impl Into<(PropertyKey, PropertyValue)> for Property {704	fn into(self) -> (PropertyKey, PropertyValue) {705		(self.key, self.value)706	}707}708709#[derive(Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone)]710#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]711pub struct PropertyKeyPermission {712	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]713	pub key: PropertyKey,714715	pub permission: PropertyPermission,716}717718impl Into<(PropertyKey, PropertyPermission)> for PropertyKeyPermission {719	fn into(self) -> (PropertyKey, PropertyPermission) {720		(self.key, self.permission)721	}722}723724#[derive(Debug)]725pub enum PropertiesError {726	NoSpaceForProperty,727	PropertyLimitReached,728	InvalidCharacterInPropertyKey,729	PropertyKeyIsTooLong,730	EmptyPropertyKey,731}732733#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, PartialEq, Clone, Copy)]734pub enum PropertyScope {735	None,736	Rmrk,737}738739impl PropertyScope {740	pub fn apply(self, key: PropertyKey) -> Result<PropertyKey, PropertiesError> {741		let scope_str: &[u8] = match self {742			Self::None => return Ok(key),743			Self::Rmrk => b"rmrk",744		};745746		[scope_str, b":", key.as_slice()]747			.concat()748			.try_into()749			.map_err(|_| PropertiesError::PropertyKeyIsTooLong)750	}751}752753pub trait TrySetProperty: Sized {754	type Value;755756	fn try_scoped_set(757		&mut self,758		scope: PropertyScope,759		key: PropertyKey,760		value: Self::Value,761	) -> Result<(), PropertiesError>;762763	fn try_scoped_set_from_iter<I, KV>(764		&mut self,765		scope: PropertyScope,766		iter: I,767	) -> Result<(), PropertiesError>768	where769		I: Iterator<Item = KV>,770		KV: Into<(PropertyKey, Self::Value)>,771	{772		for kv in iter {773			let (key, value) = kv.into();774			self.try_scoped_set(scope, key, value)?;775		}776777		Ok(())778	}779780	fn try_set(&mut self, key: PropertyKey, value: Self::Value) -> Result<(), PropertiesError> {781		self.try_scoped_set(PropertyScope::None, key, value)782	}783784	fn try_set_from_iter<I, KV>(&mut self, iter: I) -> Result<(), PropertiesError>785	where786		I: Iterator<Item = KV>,787		KV: Into<(PropertyKey, Self::Value)>,788	{789		self.try_scoped_set_from_iter(PropertyScope::None, iter)790	}791}792793#[derive(Encode, Decode, TypeInfo, Derivative, Clone, PartialEq, MaxEncodedLen)]794#[derivative(Default(bound = ""))]795pub struct PropertiesMap<Value>(796	BoundedBTreeMap<PropertyKey, Value, ConstU32<MAX_PROPERTIES_PER_ITEM>>,797);798799impl<Value> PropertiesMap<Value> {800	pub fn new() -> Self {801		Self(BoundedBTreeMap::new())802	}803804	pub fn remove(&mut self, key: &PropertyKey) -> Result<Option<Value>, PropertiesError> {805		Self::check_property_key(key)?;806807		Ok(self.0.remove(key))808	}809810	pub fn get(&self, key: &PropertyKey) -> Option<&Value> {811		self.0.get(key)812	}813814	pub fn contains_key(&self, key: &PropertyKey) -> bool {815		self.0.contains_key(key)816	}817818	fn check_property_key(key: &PropertyKey) -> Result<(), PropertiesError> {819		if key.is_empty() {820			return Err(PropertiesError::EmptyPropertyKey);821		}822823		for byte in key.as_slice().iter() {824			let byte = *byte;825826			if !byte.is_ascii_alphanumeric() && byte != b'_' && byte != b'-' && byte != b'.' {827				return Err(PropertiesError::InvalidCharacterInPropertyKey);828			}829		}830831		Ok(())832	}833}834835impl<Value> IntoIterator for PropertiesMap<Value> {836	type Item = (PropertyKey, Value);837	type IntoIter = <838		BoundedBTreeMap<839			PropertyKey,840			Value,841			ConstU32<MAX_PROPERTIES_PER_ITEM>842		> as IntoIterator843	>::IntoIter;844845	fn into_iter(self) -> Self::IntoIter {846		self.0.into_iter()847	}848}849850impl<Value> TrySetProperty for PropertiesMap<Value> {851	type Value = Value;852853	fn try_scoped_set(854		&mut self,855		scope: PropertyScope,856		key: PropertyKey,857		value: Self::Value,858	) -> Result<(), PropertiesError> {859		Self::check_property_key(&key)?;860861		let key = scope.apply(key)?;862		self.0863			.try_insert(key, value)864			.map_err(|_| PropertiesError::PropertyLimitReached)?;865866		Ok(())867	}868}869870pub type PropertiesPermissionMap = PropertiesMap<PropertyPermission>;871872#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, MaxEncodedLen)]873pub struct Properties {874	map: PropertiesMap<PropertyValue>,875	consumed_space: u32,876	space_limit: u32,877}878879impl Properties {880	pub fn new(space_limit: u32) -> Self {881		Self {882			map: PropertiesMap::new(),883			consumed_space: 0,884			space_limit,885		}886	}887888	pub fn remove(&mut self, key: &PropertyKey) -> Result<Option<PropertyValue>, PropertiesError> {889		let value = self.map.remove(key)?;890891		if let Some(ref value) = value {892			let value_len = value.len() as u32;893			self.consumed_space -= value_len;894		}895896		Ok(value)897	}898899	pub fn get(&self, key: &PropertyKey) -> Option<&PropertyValue> {900		self.map.get(key)901	}902}903904impl IntoIterator for Properties {905	type Item = (PropertyKey, PropertyValue);906	type IntoIter = <PropertiesMap<PropertyValue> as IntoIterator>::IntoIter;907908	fn into_iter(self) -> Self::IntoIter {909		self.map.into_iter()910	}911}912913impl TrySetProperty for Properties {914	type Value = PropertyValue;915916	fn try_scoped_set(917		&mut self,918		scope: PropertyScope,919		key: PropertyKey,920		value: Self::Value,921	) -> Result<(), PropertiesError> {922		let value_len = value.len();923924		if self.consumed_space as usize + value_len > self.space_limit as usize925			&& !cfg!(feature = "runtime-benchmarks")926		{927			return Err(PropertiesError::NoSpaceForProperty);928		}929930		self.map.try_scoped_set(scope, key, value)?;931932		self.consumed_space += value_len as u32;933934		Ok(())935	}936}937938pub struct CollectionProperties;939940impl Get<Properties> for CollectionProperties {941	fn get() -> Properties {942		Properties::new(MAX_COLLECTION_PROPERTIES_SIZE)943	}944}945946pub struct TokenProperties;947948impl Get<Properties> for TokenProperties {949	fn get() -> Properties {950		Properties::new(MAX_TOKEN_PROPERTIES_SIZE)951	}952}953954// RMRK955// todo document?956parameter_types! {957	#[derive(PartialEq, TypeInfo)]958	pub const RmrkStringLimit: u32 = 128;959	#[derive(PartialEq)]960	pub const RmrkCollectionSymbolLimit: u32 = MAX_TOKEN_PREFIX_LENGTH;961	#[derive(PartialEq)]962	pub const RmrkResourceSymbolLimit: u32 = 10;963	#[derive(PartialEq)]964	pub const RmrkBaseSymbolLimit: u32 = MAX_TOKEN_PREFIX_LENGTH;965	#[derive(PartialEq)]966	pub const RmrkKeyLimit: u32 = 32;967	#[derive(PartialEq)]968	pub const RmrkValueLimit: u32 = 256;969	#[derive(PartialEq)]970	pub const RmrkMaxCollectionsEquippablePerPart: u32 = 100;971	#[derive(PartialEq)]972	pub const MaxPropertiesPerTheme: u32 = 5;973	#[derive(PartialEq)]974	pub const RmrkPartsLimit: u32 = 25;975	#[derive(PartialEq)]976	pub const RmrkMaxPriorities: u32 = 25;977	#[derive(PartialEq)]978	pub const MaxResourcesOnMint: u32 = 100;979}980981impl From<RmrkCollectionId> for CollectionId {982	fn from(id: RmrkCollectionId) -> Self {983		Self(id)984	}985}986987impl From<RmrkNftId> for TokenId {988	fn from(id: RmrkNftId) -> Self {989		Self(id)990	}991}992993pub type RmrkCollectionInfo<AccountId> =994	CollectionInfo<RmrkString, RmrkCollectionSymbol, AccountId>;995pub type RmrkInstanceInfo<AccountId> = NftInfo<AccountId, Permill, RmrkString>;996pub type RmrkResourceInfo = ResourceInfo<RmrkString, RmrkBoundedParts>;997pub type RmrkPropertyInfo = PropertyInfo<RmrkKeyString, RmrkValueString>;998pub type RmrkBaseInfo<AccountId> = BaseInfo<AccountId, RmrkString>;999pub type BoundedEquippableCollectionIds =1000	BoundedVec<RmrkCollectionId, RmrkMaxCollectionsEquippablePerPart>;1001pub type RmrkPartType = PartType<RmrkString, BoundedEquippableCollectionIds>;1002pub type RmrkEquippableList = EquippableList<BoundedEquippableCollectionIds>;1003pub type RmrkThemeProperty = ThemeProperty<RmrkString>;1004pub type RmrkTheme = Theme<RmrkString, Vec<RmrkThemeProperty>>;1005pub type RmrkBoundedTheme = Theme<RmrkString, BoundedVec<RmrkThemeProperty, MaxPropertiesPerTheme>>;1006pub type RmrkResourceTypes = ResourceTypes<RmrkString, RmrkBoundedParts>;10071008pub type RmrkBasicResource = BasicResource<RmrkString>;1009pub type RmrkComposableResource = ComposableResource<RmrkString, RmrkBoundedParts>;1010pub type RmrkSlotResource = SlotResource<RmrkString>;10111012pub type RmrkString = BoundedVec<u8, RmrkStringLimit>;1013pub type RmrkCollectionSymbol = BoundedVec<u8, RmrkCollectionSymbolLimit>;1014pub type RmrkBaseSymbol = BoundedVec<u8, RmrkBaseSymbolLimit>;1015pub type RmrkKeyString = BoundedVec<u8, RmrkKeyLimit>;1016pub type RmrkValueString = BoundedVec<u8, RmrkValueLimit>;1017pub type RmrkBoundedResource = BoundedVec<u8, RmrkResourceSymbolLimit>;1018pub type RmrkBoundedParts = BoundedVec<RmrkPartId, RmrkPartsLimit>; // todo make sure it is needed10191020pub type RmrkRpcString = Vec<u8>;1021pub type RmrkThemeName = RmrkRpcString;1022pub type RmrkPropertyKey = RmrkRpcString;
after · primitives/data-structs/src/lib.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#![cfg_attr(not(feature = "std"), no_std)]1819use core::{20	convert::{TryFrom, TryInto},21	fmt,22};23use frame_support::{24	storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet},25	traits::Get,26	parameter_types,27};2829#[cfg(feature = "serde")]30use serde::{Serialize, Deserialize};3132use sp_core::U256;33use sp_runtime::{ArithmeticError, sp_std::prelude::Vec, Permill};34use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};35use frame_support::{BoundedVec, traits::ConstU32};36use derivative::Derivative;37use scale_info::TypeInfo;3839// RMRK40use rmrk_traits::{41	CollectionInfo, NftInfo, ResourceInfo, PropertyInfo, BaseInfo, PartType, Theme, ThemeProperty,42	ResourceTypes, BasicResource, ComposableResource, SlotResource, EquippableList,43};44pub use rmrk_traits::{45	primitives::{46		CollectionId as RmrkCollectionId, NftId as RmrkNftId, BaseId as RmrkBaseId,47		SlotId as RmrkSlotId, PartId as RmrkPartId, ResourceId as RmrkResourceId,48	},49	NftChild as RmrkNftChild, AccountIdOrCollectionNftTuple as RmrkAccountIdOrCollectionNftTuple,50	FixedPart as RmrkFixedPart, SlotPart as RmrkSlotPart,51};5253mod bounded;54pub mod budget;55pub mod mapping;56mod migration;5758pub const MAX_DECIMAL_POINTS: DecimalPoints = 30;59pub const MAX_REFUNGIBLE_PIECES: u128 = 1_000_000_000_000_000_000_000;60pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;6162pub const MAX_TOKEN_OWNERSHIP: u32 = if cfg!(not(feature = "limit-testing")) {63	100_00064} else {65	1066};67pub const COLLECTION_NUMBER_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {68	100_00069} else {70	1071};72pub const CUSTOM_DATA_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {73	204874} else {75	1076};77pub const COLLECTION_ADMINS_LIMIT: u32 = 5;78pub const COLLECTION_TOKEN_LIMIT: u32 = u32::MAX;79pub const ACCOUNT_TOKEN_OWNERSHIP_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {80	1_000_00081} else {82	1083};8485// Timeouts for item types in passed blocks86pub const NFT_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;87pub const FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;88pub const REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT: u32 = 5;8990pub const SPONSOR_APPROVE_TIMEOUT: u32 = 5;9192// Schema limits93pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 8192;94pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 8192;95pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 32768;9697pub const COLLECTION_FIELD_LIMIT: u32 = CONST_ON_CHAIN_SCHEMA_LIMIT;9899pub const MAX_COLLECTION_NAME_LENGTH: u32 = 64;100pub const MAX_COLLECTION_DESCRIPTION_LENGTH: u32 = 256;101pub const MAX_TOKEN_PREFIX_LENGTH: u32 = 16;102103pub const MAX_PROPERTY_KEY_LENGTH: u32 = 256;104pub const MAX_PROPERTY_VALUE_LENGTH: u32 = 32768;105pub const MAX_PROPERTIES_PER_ITEM: u32 = 64;106107pub const MAX_AUX_PROPERTY_VALUE_LENGTH: u32 = 2048;108109pub const MAX_COLLECTION_PROPERTIES_SIZE: u32 = 40960;110pub const MAX_TOKEN_PROPERTIES_SIZE: u32 = 32768;111112/// How much items can be created per single113/// create_many call114pub const MAX_ITEMS_PER_BATCH: u32 = 200;115116pub type CustomDataLimit = ConstU32<CUSTOM_DATA_LIMIT>;117118#[derive(119	Encode,120	Decode,121	PartialEq,122	Eq,123	PartialOrd,124	Ord,125	Clone,126	Copy,127	Debug,128	Default,129	TypeInfo,130	MaxEncodedLen,131)]132#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]133pub struct CollectionId(pub u32);134impl EncodeLike<u32> for CollectionId {}135impl EncodeLike<CollectionId> for u32 {}136137#[derive(138	Encode,139	Decode,140	PartialEq,141	Eq,142	PartialOrd,143	Ord,144	Clone,145	Copy,146	Debug,147	Default,148	TypeInfo,149	MaxEncodedLen,150)]151#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]152pub struct TokenId(pub u32);153impl EncodeLike<u32> for TokenId {}154impl EncodeLike<TokenId> for u32 {}155156impl TokenId {157	pub fn try_next(self) -> Result<TokenId, ArithmeticError> {158		self.0159			.checked_add(1)160			.ok_or(ArithmeticError::Overflow)161			.map(Self)162	}163}164165impl From<TokenId> for U256 {166	fn from(t: TokenId) -> Self {167		t.0.into()168	}169}170171impl TryFrom<U256> for TokenId {172	type Error = &'static str;173174	fn try_from(value: U256) -> Result<Self, Self::Error> {175		Ok(TokenId(value.try_into().map_err(|_| "too large token id")?))176	}177}178179#[derive(Encode, Decode, Clone, PartialEq, TypeInfo)]180#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]181pub struct TokenData<CrossAccountId> {182	pub properties: Vec<Property>,183	pub owner: Option<CrossAccountId>,184	pub pieces: u128,185}186187pub struct OverflowError;188impl From<OverflowError> for &'static str {189	fn from(_: OverflowError) -> Self {190		"overflow occured"191	}192}193194pub type DecimalPoints = u8;195196#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]197#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]198pub enum CollectionMode {199	NFT,200	Fungible(DecimalPoints),201	ReFungible,202}203204impl CollectionMode {205	pub fn id(&self) -> u8 {206		match self {207			CollectionMode::NFT => 1,208			CollectionMode::Fungible(_) => 2,209			CollectionMode::ReFungible => 3,210		}211	}212}213214pub trait SponsoringResolve<AccountId, Call> {215	fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>;216}217218#[derive(Encode, Decode, Eq, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen)]219#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]220pub enum AccessMode {221	Normal,222	AllowList,223}224impl Default for AccessMode {225	fn default() -> Self {226		Self::Normal227	}228}229230#[derive(Encode, Decode, Eq, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]231#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]232pub enum SchemaVersion {233	ImageURL,234	Unique,235}236impl Default for SchemaVersion {237	fn default() -> Self {238		Self::ImageURL239	}240}241242#[derive(Encode, Decode, Default, Debug, Clone, PartialEq, TypeInfo)]243#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]244pub struct Ownership<AccountId> {245	pub owner: AccountId,246	pub fraction: u128,247}248249#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]250#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]251pub enum SponsorshipState<AccountId> {252	/// The fees are applied to the transaction sender253	Disabled,254	/// Pending confirmation from a sponsor-to-be255	Unconfirmed(AccountId),256	/// Transactions are sponsored by specified account257	Confirmed(AccountId),258}259260impl<AccountId> SponsorshipState<AccountId> {261	/// Get the acting sponsor account, if present262	pub fn sponsor(&self) -> Option<&AccountId> {263		match self {264			Self::Confirmed(sponsor) => Some(sponsor),265			_ => None,266		}267	}268269	/// Get the sponsor account currently pending confirmation, if present270	pub fn pending_sponsor(&self) -> Option<&AccountId> {271		match self {272			Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),273			_ => None,274		}275	}276277	/// Is sponsorship set and acting278	pub fn confirmed(&self) -> bool {279		matches!(self, Self::Confirmed(_))280	}281}282283impl<T> Default for SponsorshipState<T> {284	fn default() -> Self {285		Self::Disabled286	}287}288289/// Collection parameters, used in storage (see [`RpcCollection`] for the RPC version).290#[struct_versioning::versioned(version = 2, upper)]291#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen)]292pub struct Collection<AccountId> {293	pub owner: AccountId,294	pub mode: CollectionMode,295	#[version(..2)]296	pub access: AccessMode,297	pub name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,298	pub description: BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>,299	pub token_prefix: BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>,300301	#[version(..2)]302	pub mint_mode: bool,303304	#[version(..2)]305	pub offchain_schema: BoundedVec<u8, ConstU32<OFFCHAIN_SCHEMA_LIMIT>>,306307	#[version(..2)]308	pub schema_version: SchemaVersion,309	pub sponsorship: SponsorshipState<AccountId>,310311	pub limits: CollectionLimits,312313	#[version(2.., upper(Default::default()))]314	pub permissions: CollectionPermissions,315316	/// Marks that this collection is not "unique", and managed from external.317	#[version(2.., upper(false))]318	pub external_collection: bool,319320	#[version(..2)]321	pub variable_on_chain_schema: BoundedVec<u8, ConstU32<VARIABLE_ON_CHAIN_SCHEMA_LIMIT>>,322323	#[version(..2)]324	pub const_on_chain_schema: BoundedVec<u8, ConstU32<CONST_ON_CHAIN_SCHEMA_LIMIT>>,325326	#[version(..2)]327	pub meta_update_permission: MetaUpdatePermission,328}329330/// Collection parameters, used in RPC calls (see [`Collection`] for the storage version).331#[derive(Encode, Decode, Clone, PartialEq, TypeInfo)]332#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]333pub struct RpcCollection<AccountId> {334	pub owner: AccountId,335	pub mode: CollectionMode,336	pub name: Vec<u16>,337	pub description: Vec<u16>,338	pub token_prefix: Vec<u8>,339	pub sponsorship: SponsorshipState<AccountId>,340	pub limits: CollectionLimits,341	pub permissions: CollectionPermissions,342	pub token_property_permissions: Vec<PropertyKeyPermission>,343	pub properties: Vec<Property>,344	pub read_only: bool,345}346347#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, Derivative, MaxEncodedLen)]348#[derivative(Debug, Default(bound = ""))]349pub struct CreateCollectionData<AccountId> {350	#[derivative(Default(value = "CollectionMode::NFT"))]351	pub mode: CollectionMode,352	pub access: Option<AccessMode>,353	pub name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,354	pub description: BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>,355	pub token_prefix: BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>,356	pub pending_sponsor: Option<AccountId>,357	pub limits: Option<CollectionLimits>,358	pub permissions: Option<CollectionPermissions>,359	pub token_property_permissions: CollectionPropertiesPermissionsVec,360	pub properties: CollectionPropertiesVec,361}362363pub type CollectionPropertiesPermissionsVec =364	BoundedVec<PropertyKeyPermission, ConstU32<MAX_PROPERTIES_PER_ITEM>>;365366pub type CollectionPropertiesVec = BoundedVec<Property, ConstU32<MAX_PROPERTIES_PER_ITEM>>;367368/// Limits and restrictions of a collection.369/// All fields are wrapped in `Option`s, where None means chain default.370///371/// todo:doc links to chain defaults372// IMPORTANT: When adding/removing fields from this struct - don't forget to also373// update clamp_limits() in pallet-common.374#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]375#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]376pub struct CollectionLimits {377	/// Maximum number of owned tokens per account. Chain default: [`ACCOUNT_TOKEN_OWNERSHIP_LIMIT`]378	pub account_token_ownership_limit: Option<u32>,379	/// Maximum size of data in bytes of a sponsored transaction. Chain default: [`CUSTOM_DATA_LIMIT`]380	pub sponsored_data_size: Option<u32>,381382	/// FIXME should we delete this or repurpose it?383	/// None - setVariableMetadata is not sponsored384	/// Some(v) - setVariableMetadata is sponsored385	///           if there is v block between txs386	///387	/// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]388	pub sponsored_data_rate_limit: Option<SponsoringRateLimit>,389	/// Maximum amount of tokens inside the collection. Chain default: [`COLLECTION_TOKEN_LIMIT`]390	pub token_limit: Option<u32>,391392	/// Timeout for sponsoring a token transfer in passed blocks. Chain default:393	/// either [`NFT_SPONSOR_TRANSFER_TIMEOUT`], [`FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT`], or [`REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT`],394	/// depending on the collection type.395	pub sponsor_transfer_timeout: Option<u32>,396	/// Timeout for sponsoring an approval in passed blocks. Chain default: [`SPONSOR_APPROVE_TIMEOUT`]397	pub sponsor_approve_timeout: Option<u32>,398	/// Can a token be transferred by the owner. Chain default: `false`399	pub owner_can_transfer: Option<bool>,400	/// Can a token be burned by the owner. Chain default: `true`401	pub owner_can_destroy: Option<bool>,402	/// Can a token be transferred at all. Chain default: `true`403	pub transfers_enabled: Option<bool>,404}405406impl CollectionLimits {407	pub fn account_token_ownership_limit(&self) -> u32 {408		self.account_token_ownership_limit409			.unwrap_or(ACCOUNT_TOKEN_OWNERSHIP_LIMIT)410			.min(MAX_TOKEN_OWNERSHIP)411	}412	pub fn sponsored_data_size(&self) -> u32 {413		self.sponsored_data_size414			.unwrap_or(CUSTOM_DATA_LIMIT)415			.min(CUSTOM_DATA_LIMIT)416	}417	pub fn token_limit(&self) -> u32 {418		self.token_limit419			.unwrap_or(COLLECTION_TOKEN_LIMIT)420			.min(COLLECTION_TOKEN_LIMIT)421	}422	pub fn sponsor_transfer_timeout(&self, default: u32) -> u32 {423		self.sponsor_transfer_timeout424			.unwrap_or(default)425			.min(MAX_SPONSOR_TIMEOUT)426	}427	pub fn sponsor_approve_timeout(&self) -> u32 {428		self.sponsor_approve_timeout429			.unwrap_or(SPONSOR_APPROVE_TIMEOUT)430			.min(MAX_SPONSOR_TIMEOUT)431	}432	pub fn owner_can_transfer(&self) -> bool {433		self.owner_can_transfer.unwrap_or(false)434	}435	pub fn owner_can_transfer_instaled(&self) -> bool {436		self.owner_can_transfer.is_some()437	}438	pub fn owner_can_destroy(&self) -> bool {439		self.owner_can_destroy.unwrap_or(true)440	}441	pub fn transfers_enabled(&self) -> bool {442		self.transfers_enabled.unwrap_or(true)443	}444	pub fn sponsored_data_rate_limit(&self) -> Option<u32> {445		match self446			.sponsored_data_rate_limit447			.unwrap_or(SponsoringRateLimit::SponsoringDisabled)448		{449			SponsoringRateLimit::SponsoringDisabled => None,450			SponsoringRateLimit::Blocks(v) => Some(v.min(MAX_SPONSOR_TIMEOUT)),451		}452	}453}454455/// Permissions on certain operations within a collection.456/// All fields are wrapped in `Option`s, where None means chain default.457// IMPORTANT: When adding/removing fields from this struct - don't forget to also458// update clamp_limits() in pallet-common.459#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]460#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]461pub struct CollectionPermissions {462	pub access: Option<AccessMode>,463	pub mint_mode: Option<bool>,464	pub nesting: Option<NestingPermissions>,465}466467impl CollectionPermissions {468	pub fn access(&self) -> AccessMode {469		self.access.unwrap_or(AccessMode::Normal)470	}471	pub fn mint_mode(&self) -> bool {472		self.mint_mode.unwrap_or(false)473	}474	pub fn nesting(&self) -> &NestingPermissions {475		static DEFAULT: NestingPermissions = NestingPermissions {476			token_owner: false,477			collection_admin: false,478			restricted: None,479			#[cfg(feature = "runtime-benchmarks")]480			permissive: false,481		};482		self.nesting.as_ref().unwrap_or(&DEFAULT)483	}484}485486type OwnerRestrictedSetInner = BoundedBTreeSet<CollectionId, ConstU32<16>>;487488#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative)]489#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]490#[derivative(Debug)]491pub struct OwnerRestrictedSet(492	#[cfg_attr(feature = "serde1", serde(with = "bounded::set_serde"))]493	#[derivative(Debug(format_with = "bounded::set_debug"))]494	pub OwnerRestrictedSetInner,495);496impl OwnerRestrictedSet {497	pub fn new() -> Self {498		Self(Default::default())499	}500}501impl core::ops::Deref for OwnerRestrictedSet {502	type Target = OwnerRestrictedSetInner;503	fn deref(&self) -> &Self::Target {504		&self.0505	}506}507impl core::ops::DerefMut for OwnerRestrictedSet {508	fn deref_mut(&mut self) -> &mut Self::Target {509		&mut self.0510	}511}512513/// Part of collection permissions, if set, defines who is able to nest tokens into other tokens.514#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative)]515#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]516#[derivative(Debug)]517pub struct NestingPermissions {518	/// Owner of token can nest tokens under it519	pub token_owner: bool,520	/// Admin of token collection can nest tokens under token521	pub collection_admin: bool,522	/// If set - only tokens from specified collections can be nested523	pub restricted: Option<OwnerRestrictedSet>,524525	#[cfg(feature = "runtime-benchmarks")]526	/// Anyone can nest tokens, mutually exclusive with `token_owner`, `admin`527	pub permissive: bool,528}529530/// Enum denominating how often can sponsoring occur if it is enabled.531#[derive(Encode, Decode, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen)]532#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]533pub enum SponsoringRateLimit {534	/// Sponsoring is disabled, and the collection sponsor will not pay for transactions535	SponsoringDisabled,536	/// Once per how many blocks can sponsorship of a transaction type occur537	Blocks(u32),538}539540/// Data used to describe an NFT at creation.541#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]542#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]543#[derivative(Debug)]544pub struct CreateNftData {545	/// Key-value pairs used to describe the token as metadata546	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]547	#[derivative(Debug(format_with = "bounded::vec_debug"))]548	pub properties: CollectionPropertiesVec,549}550551/// Data used to describe a Fungible token at creation.552#[derive(Encode, Decode, MaxEncodedLen, Default, Debug, Clone, PartialEq, TypeInfo)]553#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]554pub struct CreateFungibleData {555	/// Number of fungible coins minted556	pub value: u128,557}558559/// Data used to describe a Refungible token at creation.560#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]561#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]562#[derivative(Debug)]563pub struct CreateReFungibleData {564	/// Immutable metadata of the token565	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]566	#[derivative(Debug(format_with = "bounded::vec_debug"))]567	pub const_data: BoundedVec<u8, CustomDataLimit>,568569	/// Number of pieces the RFT is split into570	pub pieces: u128,571572	/// Key-value pairs used to describe the token as metadata573	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]574	#[derivative(Debug(format_with = "bounded::vec_debug"))]575	pub properties: CollectionPropertiesVec,576}577578#[derive(Encode, Decode, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen)]579#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]580pub enum MetaUpdatePermission {581	ItemOwner,582	Admin,583	None,584}585586/// Enum holding data used for creation of all three item types.587#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]588#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]589pub enum CreateItemData {590	NFT(CreateNftData),591	Fungible(CreateFungibleData),592	ReFungible(CreateReFungibleData),593}594595/// Explicit NFT creation data with meta parameters.596#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]597#[derivative(Debug)]598pub struct CreateNftExData<CrossAccountId> {599	#[derivative(Debug(format_with = "bounded::vec_debug"))]600	pub properties: CollectionPropertiesVec,601	pub owner: CrossAccountId,602}603604/// Explicit RFT creation data with meta parameters.605#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]606#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]607pub struct CreateRefungibleExData<CrossAccountId> {608	#[derivative(Debug(format_with = "bounded::vec_debug"))]609	pub const_data: BoundedVec<u8, CustomDataLimit>,610	#[derivative(Debug(format_with = "bounded::map_debug"))]611	pub users: BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,612	#[derivative(Debug(format_with = "bounded::vec_debug"))]613	pub properties: CollectionPropertiesVec,614}615616/// Explicit item creation data with meta parameters, namely the owner.617#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]618#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]619pub enum CreateItemExData<CrossAccountId> {620	NFT(621		#[derivative(Debug(format_with = "bounded::vec_debug"))]622		BoundedVec<CreateNftExData<CrossAccountId>, ConstU32<MAX_ITEMS_PER_BATCH>>,623	),624	Fungible(625		#[derivative(Debug(format_with = "bounded::map_debug"))]626		BoundedBTreeMap<CrossAccountId, u128, ConstU32<MAX_ITEMS_PER_BATCH>>,627	),628	/// Many tokens, each may have only one owner629	RefungibleMultipleItems(630		#[derivative(Debug(format_with = "bounded::vec_debug"))]631		BoundedVec<CreateRefungibleExData<CrossAccountId>, ConstU32<MAX_ITEMS_PER_BATCH>>,632	),633	/// Single token, which may have many owners634	RefungibleMultipleOwners(CreateRefungibleExData<CrossAccountId>),635}636637impl CreateItemData {638	pub fn data_size(&self) -> usize {639		match self {640			CreateItemData::ReFungible(data) => data.const_data.len(),641			_ => 0,642		}643	}644}645646impl From<CreateNftData> for CreateItemData {647	fn from(item: CreateNftData) -> Self {648		CreateItemData::NFT(item)649	}650}651652impl From<CreateReFungibleData> for CreateItemData {653	fn from(item: CreateReFungibleData) -> Self {654		CreateItemData::ReFungible(item)655	}656}657658impl From<CreateFungibleData> for CreateItemData {659	fn from(item: CreateFungibleData) -> Self {660		CreateItemData::Fungible(item)661	}662}663664/// Token's address, dictated by its collection and token IDs.665#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]666#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]667// todo possibly rename to be used generally as an address pair668pub struct TokenChild {669	pub token: TokenId,670	pub collection: CollectionId,671}672673#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]674#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]675pub struct CollectionStats {676	pub created: u32,677	pub destroyed: u32,678	pub alive: u32,679}680681#[derive(Encode, Decode, Clone, Debug)]682#[cfg_attr(feature = "std", derive(PartialEq))]683pub struct PhantomType<T>(core::marker::PhantomData<T>);684685impl<T: TypeInfo + 'static> TypeInfo for PhantomType<T> {686	type Identity = PhantomType<T>;687688	fn type_info() -> scale_info::Type {689		use scale_info::{690			Type, Path,691			build::{FieldsBuilder, UnnamedFields},692			type_params,693		};694		Type::builder()695			.path(Path::new("up_data_structs", "PhantomType"))696			.type_params(type_params!(T))697			.composite(<FieldsBuilder<UnnamedFields>>::default().field(|b| b.ty::<[T; 0]>()))698	}699}700impl<T> MaxEncodedLen for PhantomType<T> {701	fn max_encoded_len() -> usize {702		0703	}704}705706pub type BoundedBytes<S> = BoundedVec<u8, S>;707708pub type AuxPropertyValue = BoundedBytes<ConstU32<MAX_AUX_PROPERTY_VALUE_LENGTH>>;709710pub type PropertyKey = BoundedBytes<ConstU32<MAX_PROPERTY_KEY_LENGTH>>;711pub type PropertyValue = BoundedBytes<ConstU32<MAX_PROPERTY_VALUE_LENGTH>>;712713#[derive(Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone)]714#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]715pub struct PropertyPermission {716	pub mutable: bool,717	pub collection_admin: bool,718	pub token_owner: bool,719}720721impl PropertyPermission {722	pub fn none() -> Self {723		Self {724			mutable: true,725			collection_admin: false,726			token_owner: false,727		}728	}729}730731#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, MaxEncodedLen)]732#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]733pub struct Property {734	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]735	pub key: PropertyKey,736737	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]738	pub value: PropertyValue,739}740741impl Into<(PropertyKey, PropertyValue)> for Property {742	fn into(self) -> (PropertyKey, PropertyValue) {743		(self.key, self.value)744	}745}746747#[derive(Encode, Decode, TypeInfo, Debug, MaxEncodedLen, PartialEq, Clone)]748#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]749pub struct PropertyKeyPermission {750	#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]751	pub key: PropertyKey,752753	pub permission: PropertyPermission,754}755756impl Into<(PropertyKey, PropertyPermission)> for PropertyKeyPermission {757	fn into(self) -> (PropertyKey, PropertyPermission) {758		(self.key, self.permission)759	}760}761762#[derive(Debug)]763pub enum PropertiesError {764	NoSpaceForProperty,765	PropertyLimitReached,766	InvalidCharacterInPropertyKey,767	PropertyKeyIsTooLong,768	EmptyPropertyKey,769}770771#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, PartialEq, Clone, Copy)]772pub enum PropertyScope {773	None,774	Rmrk,775}776777impl PropertyScope {778	pub fn apply(self, key: PropertyKey) -> Result<PropertyKey, PropertiesError> {779		let scope_str: &[u8] = match self {780			Self::None => return Ok(key),781			Self::Rmrk => b"rmrk",782		};783784		[scope_str, b":", key.as_slice()]785			.concat()786			.try_into()787			.map_err(|_| PropertiesError::PropertyKeyIsTooLong)788	}789}790791pub trait TrySetProperty: Sized {792	type Value;793794	fn try_scoped_set(795		&mut self,796		scope: PropertyScope,797		key: PropertyKey,798		value: Self::Value,799	) -> Result<(), PropertiesError>;800801	fn try_scoped_set_from_iter<I, KV>(802		&mut self,803		scope: PropertyScope,804		iter: I,805	) -> Result<(), PropertiesError>806	where807		I: Iterator<Item = KV>,808		KV: Into<(PropertyKey, Self::Value)>,809	{810		for kv in iter {811			let (key, value) = kv.into();812			self.try_scoped_set(scope, key, value)?;813		}814815		Ok(())816	}817818	fn try_set(&mut self, key: PropertyKey, value: Self::Value) -> Result<(), PropertiesError> {819		self.try_scoped_set(PropertyScope::None, key, value)820	}821822	fn try_set_from_iter<I, KV>(&mut self, iter: I) -> Result<(), PropertiesError>823	where824		I: Iterator<Item = KV>,825		KV: Into<(PropertyKey, Self::Value)>,826	{827		self.try_scoped_set_from_iter(PropertyScope::None, iter)828	}829}830831#[derive(Encode, Decode, TypeInfo, Derivative, Clone, PartialEq, MaxEncodedLen)]832#[derivative(Default(bound = ""))]833pub struct PropertiesMap<Value>(834	BoundedBTreeMap<PropertyKey, Value, ConstU32<MAX_PROPERTIES_PER_ITEM>>,835);836837impl<Value> PropertiesMap<Value> {838	pub fn new() -> Self {839		Self(BoundedBTreeMap::new())840	}841842	pub fn remove(&mut self, key: &PropertyKey) -> Result<Option<Value>, PropertiesError> {843		Self::check_property_key(key)?;844845		Ok(self.0.remove(key))846	}847848	pub fn get(&self, key: &PropertyKey) -> Option<&Value> {849		self.0.get(key)850	}851852	pub fn contains_key(&self, key: &PropertyKey) -> bool {853		self.0.contains_key(key)854	}855856	fn check_property_key(key: &PropertyKey) -> Result<(), PropertiesError> {857		if key.is_empty() {858			return Err(PropertiesError::EmptyPropertyKey);859		}860861		for byte in key.as_slice().iter() {862			let byte = *byte;863864			if !byte.is_ascii_alphanumeric() && byte != b'_' && byte != b'-' && byte != b'.' {865				return Err(PropertiesError::InvalidCharacterInPropertyKey);866			}867		}868869		Ok(())870	}871}872873impl<Value> IntoIterator for PropertiesMap<Value> {874	type Item = (PropertyKey, Value);875	type IntoIter = <876		BoundedBTreeMap<877			PropertyKey,878			Value,879			ConstU32<MAX_PROPERTIES_PER_ITEM>880		> as IntoIterator881	>::IntoIter;882883	fn into_iter(self) -> Self::IntoIter {884		self.0.into_iter()885	}886}887888impl<Value> TrySetProperty for PropertiesMap<Value> {889	type Value = Value;890891	fn try_scoped_set(892		&mut self,893		scope: PropertyScope,894		key: PropertyKey,895		value: Self::Value,896	) -> Result<(), PropertiesError> {897		Self::check_property_key(&key)?;898899		let key = scope.apply(key)?;900		self.0901			.try_insert(key, value)902			.map_err(|_| PropertiesError::PropertyLimitReached)?;903904		Ok(())905	}906}907908pub type PropertiesPermissionMap = PropertiesMap<PropertyPermission>;909910#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, MaxEncodedLen)]911pub struct Properties {912	map: PropertiesMap<PropertyValue>,913	consumed_space: u32,914	space_limit: u32,915}916917impl Properties {918	pub fn new(space_limit: u32) -> Self {919		Self {920			map: PropertiesMap::new(),921			consumed_space: 0,922			space_limit,923		}924	}925926	pub fn remove(&mut self, key: &PropertyKey) -> Result<Option<PropertyValue>, PropertiesError> {927		let value = self.map.remove(key)?;928929		if let Some(ref value) = value {930			let value_len = value.len() as u32;931			self.consumed_space -= value_len;932		}933934		Ok(value)935	}936937	pub fn get(&self, key: &PropertyKey) -> Option<&PropertyValue> {938		self.map.get(key)939	}940}941942impl IntoIterator for Properties {943	type Item = (PropertyKey, PropertyValue);944	type IntoIter = <PropertiesMap<PropertyValue> as IntoIterator>::IntoIter;945946	fn into_iter(self) -> Self::IntoIter {947		self.map.into_iter()948	}949}950951impl TrySetProperty for Properties {952	type Value = PropertyValue;953954	fn try_scoped_set(955		&mut self,956		scope: PropertyScope,957		key: PropertyKey,958		value: Self::Value,959	) -> Result<(), PropertiesError> {960		let value_len = value.len();961962		if self.consumed_space as usize + value_len > self.space_limit as usize963			&& !cfg!(feature = "runtime-benchmarks")964		{965			return Err(PropertiesError::NoSpaceForProperty);966		}967968		self.map.try_scoped_set(scope, key, value)?;969970		self.consumed_space += value_len as u32;971972		Ok(())973	}974}975976pub struct CollectionProperties;977978impl Get<Properties> for CollectionProperties {979	fn get() -> Properties {980		Properties::new(MAX_COLLECTION_PROPERTIES_SIZE)981	}982}983984pub struct TokenProperties;985986impl Get<Properties> for TokenProperties {987	fn get() -> Properties {988		Properties::new(MAX_TOKEN_PROPERTIES_SIZE)989	}990}991992// RMRK993// todo document?994parameter_types! {995	#[derive(PartialEq, TypeInfo)]996	pub const RmrkStringLimit: u32 = 128;997	#[derive(PartialEq)]998	pub const RmrkCollectionSymbolLimit: u32 = MAX_TOKEN_PREFIX_LENGTH;999	#[derive(PartialEq)]1000	pub const RmrkResourceSymbolLimit: u32 = 10;1001	#[derive(PartialEq)]1002	pub const RmrkBaseSymbolLimit: u32 = MAX_TOKEN_PREFIX_LENGTH;1003	#[derive(PartialEq)]1004	pub const RmrkKeyLimit: u32 = 32;1005	#[derive(PartialEq)]1006	pub const RmrkValueLimit: u32 = 256;1007	#[derive(PartialEq)]1008	pub const RmrkMaxCollectionsEquippablePerPart: u32 = 100;1009	#[derive(PartialEq)]1010	pub const MaxPropertiesPerTheme: u32 = 5;1011	#[derive(PartialEq)]1012	pub const RmrkPartsLimit: u32 = 25;1013	#[derive(PartialEq)]1014	pub const RmrkMaxPriorities: u32 = 25;1015	#[derive(PartialEq)]1016	pub const MaxResourcesOnMint: u32 = 100;1017}10181019impl From<RmrkCollectionId> for CollectionId {1020	fn from(id: RmrkCollectionId) -> Self {1021		Self(id)1022	}1023}10241025impl From<RmrkNftId> for TokenId {1026	fn from(id: RmrkNftId) -> Self {1027		Self(id)1028	}1029}10301031pub type RmrkCollectionInfo<AccountId> =1032	CollectionInfo<RmrkString, RmrkCollectionSymbol, AccountId>;1033pub type RmrkInstanceInfo<AccountId> = NftInfo<AccountId, Permill, RmrkString>;1034pub type RmrkResourceInfo = ResourceInfo<RmrkString, RmrkBoundedParts>;1035pub type RmrkPropertyInfo = PropertyInfo<RmrkKeyString, RmrkValueString>;1036pub type RmrkBaseInfo<AccountId> = BaseInfo<AccountId, RmrkString>;1037pub type BoundedEquippableCollectionIds =1038	BoundedVec<RmrkCollectionId, RmrkMaxCollectionsEquippablePerPart>;1039pub type RmrkPartType = PartType<RmrkString, BoundedEquippableCollectionIds>;1040pub type RmrkEquippableList = EquippableList<BoundedEquippableCollectionIds>;1041pub type RmrkThemeProperty = ThemeProperty<RmrkString>;1042pub type RmrkTheme = Theme<RmrkString, Vec<RmrkThemeProperty>>;1043pub type RmrkBoundedTheme = Theme<RmrkString, BoundedVec<RmrkThemeProperty, MaxPropertiesPerTheme>>;1044pub type RmrkResourceTypes = ResourceTypes<RmrkString, RmrkBoundedParts>;10451046pub type RmrkBasicResource = BasicResource<RmrkString>;1047pub type RmrkComposableResource = ComposableResource<RmrkString, RmrkBoundedParts>;1048pub type RmrkSlotResource = SlotResource<RmrkString>;10491050pub type RmrkString = BoundedVec<u8, RmrkStringLimit>;1051pub type RmrkCollectionSymbol = BoundedVec<u8, RmrkCollectionSymbolLimit>;1052pub type RmrkBaseSymbol = BoundedVec<u8, RmrkBaseSymbolLimit>;1053pub type RmrkKeyString = BoundedVec<u8, RmrkKeyLimit>;1054pub type RmrkValueString = BoundedVec<u8, RmrkValueLimit>;1055pub type RmrkBoundedResource = BoundedVec<u8, RmrkResourceSymbolLimit>;1056pub type RmrkBoundedParts = BoundedVec<RmrkPartId, RmrkPartsLimit>; // todo make sure it is needed10571058pub type RmrkRpcString = Vec<u8>;1059pub type RmrkThemeName = RmrkRpcString;1060pub type RmrkPropertyKey = RmrkRpcString;
modifiedtests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth
--- a/tests/src/interfaces/augment-api-errors.ts
+++ b/tests/src/interfaces/augment-api-errors.ts
@@ -57,7 +57,7 @@
        **/
       AddressNotInAllowlist: AugmentedError<ApiType>;
       /**
-       * Requested value more than approved.
+       * Requested value is more than the approved
        **/
       ApprovedValueTooLow: AugmentedError<ApiType>;
       /**
@@ -113,7 +113,7 @@
        **/
       EmptyPropertyKey: AugmentedError<ApiType>;
       /**
-       * Only ASCII letters, digits, and '_', '-' are allowed
+       * Only ASCII letters, digits, and symbols `_`, `-`, and `.` are allowed
        **/
       InvalidCharacterInPropertyKey: AugmentedError<ApiType>;
       /**
@@ -133,7 +133,7 @@
        **/
       NoSpaceForProperty: AugmentedError<ApiType>;
       /**
-       * Not sufficient funds to perform action
+       * Insufficient funds to perform an action
        **/
       NotSufficientFounds: AugmentedError<ApiType>;
       /**
@@ -153,15 +153,15 @@
        **/
       PublicMintingNotAllowed: AugmentedError<ApiType>;
       /**
-       * Only tokens from specific collections may nest tokens under this
+       * Only tokens from specific collections may nest tokens under this one
        **/
       SourceCollectionIsNotAllowedToNest: AugmentedError<ApiType>;
       /**
-       * Item not exists.
+       * Item does not exist
        **/
       TokenNotFound: AugmentedError<ApiType>;
       /**
-       * Item balance not enough.
+       * Item is balance not enough
        **/
       TokenValueTooLow: AugmentedError<ApiType>;
       /**
@@ -173,11 +173,11 @@
        **/
       TransferNotAllowed: AugmentedError<ApiType>;
       /**
-       * Target collection doesn't supports this operation
+       * Target collection doesn't support this operation
        **/
       UnsupportedOperation: AugmentedError<ApiType>;
       /**
-       * User not passed nesting rule
+       * User does not satisfy the nesting rule
        **/
       UserIsNotAllowedToNest: AugmentedError<ApiType>;
       /**
@@ -285,8 +285,7 @@
        **/
       FungibleItemsDontHaveData: AugmentedError<ApiType>;
       /**
-       * Not default id passed as TokenId argument.
-       * The default value of TokenId for Fungible collection is 0.
+       * Fungible tokens hold no ID, and the default value of TokenId for Fungible collection is 0.
        **/
       FungibleItemsHaveNoId: AugmentedError<ApiType>;
       /**
@@ -426,19 +425,19 @@
        **/
       NotRefungibleDataUsedToMintFungibleCollectionToken: AugmentedError<ApiType>;
       /**
-       * Refungible token can't nest other tokens
+       * Refungible token can't nest other tokens.
        **/
       RefungibleDisallowsNesting: AugmentedError<ApiType>;
       /**
-       * Refungible token can't be repartitioned by user who isn't owns all pieces
+       * Refungible token can't be repartitioned by user who isn't owns all pieces.
        **/
       RepartitionWhileNotOwningAllPieces: AugmentedError<ApiType>;
       /**
-       * Setting item properties is not allowed
+       * Setting item properties is not allowed.
        **/
       SettingPropertiesNotAllowed: AugmentedError<ApiType>;
       /**
-       * Maximum refungibility exceeded
+       * Maximum refungibility exceeded.
        **/
       WrongRefungiblePieces: AugmentedError<ApiType>;
       /**
@@ -509,19 +508,19 @@
     };
     structure: {
       /**
-       * While iterating over children, encountered breadth limit
+       * While iterating over children, reached the breadth limit.
        **/
       BreadthLimit: AugmentedError<ApiType>;
       /**
-       * While searched for owner, encountered depth limit
+       * While searching for the owner, reached the depth limit.
        **/
       DepthLimit: AugmentedError<ApiType>;
       /**
-       * While searched for owner, got already checked account
+       * While searching for the owner, encountered an already checked account, detecting a loop.
        **/
       OuroborosDetected: AugmentedError<ApiType>;
       /**
-       * While searched for owner, found token owner by not-yet-existing token
+       * Couldn't find the token owner that is itself a token.
        **/
       TokenNotFound: AugmentedError<ApiType>;
       /**
@@ -597,7 +596,7 @@
     };
     unique: {
       /**
-       * Decimal_points parameter must be lower than MAX_DECIMAL_POINTS constant, currently it is 30.
+       * Decimal_points parameter must be lower than [`up_data_structs::MAX_DECIMAL_POINTS`].
        **/
       CollectionDecimalPointLimitExceeded: AugmentedError<ApiType>;
       /**
@@ -609,7 +608,7 @@
        **/
       EmptyArgument: AugmentedError<ApiType>;
       /**
-       * Repertition is only supported by refungible collection
+       * Repertition is only supported by refungible collection.
        **/
       RepartitionCalledOnNonRefungibleCollection: AugmentedError<ApiType>;
       /**
modifiedtests/src/interfaces/augment-api-events.tsdiffbeforeafterboth
--- a/tests/src/interfaces/augment-api-events.ts
+++ b/tests/src/interfaces/augment-api-events.ts
@@ -75,7 +75,7 @@
        **/
       CollectionPropertyDeleted: AugmentedEvent<ApiType, [u32, Bytes]>;
       /**
-       * The colletion property has been set.
+       * The colletion property has been added or edited.
        **/
       CollectionPropertySet: AugmentedEvent<ApiType, [u32, Bytes]>;
       /**
@@ -87,7 +87,7 @@
        **/
       ItemDestroyed: AugmentedEvent<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, u128]>;
       /**
-       * The colletion property permission has been set.
+       * The token property permission of a collection has been set.
        **/
       PropertyPermissionSet: AugmentedEvent<ApiType, [u32, Bytes]>;
       /**
@@ -95,7 +95,7 @@
        **/
       TokenPropertyDeleted: AugmentedEvent<ApiType, [u32, u32, Bytes]>;
       /**
-       * The token property has been set.
+       * The token property has been added or edited.
        **/
       TokenPropertySet: AugmentedEvent<ApiType, [u32, u32, Bytes]>;
       /**
@@ -407,7 +407,7 @@
     };
     structure: {
       /**
-       * Executed call on behalf of token
+       * Executed call on behalf of the token.
        **/
       Executed: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
       /**
@@ -499,90 +499,80 @@
     };
     unique: {
       /**
-       * Address was add to allow list
+       * Address was added to the allow list
        * 
        * # Arguments
-       * 
-       * * collection_id: Globally unique collection identifier.
-       * 
-       * * user:  Address.
+       * * collection_id: ID of the affected collection.
+       * * user: Address of the added account.
        **/
       AllowListAddressAdded: AugmentedEvent<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
-       * Address was remove from allow list
+       * Address was removed from the allow list
        * 
        * # Arguments
-       * 
-       * * collection_id: Globally unique collection identifier.
-       * 
-       * * user:  Address.
+       * * collection_id: ID of the affected collection.
+       * * user: Address of the removed account.
        **/
       AllowListAddressRemoved: AugmentedEvent<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
        * Collection admin was added
        * 
        * # Arguments
-       * 
-       * * collection_id: Globally unique collection identifier.
-       * 
-       * * admin:  Admin address.
+       * * collection_id: ID of the affected collection.
+       * * admin: Admin address.
        **/
       CollectionAdminAdded: AugmentedEvent<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
        * Collection admin was removed
        * 
        * # Arguments
-       * 
-       * * collection_id: Globally unique collection identifier.
-       * 
-       * * admin:  Admin address.
+       * * collection_id: ID of the affected collection.
+       * * admin: Removed admin address.
        **/
       CollectionAdminRemoved: AugmentedEvent<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
-       * Collection limits was set
+       * Collection limits were set
        * 
        * # Arguments
-       * 
-       * * collection_id: Globally unique collection identifier.
+       * * collection_id: ID of the affected collection.
        **/
       CollectionLimitSet: AugmentedEvent<ApiType, [u32]>;
       /**
-       * Collection owned was change
+       * Collection owned was changed
        * 
        * # Arguments
-       * 
-       * * collection_id: Globally unique collection identifier.
-       * 
-       * * owner:  New owner address.
+       * * collection_id: ID of the affected collection.
+       * * owner: New owner address.
        **/
       CollectionOwnedChanged: AugmentedEvent<ApiType, [u32, AccountId32]>;
+      /**
+       * Collection permissions were set
+       * 
+       * # Arguments
+       * * collection_id: ID of the affected collection.
+       **/
       CollectionPermissionSet: AugmentedEvent<ApiType, [u32]>;
       /**
        * Collection sponsor was removed
        * 
        * # Arguments
-       * 
-       * * collection_id: Globally unique collection identifier.
+       * * collection_id: ID of the affected collection.
        **/
       CollectionSponsorRemoved: AugmentedEvent<ApiType, [u32]>;
       /**
        * Collection sponsor was set
        * 
        * # Arguments
-       * 
-       * * collection_id: Globally unique collection identifier.
-       * 
-       * * owner:  New sponsor address.
+       * * collection_id: ID of the affected collection.
+       * * owner: New sponsor address.
        **/
       CollectionSponsorSet: AugmentedEvent<ApiType, [u32, AccountId32]>;
       /**
        * New sponsor was confirm
        * 
        * # Arguments
-       * 
-       * * collection_id: Globally unique collection identifier.
-       * 
-       * * sponsor:  New sponsor address.
+       * * collection_id: ID of the affected collection.
+       * * sponsor: New sponsor address.
        **/
       SponsorshipConfirmed: AugmentedEvent<ApiType, [u32, AccountId32]>;
       /**
modifiedtests/src/interfaces/augment-api-query.tsdiffbeforeafterboth
--- a/tests/src/interfaces/augment-api-query.ts
+++ b/tests/src/interfaces/augment-api-query.ts
@@ -70,11 +70,11 @@
     };
     common: {
       /**
-       * Storage of collection admins count.
+       * Storage of the amount of collection admins.
        **/
       adminAmount: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
       /**
-       * Allowlisted collection users
+       * Allowlisted collection users.
        **/
       allowlist: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
@@ -86,11 +86,11 @@
        **/
       collectionProperties: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
       /**
-       * Storage of collection properties permissions.
+       * Storage of token property permissions of a collection.
        **/
       collectionPropertyPermissions: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<BTreeMap<Bytes, UpDataStructsPropertyPermission>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
       /**
-       * Storage of the count of created collections.
+       * Storage of the count of created collections. Essentially contains the last collection ID.
        **/
       createdCollectionCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
       /**
@@ -102,7 +102,7 @@
        **/
       dummyStorageValue: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[UpDataStructsCollectionStats, u32, u32, UpDataStructsTokenChild, PhantomTypeUpDataStructs]>>>, []> & QueryableStorageEntry<ApiType, []>;
       /**
-       * List of collection admins
+       * List of collection admins.
        **/
       isAdmin: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
@@ -200,7 +200,7 @@
     };
     fungible: {
       /**
-       * Storage for delegated assets.
+       * Storage for assets delegated to a limited extent to other users.
        **/
       allowance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg3: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u128>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
@@ -244,11 +244,11 @@
     };
     nonfungible: {
       /**
-       * Amount of tokens owned by account.
+       * Amount of tokens owned by an account in a collection.
        **/
       accountBalance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u32>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
-       * Allowance set by an owner for a spender for a token.
+       * Allowance set by a token owner for another user to perform one of certain transactions on a token.
        **/
       allowance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
       /**
@@ -256,7 +256,14 @@
        **/
       owned: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg3: u32 | AnyNumber | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]>;
       /**
-       * Custom data that is serialized to bytes and attached to a token property.
+       * Custom data of a token that is serialized to bytes,
+       * primarily reserved for on-chain operations,
+       * normally obscured from the external users.
+       * 
+       * Auxiliary properties are slightly different from
+       * usual [`TokenProperties`] due to an unlimited number
+       * and separately stored and written-to key-value pairs.
+       * 
        * Currently used to store RMRK data.
        **/
       tokenAuxProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: UpDataStructsPropertyScope | 'None' | 'Rmrk' | number | Uint8Array, arg4: Bytes | string | Uint8Array) => Observable<Option<Bytes>>, [u32, u32, UpDataStructsPropertyScope, Bytes]> & QueryableStorageEntry<ApiType, [u32, u32, UpDataStructsPropertyScope, Bytes]>;
@@ -265,19 +272,19 @@
        **/
       tokenChildren: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array]) => Observable<bool>, [u32, u32, ITuple<[u32, u32]>]> & QueryableStorageEntry<ApiType, [u32, u32, ITuple<[u32, u32]>]>;
       /**
-       * Custom data serialized to bytes for token.
+       * Token data, used to partially describe a token.
        **/
       tokenData: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNonfungibleItemData>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
       /**
-       * Key-Value map stored for token.
+       * Map of key-value pairs, describing the metadata of a token.
        **/
       tokenProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
       /**
-       * Amount of burnt tokens for collection.
+       * Amount of burnt tokens in a collection.
        **/
       tokensBurnt: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
       /**
-       * Amount of tokens minted for collection.
+       * Total amount of minted tokens in a collection.
        **/
       tokensMinted: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
       /**
@@ -444,32 +451,35 @@
     };
     refungible: {
       /**
-       * Amount of tokens owned by account
+       * Amount of tokens (not pieces) partially owned by an account within a collection.
        **/
       accountBalance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u32>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
-       * Allowance set by an owner for a spender for a token
+       * Allowance set by a token owner for another user to perform one of certain transactions on a number of pieces of a token.
        **/
       allowance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg4: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u128>, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
-       * Amount of token pieces owned by account
+       * Amount of token pieces owned by account.
        **/
       balance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u128>, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
-       * Used to enumerate tokens owned by account
+       * Used to enumerate tokens owned by account.
        **/
       owned: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg3: u32 | AnyNumber | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]>;
       /**
-       * Custom data serialized to bytes for token
+       * Token data, used to partially describe a token.
        **/
       tokenData: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<PalletRefungibleItemData>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
+      /**
+       * Amount of pieces a refungible token is split into.
+       **/
       tokenProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
       /**
-       * Amount of burnt tokens for collection
+       * Amount of tokens burnt in a collection.
        **/
       tokensBurnt: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
       /**
-       * Amount of tokens minted for collection
+       * Total amount of minted tokens in a collection.
        **/
       tokensMinted: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
       /**
@@ -663,24 +673,33 @@
        * TODO: Off chain worker should remove from this map when collection gets removed
        **/
       createItemBasket: AugmentedQuery<ApiType, (arg: ITuple<[u32, AccountId32]> | [u32 | AnyNumber | Uint8Array, AccountId32 | string | Uint8Array]) => Observable<Option<u32>>, [ITuple<[u32, AccountId32]>]> & QueryableStorageEntry<ApiType, [ITuple<[u32, AccountId32]>]>;
+      /**
+       * Last sponsoring of fungible tokens approval in a collection
+       **/
       fungibleApproveBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
       /**
        * Collection id (controlled?2), owning user (real)
        **/
       fungibleTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
       /**
-       * Approval sponsoring
+       * Last sponsoring of NFT approval in a collection
        **/
       nftApproveBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
       /**
        * Collection id (controlled?2), token id (controlled?2)
        **/
       nftTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
+      /**
+       * Last sponsoring of RFT approval in a collection
+       **/
       refungibleApproveBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, u32, AccountId32]>;
       /**
        * Collection id (controlled?2), token id (controlled?2)
        **/
       reFungibleTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, u32, AccountId32]>;
+      /**
+       * Last sponsoring of token property setting // todo:doc rephrase this and the following
+       **/
       tokenPropertyBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
       /**
        * Variable metadata sponsoring
modifiedtests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth
--- a/tests/src/interfaces/augment-api-rpc.ts
+++ b/tests/src/interfaces/augment-api-rpc.ts
@@ -629,47 +629,47 @@
     };
     unique: {
       /**
-       * Get amount of different user tokens
+       * Get the amount of any user tokens owned by an account
        **/
       accountBalance: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;
       /**
-       * Get tokens owned by account
+       * Get tokens owned by an account in a collection
        **/
       accountTokens: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<u32>>>;
       /**
-       * Get admin list
+       * Get the list of admin accounts of a collection
        **/
       adminlist: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletEvmAccountBasicCrossAccountIdRepr>>>;
       /**
-       * Get allowed amount
+       * Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor
        **/
       allowance: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, sender: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, spender: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
       /**
-       * Check if user is allowed to use collection
+       * Check if a user is allowed to operate within a collection
        **/
       allowed: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;
       /**
-       * Get allowlist
+       * Get the list of accounts allowed to operate within a collection
        **/
       allowlist: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletEvmAccountBasicCrossAccountIdRepr>>>;
       /**
-       * Get amount of specific account token
+       * Get the amount of a specific token owned by an account
        **/
       balance: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
       /**
-       * Get collection by specified id
+       * Get a collection by the specified ID
        **/
       collectionById: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<UpDataStructsRpcCollection>>>;
       /**
-       * Get collection properties
+       * Get collection properties, optionally limited to the provided keys
        **/
       collectionProperties: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsProperty>>>;
       /**
-       * Get collection stats
+       * Get chain stats about collections
        **/
       collectionStats: AugmentedRpc<(at?: Hash | string | Uint8Array) => Observable<UpDataStructsCollectionStats>>;
       /**
-       * Get tokens contained in collection
+       * Get tokens contained within a collection
        **/
       collectionTokens: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<u32>>>;
       /**
@@ -681,15 +681,15 @@
        **/
       effectiveCollectionLimits: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<UpDataStructsCollectionLimits>>>;
       /**
-       * Get last token id
+       * Get the last token ID created in a collection
        **/
       lastTokenId: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;
       /**
-       * Get number of blocks when sponsored transaction is available
+       * Get the number of blocks until sponsoring a transaction is available
        **/
       nextSponsored: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u64>>>;
       /**
-       * Get property permissions
+       * Get property permissions, optionally limited to the provided keys
        **/
       propertyPermissions: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsPropertyKeyPermission>>>;
       /**
@@ -697,15 +697,15 @@
        **/
       tokenChildren: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsTokenChild>>>;
       /**
-       * Get token data
+       * Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT
        **/
       tokenData: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<UpDataStructsTokenData>>;
       /**
-       * Check if token exists
+       * Check if the token exists
        **/
       tokenExists: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;
       /**
-       * Get token owner
+       * Get the token owner
        **/
       tokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;
       /**
@@ -713,19 +713,19 @@
        **/
       tokenOwners: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletEvmAccountBasicCrossAccountIdRepr>>>;
       /**
-       * Get token properties
+       * Get token properties, optionally limited to the provided keys
        **/
       tokenProperties: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsProperty>>>;
       /**
-       * Get token owner, in case of nested token - find parent recursive
+       * Get the topmost token owner in the hierarchy of a possibly nested token
        **/
       topmostTokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;
       /**
-       * Get total pieces of token
+       * Get the total amount of pieces of an RFT
        **/
       totalPieces: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u128>>>;
       /**
-       * Get amount of unique collection tokens
+       * Get the amount of distinctive tokens present in a collection
        **/
       totalSupply: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;
       /**
modifiedtests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth
--- a/tests/src/interfaces/augment-api-tx.ts
+++ b/tests/src/interfaces/augment-api-tx.ts
@@ -730,87 +730,99 @@
     };
     unique: {
       /**
-       * Adds an admin of the Collection.
-       * NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.
+       * Add an admin to a collection.
+       * 
+       * NFT Collection can be controlled by multiple admin addresses
+       * (some which can also be servers, for example). Admins can issue
+       * and burn NFTs, as well as add and remove other admins,
+       * but cannot change NFT or Collection ownership.
        * 
        * # Permissions
        * 
-       * * Collection Owner.
-       * * Collection Admin.
+       * * Collection owner
+       * * Collection admin
        * 
        * # Arguments
-       * 
-       * * collection_id: ID of the Collection to add admin for.
        * 
-       * * new_admin_id: Address of new admin to add.
+       * * `collection_id`: ID of the Collection to add an admin for.
+       * * `new_admin`: Address of new admin to add.
        **/
-      addCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newAdminId: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
+      addCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newAdmin: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
        * Add an address to allow list.
        * 
        * # Permissions
        * 
-       * * Collection Owner
-       * * Collection Admin
+       * * Collection owner
+       * * Collection admin
        * 
        * # Arguments
        * 
-       * * collection_id.
-       * 
-       * * address.
+       * * `collection_id`: ID of the modified collection.
+       * * `address`: ID of the address to be added to the allowlist.
        **/
       addToAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
-       * Set, change, or remove approved address to transfer the ownership of the NFT.
+       * Allow a non-permissioned address to transfer or burn an item.
        * 
        * # Permissions
        * 
-       * * Collection Owner
-       * * Collection Admin
-       * * Current NFT owner
+       * * Collection owner
+       * * Collection admin
+       * * Current item owner
        * 
        * # Arguments
-       * 
-       * * approved: Address that is approved to transfer this NFT or zero (if needed to remove approval).
        * 
-       * * collection_id.
-       * 
-       * * item_id: ID of the item.
+       * * `spender`: Account to be approved to make specific transactions on non-owned tokens.
+       * * `collection_id`: ID of the collection the item belongs to.
+       * * `item_id`: ID of the item transactions on which are now approved.
+       * * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).
+       * Set to 0 to revoke the approval.
        **/
       approve: AugmentedSubmittable<(spender: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
       /**
-       * Destroys a concrete instance of NFT on behalf of the owner
-       * See also: [`approve`]
+       * Destroy a token on behalf of the owner as a non-owner account.
+       * 
+       * See also: [`approve`][`Pallet::approve`].
+       * 
+       * After this method executes, one approval is removed from the total so that
+       * the approved address will not be able to transfer this item again from this owner.
        * 
        * # Permissions
        * 
-       * * Collection Owner.
-       * * Collection Admin.
-       * * Current NFT Owner.
+       * * Collection owner
+       * * Collection admin
+       * * Current token owner
+       * * Address approved by current item owner
        * 
        * # Arguments
        * 
-       * * collection_id: ID of the collection.
-       * 
-       * * item_id: ID of NFT to burn.
-       * 
-       * * from: owner of item
+       * * `from`: The owner of the burning item.
+       * * `collection_id`: ID of the collection to which the item belongs.
+       * * `item_id`: ID of item to burn.
+       * * `value`: Number of pieces to burn.
+       * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+       * * Fungible Mode: The desired number of pieces to burn.
+       * * Re-Fungible Mode: The desired number of pieces to burn.
        **/
       burnFrom: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, from: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32, u128]>;
       /**
-       * Destroys a concrete instance of NFT.
+       * Destroy an item.
        * 
        * # Permissions
        * 
-       * * Collection Owner.
-       * * Collection Admin.
-       * * Current NFT Owner.
+       * * Collection owner
+       * * Collection admin
+       * * Current item owner
        * 
        * # Arguments
        * 
-       * * collection_id: ID of the collection.
-       * 
-       * * item_id: ID of NFT to burn.
+       * * `collection_id`: ID of the collection to which the item belongs.
+       * * `item_id`: ID of item to burn.
+       * * `value`: Number of pieces of the item to destroy.
+       * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+       * * Fungible Mode: The desired number of pieces to burn.
+       * * Re-Fungible Mode: The desired number of pieces to burn.
        **/
       burnItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;
       /**
@@ -818,131 +830,200 @@
        * 
        * # Permissions
        * 
-       * * Collection Owner.
+       * * Collection owner
        * 
        * # Arguments
        * 
-       * * collection_id.
-       * 
-       * * new_owner.
+       * * `collection_id`: ID of the modified collection.
+       * * `new_owner`: ID of the account that will become the owner.
        **/
       changeCollectionOwner: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newOwner: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, AccountId32]>;
       /**
+       * Confirm own sponsorship of a collection, becoming the sponsor.
+       * 
+       * An invitation must be pending, see [`set_collection_sponsor`][`Pallet::set_collection_sponsor`].
+       * Sponsor can pay the fees of a transaction instead of the sender,
+       * but only within specified limits.
+       * 
        * # Permissions
        * 
-       * * Sponsor.
+       * * Sponsor-to-be
        * 
        * # Arguments
        * 
-       * * collection_id.
+       * * `collection_id`: ID of the collection with the pending sponsor.
        **/
       confirmSponsorship: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
       /**
-       * This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner of the collection is set to the address that signed the transaction and can be changed later.
+       * Create a collection of tokens.
+       * 
+       * Each Token may have multiple properties encoded as an array of bytes
+       * of certain length. The initial owner of the collection is set
+       * to the address that signed the transaction and can be changed later.
+       * 
+       * Prefer the more advanced [`create_collection_ex`][`Pallet::create_collection_ex`] instead.
        * 
        * # Permissions
        * 
-       * * Anyone.
+       * * Anyone - becomes the owner of the new collection.
        * 
        * # Arguments
        * 
-       * * collection_name: UTF-16 string with collection name (limit 64 characters), will be stored as zero-terminated.
+       * * `collection_name`: Wide-character string with collection name
+       * (limit [`MAX_COLLECTION_NAME_LENGTH`]).
+       * * `collection_description`: Wide-character string with collection description
+       * (limit [`MAX_COLLECTION_DESCRIPTION_LENGTH`]).
+       * * `token_prefix`: Byte string containing the token prefix to mark a collection
+       * to which a token belongs (limit [`MAX_TOKEN_PREFIX_LENGTH`]).
+       * * `mode`: Type of items stored in the collection and type dependent data.
+       **/
+      createCollection: AugmentedSubmittable<(collectionName: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], collectionDescription: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], tokenPrefix: Bytes | string | Uint8Array, mode: UpDataStructsCollectionMode | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<u16>, Vec<u16>, Bytes, UpDataStructsCollectionMode]>;
+      /**
+       * Create a collection with explicit parameters.
        * 
-       * * collection_description: UTF-16 string with collection description (limit 256 characters), will be stored as zero-terminated.
+       * Prefer it to the deprecated [`create_collection`][`Pallet::create_collection`] method.
+       * 
+       * # Permissions
        * 
-       * * token_prefix: UTF-8 string with token prefix.
+       * * Anyone - becomes the owner of the new collection.
        * 
-       * * mode: [CollectionMode] collection type and type dependent data.
-       **/
-      createCollection: AugmentedSubmittable<(collectionName: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], collectionDescription: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], tokenPrefix: Bytes | string | Uint8Array, mode: UpDataStructsCollectionMode | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<u16>, Vec<u16>, Bytes, UpDataStructsCollectionMode]>;
-      /**
-       * This method creates a collection
+       * # Arguments
        * 
-       * Prefer it to deprecated [`created_collection`] method
+       * * `data`: Explicit data of a collection used for its creation.
        **/
       createCollectionEx: AugmentedSubmittable<(data: UpDataStructsCreateCollectionData | { mode?: any; access?: any; name?: any; description?: any; tokenPrefix?: any; pendingSponsor?: any; limits?: any; permissions?: any; tokenPropertyPermissions?: any; properties?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [UpDataStructsCreateCollectionData]>;
       /**
-       * This method creates a concrete instance of NFT Collection created with CreateCollection method.
+       * Mint an item within a collection.
        * 
+       * A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].
+       * 
        * # Permissions
        * 
-       * * Collection Owner.
-       * * Collection Admin.
+       * * Collection owner
+       * * Collection admin
        * * Anyone if
        * * Allow List is enabled, and
        * * Address is added to allow list, and
-       * * MintPermission is enabled (see SetMintPermission method)
+       * * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])
        * 
        * # Arguments
        * 
-       * * collection_id: ID of the collection.
+       * * `collection_id`: ID of the collection to which an item would belong.
+       * * `owner`: Address of the initial owner of the item.
+       * * `data`: Token data describing the item to store on chain.
+       **/
+      createItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, data: UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, UpDataStructsCreateItemData]>;
+      /**
+       * Create multiple items within a collection.
        * 
-       * * owner: Address, initial owner of the NFT.
+       * A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].
+       * 
+       * # Permissions
+       * 
+       * * Collection owner
+       * * Collection admin
+       * * Anyone if
+       * * Allow List is enabled, and
+       * * Address is added to the allow list, and
+       * * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])
        * 
-       * * data: Token data to store on chain.
+       * # Arguments
+       * 
+       * * `collection_id`: ID of the collection to which the tokens would belong.
+       * * `owner`: Address of the initial owner of the tokens.
+       * * `items_data`: Vector of data describing each item to be created.
        **/
-      createItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, data: UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, UpDataStructsCreateItemData]>;
+      createMultipleItems: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemsData: Vec<UpDataStructsCreateItemData> | (UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, Vec<UpDataStructsCreateItemData>]>;
       /**
-       * This method creates multiple items in a collection created with CreateCollection method.
+       * Create multiple items within a collection with explicitly specified initial parameters.
        * 
        * # Permissions
        * 
-       * * Collection Owner.
-       * * Collection Admin.
+       * * Collection owner
+       * * Collection admin
        * * Anyone if
        * * Allow List is enabled, and
        * * Address is added to allow list, and
-       * * MintPermission is enabled (see SetMintPermission method)
+       * * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])
        * 
        * # Arguments
        * 
-       * * collection_id: ID of the collection.
+       * * `collection_id`: ID of the collection to which the tokens would belong.
+       * * `data`: Explicit item creation data.
+       **/
+      createMultipleItemsEx: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, data: UpDataStructsCreateItemExData | { NFT: any } | { Fungible: any } | { RefungibleMultipleItems: any } | { RefungibleMultipleOwners: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCreateItemExData]>;
+      /**
+       * Delete specified collection properties.
        * 
-       * * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
+       * # Permissions
+       * 
+       * * Collection Owner
+       * * Collection Admin
+       * 
+       * # Arguments
        * 
-       * * owner: Address, initial owner of the NFT.
+       * * `collection_id`: ID of the modified collection.
+       * * `property_keys`: Vector of keys of the properties to be deleted.
+       * Keys support Latin letters, `-`, `_`, and `.` as symbols.
        **/
-      createMultipleItems: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemsData: Vec<UpDataStructsCreateItemData> | (UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, Vec<UpDataStructsCreateItemData>]>;
-      createMultipleItemsEx: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, data: UpDataStructsCreateItemExData | { NFT: any } | { Fungible: any } | { RefungibleMultipleItems: any } | { RefungibleMultipleOwners: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCreateItemExData]>;
       deleteCollectionProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, propertyKeys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<Bytes>]>;
+      /**
+       * Delete specified token properties. Currently properties only work with NFTs.
+       * 
+       * # Permissions
+       * 
+       * * Depends on collection's token property permissions and specified property mutability:
+       * * Collection owner
+       * * Collection admin
+       * * Token owner
+       * 
+       * # Arguments
+       * 
+       * * `collection_id`: ID of the collection to which the token belongs.
+       * * `token_id`: ID of the modified token.
+       * * `property_keys`: Vector of keys of the properties to be deleted.
+       * Keys support Latin letters, `-`, `_`, and `.` as symbols.
+       **/
       deleteTokenProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, propertyKeys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, u32, Vec<Bytes>]>;
       /**
-       * Destroys collection if no tokens within this collection
+       * Destroy a collection if no tokens exist within.
        * 
        * # Permissions
        * 
-       * * Collection Owner.
+       * * Collection owner
        * 
        * # Arguments
        * 
-       * * collection_id: collection to destroy.
+       * * `collection_id`: Collection to destroy.
        **/
       destroyCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
       /**
-       * Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.
+       * Remove admin of a collection.
+       * 
+       * An admin address can remove itself. List of admins may become empty,
+       * in which case only Collection Owner will be able to add an Admin.
        * 
        * # Permissions
        * 
-       * * Collection Owner.
-       * * Collection Admin.
+       * * Collection owner
+       * * Collection admin
        * 
        * # Arguments
        * 
-       * * collection_id: ID of the Collection to remove admin for.
-       * 
-       * * account_id: Address of admin to remove.
+       * * `collection_id`: ID of the collection to remove the admin for.
+       * * `account_id`: Address of the admin to remove.
        **/
       removeCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, accountId: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
       /**
-       * Switch back to pay-per-own-transaction model.
+       * Remove a collection's a sponsor, making everyone pay for their own transactions.
        * 
        * # Permissions
        * 
-       * * Collection owner.
+       * * Collection owner
        * 
        * # Arguments
        * 
-       * * collection_id.
+       * * `collection_id`: ID of the collection with the sponsor to remove.
        **/
       removeCollectionSponsor: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
       /**
@@ -950,46 +1031,140 @@
        * 
        * # Permissions
        * 
-       * * Collection Owner
-       * * Collection Admin
+       * * Collection owner
+       * * Collection admin
        * 
        * # Arguments
        * 
-       * * collection_id.
+       * * `collection_id`: ID of the modified collection.
+       * * `address`: ID of the address to be removed from the allowlist.
+       **/
+      removeFromAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
+      /**
+       * Re-partition a refungible token, while owning all of its parts/pieces.
+       * 
+       * # Permissions
+       * 
+       * * Token owner (must own every part)
+       * 
+       * # Arguments
+       * 
+       * * `collection_id`: ID of the collection the RFT belongs to.
+       * * `token_id`: ID of the RFT.
+       * * `amount`: New number of parts/pieces into which the token shall be partitioned.
+       **/
+      repartition: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;
+      /**
+       * Set specific limits of a collection. Empty, or None fields mean chain default.
+       * 
+       * # Permissions
        * 
-       * * address.
+       * * Collection owner
+       * * Collection admin
+       * 
+       * # Arguments
+       * 
+       * * `collection_id`: ID of the modified collection.
+       * * `new_limit`: New limits of the collection. Fields that are not set (None)
+       * will not overwrite the old ones.
        **/
-      removeFromAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
-      repartition: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, token: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;
       setCollectionLimits: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newLimit: UpDataStructsCollectionLimits | { accountTokenOwnershipLimit?: any; sponsoredDataSize?: any; sponsoredDataRateLimit?: any; tokenLimit?: any; sponsorTransferTimeout?: any; sponsorApproveTimeout?: any; ownerCanTransfer?: any; ownerCanDestroy?: any; transfersEnabled?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCollectionLimits]>;
-      setCollectionPermissions: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newLimit: UpDataStructsCollectionPermissions | { access?: any; mintMode?: any; nesting?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCollectionPermissions]>;
-      setCollectionProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, properties: Vec<UpDataStructsProperty> | (UpDataStructsProperty | { key?: any; value?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<UpDataStructsProperty>]>;
       /**
+       * Set specific permissions of a collection. Empty, or None fields mean chain default.
+       * 
        * # Permissions
        * 
-       * * Collection Owner
+       * * Collection owner
+       * * Collection admin
        * 
        * # Arguments
        * 
-       * * collection_id.
+       * * `collection_id`: ID of the modified collection.
+       * * `new_permission`: New permissions of the collection. Fields that are not set (None)
+       * will not overwrite the old ones.
+       **/
+      setCollectionPermissions: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newPermission: UpDataStructsCollectionPermissions | { access?: any; mintMode?: any; nesting?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCollectionPermissions]>;
+      /**
+       * Add or change collection properties.
+       * 
+       * # Permissions
+       * 
+       * * Collection owner
+       * * Collection admin
        * 
-       * * new_sponsor.
+       * # Arguments
+       * 
+       * * `collection_id`: ID of the modified collection.
+       * * `properties`: Vector of key-value pairs stored as the collection's metadata.
+       * Keys support Latin letters, `-`, `_`, and `.` as symbols.
        **/
+      setCollectionProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, properties: Vec<UpDataStructsProperty> | (UpDataStructsProperty | { key?: any; value?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<UpDataStructsProperty>]>;
+      /**
+       * Set (invite) a new collection sponsor.
+       * 
+       * If successful, confirmation from the sponsor-to-be will be pending.
+       * 
+       * # Permissions
+       * 
+       * * Collection owner
+       * * Collection admin
+       * 
+       * # Arguments
+       * 
+       * * `collection_id`: ID of the modified collection.
+       * * `new_sponsor`: ID of the account of the sponsor-to-be.
+       **/
       setCollectionSponsor: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newSponsor: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, AccountId32]>;
+      /**
+       * Add or change token properties according to collection's permissions.
+       * Currently properties only work with NFTs.
+       * 
+       * # Permissions
+       * 
+       * * Depends on collection's token property permissions and specified property mutability:
+       * * Collection owner
+       * * Collection admin
+       * * Token owner
+       * 
+       * See [`set_token_property_permissions`][`Pallet::set_token_property_permissions`].
+       * 
+       * # Arguments
+       * 
+       * * `collection_id: ID of the collection to which the token belongs.
+       * * `token_id`: ID of the modified token.
+       * * `properties`: Vector of key-value pairs stored as the token's metadata.
+       * Keys support Latin letters, `-`, `_`, and `.` as symbols.
+       **/
       setTokenProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, properties: Vec<UpDataStructsProperty> | (UpDataStructsProperty | { key?: any; value?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, u32, Vec<UpDataStructsProperty>]>;
-      setTokenPropertyPermissions: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, propertyPermissions: Vec<UpDataStructsPropertyKeyPermission> | (UpDataStructsPropertyKeyPermission | { key?: any; permission?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<UpDataStructsPropertyKeyPermission>]>;
       /**
-       * Set transfers_enabled value for particular collection
+       * Add or change token property permissions of a collection.
+       * 
+       * Without a permission for a particular key, a property with that key
+       * cannot be created in a token.
        * 
        * # Permissions
        * 
-       * * Collection Owner.
+       * * Collection owner
+       * * Collection admin
        * 
        * # Arguments
        * 
-       * * collection_id: ID of the collection.
+       * * `collection_id`: ID of the modified collection.
+       * * `property_permissions`: Vector of permissions for property keys.
+       * Keys support Latin letters, `-`, `_`, and `.` as symbols.
+       **/
+      setTokenPropertyPermissions: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, propertyPermissions: Vec<UpDataStructsPropertyKeyPermission> | (UpDataStructsPropertyKeyPermission | { key?: any; permission?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<UpDataStructsPropertyKeyPermission>]>;
+      /**
+       * Completely allow or disallow transfers for a particular collection.
        * 
-       * * value: New flag value.
+       * # Permissions
+       * 
+       * * Collection owner
+       * 
+       * # Arguments
+       * 
+       * * `collection_id`: ID of the collection.
+       * * `value`: New value of the flag, are transfers allowed?
        **/
       setTransfersEnabledFlag: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, value: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, bool]>;
       /**
@@ -997,47 +1172,50 @@
        * 
        * # Permissions
        * 
-       * * Collection Owner
-       * * Collection Admin
-       * * Current NFT owner
+       * * Collection owner
+       * * Collection admin
+       * * Current token owner
        * 
        * # Arguments
        * 
-       * * recipient: Address of token recipient.
-       * 
-       * * collection_id.
-       * 
-       * * item_id: ID of the item
+       * * `recipient`: Address of token recipient.
+       * * `collection_id`: ID of the collection the item belongs to.
+       * * `item_id`: ID of the item.
        * * Non-Fungible Mode: Required.
        * * Fungible Mode: Ignored.
        * * Re-Fungible Mode: Required.
        * 
-       * * value: Amount to transfer.
-       * * Non-Fungible Mode: Ignored
-       * * Fungible Mode: Must specify transferred amount
-       * * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)
+       * * `value`: Amount to transfer.
+       * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+       * * Fungible Mode: The desired number of pieces to transfer.
+       * * Re-Fungible Mode: The desired number of pieces to transfer.
        **/
       transfer: AugmentedSubmittable<(recipient: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
       /**
-       * Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.
-       * 
-       * # Permissions
-       * * Collection Owner
-       * * Collection Admin
-       * * Current NFT owner
-       * * Address approved by current NFT owner
+       * Change ownership of an item on behalf of the owner as a non-owner account.
        * 
-       * # Arguments
+       * See the [`approve`][`Pallet::approve`] method for additional information.
        * 
-       * * from: Address that owns token.
+       * After this method executes, one approval is removed from the total so that
+       * the approved address will not be able to transfer this item again from this owner.
        * 
-       * * recipient: Address of token recipient.
+       * # Permissions
        * 
-       * * collection_id.
+       * * Collection owner
+       * * Collection admin
+       * * Current item owner
+       * * Address approved by current item owner
        * 
-       * * item_id: ID of the item.
+       * # Arguments
        * 
-       * * value: Amount to transfer.
+       * * `from`: Address that currently owns the token.
+       * * `recipient`: Address of the new token-owner-to-be.
+       * * `collection_id`: ID of the collection the item.
+       * * `item_id`: ID of the item to be transferred.
+       * * `value`: Amount to transfer.
+       * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+       * * Fungible Mode: The desired number of pieces to transfer.
+       * * Re-Fungible Mode: The desired number of pieces to transfer.
        **/
       transferFrom: AugmentedSubmittable<(from: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, recipient: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
       /**
modifiedtests/src/interfaces/default/types.tsdiffbeforeafterboth
--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -1672,7 +1672,7 @@
   readonly isAddCollectionAdmin: boolean;
   readonly asAddCollectionAdmin: {
     readonly collectionId: u32;
-    readonly newAdminId: PalletEvmAccountBasicCrossAccountIdRepr;
+    readonly newAdmin: PalletEvmAccountBasicCrossAccountIdRepr;
   } & Struct;
   readonly isRemoveCollectionAdmin: boolean;
   readonly asRemoveCollectionAdmin: {
@@ -1784,12 +1784,12 @@
   readonly isSetCollectionPermissions: boolean;
   readonly asSetCollectionPermissions: {
     readonly collectionId: u32;
-    readonly newLimit: UpDataStructsCollectionPermissions;
+    readonly newPermission: UpDataStructsCollectionPermissions;
   } & Struct;
   readonly isRepartition: boolean;
   readonly asRepartition: {
     readonly collectionId: u32;
-    readonly token: u32;
+    readonly tokenId: u32;
     readonly amount: u128;
   } & Struct;
   readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition';
modifiedtests/src/interfaces/lookup.tsdiffbeforeafterboth
--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -1269,7 +1269,7 @@
       },
       add_collection_admin: {
         collectionId: 'u32',
-        newAdminId: 'PalletEvmAccountBasicCrossAccountIdRepr',
+        newAdmin: 'PalletEvmAccountBasicCrossAccountIdRepr',
       },
       remove_collection_admin: {
         collectionId: 'u32',
@@ -1361,11 +1361,11 @@
       },
       set_collection_permissions: {
         collectionId: 'u32',
-        newLimit: 'UpDataStructsCollectionPermissions',
+        newPermission: 'UpDataStructsCollectionPermissions',
       },
       repartition: {
         collectionId: 'u32',
-        token: 'u32',
+        tokenId: 'u32',
         amount: 'u128'
       }
     }
modifiedtests/src/interfaces/types-lookup.tsdiffbeforeafterboth
--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -1385,7 +1385,7 @@
     readonly isAddCollectionAdmin: boolean;
     readonly asAddCollectionAdmin: {
       readonly collectionId: u32;
-      readonly newAdminId: PalletEvmAccountBasicCrossAccountIdRepr;
+      readonly newAdmin: PalletEvmAccountBasicCrossAccountIdRepr;
     } & Struct;
     readonly isRemoveCollectionAdmin: boolean;
     readonly asRemoveCollectionAdmin: {
@@ -1497,12 +1497,12 @@
     readonly isSetCollectionPermissions: boolean;
     readonly asSetCollectionPermissions: {
       readonly collectionId: u32;
-      readonly newLimit: UpDataStructsCollectionPermissions;
+      readonly newPermission: UpDataStructsCollectionPermissions;
     } & Struct;
     readonly isRepartition: boolean;
     readonly asRepartition: {
       readonly collectionId: u32;
-      readonly token: u32;
+      readonly tokenId: u32;
       readonly amount: u128;
     } & Struct;
     readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition';
modifiedtests/src/interfaces/unique/definitions.tsdiffbeforeafterboth
--- a/tests/src/interfaces/unique/definitions.ts
+++ b/tests/src/interfaces/unique/definitions.ts
@@ -37,49 +37,143 @@
 export default {
   types: {},
   rpc: {
-    adminlist: fun('Get admin list', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),
-    allowlist: fun('Get allowlist', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),
+    accountTokens: fun(
+      'Get tokens owned by an account in a collection', 
+      [collectionParam, crossAccountParam()], 
+      'Vec<u32>',
+    ),
+    collectionTokens: fun(
+      'Get tokens contained within a collection', 
+      [collectionParam], 
+      'Vec<u32>',
+    ),
+    tokenExists: fun(
+      'Check if the token exists', 
+      [collectionParam, tokenParam], 
+      'bool',
+    ),
 
-    accountTokens: fun('Get tokens owned by account', [collectionParam, crossAccountParam()], 'Vec<u32>'),
-    collectionTokens: fun('Get tokens contained in collection', [collectionParam], 'Vec<u32>'),
+    tokenOwner: fun(
+      'Get the token owner', 
+      [collectionParam, tokenParam], 
+      `Option<${CROSS_ACCOUNT_ID_TYPE}>`,
+    ),
+    topmostTokenOwner: fun(
+      'Get the topmost token owner in the hierarchy of a possibly nested token', 
+      [collectionParam, tokenParam], 
+      `Option<${CROSS_ACCOUNT_ID_TYPE}>`,
+    ),
+    tokenOwners: fun(
+      'Returns 10 tokens owners in no particular order', 
+      [collectionParam, tokenParam], 
+      `Vec<${CROSS_ACCOUNT_ID_TYPE}>`,
+    ),
+    tokenChildren: fun(
+      'Get tokens nested directly into the token', 
+      [collectionParam, tokenParam], 
+      'Vec<UpDataStructsTokenChild>',
+    ),
 
-    lastTokenId: fun('Get last token id', [collectionParam], 'u32'),
-    totalSupply: fun('Get amount of unique collection tokens', [collectionParam], 'u32'),
-    accountBalance: fun('Get amount of different user tokens', [collectionParam, crossAccountParam()], 'u32'),
-    balance: fun('Get amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),
-    allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),
-    tokenOwner: fun('Get token owner', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
-    tokenOwners: fun('Returns 10 tokens owners in no particular order', [collectionParam, tokenParam], `Vec<${CROSS_ACCOUNT_ID_TYPE}>`),
-    topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
-    tokenChildren: fun('Get tokens nested directly into the token', [collectionParam, tokenParam], 'Vec<UpDataStructsTokenChild>'),
-    constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),
-    variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),
     collectionProperties: fun(
-      'Get collection properties',
+      'Get collection properties, optionally limited to the provided keys',
       [collectionParam, propertyKeysParam],
       'Vec<UpDataStructsProperty>',
     ),
     tokenProperties: fun(
-      'Get token properties',
+      'Get token properties, optionally limited to the provided keys',
       [collectionParam, tokenParam, propertyKeysParam],
       'Vec<UpDataStructsProperty>',
     ),
     propertyPermissions: fun(
-      'Get property permissions',
+      'Get property permissions, optionally limited to the provided keys',
       [collectionParam, propertyKeysParam],
       'Vec<UpDataStructsPropertyKeyPermission>',
     ),
+
+    constMetadata: fun(
+      'Get token constant metadata', 
+      [collectionParam, tokenParam], 
+      'Vec<u8>',
+    ),
+    variableMetadata: fun(
+      'Get token variable metadata', 
+      [collectionParam, tokenParam], 
+      'Vec<u8>',
+    ),
+
     tokenData: fun(
-      'Get token data',
+      'Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT',
       [collectionParam, tokenParam, propertyKeysParam],
       'UpDataStructsTokenData',
     ),
-    tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),
-    collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsRpcCollection>'),
-    collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),
-    allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),
-    nextSponsored: fun('Get number of blocks when sponsored transaction is available', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),
-    effectiveCollectionLimits: fun('Get effective collection limits', [collectionParam], 'Option<UpDataStructsCollectionLimits>'),
-    totalPieces: fun('Get total pieces of token', [collectionParam, tokenParam], 'Option<u128>'),
+    totalSupply: fun(
+      'Get the amount of distinctive tokens present in a collection', 
+      [collectionParam], 
+      'u32',
+    ),
+
+    accountBalance: fun(
+      'Get the amount of any user tokens owned by an account', 
+      [collectionParam, crossAccountParam()], 
+      'u32',
+    ),
+    balance: fun(
+      'Get the amount of a specific token owned by an account', 
+      [collectionParam, crossAccountParam(), tokenParam], 
+      'u128',
+    ),
+    allowance: fun(
+      'Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor', 
+      [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 
+      'u128',
+    ),
+
+    adminlist: fun(
+      'Get the list of admin accounts of a collection', 
+      [collectionParam], 
+      'Vec<PalletEvmAccountBasicCrossAccountIdRepr>',
+    ),
+    allowlist: fun(
+      'Get the list of accounts allowed to operate within a collection', 
+      [collectionParam], 
+      'Vec<PalletEvmAccountBasicCrossAccountIdRepr>',
+    ),
+    allowed: fun(
+      'Check if a user is allowed to operate within a collection', 
+      [collectionParam, crossAccountParam()], 
+      'bool',
+    ),
+
+    lastTokenId: fun(
+      'Get the last token ID created in a collection', 
+      [collectionParam], 
+      'u32',
+    ),
+    collectionById: fun(
+      'Get a collection by the specified ID', 
+      [collectionParam], 
+      'Option<UpDataStructsRpcCollection>',
+    ),
+    collectionStats: fun(
+      'Get chain stats about collections', 
+      [], 
+      'UpDataStructsCollectionStats',
+    ),
+
+    nextSponsored: fun(
+      'Get the number of blocks until sponsoring a transaction is available', 
+      [collectionParam, crossAccountParam(), tokenParam], 
+      'Option<u64>',
+    ),
+    effectiveCollectionLimits: fun(
+      'Get effective collection limits', 
+      [collectionParam], 
+      'Option<UpDataStructsCollectionLimits>',
+    ),
+    totalPieces: fun(
+      'Get the total amount of pieces of an RFT', 
+      [collectionParam, tokenParam], 
+      'Option<u128>',
+    ),
   },
 };