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

difftreelog

feat add ApproveFrom eth mirror

Grigoriy Simonov2023-01-09parent: #fe83568.patch.diff
in: master

26 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -746,6 +746,8 @@
 		ApprovedValueTooLow,
 		/// Tried to approve more than owned
 		CantApproveMoreThanOwned,
+		/// Only spending from eth mirror could be approved
+		AddressIsNotEthMirror,
 
 		/// Can't transfer tokens to ethereum zero address
 		AddressIsZero,
@@ -1797,6 +1799,9 @@
 	/// The price of setting the permission of the operation from another user.
 	fn approve() -> Weight;
 
+	/// The price of setting the permission of the operation from another user for eth mirror.
+	fn approve_from() -> Weight;
+
 	/// Transfer price from another user.
 	fn transfer_from() -> Weight;
 
@@ -2008,6 +2013,22 @@
 		amount: u128,
 	) -> DispatchResultWithPostInfo;
 
+	/// Grant access to another account to transfer parts of the token owned by the calling user's eth mirror via [Self::transfer_from].
+	///
+	/// * `sender` - The user who grants access to the token.
+	/// * `from` - Spender's eth mirror.
+	/// * `to` - The user to whom the rights are granted.
+	/// * `token` - The token to which access is granted.
+	/// * `amount` - The amount of pieces that another user can dispose of.
+	fn approve_from(
+		&self,
+		sender: T::CrossAccountId,
+		from: T::CrossAccountId,
+		to: T::CrossAccountId,
+		token: TokenId,
+		amount: u128,
+	) -> DispatchResultWithPostInfo;
+
 	/// Send parts of a token owned by another user.
 	///
 	/// Before calling this method, you must grant rights to the calling user via [`Self::approve`].
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
+++ b/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
@@ -283,8 +283,8 @@
 
 /// Ethereum representation of Optional value with CrossAddress.
 struct OptionCrossAddress {
-	/// TODO: field description
+	/// Whether or not this CrossAdress is valid and has meaning.
 	bool status;
-	/// TODO: field description
+	/// The underlying CrossAddress value. If the status is false, can be set to whatever.
 	CrossAddress value;
 }
modifiedpallets/fungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -82,6 +82,16 @@
 		<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200), &Unlimited)?;
 	}: {<Pallet<T>>::set_allowance(&collection, &sender, &spender, 100)?}
 
+	approve_from {
+		bench_init!{
+			owner: sub; collection: collection(owner);
+			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
+
+		};
+		let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
+		<Pallet<T>>::create_item(&collection, &owner, (owner_eth.clone(), 200), &Unlimited)?;
+	}: {<Pallet<T>>::set_allowance_for(&collection, &sender, &owner_eth, &spender, 100)?}
+
 	transfer_from {
 		bench_init!{
 			owner: sub; collection: collection(owner);
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -87,6 +87,10 @@
 		<SelfWeightOf<T>>::approve()
 	}
 
+	fn approve_from() -> Weight {
+		<SelfWeightOf<T>>::approve_from()
+	}
+
 	fn transfer_from() -> Weight {
 		<SelfWeightOf<T>>::transfer_from()
 	}
@@ -254,6 +258,25 @@
 		)
 	}
 
+	fn approve_from(
+		&self,
+		sender: T::CrossAccountId,
+		from: T::CrossAccountId,
+		to: T::CrossAccountId,
+		token: TokenId,
+		amount: u128,
+	) -> DispatchResultWithPostInfo {
+		ensure!(
+			token == TokenId::default(),
+			<Error<T>>::FungibleItemsHaveNoId
+		);
+
+		with_weight(
+			<Pallet<T>>::set_allowance_for(self, &sender, &from, &to, amount),
+			<CommonWeights<T>>::approve_from(),
+		)
+	}
+
 	fn transfer_from(
 		&self,
 		sender: T::CrossAccountId,
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -613,6 +613,45 @@
 		Ok(())
 	}
 
+	/// Set allowance for the spender to `transfer` or `burn` owner's tokens from eth mirror.
+	///
+	/// - `collection`: Collection that contains the token
+	/// - `sender`: Owner of tokens that sets the allowance.
+	/// - `from`: Owner's eth mirror.
+	/// - `to`: Recipient of the allowance rights.
+	/// - `amount`: Amount of tokens the spender is allowed to `transfer` or `burn`.
+	pub fn set_allowance_for(
+		collection: &FungibleHandle<T>,
+		sender: &T::CrossAccountId,
+		from: &T::CrossAccountId,
+		to: &T::CrossAccountId,
+		amount: u128,
+	) -> DispatchResult {
+		if collection.permissions.access() == AccessMode::AllowList {
+			collection.check_allowlist(sender)?;
+			collection.check_allowlist(from)?;
+			collection.check_allowlist(to)?;
+		}
+
+		ensure!(
+			*sender.as_eth() == *from.as_eth(),
+			<CommonError<T>>::AddressIsNotEthMirror
+		);
+
+		if <Balance<T>>::get((collection.id, from)) < amount {
+			ensure!(
+				collection.limits.owner_can_transfer()
+					&& (collection.is_owner_or_admin(sender) || collection.is_owner_or_admin(from)),
+				<CommonError<T>>::CantApproveMoreThanOwned
+			);
+		}
+
+		// =========
+
+		Self::set_allowance_unchecked(collection, from, to, amount);
+		Ok(())
+	}
+
 	/// Checks if a non-owner has (enough) allowance from the owner to perform operations on the tokens.
 	/// Returns the expected remaining allowance - it should be set manually if the transaction proceeds.
 	///
modifiedpallets/fungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -39,6 +39,7 @@
 	fn burn_item() -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
+	fn approve_from() -> Weight;
 	fn transfer_from() -> Weight;
 	fn burn_from() -> Weight;
 }
@@ -84,6 +85,13 @@
 			.saturating_add(T::DbWeight::get().reads(1 as u64))
 			.saturating_add(T::DbWeight::get().writes(1 as u64))
 	}
+	// Storage: Fungible Balance (r:1 w:0)
+	// Storage: Fungible Allowance (r:0 w:1)
+	fn approve_from() -> Weight {
+		Weight::from_ref_time(19_817_000 as u64)
+			.saturating_add(T::DbWeight::get().reads(1 as u64))
+			.saturating_add(T::DbWeight::get().writes(1 as u64))
+	}
 	// Storage: Fungible Allowance (r:1 w:1)
 	// Storage: Fungible Balance (r:2 w:2)
 	fn transfer_from() -> Weight {
@@ -141,6 +149,13 @@
 			.saturating_add(RocksDbWeight::get().reads(1 as u64))
 			.saturating_add(RocksDbWeight::get().writes(1 as u64))
 	}
+	// Storage: Fungible Balance (r:1 w:0)
+	// Storage: Fungible Allowance (r:0 w:1)
+	fn approve_from() -> Weight {
+		Weight::from_ref_time(19_817_000 as u64)
+			.saturating_add(RocksDbWeight::get().reads(1 as u64))
+			.saturating_add(RocksDbWeight::get().writes(1 as u64))
+	}
 	// Storage: Fungible Allowance (r:1 w:1)
 	// Storage: Fungible Balance (r:2 w:2)
 	fn transfer_from() -> Weight {
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -134,6 +134,15 @@
 		let item = create_max_item(&collection, &owner, sender.clone())?;
 	}: {<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?}
 
+	approve_from {
+		bench_init!{
+			owner: sub; collection: collection(owner);
+			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
+		};
+		let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
+		let item = create_max_item(&collection, &owner, owner_eth.clone())?;
+	}: {<Pallet<T>>::set_allowance_for(&collection, &sender, &owner_eth, item, Some(&spender))?}
+
 	transfer_from {
 		bench_init!{
 			owner: sub; collection: collection(owner);
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -102,6 +102,10 @@
 		<SelfWeightOf<T>>::approve()
 	}
 
+	fn approve_from() -> Weight {
+		<SelfWeightOf<T>>::approve_from()
+	}
+
 	fn transfer_from() -> Weight {
 		<SelfWeightOf<T>>::transfer_from()
 	}
@@ -353,6 +357,26 @@
 		)
 	}
 
+	fn approve_from(
+		&self,
+		sender: T::CrossAccountId,
+		from: T::CrossAccountId,
+		to: T::CrossAccountId,
+		token: TokenId,
+		amount: u128,
+	) -> DispatchResultWithPostInfo {
+		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
+
+		with_weight(
+			if amount == 1 {
+				<Pallet<T>>::set_allowance_for(self, &sender, &from, token, Some(&to))
+			} else {
+				<Pallet<T>>::set_allowance_for(self, &sender, &from, token, None)
+			},
+			<CommonWeights<T>>::approve_from(),
+		)
+	}
+
 	fn transfer_from(
 		&self,
 		sender: T::CrossAccountId,
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -1171,6 +1171,51 @@
 		Ok(())
 	}
 
+	/// Set allowance for the spender to `transfer` or `burn` sender's token from eth mirror.
+	///
+	/// - `from`: Address of sender's eth mirror.
+	/// - `to`: Adress of spender.
+	/// - `token`: Token the spender is allowed to `transfer` or `burn`.
+	pub fn set_allowance_for(
+		collection: &NonfungibleHandle<T>,
+		sender: &T::CrossAccountId,
+		from: &T::CrossAccountId,
+		token: TokenId,
+		to: Option<&T::CrossAccountId>,
+	) -> DispatchResult {
+		if collection.permissions.access() == AccessMode::AllowList {
+			collection.check_allowlist(sender)?;
+			collection.check_allowlist(from)?;
+			if let Some(to) = to {
+				collection.check_allowlist(to)?;
+			}
+		}
+
+		if let Some(to) = to {
+			<PalletCommon<T>>::ensure_correct_receiver(to)?;
+		}
+
+		ensure!(
+			*sender.as_eth() == *from.as_eth(),
+			<CommonError<T>>::AddressIsNotEthMirror
+		);
+
+		let token_data =
+			<TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
+		if token_data.owner != *from {
+			ensure!(
+				collection.limits.owner_can_transfer()
+					&& (collection.is_owner_or_admin(sender) || collection.is_owner_or_admin(from)),
+				<CommonError<T>>::CantApproveMoreThanOwned
+			);
+		}
+
+		// =========
+
+		Self::set_allowance_unchecked(collection, from, token, to, false);
+		Ok(())
+	}
+
 	/// Checks allowance for the spender to use the token.
 	fn check_allowed(
 		collection: &NonfungibleHandle<T>,
modifiedpallets/nonfungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -42,6 +42,7 @@
 	fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
+	fn approve_from() -> Weight;
 	fn transfer_from() -> Weight;
 	fn burn_from() -> Weight;
 	fn set_token_property_permissions(b: u32, ) -> Weight;
@@ -147,6 +148,13 @@
 			.saturating_add(T::DbWeight::get().reads(2 as u64))
 			.saturating_add(T::DbWeight::get().writes(1 as u64))
 	}
+	// Storage: Nonfungible TokenData (r:1 w:0)
+	// Storage: Nonfungible Allowance (r:1 w:1)
+	fn approve_from() -> Weight {
+		Weight::from_ref_time(18_965_000 as u64)
+			.saturating_add(T::DbWeight::get().reads(2 as u64))
+			.saturating_add(T::DbWeight::get().writes(1 as u64))
+	}
 	// Storage: Nonfungible Allowance (r:1 w:1)
 	// Storage: Nonfungible TokenData (r:1 w:1)
 	// Storage: Nonfungible AccountBalance (r:2 w:2)
@@ -310,6 +318,13 @@
 			.saturating_add(RocksDbWeight::get().reads(2 as u64))
 			.saturating_add(RocksDbWeight::get().writes(1 as u64))
 	}
+	// Storage: Nonfungible TokenData (r:1 w:0)
+	// Storage: Nonfungible Allowance (r:1 w:1)
+	fn approve_from() -> Weight {
+		Weight::from_ref_time(18_965_000 as u64)
+			.saturating_add(RocksDbWeight::get().reads(2 as u64))
+			.saturating_add(RocksDbWeight::get().writes(1 as u64))
+	}
 	// Storage: Nonfungible Allowance (r:1 w:1)
 	// Storage: Nonfungible TokenData (r:1 w:1)
 	// Storage: Nonfungible AccountBalance (r:2 w:2)
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -163,6 +163,15 @@
 		let item = create_max_item(&collection, &owner, [(sender.clone(), 200)])?;
 	}: {<Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 100)?}
 
+	approve_from {
+		bench_init!{
+			owner: sub; collection: collection(owner);
+			owner: cross_from_sub; sender: cross_sub; spender: cross_sub;
+		};
+		let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
+		let item = create_max_item(&collection, &owner, [(owner_eth.clone(), 200)])?;
+	}: {<Pallet<T>>::set_allowance_for(&collection, &sender, &owner_eth, &spender, item, 100)?}
+
 	transfer_from_normal {
 		bench_init!{
 			owner: sub; collection: collection(owner);
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
before · pallets/refungible/src/common.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use sp_std::collections::btree_map::BTreeMap;20use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};21use up_data_structs::{22	CollectionId, TokenId, CreateItemExData, budget::Budget, Property, PropertyKey, PropertyValue,23	PropertyKeyPermission, CollectionPropertiesVec, CreateRefungibleExMultipleOwners,24	CreateRefungibleExSingleOwner,25};26use pallet_common::{27	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,28	weights::WeightInfo as _,29};30use pallet_structure::Error as StructureError;31use sp_runtime::{DispatchError};32use sp_std::{vec::Vec, vec};3334use crate::{35	AccountBalance, Allowance, Balance, Config, Error, Owned, Pallet, RefungibleHandle,36	SelfWeightOf, weights::WeightInfo, TokensMinted, TotalSupply, CreateItemData,37};3839macro_rules! max_weight_of {40	($($method:ident ($($args:tt)*)),*) => {41		Weight::zero()42		$(43			.max(<SelfWeightOf<T>>::$method($($args)*))44		)*45	};46}4748fn properties_weight<T: Config>(properties: &CollectionPropertiesVec) -> Weight {49	if properties.len() > 0 {50		<CommonWeights<T>>::set_token_properties(properties.len() as u32)51	} else {52		Weight::zero()53	}54}5556pub struct CommonWeights<T: Config>(PhantomData<T>);57impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {58	fn create_item() -> Weight {59		<SelfWeightOf<T>>::create_item()60	}6162	fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {63		<SelfWeightOf<T>>::create_multiple_items(data.len() as u32).saturating_add(64			data.iter()65				.map(|data| match data {66					up_data_structs::CreateItemData::ReFungible(rft_data) => {67						properties_weight::<T>(&rft_data.properties)68					}69					_ => Weight::zero(),70				})71				.fold(Weight::zero(), |a, b| a.saturating_add(b)),72		)73	}7475	fn create_multiple_items_ex(call: &CreateItemExData<T::CrossAccountId>) -> Weight {76		match call {77			CreateItemExData::RefungibleMultipleOwners(i) => {78				<SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(i.users.len() as u32)79					.saturating_add(properties_weight::<T>(&i.properties))80			}81			CreateItemExData::RefungibleMultipleItems(i) => {82				<SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32)83					.saturating_add(84						i.iter()85							.map(|d| properties_weight::<T>(&d.properties))86							.fold(Weight::zero(), |a, b| a.saturating_add(b)),87					)88			}89			_ => Weight::zero(),90		}91	}9293	fn burn_item() -> Weight {94		max_weight_of!(burn_item_partial(), burn_item_fully())95	}9697	fn set_collection_properties(amount: u32) -> Weight {98		<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)99	}100101	fn delete_collection_properties(amount: u32) -> Weight {102		<pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)103	}104105	fn set_token_properties(amount: u32) -> Weight {106		<SelfWeightOf<T>>::set_token_properties(amount)107	}108109	fn delete_token_properties(amount: u32) -> Weight {110		<SelfWeightOf<T>>::delete_token_properties(amount)111	}112113	fn set_token_property_permissions(amount: u32) -> Weight {114		<SelfWeightOf<T>>::set_token_property_permissions(amount)115	}116117	fn transfer() -> Weight {118		max_weight_of!(119			transfer_normal(),120			transfer_creating(),121			transfer_removing(),122			transfer_creating_removing()123		)124	}125126	fn approve() -> Weight {127		<SelfWeightOf<T>>::approve()128	}129130	fn transfer_from() -> Weight {131		max_weight_of!(132			transfer_from_normal(),133			transfer_from_creating(),134			transfer_from_removing(),135			transfer_from_creating_removing()136		)137	}138139	fn burn_from() -> Weight {140		<SelfWeightOf<T>>::burn_from()141	}142143	fn burn_recursively_self_raw() -> Weight {144		// Read to get total balance145		Self::burn_item() + T::DbWeight::get().reads(1)146	}147	fn burn_recursively_breadth_raw(_amount: u32) -> Weight {148		// Refungible token can't have children149		Weight::zero()150	}151152	fn token_owner() -> Weight {153		<SelfWeightOf<T>>::token_owner()154	}155156	fn set_allowance_for_all() -> Weight {157		<SelfWeightOf<T>>::set_allowance_for_all()158	}159160	fn force_repair_item() -> Weight {161		<SelfWeightOf<T>>::repair_item()162	}163}164165fn map_create_data<T: Config>(166	data: up_data_structs::CreateItemData,167	to: &T::CrossAccountId,168) -> Result<CreateItemData<T>, DispatchError> {169	match data {170		up_data_structs::CreateItemData::ReFungible(data) => Ok(CreateItemData::<T> {171			users: {172				let mut out = BTreeMap::new();173				out.insert(to.clone(), data.pieces);174				out.try_into().expect("limit > 0")175			},176			properties: data.properties,177		}),178		_ => fail!(<Error<T>>::NotRefungibleDataUsedToMintFungibleCollectionToken),179	}180}181182/// Implementation of `CommonCollectionOperations` for `RefungibleHandle`. It wraps Refungible Pallete183/// methods and adds weight info.184impl<T: Config> CommonCollectionOperations<T> for RefungibleHandle<T> {185	fn create_item(186		&self,187		sender: T::CrossAccountId,188		to: T::CrossAccountId,189		data: up_data_structs::CreateItemData,190		nesting_budget: &dyn Budget,191	) -> DispatchResultWithPostInfo {192		with_weight(193			<Pallet<T>>::create_item(194				self,195				&sender,196				map_create_data::<T>(data, &to)?,197				nesting_budget,198			),199			<CommonWeights<T>>::create_item(),200		)201	}202203	fn create_multiple_items(204		&self,205		sender: T::CrossAccountId,206		to: T::CrossAccountId,207		data: Vec<up_data_structs::CreateItemData>,208		nesting_budget: &dyn Budget,209	) -> DispatchResultWithPostInfo {210		let weight = <CommonWeights<T>>::create_multiple_items(&data);211		let data = data212			.into_iter()213			.map(|d| map_create_data::<T>(d, &to))214			.collect::<Result<Vec<_>, DispatchError>>()?;215216		with_weight(217			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),218			weight,219		)220	}221222	fn create_multiple_items_ex(223		&self,224		sender: <T>::CrossAccountId,225		data: CreateItemExData<T::CrossAccountId>,226		nesting_budget: &dyn Budget,227	) -> DispatchResultWithPostInfo {228		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);229		let data = match data {230			CreateItemExData::RefungibleMultipleOwners(CreateRefungibleExMultipleOwners {231				users,232				properties,233			}) => vec![CreateItemData::<T> { users, properties }],234			CreateItemExData::RefungibleMultipleItems(r) => r235				.into_inner()236				.into_iter()237				.map(238					|CreateRefungibleExSingleOwner {239					     user,240					     pieces,241					     properties,242					 }| CreateItemData::<T> {243						users: BTreeMap::from([(user, pieces)])244							.try_into()245							.expect("limit >= 1"),246						properties,247					},248				)249				.collect(),250			_ => fail!(<Error<T>>::NotRefungibleDataUsedToMintFungibleCollectionToken),251		};252253		with_weight(254			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),255			weight,256		)257	}258259	fn burn_item(260		&self,261		sender: T::CrossAccountId,262		token: TokenId,263		amount: u128,264	) -> DispatchResultWithPostInfo {265		with_weight(266			<Pallet<T>>::burn(self, &sender, token, amount),267			<CommonWeights<T>>::burn_item(),268		)269	}270271	fn burn_item_recursively(272		&self,273		sender: T::CrossAccountId,274		token: TokenId,275		self_budget: &dyn Budget,276		_breadth_budget: &dyn Budget,277	) -> DispatchResultWithPostInfo {278		ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);279		with_weight(280			<Pallet<T>>::burn(281				self,282				&sender,283				token,284				<Balance<T>>::get((self.id, token, &sender)),285			),286			<CommonWeights<T>>::burn_recursively_self_raw(),287		)288	}289290	fn transfer(291		&self,292		from: T::CrossAccountId,293		to: T::CrossAccountId,294		token: TokenId,295		amount: u128,296		nesting_budget: &dyn Budget,297	) -> DispatchResultWithPostInfo {298		with_weight(299			<Pallet<T>>::transfer(self, &from, &to, token, amount, nesting_budget),300			<CommonWeights<T>>::transfer(),301		)302	}303304	fn approve(305		&self,306		sender: T::CrossAccountId,307		spender: T::CrossAccountId,308		token: TokenId,309		amount: u128,310	) -> DispatchResultWithPostInfo {311		with_weight(312			<Pallet<T>>::set_allowance(self, &sender, &spender, token, amount),313			<CommonWeights<T>>::approve(),314		)315	}316317	fn transfer_from(318		&self,319		sender: T::CrossAccountId,320		from: T::CrossAccountId,321		to: T::CrossAccountId,322		token: TokenId,323		amount: u128,324		nesting_budget: &dyn Budget,325	) -> DispatchResultWithPostInfo {326		with_weight(327			<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, amount, nesting_budget),328			<CommonWeights<T>>::transfer_from(),329		)330	}331332	fn burn_from(333		&self,334		sender: T::CrossAccountId,335		from: T::CrossAccountId,336		token: TokenId,337		amount: u128,338		nesting_budget: &dyn Budget,339	) -> DispatchResultWithPostInfo {340		with_weight(341			<Pallet<T>>::burn_from(self, &sender, &from, token, amount, nesting_budget),342			<CommonWeights<T>>::burn_from(),343		)344	}345346	fn set_collection_properties(347		&self,348		sender: T::CrossAccountId,349		properties: Vec<Property>,350	) -> DispatchResultWithPostInfo {351		let weight = <CommonWeights<T>>::set_collection_properties(properties.len() as u32);352353		with_weight(354			<Pallet<T>>::set_collection_properties(self, &sender, properties),355			weight,356		)357	}358359	fn delete_collection_properties(360		&self,361		sender: &T::CrossAccountId,362		property_keys: Vec<PropertyKey>,363	) -> DispatchResultWithPostInfo {364		let weight = <CommonWeights<T>>::delete_collection_properties(property_keys.len() as u32);365366		with_weight(367			<Pallet<T>>::delete_collection_properties(self, sender, property_keys),368			weight,369		)370	}371372	fn set_token_properties(373		&self,374		sender: T::CrossAccountId,375		token_id: TokenId,376		properties: Vec<Property>,377		nesting_budget: &dyn Budget,378	) -> DispatchResultWithPostInfo {379		let weight = <CommonWeights<T>>::set_token_properties(properties.len() as u32);380381		with_weight(382			<Pallet<T>>::set_token_properties(383				self,384				&sender,385				token_id,386				properties.into_iter(),387				false,388				nesting_budget,389			),390			weight,391		)392	}393394	fn set_token_property_permissions(395		&self,396		sender: &T::CrossAccountId,397		property_permissions: Vec<PropertyKeyPermission>,398	) -> DispatchResultWithPostInfo {399		let weight =400			<CommonWeights<T>>::set_token_property_permissions(property_permissions.len() as u32);401402		with_weight(403			<Pallet<T>>::set_token_property_permissions(self, sender, property_permissions),404			weight,405		)406	}407408	fn delete_token_properties(409		&self,410		sender: T::CrossAccountId,411		token_id: TokenId,412		property_keys: Vec<PropertyKey>,413		nesting_budget: &dyn Budget,414	) -> DispatchResultWithPostInfo {415		let weight = <CommonWeights<T>>::delete_token_properties(property_keys.len() as u32);416417		with_weight(418			<Pallet<T>>::delete_token_properties(419				self,420				&sender,421				token_id,422				property_keys.into_iter(),423				nesting_budget,424			),425			weight,426		)427	}428429	fn check_nesting(430		&self,431		_sender: <T>::CrossAccountId,432		_from: (CollectionId, TokenId),433		_under: TokenId,434		_nesting_budget: &dyn Budget,435	) -> sp_runtime::DispatchResult {436		fail!(<Error<T>>::RefungibleDisallowsNesting)437	}438439	fn nest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}440441	fn unnest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}442443	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {444		<Owned<T>>::iter_prefix((self.id, account))445			.map(|(id, _)| id)446			.collect()447	}448449	fn collection_tokens(&self) -> Vec<TokenId> {450		<TotalSupply<T>>::iter_prefix((self.id,))451			.map(|(id, _)| id)452			.collect()453	}454455	fn token_exists(&self, token: TokenId) -> bool {456		<Pallet<T>>::token_exists(self, token)457	}458459	fn last_token_id(&self) -> TokenId {460		TokenId(<TokensMinted<T>>::get(self.id))461	}462463	fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId> {464		<Pallet<T>>::token_owner(self.id, token)465	}466467	/// Returns 10 token in no particular order.468	fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {469		<Pallet<T>>::token_owners(self.id, token).unwrap_or_default()470	}471472	fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue> {473		<Pallet<T>>::token_properties((self.id, token_id))474			.get(key)475			.cloned()476	}477478	fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property> {479		let properties = <Pallet<T>>::token_properties((self.id, token_id));480481		keys.map(|keys| {482			keys.into_iter()483				.filter_map(|key| {484					properties.get(&key).map(|value| Property {485						key,486						value: value.clone(),487					})488				})489				.collect()490		})491		.unwrap_or_else(|| {492			properties493				.into_iter()494				.map(|(key, value)| Property { key, value })495				.collect()496		})497	}498499	fn total_supply(&self) -> u32 {500		<Pallet<T>>::total_supply(self)501	}502503	fn account_balance(&self, account: T::CrossAccountId) -> u32 {504		<AccountBalance<T>>::get((self.id, account))505	}506507	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {508		<Balance<T>>::get((self.id, token, account))509	}510511	fn allowance(512		&self,513		sender: T::CrossAccountId,514		spender: T::CrossAccountId,515		token: TokenId,516	) -> u128 {517		<Allowance<T>>::get((self.id, token, sender, spender))518	}519520	fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>> {521		Some(self)522	}523524	fn total_pieces(&self, token: TokenId) -> Option<u128> {525		<Pallet<T>>::total_pieces(self.id, token)526	}527528	fn set_allowance_for_all(529		&self,530		owner: T::CrossAccountId,531		operator: T::CrossAccountId,532		approve: bool,533	) -> DispatchResultWithPostInfo {534		with_weight(535			<Pallet<T>>::set_allowance_for_all(self, &owner, &operator, approve),536			<CommonWeights<T>>::set_allowance_for_all(),537		)538	}539540	fn allowance_for_all(&self, owner: T::CrossAccountId, operator: T::CrossAccountId) -> bool {541		<Pallet<T>>::allowance_for_all(self, &owner, &operator)542	}543544	fn repair_item(&self, token: TokenId) -> DispatchResultWithPostInfo {545		with_weight(546			<Pallet<T>>::repair_item(self, token),547			<CommonWeights<T>>::force_repair_item(),548		)549	}550}551552impl<T: Config> RefungibleExtensions<T> for RefungibleHandle<T> {553	fn repartition(554		&self,555		owner: &T::CrossAccountId,556		token: TokenId,557		amount: u128,558	) -> DispatchResultWithPostInfo {559		with_weight(560			<Pallet<T>>::repartition(self, owner, token, amount),561			<SelfWeightOf<T>>::repartition_item(),562		)563	}564}
after · pallets/refungible/src/common.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::marker::PhantomData;1819use sp_std::collections::btree_map::BTreeMap;20use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};21use up_data_structs::{22	CollectionId, TokenId, CreateItemExData, budget::Budget, Property, PropertyKey, PropertyValue,23	PropertyKeyPermission, CollectionPropertiesVec, CreateRefungibleExMultipleOwners,24	CreateRefungibleExSingleOwner,25};26use pallet_common::{27	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,28	weights::WeightInfo as _,29};30use pallet_structure::Error as StructureError;31use sp_runtime::{DispatchError};32use sp_std::{vec::Vec, vec};3334use crate::{35	AccountBalance, Allowance, Balance, Config, Error, Owned, Pallet, RefungibleHandle,36	SelfWeightOf, weights::WeightInfo, TokensMinted, TotalSupply, CreateItemData,37};3839macro_rules! max_weight_of {40	($($method:ident ($($args:tt)*)),*) => {41		Weight::zero()42		$(43			.max(<SelfWeightOf<T>>::$method($($args)*))44		)*45	};46}4748fn properties_weight<T: Config>(properties: &CollectionPropertiesVec) -> Weight {49	if properties.len() > 0 {50		<CommonWeights<T>>::set_token_properties(properties.len() as u32)51	} else {52		Weight::zero()53	}54}5556pub struct CommonWeights<T: Config>(PhantomData<T>);57impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {58	fn create_item() -> Weight {59		<SelfWeightOf<T>>::create_item()60	}6162	fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {63		<SelfWeightOf<T>>::create_multiple_items(data.len() as u32).saturating_add(64			data.iter()65				.map(|data| match data {66					up_data_structs::CreateItemData::ReFungible(rft_data) => {67						properties_weight::<T>(&rft_data.properties)68					}69					_ => Weight::zero(),70				})71				.fold(Weight::zero(), |a, b| a.saturating_add(b)),72		)73	}7475	fn create_multiple_items_ex(call: &CreateItemExData<T::CrossAccountId>) -> Weight {76		match call {77			CreateItemExData::RefungibleMultipleOwners(i) => {78				<SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(i.users.len() as u32)79					.saturating_add(properties_weight::<T>(&i.properties))80			}81			CreateItemExData::RefungibleMultipleItems(i) => {82				<SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32)83					.saturating_add(84						i.iter()85							.map(|d| properties_weight::<T>(&d.properties))86							.fold(Weight::zero(), |a, b| a.saturating_add(b)),87					)88			}89			_ => Weight::zero(),90		}91	}9293	fn burn_item() -> Weight {94		max_weight_of!(burn_item_partial(), burn_item_fully())95	}9697	fn set_collection_properties(amount: u32) -> Weight {98		<pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)99	}100101	fn delete_collection_properties(amount: u32) -> Weight {102		<pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)103	}104105	fn set_token_properties(amount: u32) -> Weight {106		<SelfWeightOf<T>>::set_token_properties(amount)107	}108109	fn delete_token_properties(amount: u32) -> Weight {110		<SelfWeightOf<T>>::delete_token_properties(amount)111	}112113	fn set_token_property_permissions(amount: u32) -> Weight {114		<SelfWeightOf<T>>::set_token_property_permissions(amount)115	}116117	fn transfer() -> Weight {118		max_weight_of!(119			transfer_normal(),120			transfer_creating(),121			transfer_removing(),122			transfer_creating_removing()123		)124	}125126	fn approve() -> Weight {127		<SelfWeightOf<T>>::approve()128	}129130	fn approve_from() -> Weight {131		<SelfWeightOf<T>>::approve_from()132	}133134	fn transfer_from() -> Weight {135		max_weight_of!(136			transfer_from_normal(),137			transfer_from_creating(),138			transfer_from_removing(),139			transfer_from_creating_removing()140		)141	}142143	fn burn_from() -> Weight {144		<SelfWeightOf<T>>::burn_from()145	}146147	fn burn_recursively_self_raw() -> Weight {148		// Read to get total balance149		Self::burn_item() + T::DbWeight::get().reads(1)150	}151	fn burn_recursively_breadth_raw(_amount: u32) -> Weight {152		// Refungible token can't have children153		Weight::zero()154	}155156	fn token_owner() -> Weight {157		<SelfWeightOf<T>>::token_owner()158	}159160	fn set_allowance_for_all() -> Weight {161		<SelfWeightOf<T>>::set_allowance_for_all()162	}163164	fn force_repair_item() -> Weight {165		<SelfWeightOf<T>>::repair_item()166	}167}168169fn map_create_data<T: Config>(170	data: up_data_structs::CreateItemData,171	to: &T::CrossAccountId,172) -> Result<CreateItemData<T>, DispatchError> {173	match data {174		up_data_structs::CreateItemData::ReFungible(data) => Ok(CreateItemData::<T> {175			users: {176				let mut out = BTreeMap::new();177				out.insert(to.clone(), data.pieces);178				out.try_into().expect("limit > 0")179			},180			properties: data.properties,181		}),182		_ => fail!(<Error<T>>::NotRefungibleDataUsedToMintFungibleCollectionToken),183	}184}185186/// Implementation of `CommonCollectionOperations` for `RefungibleHandle`. It wraps Refungible Pallete187/// methods and adds weight info.188impl<T: Config> CommonCollectionOperations<T> for RefungibleHandle<T> {189	fn create_item(190		&self,191		sender: T::CrossAccountId,192		to: T::CrossAccountId,193		data: up_data_structs::CreateItemData,194		nesting_budget: &dyn Budget,195	) -> DispatchResultWithPostInfo {196		with_weight(197			<Pallet<T>>::create_item(198				self,199				&sender,200				map_create_data::<T>(data, &to)?,201				nesting_budget,202			),203			<CommonWeights<T>>::create_item(),204		)205	}206207	fn create_multiple_items(208		&self,209		sender: T::CrossAccountId,210		to: T::CrossAccountId,211		data: Vec<up_data_structs::CreateItemData>,212		nesting_budget: &dyn Budget,213	) -> DispatchResultWithPostInfo {214		let weight = <CommonWeights<T>>::create_multiple_items(&data);215		let data = data216			.into_iter()217			.map(|d| map_create_data::<T>(d, &to))218			.collect::<Result<Vec<_>, DispatchError>>()?;219220		with_weight(221			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),222			weight,223		)224	}225226	fn create_multiple_items_ex(227		&self,228		sender: <T>::CrossAccountId,229		data: CreateItemExData<T::CrossAccountId>,230		nesting_budget: &dyn Budget,231	) -> DispatchResultWithPostInfo {232		let weight = <CommonWeights<T>>::create_multiple_items_ex(&data);233		let data = match data {234			CreateItemExData::RefungibleMultipleOwners(CreateRefungibleExMultipleOwners {235				users,236				properties,237			}) => vec![CreateItemData::<T> { users, properties }],238			CreateItemExData::RefungibleMultipleItems(r) => r239				.into_inner()240				.into_iter()241				.map(242					|CreateRefungibleExSingleOwner {243					     user,244					     pieces,245					     properties,246					 }| CreateItemData::<T> {247						users: BTreeMap::from([(user, pieces)])248							.try_into()249							.expect("limit >= 1"),250						properties,251					},252				)253				.collect(),254			_ => fail!(<Error<T>>::NotRefungibleDataUsedToMintFungibleCollectionToken),255		};256257		with_weight(258			<Pallet<T>>::create_multiple_items(self, &sender, data, nesting_budget),259			weight,260		)261	}262263	fn burn_item(264		&self,265		sender: T::CrossAccountId,266		token: TokenId,267		amount: u128,268	) -> DispatchResultWithPostInfo {269		with_weight(270			<Pallet<T>>::burn(self, &sender, token, amount),271			<CommonWeights<T>>::burn_item(),272		)273	}274275	fn burn_item_recursively(276		&self,277		sender: T::CrossAccountId,278		token: TokenId,279		self_budget: &dyn Budget,280		_breadth_budget: &dyn Budget,281	) -> DispatchResultWithPostInfo {282		ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);283		with_weight(284			<Pallet<T>>::burn(285				self,286				&sender,287				token,288				<Balance<T>>::get((self.id, token, &sender)),289			),290			<CommonWeights<T>>::burn_recursively_self_raw(),291		)292	}293294	fn transfer(295		&self,296		from: T::CrossAccountId,297		to: T::CrossAccountId,298		token: TokenId,299		amount: u128,300		nesting_budget: &dyn Budget,301	) -> DispatchResultWithPostInfo {302		with_weight(303			<Pallet<T>>::transfer(self, &from, &to, token, amount, nesting_budget),304			<CommonWeights<T>>::transfer(),305		)306	}307308	fn approve(309		&self,310		sender: T::CrossAccountId,311		spender: T::CrossAccountId,312		token: TokenId,313		amount: u128,314	) -> DispatchResultWithPostInfo {315		with_weight(316			<Pallet<T>>::set_allowance(self, &sender, &spender, token, amount),317			<CommonWeights<T>>::approve(),318		)319	}320321	fn approve_from(322		&self,323		sender: T::CrossAccountId,324		from: T::CrossAccountId,325		to: T::CrossAccountId,326		token_id: TokenId,327		amount: u128,328	) -> DispatchResultWithPostInfo {329		with_weight(330			<Pallet<T>>::set_allowance_for(self, &sender, &from, &to, token_id, amount),331			<CommonWeights<T>>::approve_from(),332		)333	}334335	fn transfer_from(336		&self,337		sender: T::CrossAccountId,338		from: T::CrossAccountId,339		to: T::CrossAccountId,340		token: TokenId,341		amount: u128,342		nesting_budget: &dyn Budget,343	) -> DispatchResultWithPostInfo {344		with_weight(345			<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, amount, nesting_budget),346			<CommonWeights<T>>::transfer_from(),347		)348	}349350	fn burn_from(351		&self,352		sender: T::CrossAccountId,353		from: T::CrossAccountId,354		token: TokenId,355		amount: u128,356		nesting_budget: &dyn Budget,357	) -> DispatchResultWithPostInfo {358		with_weight(359			<Pallet<T>>::burn_from(self, &sender, &from, token, amount, nesting_budget),360			<CommonWeights<T>>::burn_from(),361		)362	}363364	fn set_collection_properties(365		&self,366		sender: T::CrossAccountId,367		properties: Vec<Property>,368	) -> DispatchResultWithPostInfo {369		let weight = <CommonWeights<T>>::set_collection_properties(properties.len() as u32);370371		with_weight(372			<Pallet<T>>::set_collection_properties(self, &sender, properties),373			weight,374		)375	}376377	fn delete_collection_properties(378		&self,379		sender: &T::CrossAccountId,380		property_keys: Vec<PropertyKey>,381	) -> DispatchResultWithPostInfo {382		let weight = <CommonWeights<T>>::delete_collection_properties(property_keys.len() as u32);383384		with_weight(385			<Pallet<T>>::delete_collection_properties(self, sender, property_keys),386			weight,387		)388	}389390	fn set_token_properties(391		&self,392		sender: T::CrossAccountId,393		token_id: TokenId,394		properties: Vec<Property>,395		nesting_budget: &dyn Budget,396	) -> DispatchResultWithPostInfo {397		let weight = <CommonWeights<T>>::set_token_properties(properties.len() as u32);398399		with_weight(400			<Pallet<T>>::set_token_properties(401				self,402				&sender,403				token_id,404				properties.into_iter(),405				false,406				nesting_budget,407			),408			weight,409		)410	}411412	fn set_token_property_permissions(413		&self,414		sender: &T::CrossAccountId,415		property_permissions: Vec<PropertyKeyPermission>,416	) -> DispatchResultWithPostInfo {417		let weight =418			<CommonWeights<T>>::set_token_property_permissions(property_permissions.len() as u32);419420		with_weight(421			<Pallet<T>>::set_token_property_permissions(self, sender, property_permissions),422			weight,423		)424	}425426	fn delete_token_properties(427		&self,428		sender: T::CrossAccountId,429		token_id: TokenId,430		property_keys: Vec<PropertyKey>,431		nesting_budget: &dyn Budget,432	) -> DispatchResultWithPostInfo {433		let weight = <CommonWeights<T>>::delete_token_properties(property_keys.len() as u32);434435		with_weight(436			<Pallet<T>>::delete_token_properties(437				self,438				&sender,439				token_id,440				property_keys.into_iter(),441				nesting_budget,442			),443			weight,444		)445	}446447	fn check_nesting(448		&self,449		_sender: <T>::CrossAccountId,450		_from: (CollectionId, TokenId),451		_under: TokenId,452		_nesting_budget: &dyn Budget,453	) -> sp_runtime::DispatchResult {454		fail!(<Error<T>>::RefungibleDisallowsNesting)455	}456457	fn nest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}458459	fn unnest(&self, _under: TokenId, _to_nest: (CollectionId, TokenId)) {}460461	fn account_tokens(&self, account: T::CrossAccountId) -> Vec<TokenId> {462		<Owned<T>>::iter_prefix((self.id, account))463			.map(|(id, _)| id)464			.collect()465	}466467	fn collection_tokens(&self) -> Vec<TokenId> {468		<TotalSupply<T>>::iter_prefix((self.id,))469			.map(|(id, _)| id)470			.collect()471	}472473	fn token_exists(&self, token: TokenId) -> bool {474		<Pallet<T>>::token_exists(self, token)475	}476477	fn last_token_id(&self) -> TokenId {478		TokenId(<TokensMinted<T>>::get(self.id))479	}480481	fn token_owner(&self, token: TokenId) -> Option<T::CrossAccountId> {482		<Pallet<T>>::token_owner(self.id, token)483	}484485	/// Returns 10 token in no particular order.486	fn token_owners(&self, token: TokenId) -> Vec<T::CrossAccountId> {487		<Pallet<T>>::token_owners(self.id, token).unwrap_or_default()488	}489490	fn token_property(&self, token_id: TokenId, key: &PropertyKey) -> Option<PropertyValue> {491		<Pallet<T>>::token_properties((self.id, token_id))492			.get(key)493			.cloned()494	}495496	fn token_properties(&self, token_id: TokenId, keys: Option<Vec<PropertyKey>>) -> Vec<Property> {497		let properties = <Pallet<T>>::token_properties((self.id, token_id));498499		keys.map(|keys| {500			keys.into_iter()501				.filter_map(|key| {502					properties.get(&key).map(|value| Property {503						key,504						value: value.clone(),505					})506				})507				.collect()508		})509		.unwrap_or_else(|| {510			properties511				.into_iter()512				.map(|(key, value)| Property { key, value })513				.collect()514		})515	}516517	fn total_supply(&self) -> u32 {518		<Pallet<T>>::total_supply(self)519	}520521	fn account_balance(&self, account: T::CrossAccountId) -> u32 {522		<AccountBalance<T>>::get((self.id, account))523	}524525	fn balance(&self, account: T::CrossAccountId, token: TokenId) -> u128 {526		<Balance<T>>::get((self.id, token, account))527	}528529	fn allowance(530		&self,531		sender: T::CrossAccountId,532		spender: T::CrossAccountId,533		token: TokenId,534	) -> u128 {535		<Allowance<T>>::get((self.id, token, sender, spender))536	}537538	fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>> {539		Some(self)540	}541542	fn total_pieces(&self, token: TokenId) -> Option<u128> {543		<Pallet<T>>::total_pieces(self.id, token)544	}545546	fn set_allowance_for_all(547		&self,548		owner: T::CrossAccountId,549		operator: T::CrossAccountId,550		approve: bool,551	) -> DispatchResultWithPostInfo {552		with_weight(553			<Pallet<T>>::set_allowance_for_all(self, &owner, &operator, approve),554			<CommonWeights<T>>::set_allowance_for_all(),555		)556	}557558	fn allowance_for_all(&self, owner: T::CrossAccountId, operator: T::CrossAccountId) -> bool {559		<Pallet<T>>::allowance_for_all(self, &owner, &operator)560	}561562	fn repair_item(&self, token: TokenId) -> DispatchResultWithPostInfo {563		with_weight(564			<Pallet<T>>::repair_item(self, token),565			<CommonWeights<T>>::force_repair_item(),566		)567	}568}569570impl<T: Config> RefungibleExtensions<T> for RefungibleHandle<T> {571	fn repartition(572		&self,573		owner: &T::CrossAccountId,574		token: TokenId,575		amount: u128,576	) -> DispatchResultWithPostInfo {577		with_weight(578			<Pallet<T>>::repartition(self, owner, token, amount),579			<SelfWeightOf<T>>::repartition_item(),580		)581	}582}
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -1102,6 +1102,47 @@
 		Ok(())
 	}
 
+	/// Set allowance to spend from sender's eth mirror
+	///
+	/// - `from`: Address of sender's eth mirror.
+	/// - `to`: Adress of spender.
+	/// - `amount`: Amount of token pieces the spender is allowed to `transfer` or `burn.
+	pub fn set_allowance_for(
+		collection: &RefungibleHandle<T>,
+		sender: &T::CrossAccountId,
+		from: &T::CrossAccountId,
+		to: &T::CrossAccountId,
+		token_id: TokenId,
+		amount: u128,
+	) -> DispatchResult {
+		if collection.permissions.access() == AccessMode::AllowList {
+			collection.check_allowlist(sender)?;
+			collection.check_allowlist(from)?;
+			collection.check_allowlist(to)?;
+		}
+
+		<PalletCommon<T>>::ensure_correct_receiver(to)?;
+
+		ensure!(
+			*sender.as_eth() == *from.as_eth(),
+			<CommonError<T>>::AddressIsNotEthMirror
+		);
+
+		if <Balance<T>>::get((collection.id, token_id, from)) < amount {
+			ensure!(
+				collection.limits.owner_can_transfer()
+					&& (collection.is_owner_or_admin(sender) || collection.is_owner_or_admin(from))
+					&& Self::token_exists(collection, token_id),
+				<CommonError<T>>::CantApproveMoreThanOwned
+			);
+		}
+
+		// =========
+
+		Self::set_allowance_unchecked(collection, from, to, token_id, amount);
+		Ok(())
+	}
+
 	/// Returns allowance, which should be set after transaction
 	fn check_allowed(
 		collection: &RefungibleHandle<T>,
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -45,6 +45,7 @@
 	fn transfer_removing() -> Weight;
 	fn transfer_creating_removing() -> Weight;
 	fn approve() -> Weight;
+	fn approve_from() -> Weight;
 	fn transfer_from_normal() -> Weight;
 	fn transfer_from_creating() -> Weight;
 	fn transfer_from_removing() -> Weight;
@@ -175,6 +176,13 @@
 			.saturating_add(T::DbWeight::get().reads(1 as u64))
 			.saturating_add(T::DbWeight::get().writes(1 as u64))
 	}
+	// Storage: Refungible Balance (r:1 w:0)
+	// Storage: Refungible Allowance (r:0 w:1)
+	fn approve_from() -> Weight {
+		Weight::from_ref_time(20_649_000 as u64)
+			.saturating_add(T::DbWeight::get().reads(1 as u64))
+			.saturating_add(T::DbWeight::get().writes(1 as u64))
+	}
 	// Storage: Refungible Allowance (r:1 w:1)
 	// Storage: Refungible CollectionAllowance (r:1 w:0)
 	// Storage: Refungible Balance (r:2 w:2)
@@ -400,6 +408,13 @@
 			.saturating_add(RocksDbWeight::get().reads(1 as u64))
 			.saturating_add(RocksDbWeight::get().writes(1 as u64))
 	}
+	// Storage: Refungible Balance (r:1 w:0)
+	// Storage: Refungible Allowance (r:0 w:1)
+	fn approve_from() -> Weight {
+		Weight::from_ref_time(20_649_000 as u64)
+			.saturating_add(RocksDbWeight::get().reads(1 as u64))
+			.saturating_add(RocksDbWeight::get().writes(1 as u64))
+	}
 	// Storage: Refungible Allowance (r:1 w:1)
 	// Storage: Refungible CollectionAllowance (r:1 w:0)
 	// Storage: Refungible Balance (r:2 w:2)
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -851,6 +851,29 @@
 			dispatch_tx::<T, _>(collection_id, |d| d.approve(sender, spender, item_id, amount))
 		}
 
+		/// Allow a non-permissioned address to transfer or burn an item from owner's eth mirror.
+		///
+		/// # Permissions
+		///
+		/// * Collection owner
+		/// * Collection admin
+		/// * Current item owner
+		///
+		/// # Arguments
+		///
+		/// * `from`: Owner's account eth mirror
+		/// * `to`: 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_from()]
+		pub fn approve_from(origin, from:T::CrossAccountId, to: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResultWithPostInfo {
+			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
+
+			dispatch_tx::<T, _>(collection_id, |d| d.approve_from(sender, from, to, item_id, amount))
+		}
+
 		/// Change ownership of an item on behalf of the owner as a non-owner account.
 		///
 		/// See the [`approve`][`Pallet::approve`] method for additional information.
modifiedruntime/common/identity.rsdiffbeforeafterboth
--- a/runtime/common/identity.rs
+++ b/runtime/common/identity.rs
@@ -21,9 +21,7 @@
 
 use sp_runtime::{
 	traits::{DispatchInfoOf, SignedExtension},
-	transaction_validity::{
-		TransactionValidity, ValidTransaction, InvalidTransaction, TransactionValidityError,
-	},
+	transaction_validity::{TransactionValidity, ValidTransaction, TransactionValidityError},
 };
 
 #[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]
modifiedruntime/common/weights.rsdiffbeforeafterboth
--- a/runtime/common/weights.rs
+++ b/runtime/common/weights.rs
@@ -101,6 +101,10 @@
 		dispatch_weight::<T>() + max_weight_of!(approve())
 	}
 
+	fn approve_from() -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(approve_from())
+	}
+
 	fn transfer_from() -> Weight {
 		dispatch_weight::<T>() + max_weight_of!(transfer_from())
 	}
modifiedtests/src/approve.test.tsdiffbeforeafterboth
--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -16,336 +16,521 @@
 
 import {IKeyringPair} from '@polkadot/types/types';
 import {expect, itSub, Pallets, usingPlaygrounds} from './util';
+import {CrossAccountId} from './util/playgrounds/unique';
+
 
 
-describe('Integration Test approve(spender, collection_id, item_id, amount):', () => {
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-  let charlie: IKeyringPair;
+[
+  {method: 'approveToken', account: (account: IKeyringPair) => CrossAccountId.fromKeyring(account)},
+  {method: 'approveTokenFromEth', account: (account: IKeyringPair) => CrossAccountId.fromKeyring(account).toEthereum()},
+].map(testCase => {
+  describe(`Integration Test ${testCase.method}(spender, collection_id, item_id, amount):`, () => {
+    let alice: IKeyringPair;
+    let bob: IKeyringPair;
+    let charlie: IKeyringPair;
 
-  before(async () => {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      const donor = await privateKey({filename: __filename});
-      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+    before(async () => {
+      await usingPlaygrounds(async (helper, privateKey) => {
+        const donor = await privateKey({filename: __filename});
+        [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+      });
     });
-  });
 
-  itSub('[nft] Execute the extrinsic and check approvedList', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
-    await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
-    expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
-  });
+    itSub('[nft] Execute the extrinsic and check approvedList', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice)});
+      await (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+      expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
+    });
+
+    itSub('[fungible] Execute the extrinsic and check approvedList', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+      await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+      const tokenId = await helper.ft.getLastTokenId(collectionId);
+      await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+      const amount = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+      expect(amount).to.be.equal(BigInt(1));
+    });
+
+    itSub.ifWithPallets('[refungible] Execute the extrinsic and check approvedList', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice), pieces: 100n});
+      await (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+      const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+      expect(amount).to.be.equal(BigInt(1));
+    });
+
+    itSub('[nft] Remove approval by using 0 amount', async ({helper}) => {
+      const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const collectionId = collection.collectionId;
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice)});
+      await (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+      expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
+      await (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+      expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
+    });
 
-  itSub('[fungible] Execute the extrinsic and check approvedList', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
-    await helper.ft.mintTokens(alice, collectionId, 10n, {Substrate: alice.address});
-    const tokenId = await helper.ft.getLastTokenId(collectionId);
-    await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
-    const amount = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    expect(amount).to.be.equal(BigInt(1));
-  });
+    itSub('[fungible] Remove approval by using 0 amount', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+      await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+      const tokenId = await helper.ft.getLastTokenId(collectionId);
+      await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+      const amountBefore = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+      expect(amountBefore).to.be.equal(BigInt(1));
 
-  itSub.ifWithPallets('[refungible] Execute the extrinsic and check approvedList', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
-    await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
-    const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    expect(amount).to.be.equal(BigInt(1));
-  });
+      await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+      const amountAfter = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+      expect(amountAfter).to.be.equal(BigInt(0));
+    });
 
-  itSub('[nft] Remove approval by using 0 amount', async ({helper}) => {
-    const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const collectionId = collection.collectionId;
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
-    await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
-    expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
-    await helper.signTransaction(alice, helper.constructApiCall('api.tx.unique.approve', [{Substrate: bob.address}, collectionId, tokenId, 0]));
-    expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
-  });
+    itSub.ifWithPallets('[refungible] Remove approval by using 0 amount', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice), pieces: 100n});
+      await (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+      const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+      expect(amountBefore).to.be.equal(BigInt(1));
 
-  itSub('[fungible] Remove approval by using 0 amount', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
-    await helper.ft.mintTokens(alice, collectionId, 10n, {Substrate: alice.address});
-    const tokenId = await helper.ft.getLastTokenId(collectionId);
-    await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
-    const amountBefore = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    expect(amountBefore).to.be.equal(BigInt(1));
+      await (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+      const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+      expect(amountAfter).to.be.equal(BigInt(0));
+    });
 
-    await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
-    const amountAfter = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    expect(amountAfter).to.be.equal(BigInt(0));
+    itSub('can`t be called by collection owner on non-owned item when OwnerCanTransfer == false', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+      const result = (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: charlie.address});
+      await expect(result).to.be.rejected;
+    });
   });
 
-  itSub.ifWithPallets('[refungible] Remove approval by using 0 amount', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
-    await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
-    const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    expect(amountBefore).to.be.equal(BigInt(1));
+  describe(`[${testCase.method}] Normal user can approve other users to transfer:`, () => {
+    let alice: IKeyringPair;
+    let bob: IKeyringPair;
+    let charlie: IKeyringPair;
 
-    await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
-    const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    expect(amountAfter).to.be.equal(BigInt(0));
-  });
+    before(async () => {
+      await usingPlaygrounds(async (helper, privateKey) => {
+        const donor = await privateKey({filename: __filename});
+        [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+      });
+    });
 
-  itSub('can`t be called by collection owner on non-owned item when OwnerCanTransfer == false', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
-    const approveTokenTx = () => helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: charlie.address});
-    await expect(approveTokenTx()).to.be.rejected;
-  });
-});
+    itSub('NFT', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+      await (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+      expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.true;
+    });
 
-describe('Normal user can approve other users to transfer:', () => {
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-  let charlie: IKeyringPair;
+    itSub('Fungible up to an approved amount', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+      await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(bob));
+      const tokenId = await helper.ft.getLastTokenId(collectionId);
+      await (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+      const amount = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: charlie.address}, testCase.account(bob));
+      expect(amount).to.be.equal(BigInt(1));
+    });
 
-  before(async () => {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      const donor = await privateKey({filename: __filename});
-      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+    itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob), pieces: 100n});
+      await (helper.rft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address}, 100n);
+      const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: charlie.address}, testCase.account(bob));
+      expect(amount).to.be.equal(BigInt(100n));
     });
   });
 
-  itSub('NFT', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
-    await helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
-    expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.true;
-  });
+  describe(`[${testCase.method}] Approved users can transferFrom up to approved amount:`, () => {
+    let alice: IKeyringPair;
+    let bob: IKeyringPair;
+    let charlie: IKeyringPair;
 
-  itSub('Fungible up to an approved amount', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
-    await helper.ft.mintTokens(alice, collectionId, 10n, bob.address);
-    const tokenId = await helper.ft.getLastTokenId(collectionId);
-    await helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
-    const amount = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: charlie.address}, {Substrate: bob.address});
-    expect(amount).to.be.equal(BigInt(1));
-  });
+    before(async () => {
+      await usingPlaygrounds(async (helper, privateKey) => {
+        const donor = await privateKey({filename: __filename});
+        [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+      });
+    });
 
-  itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: bob.address, pieces: 100n});
-    await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address}, 100n);
-    const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: charlie.address}, {Substrate: bob.address});
-    expect(amount).to.be.equal(BigInt(100n));
+    itSub('NFT', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+      await (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+      await helper.nft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address});
+      const owner = await helper.nft.getTokenOwner(collectionId, tokenId);
+      expect(owner.Substrate).to.be.equal(alice.address);
+    });
+
+    itSub('Fungible up to an approved amount', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+      await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(bob));
+      const tokenId = await helper.ft.getLastTokenId(collectionId);
+      await (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+      const before = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
+      await helper.ft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 1n);
+      const after = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
+      expect(after - before).to.be.equal(BigInt(1));
+    });
+
+    itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob), pieces: 100n});
+      await (helper.rft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+      const before = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
+      await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 1n);
+      const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
+      expect(after - before).to.be.equal(BigInt(1));
+    });
   });
-});
 
-describe('Approved users can transferFrom up to approved amount:', () => {
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-  let charlie: IKeyringPair;
+  describe(`[${testCase.method}] Approved users cannot use transferFrom to repeat transfers if approved amount was already transferred:`, () => {
+    let alice: IKeyringPair;
+    let bob: IKeyringPair;
+    let charlie: IKeyringPair;
+
+    before(async () => {
+      await usingPlaygrounds(async (helper, privateKey) => {
+        const donor = await privateKey({filename: __filename});
+        [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+      });
+    });
+
+    itSub('NFT', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+      await (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+      await helper.nft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address});
+      const owner = await helper.nft.getTokenOwner(collectionId, tokenId);
+      expect(owner.Substrate).to.be.equal(alice.address);
+      const transferTokenFromTx = () => helper.nft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address});
+      await expect(transferTokenFromTx()).to.be.rejected;
+    });
+
+    itSub('Fungible up to an approved amount', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+      await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(bob));
+      const tokenId = await helper.ft.getLastTokenId(collectionId);
+      await (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+      const before = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
+      await helper.ft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 1n);
+      const after = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
+      expect(after - before).to.be.equal(BigInt(1));
+
+      const transferTokenFromTx = () => helper.ft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 1n);
+      await expect(transferTokenFromTx()).to.be.rejected;
+    });
 
-  before(async () => {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      const donor = await privateKey({filename: __filename});
-      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+    itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob), pieces: 100n});
+      await (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address}, 100n);
+      const before = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
+      await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 100n);
+      const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
+      expect(after - before).to.be.equal(BigInt(100));
+      const transferTokenFromTx = () => helper.rft.transferTokenFrom(charlie, collectionId, tokenId, testCase.account(bob), {Substrate: alice.address}, 100n);
+      await expect(transferTokenFromTx()).to.be.rejected;
     });
   });
 
-  itSub('NFT', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
-    await helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
-    await helper.nft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    const owner = await helper.nft.getTokenOwner(collectionId, tokenId);
-    expect(owner.Substrate).to.be.equal(alice.address);
+  describe(`[${testCase.method}] Approved amount decreases by the transferred amount:`, () => {
+    let alice: IKeyringPair;
+    let bob: IKeyringPair;
+    let charlie: IKeyringPair;
+    let dave: IKeyringPair;
+
+    before(async () => {
+      await usingPlaygrounds(async (helper, privateKey) => {
+        const donor = await privateKey({filename: __filename});
+        [alice, bob, charlie, dave] = await helper.arrange.createAccounts([100n, 100n, 100n, 100n], donor);
+      });
+    });
+
+    itSub('If a user B is approved to transfer 10 Fungible tokens from user A, they can transfer 2 tokens to user C, which will result in decreasing approval from 10 to 8. Then user B can transfer 8 tokens to user D.', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+      await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+      const tokenId = await helper.ft.getLastTokenId(collectionId);
+      await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 10n);
+
+      const charlieBefore = await helper.ft.getBalance(collectionId, {Substrate: charlie.address});
+      await helper.ft.transferTokenFrom(bob, collectionId, tokenId, testCase.account(alice), {Substrate: charlie.address}, 2n);
+      const charlieAfter = await helper.ft.getBalance(collectionId, {Substrate: charlie.address});
+      expect(charlieAfter - charlieBefore).to.be.equal(BigInt(2));
+
+      const daveBefore = await helper.ft.getBalance(collectionId, {Substrate: dave.address});
+      await helper.ft.transferTokenFrom(bob, collectionId, tokenId, testCase.account(alice), {Substrate: dave.address}, 8n);
+      const daveAfter = await helper.ft.getBalance(collectionId, {Substrate: dave.address});
+      expect(daveAfter - daveBefore).to.be.equal(BigInt(8));
+    });
   });
 
-  itSub('Fungible up to an approved amount', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
-    await helper.ft.mintTokens(alice, collectionId, 10n, bob.address);
-    const tokenId = await helper.ft.getLastTokenId(collectionId);
-    await helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
-    const before = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
-    await helper.ft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 1n);
-    const after = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
-    expect(after - before).to.be.equal(BigInt(1));
+  describe(`[${testCase.method}] User may clear the approvals to approving for 0 amount:`, () => {
+    let alice: IKeyringPair;
+    let bob: IKeyringPair;
+    let charlie: IKeyringPair;
+
+    before(async () => {
+      await usingPlaygrounds(async (helper, privateKey) => {
+        const donor = await privateKey({filename: __filename});
+        [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+      });
+    });
+
+    itSub('NFT', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice)});
+      await (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+      expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
+      await (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+      expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
+      const transferTokenFromTx = () => helper.nft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: bob.address});
+      await expect(transferTokenFromTx()).to.be.rejected;
+    });
+
+    itSub('Fungible', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+      await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+      const tokenId = await helper.ft.getLastTokenId(collectionId);
+      await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+      const amountBefore = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+      expect(amountBefore).to.be.equal(BigInt(1));
+
+      await (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+      const amountAfter = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+      expect(amountAfter).to.be.equal(BigInt(0));
+
+      const transferTokenFromTx = () => helper.ft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 1n);
+      await expect(transferTokenFromTx()).to.be.rejected;
+    });
+
+    itSub.ifWithPallets('ReFungible', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice), pieces: 100n});
+      await (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address});
+      const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+      expect(amountBefore).to.be.equal(BigInt(1));
+
+      await (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
+      const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, testCase.account(alice));
+      expect(amountAfter).to.be.equal(BigInt(0));
+
+      const transferTokenFromTx = () => helper.rft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 100n);
+      await expect(transferTokenFromTx()).to.be.rejected;
+    });
   });
 
-  itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: bob.address, pieces: 100n});
-    await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
-    const before = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
-    await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 1n);
-    const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
-    expect(after - before).to.be.equal(BigInt(1));
+  describe(`[${testCase.method}] User cannot approve for the amount greater than they own:`, () => {
+    let alice: IKeyringPair;
+    let bob: IKeyringPair;
+    let charlie: IKeyringPair;
+
+    before(async () => {
+      await usingPlaygrounds(async (helper, privateKey) => {
+        const donor = await privateKey({filename: __filename});
+        [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+      });
+    });
+
+    itSub('1 for NFT', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+      const result = (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address}, 2n);
+      await expect(result).to.be.rejected;
+      expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.false;
+    });
+
+    itSub('Fungible', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+      await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+      const tokenId = await helper.ft.getLastTokenId(collectionId);
+      const result = (helper.ft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 11n);
+      await expect(result).to.be.rejected;
+    });
+
+    itSub.ifWithPallets('ReFungible', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice), pieces: 100n});
+      const result = (helper.rft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: bob.address}, 101n);
+      await expect(result).to.be.rejected;
+    });
   });
-});
 
-describe('Approved users cannot use transferFrom to repeat transfers if approved amount was already transferred:', () => {
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-  let charlie: IKeyringPair;
+  describe(`[${testCase.method}] Integration Test approve(spender, collection_id, item_id, amount) with collection admin permissions:`, () => {
+    let alice: IKeyringPair;
+    let bob: IKeyringPair;
+    let charlie: IKeyringPair;
+
+    before(async () => {
+      await usingPlaygrounds(async (helper, privateKey) => {
+        const donor = await privateKey({filename: __filename});
+        [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+      });
+    });
 
-  before(async () => {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      const donor = await privateKey({filename: __filename});
-      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+    itSub('can be called by collection admin on non-owned item', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice)});
+      await helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address});
+      const result = (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: charlie.address});
+      await expect(result).to.be.rejected;
     });
   });
 
-  itSub('NFT', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
-    await helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
-    await helper.nft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    const owner = await helper.nft.getTokenOwner(collectionId, tokenId);
-    expect(owner.Substrate).to.be.equal(alice.address);
-    const transferTokenFromTx = () => helper.nft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    await expect(transferTokenFromTx()).to.be.rejected;
-  });
+  describe(`[${testCase.method}] Negative Integration Test approve(spender, collection_id, item_id, amount):`, () => {
+    let alice: IKeyringPair;
+    let bob: IKeyringPair;
+    let charlie: IKeyringPair;
 
-  itSub('Fungible up to an approved amount', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
-    await helper.ft.mintTokens(alice, collectionId, 10n, bob.address);
-    const tokenId = await helper.ft.getLastTokenId(collectionId);
-    await helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
-    const before = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
-    await helper.ft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 1n);
-    const after = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
-    expect(after - before).to.be.equal(BigInt(1));
+    before(async () => {
+      await usingPlaygrounds(async (helper, privateKey) => {
+        const donor = await privateKey({filename: __filename});
+        [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+      });
+    });
 
-    const transferTokenFromTx = () => helper.ft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 1n);
-    await expect(transferTokenFromTx()).to.be.rejected;
-  });
+    itSub('[nft] Approve for a collection that does not exist', async ({helper}) => {
+      const collectionId = 1 << 32 - 1;
+      await expect((helper.nft as any)[testCase.method](bob, collectionId, 1, {Substrate: charlie.address})).to.be.rejected;
+    });
+
+    itSub('[fungible] Approve for a collection that does not exist', async ({helper}) => {
+      const collectionId = 1 << 32 - 1;
+      const approveTx = () => (helper.ft as any)[testCase.method](bob, collectionId, 1, {Substrate: charlie.address});
+      await expect(approveTx()).to.be.rejected;
+    });
 
-  itSub.ifWithPallets('ReFungible up to an approved amount', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: bob.address, pieces: 100n});
-    await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address}, 100n);
-    const before = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
-    await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 100n);
-    const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
-    expect(after - before).to.be.equal(BigInt(100));
-    const transferTokenFromTx = () => helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 100n);
-    await expect(transferTokenFromTx()).to.be.rejected;
-  });
-});
+    itSub.ifWithPallets('[refungible] Approve for a collection that does not exist', [Pallets.ReFungible], async ({helper}) => {
+      const collectionId = 1 << 32 - 1;
+      const approveTx = () => (helper.rft as any)[testCase.method](bob, collectionId, 1, {Substrate: charlie.address});
+      await expect(approveTx()).to.be.rejected;
+    });
 
-describe('Approved amount decreases by the transferred amount:', () => {
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-  let charlie: IKeyringPair;
-  let dave: IKeyringPair;
+    itSub('[nft] Approve for a collection that was destroyed', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await helper.nft.burn(alice, collectionId);
+      const approveTx = () => (helper.nft as any)[testCase.method](alice, collectionId, 1, {Substrate: bob.address});
+      await expect(approveTx()).to.be.rejected;
+    });
 
-  before(async () => {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      const donor = await privateKey({filename: __filename});
-      [alice, bob, charlie, dave] = await helper.arrange.createAccounts([100n, 100n, 100n, 100n], donor);
+    itSub('[fungible] Approve for a collection that was destroyed', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await helper.ft.burn(alice, collectionId);
+      const approveTx = () => (helper.ft as any)[testCase.method](alice, collectionId, 1, {Substrate: bob.address});
+      await expect(approveTx()).to.be.rejected;
     });
-  });
 
-  itSub('If a user B is approved to transfer 10 Fungible tokens from user A, they can transfer 2 tokens to user C, which will result in decreasing approval from 10 to 8. Then user B can transfer 8 tokens to user D.', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
-    await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
-    const tokenId = await helper.ft.getLastTokenId(collectionId);
-    await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 10n);
+    itSub.ifWithPallets('[refungible] Approve for a collection that was destroyed', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await helper.rft.burn(alice, collectionId);
+      const approveTx = () => (helper.rft as any)[testCase.method](alice, collectionId, 1, {Substrate: bob.address});
+      await expect(approveTx()).to.be.rejected;
+    });
 
-    const charlieBefore = await helper.ft.getBalance(collectionId, {Substrate: charlie.address});
-    await helper.ft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: alice.address}, {Substrate: charlie.address}, 2n);
-    const charlieAfter = await helper.ft.getBalance(collectionId, {Substrate: charlie.address});
-    expect(charlieAfter - charlieBefore).to.be.equal(BigInt(2));
+    itSub('[nft] Approve transfer of a token that does not exist', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const approveTx = () => (helper.nft as any)[testCase.method](alice, collectionId, 2, {Substrate: bob.address});
+      await expect(approveTx()).to.be.rejected;
+    });
 
-    const daveBefore = await helper.ft.getBalance(collectionId, {Substrate: dave.address});
-    await helper.ft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: alice.address}, {Substrate: dave.address}, 8n);
-    const daveAfter = await helper.ft.getBalance(collectionId, {Substrate: dave.address});
-    expect(daveAfter - daveBefore).to.be.equal(BigInt(8));
-  });
-});
+    itSub.ifWithPallets('[refungible] Approve transfer of a token that does not exist', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const approveTx = () => (helper.rft as any)[testCase.method](alice, collectionId, 2, {Substrate: bob.address});
+      await expect(approveTx()).to.be.rejected;
+    });
 
-describe('User may clear the approvals to approving for 0 amount:', () => {
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-  let charlie: IKeyringPair;
+    itSub('[nft] Approve using the address that does not own the approved token', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice)});
+      const approveTx = () => (helper.nft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address});
+      await expect(approveTx()).to.be.rejected;
+    });
 
-  before(async () => {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      const donor = await privateKey({filename: __filename});
-      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+    itSub('[fungible] Approve using the address that does not own the approved token', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await helper.ft.mintTokens(alice, collectionId, 10n, testCase.account(alice));
+      const tokenId = await helper.ft.getLastTokenId(collectionId);
+      const approveTx = () => (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address});
+      await expect(approveTx()).to.be.rejected;
     });
-  });
 
-  itSub('NFT', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
-    await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
-    expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
-    await helper.signTransaction(alice, helper.constructApiCall('api.tx.unique.approve', [{Substrate: bob.address}, collectionId, tokenId, 0]));
-    expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
-    const transferTokenFromTx = () => helper.nft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: bob.address});
-    await expect(transferTokenFromTx()).to.be.rejected;
-  });
+    itSub.ifWithPallets('[refungible] Approve using the address that does not own the approved token', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(alice), pieces: 100n});
+      const approveTx = () => (helper.rft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address});
+      await expect(approveTx()).to.be.rejected;
+    });
 
-  itSub('Fungible', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
-    await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
-    const tokenId = await helper.ft.getLastTokenId(collectionId);
-    await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
-    const amountBefore = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    expect(amountBefore).to.be.equal(BigInt(1));
+    itSub.ifWithPallets('should fail if approved more ReFungibles than owned', [Pallets.ReFungible], async ({helper}) => {
+      const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
+      await helper.rft.transferToken(alice, collectionId, tokenId, testCase.account(bob), 100n);
+      await (helper.rft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address}, 100n);
 
-    await helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
-    const amountAfter = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    expect(amountAfter).to.be.equal(BigInt(0));
+      const approveTx = () => (helper.rft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address}, 101n);
+      await expect(approveTx()).to.be.rejected;
+    });
 
-    const transferTokenFromTx = () => helper.ft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 1n);
-    await expect(transferTokenFromTx()).to.be.rejected;
-  });
+    itSub('should fail if approved more Fungibles than owned', async ({helper}) => {
+      const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
+      const tokenId = await helper.ft.getLastTokenId(collectionId);
 
-  itSub.ifWithPallets('ReFungible', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
-    await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
-    const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    expect(amountBefore).to.be.equal(BigInt(1));
+      await helper.ft.transferToken(alice, collectionId, tokenId, testCase.account(bob), 10n);
+      await (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address}, 10n);
+      const approveTx = () => (helper.ft as any)[testCase.method](bob, collectionId, tokenId, {Substrate: alice.address}, 11n);
+      await expect(approveTx()).to.be.rejected;
+    });
 
-    await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
-    const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
-    expect(amountAfter).to.be.equal(BigInt(0));
+    itSub('fails when called by collection owner on non-owned item when OwnerCanTransfer == false', async ({helper}) => {
+      const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: testCase.account(bob)});
+      await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: false});
 
-    const transferTokenFromTx = () => helper.rft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 100n);
-    await expect(transferTokenFromTx()).to.be.rejected;
+      const approveTx = () => (helper.nft as any)[testCase.method](alice, collectionId, tokenId, {Substrate: charlie.address});
+      await expect(approveTx()).to.be.rejected;
+    });
   });
 });
 
-describe('User cannot approve for the amount greater than they own:', () => {
+describe('Normal user can approve other users to be wallet operator:', () => {
   let alice: IKeyringPair;
   let bob: IKeyringPair;
-  let charlie: IKeyringPair;
 
   before(async () => {
     await usingPlaygrounds(async (helper, privateKey) => {
       const donor = await privateKey({filename: __filename});
-      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+      [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
     });
   });
 
-  itSub('1 for NFT', async ({helper}) => {
+  itSub('[nft] Enable and disable approval', async ({helper}) => {
     const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
-    const approveTx = () => helper.signTransaction(bob, helper.constructApiCall('api.tx.unique.approve', [{Substrate: charlie.address}, collectionId, tokenId, 2]));
-    await expect(approveTx()).to.be.rejected;
-    expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.false;
-  });
 
-  itSub('Fungible', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
-    await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
-    const tokenId = await helper.ft.getLastTokenId(collectionId);
-    const approveTx = () => helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 11n);
-    await expect(approveTx()).to.be.rejected;
+    const checkBeforeApproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+    expect(checkBeforeApproval).to.be.false;
+
+    await helper.nft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, true);
+    const checkAfterApproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+    expect(checkAfterApproval).to.be.true;
+
+    await helper.nft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, false);
+    const checkAfterDisapproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+    expect(checkAfterDisapproval).to.be.false;
   });
 
-  itSub.ifWithPallets('ReFungible', [Pallets.ReFungible], async ({helper}) => {
+  itSub.ifWithPallets('[rft] Enable and disable approval', [Pallets.ReFungible], async ({helper}) => {
     const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
-    const approveTx = () => helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 101n);
-    await expect(approveTx()).to.be.rejected;
+
+    const checkBeforeApproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+    expect(checkBeforeApproval).to.be.false;
+
+    await helper.rft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, true);
+    const checkAfterApproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+    expect(checkAfterApproval).to.be.true;
+
+    await helper.rft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, false);
+    const checkAfterDisapproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
+    expect(checkAfterDisapproval).to.be.false;
   });
 });
 
@@ -464,184 +649,5 @@
     await token.approve(dave, {Substrate: bob.address}, 50n);
     await expect(token.approve(dave, {Substrate: charlie.address}, 51n))
       .to.be.rejectedWith('this test would fail (since it is skipped), replace this expecting message with what would have been received');
-  });
-});
-
-describe('Integration Test approve(spender, collection_id, item_id, amount) with collection admin permissions:', () => {
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-  let charlie: IKeyringPair;
-
-  before(async () => {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      const donor = await privateKey({filename: __filename});
-      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
-    });
-  });
-
-  itSub('can be called by collection admin on non-owned item', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
-    await helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address});
-    const approveTx = () => helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-});
-
-describe('Negative Integration Test approve(spender, collection_id, item_id, amount):', () => {
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-  let charlie: IKeyringPair;
-
-  before(async () => {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      const donor = await privateKey({filename: __filename});
-      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
-    });
-  });
-
-  itSub('[nft] Approve for a collection that does not exist', async ({helper}) => {
-    const collectionId = 1 << 32 - 1;
-    const approveTx = () => helper.nft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub('[fungible] Approve for a collection that does not exist', async ({helper}) => {
-    const collectionId = 1 << 32 - 1;
-    const approveTx = () => helper.ft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub.ifWithPallets('[refungible] Approve for a collection that does not exist', [Pallets.ReFungible], async ({helper}) => {
-    const collectionId = 1 << 32 - 1;
-    const approveTx = () => helper.rft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub('[nft] Approve for a collection that was destroyed', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    await helper.nft.burn(alice, collectionId);
-    const approveTx = () => helper.nft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub('[fungible] Approve for a collection that was destroyed', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    await helper.ft.burn(alice, collectionId);
-    const approveTx = () => helper.ft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub.ifWithPallets('[refungible] Approve for a collection that was destroyed', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    await helper.rft.burn(alice, collectionId);
-    const approveTx = () => helper.rft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub('[nft] Approve transfer of a token that does not exist', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const approveTx = () => helper.nft.approveToken(alice, collectionId, 2, {Substrate: bob.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub.ifWithPallets('[refungible] Approve transfer of a token that does not exist', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const approveTx = () => helper.rft.approveToken(alice, collectionId, 2, {Substrate: bob.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub('[nft] Approve using the address that does not own the approved token', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
-    const approveTx = () => helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub('[fungible] Approve using the address that does not own the approved token', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
-    const tokenId = await helper.ft.getLastTokenId(collectionId);
-    const approveTx = () => helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub.ifWithPallets('[refungible] Approve using the address that does not own the approved token', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
-    const approveTx = () => helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub.ifWithPallets('should fail if approved more ReFungibles than owned', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
-    await helper.rft.transferToken(alice, collectionId, tokenId, {Substrate: bob.address}, 100n);
-    await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 100n);
-
-    const approveTx = () => helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 101n);
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub('should fail if approved more Fungibles than owned', async ({helper}) => {
-    const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
-    const tokenId = await helper.ft.getLastTokenId(collectionId);
-
-    await helper.ft.transferToken(alice, collectionId, tokenId, {Substrate: bob.address}, 10n);
-    await helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 10n);
-    const approveTx = () => helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 11n);
-    await expect(approveTx()).to.be.rejected;
-  });
-
-  itSub('fails when called by collection owner on non-owned item when OwnerCanTransfer == false', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-    const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
-    await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: false});
-
-    const approveTx = () => helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: charlie.address});
-    await expect(approveTx()).to.be.rejected;
-  });
-});
-
-describe('Normal user can approve other users to be wallet operator:', () => {
-  let alice: IKeyringPair;
-  let bob: IKeyringPair;
-
-  before(async () => {
-    await usingPlaygrounds(async (helper, privateKey) => {
-      const donor = await privateKey({filename: __filename});
-      [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);
-    });
-  });
-
-  itSub('[nft] Enable and disable approval', async ({helper}) => {
-    const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-
-    const checkBeforeApproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
-    expect(checkBeforeApproval).to.be.false;
-
-    await helper.nft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, true);
-    const checkAfterApproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
-    expect(checkAfterApproval).to.be.true;
-
-    await helper.nft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, false);
-    const checkAfterDisapproval = await helper.nft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
-    expect(checkAfterDisapproval).to.be.false;
-  });
-
-  itSub.ifWithPallets('[rft] Enable and disable approval', [Pallets.ReFungible], async ({helper}) => {
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
-
-    const checkBeforeApproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
-    expect(checkBeforeApproval).to.be.false;
-
-    await helper.rft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, true);
-    const checkAfterApproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
-    expect(checkAfterApproval).to.be.true;
-
-    await helper.rft.setAllowanceForAll(alice, collectionId, {Substrate: bob.address}, false);
-    const checkAfterDisapproval = await helper.rft.allowanceForAll(collectionId, {Substrate: alice.address}, {Substrate: bob.address});
-    expect(checkAfterDisapproval).to.be.false;
   });
 });
modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -183,9 +183,9 @@
 
 /// Ethereum representation of Optional value with CrossAddress.
 struct OptionCrossAddress {
-	/// TODO: field description
+	/// Whether or not this CrossAdress is valid and has meaning.
 	bool status;
-	/// TODO: field description
+	/// The underlying CrossAddress value. If the status is false, can be set to whatever.
 	CrossAddress value;
 }
 
modifiedtests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth
--- a/tests/src/interfaces/augment-api-errors.ts
+++ b/tests/src/interfaces/augment-api-errors.ts
@@ -85,6 +85,10 @@
        **/
       AccountTokenLimitExceeded: AugmentedError<ApiType>;
       /**
+       * Only spending from eth mirror could be approved
+       **/
+      AddressIsNotEthMirror: AugmentedError<ApiType>;
+      /**
        * Can't transfer tokens to ethereum zero address
        **/
       AddressIsZero: AugmentedError<ApiType>;
modifiedtests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth
--- a/tests/src/interfaces/augment-api-tx.ts
+++ b/tests/src/interfaces/augment-api-tx.ts
@@ -1214,6 +1214,25 @@
        **/
       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]>;
       /**
+       * Allow a non-permissioned address to transfer or burn an item from owner's eth mirror.
+       * 
+       * # Permissions
+       * 
+       * * Collection owner
+       * * Collection admin
+       * * Current item owner
+       * 
+       * # Arguments
+       * 
+       * * `from`: Owner's account eth mirror
+       * * `to`: 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.
+       **/
+      approveFrom: AugmentedSubmittable<(from: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, to: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
+      /**
        * Destroy a token on behalf of the owner as a non-owner account.
        * 
        * See also: [`approve`][`Pallet::approve`].
modifiedtests/src/interfaces/default/types.tsdiffbeforeafterboth
--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -1216,6 +1216,7 @@
   readonly isTokenValueTooLow: boolean;
   readonly isApprovedValueTooLow: boolean;
   readonly isCantApproveMoreThanOwned: boolean;
+  readonly isAddressIsNotEthMirror: boolean;
   readonly isAddressIsZero: boolean;
   readonly isUnsupportedOperation: boolean;
   readonly isNotSufficientFounds: boolean;
@@ -1231,7 +1232,7 @@
   readonly isCollectionIsInternal: boolean;
   readonly isConfirmSponsorshipFail: boolean;
   readonly isUserIsNotCollectionAdmin: boolean;
-  readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'CantDestroyNotEmptyCollection' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds' | 'UserIsNotAllowedToNest' | 'SourceCollectionIsNotAllowedToNest' | 'CollectionFieldSizeExceeded' | 'NoSpaceForProperty' | 'PropertyLimitReached' | 'PropertyKeyIsTooLong' | 'InvalidCharacterInPropertyKey' | 'EmptyPropertyKey' | 'CollectionIsExternal' | 'CollectionIsInternal' | 'ConfirmSponsorshipFail' | 'UserIsNotCollectionAdmin';
+  readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'CantDestroyNotEmptyCollection' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsNotEthMirror' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds' | 'UserIsNotAllowedToNest' | 'SourceCollectionIsNotAllowedToNest' | 'CollectionFieldSizeExceeded' | 'NoSpaceForProperty' | 'PropertyLimitReached' | 'PropertyKeyIsTooLong' | 'InvalidCharacterInPropertyKey' | 'EmptyPropertyKey' | 'CollectionIsExternal' | 'CollectionIsInternal' | 'ConfirmSponsorshipFail' | 'UserIsNotCollectionAdmin';
 }
 
 /** @name PalletCommonEvent */
@@ -2306,6 +2307,14 @@
     readonly itemId: u32;
     readonly amount: u128;
   } & Struct;
+  readonly isApproveFrom: boolean;
+  readonly asApproveFrom: {
+    readonly from: PalletEvmAccountBasicCrossAccountIdRepr;
+    readonly to: PalletEvmAccountBasicCrossAccountIdRepr;
+    readonly collectionId: u32;
+    readonly itemId: u32;
+    readonly amount: u128;
+  } & Struct;
   readonly isTransferFrom: boolean;
   readonly asTransferFrom: {
     readonly from: PalletEvmAccountBasicCrossAccountIdRepr;
@@ -2345,7 +2354,7 @@
     readonly collectionId: u32;
     readonly itemId: u32;
   } & 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' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';
+  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' | 'ApproveFrom' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';
 }
 
 /** @name PalletUniqueError */
modifiedtests/src/interfaces/lookup.tsdiffbeforeafterboth
--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -2264,6 +2264,13 @@
         itemId: 'u32',
         amount: 'u128',
       },
+      approve_from: {
+        from: 'PalletEvmAccountBasicCrossAccountIdRepr',
+        to: 'PalletEvmAccountBasicCrossAccountIdRepr',
+        collectionId: 'u32',
+        itemId: 'u32',
+        amount: 'u128',
+      },
       transfer_from: {
         from: 'PalletEvmAccountBasicCrossAccountIdRepr',
         recipient: 'PalletEvmAccountBasicCrossAccountIdRepr',
@@ -3280,7 +3287,7 @@
    * Lookup423: pallet_common::pallet::Error<T>
    **/
   PalletCommonError: {
-    _enum: ['CollectionNotFound', 'MustBeTokenOwner', 'NoPermission', 'CantDestroyNotEmptyCollection', 'PublicMintingNotAllowed', 'AddressNotInAllowlist', 'CollectionNameLimitExceeded', 'CollectionDescriptionLimitExceeded', 'CollectionTokenPrefixLimitExceeded', 'TotalCollectionsLimitExceeded', 'CollectionAdminCountExceeded', 'CollectionLimitBoundsExceeded', 'OwnerPermissionsCantBeReverted', 'TransferNotAllowed', 'AccountTokenLimitExceeded', 'CollectionTokenLimitExceeded', 'MetadataFlagFrozen', 'TokenNotFound', 'TokenValueTooLow', 'ApprovedValueTooLow', 'CantApproveMoreThanOwned', 'AddressIsZero', 'UnsupportedOperation', 'NotSufficientFounds', 'UserIsNotAllowedToNest', 'SourceCollectionIsNotAllowedToNest', 'CollectionFieldSizeExceeded', 'NoSpaceForProperty', 'PropertyLimitReached', 'PropertyKeyIsTooLong', 'InvalidCharacterInPropertyKey', 'EmptyPropertyKey', 'CollectionIsExternal', 'CollectionIsInternal', 'ConfirmSponsorshipFail', 'UserIsNotCollectionAdmin']
+    _enum: ['CollectionNotFound', 'MustBeTokenOwner', 'NoPermission', 'CantDestroyNotEmptyCollection', 'PublicMintingNotAllowed', 'AddressNotInAllowlist', 'CollectionNameLimitExceeded', 'CollectionDescriptionLimitExceeded', 'CollectionTokenPrefixLimitExceeded', 'TotalCollectionsLimitExceeded', 'CollectionAdminCountExceeded', 'CollectionLimitBoundsExceeded', 'OwnerPermissionsCantBeReverted', 'TransferNotAllowed', 'AccountTokenLimitExceeded', 'CollectionTokenLimitExceeded', 'MetadataFlagFrozen', 'TokenNotFound', 'TokenValueTooLow', 'ApprovedValueTooLow', 'CantApproveMoreThanOwned', 'AddressIsNotEthMirror', 'AddressIsZero', 'UnsupportedOperation', 'NotSufficientFounds', 'UserIsNotAllowedToNest', 'SourceCollectionIsNotAllowedToNest', 'CollectionFieldSizeExceeded', 'NoSpaceForProperty', 'PropertyLimitReached', 'PropertyKeyIsTooLong', 'InvalidCharacterInPropertyKey', 'EmptyPropertyKey', 'CollectionIsExternal', 'CollectionIsInternal', 'ConfirmSponsorshipFail', 'UserIsNotCollectionAdmin']
   },
   /**
    * Lookup425: pallet_fungible::pallet::Error<T>
modifiedtests/src/interfaces/types-lookup.tsdiffbeforeafterboth
--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -2493,6 +2493,14 @@
       readonly itemId: u32;
       readonly amount: u128;
     } & Struct;
+    readonly isApproveFrom: boolean;
+    readonly asApproveFrom: {
+      readonly from: PalletEvmAccountBasicCrossAccountIdRepr;
+      readonly to: PalletEvmAccountBasicCrossAccountIdRepr;
+      readonly collectionId: u32;
+      readonly itemId: u32;
+      readonly amount: u128;
+    } & Struct;
     readonly isTransferFrom: boolean;
     readonly asTransferFrom: {
       readonly from: PalletEvmAccountBasicCrossAccountIdRepr;
@@ -2532,7 +2540,7 @@
       readonly collectionId: u32;
       readonly itemId: u32;
     } & 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' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';
+    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' | 'ApproveFrom' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';
   }
 
   /** @name UpDataStructsCollectionMode (236) */
@@ -3564,6 +3572,7 @@
     readonly isTokenValueTooLow: boolean;
     readonly isApprovedValueTooLow: boolean;
     readonly isCantApproveMoreThanOwned: boolean;
+    readonly isAddressIsNotEthMirror: boolean;
     readonly isAddressIsZero: boolean;
     readonly isUnsupportedOperation: boolean;
     readonly isNotSufficientFounds: boolean;
@@ -3579,7 +3588,7 @@
     readonly isCollectionIsInternal: boolean;
     readonly isConfirmSponsorshipFail: boolean;
     readonly isUserIsNotCollectionAdmin: boolean;
-    readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'CantDestroyNotEmptyCollection' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds' | 'UserIsNotAllowedToNest' | 'SourceCollectionIsNotAllowedToNest' | 'CollectionFieldSizeExceeded' | 'NoSpaceForProperty' | 'PropertyLimitReached' | 'PropertyKeyIsTooLong' | 'InvalidCharacterInPropertyKey' | 'EmptyPropertyKey' | 'CollectionIsExternal' | 'CollectionIsInternal' | 'ConfirmSponsorshipFail' | 'UserIsNotCollectionAdmin';
+    readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'CantDestroyNotEmptyCollection' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsNotEthMirror' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds' | 'UserIsNotAllowedToNest' | 'SourceCollectionIsNotAllowedToNest' | 'CollectionFieldSizeExceeded' | 'NoSpaceForProperty' | 'PropertyLimitReached' | 'PropertyKeyIsTooLong' | 'InvalidCharacterInPropertyKey' | 'EmptyPropertyKey' | 'CollectionIsExternal' | 'CollectionIsInternal' | 'ConfirmSponsorshipFail' | 'UserIsNotCollectionAdmin';
   }
 
   /** @name PalletFungibleError (425) */
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -633,6 +633,10 @@
     let call = this.getApi() as any;
     for(const part of apiCall.slice(4).split('.')) {
       call = call[part];
+      if (!call) {
+        const advice = part.includes('_') ? ' Looks like it needs to be converted to camel case.' : '';
+        throw Error(`Function ${part} of api call ${apiCall} not found.${advice}`);
+      }
     }
     return call(...params);
   }
@@ -1259,6 +1263,42 @@
   }
 
   /**
+   * Set, change, or remove approved address to transfer the ownership of the NFT from eth mirror.
+   *
+   * @param signer keyring of signer
+   * @param collectionId ID of collection
+   * @param tokenId ID of token
+   * @param fromAddressObj Signer's Ethereum address containing her tokens
+   * @param toAddressObj Substrate or Ethereum address which gets approved use of the signer's tokens
+   * @param amount amount of token to be approved. For NFT must be set to 1n
+   * @returns ```true``` if extrinsic success, otherwise ```false```
+   */
+  async approveTokenFrom(signer: IKeyringPair, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId, amount=1n) {
+    const approveResult = await this.helper.executeExtrinsic(
+      signer,
+      'api.tx.unique.approveFrom', [fromAddressObj, toAddressObj, collectionId, tokenId, amount],
+      true, // `Unable to approve token for ${label}`,
+    );
+
+    return this.helper.util.findCollectionInEvents(approveResult.result.events, collectionId, 'common', 'Approved');
+  }
+
+  /**
+   * Set, change, or remove approved address to transfer the ownership of the NFT from eth mirror.
+   *
+   * @param signer keyring of signer
+   * @param collectionId ID of collection
+   * @param tokenId ID of token
+   * @param toAddressObj Substrate or Ethereum address which gets approved use of the signer's tokens
+   * @param amount amount of token to be approved. For NFT must be set to 1n
+   * @returns ```true``` if extrinsic success, otherwise ```false```
+   */
+  async approveTokenFromEth(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {
+    const ethMirror = CrossAccountId.fromKeyring(signer).toEthereum();
+    return await this.approveTokenFrom(signer, collectionId, tokenId, ethMirror, toAddressObj, amount);
+  }
+
+  /**
    * Get the amount of token pieces approved to transfer or burn. Normally 0.
    *
    * @param collectionId ID of collection
@@ -1756,8 +1796,8 @@
    * @example approveToken(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."})
    * @returns ```true``` if extrinsic success, otherwise ```false```
    */
-  approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId) {
-    return super.approveToken(signer, collectionId, tokenId, toAddressObj, 1n);
+  approveToken(signer: IKeyringPair, collectionId: number, tokenId: number, toAddressObj: ICrossAccountId, amount=1n) {
+    return super.approveToken(signer, collectionId, tokenId, toAddressObj, amount);
   }
 }