git.delta.rocks / unique-network / refs/commits / 960c1089697d

difftreelog

refactor move RMRK rpc impl to proxy pallets

Daniel Shiposha2022-06-17parent: #a8df50d.patch.diff
in: master

6 files changed

modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -35,6 +35,7 @@
 pub mod benchmarking;
 pub mod misc;
 pub mod property;
+pub mod rpc;
 pub mod weights;
 
 pub type SelfWeightOf<T> = <T as Config>::WeightInfo;
addedpallets/proxy-rmrk-core/src/rpc.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/proxy-rmrk-core/src/rpc.rs
@@ -0,0 +1,265 @@
+use super::*;
+
+pub fn last_collection_idx<T: Config>() -> Result<RmrkCollectionId, DispatchError> {
+	Ok(<Pallet<T>>::last_collection_idx())
+}
+
+pub fn collection_by_id<T: Config>(
+	collection_id: RmrkCollectionId,
+) -> Result<Option<RmrkCollectionInfo<T::AccountId>>, DispatchError> {
+	let (collection, collection_id) = match <Pallet<T>>::get_typed_nft_collection_mapped(
+		collection_id,
+		misc::CollectionType::Regular,
+	) {
+		Ok(c) => c,
+		Err(_) => return Ok(None),
+	};
+
+	let nfts_count = collection.total_supply();
+
+	Ok(Some(RmrkCollectionInfo {
+		issuer: collection.owner.clone(),
+		metadata: <Pallet<T>>::get_collection_property_decoded(
+			collection_id,
+			RmrkProperty::Metadata,
+		)?,
+		max: collection.limits.token_limit,
+		symbol: <Pallet<T>>::rebind(&collection.token_prefix)?,
+		nfts_count,
+	}))
+}
+
+pub fn nft_by_id<T: Config>(
+	collection_id: RmrkCollectionId,
+	nft_by_id: RmrkNftId,
+) -> Result<Option<RmrkInstanceInfo<T::AccountId>>, DispatchError> {
+	let (collection, collection_id) = match <Pallet<T>>::get_typed_nft_collection_mapped(
+		collection_id,
+		misc::CollectionType::Regular,
+	) {
+		Ok(c) => c,
+		Err(_) => return Ok(None),
+	};
+
+	let nft_id = TokenId(nft_by_id);
+	if !<Pallet<T>>::nft_exists(collection_id, nft_id) {
+		return Ok(None);
+	}
+
+	let owner = match collection.token_owner(nft_id) {
+		Some(owner) => match T::CrossTokenAddressMapping::address_to_token(&owner) {
+			Some((col, tok)) => {
+				let rmrk_collection = <Pallet<T>>::rmrk_collection_id(col)?;
+
+				RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(rmrk_collection, tok.0)
+			}
+			None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone()),
+		},
+		None => return Ok(None),
+	};
+
+	Ok(Some(RmrkInstanceInfo {
+		owner: owner,
+		royalty: <Pallet<T>>::get_nft_property_decoded(
+			collection_id,
+			nft_id,
+			RmrkProperty::RoyaltyInfo,
+		)?,
+		metadata: <Pallet<T>>::get_nft_property_decoded(
+			collection_id,
+			nft_id,
+			RmrkProperty::Metadata,
+		)?,
+		equipped: <Pallet<T>>::get_nft_property_decoded(
+			collection_id,
+			nft_id,
+			RmrkProperty::Equipped,
+		)?,
+		pending: <Pallet<T>>::get_nft_property_decoded(
+			collection_id,
+			nft_id,
+			RmrkProperty::PendingNftAccept,
+		)?,
+	}))
+}
+
+pub fn account_tokens<T: Config>(
+	account_id: T::AccountId,
+	collection_id: RmrkCollectionId,
+) -> Result<Vec<RmrkNftId>, DispatchError> {
+	let cross_account_id = CrossAccountId::from_sub(account_id);
+
+	let (collection, collection_id) = match <Pallet<T>>::get_typed_nft_collection_mapped(
+		collection_id,
+		misc::CollectionType::Regular,
+	) {
+		Ok(c) => c,
+		Err(_) => return Ok(Vec::new()),
+	};
+
+	let tokens = collection
+		.account_tokens(cross_account_id)
+		.into_iter()
+		.filter(|token| {
+			let is_pending = <Pallet<T>>::get_nft_property_decoded(
+				collection_id,
+				*token,
+				RmrkProperty::PendingNftAccept,
+			)
+			.unwrap_or(true);
+
+			!is_pending
+		})
+		.map(|token| token.0)
+		.collect();
+
+	Ok(tokens)
+}
+
+pub fn nft_children<T: Config>(
+	collection_id: RmrkCollectionId,
+	nft_id: RmrkNftId,
+) -> Result<Vec<RmrkNftChild>, DispatchError> {
+	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {
+		Ok(id) => id,
+		Err(_) => return Ok(Vec::new()),
+	};
+	let nft_id = TokenId(nft_id);
+	if !<Pallet<T>>::nft_exists(collection_id, nft_id) {
+		return Ok(Vec::new());
+	}
+
+	Ok(
+		pallet_nonfungible::TokenChildren::<T>::iter_prefix((collection_id, nft_id))
+			.filter_map(|((child_collection, child_token), _)| {
+				let is_pending = <Pallet<T>>::get_nft_property_decoded(
+					child_collection,
+					child_token,
+					RmrkProperty::PendingNftAccept,
+				)
+				.ok()?;
+
+				if is_pending {
+					return None;
+				}
+
+				let rmrk_child_collection =
+					<Pallet<T>>::rmrk_collection_id(child_collection).ok()?;
+
+				Some(RmrkNftChild {
+					collection_id: rmrk_child_collection,
+					nft_id: child_token.0,
+				})
+			})
+			.collect(),
+	)
+}
+
+pub fn collection_properties<T: Config>(
+	collection_id: RmrkCollectionId,
+	filter_keys: Option<Vec<RmrkPropertyKey>>,
+) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {
+	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {
+		Ok(id) => id,
+		Err(_) => return Ok(Vec::new()),
+	};
+	if <Pallet<T>>::ensure_collection_type(collection_id, misc::CollectionType::Regular).is_err() {
+		return Ok(Vec::new());
+	}
+
+	let properties = <Pallet<T>>::filter_user_properties(
+		collection_id,
+		/* token_id = */ None,
+		filter_keys,
+		|key, value| RmrkPropertyInfo { key, value },
+	)?;
+
+	Ok(properties)
+}
+
+pub fn nft_properties<T: Config>(
+	collection_id: RmrkCollectionId,
+	nft_id: RmrkNftId,
+	filter_keys: Option<Vec<RmrkPropertyKey>>,
+) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {
+	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {
+		Ok(id) => id,
+		Err(_) => return Ok(Vec::new()),
+	};
+	let token_id = TokenId(nft_id);
+
+	if <Pallet<T>>::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {
+		return Ok(Vec::new());
+	}
+
+	let properties = <Pallet<T>>::filter_user_properties(
+		collection_id,
+		Some(token_id),
+		filter_keys,
+		|key, value| RmrkPropertyInfo { key, value },
+	)?;
+
+	Ok(properties)
+}
+
+pub fn nft_resources<T: Config>(
+	collection_id: RmrkCollectionId,
+	nft_id: RmrkNftId,
+) -> Result<Vec<RmrkResourceInfo>, DispatchError> {
+	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {
+		Ok(id) => id,
+		Err(_) => return Ok(Vec::new()),
+	};
+	if <Pallet<T>>::ensure_collection_type(collection_id, misc::CollectionType::Regular).is_err() {
+		return Ok(Vec::new());
+	}
+
+	let nft_id = TokenId(nft_id);
+	if <Pallet<T>>::ensure_nft_type(collection_id, nft_id, NftType::Regular).is_err() {
+		return Ok(Vec::new());
+	}
+
+	let resources = <pallet_nonfungible::Pallet<T>>::iterate_token_aux_properties(
+		collection_id,
+		nft_id,
+		PropertyScope::Rmrk,
+	)
+	.filter_map(|(_, value)| {
+		let resource_info: RmrkResourceInfo = <Pallet<T>>::decode_property(&value).ok()?;
+
+		Some(resource_info)
+	})
+	.collect();
+
+	Ok(resources)
+}
+
+pub fn nft_resource_priority<T: Config>(
+	collection_id: RmrkCollectionId,
+	nft_id: RmrkNftId,
+	resource_id: RmrkResourceId,
+) -> Result<Option<u32>, DispatchError> {
+	let collection_id = match <Pallet<T>>::unique_collection_id(collection_id) {
+		Ok(id) => id,
+		Err(_) => return Ok(None),
+	};
+	if <Pallet<T>>::ensure_collection_type(collection_id, misc::CollectionType::Regular).is_err() {
+		return Ok(None);
+	}
+
+	let nft_id = TokenId(nft_id);
+	if <Pallet<T>>::ensure_nft_type(collection_id, nft_id, NftType::Regular).is_err() {
+		return Ok(None);
+	}
+
+	let priorities: Vec<_> = <Pallet<T>>::get_nft_property_decoded(
+		collection_id,
+		nft_id,
+		RmrkProperty::ResourcePriorities,
+	)?;
+	Ok(priorities
+		.into_iter()
+		.enumerate()
+		.find(|(_, id)| *id == resource_id)
+		.map(|(priority, _): (usize, RmrkResourceId)| priority as u32))
+}
modifiedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
before · pallets/proxy-rmrk-equip/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![cfg_attr(not(feature = "std"), no_std)]1819use frame_support::{pallet_prelude::*, transactional, BoundedVec, dispatch::DispatchResult};20use frame_system::{pallet_prelude::*, ensure_signed};21use sp_runtime::DispatchError;22use up_data_structs::*;23use pallet_common::{Pallet as PalletCommon, Error as CommonError};24use pallet_rmrk_core::{25	Pallet as PalletCore,26	misc::{self, *},27	property::RmrkProperty::*,28};29use pallet_nonfungible::{Pallet as PalletNft, NonfungibleHandle};30use pallet_evm::account::CrossAccountId;31use weights::WeightInfo;3233pub use pallet::*;3435#[cfg(feature = "runtime-benchmarks")]36pub mod benchmarking;37pub mod weights;3839pub type SelfWeightOf<T> = <T as Config>::WeightInfo;4041#[frame_support::pallet]42pub mod pallet {43	use super::*;4445	#[pallet::config]46	pub trait Config: frame_system::Config + pallet_rmrk_core::Config {47		type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;48		type WeightInfo: WeightInfo;49	}5051	#[pallet::storage]52	#[pallet::getter(fn internal_part_id)]53	pub type InernalPartId<T: Config> =54		StorageDoubleMap<_, Twox64Concat, CollectionId, Twox64Concat, RmrkPartId, TokenId>;5556	#[pallet::storage]57	#[pallet::getter(fn base_has_default_theme)]58	pub type BaseHasDefaultTheme<T: Config> =59		StorageMap<_, Twox64Concat, CollectionId, bool, ValueQuery>;6061	#[pallet::pallet]62	#[pallet::generate_store(pub(super) trait Store)]63	pub struct Pallet<T>(_);6465	#[pallet::event]66	#[pallet::generate_deposit(pub(super) fn deposit_event)]67	pub enum Event<T: Config> {68		BaseCreated {69			issuer: T::AccountId,70			base_id: RmrkBaseId,71		},72	}7374	#[pallet::error]75	pub enum Error<T> {76		PermissionError,77		NoAvailableBaseId,78		NoAvailablePartId,79		BaseDoesntExist,80		NeedsDefaultThemeFirst,81	}8283	#[pallet::call]84	impl<T: Config> Pallet<T> {85		/// Creates a new Base.86		/// Modeled after [base interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/base.md)87		///88		/// Parameters:89		/// - origin: Caller, will be assigned as the issuer of the Base90		/// - base_type: media type, e.g. "svg"91		/// - symbol: arbitrary client-chosen symbol92		/// - parts: array of Fixed and Slot parts composing the base, confined in length by93		///   RmrkPartsLimit94		#[transactional]95		#[pallet::weight(<SelfWeightOf<T>>::create_base(parts.len() as u32))]96		pub fn create_base(97			origin: OriginFor<T>,98			base_type: RmrkString,99			symbol: RmrkBaseSymbol,100			parts: BoundedVec<RmrkPartType, RmrkPartsLimit>,101		) -> DispatchResult {102			let sender = ensure_signed(origin)?;103			let cross_sender = T::CrossAccountId::from_sub(sender.clone());104105			let data = CreateCollectionData {106				limits: None,107				token_prefix: symbol108					.into_inner()109					.try_into()110					.map_err(|_| <CommonError<T>>::CollectionTokenPrefixLimitExceeded)?,111				..Default::default()112			};113114			let collection_id_res =115				<PalletNft<T>>::init_collection(cross_sender.clone(), data, true);116117			if let Err(DispatchError::Arithmetic(_)) = &collection_id_res {118				return Err(<Error<T>>::NoAvailableBaseId.into());119			}120121			let collection_id = collection_id_res?;122123			<PalletCommon<T>>::set_scoped_collection_properties(124				collection_id,125				PropertyScope::Rmrk,126				[127					<PalletCore<T>>::rmrk_property(CollectionType, &misc::CollectionType::Base)?,128					<PalletCore<T>>::rmrk_property(BaseType, &base_type)?,129				]130				.into_iter(),131			)?;132133			let collection = <PalletCore<T>>::get_nft_collection(collection_id)?;134135			for part in parts {136				let part_id = part.id();137				let part_token_id = Self::create_part(&cross_sender, &collection, part)?;138139				<InernalPartId<T>>::insert(collection_id, part_id, part_token_id);140141				<PalletNft<T>>::set_scoped_token_property(142					collection_id,143					part_token_id,144					PropertyScope::Rmrk,145					<PalletCore<T>>::rmrk_property(ExternalPartId, &part_id)?,146				)?;147			}148149			Self::deposit_event(Event::BaseCreated {150				issuer: sender,151				base_id: collection_id.0,152			});153154			Ok(())155		}156157		/// Adds a Theme to a Base.158		/// Modeled after [themeadd interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/themeadd.md)159		/// Themes are stored in the Themes storage160		/// A Theme named "default" is required prior to adding other Themes.161		///162		/// Parameters:163		/// - origin: The caller of the function, must be issuer of the base164		/// - base_id: The Base containing the Theme to be updated165		/// - theme: The Theme to add to the Base.  A Theme has a name and properties, which are an166		///   array of [key, value, inherit].167		///   - key: arbitrary BoundedString, defined by client168		///   - value: arbitrary BoundedString, defined by client169		///   - inherit: optional bool170		#[transactional]171		#[pallet::weight(<SelfWeightOf<T>>::theme_add(theme.properties.len() as u32))]172		pub fn theme_add(173			origin: OriginFor<T>,174			base_id: RmrkBaseId,175			theme: RmrkBoundedTheme,176		) -> DispatchResult {177			let sender = ensure_signed(origin)?;178179			let sender = T::CrossAccountId::from_sub(sender);180			let owner = &sender;181182			let collection_id: CollectionId = base_id.into();183184			let collection = <PalletCore<T>>::get_typed_nft_collection(185				collection_id,186				misc::CollectionType::Base,187			)188			.map_err(|_| <Error<T>>::BaseDoesntExist)?;189			collection.check_is_external()?;190191			if theme.name.as_slice() == b"default" {192				<BaseHasDefaultTheme<T>>::insert(collection_id, true);193			} else if !Self::base_has_default_theme(collection_id) {194				return Err(<Error<T>>::NeedsDefaultThemeFirst.into());195			}196197			let token_id = <PalletCore<T>>::create_nft(198				&sender,199				owner,200				&collection,201				[202					<PalletCore<T>>::rmrk_property(TokenType, &NftType::Theme)?,203					<PalletCore<T>>::rmrk_property(ThemeName, &theme.name)?,204					<PalletCore<T>>::rmrk_property(ThemeInherit, &theme.inherit)?,205				]206				.into_iter(),207			)208			.map_err(|_| <Error<T>>::PermissionError)?;209210			for property in theme.properties {211				<PalletNft<T>>::set_scoped_token_property(212					collection_id,213					token_id,214					PropertyScope::Rmrk,215					<PalletCore<T>>::rmrk_property(216						UserProperty(property.key.as_slice()),217						&property.value,218					)?,219				)?;220			}221222			Ok(())223		}224	}225}226227impl<T: Config> Pallet<T> {228	fn create_part(229		sender: &T::CrossAccountId,230		collection: &NonfungibleHandle<T>,231		part: RmrkPartType,232	) -> Result<TokenId, DispatchError> {233		let owner = sender;234235		let src = part.src();236		let z_index = part.z_index();237238		let nft_type = match part {239			RmrkPartType::FixedPart(_) => NftType::FixedPart,240			RmrkPartType::SlotPart(_) => NftType::SlotPart,241		};242243		let token_id = <PalletCore<T>>::create_nft(244			sender,245			owner,246			collection,247			[248				<PalletCore<T>>::rmrk_property(TokenType, &nft_type)?,249				<PalletCore<T>>::rmrk_property(Src, &src)?,250				<PalletCore<T>>::rmrk_property(ZIndex, &z_index)?,251			]252			.into_iter(),253		)254		.map_err(|err| match err {255			DispatchError::Arithmetic(_) => <Error<T>>::NoAvailablePartId.into(),256			err => err,257		})?;258259		if let RmrkPartType::SlotPart(part) = part {260			<PalletNft<T>>::set_scoped_token_property(261				collection.id,262				token_id,263				PropertyScope::Rmrk,264				<PalletCore<T>>::rmrk_property(EquippableList, &part.equippable)?,265			)?;266		}267268		Ok(token_id)269	}270}
addedpallets/proxy-rmrk-equip/src/rpc.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/proxy-rmrk-equip/src/rpc.rs
@@ -0,0 +1,186 @@
+use super::*;
+use pallet_rmrk_core::{misc, property::*};
+use sp_std::vec::Vec;
+
+pub fn base<T: Config>(
+	base_id: RmrkBaseId,
+) -> Result<Option<RmrkBaseInfo<T::AccountId>>, DispatchError> {
+	let (collection, collection_id) =
+		match <PalletCore<T>>::get_typed_nft_collection_mapped(base_id, misc::CollectionType::Base)
+		{
+			Ok(c) => c,
+			Err(_) => return Ok(None),
+		};
+
+	Ok(Some(RmrkBaseInfo {
+		issuer: collection.owner.clone(),
+		base_type: <PalletCore<T>>::get_collection_property_decoded(
+			collection_id,
+			RmrkProperty::BaseType,
+		)?,
+		symbol: <PalletCore<T>>::rebind(&collection.token_prefix)?,
+	}))
+}
+
+pub fn base_parts<T: Config>(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {
+	use pallet_common::CommonCollectionOperations;
+
+	let (collection, collection_id) =
+		match <PalletCore<T>>::get_typed_nft_collection_mapped(base_id, misc::CollectionType::Base)
+		{
+			Ok(c) => c,
+			Err(_) => return Ok(Vec::new()),
+		};
+
+	let parts = collection
+		.collection_tokens()
+		.into_iter()
+		.filter_map(|token_id| {
+			let nft_type = <PalletCore<T>>::get_nft_type(collection_id, token_id).ok()?;
+
+			match nft_type {
+				NftType::FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {
+					id: <PalletCore<T>>::get_nft_property_decoded(
+						collection_id,
+						token_id,
+						RmrkProperty::ExternalPartId,
+					)
+					.ok()?,
+					src: <PalletCore<T>>::get_nft_property_decoded(
+						collection_id,
+						token_id,
+						RmrkProperty::Src,
+					)
+					.ok()?,
+					z: <PalletCore<T>>::get_nft_property_decoded(
+						collection_id,
+						token_id,
+						RmrkProperty::ZIndex,
+					)
+					.ok()?,
+				})),
+				NftType::SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {
+					id: <PalletCore<T>>::get_nft_property_decoded(
+						collection_id,
+						token_id,
+						RmrkProperty::ExternalPartId,
+					)
+					.ok()?,
+					src: <PalletCore<T>>::get_nft_property_decoded(
+						collection_id,
+						token_id,
+						RmrkProperty::Src,
+					)
+					.ok()?,
+					z: <PalletCore<T>>::get_nft_property_decoded(
+						collection_id,
+						token_id,
+						RmrkProperty::ZIndex,
+					)
+					.ok()?,
+					equippable: <PalletCore<T>>::get_nft_property_decoded(
+						collection_id,
+						token_id,
+						RmrkProperty::EquippableList,
+					)
+					.ok()?,
+				})),
+				_ => None,
+			}
+		})
+		.collect();
+
+	Ok(parts)
+}
+
+pub fn theme_names<T: Config>(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {
+	use pallet_common::CommonCollectionOperations;
+
+	let (collection, collection_id) =
+		match <PalletCore<T>>::get_typed_nft_collection_mapped(base_id, misc::CollectionType::Base)
+		{
+			Ok(c) => c,
+			Err(_) => return Ok(Vec::new()),
+		};
+
+	let theme_names = collection
+		.collection_tokens()
+		.iter()
+		.filter_map(|token_id| {
+			let nft_type = <PalletCore<T>>::get_nft_type(collection_id, *token_id).ok()?;
+
+			match nft_type {
+				NftType::Theme => <PalletCore<T>>::get_nft_property_decoded(
+					collection_id,
+					*token_id,
+					RmrkProperty::ThemeName,
+				)
+				.ok(),
+				_ => None,
+			}
+		})
+		.collect();
+
+	Ok(theme_names)
+}
+
+pub fn theme<T: Config>(
+	base_id: RmrkBaseId,
+	theme_name: RmrkThemeName,
+	filter_keys: Option<Vec<RmrkPropertyKey>>,
+) -> Result<Option<RmrkTheme>, DispatchError> {
+	use pallet_common::CommonCollectionOperations;
+
+	let (collection, collection_id) =
+		match <PalletCore<T>>::get_typed_nft_collection_mapped(base_id, misc::CollectionType::Base)
+		{
+			Ok(c) => c,
+			Err(_) => return Ok(None),
+		};
+
+	let theme_info = collection
+		.collection_tokens()
+		.into_iter()
+		.find_map(|token_id| {
+			<PalletCore<T>>::ensure_nft_type(collection_id, token_id, NftType::Theme).ok()?;
+
+			let name: RmrkString = <PalletCore<T>>::get_nft_property_decoded(
+				collection_id,
+				token_id,
+				RmrkProperty::ThemeName,
+			)
+			.ok()?;
+
+			if name == theme_name {
+				Some((name, token_id))
+			} else {
+				None
+			}
+		});
+
+	let (name, theme_id) = match theme_info {
+		Some((name, theme_id)) => (name, theme_id),
+		None => return Ok(None),
+	};
+
+	let properties = <PalletCore<T>>::filter_user_properties(
+		collection_id,
+		Some(theme_id),
+		filter_keys,
+		|key, value| RmrkThemeProperty { key, value },
+	)?;
+
+	let inherit = <PalletCore<T>>::get_nft_property_decoded(
+		collection_id,
+		theme_id,
+		RmrkProperty::ThemeInherit,
+	)?;
+
+	let theme = RmrkTheme {
+		name,
+		properties,
+		inherit,
+	};
+
+	Ok(Some(theme))
+}
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -74,9 +74,8 @@
 	CollectionStats, RpcCollection,
 	mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping},
 	TokenChild, RmrkCollectionInfo, RmrkInstanceInfo, RmrkResourceInfo, RmrkPropertyInfo,
-	RmrkBaseInfo, RmrkPartType, RmrkTheme, RmrkThemeName, RmrkThemeProperty, RmrkCollectionId,
-	RmrkNftId, RmrkAccountIdOrCollectionNftTuple, RmrkNftChild, RmrkPropertyKey, RmrkResourceId,
-	RmrkBaseId, RmrkFixedPart, RmrkSlotPart, RmrkString,
+	RmrkBaseInfo, RmrkPartType, RmrkTheme, RmrkThemeName, RmrkCollectionId, RmrkNftId,
+	RmrkNftChild, RmrkPropertyKey, RmrkResourceId, RmrkBaseId,
 };
 
 // use pallet_contracts::weights::WeightInfo;
@@ -1330,352 +1329,55 @@
 		RmrkTheme
 	> for Runtime {
 		fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {
-			Ok(RmrkCore::last_collection_idx())
+			pallet_proxy_rmrk_core::rpc::last_collection_idx::<Runtime>()
 		}
 
 		fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::CollectionType};
-			use pallet_common::CommonCollectionOperations;
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(collection_id, CollectionType::Regular) {
-				Ok(c) => c,
-				Err(_) => return Ok(None),
-			};
-
-			let nfts_count = collection.total_supply();
-
-			Ok(Some(RmrkCollectionInfo {
-				issuer: collection.owner.clone(),
-				metadata: RmrkCore::get_collection_property_decoded(collection_id, RmrkProperty::Metadata)?,
-				max: collection.limits.token_limit,
-				symbol: RmrkCore::rebind(&collection.token_prefix)?,
-				nfts_count
-			}))
+			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> {
-			use up_data_structs::mapping::TokenAddressMapping;
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::CollectionType};
-			use pallet_common::CommonCollectionOperations;
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(collection_id, CollectionType::Regular) {
-				Ok(c) => c,
-				Err(_) => return Ok(None),
-			};
-
-			let nft_id = TokenId(nft_by_id);
-			if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(None); }
-
-			let owner = match collection.token_owner(nft_id) {
-				Some(owner) => match <Runtime as pallet_common::Config>::CrossTokenAddressMapping::address_to_token(&owner) {
-					Some((col, tok)) => {
-						let rmrk_collection = RmrkCore::rmrk_collection_id(col)?;
-
-						RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(rmrk_collection, tok.0)
-					}
-					None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone())
-				},
-				None => return Ok(None)
-			};
-
-			Ok(Some(RmrkInstanceInfo {
-				owner: owner,
-				royalty: RmrkCore::get_nft_property_decoded(collection_id, nft_id, RmrkProperty::RoyaltyInfo)?,
-				metadata: RmrkCore::get_nft_property_decoded(collection_id, nft_id, RmrkProperty::Metadata)?,
-				equipped: RmrkCore::get_nft_property_decoded(collection_id, nft_id, RmrkProperty::Equipped)?,
-				pending: RmrkCore::get_nft_property_decoded(collection_id, nft_id, RmrkProperty::PendingNftAccept)?,
-			}))
+			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> {
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::CollectionType};
-			use pallet_common::CommonCollectionOperations;
-
-			let cross_account_id = CrossAccountId::from_sub(account_id);
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(collection_id, CollectionType::Regular) {
-				Ok(c) => c,
-				Err(_) => return Ok(Vec::new()),
-			};
-
-			let tokens = collection.account_tokens(cross_account_id)
-				.into_iter()
-				.filter(|token| {
-					let is_pending = RmrkCore::get_nft_property_decoded(
-						collection_id,
-						*token,
-						RmrkProperty::PendingNftAccept
-					).unwrap_or(true);
-
-					!is_pending
-				})
-				.map(|token| token.0)
-				.collect();
-
-			Ok(tokens)
+			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> {
-			use pallet_proxy_rmrk_core::RmrkProperty;
-
-			let collection_id = match RmrkCore::unique_collection_id(collection_id) {
-				Ok(id) => id,
-				Err(_) => return Ok(Vec::new())
-			};
-			let nft_id = TokenId(nft_id);
-			if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(Vec::new()); }
-
-			Ok(
-				pallet_nonfungible::TokenChildren::<Runtime>::iter_prefix((collection_id, nft_id))
-					.filter_map(|((child_collection, child_token), _)| {
-						let is_pending = RmrkCore::get_nft_property_decoded(
-							child_collection,
-							child_token,
-							RmrkProperty::PendingNftAccept
-						).ok()?;
-
-						if is_pending {
-							return None;
-						}
-
-						let rmrk_child_collection = RmrkCore::rmrk_collection_id(
-							child_collection
-						).ok()?;
-
-						Some(RmrkNftChild {
-							collection_id: rmrk_child_collection,
-							nft_id: child_token.0,
-						})
-					}).collect()
-			)
+			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> {
-			use pallet_proxy_rmrk_core::misc::CollectionType;
-
-			let collection_id = match RmrkCore::unique_collection_id(collection_id) {
-				Ok(id) => id,
-				Err(_) => return Ok(Vec::new())
-			};
-			if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() {
-				return Ok(Vec::new());
-			}
-
-			let properties = RmrkCore::filter_user_properties(
-				collection_id,
-				/* token_id = */ None,
-				filter_keys,
-				|key, value| RmrkPropertyInfo {
-					key,
-					value
-				}
-			)?;
-
-			Ok(properties)
+			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> {
-			use pallet_proxy_rmrk_core::misc::NftType;
-
-			let collection_id = match RmrkCore::unique_collection_id(collection_id) {
-				Ok(id) => id,
-				Err(_) => return Ok(Vec::new())
-			};
-			let token_id = TokenId(nft_id);
-
-			if RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {
-				return Ok(Vec::new());
-			}
-
-			let properties = RmrkCore::filter_user_properties(
-				collection_id,
-				Some(token_id),
-				filter_keys,
-				|key, value| RmrkPropertyInfo {
-					key,
-					value
-				}
-			)?;
-
-			Ok(properties)
+			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> {
-			use pallet_proxy_rmrk_core::misc::{CollectionType, NftType};
-			use up_data_structs::PropertyScope;
-
-			let collection_id = match RmrkCore::unique_collection_id(collection_id) {
-				Ok(id) => id,
-				Err(_) => return Ok(Vec::new())
-			};
-			if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() { return Ok(Vec::new()); }
-
-			let nft_id = TokenId(nft_id);
-			if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Regular).is_err() { return Ok(Vec::new()); }
-
-			let resources = <pallet_nonfungible::Pallet<Runtime>>::iterate_token_aux_properties(
-				collection_id, nft_id, PropertyScope::Rmrk
-			).filter_map(|(_, value)| {
-				let resource_info: RmrkResourceInfo = RmrkCore::decode_property(&value).ok()?;
-
-				Some(resource_info)
-			}).collect();
-
-			Ok(resources)
+			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> {
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType}};
-
-			let collection_id = match RmrkCore::unique_collection_id(collection_id) {
-				Ok(id) => id,
-				Err(_) => return Ok(None)
-			};
-			if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() { return Ok(None); }
-
-			let nft_id = TokenId(nft_id);
-			if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Regular).is_err() { return Ok(None); }
-
-			let priorities: Vec<_> = RmrkCore::get_nft_property_decoded(collection_id, nft_id, RmrkProperty::ResourcePriorities)?;
-			Ok(
-				priorities.into_iter()
-					.enumerate()
-					.find(|(_, id)| *id == resource_id)
-					.map(|(priority, _): (usize, RmrkResourceId)| priority as u32)
-			)
+			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> {
-			use pallet_proxy_rmrk_core::{
-				RmrkProperty, misc::{CollectionType},
-			};
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(base_id, CollectionType::Base) {
-				Ok(c) => c,
-				Err(_) => return Ok(None),
-			};
-
-			Ok(Some(RmrkBaseInfo {
-				issuer: collection.owner.clone(),
-				base_type: RmrkCore::get_collection_property_decoded(collection_id, RmrkProperty::BaseType)?,
-				symbol: RmrkCore::rebind(&collection.token_prefix)?,
-			}))
+			pallet_proxy_rmrk_equip::rpc::base::<Runtime>(base_id)
 		}
 
 		fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType}};
-			use pallet_common::CommonCollectionOperations;
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(base_id, CollectionType::Base) {
-				Ok(c) => c,
-				Err(_) => return Ok(Vec::new()),
-			};
-
-			let parts = collection.collection_tokens()
-				.into_iter()
-				.filter_map(|token_id| {
-					let nft_type = RmrkCore::get_nft_type(collection_id, token_id).ok()?;
-
-					match nft_type {
-						NftType::FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {
-							id: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?,
-							src: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::Src).ok()?,
-							z: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::ZIndex).ok()?,
-						})),
-						NftType::SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {
-							id: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?,
-							src: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::Src).ok()?,
-							z: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::ZIndex).ok()?,
-							equippable: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::EquippableList).ok()?,
-						})),
-						_ => None
-					}
-				})
-				.collect();
-
-			Ok(parts)
+			pallet_proxy_rmrk_equip::rpc::base_parts::<Runtime>(base_id)
 		}
 
 		fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::{NftType, CollectionType}};
-			use pallet_common::CommonCollectionOperations;
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(base_id, CollectionType::Base) {
-				Ok(c) => c,
-				Err(_) => return Ok(Vec::new()),
-			};
-
-			let theme_names = collection.collection_tokens()
-				.iter()
-				.filter_map(|token_id| {
-					let nft_type = RmrkCore::get_nft_type(collection_id, *token_id).ok()?;
-
-					match nft_type {
-						NftType::Theme => RmrkCore::get_nft_property_decoded(collection_id, *token_id, RmrkProperty::ThemeName).ok(),
-						_ => None
-					}
-				})
-				.collect();
-
-			Ok(theme_names)
+			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> {
-			use pallet_proxy_rmrk_core::{
-				RmrkProperty,
-				misc::{CollectionType, NftType}
-			};
-			use pallet_common::CommonCollectionOperations;
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(base_id, CollectionType::Base) {
-				Ok(c) => c,
-				Err(_) => return Ok(None),
-			};
-
-			let theme_info = collection.collection_tokens()
-				.into_iter()
-				.find_map(|token_id| {
-					RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Theme).ok()?;
-
-					let name: RmrkString = RmrkCore::get_nft_property_decoded(
-						collection_id, token_id, RmrkProperty::ThemeName
-					).ok()?;
-
-					if name == theme_name {
-						Some((name, token_id))
-					} else {
-						None
-					}
-				});
-
-			let (name, theme_id) = match theme_info {
-				Some((name, theme_id)) => (name, theme_id),
-				None => return Ok(None)
-			};
-
-			let properties = RmrkCore::filter_user_properties(
-				collection_id,
-				Some(theme_id),
-				filter_keys,
-				|key, value| RmrkThemeProperty {
-					key,
-					value
-				}
-			)?;
-
-			let inherit = RmrkCore::get_nft_property_decoded(
-				collection_id,
-				theme_id,
-				RmrkProperty::ThemeInherit
-			)?;
-
-			let theme = RmrkTheme {
-				name,
-				properties,
-				inherit,
-			};
-
-			Ok(Some(theme))
+			pallet_proxy_rmrk_equip::rpc::theme::<Runtime>(base_id, theme_name, filter_keys)
 		}
 	}
 }
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -74,9 +74,8 @@
 	CollectionStats, RpcCollection,
 	mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping},
 	TokenChild, RmrkCollectionInfo, RmrkInstanceInfo, RmrkResourceInfo, RmrkPropertyInfo,
-	RmrkBaseInfo, RmrkPartType, RmrkTheme, RmrkThemeName, RmrkThemeProperty, RmrkCollectionId,
-	RmrkNftId, RmrkAccountIdOrCollectionNftTuple, RmrkNftChild, RmrkPropertyKey, RmrkResourceId,
-	RmrkBaseId, RmrkFixedPart, RmrkSlotPart, RmrkString,
+	RmrkBaseInfo, RmrkPartType, RmrkTheme, RmrkThemeName, RmrkCollectionId, RmrkNftId,
+	RmrkNftChild, RmrkPropertyKey, RmrkResourceId, RmrkBaseId,
 };
 
 // use pallet_contracts::weights::WeightInfo;
@@ -1330,352 +1329,55 @@
 		RmrkTheme
 	> for Runtime {
 		fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {
-			Ok(RmrkCore::last_collection_idx())
+			pallet_proxy_rmrk_core::rpc::last_collection_idx::<Runtime>()
 		}
 
 		fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::CollectionType};
-			use pallet_common::CommonCollectionOperations;
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(collection_id, CollectionType::Regular) {
-				Ok(c) => c,
-				Err(_) => return Ok(None),
-			};
-
-			let nfts_count = collection.total_supply();
-
-			Ok(Some(RmrkCollectionInfo {
-				issuer: collection.owner.clone(),
-				metadata: RmrkCore::get_collection_property_decoded(collection_id, RmrkProperty::Metadata)?,
-				max: collection.limits.token_limit,
-				symbol: RmrkCore::rebind(&collection.token_prefix)?,
-				nfts_count
-			}))
+			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> {
-			use up_data_structs::mapping::TokenAddressMapping;
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::CollectionType};
-			use pallet_common::CommonCollectionOperations;
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(collection_id, CollectionType::Regular) {
-				Ok(c) => c,
-				Err(_) => return Ok(None),
-			};
-
-			let nft_id = TokenId(nft_by_id);
-			if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(None); }
-
-			let owner = match collection.token_owner(nft_id) {
-				Some(owner) => match <Runtime as pallet_common::Config>::CrossTokenAddressMapping::address_to_token(&owner) {
-					Some((col, tok)) => {
-						let rmrk_collection = RmrkCore::rmrk_collection_id(col)?;
-
-						RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(rmrk_collection, tok.0)
-					}
-					None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone())
-				},
-				None => return Ok(None)
-			};
-
-			Ok(Some(RmrkInstanceInfo {
-				owner: owner,
-				royalty: RmrkCore::get_nft_property_decoded(collection_id, nft_id, RmrkProperty::RoyaltyInfo)?,
-				metadata: RmrkCore::get_nft_property_decoded(collection_id, nft_id, RmrkProperty::Metadata)?,
-				equipped: RmrkCore::get_nft_property_decoded(collection_id, nft_id, RmrkProperty::Equipped)?,
-				pending: RmrkCore::get_nft_property_decoded(collection_id, nft_id, RmrkProperty::PendingNftAccept)?,
-			}))
+			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> {
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::CollectionType};
-			use pallet_common::CommonCollectionOperations;
-
-			let cross_account_id = CrossAccountId::from_sub(account_id);
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(collection_id, CollectionType::Regular) {
-				Ok(c) => c,
-				Err(_) => return Ok(Vec::new()),
-			};
-
-			let tokens = collection.account_tokens(cross_account_id)
-				.into_iter()
-				.filter(|token| {
-					let is_pending = RmrkCore::get_nft_property_decoded(
-						collection_id,
-						*token,
-						RmrkProperty::PendingNftAccept
-					).unwrap_or(true);
-
-					!is_pending
-				})
-				.map(|token| token.0)
-				.collect();
-
-			Ok(tokens)
+			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> {
-			use pallet_proxy_rmrk_core::RmrkProperty;
-
-			let collection_id = match RmrkCore::unique_collection_id(collection_id) {
-				Ok(id) => id,
-				Err(_) => return Ok(Vec::new())
-			};
-			let nft_id = TokenId(nft_id);
-			if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(Vec::new()); }
-
-			Ok(
-				pallet_nonfungible::TokenChildren::<Runtime>::iter_prefix((collection_id, nft_id))
-					.filter_map(|((child_collection, child_token), _)| {
-						let is_pending = RmrkCore::get_nft_property_decoded(
-							child_collection,
-							child_token,
-							RmrkProperty::PendingNftAccept
-						).ok()?;
-
-						if is_pending {
-							return None;
-						}
-
-						let rmrk_child_collection = RmrkCore::rmrk_collection_id(
-							child_collection
-						).ok()?;
-
-						Some(RmrkNftChild {
-							collection_id: rmrk_child_collection,
-							nft_id: child_token.0,
-						})
-					}).collect()
-			)
+			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> {
-			use pallet_proxy_rmrk_core::misc::CollectionType;
-
-			let collection_id = match RmrkCore::unique_collection_id(collection_id) {
-				Ok(id) => id,
-				Err(_) => return Ok(Vec::new())
-			};
-			if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() {
-				return Ok(Vec::new());
-			}
-
-			let properties = RmrkCore::filter_user_properties(
-				collection_id,
-				/* token_id = */ None,
-				filter_keys,
-				|key, value| RmrkPropertyInfo {
-					key,
-					value
-				}
-			)?;
-
-			Ok(properties)
+			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> {
-			use pallet_proxy_rmrk_core::misc::NftType;
-
-			let collection_id = match RmrkCore::unique_collection_id(collection_id) {
-				Ok(id) => id,
-				Err(_) => return Ok(Vec::new())
-			};
-			let token_id = TokenId(nft_id);
-
-			if RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {
-				return Ok(Vec::new());
-			}
-
-			let properties = RmrkCore::filter_user_properties(
-				collection_id,
-				Some(token_id),
-				filter_keys,
-				|key, value| RmrkPropertyInfo {
-					key,
-					value
-				}
-			)?;
-
-			Ok(properties)
+			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> {
-			use pallet_proxy_rmrk_core::misc::{CollectionType, NftType};
-			use up_data_structs::PropertyScope;
-
-			let collection_id = match RmrkCore::unique_collection_id(collection_id) {
-				Ok(id) => id,
-				Err(_) => return Ok(Vec::new())
-			};
-			if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() { return Ok(Vec::new()); }
-
-			let nft_id = TokenId(nft_id);
-			if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Regular).is_err() { return Ok(Vec::new()); }
-
-			let resources = <pallet_nonfungible::Pallet<Runtime>>::iterate_token_aux_properties(
-				collection_id, nft_id, PropertyScope::Rmrk
-			).filter_map(|(_, value)| {
-				let resource_info: RmrkResourceInfo = RmrkCore::decode_property(&value).ok()?;
-
-				Some(resource_info)
-			}).collect();
-
-			Ok(resources)
+			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> {
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType}};
-
-			let collection_id = match RmrkCore::unique_collection_id(collection_id) {
-				Ok(id) => id,
-				Err(_) => return Ok(None)
-			};
-			if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() { return Ok(None); }
-
-			let nft_id = TokenId(nft_id);
-			if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Regular).is_err() { return Ok(None); }
-
-			let priorities: Vec<_> = RmrkCore::get_nft_property_decoded(collection_id, nft_id, RmrkProperty::ResourcePriorities)?;
-			Ok(
-				priorities.into_iter()
-					.enumerate()
-					.find(|(_, id)| *id == resource_id)
-					.map(|(priority, _): (usize, RmrkResourceId)| priority as u32)
-			)
+			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> {
-			use pallet_proxy_rmrk_core::{
-				RmrkProperty, misc::{CollectionType},
-			};
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(base_id, CollectionType::Base) {
-				Ok(c) => c,
-				Err(_) => return Ok(None),
-			};
-
-			Ok(Some(RmrkBaseInfo {
-				issuer: collection.owner.clone(),
-				base_type: RmrkCore::get_collection_property_decoded(collection_id, RmrkProperty::BaseType)?,
-				symbol: RmrkCore::rebind(&collection.token_prefix)?,
-			}))
+			pallet_proxy_rmrk_equip::rpc::base::<Runtime>(base_id)
 		}
 
 		fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType}};
-			use pallet_common::CommonCollectionOperations;
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(base_id, CollectionType::Base) {
-				Ok(c) => c,
-				Err(_) => return Ok(Vec::new()),
-			};
-
-			let parts = collection.collection_tokens()
-				.into_iter()
-				.filter_map(|token_id| {
-					let nft_type = RmrkCore::get_nft_type(collection_id, token_id).ok()?;
-
-					match nft_type {
-						NftType::FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {
-							id: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?,
-							src: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::Src).ok()?,
-							z: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::ZIndex).ok()?,
-						})),
-						NftType::SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {
-							id: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?,
-							src: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::Src).ok()?,
-							z: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::ZIndex).ok()?,
-							equippable: RmrkCore::get_nft_property_decoded(collection_id, token_id, RmrkProperty::EquippableList).ok()?,
-						})),
-						_ => None
-					}
-				})
-				.collect();
-
-			Ok(parts)
+			pallet_proxy_rmrk_equip::rpc::base_parts::<Runtime>(base_id)
 		}
 
 		fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {
-			use pallet_proxy_rmrk_core::{RmrkProperty, misc::{NftType, CollectionType}};
-			use pallet_common::CommonCollectionOperations;
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(base_id, CollectionType::Base) {
-				Ok(c) => c,
-				Err(_) => return Ok(Vec::new()),
-			};
-
-			let theme_names = collection.collection_tokens()
-				.iter()
-				.filter_map(|token_id| {
-					let nft_type = RmrkCore::get_nft_type(collection_id, *token_id).ok()?;
-
-					match nft_type {
-						NftType::Theme => RmrkCore::get_nft_property_decoded(collection_id, *token_id, RmrkProperty::ThemeName).ok(),
-						_ => None
-					}
-				})
-				.collect();
-
-			Ok(theme_names)
+			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> {
-			use pallet_proxy_rmrk_core::{
-				RmrkProperty,
-				misc::{CollectionType, NftType}
-			};
-			use pallet_common::CommonCollectionOperations;
-
-			let (collection, collection_id) = match RmrkCore::get_typed_nft_collection_mapped(base_id, CollectionType::Base) {
-				Ok(c) => c,
-				Err(_) => return Ok(None),
-			};
-
-			let theme_info = collection.collection_tokens()
-				.into_iter()
-				.find_map(|token_id| {
-					RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Theme).ok()?;
-
-					let name: RmrkString = RmrkCore::get_nft_property_decoded(
-						collection_id, token_id, RmrkProperty::ThemeName
-					).ok()?;
-
-					if name == theme_name {
-						Some((name, token_id))
-					} else {
-						None
-					}
-				});
-
-			let (name, theme_id) = match theme_info {
-				Some((name, theme_id)) => (name, theme_id),
-				None => return Ok(None)
-			};
-
-			let properties = RmrkCore::filter_user_properties(
-				collection_id,
-				Some(theme_id),
-				filter_keys,
-				|key, value| RmrkThemeProperty {
-					key,
-					value
-				}
-			)?;
-
-			let inherit = RmrkCore::get_nft_property_decoded(
-				collection_id,
-				theme_id,
-				RmrkProperty::ThemeInherit
-			)?;
-
-			let theme = RmrkTheme {
-				name,
-				properties,
-				inherit,
-			};
-
-			Ok(Some(theme))
+			pallet_proxy_rmrk_equip::rpc::theme::<Runtime>(base_id, theme_name, filter_keys)
 		}
 	}
 }