git.delta.rocks / unique-network / refs/commits / 01c2c9e3dbbd

difftreelog

doc(rmrk): style + minor revisions

Farhad Hakimov2022-07-22parent: #0e74039.patch.diff
in: master

3 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
@@ -49,41 +49,41 @@
 //! - FAQ: <https://coda.io/@rmrk/faq>
 //! - Substrate code repository: <https://github.com/rmrk-team/rmrk-substrate>
 //! - RMRK specification repository: <https://github.com/rmrk-team/rmrk-spec>
-//! 
+//!
 //! ## Terminology
-//! 
+//!
 //! For more information on RMRK, see RMRK's own documentation.
-//! 
+//!
 //! ### Intro to RMRK
-//! 
-//! - **Resource:** Additional piece of metadata of an NFT usually serving to add 
-//! a piece of media on top of the root metadata (NFT's own), be it a different wing 
+//!
+//! - **Resource:** Additional piece of metadata of an NFT usually serving to add
+//! a piece of media on top of the root metadata (NFT's own), be it a different wing
 //! on the root template bird or something entirely unrelated.
-//! 
-//! - **Base:** A list of possible "components" - Parts, a combination of which can 
+//!
+//! - **Base:** A list of possible "components" - Parts, a combination of which can
 //! be appended/equipped to/on an NFT.
-//! 
-//! - **Part:** Something that, together with other Parts, can constitute an NFT. 
-//! Parts are defined in the Base to which they belong. Parts can be either 
+//!
+//! - **Part:** Something that, together with other Parts, can constitute an NFT.
+//! Parts are defined in the Base to which they belong. Parts can be either
 //! of the `slot` type or `fixed` type. Slots are intended for equippables.
-//! Note that "part of something" and "Part of a Base" can be easily confused, 
+//! Note that "part of something" and "Part of a Base" can be easily confused,
 //! and in this documentation these words are distinguished by the capital letter.
-//! 
-//! - **Theme:** Named objects of variable => value pairs which get interpolated into 
-//! the Base's `themable` Parts. Themes can hold any value, but are often represented 
+//!
+//! - **Theme:** Named objects of variable => value pairs which get interpolated into
+//! the Base's `themable` Parts. Themes can hold any value, but are often represented
 //! in RMRK's examples as colors applied to visible Parts.
-//! 
+//!
 //! ### Peculiarities in Unique
-//! 
-//! - **Scoped properties:** Properties that are normally obscured from users. 
-//! Their purpose is to contain structured metadata that was not included in the Unique standard 
-//! for collections and tokens, meant to be operated on by proxies and other outliers. 
-//! Scoped properties are prefixed with `some-scope:`, where `some-scope` is 
-//! an arbitrary keyword, like "rmrk", and `:` is an unacceptable symbol in user-defined 
+//!
+//! - **Scoped properties:** Properties that are normally obscured from users.
+//! Their purpose is to contain structured metadata that was not included in the Unique standard
+//! for collections and tokens, meant to be operated on by proxies and other outliers.
+//! Scoped properties are prefixed with `some-scope:`, where `some-scope` is
+//! an arbitrary keyword, like "rmrk", and `:` is an unacceptable symbol in user-defined
 //! properties, which, along with other safeguards, makes them impossible to tamper with.
-//! 
-//! - **Auxiliary properties:** A slightly different structure of properties, 
-//! trading universality of use for more convenient storage, writes and access. 
+//!
+//! - **Auxiliary properties:** A slightly different structure of properties,
+//! trading universality of use for more convenient storage, writes and access.
 //! Meant to be inaccessible to end users.
 //!
 //! ## Proxy Implementation
@@ -118,9 +118,8 @@
 //! RMRK introduces the concept of a Base, which is a catalgoue of Parts,
 //! possible components of an NFT. Due to its similarity with the functionality
 //! of a token collection, a Base is stored and handled as one, and the Base's Parts and Themes
-//! are the collection's NFTs. See [`CollectionType`](pallet_rmrk_core::misc::CollectionType) and
-//! [`NftType`](pallet_rmrk_core::misc::NftType).
-//! 
+//! are the collection's NFTs. See [`CollectionType`] and [`NftType`].
+//!
 //! ## Interface
 //!
 //! ### Dispatchables
@@ -788,7 +787,7 @@
 
 		/// Accept an NFT sent from another account to self or an owned NFT.
 		///
-		/// The NFT in question must be pending, and, thus, be [sent](`crate::pallet::Call::send`) first.
+		/// The NFT in question must be pending, and, thus, be [sent](`Pallet::send`) first.
 		///
 		/// # Permissions:
 		/// - Token-owner-to-be
@@ -880,7 +879,7 @@
 		/// Reject an NFT sent from another account to self or owned NFT.
 		/// The NFT in question will not be sent back and burnt instead.
 		///
-		/// The NFT in question must be pending, and, thus, be [sent](`crate::pallet::Call::send`) first.
+		/// The NFT in question must be pending, and, thus, be [sent](`Pallet::send`) first.
 		///
 		/// # Permissions:
 		/// - Token-owner-to-be-not
@@ -945,7 +944,7 @@
 		///
 		/// This transaction is needed when a resource is created and assigned to an NFT
 		/// by a non-owner, i.e. the collection issuer, with one of the
-		/// [`add_...` transactions](crate::pallet::Call::add_basic_resource).
+		/// [`add_...` transactions](Pallet::add_basic_resource).
 		///
 		/// # Permissions:
 		/// - Token owner
@@ -999,7 +998,7 @@
 		/// Accept the removal of a removal-pending resource from an NFT.
 		///
 		/// This transaction is needed when a non-owner, i.e. the collection issuer,
-		/// requests a [removal](`crate::pallet::Call::remove_resource`) of a resource from an NFT.
+		/// requests a [removal](`Pallet::remove_resource`) of a resource from an NFT.
 		///
 		/// # Permissions:
 		/// - Token owner
@@ -1207,7 +1206,7 @@
 		///
 		/// # Permissions:
 		/// - Collection issuer - if not the token owner, adding the resource will warrant
-		/// the owner's [acceptance](crate::pallet::Call::accept_resource).
+		/// the owner's [acceptance](Pallet::accept_resource).
 		///
 		/// # Arguments:
 		/// - `rmrk_collection_id`: RMRK collection ID of the NFT.
@@ -1249,7 +1248,7 @@
 		///
 		/// # Permissions:
 		/// - Collection issuer - if not the token owner, adding the resource will warrant
-		/// the owner's [acceptance](crate::pallet::Call::accept_resource).
+		/// the owner's [acceptance](Pallet::accept_resource).
 		///
 		/// # Arguments:
 		/// - `rmrk_collection_id`: RMRK collection ID of the NFT.
@@ -1311,7 +1310,7 @@
 		///
 		/// # Permissions:
 		/// - Collection issuer - if not the token owner, adding the resource will warrant
-		/// the owner's [acceptance](crate::pallet::Call::accept_resource).
+		/// the owner's [acceptance](Pallet::accept_resource).
 		///
 		/// # Arguments:
 		/// - `rmrk_collection_id`: RMRK collection ID of the NFT.
@@ -1349,7 +1348,7 @@
 		/// Remove and erase a resource from an NFT.
 		///
 		/// If the sender does not own the NFT, then it will be pending confirmation,
-		/// and will have to be [accepted](crate::pallet::Call::accept_resource_removal) by the token owner.
+		/// and will have to be [accepted](Pallet::accept_resource_removal) by the token owner.
 		///
 		/// # Permissions
 		/// - Collection issuer
@@ -1600,7 +1599,7 @@
 
 	/// Get incremented resource ID from within an NFT's properties and store the new latest ID.
 	/// Thus, the returned resource ID should be used.
-	/// 
+	///
 	/// Resource IDs are unique only across an NFT.
 	fn acquire_next_resource_id(
 		collection_id: CollectionId,
@@ -1720,7 +1719,7 @@
 		Ok(())
 	}
 
-	/// Remove a Base ID from an NFT if they are associated. 
+	/// Remove a Base ID from an NFT if they are associated.
 	/// The Base itself is deleted if the number of associated NFTs reaches 0.
 	fn remove_associated_base_id(
 		collection_id: CollectionId,
modifiedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-equip/src/lib.rs
+++ b/pallets/proxy-rmrk-equip/src/lib.rs
@@ -52,41 +52,41 @@
 //! - FAQ: <https://coda.io/@rmrk/faq>
 //! - Substrate code repository: <https://github.com/rmrk-team/rmrk-substrate>
 //! - RMRK spec repository: <https://github.com/rmrk-team/rmrk-spec>
-//! 
+//!
 //! ## Terminology
-//! 
+//!
 //! For more information on RMRK, see RMRK's own documentation.
-//! 
+//!
 //! ### Intro to RMRK
-//! 
-//! - **Resource:** Additional piece of metadata of an NFT usually serving to add 
-//! a piece of media on top of the root metadata (NFT's own), be it a different wing 
+//!
+//! - **Resource:** Additional piece of metadata of an NFT usually serving to add
+//! a piece of media on top of the root metadata (NFT's own), be it a different wing
 //! on the root template bird or something entirely unrelated.
-//! 
-//! - **Base:** A list of possible "components" - Parts, a combination of which can 
+//!
+//! - **Base:** A list of possible "components" - Parts, a combination of which can
 //! be appended/equipped to/on an NFT.
-//! 
-//! - **Part:** Something that, together with other Parts, can constitute an NFT. 
-//! Parts are defined in the Base to which they belong. Parts can be either 
+//!
+//! - **Part:** Something that, together with other Parts, can constitute an NFT.
+//! Parts are defined in the Base to which they belong. Parts can be either
 //! of the `slot` type or `fixed` type. Slots are intended for equippables.
-//! Note that "part of something" and "Part of a Base" can be easily confused, 
+//! Note that "part of something" and "Part of a Base" can be easily confused,
 //! and in this documentation these words are distinguished by the capital letter.
-//! 
-//! - **Theme:** Named objects of variable => value pairs which get interpolated into 
-//! the Base's `themable` Parts. Themes can hold any value, but are often represented 
+//!
+//! - **Theme:** Named objects of variable => value pairs which get interpolated into
+//! the Base's `themable` Parts. Themes can hold any value, but are often represented
 //! in RMRK's examples as colors applied to visible Parts.
-//! 
+//!
 //! ### Peculiarities in Unique
-//! 
-//! - **Scoped properties:** Properties that are normally obscured from users. 
-//! Their purpose is to contain structured metadata that was not included in the Unique standard 
-//! for collections and tokens, meant to be operated on by proxies and other outliers. 
-//! Scoped properties are prefixed with `some-scope:`, where `some-scope` is 
-//! an arbitrary keyword, like "rmrk", and `:` is an unacceptable symbol in user-defined 
+//!
+//! - **Scoped properties:** Properties that are normally obscured from users.
+//! Their purpose is to contain structured metadata that was not included in the Unique standard
+//! for collections and tokens, meant to be operated on by proxies and other outliers.
+//! Scoped properties are prefixed with `some-scope:`, where `some-scope` is
+//! an arbitrary keyword, like "rmrk", and `:` is an unacceptable symbol in user-defined
 //! properties, which, along with other safeguards, makes them impossible to tamper with.
-//! 
-//! - **Auxiliary properties:** A slightly different structure of properties, 
-//! trading universality of use for more convenient storage, writes and access. 
+//!
+//! - **Auxiliary properties:** A slightly different structure of properties,
+//! trading universality of use for more convenient storage, writes and access.
 //! Meant to be inaccessible to end users.
 //!
 //! ## Proxy Implementation
@@ -121,8 +121,7 @@
 //! RMRK introduces the concept of a Base, which is a catalgoue of Parts,
 //! possible components of an NFT. Due to its similarity with the functionality
 //! of a token collection, a Base is stored and handled as one, and the Base's Parts and Themes
-//! are the collection's NFTs. See [`CollectionType`](pallet_rmrk_core::misc::CollectionType) and
-//! [`NftType`](pallet_rmrk_core::misc::NftType).
+//! are the collection's NFTs. See [`CollectionType`] and [`NftType`].
 //!
 //! ## Interface
 //!
@@ -415,7 +414,7 @@
 }
 
 impl<T: Config> Pallet<T> {
-	/// Create or renew an NFT serving as a Part.
+	/// Create or renew an NFT serving as a Part inside a collection serving as a Base.
 	fn create_part(
 		sender: &T::CrossAccountId,
 		collection: &NonfungibleHandle<T>,
modifiedprimitives/rmrk-traits/src/resource.rsdiffbeforeafterboth
before · primitives/rmrk-traits/src/resource.rs
1// Copyright (C) 2021-2022 RMRK2// This file is part of rmrk-substrate.3// License: Apache 2.0 modified by RMRK, see https://github.com/rmrk-team/rmrk-substrate/blob/main/LICENSE45use codec::{Decode, Encode, MaxEncodedLen};6use scale_info::TypeInfo;78#[cfg(feature = "std")]9use serde::Serialize;1011#[cfg(feature = "std")]12use crate::serialize;1314use crate::primitives::*;1516#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]17#[cfg_attr(feature = "std", derive(Serialize))]18#[cfg_attr(feature = "std", serde(bound = "BoundedString: AsRef<[u8]>"))]19pub struct BasicResource<BoundedString> {20	/// If the resource is Media, the base property is absent. Media src should be a URI like an21	/// IPFS hash.22	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]23	pub src: Option<BoundedString>,2425	/// Reference to IPFS location of metadata26	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]27	pub metadata: Option<BoundedString>,2829	/// Optional location or identier of license30	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]31	pub license: Option<BoundedString>,3233	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given34	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is35	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns36	/// another bird, showing the full render of one bird inside the other's inventory might be a37	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an38	/// image that is lighter and faster to load but representative of this resource.39	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]40	pub thumb: Option<BoundedString>,41}4243#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]44#[cfg_attr(feature = "std", derive(Serialize))]45#[cfg_attr(46	feature = "std",47	serde(bound = r#"48			BoundedString: AsRef<[u8]>,49			BoundedParts: AsRef<[PartId]>50		"#)51)]52pub struct ComposableResource<BoundedString, BoundedParts> {53	/// If a resource is composed, it will have an array of parts that compose it54	#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]55	pub parts: BoundedParts,5657	/// A Base is uniquely identified by the combination of the word `base`, its minting block58	/// number, and user provided symbol during Base creation, glued by dashes `-`, e.g.59	/// base-4477293-kanaria_superbird.60	pub base: BaseId,6162	/// If the resource is Media, the base property is absent. Media src should be a URI like an63	/// IPFS hash.64	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]65	pub src: Option<BoundedString>,6667	/// Reference to IPFS location of metadata68	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]69	pub metadata: Option<BoundedString>,7071	/// If the resource has the slot property, it was designed to fit into a specific Base's slot.72	/// The baseslot will be composed of two dot-delimited values, like so:73	/// "base-4477293-kanaria_superbird.machine_gun_scope". This means: "This resource is74	/// compatible with the machine_gun_scope slot of base base-4477293-kanaria_superbird7576	/// Optional location or identier of license77	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]78	pub license: Option<BoundedString>,7980	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given81	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is82	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns83	/// another bird, showing the full render of one bird inside the other's inventory might be a84	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an85	/// image that is lighter and faster to load but representative of this resource.86	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]87	pub thumb: Option<BoundedString>,88}8990#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]91#[cfg_attr(feature = "std", derive(Serialize))]92#[cfg_attr(feature = "std", serde(bound = "BoundedString: AsRef<[u8]>"))]93pub struct SlotResource<BoundedString> {94	/// A Base is uniquely identified by the combination of the word `base`, its minting block95	/// number, and user provided symbol during Base creation, glued by dashes `-`, e.g.96	/// base-4477293-kanaria_superbird.97	pub base: BaseId,9899	/// If the resource is Media, the base property is absent. Media src should be a URI like an100	/// IPFS hash.101	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]102	pub src: Option<BoundedString>,103104	/// Reference to IPFS location of metadata105	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]106	pub metadata: Option<BoundedString>,107108	/// If the resource has the slot property, it was designed to fit into a specific Base's slot.109	/// The baseslot will be composed of two dot-delimited values, like so:110	/// "base-4477293-kanaria_superbird.machine_gun_scope". This means: "This resource is111	/// compatible with the machine_gun_scope slot of base base-4477293-kanaria_superbird112	pub slot: SlotId,113114	/// The license field, if present, should contain a link to a license (IPFS or static HTTP115	/// url), or an identifier, like RMRK_nocopy or ipfs://ipfs/someHashOfLicense.116	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]117	pub license: Option<BoundedString>,118119	/// If the resource has the thumb property, this will be a URI to a thumbnail of the given120	/// resource. For example, if we have a composable NFT like a Kanaria bird, the resource is121	/// complex and too detailed to show in a search-results page or a list. Also, if a bird owns122	/// another bird, showing the full render of one bird inside the other's inventory might be a123	/// bit of a strain on the browser. For this reason, the thumb value can contain a URI to an124	/// image that is lighter and faster to load but representative of this resource.125	#[cfg_attr(feature = "std", serde(with = "serialize::opt_vec"))]126	pub thumb: Option<BoundedString>,127}128129#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]130#[cfg_attr(feature = "std", derive(Serialize))]131#[cfg_attr(132	feature = "std",133	serde(bound = r#"134			BoundedString: AsRef<[u8]>,135			BoundedParts: AsRef<[PartId]>136		"#)137)]138pub enum ResourceTypes<BoundedString, BoundedParts> {139	Basic(BasicResource<BoundedString>),140	Composable(ComposableResource<BoundedString, BoundedParts>),141	Slot(SlotResource<BoundedString>),142}143144#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]145#[cfg_attr(feature = "std", derive(Serialize))]146#[cfg_attr(147	feature = "std",148	serde(bound = r#"149			BoundedString: AsRef<[u8]>,150			BoundedParts: AsRef<[PartId]>151		"#)152)]153pub struct ResourceInfo<BoundedString, BoundedParts> {154	/// ID a unique identifier for a resource across all those of a single NFT.155	/// The combination of a collection ID, an NFT ID, and the resource ID must be 156	/// unique across the entire RMRK ecosystem.157	//#[cfg_attr(feature = "std", serde(with = "serialize::vec"))]158	pub id: ResourceId,159160	/// Resource type and the accordingly structured data stored161	pub resource: ResourceTypes<BoundedString, BoundedParts>,162163	/// If resource is sent to non-rootowned NFT, pending will be false and need to be accepted164	pub pending: bool,165166	/// If resource removal request is sent by non-rootowned NFT, pending will be true and need to be accepted167	pub pending_removal: bool,168}