git.delta.rocks / unique-network / refs/commits / 4186437dc1bc

difftreelog

feat add rmrk proxy create_base

Daniel Shiposha2022-05-25parent: #e8a3a23.patch.diff
in: master

12 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5513,6 +5513,7 @@
  "pallet-randomness-collective-flip",
  "pallet-refungible",
  "pallet-rmrk-core",
+ "pallet-rmrk-equip",
  "pallet-structure",
  "pallet-sudo",
  "pallet-template-transaction-payment",
@@ -6533,6 +6534,25 @@
 ]
 
 [[package]]
+name = "pallet-rmrk-equip"
+version = "0.1.0"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "pallet-common",
+ "pallet-evm",
+ "pallet-nonfungible",
+ "pallet-rmrk-core",
+ "parity-scale-codec 3.1.2",
+ "scale-info",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+ "up-data-structs",
+]
+
+[[package]]
 name = "pallet-scheduler"
 version = "4.0.0-dev"
 source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.21#563f4820d8f36d256ada7ea3fef46b2e94c4cd5a"
modifiedpallets/proxy-rmrk-core/Cargo.tomldiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/Cargo.toml
+++ b/pallets/proxy-rmrk-core/Cargo.toml
@@ -18,10 +18,7 @@
 sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
 pallet-common = { default-features = false, path = '../common' }
 pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
-# pallet-structure = { default-features = false, path = '../structure' }
 up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
-# evm-coder = { default-features = false, path = '../../crates/evm-coder' }
-# pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
 pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
 frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
 scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
@@ -37,9 +34,6 @@
     "pallet-common/std",
     "pallet-nonfungible/std",
     "pallet-evm/std",
-    # "pallet-structure/std",
-    # "evm-coder/std",
-    # "pallet-evm-coder-substrate/std",
     'frame-benchmarking/std',
 ]
 runtime-benchmarks = [
modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -254,8 +254,8 @@
             });
 
             let nft_id = Self::create_nft(
-                sender,
-                cross_owner,
+                &sender,
+                &cross_owner,
                 collection_id.into(),
                 CollectionType::Regular,
                 NftType::Regular,
@@ -302,9 +302,9 @@
 }
 
 impl<T: Config> Pallet<T> {
-    fn create_nft(
-        sender: T::CrossAccountId,
-        owner: T::CrossAccountId,
+    pub fn create_nft(
+        sender: &T::CrossAccountId,
+        owner: &T::CrossAccountId,
         collection_id: CollectionId,
         collection_type: CollectionType,
         nft_type: NftType,
@@ -320,14 +320,14 @@
                 .try_into()
                 .map_err(|_| <Error<T>>::NftTypeEncodeError)?,
             properties: BoundedVec::default(),
-            owner,
+            owner: owner.clone(),
         };
 
         let budget = budget::Value::new(2);
 
         <PalletNft<T>>::create_item(
             &collection,
-            &sender,
+            sender,
             data,
             &budget,
         ).map_err(Self::map_common_err_to_proxy)?;
modifiedpallets/proxy-rmrk-core/src/property.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/property.rs
+++ b/pallets/proxy-rmrk-core/src/property.rs
@@ -19,7 +19,7 @@
     Thumb,
     EquippedNft,
     BaseType,
-    // // RmrkPartId(/* Id type? */)
+    ExternalPartId,
     EquippableList,
     ZIndex,
     ThemeName,
@@ -62,8 +62,7 @@
             Self::Thumb => key!("thumb"),
             Self::EquippedNft => key!("equipped-nft"),
             Self::BaseType => key!("base-type"),
-            // RmrkResourceId(/* Id type? */)
-            // RmrkPartId(/* Id type? */)
+            Self::ExternalPartId => key!("ext-part-id"),
             Self::EquippableList => key!("equippable-list"),
             Self::ZIndex => key!("z-index"),
             Self::ThemeName => key!("theme-name"),
addedpallets/proxy-rmrk-equip/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/pallets/proxy-rmrk-equip/Cargo.toml
@@ -0,0 +1,45 @@
+[package]
+name = "pallet-rmrk-equip"
+version = "0.1.0"
+license = "GPLv3"
+edition = "2021"
+
+[dependencies.codec]
+default-features = false
+features = ['derive']
+package = 'parity-scale-codec'
+version = '3.1.2'
+
+[dependencies]
+frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
+frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
+sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
+sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
+sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
+pallet-common = { default-features = false, path = '../common' }
+pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
+up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
+frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.21" }
+scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }
+pallet-rmrk-core = { default-features = false, path = "../proxy-rmrk-core" }
+
+[features]
+default = ["std"]
+std = [
+    "frame-support/std",
+    "frame-system/std",
+    "sp-runtime/std",
+    "sp-std/std",
+    "up-data-structs/std",
+    "pallet-common/std",
+    "pallet-nonfungible/std",
+    "pallet-rmrk-core/std",
+    "pallet-evm/std",
+    'frame-benchmarking/std',
+]
+runtime-benchmarks = [
+    'frame-benchmarking',
+    'frame-support/runtime-benchmarks',
+    'frame-system/runtime-benchmarks',
+]
addedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/pallets/proxy-rmrk-equip/src/lib.rs
@@ -0,0 +1,173 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+use frame_support::{pallet_prelude::*, transactional, BoundedVec, dispatch::DispatchResult};
+use frame_system::{pallet_prelude::*, ensure_signed};
+use sp_runtime::DispatchError;
+use up_data_structs::*;
+use pallet_common::{Pallet as PalletCommon, Error as CommonError, CollectionHandle};
+use pallet_rmrk_core::{Pallet as PalletCore, rmrk_property, misc::*};
+use pallet_nonfungible::{Pallet as PalletNft};
+use pallet_evm::account::CrossAccountId;
+
+pub use pallet::*;
+
+#[frame_support::pallet]
+pub mod pallet {
+    use super::*;
+
+	#[pallet::config]
+	pub trait Config: frame_system::Config
+                    + pallet_rmrk_core::Config {
+		type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
+	}
+
+    #[pallet::storage]
+	#[pallet::getter(fn internal_part_id)]
+	pub type InernalPartId<T: Config> = StorageDoubleMap<
+        _,
+        Twox64Concat,
+        CollectionId,
+        Twox64Concat,
+        RmrkPartId,
+        TokenId
+    >;
+
+    #[pallet::pallet]
+	#[pallet::generate_store(pub(super) trait Store)]
+	pub struct Pallet<T>(_);
+
+	#[pallet::event]
+	#[pallet::generate_deposit(pub(super) fn deposit_event)]
+	pub enum Event<T: Config> {
+        BaseCreated {
+			issuer: T::AccountId,
+			base_id: RmrkBaseId,
+		},
+    }
+
+    #[pallet::error]
+	pub enum Error<T> {
+        NoAvailableBaseId,
+    }
+
+    #[pallet::call]
+	impl<T: Config> Pallet<T> {
+        #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
+        #[transactional]
+		pub fn create_base(
+			origin: OriginFor<T>,
+			base_type: RmrkString,
+			symbol: RmrkString,
+			parts: BoundedVec<RmrkPartType, RmrkPartsLimit>,
+		) -> DispatchResult {
+            let sender = ensure_signed(origin)?;
+            let cross_sender = T::CrossAccountId::from_sub(sender.clone());
+
+            let data = CreateCollectionData {
+                limits: None,
+                token_prefix: symbol.into_inner()
+                    .try_into()
+                    .map_err(|_| <CommonError<T>>::CollectionTokenPrefixLimitExceeded)?,
+                ..Default::default()
+            };
+
+            let collection_id_res = <PalletNft<T>>::init_collection(sender.clone(), data);
+
+            if let Err(DispatchError::Arithmetic(_)) = &collection_id_res {
+                return Err(<Error<T>>::NoAvailableBaseId.into());
+            }
+
+            let collection_id = collection_id_res?;
+
+            let collection = <PalletCore<T>>::get_nft_collection(collection_id)?.into_inner();
+
+            <PalletCommon<T>>::set_scoped_collection_properties(
+                &collection,
+                PropertyScope::Rmrk,
+                [
+                    rmrk_property!(Config=T, CollectionType: CollectionType::Base)?,
+                    rmrk_property!(Config=T, BaseType: base_type)?,
+                ].into_iter()
+            )?;
+
+            for part in parts {
+                let part_id = part.id();
+                let part_token_id = Self::create_part(
+                    &cross_sender,
+                    &collection,
+                    part
+                )?;
+
+                <InernalPartId<T>>::insert(collection_id, part_id, part_token_id);
+
+                <PalletNft<T>>::set_scoped_token_property(
+                    &collection,
+                    part_token_id,
+                    PropertyScope::Rmrk,
+                    rmrk_property!(Config=T, ExternalPartId: part_id)?
+                )?;
+            }
+
+            Self::deposit_event(Event::BaseCreated { issuer: sender, base_id: collection_id.0 });
+
+            Ok(())
+        }
+    }
+}
+
+impl<T: Config> Pallet<T> {
+    fn create_part(
+        sender: &T::CrossAccountId,
+        collection: &CollectionHandle<T>,
+        part: RmrkPartType
+    ) -> Result<TokenId, DispatchError> {
+        let owner = sender;
+
+        let src = part.src();
+        let z_index = part.z_index();
+
+        let nft_type = match part {
+            RmrkPartType::FixedPart(_) => NftType::FixedPart,
+            RmrkPartType::SlotPart(_) => NftType::SlotPart,
+        };
+
+        let token_id = <PalletCore<T>>::create_nft(
+            sender,
+            owner,
+            collection.id,
+            CollectionType::Base,
+            nft_type,
+            [
+                rmrk_property!(Config=T, Src: src)?,
+                rmrk_property!(Config=T, ZIndex: z_index)?
+            ].into_iter()
+        )?;
+
+        if let RmrkPartType::SlotPart(part) = part {
+            <PalletNft<T>>::set_scoped_token_property(
+                collection,
+                token_id,
+                PropertyScope::Rmrk,
+                rmrk_property!(Config=T, EquippableList: part.equippable)?
+            )?;
+        }
+
+        Ok(token_id)
+    }
+}
modifiedprimitives/data-structs/src/rmrk.rsdiffbeforeafterboth
before · primitives/data-structs/src/rmrk.rs
1use codec::{Decode, Encode, MaxEncodedLen};2use scale_info::TypeInfo;34use derivative::Derivative;56#[cfg(feature = "std")]7use serde::Serialize;89use primitives::*;1011pub mod primitives {12	pub type CollectionId = u32;13	pub type ResourceId = u32;14	pub type NftId = u32;15	pub type BaseId = u32;16	pub type SlotId = u32;17	pub type PartId = u32;18	pub type ZIndex = u32;19}2021#[cfg(feature = "std")]22mod serialize {23    use core::convert::AsRef;24    use serde::ser::{self, Serialize};2526    pub mod vec {27        use super::*;2829        pub fn serialize<D, V, C>(value: &C, serializer: D) -> Result<D::Ok, D::Error>30        where31            D: ser::Serializer,32            V: Serialize,33            C: AsRef<[V]>,34        {35            value.as_ref().serialize(serializer)36        }37    }3839    pub mod opt_vec {40        use super::*;4142        pub fn serialize<D, V, C>(value: &Option<C>, serializer: D) -> Result<D::Ok, D::Error>43        where44            D: ser::Serializer,45            V: Serialize,46            C: AsRef<[V]>,47        {48            match value {49                Some(value) => super::vec::serialize(value, serializer),50                None => serializer.serialize_none()51            }52        }53    }54}5556/// Collection info.57#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]58#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]59#[cfg_attr(60	feature = "std",61	serde(62		bound = r#"63			AccountId: Serialize,64			BoundedString: AsRef<[u8]>,65			BoundedSymbol: AsRef<[u8]>66		"#67	)68)]69pub struct CollectionInfo<BoundedString, BoundedSymbol, AccountId> {70	/// Current bidder and bid price.71	pub issuer: AccountId,7273	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]74	pub metadata: BoundedString,75	pub max: Option<u32>,7677	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]78	pub symbol: BoundedSymbol,79	pub nfts_count: u32,80}8182#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, Debug, TypeInfo, MaxEncodedLen)]83#[cfg_attr(feature = "std", derive(Serialize))]84pub enum AccountIdOrCollectionNftTuple<AccountId> {85	AccountId(AccountId),86	CollectionAndNftTuple(CollectionId, NftId),87}8889/// Royalty information (recipient and amount)90#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]91#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]92pub struct RoyaltyInfo<AccountId, RoyaltyAmount> {93	/// Recipient (AccountId) of the royalty94    pub recipient: AccountId,95	/// Amount (Permill) of the royalty96    pub amount: RoyaltyAmount,97}9899/// Nft info.100#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]101#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]102#[cfg_attr(103	feature = "std",104	serde(105		bound = r#"106			AccountId: Serialize,107			RoyaltyAmount: Serialize,108			BoundedString: AsRef<[u8]>109		"#110	)111)]112pub struct NftInfo<AccountId, RoyaltyAmount, BoundedString> {113	/// The owner of the NFT, can be either an Account or a tuple (CollectionId, NftId)114	pub owner: AccountIdOrCollectionNftTuple<AccountId>,115	/// Royalty (optional)116	pub royalty: Option<RoyaltyInfo<AccountId, RoyaltyAmount>>,117118	/// Arbitrary data about an instance, e.g. IPFS hash119	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]120	pub metadata: BoundedString,121122	/// Equipped state123	pub equipped: bool,124	/// Pending state (if sent to NFT)125	pub pending: bool,126}127128#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]129#[derive(Encode, Decode, TypeInfo, MaxEncodedLen)]130pub struct NftChild {131	pub collection_id: CollectionId,132	pub nft_id: NftId133}134135#[cfg_attr(feature = "std", derive(Serialize))]136#[derive(Encode, Decode, PartialEq, TypeInfo)]137#[cfg_attr(138	feature = "std",139	serde(140		bound = r#"141			BoundedKey: AsRef<[u8]>,142			BoundedValue: AsRef<[u8]>143		"#144	)145)]146pub struct PropertyInfo<BoundedKey, BoundedValue>147{148	/// Key of the property149	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]150	pub key: BoundedKey,151152	/// Value of the property153	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]154	pub value: BoundedValue,155}156157#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]158#[cfg_attr(feature = "std", derive(Serialize))]159#[cfg_attr(160	feature = "std",161	serde(bound = "BoundedString: AsRef<[u8]>")162)]163pub struct BasicResource<BoundedString> {164	/// If the resource is Media, the base property is absent. Media src should be a URI like an165	/// IPFS hash.166	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]167	pub src: Option<BoundedString>,168169	/// Reference to IPFS location of metadata170	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]171	pub metadata: Option<BoundedString>,172173	/// Optional location or identier of license174	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]175	pub license: Option<BoundedString>,176177	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given178	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is179	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns180	/// another bird, showing the full render of one bird inside the other's inventory might be a181	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an182	/// image that is lighter and faster to load but representative of this resource.183	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]184	pub thumb: Option<BoundedString>,185}186187#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]188#[cfg_attr(feature = "std", derive(Serialize))]189#[cfg_attr(190	feature = "std",191	serde(192		bound = r#"193			BoundedString: AsRef<[u8]>,194			BoundedParts: AsRef<[PartId]>195		"#196	)197)]198pub struct ComposableResource<BoundedString, BoundedParts> {199	/// If a resource is composed, it will have an array of parts that compose it200	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]201	pub parts: BoundedParts,202203	/// A Base is uniquely identified by the combination of the word `base`, its minting block204	/// number, and user provided symbol during Base creation, glued by dashes `-`, e.g.205	/// base-4477293-kanaria_superbird.206	pub base: BaseId,207208	/// If the resource is Media, the base property is absent. Media src should be a URI like an209	/// IPFS hash.210	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]211	pub src: Option<BoundedString>,212213	/// Reference to IPFS location of metadata214	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]215	pub metadata: Option<BoundedString>,216217	/// If the resource has the slot property, it was designed to fit into a specific Base's slot.218	/// The baseslot will be composed of two dot-delimited values, like so:219	/// "base-4477293-kanaria_superbird.machine_gun_scope". This means: "This resource is220	/// compatible with the machine_gun_scope slot of base base-4477293-kanaria_superbird221222	/// Optional location or identier of license223	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]224	pub license: Option<BoundedString>,225226	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given227	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is228	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns229	/// another bird, showing the full render of one bird inside the other's inventory might be a230	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an231	/// image that is lighter and faster to load but representative of this resource.232	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]233	pub thumb: Option<BoundedString>,234}235236#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]237#[cfg_attr(feature = "std", derive(Serialize))]238#[cfg_attr(239	feature = "std",240	serde(bound = "BoundedString: AsRef<[u8]>")241)]242pub struct SlotResource<BoundedString> {243	/// A Base is uniquely identified by the combination of the word `base`, its minting block244	/// number, and user provided symbol during Base creation, glued by dashes `-`, e.g.245	/// base-4477293-kanaria_superbird.246	pub base: BaseId,247248	/// If the resource is Media, the base property is absent. Media src should be a URI like an249	/// IPFS hash.250	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]251	pub src: Option<BoundedString>,252253	/// Reference to IPFS location of metadata254	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]255	pub metadata: Option<BoundedString>,256257	/// If the resource has the slot property, it was designed to fit into a specific Base's slot.258	/// The baseslot will be composed of two dot-delimited values, like so:259	/// "base-4477293-kanaria_superbird.machine_gun_scope". This means: "This resource is260	/// compatible with the machine_gun_scope slot of base base-4477293-kanaria_superbird261	pub slot: SlotId,262263	/// The license field, if present, should contain a link to a license (IPFS or static HTTP264	/// url), or an identifier, like RMRK_nocopy or ipfs://ipfs/someHashOfLicense.265	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]266	pub license: Option<BoundedString>,267268	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given269	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is270	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns271	/// another bird, showing the full render of one bird inside the other's inventory might be a272	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an273	/// image that is lighter and faster to load but representative of this resource.274	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]275	pub thumb: Option<BoundedString>,276}277278#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]279#[cfg_attr(feature = "std", derive(Serialize))]280#[cfg_attr(281	feature = "std",282	serde(283		bound = r#"284			BoundedString: AsRef<[u8]>,285			BoundedParts: AsRef<[PartId]>286		"#287	)288)]289pub enum ResourceTypes<BoundedString, BoundedParts> {290	Basic(BasicResource<BoundedString>),291	Composable(ComposableResource<BoundedString, BoundedParts>),292	Slot(SlotResource<BoundedString>),293}294295296#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]297#[cfg_attr(feature = "std", derive(Serialize))]298#[cfg_attr(299	feature = "std",300	serde(301		bound = r#"302			BoundedResource: AsRef<[u8]>,303			BoundedString: AsRef<[u8]>,304			BoundedParts: AsRef<[PartId]>305		"#306	)307)]308pub struct ResourceInfo<BoundedResource, BoundedString, BoundedParts> {309	/// id is a 5-character string of reasonable uniqueness.310	/// The combination of base ID and resource id should be unique across the entire RMRK311	/// ecosystem which312	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]313	pub id: BoundedResource,314315	/// Resource316	pub resource: ResourceTypes<BoundedString, BoundedParts>,317318	/// If resource is sent to non-rootowned NFT, pending will be false and need to be accepted319	pub pending: bool,320321	/// If resource removal request is sent by non-rootowned NFT, pending will be true and need to be accepted322	pub pending_removal: bool,323}324325#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]326#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]327#[cfg_attr(328	feature = "std",329	serde(330		bound = r#"331			AccountId: Serialize,332			BoundedString: AsRef<[u8]>333		"#334	)335)]336pub struct BaseInfo<AccountId, BoundedString> {337	/// Original creator of the Base338	pub issuer: AccountId,339340	/// Specifies how an NFT should be rendered, ie "svg"341	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]342	pub base_type: BoundedString,343344	/// User provided symbol during Base creation345	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]346	pub symbol: BoundedString,347}348349#[cfg_attr(feature = "std", derive(Serialize))]350#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]351#[cfg_attr(352	feature = "std",353	serde(bound = "BoundedString: AsRef<[u8]>")354)]355pub struct FixedPart<BoundedString> {356	pub id: PartId,357	pub z: ZIndex,358359	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]360	pub src: BoundedString,361}362363#[cfg_attr(feature = "std", derive(Serialize))]364#[derive(Encode, Decode, Debug, Derivative, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]365#[cfg_attr(366	feature = "std",367	serde(bound = "BoundedCollectionList: AsRef<[CollectionId]>")368)]369#[derivative(Default(bound=""))]370pub enum EquippableList<BoundedCollectionList> {371	All,372373	#[derivative(Default)]374	Empty,375376	Custom(377		#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]378		BoundedCollectionList379	),380}381382#[cfg_attr(feature = "std", derive(Serialize))]383#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]384#[cfg_attr(385	feature = "std",386	serde(387		bound = r#"388			BoundedString: AsRef<[u8]>,389			BoundedCollectionList: AsRef<[CollectionId]>390		"#391	)392)]393pub struct SlotPart<BoundedString, BoundedCollectionList> {394	pub id: PartId,395	pub equippable: EquippableList<BoundedCollectionList>,396397	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]398	pub src: BoundedString,399400	pub z: ZIndex,401}402403#[cfg_attr(feature = "std", derive(Serialize))]404#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]405#[cfg_attr(406	feature = "std",407	serde(408		bound = r#"409			BoundedString: AsRef<[u8]>,410			BoundedCollectionList: AsRef<[CollectionId]>411		"#412	)413)]414pub enum PartType<BoundedString, BoundedCollectionList> {415	FixedPart(FixedPart<BoundedString>),416	SlotPart(SlotPart<BoundedString, BoundedCollectionList>),417}418419#[cfg_attr(feature = "std", derive(Eq, Serialize))]420#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq)]421#[cfg_attr(422	feature = "std",423	serde(424		bound = r#"425			BoundedString: AsRef<[u8]>,426			PropertyList: AsRef<[ThemeProperty<BoundedString>]>,427		"#428	)429)]430pub struct Theme<BoundedString, PropertyList> {431	/// Name of the theme432	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]433	pub name: BoundedString,434435	/// Theme properties436	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]437	pub properties: PropertyList,438	/// Inheritability439	pub inherit: bool,440}441442#[cfg_attr(feature = "std", derive(Eq, Serialize))]443#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq)]444#[cfg_attr(445	feature = "std",446	serde(bound = "BoundedString: AsRef<[u8]>")447)]448pub struct ThemeProperty<BoundedString> {449	/// Key of the property450	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]451	pub key: BoundedString,452453	/// Value of the property454	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]455	pub value: BoundedString,456}
after · primitives/data-structs/src/rmrk.rs
1use codec::{Decode, Encode, MaxEncodedLen};2use scale_info::TypeInfo;34use derivative::Derivative;56#[cfg(feature = "std")]7use serde::Serialize;89use primitives::*;1011pub mod primitives {12	pub type CollectionId = u32;13	pub type ResourceId = u32;14	pub type NftId = u32;15	pub type BaseId = u32;16	pub type SlotId = u32;17	pub type PartId = u32;18	pub type ZIndex = u32;19}2021#[cfg(feature = "std")]22mod serialize {23    use core::convert::AsRef;24    use serde::ser::{self, Serialize};2526    pub mod vec {27        use super::*;2829        pub fn serialize<D, V, C>(value: &C, serializer: D) -> Result<D::Ok, D::Error>30        where31            D: ser::Serializer,32            V: Serialize,33            C: AsRef<[V]>,34        {35            value.as_ref().serialize(serializer)36        }37    }3839    pub mod opt_vec {40        use super::*;4142        pub fn serialize<D, V, C>(value: &Option<C>, serializer: D) -> Result<D::Ok, D::Error>43        where44            D: ser::Serializer,45            V: Serialize,46            C: AsRef<[V]>,47        {48            match value {49                Some(value) => super::vec::serialize(value, serializer),50                None => serializer.serialize_none()51            }52        }53    }54}5556/// Collection info.57#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]58#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]59#[cfg_attr(60	feature = "std",61	serde(62		bound = r#"63			AccountId: Serialize,64			BoundedString: AsRef<[u8]>,65			BoundedSymbol: AsRef<[u8]>66		"#67	)68)]69pub struct CollectionInfo<BoundedString, BoundedSymbol, AccountId> {70	/// Current bidder and bid price.71	pub issuer: AccountId,7273	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]74	pub metadata: BoundedString,75	pub max: Option<u32>,7677	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]78	pub symbol: BoundedSymbol,79	pub nfts_count: u32,80}8182#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, Debug, TypeInfo, MaxEncodedLen)]83#[cfg_attr(feature = "std", derive(Serialize))]84pub enum AccountIdOrCollectionNftTuple<AccountId> {85	AccountId(AccountId),86	CollectionAndNftTuple(CollectionId, NftId),87}8889/// Royalty information (recipient and amount)90#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]91#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]92pub struct RoyaltyInfo<AccountId, RoyaltyAmount> {93	/// Recipient (AccountId) of the royalty94    pub recipient: AccountId,95	/// Amount (Permill) of the royalty96    pub amount: RoyaltyAmount,97}9899/// Nft info.100#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]101#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]102#[cfg_attr(103	feature = "std",104	serde(105		bound = r#"106			AccountId: Serialize,107			RoyaltyAmount: Serialize,108			BoundedString: AsRef<[u8]>109		"#110	)111)]112pub struct NftInfo<AccountId, RoyaltyAmount, BoundedString> {113	/// The owner of the NFT, can be either an Account or a tuple (CollectionId, NftId)114	pub owner: AccountIdOrCollectionNftTuple<AccountId>,115	/// Royalty (optional)116	pub royalty: Option<RoyaltyInfo<AccountId, RoyaltyAmount>>,117118	/// Arbitrary data about an instance, e.g. IPFS hash119	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]120	pub metadata: BoundedString,121122	/// Equipped state123	pub equipped: bool,124	/// Pending state (if sent to NFT)125	pub pending: bool,126}127128#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]129#[derive(Encode, Decode, TypeInfo, MaxEncodedLen)]130pub struct NftChild {131	pub collection_id: CollectionId,132	pub nft_id: NftId133}134135#[cfg_attr(feature = "std", derive(Serialize))]136#[derive(Encode, Decode, PartialEq, TypeInfo)]137#[cfg_attr(138	feature = "std",139	serde(140		bound = r#"141			BoundedKey: AsRef<[u8]>,142			BoundedValue: AsRef<[u8]>143		"#144	)145)]146pub struct PropertyInfo<BoundedKey, BoundedValue>147{148	/// Key of the property149	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]150	pub key: BoundedKey,151152	/// Value of the property153	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]154	pub value: BoundedValue,155}156157#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]158#[cfg_attr(feature = "std", derive(Serialize))]159#[cfg_attr(160	feature = "std",161	serde(bound = "BoundedString: AsRef<[u8]>")162)]163pub struct BasicResource<BoundedString> {164	/// If the resource is Media, the base property is absent. Media src should be a URI like an165	/// IPFS hash.166	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]167	pub src: Option<BoundedString>,168169	/// Reference to IPFS location of metadata170	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]171	pub metadata: Option<BoundedString>,172173	/// Optional location or identier of license174	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]175	pub license: Option<BoundedString>,176177	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given178	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is179	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns180	/// another bird, showing the full render of one bird inside the other's inventory might be a181	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an182	/// image that is lighter and faster to load but representative of this resource.183	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]184	pub thumb: Option<BoundedString>,185}186187#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]188#[cfg_attr(feature = "std", derive(Serialize))]189#[cfg_attr(190	feature = "std",191	serde(192		bound = r#"193			BoundedString: AsRef<[u8]>,194			BoundedParts: AsRef<[PartId]>195		"#196	)197)]198pub struct ComposableResource<BoundedString, BoundedParts> {199	/// If a resource is composed, it will have an array of parts that compose it200	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]201	pub parts: BoundedParts,202203	/// A Base is uniquely identified by the combination of the word `base`, its minting block204	/// number, and user provided symbol during Base creation, glued by dashes `-`, e.g.205	/// base-4477293-kanaria_superbird.206	pub base: BaseId,207208	/// If the resource is Media, the base property is absent. Media src should be a URI like an209	/// IPFS hash.210	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]211	pub src: Option<BoundedString>,212213	/// Reference to IPFS location of metadata214	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]215	pub metadata: Option<BoundedString>,216217	/// If the resource has the slot property, it was designed to fit into a specific Base's slot.218	/// The baseslot will be composed of two dot-delimited values, like so:219	/// "base-4477293-kanaria_superbird.machine_gun_scope". This means: "This resource is220	/// compatible with the machine_gun_scope slot of base base-4477293-kanaria_superbird221222	/// Optional location or identier of license223	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]224	pub license: Option<BoundedString>,225226	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given227	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is228	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns229	/// another bird, showing the full render of one bird inside the other's inventory might be a230	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an231	/// image that is lighter and faster to load but representative of this resource.232	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]233	pub thumb: Option<BoundedString>,234}235236#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]237#[cfg_attr(feature = "std", derive(Serialize))]238#[cfg_attr(239	feature = "std",240	serde(bound = "BoundedString: AsRef<[u8]>")241)]242pub struct SlotResource<BoundedString> {243	/// A Base is uniquely identified by the combination of the word `base`, its minting block244	/// number, and user provided symbol during Base creation, glued by dashes `-`, e.g.245	/// base-4477293-kanaria_superbird.246	pub base: BaseId,247248	/// If the resource is Media, the base property is absent. Media src should be a URI like an249	/// IPFS hash.250	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]251	pub src: Option<BoundedString>,252253	/// Reference to IPFS location of metadata254	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]255	pub metadata: Option<BoundedString>,256257	/// If the resource has the slot property, it was designed to fit into a specific Base's slot.258	/// The baseslot will be composed of two dot-delimited values, like so:259	/// "base-4477293-kanaria_superbird.machine_gun_scope". This means: "This resource is260	/// compatible with the machine_gun_scope slot of base base-4477293-kanaria_superbird261	pub slot: SlotId,262263	/// The license field, if present, should contain a link to a license (IPFS or static HTTP264	/// url), or an identifier, like RMRK_nocopy or ipfs://ipfs/someHashOfLicense.265	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]266	pub license: Option<BoundedString>,267268	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given269	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is270	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns271	/// another bird, showing the full render of one bird inside the other's inventory might be a272	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an273	/// image that is lighter and faster to load but representative of this resource.274	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]275	pub thumb: Option<BoundedString>,276}277278#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]279#[cfg_attr(feature = "std", derive(Serialize))]280#[cfg_attr(281	feature = "std",282	serde(283		bound = r#"284			BoundedString: AsRef<[u8]>,285			BoundedParts: AsRef<[PartId]>286		"#287	)288)]289pub enum ResourceTypes<BoundedString, BoundedParts> {290	Basic(BasicResource<BoundedString>),291	Composable(ComposableResource<BoundedString, BoundedParts>),292	Slot(SlotResource<BoundedString>),293}294295296#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]297#[cfg_attr(feature = "std", derive(Serialize))]298#[cfg_attr(299	feature = "std",300	serde(301		bound = r#"302			BoundedResource: AsRef<[u8]>,303			BoundedString: AsRef<[u8]>,304			BoundedParts: AsRef<[PartId]>305		"#306	)307)]308pub struct ResourceInfo<BoundedResource, BoundedString, BoundedParts> {309	/// id is a 5-character string of reasonable uniqueness.310	/// The combination of base ID and resource id should be unique across the entire RMRK311	/// ecosystem which312	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]313	pub id: BoundedResource,314315	/// Resource316	pub resource: ResourceTypes<BoundedString, BoundedParts>,317318	/// If resource is sent to non-rootowned NFT, pending will be false and need to be accepted319	pub pending: bool,320321	/// If resource removal request is sent by non-rootowned NFT, pending will be true and need to be accepted322	pub pending_removal: bool,323}324325#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]326#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]327#[cfg_attr(328	feature = "std",329	serde(330		bound = r#"331			AccountId: Serialize,332			BoundedString: AsRef<[u8]>333		"#334	)335)]336pub struct BaseInfo<AccountId, BoundedString> {337	/// Original creator of the Base338	pub issuer: AccountId,339340	/// Specifies how an NFT should be rendered, ie "svg"341	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]342	pub base_type: BoundedString,343344	/// User provided symbol during Base creation345	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]346	pub symbol: BoundedString,347}348349#[cfg_attr(feature = "std", derive(Serialize))]350#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]351#[cfg_attr(352	feature = "std",353	serde(bound = "BoundedString: AsRef<[u8]>")354)]355pub struct FixedPart<BoundedString> {356	pub id: PartId,357	pub z: ZIndex,358359	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]360	pub src: BoundedString,361}362363#[cfg_attr(feature = "std", derive(Serialize))]364#[derive(Encode, Decode, Debug, Derivative, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]365#[cfg_attr(366	feature = "std",367	serde(bound = "BoundedCollectionList: AsRef<[CollectionId]>")368)]369#[derivative(Default(bound=""))]370pub enum EquippableList<BoundedCollectionList> {371	All,372373	#[derivative(Default)]374	Empty,375376	Custom(377		#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]378		BoundedCollectionList379	),380}381382#[cfg_attr(feature = "std", derive(Serialize))]383#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]384#[cfg_attr(385	feature = "std",386	serde(387		bound = r#"388			BoundedString: AsRef<[u8]>,389			BoundedCollectionList: AsRef<[CollectionId]>390		"#391	)392)]393pub struct SlotPart<BoundedString, BoundedCollectionList> {394	pub id: PartId,395	pub equippable: EquippableList<BoundedCollectionList>,396397	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]398	pub src: BoundedString,399400	pub z: ZIndex,401}402403#[cfg_attr(feature = "std", derive(Serialize))]404#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]405#[cfg_attr(406	feature = "std",407	serde(408		bound = r#"409			BoundedString: AsRef<[u8]>,410			BoundedCollectionList: AsRef<[CollectionId]>411		"#412	)413)]414pub enum PartType<BoundedString, BoundedCollectionList> {415	FixedPart(FixedPart<BoundedString>),416	SlotPart(SlotPart<BoundedString, BoundedCollectionList>),417}418419impl<BoundedString, BoundedCollectionList> PartType<BoundedString, BoundedCollectionList> {420	pub fn id(&self) -> PartId {421		match self {422			Self::FixedPart(part) => part.id,423			Self::SlotPart(part) => part.id424		}425	}426427	pub fn src(&self) -> &BoundedString {428		match self {429			Self::FixedPart(part) => &part.src,430			Self::SlotPart(part) => &part.src431		}432	}433434	pub fn z_index(&self) -> ZIndex {435		match self {436			Self::FixedPart(part) => part.z,437			Self::SlotPart(part) => part.z438		}439	}440}441442#[cfg_attr(feature = "std", derive(Eq, Serialize))]443#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq)]444#[cfg_attr(445	feature = "std",446	serde(447		bound = r#"448			BoundedString: AsRef<[u8]>,449			PropertyList: AsRef<[ThemeProperty<BoundedString>]>,450		"#451	)452)]453pub struct Theme<BoundedString, PropertyList> {454	/// Name of the theme455	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]456	pub name: BoundedString,457458	/// Theme properties459	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]460	pub properties: PropertyList,461	/// Inheritability462	pub inherit: bool,463}464465#[cfg_attr(feature = "std", derive(Eq, Serialize))]466#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq)]467#[cfg_attr(468	feature = "std",469	serde(bound = "BoundedString: AsRef<[u8]>")470)]471pub struct ThemeProperty<BoundedString> {472	/// Key of the property473	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]474	pub key: BoundedString,475476	/// Value of the property477	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]478	pub value: BoundedString,479}
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
--- a/runtime/common/src/runtime_apis.rs
+++ b/runtime/common/src/runtime_apis.rs
@@ -347,27 +347,27 @@
 
                 fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {
                     use frame_support::BoundedVec;
-                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkNft, RmrkDecode}};
+                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkNft, RmrkDecode}};
 
                     let collection_id = CollectionId(base_id);
                     if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() { return Ok(Vec::new()); }
 
-                    let parts = (dispatch_unique_runtime!(collection_id.collection_tokens()) as Result<Vec<TokenId>, DispatchError>)?
-                        .iter()
+                    let parts = (dispatch_unique_runtime!(collection_id.collection_tokens()))?
+                        .into_iter()
                         .filter_map(|token_id| {
-                            let nft_type = RmrkCore::get_nft_type(collection_id, *token_id).unwrap();
+                            let nft_type = RmrkCore::get_nft_type(collection_id, token_id).ok()?;
 
                             match nft_type {
-                                FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {
-                                    id: token_id.0,
-                                    src: RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::Src).unwrap().decode_or_default(),
-                                    z: RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::ZIndex).unwrap().decode_or_default(),
+                                NftType::FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {
+                                    id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),
+                                    src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),
+                                    z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),
                                 })),
-                                SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {
-                                    id: token_id.0,
-                                    src: RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::Src).unwrap().decode_or_default(),
-                                    z: RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::ZIndex).unwrap().decode_or_default(),
-                                    equippable: RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::EquippableList).unwrap().decode_or_default(),
+                                NftType::SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {
+                                    id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),
+                                    src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),
+                                    z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),
+                                    equippable: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::EquippableList).ok()?.decode_or_default(),
                                 })),
                                 _ => None
                             }
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -91,6 +91,7 @@
     'pallet-refungible/std',
     'pallet-nonfungible/std',
     'pallet-proxy-rmrk-core/std',
+    'pallet-proxy-rmrk-equip/std',
     'pallet-unique/std',
     'pallet-unq-scheduler/std',
     'pallet-charge-transaction/std',
@@ -410,6 +411,7 @@
 pallet-refungible = { default-features = false, path = "../../pallets/refungible" }
 pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
 pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }
+pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
 pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
 pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.21", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -906,6 +906,10 @@
 	type Event = Event;
 }
 
+impl pallet_proxy_rmrk_equip::Config for Runtime {
+	type Event = Event;
+}
+
 impl pallet_unique::Config for Runtime {
 	type Event = Event;
 	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
@@ -1019,6 +1023,7 @@
 		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
 		Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,
 		RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,
+		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,
 
 		// Frontier
 		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -880,6 +880,14 @@
 	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
 }
 
+impl pallet_proxy_rmrk_core::Config for Runtime {
+	type Event = Event;
+}
+
+impl pallet_proxy_rmrk_equip::Config for Runtime {
+	type Event = Event;
+}
+
 impl pallet_unique::Config for Runtime {
 	type Event = Event;
 	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
@@ -992,6 +1000,7 @@
 		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
 		Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,
 		RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,
+		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,
 
 		// Frontier
 		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -884,6 +884,14 @@
 	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
 }
 
+impl pallet_proxy_rmrk_core::Config for Runtime {
+	type Event = Event;
+}
+
+impl pallet_proxy_rmrk_equip::Config for Runtime {
+	type Event = Event;
+}
+
 impl pallet_unique::Config for Runtime {
 	type Event = Event;
 	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
@@ -997,6 +1005,7 @@
 		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
 		Structure: pallet_structure::{Pallet, Call, Storage, Event<T>} = 70,
 		RmrkCore: pallet_proxy_rmrk_core::{Pallet, Call, Storage, Event<T>} = 71,
+		RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event<T>} = 72,
 
 		// Frontier
 		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,