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

difftreelog

feat copy rmrk types and rpc

Daniel Shiposha2022-05-23parent: #f6360cc.patch.diff
in: master

13 files changed

modifiedCargo.lockdiffbeforeafterboth
before · Cargo.lock
1013 packageslockfile v3
modifiedclient/rpc/Cargo.tomldiffbeforeafterboth
--- a/client/rpc/Cargo.toml
+++ b/client/rpc/Cargo.toml
@@ -9,6 +9,7 @@
 pallet-common = { default-features = false, path = '../../pallets/common' }
 up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
 up-rpc = { path = "../../primitives/rpc" }
+rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
 codec = { package = "parity-scale-codec", version = "3.1.2" }
 jsonrpc-core = "18.0.0"
 jsonrpc-core-client = "18.0.0"
@@ -20,8 +21,3 @@
 sp-rpc = { 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" }
 pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
-
-# RMRK
-# todo git
-rmrk-rpc = { git = "https://github.com/UniqueNetwork/rmrk-substrate.git", branch = "feature/separate-types-and-traits" } 
-rmrk-types = { git = "https://github.com/UniqueNetwork/rmrk-substrate.git", branch = "feature/separate-types-and-traits" } 
modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -276,14 +276,6 @@
 branch = "polkadot-v0.9.21"
 
 ################################################################################
-# RMRK dependencies
-
-# todo git
-[dependencies.rmrk-rpc]
-git = "https://github.com/UniqueNetwork/rmrk-substrate.git"
-branch = "feature/separate-types-and-traits"
-
-################################################################################
 # Package
 
 [package]
@@ -323,6 +315,7 @@
 pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
 
 unique-rpc = { default-features = false, path = "../rpc" }
+rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
 
 [features]
 default = []
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -49,15 +49,12 @@
 fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
 fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
 
-# RMRK
-# todo git
-rmrk-rpc = { git = "https://github.com/UniqueNetwork/rmrk-substrate.git", branch = "feature/separate-types-and-traits" }
-
 pallet-common = { default-features = false, path = "../../pallets/common" }
 unique-runtime-common = { default-features = false, path = "../../runtime/common" }
 pallet-unique = { path = "../../pallets/unique" }
 uc-rpc = { path = "../../client/rpc" }
 up-rpc = { path = "../../primitives/rpc" }
+rmrk-rpc = { path = "../../primitives/rmrk-rpc" }
 up-data-structs = { default-features = false, path = "../../primitives/data-structs" }
 
 [dependencies.serde]
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
--- a/pallets/common/Cargo.toml
+++ b/pallets/common/Cargo.toml
@@ -26,10 +26,6 @@
     "derive",
 ] }
 
-# RMRK
-# todo git
-rmrk-types = { default-features = false, git = "https://github.com/UniqueNetwork/rmrk-substrate.git", branch = "feature/separate-types-and-traits" }
-
 [features]
 default = ["std"]
 std = [
modifiedprimitives/data-structs/Cargo.tomldiffbeforeafterboth
--- a/primitives/data-structs/Cargo.toml
+++ b/primitives/data-structs/Cargo.toml
@@ -27,10 +27,6 @@
 struct-versioning = { path = "../../crates/struct-versioning" }
 pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
 
-# RMRK
-# todo git
-rmrk-types = { default-features = false, git = "https://github.com/UniqueNetwork/rmrk-substrate.git", branch = "feature/separate-types-and-traits" }
-
 [features]
 default = ["std"]
 std = [
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -36,11 +36,13 @@
 use derivative::Derivative;
 use scale_info::TypeInfo;
 
+pub mod rmrk;
+
 // RMRK
-use rmrk_types::{
+use rmrk::{
 	CollectionInfo, NftInfo, ResourceInfo, PropertyInfo, BaseInfo, PartType, Theme, ThemeProperty,
 };
-pub use rmrk_types::{
+pub use rmrk::{
 	primitives::{
 		CollectionId as RmrkCollectionId, NftId as RmrkNftId, BaseId as RmrkBaseId,
 		PartId as RmrkPartId, ResourceId as RmrkResourceId,
addedprimitives/data-structs/src/rmrk.rsdiffbeforeafterboth
--- /dev/null
+++ b/primitives/data-structs/src/rmrk.rs
@@ -0,0 +1,451 @@
+use codec::{Decode, Encode, MaxEncodedLen};
+use scale_info::TypeInfo;
+
+
+#[cfg(feature = "std")]
+use serde::Serialize;
+
+use primitives::*;
+
+pub mod primitives {
+	pub type CollectionId = u32;
+	pub type ResourceId = u32;
+	pub type NftId = u32;
+	pub type BaseId = u32;
+	pub type SlotId = u32;
+	pub type PartId = u32;
+	pub type ZIndex = u32;
+}
+
+#[cfg(feature = "std")]
+mod serialize {
+    use core::convert::AsRef;
+    use serde::ser::{self, Serialize};
+
+    pub mod vec {
+        use super::*;
+
+        pub fn serialize<D, V, C>(value: &C, serializer: D) -> Result<D::Ok, D::Error>
+        where
+            D: ser::Serializer,
+            V: Serialize,
+            C: AsRef<[V]>,
+        {
+            value.as_ref().serialize(serializer)
+        }
+    }
+
+    pub mod opt_vec {
+        use super::*;
+
+        pub fn serialize<D, V, C>(value: &Option<C>, serializer: D) -> Result<D::Ok, D::Error>
+        where
+            D: ser::Serializer,
+            V: Serialize,
+            C: AsRef<[V]>,
+        {
+            match value {
+                Some(value) => super::vec::serialize(value, serializer),
+                None => serializer.serialize_none()
+            }
+        }
+    }
+}
+
+/// Collection info.
+#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]
+#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
+#[cfg_attr(
+	feature = "std",
+	serde(
+		bound = r#"
+			AccountId: Serialize,
+			BoundedString: AsRef<[u8]>,
+			BoundedSymbol: AsRef<[u8]>
+		"#
+	)
+)]
+pub struct CollectionInfo<BoundedString, BoundedSymbol, AccountId> {
+	/// Current bidder and bid price.
+	pub issuer: AccountId,
+
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub metadata: BoundedString,
+	pub max: Option<u32>,
+
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub symbol: BoundedSymbol,
+	pub nfts_count: u32,
+}
+
+#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, Debug, TypeInfo, MaxEncodedLen)]
+#[cfg_attr(feature = "std", derive(Serialize))]
+pub enum AccountIdOrCollectionNftTuple<AccountId> {
+	AccountId(AccountId),
+	CollectionAndNftTuple(CollectionId, NftId),
+}
+
+/// Royalty information (recipient and amount)
+#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]
+#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
+pub struct RoyaltyInfo<AccountId, RoyaltyAmount> {
+	/// Recipient (AccountId) of the royalty
+    pub recipient: AccountId,
+	/// Amount (Permill) of the royalty
+    pub amount: RoyaltyAmount,
+}
+
+/// Nft info.
+#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]
+#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
+#[cfg_attr(
+	feature = "std",
+	serde(
+		bound = r#"
+			AccountId: Serialize,
+			RoyaltyAmount: Serialize,
+			BoundedString: AsRef<[u8]>
+		"#
+	)
+)]
+pub struct NftInfo<AccountId, RoyaltyAmount, BoundedString> {
+	/// The owner of the NFT, can be either an Account or a tuple (CollectionId, NftId)
+	pub owner: AccountIdOrCollectionNftTuple<AccountId>,
+	/// Royalty (optional)
+	pub royalty: Option<RoyaltyInfo<AccountId, RoyaltyAmount>>,
+
+	/// Arbitrary data about an instance, e.g. IPFS hash
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub metadata: BoundedString,
+
+	/// Equipped state
+	pub equipped: bool,
+	/// Pending state (if sent to NFT)
+	pub pending: bool,
+}
+
+#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]
+#[derive(Encode, Decode, TypeInfo, MaxEncodedLen)]
+pub struct NftChild {
+	pub collection_id: CollectionId,
+	pub nft_id: NftId
+}
+
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[derive(Encode, Decode, PartialEq, TypeInfo)]
+#[cfg_attr(
+	feature = "std",
+	serde(
+		bound = r#"
+			BoundedKey: AsRef<[u8]>,
+			BoundedValue: AsRef<[u8]>
+		"#
+	)
+)]
+pub struct PropertyInfo<BoundedKey, BoundedValue>
+{
+	/// Key of the property
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub key: BoundedKey,
+
+	/// Value of the property
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub value: BoundedValue,
+}
+
+#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[cfg_attr(
+	feature = "std",
+	serde(bound = "BoundedString: AsRef<[u8]>")
+)]
+pub struct BasicResource<BoundedString> {
+	/// If the resource is Media, the base property is absent. Media src should be a URI like an
+	/// IPFS hash.
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub src: Option<BoundedString>,
+
+	/// Reference to IPFS location of metadata
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub metadata: Option<BoundedString>,
+
+	/// Optional location or identier of license
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub license: Option<BoundedString>,
+
+	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given
+	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is
+	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns
+	/// another bird, showing the full render of one bird inside the other's inventory might be a
+	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an
+	/// image that is lighter and faster to load but representative of this resource.
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub thumb: Option<BoundedString>,
+}
+
+#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[cfg_attr(
+	feature = "std",
+	serde(
+		bound = r#"
+			BoundedString: AsRef<[u8]>,
+			BoundedParts: AsRef<[PartId]>
+		"#
+	)
+)]
+pub struct ComposableResource<BoundedString, BoundedParts> {
+	/// If a resource is composed, it will have an array of parts that compose it
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub parts: BoundedParts,
+
+	/// A Base is uniquely identified by the combination of the word `base`, its minting block
+	/// number, and user provided symbol during Base creation, glued by dashes `-`, e.g.
+	/// base-4477293-kanaria_superbird.
+	pub base: BaseId,
+
+	/// If the resource is Media, the base property is absent. Media src should be a URI like an
+	/// IPFS hash.
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub src: Option<BoundedString>,
+
+	/// Reference to IPFS location of metadata
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub metadata: Option<BoundedString>,
+
+	/// If the resource has the slot property, it was designed to fit into a specific Base's slot.
+	/// The baseslot will be composed of two dot-delimited values, like so:
+	/// "base-4477293-kanaria_superbird.machine_gun_scope". This means: "This resource is
+	/// compatible with the machine_gun_scope slot of base base-4477293-kanaria_superbird
+
+	/// Optional location or identier of license
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub license: Option<BoundedString>,
+
+	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given
+	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is
+	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns
+	/// another bird, showing the full render of one bird inside the other's inventory might be a
+	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an
+	/// image that is lighter and faster to load but representative of this resource.
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub thumb: Option<BoundedString>,
+}
+
+#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[cfg_attr(
+	feature = "std",
+	serde(bound = "BoundedString: AsRef<[u8]>")
+)]
+pub struct SlotResource<BoundedString> {
+	/// A Base is uniquely identified by the combination of the word `base`, its minting block
+	/// number, and user provided symbol during Base creation, glued by dashes `-`, e.g.
+	/// base-4477293-kanaria_superbird.
+	pub base: BaseId,
+
+	/// If the resource is Media, the base property is absent. Media src should be a URI like an
+	/// IPFS hash.
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub src: Option<BoundedString>,
+
+	/// Reference to IPFS location of metadata
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub metadata: Option<BoundedString>,
+
+	/// If the resource has the slot property, it was designed to fit into a specific Base's slot.
+	/// The baseslot will be composed of two dot-delimited values, like so:
+	/// "base-4477293-kanaria_superbird.machine_gun_scope". This means: "This resource is
+	/// compatible with the machine_gun_scope slot of base base-4477293-kanaria_superbird
+	pub slot: SlotId,
+
+	/// The license field, if present, should contain a link to a license (IPFS or static HTTP
+	/// url), or an identifier, like RMRK_nocopy or ipfs://ipfs/someHashOfLicense.
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub license: Option<BoundedString>,
+
+	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given
+	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is
+	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns
+	/// another bird, showing the full render of one bird inside the other's inventory might be a
+	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an
+	/// image that is lighter and faster to load but representative of this resource.
+	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]
+	pub thumb: Option<BoundedString>,
+}
+
+#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[cfg_attr(
+	feature = "std",
+	serde(
+		bound = r#"
+			BoundedString: AsRef<[u8]>,
+			BoundedParts: AsRef<[PartId]>
+		"#
+	)
+)]
+pub enum ResourceTypes<BoundedString, BoundedParts> {
+	Basic(BasicResource<BoundedString>),
+	Composable(ComposableResource<BoundedString, BoundedParts>),
+	Slot(SlotResource<BoundedString>),
+}
+
+
+#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[cfg_attr(
+	feature = "std",
+	serde(
+		bound = r#"
+			BoundedResource: AsRef<[u8]>,
+			BoundedString: AsRef<[u8]>,
+			BoundedParts: AsRef<[PartId]>
+		"#
+	)
+)]
+pub struct ResourceInfo<BoundedResource, BoundedString, BoundedParts> {
+	/// id is a 5-character string of reasonable uniqueness.
+	/// The combination of base ID and resource id should be unique across the entire RMRK
+	/// ecosystem which
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub id: BoundedResource,
+
+	/// Resource
+	pub resource: ResourceTypes<BoundedString, BoundedParts>,
+
+	/// If resource is sent to non-rootowned NFT, pending will be false and need to be accepted
+	pub pending: bool,
+
+	/// If resource removal request is sent by non-rootowned NFT, pending will be true and need to be accepted
+	pub pending_removal: bool,
+}
+
+#[cfg_attr(feature = "std", derive(PartialEq, Eq, Serialize))]
+#[derive(Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
+#[cfg_attr(
+	feature = "std",
+	serde(
+		bound = r#"
+			AccountId: Serialize,
+			BoundedString: AsRef<[u8]>
+		"#
+	)
+)]
+pub struct BaseInfo<AccountId, BoundedString> {
+	/// Original creator of the Base
+	pub issuer: AccountId,
+
+	/// Specifies how an NFT should be rendered, ie "svg"
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub base_type: BoundedString,
+
+	/// User provided symbol during Base creation
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub symbol: BoundedString,
+}
+
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]
+#[cfg_attr(
+	feature = "std",
+	serde(bound = "BoundedString: AsRef<[u8]>")
+)]
+pub struct FixedPart<BoundedString> {
+	pub id: PartId,
+	pub z: ZIndex,
+
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub src: BoundedString,
+}
+
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]
+#[cfg_attr(
+	feature = "std",
+	serde(bound = "BoundedCollectionList: AsRef<[CollectionId]>")
+)]
+pub enum EquippableList<BoundedCollectionList> {
+	All,
+	Empty,
+	Custom(
+		#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+		BoundedCollectionList
+	),
+}
+
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]
+#[cfg_attr(
+	feature = "std",
+	serde(
+		bound = r#"
+			BoundedString: AsRef<[u8]>,
+			BoundedCollectionList: AsRef<[CollectionId]>
+		"#
+	)
+)]
+pub struct SlotPart<BoundedString, BoundedCollectionList> {
+	pub id: PartId,
+	pub equippable: EquippableList<BoundedCollectionList>,
+
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub src: BoundedString,
+
+	pub z: ZIndex,
+}
+
+#[cfg_attr(feature = "std", derive(Serialize))]
+#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]
+#[cfg_attr(
+	feature = "std",
+	serde(
+		bound = r#"
+			BoundedString: AsRef<[u8]>,
+			BoundedCollectionList: AsRef<[CollectionId]>
+		"#
+	)
+)]
+pub enum PartType<BoundedString, BoundedCollectionList> {
+	FixedPart(FixedPart<BoundedString>),
+	SlotPart(SlotPart<BoundedString, BoundedCollectionList>),
+}
+
+#[cfg_attr(feature = "std", derive(Eq, Serialize))]
+#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq)]
+#[cfg_attr(
+	feature = "std",
+	serde(
+		bound = r#"
+			BoundedString: AsRef<[u8]>,
+			PropertyList: AsRef<[ThemeProperty<BoundedString>]>,
+		"#
+	)
+)]
+pub struct Theme<BoundedString, PropertyList> {
+	/// Name of the theme
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub name: BoundedString,
+
+	/// Theme properties
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub properties: PropertyList,
+	/// Inheritability
+	pub inherit: bool,
+}
+
+#[cfg_attr(feature = "std", derive(Eq, Serialize))]
+#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq)]
+#[cfg_attr(
+	feature = "std",
+	serde(bound = "BoundedString: AsRef<[u8]>")
+)]
+pub struct ThemeProperty<BoundedString> {
+	/// Key of the property
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub key: BoundedString,
+
+	/// Value of the property
+	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]
+	pub value: BoundedString,
+}
addedprimitives/rmrk-rpc/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/primitives/rmrk-rpc/Cargo.toml
@@ -0,0 +1,26 @@
+[package]
+name = "rmrk-rpc"
+version = "0.0.1"
+license = ""
+edition = "2021"
+
+[dependencies]
+codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
+sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
+sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
+sp-api = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
+sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.21' }
+serde = { version = "1.0.130", default-features = false, features = ["derive"] }
+up-data-structs = { default-features = false, path = '../data-structs' }
+
+[features]
+default = ["std"]
+std = [
+	"codec/std",
+	"sp-core/std",
+	"sp-std/std",
+	"sp-api/std",
+	"sp-runtime/std",
+	"serde/std",
+	"up-data-structs/std",
+]
addedprimitives/rmrk-rpc/src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/primitives/rmrk-rpc/src/lib.rs
@@ -0,0 +1,63 @@
+#![cfg_attr(not(feature = "std"), no_std)]
+
+use sp_api::{Encode, Decode};
+use sp_std::vec::Vec;
+use sp_runtime::DispatchError;
+use up_data_structs::rmrk::{primitives::*, NftChild};
+
+pub type Result<T> = core::result::Result<T, DispatchError>;
+
+pub type RpcString = Vec<u8>;
+
+pub type PropertyKey = RpcString;
+
+pub type ThemeName = RpcString;
+
+sp_api::decl_runtime_apis! {
+	pub trait RmrkApi<
+		AccountId,
+		CollectionInfo,
+		NftInfo,
+		ResourceInfo,
+		PropertyInfo,
+		BaseInfo,
+		PartType,
+		Theme
+	>
+	where
+		AccountId: Encode,
+		CollectionInfo: Decode,
+		NftInfo: Decode,
+		ResourceInfo: Decode,
+		PropertyInfo: Decode,
+		BaseInfo: Decode,
+		PartType: Decode,
+		Theme: Decode,
+	{
+		fn last_collection_idx() -> Result<CollectionId>;
+
+		fn collection_by_id(id: CollectionId) -> Result<Option<CollectionInfo>>;
+
+		fn nft_by_id(collection_id: CollectionId, nft_id: NftId) -> Result<Option<NftInfo>>;
+
+		fn account_tokens(account_id: AccountId, collection_id: CollectionId) -> Result<Vec<NftId>>;
+
+		fn nft_children(collection_id: CollectionId, nft_id: NftId) -> Result<Vec<NftChild>>;
+
+		fn collection_properties(collection_id: CollectionId, filter_keys: Option<Vec<PropertyKey>>) -> Result<Vec<PropertyInfo>>;
+
+		fn nft_properties(collection_id: CollectionId, nft_id: NftId, filter_keys: Option<Vec<PropertyKey>>) -> Result<Vec<PropertyInfo>>;
+
+		fn nft_resources(collection_id: CollectionId, nft_id: NftId) -> Result<Vec<ResourceInfo>>;
+
+		fn nft_resource_priorities(collection_id: CollectionId, nft_id: NftId) -> Result<Vec<ResourceId>>;
+
+		fn base(base_id: BaseId) -> Result<Option<BaseInfo>>;
+
+		fn base_parts(base_id: BaseId) -> Result<Vec<PartType>>;
+
+		fn theme_names(base_id: BaseId) -> Result<Vec<ThemeName>>;
+
+		fn theme(base_id: BaseId, theme_name: ThemeName, filter_keys: Option<Vec<PropertyKey>>) -> Result<Option<Theme>>;
+	}
+}
modifiedruntime/common/Cargo.tomldiffbeforeafterboth
--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -108,7 +108,4 @@
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
 up-sponsorship = { default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.21' }
 
-# RMRK
-# todo git
-rmrk-rpc = { default-features = false, git = "https://github.com/UniqueNetwork/rmrk-substrate.git", branch = "feature/separate-types-and-traits" } 
-rmrk-types = { default-features = false, git = "https://github.com/UniqueNetwork/rmrk-substrate.git", branch = "feature/separate-types-and-traits" } 
+rmrk-rpc = { default-features = false, path = "../../primitives/rmrk-rpc" }
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -389,15 +389,6 @@
 default-features = false
 
 ################################################################################
-# RMRK dependencies
-
-# todo git
-[dependencies.rmrk-rpc]
-default-features = false
-git = "https://github.com/UniqueNetwork/rmrk-substrate.git"
-branch = "feature/separate-types-and-traits"
-
-################################################################################
 # local dependencies
 
 [dependencies]
@@ -409,6 +400,7 @@
 derivative = "2.2.0"
 pallet-unique = { path = '../../pallets/unique', default-features = false }
 up-rpc = { path = "../../primitives/rpc", default-features = false }
+rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
 fp-evm-mapping = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.21-logs" }
 pallet-inflation = { path = '../../pallets/inflation', default-features = false }
 up-data-structs = { path = '../../primitives/data-structs', default-features = false }
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -388,15 +388,6 @@
 default-features = false
 
 ################################################################################
-# RMRK dependencies
-
-# todo git
-[dependencies.rmrk-rpc]
-default-features = false
-git = "https://github.com/UniqueNetwork/rmrk-substrate.git"
-branch = "feature/separate-types-and-traits"
-
-################################################################################
 # local dependencies
 
 [dependencies]
@@ -408,6 +399,7 @@
 derivative = "2.2.0"
 pallet-unique = { path = '../../pallets/unique', default-features = false }
 up-rpc = { path = "../../primitives/rpc", default-features = false }
+rmrk-rpc = { path = "../../primitives/rmrk-rpc", default-features = false }
 pallet-inflation = { path = '../../pallets/inflation', default-features = false }
 up-data-structs = { path = '../../primitives/data-structs', default-features = false }
 pallet-common = { default-features = false, path = "../../pallets/common" }