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

difftreelog

fix disbaled pallets Rmrk, RFT, Scheduler for Quartz RFT, Scheduler for Unique Added the logic of checking the availability of pallets necessary for their execution in tests

PraetorP2022-08-01parent: #0d95470.patch.diff
in: master

27 files changed

modifiedruntime/common/Cargo.tomldiffbeforeafterboth
--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -32,6 +32,8 @@
     'frame-support/runtime-benchmarks',
     'frame-system/runtime-benchmarks',
 ]
+unique-runtime = ['std']
+quartz-runtime = ['std']
 
 [dependencies.sp-core]
 default-features = false
modifiedruntime/common/src/dispatch.rsdiffbeforeafterboth
--- a/runtime/common/src/dispatch.rs
+++ b/runtime/common/src/dispatch.rs
@@ -64,7 +64,12 @@
 				);
 				<PalletFungible<T>>::init_collection(sender, data)?
 			}
+			#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]
 			CollectionMode::ReFungible => <PalletRefungible<T>>::init_collection(sender, data)?,
+
+			CollectionMode::ReFungible => {
+				return Err(DispatchError::Other("Refunginle pallet is not supported"))
+			}
 		};
 		Ok(id)
 	}
modifiedruntime/common/src/weights.rsdiffbeforeafterboth
--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -25,6 +25,7 @@
 };
 use up_data_structs::{CreateItemExData, CreateItemData};
 
+#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
 macro_rules! max_weight_of {
 	($method:ident ( $($args:tt)* )) => {
 		<FungibleWeights<T>>::$method($($args)*)
@@ -33,9 +34,21 @@
 	};
 }
 
+#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]
+macro_rules! max_weight_of {
+	($method:ident ( $($args:tt)* )) => {
+		<FungibleWeights<T>>::$method($($args)*)
+		.max(<NonfungibleWeights<T>>::$method($($args)*))
+
+	};
+}
+
+#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
 pub struct CommonWeights<T>(PhantomData<T>)
 where
 	T: FungibleConfig + NonfungibleConfig + RefungibleConfig;
+
+#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
 impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>
 where
 	T: FungibleConfig + NonfungibleConfig + RefungibleConfig,
@@ -101,6 +114,7 @@
 	}
 }
 
+#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]
 impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>
 where
 	T: FungibleConfig + NonfungibleConfig + RefungibleConfig,
@@ -109,3 +123,84 @@
 		dispatch_weight::<T>() + <<T as RefungibleConfig>::WeightInfo>::repartition_item()
 	}
 }
+
+#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]
+pub struct CommonWeights<T>(PhantomData<T>)
+where
+	T: FungibleConfig + NonfungibleConfig;
+
+#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]
+impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>
+where
+	T: FungibleConfig + NonfungibleConfig,
+{
+	fn create_item() -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(create_item())
+	}
+
+	fn create_multiple_items(data: &[CreateItemData]) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(create_multiple_items(data))
+	}
+
+	fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(create_multiple_items_ex(data))
+	}
+
+	fn burn_item() -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(burn_item())
+	}
+
+	fn set_collection_properties(amount: u32) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(set_collection_properties(amount))
+	}
+
+	fn delete_collection_properties(amount: u32) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(delete_collection_properties(amount))
+	}
+
+	fn set_token_properties(amount: u32) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))
+	}
+
+	fn delete_token_properties(amount: u32) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))
+	}
+
+	fn set_token_property_permissions(amount: u32) -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))
+	}
+
+	fn transfer() -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(transfer())
+	}
+
+	fn approve() -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(approve())
+	}
+
+	fn transfer_from() -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(transfer_from())
+	}
+
+	fn burn_from() -> Weight {
+		dispatch_weight::<T>() + max_weight_of!(burn_from())
+	}
+
+	fn burn_recursively_self_raw() -> Weight {
+		max_weight_of!(burn_recursively_self_raw())
+	}
+
+	fn burn_recursively_breadth_raw(amount: u32) -> Weight {
+		max_weight_of!(burn_recursively_breadth_raw(amount))
+	}
+}
+
+#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]
+impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>
+where
+	T: FungibleConfig + NonfungibleConfig,
+{
+	fn repartition() -> Weight {
+		dispatch_weight::<T>()
+	}
+}
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -909,15 +909,15 @@
 	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
 }
 
-impl pallet_proxy_rmrk_core::Config for Runtime {
-	type WeightInfo = pallet_proxy_rmrk_core::weights::SubstrateWeight<Self>;
-	type Event = Event;
-}
+// impl pallet_proxy_rmrk_core::Config for Runtime {
+// 	type WeightInfo = pallet_proxy_rmrk_core::weights::SubstrateWeight<Self>;
+// 	type Event = Event;
+// }
 
-impl pallet_proxy_rmrk_equip::Config for Runtime {
-	type WeightInfo = pallet_proxy_rmrk_equip::weights::SubstrateWeight<Self>;
-	type Event = Event;
-}
+// impl pallet_proxy_rmrk_equip::Config for Runtime {
+// 	type WeightInfo = pallet_proxy_rmrk_equip::weights::SubstrateWeight<Self>;
+// 	type Event = Event;
+// }
 
 impl pallet_unique::Config for Runtime {
 	type Event = Event;
@@ -961,92 +961,92 @@
 	)
 }
 
-pub struct SchedulerPaymentExecutor;
-impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
-	DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
-where
-	<T as frame_system::Config>::Call: Member
-		+ Dispatchable<Origin = Origin, Info = DispatchInfo>
-		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>
-		+ GetDispatchInfo
-		+ From<frame_system::Call<Runtime>>,
-	SelfContainedSignedInfo: Send + Sync + 'static,
-	Call: From<<T as frame_system::Config>::Call>
-		+ From<<T as pallet_unique_scheduler::Config>::Call>
-		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
-	sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
-{
-	fn dispatch_call(
-		signer: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unique_scheduler::Config>::Call,
-	) -> Result<
-		Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
-		TransactionValidityError,
-	> {
-		let dispatch_info = call.get_dispatch_info();
-		let extrinsic = fp_self_contained::CheckedExtrinsic::<
-			AccountId,
-			Call,
-			SignedExtraScheduler,
-			SelfContainedSignedInfo,
-		> {
-			signed:
-				CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(
-					signer.clone().into(),
-					get_signed_extras(signer.into()),
-				),
-			function: call.into(),
-		};
+// pub struct SchedulerPaymentExecutor;
+// impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
+// 	DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
+// where
+// 	<T as frame_system::Config>::Call: Member
+// 		+ Dispatchable<Origin = Origin, Info = DispatchInfo>
+// 		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>
+// 		+ GetDispatchInfo
+// 		+ From<frame_system::Call<Runtime>>,
+// 	SelfContainedSignedInfo: Send + Sync + 'static,
+// 	Call: From<<T as frame_system::Config>::Call>
+// 		+ From<<T as pallet_unique_scheduler::Config>::Call>
+// 		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
+// 	sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
+// {
+// 	fn dispatch_call(
+// 		signer: <T as frame_system::Config>::AccountId,
+// 		call: <T as pallet_unique_scheduler::Config>::Call,
+// 	) -> Result<
+// 		Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
+// 		TransactionValidityError,
+// 	> {
+// 		let dispatch_info = call.get_dispatch_info();
+// 		let extrinsic = fp_self_contained::CheckedExtrinsic::<
+// 			AccountId,
+// 			Call,
+// 			SignedExtraScheduler,
+// 			SelfContainedSignedInfo,
+// 		> {
+// 			signed:
+// 				CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(
+// 					signer.clone().into(),
+// 					get_signed_extras(signer.into()),
+// 				),
+// 			function: call.into(),
+// 		};
 
-		extrinsic.apply::<Runtime>(&dispatch_info, 0)
-	}
+// 		extrinsic.apply::<Runtime>(&dispatch_info, 0)
+// 	}
 
-	fn reserve_balance(
-		id: [u8; 16],
-		sponsor: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unique_scheduler::Config>::Call,
-		count: u32,
-	) -> Result<(), DispatchError> {
-		let dispatch_info = call.get_dispatch_info();
-		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)
-			.saturating_mul(count.into());
+// 	fn reserve_balance(
+// 		id: [u8; 16],
+// 		sponsor: <T as frame_system::Config>::AccountId,
+// 		call: <T as pallet_unique_scheduler::Config>::Call,
+// 		count: u32,
+// 	) -> Result<(), DispatchError> {
+// 		let dispatch_info = call.get_dispatch_info();
+// 		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)
+// 			.saturating_mul(count.into());
 
-		<Balances as NamedReservableCurrency<AccountId>>::reserve_named(
-			&id,
-			&(sponsor.into()),
-			weight.into(),
-		)
-	}
+// 		<Balances as NamedReservableCurrency<AccountId>>::reserve_named(
+// 			&id,
+// 			&(sponsor.into()),
+// 			weight.into(),
+// 		)
+// 	}
 
-	fn pay_for_call(
-		id: [u8; 16],
-		sponsor: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unique_scheduler::Config>::Call,
-	) -> Result<u128, DispatchError> {
-		let dispatch_info = call.get_dispatch_info();
-		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
-		Ok(
-			<Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
-				&id,
-				&(sponsor.into()),
-				weight.into(),
-			),
-		)
-	}
+// 	fn pay_for_call(
+// 		id: [u8; 16],
+// 		sponsor: <T as frame_system::Config>::AccountId,
+// 		call: <T as pallet_unique_scheduler::Config>::Call,
+// 	) -> Result<u128, DispatchError> {
+// 		let dispatch_info = call.get_dispatch_info();
+// 		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
+// 		Ok(
+// 			<Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
+// 				&id,
+// 				&(sponsor.into()),
+// 				weight.into(),
+// 			),
+// 		)
+// 	}
 
-	fn cancel_reserve(
-		id: [u8; 16],
-		sponsor: <T as frame_system::Config>::AccountId,
-	) -> Result<u128, DispatchError> {
-		Ok(
-			<Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
-				&id,
-				&(sponsor.into()),
-				u128::MAX,
-			),
-		)
-	}
-}
+// 	fn cancel_reserve(
+// 		id: [u8; 16],
+// 		sponsor: <T as frame_system::Config>::AccountId,
+// 	) -> Result<u128, DispatchError> {
+// 		Ok(
+// 			<Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
+// 				&id,
+// 				&(sponsor.into()),
+// 				u128::MAX,
+// 			),
+// 		)
+// 	}
+// }
 
 parameter_types! {
 	pub const NoPreimagePostponement: Option<u32> = Some(10);
@@ -1062,21 +1062,21 @@
 	}
 }
 
-impl pallet_unique_scheduler::Config for Runtime {
-	type Event = Event;
-	type Origin = Origin;
-	type Currency = Balances;
-	type PalletsOrigin = OriginCaller;
-	type Call = Call;
-	type MaximumWeight = MaximumSchedulerWeight;
-	type ScheduleOrigin = EnsureSigned<AccountId>;
-	type MaxScheduledPerBlock = MaxScheduledPerBlock;
-	type WeightInfo = ();
-	type CallExecutor = SchedulerPaymentExecutor;
-	type OriginPrivilegeCmp = OriginPrivilegeCmp;
-	type PreimageProvider = ();
-	type NoPreimagePostponement = NoPreimagePostponement;
-}
+// impl pallet_unique_scheduler::Config for Runtime {
+// 	type Event = Event;
+// 	type Origin = Origin;
+// 	type Currency = Balances;
+// 	type PalletsOrigin = OriginCaller;
+// 	type Call = Call;
+// 	type MaximumWeight = MaximumSchedulerWeight;
+// 	type ScheduleOrigin = EnsureSigned<AccountId>;
+// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;
+// 	type WeightInfo = ();
+// 	type CallExecutor = SchedulerPaymentExecutor;
+// 	type OriginPrivilegeCmp = OriginPrivilegeCmp;
+// 	type PreimageProvider = ();
+// 	type NoPreimagePostponement = NoPreimagePostponement;
+// }
 
 type EvmSponsorshipHandler = (
 	UniqueEthSponsorshipHandler<Runtime>,
@@ -1150,17 +1150,17 @@
 		// Unique Pallets
 		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
 		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
-		Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+		// Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
 		// free = 63
 		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
 		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
 		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,
 		Fungible: pallet_fungible::{Pallet, Storage} = 67,
-		Refungible: pallet_refungible::{Pallet, Storage} = 68,
+		// Refungible: pallet_refungible::{Pallet, Storage} = 68,
 		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
 		Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,
-		RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,
-		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,
+		// RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,
+		// RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,
 
 		// Frontier
 		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,
@@ -1323,57 +1323,112 @@
 		RmrkPartType,
 		RmrkTheme
 	> for Runtime {
+		
+		// fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {
+		// 	pallet_proxy_rmrk_core::rpc::last_collection_idx::<Runtime>()
+		// }
+
+		// fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {
+		// 	pallet_proxy_rmrk_core::rpc::collection_by_id::<Runtime>(collection_id)
+		// }
+
+		// fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {
+		// 	pallet_proxy_rmrk_core::rpc::nft_by_id::<Runtime>(collection_id, nft_by_id)
+		// }
+
+		// fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {
+		// 	pallet_proxy_rmrk_core::rpc::account_tokens::<Runtime>(account_id, collection_id)
+		// }
+
+		// fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {
+		// 	pallet_proxy_rmrk_core::rpc::nft_children::<Runtime>(collection_id, nft_id)
+		// }
+
+		// fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {
+		// 	pallet_proxy_rmrk_core::rpc::collection_properties::<Runtime>(collection_id, filter_keys)
+		// }
+
+		// fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {
+		// 	pallet_proxy_rmrk_core::rpc::nft_properties::<Runtime>(collection_id, nft_id, filter_keys)
+		// }
+
+		// fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {
+		// 	pallet_proxy_rmrk_core::rpc::nft_resources::<Runtime>(collection_id, nft_id)
+		// }
+
+		// fn nft_resource_priority(collection_id: RmrkCollectionId, nft_id: RmrkNftId, resource_id: RmrkResourceId) -> Result<Option<u32>, DispatchError> {
+		// 	pallet_proxy_rmrk_core::rpc::nft_resource_priority::<Runtime>(collection_id, nft_id, resource_id)
+		// }
+
+		// fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {
+		// 	pallet_proxy_rmrk_equip::rpc::base::<Runtime>(base_id)
+		// }
+
+		// fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {
+		// 	pallet_proxy_rmrk_equip::rpc::base_parts::<Runtime>(base_id)
+		// }
+
+		// fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {
+		// 	pallet_proxy_rmrk_equip::rpc::theme_names::<Runtime>(base_id)
+		// }
+
+		// fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {
+		// 	pallet_proxy_rmrk_equip::rpc::theme::<Runtime>(base_id, theme_name, filter_keys)
+		// }
+		
 		fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {
-			pallet_proxy_rmrk_core::rpc::last_collection_idx::<Runtime>()
+			Ok(Default::default())
 		}
 
-		fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {
-			pallet_proxy_rmrk_core::rpc::collection_by_id::<Runtime>(collection_id)
+		fn collection_by_id(_collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {
-			pallet_proxy_rmrk_core::rpc::nft_by_id::<Runtime>(collection_id, nft_by_id)
+		fn nft_by_id(_collection_id: RmrkCollectionId, _nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {
-			pallet_proxy_rmrk_core::rpc::account_tokens::<Runtime>(account_id, collection_id)
+		fn account_tokens(_account_id: AccountId, _collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {
-			pallet_proxy_rmrk_core::rpc::nft_children::<Runtime>(collection_id, nft_id)
+		fn nft_children(_collection_id: RmrkCollectionId, _nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {
-			pallet_proxy_rmrk_core::rpc::collection_properties::<Runtime>(collection_id, filter_keys)
+		fn collection_properties(_collection_id: RmrkCollectionId, _filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {
-			pallet_proxy_rmrk_core::rpc::nft_properties::<Runtime>(collection_id, nft_id, filter_keys)
+		fn nft_properties(_collection_id: RmrkCollectionId, _nft_id: RmrkNftId, _filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {
-			pallet_proxy_rmrk_core::rpc::nft_resources::<Runtime>(collection_id, nft_id)
+		fn nft_resources(_collection_id: RmrkCollectionId, _nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn nft_resource_priority(collection_id: RmrkCollectionId, nft_id: RmrkNftId, resource_id: RmrkResourceId) -> Result<Option<u32>, DispatchError> {
-			pallet_proxy_rmrk_core::rpc::nft_resource_priority::<Runtime>(collection_id, nft_id, resource_id)
+		fn nft_resource_priority(_collection_id: RmrkCollectionId, _nft_id: RmrkNftId, _resource_id: RmrkResourceId) -> Result<Option<u32>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {
-			pallet_proxy_rmrk_equip::rpc::base::<Runtime>(base_id)
+		fn base(_base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {
-			pallet_proxy_rmrk_equip::rpc::base_parts::<Runtime>(base_id)
+		fn base_parts(_base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {
-			pallet_proxy_rmrk_equip::rpc::theme_names::<Runtime>(base_id)
+		fn theme_names(_base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {
+			Ok(Default::default())
 		}
 
-		fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {
-			pallet_proxy_rmrk_equip::rpc::theme::<Runtime>(base_id, theme_name, filter_keys)
+		fn theme(_base_id: RmrkBaseId, _theme_name: RmrkThemeName, _filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {
+			Ok(Default::default())
 		}
+		
+		
 	}
 }
 
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -901,9 +901,11 @@
 impl pallet_fungible::Config for Runtime {
 	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;
 }
+
 impl pallet_refungible::Config for Runtime {
 	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;
 }
+
 impl pallet_nonfungible::Config for Runtime {
 	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
 }
@@ -950,92 +952,92 @@
 	)
 }
 
-pub struct SchedulerPaymentExecutor;
-impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
-	DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
-where
-	<T as frame_system::Config>::Call: Member
-		+ Dispatchable<Origin = Origin, Info = DispatchInfo>
-		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>
-		+ GetDispatchInfo
-		+ From<frame_system::Call<Runtime>>,
-	SelfContainedSignedInfo: Send + Sync + 'static,
-	Call: From<<T as frame_system::Config>::Call>
-		+ From<<T as pallet_unique_scheduler::Config>::Call>
-		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
-	sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
-{
-	fn dispatch_call(
-		signer: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unique_scheduler::Config>::Call,
-	) -> Result<
-		Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
-		TransactionValidityError,
-	> {
-		let dispatch_info = call.get_dispatch_info();
-		let extrinsic = fp_self_contained::CheckedExtrinsic::<
-			AccountId,
-			Call,
-			SignedExtraScheduler,
-			SelfContainedSignedInfo,
-		> {
-			signed:
-				CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(
-					signer.clone().into(),
-					get_signed_extras(signer.into()),
-				),
-			function: call.into(),
-		};
+// pub struct SchedulerPaymentExecutor;
+// impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
+// 	DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
+// where
+// 	<T as frame_system::Config>::Call: Member
+// 		+ Dispatchable<Origin = Origin, Info = DispatchInfo>
+// 		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>
+// 		+ GetDispatchInfo
+// 		+ From<frame_system::Call<Runtime>>,
+// 	SelfContainedSignedInfo: Send + Sync + 'static,
+// 	Call: From<<T as frame_system::Config>::Call>
+// 		+ From<<T as pallet_unique_scheduler::Config>::Call>
+// 		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
+// 	sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
+// {
+// 	fn dispatch_call(
+// 		signer: <T as frame_system::Config>::AccountId,
+// 		call: <T as pallet_unique_scheduler::Config>::Call,
+// 	) -> Result<
+// 		Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
+// 		TransactionValidityError,
+// 	> {
+// 		let dispatch_info = call.get_dispatch_info();
+// 		let extrinsic = fp_self_contained::CheckedExtrinsic::<
+// 			AccountId,
+// 			Call,
+// 			SignedExtraScheduler,
+// 			SelfContainedSignedInfo,
+// 		> {
+// 			signed:
+// 				CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(
+// 					signer.clone().into(),
+// 					get_signed_extras(signer.into()),
+// 				),
+// 			function: call.into(),
+// 		};
 
-		extrinsic.apply::<Runtime>(&dispatch_info, 0)
-	}
+// 		extrinsic.apply::<Runtime>(&dispatch_info, 0)
+// 	}
 
-	fn reserve_balance(
-		id: [u8; 16],
-		sponsor: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unique_scheduler::Config>::Call,
-		count: u32,
-	) -> Result<(), DispatchError> {
-		let dispatch_info = call.get_dispatch_info();
-		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)
-			.saturating_mul(count.into());
+// 	fn reserve_balance(
+// 		id: [u8; 16],
+// 		sponsor: <T as frame_system::Config>::AccountId,
+// 		call: <T as pallet_unique_scheduler::Config>::Call,
+// 		count: u32,
+// 	) -> Result<(), DispatchError> {
+// 		let dispatch_info = call.get_dispatch_info();
+// 		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)
+// 			.saturating_mul(count.into());
 
-		<Balances as NamedReservableCurrency<AccountId>>::reserve_named(
-			&id,
-			&(sponsor.into()),
-			weight,
-		)
-	}
+// 		<Balances as NamedReservableCurrency<AccountId>>::reserve_named(
+// 			&id,
+// 			&(sponsor.into()),
+// 			weight,
+// 		)
+// 	}
 
-	fn pay_for_call(
-		id: [u8; 16],
-		sponsor: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unique_scheduler::Config>::Call,
-	) -> Result<u128, DispatchError> {
-		let dispatch_info = call.get_dispatch_info();
-		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
-		Ok(
-			<Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
-				&id,
-				&(sponsor.into()),
-				weight,
-			),
-		)
-	}
+// 	fn pay_for_call(
+// 		id: [u8; 16],
+// 		sponsor: <T as frame_system::Config>::AccountId,
+// 		call: <T as pallet_unique_scheduler::Config>::Call,
+// 	) -> Result<u128, DispatchError> {
+// 		let dispatch_info = call.get_dispatch_info();
+// 		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
+// 		Ok(
+// 			<Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
+// 				&id,
+// 				&(sponsor.into()),
+// 				weight,
+// 			),
+// 		)
+// 	}
 
-	fn cancel_reserve(
-		id: [u8; 16],
-		sponsor: <T as frame_system::Config>::AccountId,
-	) -> Result<u128, DispatchError> {
-		Ok(
-			<Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
-				&id,
-				&(sponsor.into()),
-				u128::MAX,
-			),
-		)
-	}
-}
+// 	fn cancel_reserve(
+// 		id: [u8; 16],
+// 		sponsor: <T as frame_system::Config>::AccountId,
+// 	) -> Result<u128, DispatchError> {
+// 		Ok(
+// 			<Balances as NamedReservableCurrency<AccountId>>::unreserve_named(
+// 				&id,
+// 				&(sponsor.into()),
+// 				u128::MAX,
+// 			),
+// 		)
+// 	}
+// }
 
 parameter_types! {
 	pub const NoPreimagePostponement: Option<u32> = Some(10);
@@ -1051,21 +1053,21 @@
 	}
 }
 
-impl pallet_unique_scheduler::Config for Runtime {
-	type Event = Event;
-	type Origin = Origin;
-	type Currency = Balances;
-	type PalletsOrigin = OriginCaller;
-	type Call = Call;
-	type MaximumWeight = MaximumSchedulerWeight;
-	type ScheduleOrigin = EnsureSigned<AccountId>;
-	type MaxScheduledPerBlock = MaxScheduledPerBlock;
-	type WeightInfo = ();
-	type CallExecutor = SchedulerPaymentExecutor;
-	type OriginPrivilegeCmp = OriginPrivilegeCmp;
-	type PreimageProvider = ();
-	type NoPreimagePostponement = NoPreimagePostponement;
-}
+// impl pallet_unique_scheduler::Config for Runtime {
+// 	type Event = Event;
+// 	type Origin = Origin;
+// 	type Currency = Balances;
+// 	type PalletsOrigin = OriginCaller;
+// 	type Call = Call;
+// 	type MaximumWeight = MaximumSchedulerWeight;
+// 	type ScheduleOrigin = EnsureSigned<AccountId>;
+// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;
+// 	type WeightInfo = ();
+// 	type CallExecutor = SchedulerPaymentExecutor;
+// 	type OriginPrivilegeCmp = OriginPrivilegeCmp;
+// 	type PreimageProvider = ();
+// 	type NoPreimagePostponement = NoPreimagePostponement;
+// }
 
 type EvmSponsorshipHandler = (
 	UniqueEthSponsorshipHandler<Runtime>,
@@ -1139,13 +1141,13 @@
 		// Unique Pallets
 		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
 		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
-		Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+		// Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
 		// free = 63
 		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
 		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
 		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,
 		Fungible: pallet_fungible::{Pallet, Storage} = 67,
-		Refungible: pallet_refungible::{Pallet, Storage} = 68,
+		// Refungible: pallet_refungible::{Pallet, Storage} = 68,
 		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
 		Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,
 
modifiedtests/src/refungible.test.tsdiffbeforeafterboth
before · tests/src/refungible.test.ts
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/>.1617import {default as usingApi, submitTransactionAsync} from './substrate/substrate-api';18import {IKeyringPair} from '@polkadot/types/types';19import {20  createCollectionExpectSuccess,21  getBalance,22  createMultipleItemsExpectSuccess,23  isTokenExists,24  getLastTokenId,25  getAllowance,26  approve,27  transferFrom,28  createCollection,29  createRefungibleToken,30  transfer,31  burnItem,32  repartitionRFT,33  createCollectionWithPropsExpectSuccess,34  getDetailedCollectionInfo,35  normalizeAccountId,36  CrossAccountId,37  getCreateItemsResult,38  getDestroyItemsResult,39} from './util/helpers';4041import chai from 'chai';42import chaiAsPromised from 'chai-as-promised';43chai.use(chaiAsPromised);44const expect = chai.expect;4546let alice: IKeyringPair;47let bob: IKeyringPair;4849describe('integration test: Refungible functionality:', () => {50  before(async () => {51    await usingApi(async (api, privateKeyWrapper) => {52      alice = privateKeyWrapper('//Alice');53      bob = privateKeyWrapper('//Bob');54    });55  });5657  it('Create refungible collection and token', async () => {58    await usingApi(async api => {59      const createCollectionResult = await createCollection(api, alice, {mode: {type: 'ReFungible'}});60      expect(createCollectionResult.success).to.be.true;61      const collectionId  = createCollectionResult.collectionId;62      63      const itemCountBefore = await getLastTokenId(api, collectionId);64      const result = await createRefungibleToken(api, alice, collectionId, 100n);65      66      const itemCountAfter = await getLastTokenId(api, collectionId);67      68      // What to expect69      // tslint:disable-next-line:no-unused-expression70      expect(result.success).to.be.true;71      expect(itemCountAfter).to.be.equal(itemCountBefore + 1);72      expect(collectionId).to.be.equal(result.collectionId);73      expect(itemCountAfter.toString()).to.be.equal(result.itemId.toString());74    });75  });76  77  it('RPC method tokenOnewrs for refungible collection and token', async () => {78    await usingApi(async (api, privateKeyWrapper) => {79      const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};80      const facelessCrowd = Array.from(Array(7).keys()).map(i => normalizeAccountId(privateKeyWrapper(i.toString())));81      82      const createCollectionResult = await createCollection(api, alice, {mode: {type: 'ReFungible'}});83      const collectionId = createCollectionResult.collectionId;84      85      const result = await createRefungibleToken(api, alice, collectionId, 10_000n);86      const aliceTokenId = result.itemId;87      88      89      await transfer(api, collectionId, aliceTokenId, alice, bob, 1000n);90      await transfer(api, collectionId, aliceTokenId, alice, ethAcc, 900n);91      92      for (let i = 0; i < 7; i++) {93        await transfer(api, collectionId, aliceTokenId, alice, facelessCrowd[i], 50*(i+1));94      } 95      96      const owners = await api.rpc.unique.tokenOwners(collectionId, aliceTokenId);97      const ids = (owners.toJSON() as CrossAccountId[]).map(s => normalizeAccountId(s));98      99      const aliceID = normalizeAccountId(alice);100      const bobId = normalizeAccountId(bob);101      102      // What to expect103      // tslint:disable-next-line:no-unused-expression104      expect(ids).to.deep.include.members([aliceID, ethAcc, bobId, ...facelessCrowd]);105      expect(owners.length).to.be.equal(10);106      107      const eleven = privateKeyWrapper('11');108      expect(await transfer(api, collectionId, aliceTokenId, alice, eleven, 10n)).to.be.true;109      expect((await api.rpc.unique.tokenOwners(collectionId, aliceTokenId)).length).to.be.equal(10);110    });111  });112  113  it('Transfer token pieces', async () => {114    await usingApi(async api => {115      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;116      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;117118      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);119      expect(await transfer(api, collectionId, tokenId, alice, bob, 60n)).to.be.true;120121      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(40n);122      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(60n);123      await expect(transfer(api, collectionId, tokenId, alice, bob, 41n)).to.eventually.be.rejected;124    });125  });126127  it('Create multiple tokens', async () => {128    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});129    const args = [130      {ReFungible: {pieces: 1}},131      {ReFungible: {pieces: 2}},132      {ReFungible: {pieces: 100}},133    ];134    await createMultipleItemsExpectSuccess(alice, collectionId, args);135136    await usingApi(async api => {      137      const tokenId = await getLastTokenId(api, collectionId);138      expect(tokenId).to.be.equal(3);139      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);140    });141  });142143  it('Burn some pieces', async () => {144    await usingApi(async api => {   145      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;146      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;147      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;148      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);149      expect(await burnItem(api, alice, collectionId, tokenId, 99n)).to.be.true;150      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;151      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(1n);152    });153  });154155  it('Burn all pieces', async () => {156    await usingApi(async api => {   157      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;158      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;159      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;160      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);161      expect(await burnItem(api, alice, collectionId, tokenId, 100n)).to.be.true;162      expect(await isTokenExists(api, collectionId, tokenId)).to.be.false;163    });164  });165166  it('Burn some pieces for multiple users', async () => {167    await usingApi(async api => {   168      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;169      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;170      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;171172      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);173      expect(await transfer(api, collectionId, tokenId, alice, bob, 60n)).to.be.true;174175      176      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(40n);177      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(60n);178      expect(await burnItem(api, alice, collectionId, tokenId, 40n)).to.be.true;179180      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(0n);181      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;182      expect(await burnItem(api, bob, collectionId, tokenId, 59n)).to.be.true;183184      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(1n);185      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;186      expect(await burnItem(api, bob, collectionId, tokenId, 1n)).to.be.true;187      188      expect(await isTokenExists(api, collectionId, tokenId)).to.be.false;189    });190  });191192  it('Set allowance for token', async () => {193    await usingApi(async api => {194      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;195      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;196197      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);198199      expect(await approve(api, collectionId, tokenId, alice, bob, 60n)).to.be.true;200      expect(await getAllowance(api, collectionId, alice, bob, tokenId)).to.be.equal(60n);201202      expect(await transferFrom(api, collectionId, tokenId, bob, alice, bob,  20n)).to.be.true;203      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(80n);204      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(20n);205      expect(await getAllowance(api, collectionId, alice, bob, tokenId)).to.be.equal(40n);206    });207  });208209  it('Repartition', async () => {210    await usingApi(async api => {211      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;212      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;213214      expect(await repartitionRFT(api, collectionId, alice, tokenId, 200n)).to.be.true;215      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(200n);216217      expect(await transfer(api, collectionId, tokenId, alice, bob, 110n)).to.be.true;218      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(90n);219      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(110n);220221      await expect(repartitionRFT(api, collectionId, alice, tokenId, 80n)).to.eventually.be.rejected;222223      expect(await transfer(api, collectionId, tokenId, alice, bob, 90n)).to.be.true;224      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(0n);225      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(200n);226227      expect(await repartitionRFT(api, collectionId, bob, tokenId, 150n)).to.be.true;228      await expect(transfer(api, collectionId, tokenId, bob, alice, 160n)).to.eventually.be.rejected;229    });230  });231232  it('Repartition with increased amount', async () => {233    await usingApi(async api => {234      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;235      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;236237      const tx = api.tx.unique.repartition(collectionId, tokenId, 200n);238      const events = await submitTransactionAsync(alice, tx);239      const substrateEvents = getCreateItemsResult(events);240      expect(substrateEvents).to.include.deep.members([241        {242          success: true,243          collectionId,244          itemId: tokenId,245          recipient: {Substrate: alice.address},246          amount: 100,247        },248      ]);249    });250  });251252  it('Repartition with decreased amount', async () => {253    await usingApi(async api => {254      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;255      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;256257      const tx = api.tx.unique.repartition(collectionId, tokenId, 50n);258      const events = await submitTransactionAsync(alice, tx);259      const substrateEvents = getDestroyItemsResult(events);260      expect(substrateEvents).to.include.deep.members([261        {262          success: true,263          collectionId,264          itemId: tokenId,265          owner: {Substrate: alice.address},266          amount: 50,267        },268      ]);269    });270  });271});272273describe('Test Refungible properties:', () => {274  before(async () => {275    await usingApi(async (api, privateKeyWrapper) => {276      alice = privateKeyWrapper('//Alice');277      bob = privateKeyWrapper('//Bob');278    });279  });280  281  it('Сreate new collection with properties', async () => {282    await usingApi(async api => {283      const properties = [{key: 'key1', value: 'val1'}];284      const propertyPermissions = [{key: 'key1', permission: {tokenOwner: true, mutable: false, collectionAdmin: true}}];285      const collectionId = await createCollectionWithPropsExpectSuccess({name: 'A', description: 'B', tokenPrefix: 'C', mode: {type: 'ReFungible'},286        properties: properties,287        propPerm: propertyPermissions, 288      });289      const collection = (await getDetailedCollectionInfo(api, collectionId))!;290      expect(collection.properties.toHuman()).to.be.deep.equal(properties);291      expect(collection.tokenPropertyPermissions.toHuman()).to.be.deep.equal(propertyPermissions);292    });293  });294});
after · tests/src/refungible.test.ts
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/>.1617import {default as usingApi, submitTransactionAsync} from './substrate/substrate-api';18import {IKeyringPair} from '@polkadot/types/types';19import {20  createCollectionExpectSuccess,21  getBalance,22  createMultipleItemsExpectSuccess,23  isTokenExists,24  getLastTokenId,25  getAllowance,26  approve,27  transferFrom,28  createCollection,29  createRefungibleToken,30  transfer,31  burnItem,32  repartitionRFT,33  createCollectionWithPropsExpectSuccess,34  getDetailedCollectionInfo,35  normalizeAccountId,36  CrossAccountId,37  getCreateItemsResult,38  getDestroyItemsResult,39  getModuleNames,40  Pallets,41} from './util/helpers';4243import chai from 'chai';44import chaiAsPromised from 'chai-as-promised';45chai.use(chaiAsPromised);46const expect = chai.expect;4748let alice: IKeyringPair;49let bob: IKeyringPair;50515253describe('integration test: Refungible functionality:', async () => {54  before(async function() {55    await usingApi(async (api, privateKeyWrapper) => {56      alice = privateKeyWrapper('//Alice');57      bob = privateKeyWrapper('//Bob');58      if (!getModuleNames(api).includes(Pallets.ReFungible)) this.skip();59    });60    61  });62  63  it('Create refungible collection and token', async () => {64    await usingApi(async api => {65      const createCollectionResult = await createCollection(api, alice, {mode: {type: 'ReFungible'}});66      expect(createCollectionResult.success).to.be.true;67      const collectionId  = createCollectionResult.collectionId;68      69      const itemCountBefore = await getLastTokenId(api, collectionId);70      const result = await createRefungibleToken(api, alice, collectionId, 100n);71      72      const itemCountAfter = await getLastTokenId(api, collectionId);73      74      // What to expect75      // tslint:disable-next-line:no-unused-expression76      expect(result.success).to.be.true;77      expect(itemCountAfter).to.be.equal(itemCountBefore + 1);78      expect(collectionId).to.be.equal(result.collectionId);79      expect(itemCountAfter.toString()).to.be.equal(result.itemId.toString());80    });81  });82  83  it('RPC method tokenOnewrs for refungible collection and token', async () => {84    await usingApi(async (api, privateKeyWrapper) => {85      const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};86      const facelessCrowd = Array.from(Array(7).keys()).map(i => normalizeAccountId(privateKeyWrapper(i.toString())));87      88      const createCollectionResult = await createCollection(api, alice, {mode: {type: 'ReFungible'}});89      const collectionId = createCollectionResult.collectionId;90      91      const result = await createRefungibleToken(api, alice, collectionId, 10_000n);92      const aliceTokenId = result.itemId;93      94      95      await transfer(api, collectionId, aliceTokenId, alice, bob, 1000n);96      await transfer(api, collectionId, aliceTokenId, alice, ethAcc, 900n);97      98      for (let i = 0; i < 7; i++) {99        await transfer(api, collectionId, aliceTokenId, alice, facelessCrowd[i], 50*(i+1));100      } 101      102      const owners = await api.rpc.unique.tokenOwners(collectionId, aliceTokenId);103      const ids = (owners.toJSON() as CrossAccountId[]).map(s => normalizeAccountId(s));104      105      const aliceID = normalizeAccountId(alice);106      const bobId = normalizeAccountId(bob);107      108      // What to expect109      // tslint:disable-next-line:no-unused-expression110      expect(ids).to.deep.include.members([aliceID, ethAcc, bobId, ...facelessCrowd]);111      expect(owners.length).to.be.equal(10);112      113      const eleven = privateKeyWrapper('11');114      expect(await transfer(api, collectionId, aliceTokenId, alice, eleven, 10n)).to.be.true;115      expect((await api.rpc.unique.tokenOwners(collectionId, aliceTokenId)).length).to.be.equal(10);116    });117  });118  119  it('Transfer token pieces', async () => {120    await usingApi(async api => {121      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;122      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;123124      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);125      expect(await transfer(api, collectionId, tokenId, alice, bob, 60n)).to.be.true;126127      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(40n);128      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(60n);129      await expect(transfer(api, collectionId, tokenId, alice, bob, 41n)).to.eventually.be.rejected;130    });131  });132133  it('Create multiple tokens', async () => {134    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});135    const args = [136      {ReFungible: {pieces: 1}},137      {ReFungible: {pieces: 2}},138      {ReFungible: {pieces: 100}},139    ];140    await createMultipleItemsExpectSuccess(alice, collectionId, args);141142    await usingApi(async api => {      143      const tokenId = await getLastTokenId(api, collectionId);144      expect(tokenId).to.be.equal(3);145      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);146    });147  });148149  it('Burn some pieces', async () => {150    await usingApi(async api => {   151      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;152      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;153      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;154      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);155      expect(await burnItem(api, alice, collectionId, tokenId, 99n)).to.be.true;156      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;157      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(1n);158    });159  });160161  it('Burn all pieces', async () => {162    await usingApi(async api => {   163      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;164      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;165      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;166      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);167      expect(await burnItem(api, alice, collectionId, tokenId, 100n)).to.be.true;168      expect(await isTokenExists(api, collectionId, tokenId)).to.be.false;169    });170  });171172  it('Burn some pieces for multiple users', async () => {173    await usingApi(async api => {   174      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;175      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;176      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;177178      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);179      expect(await transfer(api, collectionId, tokenId, alice, bob, 60n)).to.be.true;180181      182      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(40n);183      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(60n);184      expect(await burnItem(api, alice, collectionId, tokenId, 40n)).to.be.true;185186      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(0n);187      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;188      expect(await burnItem(api, bob, collectionId, tokenId, 59n)).to.be.true;189190      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(1n);191      expect(await isTokenExists(api, collectionId, tokenId)).to.be.true;192      expect(await burnItem(api, bob, collectionId, tokenId, 1n)).to.be.true;193      194      expect(await isTokenExists(api, collectionId, tokenId)).to.be.false;195    });196  });197198  it('Set allowance for token', async () => {199    await usingApi(async api => {200      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;201      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;202203      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(100n);204205      expect(await approve(api, collectionId, tokenId, alice, bob, 60n)).to.be.true;206      expect(await getAllowance(api, collectionId, alice, bob, tokenId)).to.be.equal(60n);207208      expect(await transferFrom(api, collectionId, tokenId, bob, alice, bob,  20n)).to.be.true;209      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(80n);210      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(20n);211      expect(await getAllowance(api, collectionId, alice, bob, tokenId)).to.be.equal(40n);212    });213  });214215  it('Repartition', async () => {216    await usingApi(async api => {217      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;218      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;219220      expect(await repartitionRFT(api, collectionId, alice, tokenId, 200n)).to.be.true;221      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(200n);222223      expect(await transfer(api, collectionId, tokenId, alice, bob, 110n)).to.be.true;224      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(90n);225      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(110n);226227      await expect(repartitionRFT(api, collectionId, alice, tokenId, 80n)).to.eventually.be.rejected;228229      expect(await transfer(api, collectionId, tokenId, alice, bob, 90n)).to.be.true;230      expect(await getBalance(api, collectionId, alice, tokenId)).to.be.equal(0n);231      expect(await getBalance(api, collectionId, bob, tokenId)).to.be.equal(200n);232233      expect(await repartitionRFT(api, collectionId, bob, tokenId, 150n)).to.be.true;234      await expect(transfer(api, collectionId, tokenId, bob, alice, 160n)).to.eventually.be.rejected;235    });236  });237238  it('Repartition with increased amount', async () => {239    await usingApi(async api => {240      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;241      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;242243      const tx = api.tx.unique.repartition(collectionId, tokenId, 200n);244      const events = await submitTransactionAsync(alice, tx);245      const substrateEvents = getCreateItemsResult(events);246      expect(substrateEvents).to.include.deep.members([247        {248          success: true,249          collectionId,250          itemId: tokenId,251          recipient: {Substrate: alice.address},252          amount: 100,253        },254      ]);255    });256  });257258  it('Repartition with decreased amount', async () => {259    await usingApi(async api => {260      const collectionId = (await createCollection(api, alice, {mode: {type: 'ReFungible'}})).collectionId;261      const tokenId = (await createRefungibleToken(api, alice, collectionId, 100n)).itemId;262263      const tx = api.tx.unique.repartition(collectionId, tokenId, 50n);264      const events = await submitTransactionAsync(alice, tx);265      const substrateEvents = getDestroyItemsResult(events);266      expect(substrateEvents).to.include.deep.members([267        {268          success: true,269          collectionId,270          itemId: tokenId,271          owner: {Substrate: alice.address},272          amount: 50,273        },274      ]);275    });276  });277  278  it('Сreate new collection with properties', async () => {279    await usingApi(async api => {280      const properties = [{key: 'key1', value: 'val1'}];281      const propertyPermissions = [{key: 'key1', permission: {tokenOwner: true, mutable: false, collectionAdmin: true}}];282      const collectionId = await createCollectionWithPropsExpectSuccess({name: 'A', description: 'B', tokenPrefix: 'C', mode: {type: 'ReFungible'},283        properties: properties,284        propPerm: propertyPermissions, 285      });286      const collection = (await getDetailedCollectionInfo(api, collectionId))!;287      expect(collection.properties.toHuman()).to.be.deep.equal(properties);288      expect(collection.tokenPropertyPermissions.toHuman()).to.be.deep.equal(propertyPermissions);289    });290  });291});292
modifiedtests/src/rmrk/acceptNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/acceptNft.test.ts
+++ b/tests/src/rmrk/acceptNft.test.ts
@@ -8,14 +8,19 @@
 } from './util/tx';
 import {NftIdTuple} from './util/fetch';
 import {isNftChildOfAnother, expectTxFailure} from './util/helpers';
+import { getModuleNames, Pallets } from '../util/helpers';
 
 describe('integration test: accept NFT', () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
-
+  before(async function() {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
+  
+  
   const alice = '//Alice';
   const bob = '//Bob';
-
+  
   const createTestCollection = async (issuerUri: string) => {
     return await createCollection(
       api,
modifiedtests/src/rmrk/addResource.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/addResource.test.ts
+++ b/tests/src/rmrk/addResource.test.ts
@@ -12,6 +12,7 @@
   addNftComposableResource,
 } from './util/tx';
 import {RmrkTraitsResourceResourceInfo as ResourceInfo} from '@polkadot/types/lookup';
+import { getModuleNames, Pallets } from '../util/helpers';
 
 describe('integration test: add NFT resource', () => {
   const Alice = '//Alice';
@@ -24,8 +25,9 @@
   const nonexistentId = 99999;
 
   let api: any;
-  before(async () => {
+  before(async function() {
     api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
   });
 
   it('add resource', async () => {
modifiedtests/src/rmrk/addTheme.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/addTheme.test.ts
+++ b/tests/src/rmrk/addTheme.test.ts
@@ -3,10 +3,14 @@
 import {createBase, addTheme} from './util/tx';
 import {expectTxFailure} from './util/helpers';
 import {getThemeNames} from './util/fetch';
+import { getModuleNames, Pallets } from '../util/helpers';
 
 describe('integration test: add Theme to Base', () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
+  before(async function() {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
 
   const alice = '//Alice';
   const bob = '//Bob';
modifiedtests/src/rmrk/burnNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/burnNft.test.ts
+++ b/tests/src/rmrk/burnNft.test.ts
@@ -5,6 +5,7 @@
 
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
+import { getModuleNames, Pallets } from '../util/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
@@ -14,10 +15,12 @@
   const Bob = '//Bob';
 
   let api: any;
-  before(async () => {
+  before(async function() {
     api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
   });
 
+
   it('burn nft', async () => {
     await createCollection(
       api,
modifiedtests/src/rmrk/changeCollectionIssuer.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/changeCollectionIssuer.test.ts
+++ b/tests/src/rmrk/changeCollectionIssuer.test.ts
@@ -1,4 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {expectTxFailure} from './util/helpers';
 import {
   changeIssuer,
@@ -10,10 +11,13 @@
   const Bob = '//Bob';
 
   let api: any;
-  before(async () => {
+  before(async function() {
     api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
   });
 
+
+
   it('change collection issuer', async () => {
     await createCollection(
       api,
modifiedtests/src/rmrk/createBase.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/createBase.test.ts
+++ b/tests/src/rmrk/createBase.test.ts
@@ -1,9 +1,13 @@
 import {getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {createCollection, createBase} from './util/tx';
 
 describe('integration test: create new Base', () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
+  before(async function() {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
 
   const alice = '//Alice';
 
modifiedtests/src/rmrk/createCollection.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/createCollection.test.ts
+++ b/tests/src/rmrk/createCollection.test.ts
@@ -1,9 +1,15 @@
 import {getApiConnection} from '../substrate/substrate-api';
+import {getModuleNames, Pallets} from '../util/helpers';
 import {createCollection} from './util/tx';
 
 describe('Integration test: create new collection', () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
+  before(async function () {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
+
+
 
   const alice = '//Alice';
 
modifiedtests/src/rmrk/deleteCollection.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/deleteCollection.test.ts
+++ b/tests/src/rmrk/deleteCollection.test.ts
@@ -1,11 +1,13 @@
 import {getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {expectTxFailure} from './util/helpers';
 import {createCollection, deleteCollection} from './util/tx';
 
 describe('integration test: delete collection', () => {
   let api: any;
-  before(async () => {
+  before(async function () {
     api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
   });
 
   const Alice = '//Alice';
modifiedtests/src/rmrk/equipNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/equipNft.test.ts
+++ b/tests/src/rmrk/equipNft.test.ts
@@ -1,6 +1,7 @@
 import {ApiPromise} from '@polkadot/api';
 import {expect} from 'chai';
 import {getApiConnection} from '../substrate/substrate-api';
+import {getModuleNames, Pallets} from '../util/helpers';
 import {getNft, getParts, NftIdTuple} from './util/fetch';
 import {expectTxFailure} from './util/helpers';
 import {
@@ -122,8 +123,10 @@
 describe.skip('integration test: Equip NFT', () => {
 
   let api: any;
-  before(async () => {
+  
+  before(async function () {
     api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
   });
 
   it('equip nft', async () => {
modifiedtests/src/rmrk/getOwnedNfts.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/getOwnedNfts.test.ts
+++ b/tests/src/rmrk/getOwnedNfts.test.ts
@@ -1,11 +1,17 @@
 import {expect} from 'chai';
 import {getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {getOwnedNfts} from './util/fetch';
 import {mintNft, createCollection} from './util/tx';
 
 describe('integration test: get owned NFTs', () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
+  
+  before(async function () {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
+
 
   const alice = '//Alice';
 
modifiedtests/src/rmrk/lockCollection.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/lockCollection.test.ts
+++ b/tests/src/rmrk/lockCollection.test.ts
@@ -1,4 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {expectTxFailure} from './util/helpers';
 import {createCollection, lockCollection, mintNft} from './util/tx';
 
@@ -8,8 +9,9 @@
   const Max = 5;
 
   let api: any;
-  before(async () => {
+  before(async function () {
     api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
   });
 
   it('lock collection', async () => {
modifiedtests/src/rmrk/mintNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/mintNft.test.ts
+++ b/tests/src/rmrk/mintNft.test.ts
@@ -1,12 +1,18 @@
 import {expect} from 'chai';
 import {getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {getNft} from './util/fetch';
 import {expectTxFailure} from './util/helpers';
 import {createCollection, mintNft} from './util/tx';
 
 describe('integration test: mint new NFT', () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
+ 
+  before(async function () {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
+
 
   const alice = '//Alice';
   const bob = '//Bob';
modifiedtests/src/rmrk/rejectNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/rejectNft.test.ts
+++ b/tests/src/rmrk/rejectNft.test.ts
@@ -8,10 +8,16 @@
 } from './util/tx';
 import {getChildren, NftIdTuple} from './util/fetch';
 import {isNftChildOfAnother, expectTxFailure} from './util/helpers';
+import { getModuleNames, Pallets } from '../util/helpers';
 
 describe('integration test: reject NFT', () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
+  before(async function () {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
+
+
 
   const alice = '//Alice';
   const bob = '//Bob';
modifiedtests/src/rmrk/removeResource.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/removeResource.test.ts
+++ b/tests/src/rmrk/removeResource.test.ts
@@ -1,6 +1,7 @@
 import {expect} from 'chai';
 import privateKey from '../substrate/privateKey';
 import {executeTransaction, getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {getNft, NftIdTuple} from './util/fetch';
 import {expectTxFailure} from './util/helpers';
 import {
@@ -16,9 +17,10 @@
 describe('Integration test: remove nft resource', () => {
   let api: any;
   let ss58Format: string;
-  before(async () => {
+  before(async function() {
     api = await getApiConnection();
     ss58Format = api.registry.getChainProperties()!.toJSON().ss58Format;
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
   });
 
   const Alice = '//Alice';
modifiedtests/src/rmrk/rmrkIsolation.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/rmrkIsolation.test.ts
+++ b/tests/src/rmrk/rmrkIsolation.test.ts
@@ -6,7 +6,9 @@
   getCreateCollectionResult,
   getDetailedCollectionInfo,
   getGenericResult,
+  getModuleNames,
   normalizeAccountId,
+  Pallets,
 } from '../util/helpers';
 import {IKeyringPair} from '@polkadot/types/types';
 import {ApiPromise} from '@polkadot/api';
@@ -59,11 +61,10 @@
 describe('RMRK External Integration Test', async () => {
   const it_rmrk = (await isUnique() ? it : it.skip);
 
-  before(async () => {
+  before(async function() {
     await usingApi(async (api, privateKeyWrapper) => {
       alice = privateKeyWrapper('//Alice');
-
-      
+      if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
     });
   });
 
modifiedtests/src/rmrk/sendNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/sendNft.test.ts
+++ b/tests/src/rmrk/sendNft.test.ts
@@ -3,10 +3,14 @@
 import {createCollection, mintNft, sendNft} from './util/tx';
 import {NftIdTuple} from './util/fetch';
 import {isNftChildOfAnother, expectTxFailure} from './util/helpers';
+import { getModuleNames, Pallets } from '../util/helpers';
 
 describe('integration test: send NFT', () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
+  before(async function () {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
 
   const maxNftId = 0xFFFFFFFF;
 
modifiedtests/src/rmrk/setCollectionProperty.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/setCollectionProperty.test.ts
+++ b/tests/src/rmrk/setCollectionProperty.test.ts
@@ -1,4 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {expectTxFailure} from './util/helpers';
 import {createCollection, setPropertyCollection} from './util/tx';
 
@@ -7,8 +8,9 @@
   const Bob = '//Bob';
 
   let api: any;
-  before(async () => {
+  before(async function () {
     api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
   });
 
   it('set collection property', async () => {
modifiedtests/src/rmrk/setEquippableList.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/setEquippableList.test.ts
+++ b/tests/src/rmrk/setEquippableList.test.ts
@@ -1,10 +1,14 @@
 import {getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {expectTxFailure} from './util/helpers';
 import {createCollection, createBase, setEquippableList} from './util/tx';
 
 describe("integration test: set slot's Equippable List", () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
+  before(async function () {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
 
   const alice = '//Alice';
   const bob = '//Bob';
modifiedtests/src/rmrk/setNftProperty.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/setNftProperty.test.ts
+++ b/tests/src/rmrk/setNftProperty.test.ts
@@ -1,11 +1,15 @@
 import {getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {NftIdTuple} from './util/fetch';
 import {expectTxFailure} from './util/helpers';
 import {createCollection, mintNft, sendNft, setNftProperty} from './util/tx';
 
 describe('integration test: set NFT property', () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
+  before(async function () {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
 
   const alice = '//Alice';
   const bob = '//Bob';
modifiedtests/src/rmrk/setResourcePriorities.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/setResourcePriorities.test.ts
+++ b/tests/src/rmrk/setResourcePriorities.test.ts
@@ -1,10 +1,14 @@
 import {getApiConnection} from '../substrate/substrate-api';
+import { getModuleNames, Pallets } from '../util/helpers';
 import {expectTxFailure} from './util/helpers';
 import {mintNft, createCollection, setResourcePriorities} from './util/tx';
 
 describe('integration test: set NFT resource priorities', () => {
   let api: any;
-  before(async () => { api = await getApiConnection(); });
+  before(async function () {
+    api = await getApiConnection();
+    if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();
+  });
 
   const alice = '//Alice';
   const bob = '//Bob';
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -38,6 +38,38 @@
   Ethereum: string,
 };
 
+
+export enum Pallets {
+  Inflation = 'inflation',
+  RmrkCore = 'rmrkcore',
+  ReFungible = 'refungible',
+  Fungible = 'fungible',
+  NFT = 'nonfungible',
+}
+
+export async function isUnique(): Promise<boolean> {
+  return usingApi(async api => {
+    const chain = await api.rpc.system.chain();
+
+    return chain.eq('UNIQUE');
+  });
+}
+
+export async function isQuartz(): Promise<boolean> {
+  return usingApi(async api => {
+    const chain = await api.rpc.system.chain();
+    
+    return chain.eq('QUARTZ');
+  });
+}
+
+let modulesNames: any;
+export function getModuleNames(api: ApiPromise): string[] {
+  if (typeof modulesNames === 'undefined') 
+    modulesNames = api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());
+  return modulesNames;
+}
+
 export function normalizeAccountId(input: string | AccountId | CrossAccountId | IKeyringPair): CrossAccountId {
   if (typeof input === 'string') {
     if (input.length >= 47) {