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
in: master
27 files changed
runtime/common/Cargo.tomldiffbeforeafterboth32 'frame-support/runtime-benchmarks',32 'frame-support/runtime-benchmarks',33 'frame-system/runtime-benchmarks',33 'frame-system/runtime-benchmarks',34]34]35unique-runtime = ['std']36quartz-runtime = ['std']353736[dependencies.sp-core]38[dependencies.sp-core]37default-features = false39default-features = falseruntime/common/src/dispatch.rsdiffbeforeafterboth64 );64 );65 <PalletFungible<T>>::init_collection(sender, data)?65 <PalletFungible<T>>::init_collection(sender, data)?66 }66 }67 #[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]67 CollectionMode::ReFungible => <PalletRefungible<T>>::init_collection(sender, data)?,68 CollectionMode::ReFungible => <PalletRefungible<T>>::init_collection(sender, data)?,6970 CollectionMode::ReFungible => {71 return Err(DispatchError::Other("Refunginle pallet is not supported"))72 }68 };73 };69 Ok(id)74 Ok(id)70 }75 }runtime/common/src/weights.rsdiffbeforeafterboth25};25};26use up_data_structs::{CreateItemExData, CreateItemData};26use up_data_structs::{CreateItemExData, CreateItemData};272728#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]28macro_rules! max_weight_of {29macro_rules! max_weight_of {29 ($method:ident ( $($args:tt)* )) => {30 ($method:ident ( $($args:tt)* )) => {30 <FungibleWeights<T>>::$method($($args)*)31 <FungibleWeights<T>>::$method($($args)*)33 };34 };34}35}353637#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]38macro_rules! max_weight_of {39 ($method:ident ( $($args:tt)* )) => {40 <FungibleWeights<T>>::$method($($args)*)41 .max(<NonfungibleWeights<T>>::$method($($args)*))4243 };44}4546#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]36pub struct CommonWeights<T>(PhantomData<T>)47pub struct CommonWeights<T>(PhantomData<T>)37where48where38 T: FungibleConfig + NonfungibleConfig + RefungibleConfig;49 T: FungibleConfig + NonfungibleConfig + RefungibleConfig;5051#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]39impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>52impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>40where53where41 T: FungibleConfig + NonfungibleConfig + RefungibleConfig,54 T: FungibleConfig + NonfungibleConfig + RefungibleConfig,101 }114 }102}115}103116117#[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]104impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>118impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>105where119where106 T: FungibleConfig + NonfungibleConfig + RefungibleConfig,120 T: FungibleConfig + NonfungibleConfig + RefungibleConfig,110 }124 }111}125}126127#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]128pub struct CommonWeights<T>(PhantomData<T>)129where130 T: FungibleConfig + NonfungibleConfig;131132#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]133impl<T> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T>134where135 T: FungibleConfig + NonfungibleConfig,136{137 fn create_item() -> Weight {138 dispatch_weight::<T>() + max_weight_of!(create_item())139 }140141 fn create_multiple_items(data: &[CreateItemData]) -> Weight {142 dispatch_weight::<T>() + max_weight_of!(create_multiple_items(data))143 }144145 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {146 dispatch_weight::<T>() + max_weight_of!(create_multiple_items_ex(data))147 }148149 fn burn_item() -> Weight {150 dispatch_weight::<T>() + max_weight_of!(burn_item())151 }152153 fn set_collection_properties(amount: u32) -> Weight {154 dispatch_weight::<T>() + max_weight_of!(set_collection_properties(amount))155 }156157 fn delete_collection_properties(amount: u32) -> Weight {158 dispatch_weight::<T>() + max_weight_of!(delete_collection_properties(amount))159 }160161 fn set_token_properties(amount: u32) -> Weight {162 dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))163 }164165 fn delete_token_properties(amount: u32) -> Weight {166 dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))167 }168169 fn set_token_property_permissions(amount: u32) -> Weight {170 dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))171 }172173 fn transfer() -> Weight {174 dispatch_weight::<T>() + max_weight_of!(transfer())175 }176177 fn approve() -> Weight {178 dispatch_weight::<T>() + max_weight_of!(approve())179 }180181 fn transfer_from() -> Weight {182 dispatch_weight::<T>() + max_weight_of!(transfer_from())183 }184185 fn burn_from() -> Weight {186 dispatch_weight::<T>() + max_weight_of!(burn_from())187 }188189 fn burn_recursively_self_raw() -> Weight {190 max_weight_of!(burn_recursively_self_raw())191 }192193 fn burn_recursively_breadth_raw(amount: u32) -> Weight {194 max_weight_of!(burn_recursively_breadth_raw(amount))195 }196}197198#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]199impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>200where201 T: FungibleConfig + NonfungibleConfig,202{203 fn repartition() -> Weight {204 dispatch_weight::<T>()205 }206}112207runtime/quartz/src/lib.rsdiffbeforeafterboth909 type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;909 type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;910}910}911911912impl pallet_proxy_rmrk_core::Config for Runtime {912// impl pallet_proxy_rmrk_core::Config for Runtime {913 type WeightInfo = pallet_proxy_rmrk_core::weights::SubstrateWeight<Self>;913// type WeightInfo = pallet_proxy_rmrk_core::weights::SubstrateWeight<Self>;914 type Event = Event;914// type Event = Event;915}915// }916916917impl pallet_proxy_rmrk_equip::Config for Runtime {917// impl pallet_proxy_rmrk_equip::Config for Runtime {918 type WeightInfo = pallet_proxy_rmrk_equip::weights::SubstrateWeight<Self>;918// type WeightInfo = pallet_proxy_rmrk_equip::weights::SubstrateWeight<Self>;919 type Event = Event;919// type Event = Event;920}920// }921921922impl pallet_unique::Config for Runtime {922impl pallet_unique::Config for Runtime {923 type Event = Event;923 type Event = Event;961 )961 )962}962}963963964pub struct SchedulerPaymentExecutor;964// pub struct SchedulerPaymentExecutor;965impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>965// impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>966 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor966// DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor967where967// where968 <T as frame_system::Config>::Call: Member968// <T as frame_system::Config>::Call: Member969 + Dispatchable<Origin = Origin, Info = DispatchInfo>969// + Dispatchable<Origin = Origin, Info = DispatchInfo>970 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>970// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>971 + GetDispatchInfo971// + GetDispatchInfo972 + From<frame_system::Call<Runtime>>,972// + From<frame_system::Call<Runtime>>,973 SelfContainedSignedInfo: Send + Sync + 'static,973// SelfContainedSignedInfo: Send + Sync + 'static,974 Call: From<<T as frame_system::Config>::Call>974// Call: From<<T as frame_system::Config>::Call>975 + From<<T as pallet_unique_scheduler::Config>::Call>975// + From<<T as pallet_unique_scheduler::Config>::Call>976 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,976// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,977 sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,977// sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,978{978// {979 fn dispatch_call(979// fn dispatch_call(980 signer: <T as frame_system::Config>::AccountId,980// signer: <T as frame_system::Config>::AccountId,981 call: <T as pallet_unique_scheduler::Config>::Call,981// call: <T as pallet_unique_scheduler::Config>::Call,982 ) -> Result<982// ) -> Result<983 Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,983// Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,984 TransactionValidityError,984// TransactionValidityError,985 > {985// > {986 let dispatch_info = call.get_dispatch_info();986// let dispatch_info = call.get_dispatch_info();987 let extrinsic = fp_self_contained::CheckedExtrinsic::<987// let extrinsic = fp_self_contained::CheckedExtrinsic::<988 AccountId,988// AccountId,989 Call,989// Call,990 SignedExtraScheduler,990// SignedExtraScheduler,991 SelfContainedSignedInfo,991// SelfContainedSignedInfo,992 > {992// > {993 signed:993// signed:994 CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(994// CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(995 signer.clone().into(),995// signer.clone().into(),996 get_signed_extras(signer.into()),996// get_signed_extras(signer.into()),997 ),997// ),998 function: call.into(),998// function: call.into(),999 };999// };100010001001 extrinsic.apply::<Runtime>(&dispatch_info, 0)1001// extrinsic.apply::<Runtime>(&dispatch_info, 0)1002 }1002// }100310031004 fn reserve_balance(1004// fn reserve_balance(1005 id: [u8; 16],1005// id: [u8; 16],1006 sponsor: <T as frame_system::Config>::AccountId,1006// sponsor: <T as frame_system::Config>::AccountId,1007 call: <T as pallet_unique_scheduler::Config>::Call,1007// call: <T as pallet_unique_scheduler::Config>::Call,1008 count: u32,1008// count: u32,1009 ) -> Result<(), DispatchError> {1009// ) -> Result<(), DispatchError> {1010 let dispatch_info = call.get_dispatch_info();1010// let dispatch_info = call.get_dispatch_info();1011 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)1011// let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)1012 .saturating_mul(count.into());1012// .saturating_mul(count.into());101310131014 <Balances as NamedReservableCurrency<AccountId>>::reserve_named(1014// <Balances as NamedReservableCurrency<AccountId>>::reserve_named(1015 &id,1015// &id,1016 &(sponsor.into()),1016// &(sponsor.into()),1017 weight.into(),1017// weight.into(),1018 )1018// )1019 }1019// }102010201021 fn pay_for_call(1021// fn pay_for_call(1022 id: [u8; 16],1022// id: [u8; 16],1023 sponsor: <T as frame_system::Config>::AccountId,1023// sponsor: <T as frame_system::Config>::AccountId,1024 call: <T as pallet_unique_scheduler::Config>::Call,1024// call: <T as pallet_unique_scheduler::Config>::Call,1025 ) -> Result<u128, DispatchError> {1025// ) -> Result<u128, DispatchError> {1026 let dispatch_info = call.get_dispatch_info();1026// let dispatch_info = call.get_dispatch_info();1027 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);1027// let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);1028 Ok(1028// Ok(1029 <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1029// <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1030 &id,1030// &id,1031 &(sponsor.into()),1031// &(sponsor.into()),1032 weight.into(),1032// weight.into(),1033 ),1033// ),1034 )1034// )1035 }1035// }103610361037 fn cancel_reserve(1037// fn cancel_reserve(1038 id: [u8; 16],1038// id: [u8; 16],1039 sponsor: <T as frame_system::Config>::AccountId,1039// sponsor: <T as frame_system::Config>::AccountId,1040 ) -> Result<u128, DispatchError> {1040// ) -> Result<u128, DispatchError> {1041 Ok(1041// Ok(1042 <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1042// <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1043 &id,1043// &id,1044 &(sponsor.into()),1044// &(sponsor.into()),1045 u128::MAX,1045// u128::MAX,1046 ),1046// ),1047 )1047// )1048 }1048// }1049}1049// }105010501051parameter_types! {1051parameter_types! {1052 pub const NoPreimagePostponement: Option<u32> = Some(10);1052 pub const NoPreimagePostponement: Option<u32> = Some(10);1062 }1062 }1063}1063}106410641065impl pallet_unique_scheduler::Config for Runtime {1065// impl pallet_unique_scheduler::Config for Runtime {1066 type Event = Event;1066// type Event = Event;1067 type Origin = Origin;1067// type Origin = Origin;1068 type Currency = Balances;1068// type Currency = Balances;1069 type PalletsOrigin = OriginCaller;1069// type PalletsOrigin = OriginCaller;1070 type Call = Call;1070// type Call = Call;1071 type MaximumWeight = MaximumSchedulerWeight;1071// type MaximumWeight = MaximumSchedulerWeight;1072 type ScheduleOrigin = EnsureSigned<AccountId>;1072// type ScheduleOrigin = EnsureSigned<AccountId>;1073 type MaxScheduledPerBlock = MaxScheduledPerBlock;1073// type MaxScheduledPerBlock = MaxScheduledPerBlock;1074 type WeightInfo = ();1074// type WeightInfo = ();1075 type CallExecutor = SchedulerPaymentExecutor;1075// type CallExecutor = SchedulerPaymentExecutor;1076 type OriginPrivilegeCmp = OriginPrivilegeCmp;1076// type OriginPrivilegeCmp = OriginPrivilegeCmp;1077 type PreimageProvider = ();1077// type PreimageProvider = ();1078 type NoPreimagePostponement = NoPreimagePostponement;1078// type NoPreimagePostponement = NoPreimagePostponement;1079}1079// }108010801081type EvmSponsorshipHandler = (1081type EvmSponsorshipHandler = (1082 UniqueEthSponsorshipHandler<Runtime>,1082 UniqueEthSponsorshipHandler<Runtime>,1150 // Unique Pallets1150 // Unique Pallets1151 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,1151 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,1152 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,1152 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,1153 Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,1153 // Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,1154 // free = 631154 // free = 631155 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,1155 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,1156 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,1156 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,1157 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,1157 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,1158 Fungible: pallet_fungible::{Pallet, Storage} = 67,1158 Fungible: pallet_fungible::{Pallet, Storage} = 67,1159 Refungible: pallet_refungible::{Pallet, Storage} = 68,1159 // Refungible: pallet_refungible::{Pallet, Storage} = 68,1160 Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,1160 Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,1161 Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,1161 Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,1162 RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,1162 // RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,1163 RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,1163 // RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,116411641165 // Frontier1165 // Frontier1166 EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,1166 EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,1324 RmrkTheme1324 RmrkTheme1325 > for Runtime {1325 > for Runtime {1326 1327 // fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {1328 // pallet_proxy_rmrk_core::rpc::last_collection_idx::<Runtime>()1329 // }13301331 // fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {1332 // pallet_proxy_rmrk_core::rpc::collection_by_id::<Runtime>(collection_id)1333 // }13341335 // fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {1336 // pallet_proxy_rmrk_core::rpc::nft_by_id::<Runtime>(collection_id, nft_by_id)1337 // }13381339 // fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {1340 // pallet_proxy_rmrk_core::rpc::account_tokens::<Runtime>(account_id, collection_id)1341 // }13421343 // fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {1344 // pallet_proxy_rmrk_core::rpc::nft_children::<Runtime>(collection_id, nft_id)1345 // }13461347 // fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {1348 // pallet_proxy_rmrk_core::rpc::collection_properties::<Runtime>(collection_id, filter_keys)1349 // }13501351 // fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {1352 // pallet_proxy_rmrk_core::rpc::nft_properties::<Runtime>(collection_id, nft_id, filter_keys)1353 // }13541355 // fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {1356 // pallet_proxy_rmrk_core::rpc::nft_resources::<Runtime>(collection_id, nft_id)1357 // }13581359 // fn nft_resource_priority(collection_id: RmrkCollectionId, nft_id: RmrkNftId, resource_id: RmrkResourceId) -> Result<Option<u32>, DispatchError> {1360 // pallet_proxy_rmrk_core::rpc::nft_resource_priority::<Runtime>(collection_id, nft_id, resource_id)1361 // }13621363 // fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {1364 // pallet_proxy_rmrk_equip::rpc::base::<Runtime>(base_id)1365 // }13661367 // fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {1368 // pallet_proxy_rmrk_equip::rpc::base_parts::<Runtime>(base_id)1369 // }13701371 // fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {1372 // pallet_proxy_rmrk_equip::rpc::theme_names::<Runtime>(base_id)1373 // }13741375 // fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {1376 // pallet_proxy_rmrk_equip::rpc::theme::<Runtime>(base_id, theme_name, filter_keys)1377 // }1378 1326 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {1379 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {1327 pallet_proxy_rmrk_core::rpc::last_collection_idx::<Runtime>()1380 Ok(Default::default())1328 }1381 }132913821330 fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {1383 fn collection_by_id(_collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {1331 pallet_proxy_rmrk_core::rpc::collection_by_id::<Runtime>(collection_id)1384 Ok(Default::default())1332 }1385 }133313861334 fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {1387 fn nft_by_id(_collection_id: RmrkCollectionId, _nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {1335 pallet_proxy_rmrk_core::rpc::nft_by_id::<Runtime>(collection_id, nft_by_id)1388 Ok(Default::default())1336 }1389 }133713901338 fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {1391 fn account_tokens(_account_id: AccountId, _collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {1339 pallet_proxy_rmrk_core::rpc::account_tokens::<Runtime>(account_id, collection_id)1392 Ok(Default::default())1340 }1393 }134113941342 fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {1395 fn nft_children(_collection_id: RmrkCollectionId, _nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {1343 pallet_proxy_rmrk_core::rpc::nft_children::<Runtime>(collection_id, nft_id)1396 Ok(Default::default())1344 }1397 }134513981346 fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {1399 fn collection_properties(_collection_id: RmrkCollectionId, _filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {1347 pallet_proxy_rmrk_core::rpc::collection_properties::<Runtime>(collection_id, filter_keys)1400 Ok(Default::default())1348 }1401 }134914021350 fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {1403 fn nft_properties(_collection_id: RmrkCollectionId, _nft_id: RmrkNftId, _filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {1351 pallet_proxy_rmrk_core::rpc::nft_properties::<Runtime>(collection_id, nft_id, filter_keys)1404 Ok(Default::default())1352 }1405 }135314061354 fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {1407 fn nft_resources(_collection_id: RmrkCollectionId, _nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {1355 pallet_proxy_rmrk_core::rpc::nft_resources::<Runtime>(collection_id, nft_id)1408 Ok(Default::default())1356 }1409 }135714101358 fn nft_resource_priority(collection_id: RmrkCollectionId, nft_id: RmrkNftId, resource_id: RmrkResourceId) -> Result<Option<u32>, DispatchError> {1411 fn nft_resource_priority(_collection_id: RmrkCollectionId, _nft_id: RmrkNftId, _resource_id: RmrkResourceId) -> Result<Option<u32>, DispatchError> {1359 pallet_proxy_rmrk_core::rpc::nft_resource_priority::<Runtime>(collection_id, nft_id, resource_id)1412 Ok(Default::default())1360 }1413 }136114141362 fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {1415 fn base(_base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {1363 pallet_proxy_rmrk_equip::rpc::base::<Runtime>(base_id)1416 Ok(Default::default())1364 }1417 }136514181366 fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {1419 fn base_parts(_base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {1367 pallet_proxy_rmrk_equip::rpc::base_parts::<Runtime>(base_id)1420 Ok(Default::default())1368 }1421 }136914221370 fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {1423 fn theme_names(_base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {1371 pallet_proxy_rmrk_equip::rpc::theme_names::<Runtime>(base_id)1424 Ok(Default::default())1372 }1425 }137314261374 fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {1427 fn theme(_base_id: RmrkBaseId, _theme_name: RmrkThemeName, _filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {1375 pallet_proxy_rmrk_equip::rpc::theme::<Runtime>(base_id, theme_name, filter_keys)1428 Ok(Default::default())1376 }1429 }1430 1431 runtime/unique/src/lib.rsdiffbeforeafterboth950 )952 )951}953}952954953pub struct SchedulerPaymentExecutor;955// pub struct SchedulerPaymentExecutor;954impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>956// impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>955 DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor957// DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor956where958// where957 <T as frame_system::Config>::Call: Member959// <T as frame_system::Config>::Call: Member958 + Dispatchable<Origin = Origin, Info = DispatchInfo>960// + Dispatchable<Origin = Origin, Info = DispatchInfo>959 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>961// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>960 + GetDispatchInfo962// + GetDispatchInfo961 + From<frame_system::Call<Runtime>>,963// + From<frame_system::Call<Runtime>>,962 SelfContainedSignedInfo: Send + Sync + 'static,964// SelfContainedSignedInfo: Send + Sync + 'static,963 Call: From<<T as frame_system::Config>::Call>965// Call: From<<T as frame_system::Config>::Call>964 + From<<T as pallet_unique_scheduler::Config>::Call>966// + From<<T as pallet_unique_scheduler::Config>::Call>965 + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,967// + SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,966 sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,968// sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,967{969// {968 fn dispatch_call(970// fn dispatch_call(969 signer: <T as frame_system::Config>::AccountId,971// signer: <T as frame_system::Config>::AccountId,970 call: <T as pallet_unique_scheduler::Config>::Call,972// call: <T as pallet_unique_scheduler::Config>::Call,971 ) -> Result<973// ) -> Result<972 Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,974// Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,973 TransactionValidityError,975// TransactionValidityError,974 > {976// > {975 let dispatch_info = call.get_dispatch_info();977// let dispatch_info = call.get_dispatch_info();976 let extrinsic = fp_self_contained::CheckedExtrinsic::<978// let extrinsic = fp_self_contained::CheckedExtrinsic::<977 AccountId,979// AccountId,978 Call,980// Call,979 SignedExtraScheduler,981// SignedExtraScheduler,980 SelfContainedSignedInfo,982// SelfContainedSignedInfo,981 > {983// > {982 signed:984// signed:983 CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(985// CheckedSignature::<AccountId, SignedExtraScheduler, SelfContainedSignedInfo>::Signed(984 signer.clone().into(),986// signer.clone().into(),985 get_signed_extras(signer.into()),987// get_signed_extras(signer.into()),986 ),988// ),987 function: call.into(),989// function: call.into(),988 };990// };989991990 extrinsic.apply::<Runtime>(&dispatch_info, 0)992// extrinsic.apply::<Runtime>(&dispatch_info, 0)991 }993// }992994993 fn reserve_balance(995// fn reserve_balance(994 id: [u8; 16],996// id: [u8; 16],995 sponsor: <T as frame_system::Config>::AccountId,997// sponsor: <T as frame_system::Config>::AccountId,996 call: <T as pallet_unique_scheduler::Config>::Call,998// call: <T as pallet_unique_scheduler::Config>::Call,997 count: u32,999// count: u32,998 ) -> Result<(), DispatchError> {1000// ) -> Result<(), DispatchError> {999 let dispatch_info = call.get_dispatch_info();1001// let dispatch_info = call.get_dispatch_info();1000 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)1002// let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0)1001 .saturating_mul(count.into());1003// .saturating_mul(count.into());100210041003 <Balances as NamedReservableCurrency<AccountId>>::reserve_named(1005// <Balances as NamedReservableCurrency<AccountId>>::reserve_named(1004 &id,1006// &id,1005 &(sponsor.into()),1007// &(sponsor.into()),1006 weight,1008// weight,1007 )1009// )1008 }1010// }100910111010 fn pay_for_call(1012// fn pay_for_call(1011 id: [u8; 16],1013// id: [u8; 16],1012 sponsor: <T as frame_system::Config>::AccountId,1014// sponsor: <T as frame_system::Config>::AccountId,1013 call: <T as pallet_unique_scheduler::Config>::Call,1015// call: <T as pallet_unique_scheduler::Config>::Call,1014 ) -> Result<u128, DispatchError> {1016// ) -> Result<u128, DispatchError> {1015 let dispatch_info = call.get_dispatch_info();1017// let dispatch_info = call.get_dispatch_info();1016 let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);1018// let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);1017 Ok(1019// Ok(1018 <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1020// <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1019 &id,1021// &id,1020 &(sponsor.into()),1022// &(sponsor.into()),1021 weight,1023// weight,1022 ),1024// ),1023 )1025// )1024 }1026// }102510271026 fn cancel_reserve(1028// fn cancel_reserve(1027 id: [u8; 16],1029// id: [u8; 16],1028 sponsor: <T as frame_system::Config>::AccountId,1030// sponsor: <T as frame_system::Config>::AccountId,1029 ) -> Result<u128, DispatchError> {1031// ) -> Result<u128, DispatchError> {1030 Ok(1032// Ok(1031 <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1033// <Balances as NamedReservableCurrency<AccountId>>::unreserve_named(1032 &id,1034// &id,1033 &(sponsor.into()),1035// &(sponsor.into()),1034 u128::MAX,1036// u128::MAX,1035 ),1037// ),1036 )1038// )1037 }1039// }1038}1040// }103910411040parameter_types! {1042parameter_types! {1041 pub const NoPreimagePostponement: Option<u32> = Some(10);1043 pub const NoPreimagePostponement: Option<u32> = Some(10);1051 }1053 }1052}1054}105310551054impl pallet_unique_scheduler::Config for Runtime {1056// impl pallet_unique_scheduler::Config for Runtime {1055 type Event = Event;1057// type Event = Event;1056 type Origin = Origin;1058// type Origin = Origin;1057 type Currency = Balances;1059// type Currency = Balances;1058 type PalletsOrigin = OriginCaller;1060// type PalletsOrigin = OriginCaller;1059 type Call = Call;1061// type Call = Call;1060 type MaximumWeight = MaximumSchedulerWeight;1062// type MaximumWeight = MaximumSchedulerWeight;1061 type ScheduleOrigin = EnsureSigned<AccountId>;1063// type ScheduleOrigin = EnsureSigned<AccountId>;1062 type MaxScheduledPerBlock = MaxScheduledPerBlock;1064// type MaxScheduledPerBlock = MaxScheduledPerBlock;1063 type WeightInfo = ();1065// type WeightInfo = ();1064 type CallExecutor = SchedulerPaymentExecutor;1066// type CallExecutor = SchedulerPaymentExecutor;1065 type OriginPrivilegeCmp = OriginPrivilegeCmp;1067// type OriginPrivilegeCmp = OriginPrivilegeCmp;1066 type PreimageProvider = ();1068// type PreimageProvider = ();1067 type NoPreimagePostponement = NoPreimagePostponement;1069// type NoPreimagePostponement = NoPreimagePostponement;1068}1070// }106910711070type EvmSponsorshipHandler = (1072type EvmSponsorshipHandler = (1071 UniqueEthSponsorshipHandler<Runtime>,1073 UniqueEthSponsorshipHandler<Runtime>,1139 // Unique Pallets1141 // Unique Pallets1140 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,1142 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,1141 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,1143 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,1142 Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,1144 // Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,1143 // free = 631145 // free = 631144 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,1146 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,1145 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,1147 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,1146 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,1148 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,1147 Fungible: pallet_fungible::{Pallet, Storage} = 67,1149 Fungible: pallet_fungible::{Pallet, Storage} = 67,1148 Refungible: pallet_refungible::{Pallet, Storage} = 68,1150 // Refungible: pallet_refungible::{Pallet, Storage} = 68,1149 Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,1151 Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,1150 Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,1152 Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,11511153tests/src/refungible.test.tsdiffbeforeafterboth36 CrossAccountId,36 CrossAccountId,37 getCreateItemsResult,37 getCreateItemsResult,38 getDestroyItemsResult,38 getDestroyItemsResult,39 getModuleNames,40 Pallets,39} from './util/helpers';41} from './util/helpers';404241import chai from 'chai';43import chai from 'chai';46let alice: IKeyringPair;48let alice: IKeyringPair;47let bob: IKeyringPair;49let bob: IKeyringPair;4850515249describe('integration test: Refungible functionality:', () => {53describe('integration test: Refungible functionality:', async () => {50 before(async () => {54 before(async function() {51 await usingApi(async (api, privateKeyWrapper) => {55 await usingApi(async (api, privateKeyWrapper) => {52 alice = privateKeyWrapper('//Alice');56 alice = privateKeyWrapper('//Alice');53 bob = privateKeyWrapper('//Bob');57 bob = privateKeyWrapper('//Bob');58 if (!getModuleNames(api).includes(Pallets.ReFungible)) this.skip();54 });59 });60 55 });61 });5662 57 it('Create refungible collection and token', async () => {63 it('Create refungible collection and token', async () => {58 await usingApi(async api => {64 await usingApi(async api => {59 const createCollectionResult = await createCollection(api, alice, {mode: {type: 'ReFungible'}});65 const createCollectionResult = await createCollection(api, alice, {mode: {type: 'ReFungible'}});268 ]);274 ]);269 });275 });270 });276 });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 277 281 it('Сreate new collection with properties', async () => {278 it('Сreate new collection with properties', async () => {282 await usingApi(async api => {279 await usingApi(async api => {292 });289 });293 });290 });294});291});292295293tests/src/rmrk/acceptNft.test.tsdiffbeforeafterboth8} from './util/tx';8} from './util/tx';9import {NftIdTuple} from './util/fetch';9import {NftIdTuple} from './util/fetch';10import {isNftChildOfAnother, expectTxFailure} from './util/helpers';10import {isNftChildOfAnother, expectTxFailure} from './util/helpers';11import { getModuleNames, Pallets } from '../util/helpers';111212describe('integration test: accept NFT', () => {13describe('integration test: accept NFT', () => {13 let api: any;14 let api: any;14 before(async () => { api = await getApiConnection(); });15 before(async function() {1516 api = await getApiConnection();17 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();18 });19 20 tests/src/rmrk/addResource.test.tsdiffbeforeafterboth12 addNftComposableResource,12 addNftComposableResource,13} from './util/tx';13} from './util/tx';14import {RmrkTraitsResourceResourceInfo as ResourceInfo} from '@polkadot/types/lookup';14import {RmrkTraitsResourceResourceInfo as ResourceInfo} from '@polkadot/types/lookup';15import { getModuleNames, Pallets } from '../util/helpers';151616describe('integration test: add NFT resource', () => {17describe('integration test: add NFT resource', () => {17 const Alice = '//Alice';18 const Alice = '//Alice';24 const nonexistentId = 99999;25 const nonexistentId = 99999;252626 let api: any;27 let api: any;27 before(async () => {28 before(async function() {28 api = await getApiConnection();29 api = await getApiConnection();30 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();29 });31 });303231 it('add resource', async () => {33 it('add resource', async () => {tests/src/rmrk/addTheme.test.tsdiffbeforeafterboth3import {createBase, addTheme} from './util/tx';3import {createBase, addTheme} from './util/tx';4import {expectTxFailure} from './util/helpers';4import {expectTxFailure} from './util/helpers';5import {getThemeNames} from './util/fetch';5import {getThemeNames} from './util/fetch';6import { getModuleNames, Pallets } from '../util/helpers';677describe('integration test: add Theme to Base', () => {8describe('integration test: add Theme to Base', () => {8 let api: any;9 let api: any;9 before(async () => { api = await getApiConnection(); });10 before(async function() {11 api = await getApiConnection();12 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();13 });101411 const alice = '//Alice';15 const alice = '//Alice';tests/src/rmrk/burnNft.test.tsdiffbeforeafterboth556import chai from 'chai';6import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';7import chaiAsPromised from 'chai-as-promised';8import { getModuleNames, Pallets } from '../util/helpers';899chai.use(chaiAsPromised);10chai.use(chaiAsPromised);10const expect = chai.expect;11const expect = chai.expect;14 const Bob = '//Bob';15 const Bob = '//Bob';151616 let api: any;17 let api: any;17 before(async () => {18 before(async function() {18 api = await getApiConnection();19 api = await getApiConnection();20 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();19 });21 });222023tests/src/rmrk/changeCollectionIssuer.test.tsdiffbeforeafterboth1import {getApiConnection} from '../substrate/substrate-api';1import {getApiConnection} from '../substrate/substrate-api';2import { getModuleNames, Pallets } from '../util/helpers';2import {expectTxFailure} from './util/helpers';3import {expectTxFailure} from './util/helpers';3import {4import {4 changeIssuer,5 changeIssuer,10 const Bob = '//Bob';11 const Bob = '//Bob';111212 let api: any;13 let api: any;13 before(async () => {14 before(async function() {14 api = await getApiConnection();15 api = await getApiConnection();16 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();15 });17 });1819tests/src/rmrk/createBase.test.tsdiffbeforeafterboth1import {getApiConnection} from '../substrate/substrate-api';1import {getApiConnection} from '../substrate/substrate-api';2import { getModuleNames, Pallets } from '../util/helpers';2import {createCollection, createBase} from './util/tx';3import {createCollection, createBase} from './util/tx';344describe('integration test: create new Base', () => {5describe('integration test: create new Base', () => {5 let api: any;6 let api: any;6 before(async () => { api = await getApiConnection(); });7 before(async function() {8 api = await getApiConnection();9 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();10 });7118 const alice = '//Alice';12 const alice = '//Alice';tests/src/rmrk/createCollection.test.tsdiffbeforeafterboth1import {getApiConnection} from '../substrate/substrate-api';1import {getApiConnection} from '../substrate/substrate-api';2import {getModuleNames, Pallets} from '../util/helpers';2import {createCollection} from './util/tx';3import {createCollection} from './util/tx';344describe('Integration test: create new collection', () => {5describe('Integration test: create new collection', () => {5 let api: any;6 let api: any;6 before(async () => { api = await getApiConnection(); });7 before(async function () {8 api = await getApiConnection();9 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();10 });1112tests/src/rmrk/deleteCollection.test.tsdiffbeforeafterboth1import {getApiConnection} from '../substrate/substrate-api';1import {getApiConnection} from '../substrate/substrate-api';2import { getModuleNames, Pallets } from '../util/helpers';2import {expectTxFailure} from './util/helpers';3import {expectTxFailure} from './util/helpers';3import {createCollection, deleteCollection} from './util/tx';4import {createCollection, deleteCollection} from './util/tx';455describe('integration test: delete collection', () => {6describe('integration test: delete collection', () => {6 let api: any;7 let api: any;7 before(async () => {8 before(async function () {8 api = await getApiConnection();9 api = await getApiConnection();10 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();9 });11 });101211 const Alice = '//Alice';13 const Alice = '//Alice';tests/src/rmrk/equipNft.test.tsdiffbeforeafterboth1import {ApiPromise} from '@polkadot/api';1import {ApiPromise} from '@polkadot/api';2import {expect} from 'chai';2import {expect} from 'chai';3import {getApiConnection} from '../substrate/substrate-api';3import {getApiConnection} from '../substrate/substrate-api';4import {getModuleNames, Pallets} from '../util/helpers';4import {getNft, getParts, NftIdTuple} from './util/fetch';5import {getNft, getParts, NftIdTuple} from './util/fetch';5import {expectTxFailure} from './util/helpers';6import {expectTxFailure} from './util/helpers';6import {7import {123124124 let api: any;125 let api: any;126 125 before(async () => {127 before(async function () {126 api = await getApiConnection();128 api = await getApiConnection();129 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();127 });130 });128131129 it('equip nft', async () => {132 it('equip nft', async () => {tests/src/rmrk/getOwnedNfts.test.tsdiffbeforeafterboth1import {expect} from 'chai';1import {expect} from 'chai';2import {getApiConnection} from '../substrate/substrate-api';2import {getApiConnection} from '../substrate/substrate-api';3import { getModuleNames, Pallets } from '../util/helpers';3import {getOwnedNfts} from './util/fetch';4import {getOwnedNfts} from './util/fetch';4import {mintNft, createCollection} from './util/tx';5import {mintNft, createCollection} from './util/tx';566describe('integration test: get owned NFTs', () => {7describe('integration test: get owned NFTs', () => {7 let api: any;8 let api: any;9 8 before(async () => { api = await getApiConnection(); });10 before(async function () {11 api = await getApiConnection();12 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();13 });14915tests/src/rmrk/lockCollection.test.tsdiffbeforeafterboth1import {getApiConnection} from '../substrate/substrate-api';1import {getApiConnection} from '../substrate/substrate-api';2import { getModuleNames, Pallets } from '../util/helpers';2import {expectTxFailure} from './util/helpers';3import {expectTxFailure} from './util/helpers';3import {createCollection, lockCollection, mintNft} from './util/tx';4import {createCollection, lockCollection, mintNft} from './util/tx';458 const Max = 5;9 const Max = 5;91010 let api: any;11 let api: any;11 before(async () => {12 before(async function () {12 api = await getApiConnection();13 api = await getApiConnection();14 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();13 });15 });141615 it('lock collection', async () => {17 it('lock collection', async () => {tests/src/rmrk/mintNft.test.tsdiffbeforeafterboth1import {expect} from 'chai';1import {expect} from 'chai';2import {getApiConnection} from '../substrate/substrate-api';2import {getApiConnection} from '../substrate/substrate-api';3import { getModuleNames, Pallets } from '../util/helpers';3import {getNft} from './util/fetch';4import {getNft} from './util/fetch';4import {expectTxFailure} from './util/helpers';5import {expectTxFailure} from './util/helpers';5import {createCollection, mintNft} from './util/tx';6import {createCollection, mintNft} from './util/tx';677describe('integration test: mint new NFT', () => {8describe('integration test: mint new NFT', () => {8 let api: any;9 let api: any;10 9 before(async () => { api = await getApiConnection(); });11 before(async function () {12 api = await getApiConnection();13 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();14 });151016tests/src/rmrk/rejectNft.test.tsdiffbeforeafterboth8} from './util/tx';8} from './util/tx';9import {getChildren, NftIdTuple} from './util/fetch';9import {getChildren, NftIdTuple} from './util/fetch';10import {isNftChildOfAnother, expectTxFailure} from './util/helpers';10import {isNftChildOfAnother, expectTxFailure} from './util/helpers';11import { getModuleNames, Pallets } from '../util/helpers';111212describe('integration test: reject NFT', () => {13describe('integration test: reject NFT', () => {13 let api: any;14 let api: any;14 before(async () => { api = await getApiConnection(); });15 before(async function () {16 api = await getApiConnection();17 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();18 });1920tests/src/rmrk/removeResource.test.tsdiffbeforeafterboth1import {expect} from 'chai';1import {expect} from 'chai';2import privateKey from '../substrate/privateKey';2import privateKey from '../substrate/privateKey';3import {executeTransaction, getApiConnection} from '../substrate/substrate-api';3import {executeTransaction, getApiConnection} from '../substrate/substrate-api';4import { getModuleNames, Pallets } from '../util/helpers';4import {getNft, NftIdTuple} from './util/fetch';5import {getNft, NftIdTuple} from './util/fetch';5import {expectTxFailure} from './util/helpers';6import {expectTxFailure} from './util/helpers';6import {7import {16describe('Integration test: remove nft resource', () => {17describe('Integration test: remove nft resource', () => {17 let api: any;18 let api: any;18 let ss58Format: string;19 let ss58Format: string;19 before(async () => {20 before(async function() {20 api = await getApiConnection();21 api = await getApiConnection();21 ss58Format = api.registry.getChainProperties()!.toJSON().ss58Format;22 ss58Format = api.registry.getChainProperties()!.toJSON().ss58Format;23 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();22 });24 });232524 const Alice = '//Alice';26 const Alice = '//Alice';tests/src/rmrk/rmrkIsolation.test.tsdiffbeforeafterboth6 getCreateCollectionResult,6 getCreateCollectionResult,7 getDetailedCollectionInfo,7 getDetailedCollectionInfo,8 getGenericResult,8 getGenericResult,9 getModuleNames,9 normalizeAccountId,10 normalizeAccountId,11 Pallets,10} from '../util/helpers';12} from '../util/helpers';11import {IKeyringPair} from '@polkadot/types/types';13import {IKeyringPair} from '@polkadot/types/types';12import {ApiPromise} from '@polkadot/api';14import {ApiPromise} from '@polkadot/api';59describe('RMRK External Integration Test', async () => {61describe('RMRK External Integration Test', async () => {60 const it_rmrk = (await isUnique() ? it : it.skip);62 const it_rmrk = (await isUnique() ? it : it.skip);616362 before(async () => {64 before(async function() {63 await usingApi(async (api, privateKeyWrapper) => {65 await usingApi(async (api, privateKeyWrapper) => {64 alice = privateKeyWrapper('//Alice');66 alice = privateKeyWrapper('//Alice');6567 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();66 67 });68 });68 });69 });tests/src/rmrk/sendNft.test.tsdiffbeforeafterboth3import {createCollection, mintNft, sendNft} from './util/tx';3import {createCollection, mintNft, sendNft} from './util/tx';4import {NftIdTuple} from './util/fetch';4import {NftIdTuple} from './util/fetch';5import {isNftChildOfAnother, expectTxFailure} from './util/helpers';5import {isNftChildOfAnother, expectTxFailure} from './util/helpers';6import { getModuleNames, Pallets } from '../util/helpers';677describe('integration test: send NFT', () => {8describe('integration test: send NFT', () => {8 let api: any;9 let api: any;9 before(async () => { api = await getApiConnection(); });10 before(async function () {11 api = await getApiConnection();12 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();13 });101411 const maxNftId = 0xFFFFFFFF;15 const maxNftId = 0xFFFFFFFF;tests/src/rmrk/setCollectionProperty.test.tsdiffbeforeafterboth1import {getApiConnection} from '../substrate/substrate-api';1import {getApiConnection} from '../substrate/substrate-api';2import { getModuleNames, Pallets } from '../util/helpers';2import {expectTxFailure} from './util/helpers';3import {expectTxFailure} from './util/helpers';3import {createCollection, setPropertyCollection} from './util/tx';4import {createCollection, setPropertyCollection} from './util/tx';457 const Bob = '//Bob';8 const Bob = '//Bob';899 let api: any;10 let api: any;10 before(async () => {11 before(async function () {11 api = await getApiConnection();12 api = await getApiConnection();13 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();12 });14 });131514 it('set collection property', async () => {16 it('set collection property', async () => {tests/src/rmrk/setEquippableList.test.tsdiffbeforeafterboth1import {getApiConnection} from '../substrate/substrate-api';1import {getApiConnection} from '../substrate/substrate-api';2import { getModuleNames, Pallets } from '../util/helpers';2import {expectTxFailure} from './util/helpers';3import {expectTxFailure} from './util/helpers';3import {createCollection, createBase, setEquippableList} from './util/tx';4import {createCollection, createBase, setEquippableList} from './util/tx';455describe("integration test: set slot's Equippable List", () => {6describe("integration test: set slot's Equippable List", () => {6 let api: any;7 let api: any;7 before(async () => { api = await getApiConnection(); });8 before(async function () {9 api = await getApiConnection();10 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();11 });8129 const alice = '//Alice';13 const alice = '//Alice';tests/src/rmrk/setNftProperty.test.tsdiffbeforeafterboth1import {getApiConnection} from '../substrate/substrate-api';1import {getApiConnection} from '../substrate/substrate-api';2import { getModuleNames, Pallets } from '../util/helpers';2import {NftIdTuple} from './util/fetch';3import {NftIdTuple} from './util/fetch';3import {expectTxFailure} from './util/helpers';4import {expectTxFailure} from './util/helpers';4import {createCollection, mintNft, sendNft, setNftProperty} from './util/tx';5import {createCollection, mintNft, sendNft, setNftProperty} from './util/tx';566describe('integration test: set NFT property', () => {7describe('integration test: set NFT property', () => {7 let api: any;8 let api: any;8 before(async () => { api = await getApiConnection(); });9 before(async function () {10 api = await getApiConnection();11 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();12 });91310 const alice = '//Alice';14 const alice = '//Alice';tests/src/rmrk/setResourcePriorities.test.tsdiffbeforeafterboth1import {getApiConnection} from '../substrate/substrate-api';1import {getApiConnection} from '../substrate/substrate-api';2import { getModuleNames, Pallets } from '../util/helpers';2import {expectTxFailure} from './util/helpers';3import {expectTxFailure} from './util/helpers';3import {mintNft, createCollection, setResourcePriorities} from './util/tx';4import {mintNft, createCollection, setResourcePriorities} from './util/tx';455describe('integration test: set NFT resource priorities', () => {6describe('integration test: set NFT resource priorities', () => {6 let api: any;7 let api: any;7 before(async () => { api = await getApiConnection(); });8 before(async function () {9 api = await getApiConnection();10 if (!getModuleNames(api).includes(Pallets.RmrkCore)) this.skip();11 });8129 const alice = '//Alice';13 const alice = '//Alice';tests/src/util/helpers.tsdiffbeforeafterboth39};39};404142export enum Pallets {43 Inflation = 'inflation',44 RmrkCore = 'rmrkcore',45 ReFungible = 'refungible',46 Fungible = 'fungible',47 NFT = 'nonfungible',48}4950export async function isUnique(): Promise<boolean> {51 return usingApi(async api => {52 const chain = await api.rpc.system.chain();5354 return chain.eq('UNIQUE');55 });56}5758export async function isQuartz(): Promise<boolean> {59 return usingApi(async api => {60 const chain = await api.rpc.system.chain();61 62 return chain.eq('QUARTZ');63 });64}6566let modulesNames: any;67export function getModuleNames(api: ApiPromise): string[] {68 if (typeof modulesNames === 'undefined') 69 modulesNames = api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());70 return modulesNames;71}407241export function normalizeAccountId(input: string | AccountId | CrossAccountId | IKeyringPair): CrossAccountId {73export function normalizeAccountId(input: string | AccountId | CrossAccountId | IKeyringPair): CrossAccountId {42 if (typeof input === 'string') {74 if (typeof input === 'string') {