difftreelog
Merge pull request #427 from UniqueNetwork/doc/architectural-changes
in: master
19 files changed
client/rpc/src/lib.rsdiffbeforeafterboth--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -42,6 +42,7 @@
#[rpc(server)]
#[async_trait]
pub trait UniqueApi<BlockHash, CrossAccountId, AccountId> {
+ /// Get tokens owned by account.
#[method(name = "unique_accountTokens")]
fn account_tokens(
&self,
@@ -49,12 +50,16 @@
account: CrossAccountId,
at: Option<BlockHash>,
) -> Result<Vec<TokenId>>;
+
+ /// Get tokens contained within a collection.
#[method(name = "unique_collectionTokens")]
fn collection_tokens(
&self,
collection: CollectionId,
at: Option<BlockHash>,
) -> Result<Vec<TokenId>>;
+
+ /// Check if the token exists.
#[method(name = "unique_tokenExists")]
fn token_exists(
&self,
@@ -63,6 +68,7 @@
at: Option<BlockHash>,
) -> Result<bool>;
+ /// Get the token owner.
#[method(name = "unique_tokenOwner")]
fn token_owner(
&self,
@@ -80,6 +86,7 @@
at: Option<BlockHash>,
) -> Result<Vec<CrossAccountId>>;
+ /// Get the topmost token owner in the hierarchy of a possibly nested token.
#[method(name = "unique_topmostTokenOwner")]
fn topmost_token_owner(
&self,
@@ -87,6 +94,8 @@
token: TokenId,
at: Option<BlockHash>,
) -> Result<Option<CrossAccountId>>;
+
+ /// Get tokens nested directly into the token.
#[method(name = "unique_tokenChildren")]
fn token_children(
&self,
@@ -95,6 +104,7 @@
at: Option<BlockHash>,
) -> Result<Vec<TokenChild>>;
+ /// Get collection properties, optionally limited to the provided keys.
#[method(name = "unique_collectionProperties")]
fn collection_properties(
&self,
@@ -103,6 +113,7 @@
at: Option<BlockHash>,
) -> Result<Vec<Property>>;
+ /// Get token properties, optionally limited to the provided keys.
#[method(name = "unique_tokenProperties")]
fn token_properties(
&self,
@@ -112,6 +123,7 @@
at: Option<BlockHash>,
) -> Result<Vec<Property>>;
+ /// Get property permissions, optionally limited to the provided keys.
#[method(name = "unique_propertyPermissions")]
fn property_permissions(
&self,
@@ -120,6 +132,7 @@
at: Option<BlockHash>,
) -> Result<Vec<PropertyKeyPermission>>;
+ /// Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT.
#[method(name = "unique_tokenData")]
fn token_data(
&self,
@@ -129,8 +142,11 @@
at: Option<BlockHash>,
) -> Result<TokenData<CrossAccountId>>;
+ /// Get the amount of distinctive tokens present in a collection.
#[method(name = "unique_totalSupply")]
fn total_supply(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<u32>;
+
+ /// Get the amount of any user tokens owned by an account.
#[method(name = "unique_accountBalance")]
fn account_balance(
&self,
@@ -138,6 +154,8 @@
account: CrossAccountId,
at: Option<BlockHash>,
) -> Result<u32>;
+
+ /// Get the amount of a specific token owned by an account.
#[method(name = "unique_balance")]
fn balance(
&self,
@@ -146,6 +164,8 @@
token: TokenId,
at: Option<BlockHash>,
) -> Result<String>;
+
+ /// Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor.
#[method(name = "unique_allowance")]
fn allowance(
&self,
@@ -156,18 +176,23 @@
at: Option<BlockHash>,
) -> Result<String>;
+ /// Get the list of admin accounts of a collection.
#[method(name = "unique_adminlist")]
fn adminlist(
&self,
collection: CollectionId,
at: Option<BlockHash>,
) -> Result<Vec<CrossAccountId>>;
+
+ /// Get the list of accounts allowed to operate within a collection.
#[method(name = "unique_allowlist")]
fn allowlist(
&self,
collection: CollectionId,
at: Option<BlockHash>,
) -> Result<Vec<CrossAccountId>>;
+
+ /// Check if a user is allowed to operate within a collection.
#[method(name = "unique_allowed")]
fn allowed(
&self,
@@ -175,17 +200,24 @@
user: CrossAccountId,
at: Option<BlockHash>,
) -> Result<bool>;
+
+ /// Get the last token ID created in a collection.
#[method(name = "unique_lastTokenId")]
fn last_token_id(&self, collection: CollectionId, at: Option<BlockHash>) -> Result<TokenId>;
+
+ /// Get collection info by the specified ID.
#[method(name = "unique_collectionById")]
fn collection_by_id(
&self,
collection: CollectionId,
at: Option<BlockHash>,
) -> Result<Option<RpcCollection<AccountId>>>;
+
+ /// Get chain stats about collections.
#[method(name = "unique_collectionStats")]
fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;
+ /// Get the number of blocks until sponsoring a transaction is available.
#[method(name = "unique_nextSponsored")]
fn next_sponsored(
&self,
@@ -195,6 +227,7 @@
at: Option<BlockHash>,
) -> Result<Option<u64>>;
+ /// Get effective collection limits. If not explicitly set, get the chain defaults.
#[method(name = "unique_effectiveCollectionLimits")]
fn effective_collection_limits(
&self,
@@ -202,6 +235,7 @@
at: Option<BlockHash>,
) -> Result<Option<CollectionLimits>>;
+ /// Get the total amount of pieces of an RFT.
#[method(name = "unique_totalPieces")]
fn total_pieces(
&self,
@@ -228,20 +262,20 @@
Theme,
>
{
+ /// Get the latest created collection ID.
#[method(name = "rmrk_lastCollectionIdx")]
- /// Get the latest created collection id
fn last_collection_idx(&self, at: Option<BlockHash>) -> Result<RmrkCollectionId>;
+ /// Get collection info by ID.
#[method(name = "rmrk_collectionById")]
- /// Get collection by id
fn collection_by_id(
&self,
id: RmrkCollectionId,
at: Option<BlockHash>,
) -> Result<Option<CollectionInfo>>;
+ /// Get NFT info by collection and NFT IDs.
#[method(name = "rmrk_nftById")]
- /// Get NFT by collection id and NFT id
fn nft_by_id(
&self,
collection_id: RmrkCollectionId,
@@ -249,8 +283,8 @@
at: Option<BlockHash>,
) -> Result<Option<NftInfo>>;
+ /// Get tokens owned by an account in a collection.
#[method(name = "rmrk_accountTokens")]
- /// Get tokens owned by an account in a collection
fn account_tokens(
&self,
account_id: AccountId,
@@ -258,8 +292,8 @@
at: Option<BlockHash>,
) -> Result<Vec<RmrkNftId>>;
+ /// Get tokens nested in an NFT - its direct children (not the children's children).
#[method(name = "rmrk_nftChildren")]
- /// Get NFT children
fn nft_children(
&self,
collection_id: RmrkCollectionId,
@@ -267,8 +301,8 @@
at: Option<BlockHash>,
) -> Result<Vec<RmrkNftChild>>;
+ /// Get collection properties, created by the user - not the proxy-specific properties.
#[method(name = "rmrk_collectionProperties")]
- /// Get collection properties
fn collection_properties(
&self,
collection_id: RmrkCollectionId,
@@ -276,8 +310,8 @@
at: Option<BlockHash>,
) -> Result<Vec<PropertyInfo>>;
+ /// Get NFT properties, created by the user - not the proxy-specific properties.
#[method(name = "rmrk_nftProperties")]
- /// Get NFT properties
fn nft_properties(
&self,
collection_id: RmrkCollectionId,
@@ -286,8 +320,8 @@
at: Option<BlockHash>,
) -> Result<Vec<PropertyInfo>>;
+ /// Get data of resources of an NFT.
#[method(name = "rmrk_nftResources")]
- /// Get NFT resources
fn nft_resources(
&self,
collection_id: RmrkCollectionId,
@@ -295,8 +329,8 @@
at: Option<BlockHash>,
) -> Result<Vec<ResourceInfo>>;
+ /// Get the priority of a resource in an NFT.
#[method(name = "rmrk_nftResourcePriority")]
- /// Get NFT resource priority
fn nft_resource_priority(
&self,
collection_id: RmrkCollectionId,
@@ -305,14 +339,15 @@
at: Option<BlockHash>,
) -> Result<Option<u32>>;
+ /// Get base info by its ID.
#[method(name = "rmrk_base")]
- /// Get base info
fn base(&self, base_id: RmrkBaseId, at: Option<BlockHash>) -> Result<Option<BaseInfo>>;
+ /// Get all parts of a base.
#[method(name = "rmrk_baseParts")]
- /// Get all Base's parts
fn base_parts(&self, base_id: RmrkBaseId, at: Option<BlockHash>) -> Result<Vec<PartType>>;
+ /// Get the theme names belonging to a base.
#[method(name = "rmrk_themeNames")]
fn theme_names(
&self,
@@ -320,6 +355,7 @@
at: Option<BlockHash>,
) -> Result<Vec<RmrkThemeName>>;
+ /// Get theme info, including properties, optionally limited to the provided keys.
#[method(name = "rmrk_themes")]
fn theme(
&self,
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -441,7 +441,7 @@
u128,
),
- /// The colletion property has been set.
+ /// The colletion property has been added or edited.
CollectionPropertySet(
/// Id of collection to which property has been set.
CollectionId,
@@ -457,7 +457,7 @@
PropertyKey,
),
- /// The token property has been set.
+ /// The token property has been added or edited.
TokenPropertySet(
/// Identifier of the collection whose token has the property set.
CollectionId,
@@ -477,9 +477,9 @@
PropertyKey,
),
- /// The colletion property permission has been set.
+ /// The token property permission of a collection has been set.
PropertyPermissionSet(
- /// Id of collection to which property permission has been set.
+ /// ID of collection to which property permission has been set.
CollectionId,
/// The property permission that was set.
PropertyKey,
@@ -524,26 +524,26 @@
/// Metadata flag frozen
MetadataFlagFrozen,
- /// Item not exists.
+ /// Item does not exist
TokenNotFound,
- /// Item balance not enough.
+ /// Item is balance not enough
TokenValueTooLow,
- /// Requested value more than approved.
+ /// Requested value is more than the approved
ApprovedValueTooLow,
/// Tried to approve more than owned
CantApproveMoreThanOwned,
/// Can't transfer tokens to ethereum zero address
AddressIsZero,
- /// Target collection doesn't supports this operation
+ /// Target collection doesn't support this operation
UnsupportedOperation,
- /// Not sufficient funds to perform action
+ /// Insufficient funds to perform an action
NotSufficientFounds,
- /// User not passed nesting rule
+ /// User does not satisfy the nesting rule
UserIsNotAllowedToNest,
- /// Only tokens from specific collections may nest tokens under this
+ /// Only tokens from specific collections may nest tokens under this one
SourceCollectionIsNotAllowedToNest,
/// Tried to store more data than allowed in collection field
@@ -558,7 +558,7 @@
/// Property key is too long
PropertyKeyIsTooLong,
- /// Only ASCII letters, digits, and '_', '-' are allowed
+ /// Only ASCII letters, digits, and symbols `_`, `-`, and `.` are allowed
InvalidCharacterInPropertyKey,
/// Empty property keys are forbidden
@@ -571,7 +571,7 @@
CollectionIsInternal,
}
- /// Storage of the count of created collections.
+ /// Storage of the count of created collections. Essentially contains the last collection ID.
#[pallet::storage]
pub type CreatedCollectionCount<T> = StorageValue<Value = CollectionId, QueryKind = ValueQuery>;
@@ -600,7 +600,7 @@
OnEmpty = up_data_structs::CollectionProperties,
>;
- /// Storage of collection properties permissions.
+ /// Storage of token property permissions of a collection.
#[pallet::storage]
#[pallet::getter(fn property_permissions)]
pub type CollectionPropertyPermissions<T> = StorageMap<
@@ -610,7 +610,7 @@
QueryKind = ValueQuery,
>;
- /// Storage of collection admins count.
+ /// Storage of the amount of collection admins.
#[pallet::storage]
pub type AdminAmount<T> = StorageMap<
Hasher = Blake2_128Concat,
@@ -619,7 +619,7 @@
QueryKind = ValueQuery,
>;
- /// List of collection admins
+ /// List of collection admins.
#[pallet::storage]
pub type IsAdmin<T: Config> = StorageNMap<
Key = (
@@ -630,7 +630,7 @@
QueryKind = ValueQuery,
>;
- /// Allowlisted collection users
+ /// Allowlisted collection users.
#[pallet::storage]
pub type Allowlist<T: Config> = StorageNMap<
Key = (
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -119,8 +119,7 @@
pub enum Error<T> {
/// Not Fungible item data used to mint in Fungible collection.
NotFungibleDataUsedToMintFungibleCollectionToken,
- /// Not default id passed as TokenId argument.
- /// The default value of TokenId for Fungible collection is 0.
+ /// Fungible tokens hold no ID, and the default value of TokenId for Fungible collection is 0.
FungibleItemsHaveNoId,
/// Tried to set data for fungible item.
FungibleItemsDontHaveData,
@@ -157,7 +156,7 @@
QueryKind = ValueQuery,
>;
- /// Storage for delegated assets.
+ /// Storage for assets delegated to a limited extent to other users.
#[pallet::storage]
pub type Allowance<T: Config> = StorageNMap<
Key = (
@@ -172,7 +171,6 @@
/// Wrapper around untyped collection handle, asserting inner collection is of fungible type.
/// Required for interaction with Fungible collections, type safety and implementation [`solidity_interface`][`evm_coder::solidity_interface`].
-
pub struct FungibleHandle<T: Config>(pallet_common::CollectionHandle<T>);
/// Implementation of methods required for dispatching during runtime.
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -21,7 +21,7 @@
//! - [`Config`]
//! - [`NonfungibleHandle`]
//! - [`Pallet`]
-//! - [`CommonWeights`]
+//! - [`CommonWeights`](common::CommonWeights)
//!
//! ## Overview
//!
@@ -130,6 +130,8 @@
pub type CreateItemData<T> = CreateNftExData<<T as pallet_evm::account::Config>::CrossAccountId>;
pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
+/// Token data, stored independently from other data used to describe it
+/// for the convenience of database access. Notably contains the owner account address.
#[struct_versioning::versioned(version = 2, upper)]
#[derive(Encode, Decode, TypeInfo, MaxEncodedLen)]
pub struct ItemData<CrossAccountId> {
@@ -176,17 +178,17 @@
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T>(_);
- /// Amount of tokens minted for collection.
+ /// Total amount of minted tokens in a collection.
#[pallet::storage]
pub type TokensMinted<T: Config> =
StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
- /// Amount of burnt tokens for collection.
+ /// Amount of burnt tokens in a collection.
#[pallet::storage]
pub type TokensBurnt<T: Config> =
StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
- /// Custom data serialized to bytes for token.
+ /// Token data, used to partially describe a token.
#[pallet::storage]
pub type TokenData<T: Config> = StorageNMap<
Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
@@ -194,7 +196,7 @@
QueryKind = OptionQuery,
>;
- /// Key-Value map stored for token.
+ /// Map of key-value pairs, describing the metadata of a token.
#[pallet::storage]
#[pallet::getter(fn token_properties)]
pub type TokenProperties<T: Config> = StorageNMap<
@@ -204,7 +206,14 @@
OnEmpty = up_data_structs::TokenProperties,
>;
- /// Custom data that is serialized to bytes and attached to a token property.
+ /// Custom data of a token that is serialized to bytes,
+ /// primarily reserved for on-chain operations,
+ /// normally obscured from the external users.
+ ///
+ /// Auxiliary properties are slightly different from
+ /// usual [`TokenProperties`] due to an unlimited number
+ /// and separately stored and written-to key-value pairs.
+ ///
/// Currently used to store RMRK data.
#[pallet::storage]
#[pallet::getter(fn token_aux_property)]
@@ -244,7 +253,7 @@
QueryKind = ValueQuery,
>;
- /// Amount of tokens owned by account.
+ /// Amount of tokens owned by an account in a collection.
#[pallet::storage]
pub type AccountBalance<T: Config> = StorageNMap<
Key = (
@@ -255,7 +264,7 @@
QueryKind = ValueQuery,
>;
- /// Allowance set by an owner for a spender for a token.
+ /// Allowance set by a token owner for another user to perform one of certain transactions on a token.
#[pallet::storage]
pub type Allowance<T: Config> = StorageNMap<
Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
@@ -263,6 +272,7 @@
QueryKind = OptionQuery,
>;
+ /// Upgrade from the old schema to properties.
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_runtime_upgrade() -> Weight {
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -21,7 +21,7 @@
//! - [`Config`]
//! - [`RefungibleHandle`]
//! - [`Pallet`]
-//! - [`CommonWeights`]
+//! - [`CommonWeights`](common::CommonWeights)
//!
//! ## Overview
//!
@@ -119,6 +119,8 @@
pub mod weights;
pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
+/// Token data, stored independently from other data used to describe it
+/// for the convenience of database access. Notably contains the token metadata.
#[struct_versioning::versioned(version = 2, upper)]
#[derive(Encode, Decode, Default, TypeInfo, MaxEncodedLen)]
pub struct ItemData {
@@ -143,13 +145,13 @@
pub enum Error<T> {
/// Not Refungible item data used to mint in Refungible collection.
NotRefungibleDataUsedToMintFungibleCollectionToken,
- /// Maximum refungibility exceeded
+ /// Maximum refungibility exceeded.
WrongRefungiblePieces,
- /// Refungible token can't be repartitioned by user who isn't owns all pieces
+ /// Refungible token can't be repartitioned by user who isn't owns all pieces.
RepartitionWhileNotOwningAllPieces,
- /// Refungible token can't nest other tokens
+ /// Refungible token can't nest other tokens.
RefungibleDisallowsNesting,
- /// Setting item properties is not allowed
+ /// Setting item properties is not allowed.
SettingPropertiesNotAllowed,
}
@@ -167,17 +169,17 @@
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T>(_);
- /// Amount of tokens minted for collection
+ /// Total amount of minted tokens in a collection.
#[pallet::storage]
pub type TokensMinted<T: Config> =
StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
- /// Amount of burnt tokens for collection
+ /// Amount of tokens burnt in a collection.
#[pallet::storage]
pub type TokensBurnt<T: Config> =
StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
- /// Custom data serialized to bytes for token
+ /// Token data, used to partially describe a token.
#[pallet::storage]
pub type TokenData<T: Config> = StorageNMap<
Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
@@ -185,6 +187,7 @@
QueryKind = ValueQuery,
>;
+ /// Amount of pieces a refungible token is split into.
#[pallet::storage]
#[pallet::getter(fn token_properties)]
pub type TokenProperties<T: Config> = StorageNMap<
@@ -202,7 +205,7 @@
QueryKind = ValueQuery,
>;
- /// Used to enumerate tokens owned by account
+ /// Used to enumerate tokens owned by account.
#[pallet::storage]
pub type Owned<T: Config> = StorageNMap<
Key = (
@@ -214,7 +217,7 @@
QueryKind = ValueQuery,
>;
- /// Amount of tokens owned by account
+ /// Amount of tokens (not pieces) partially owned by an account within a collection.
#[pallet::storage]
pub type AccountBalance<T: Config> = StorageNMap<
Key = (
@@ -226,7 +229,7 @@
QueryKind = ValueQuery,
>;
- /// Amount of token pieces owned by account
+ /// Amount of token pieces owned by account.
#[pallet::storage]
pub type Balance<T: Config> = StorageNMap<
Key = (
@@ -239,7 +242,7 @@
QueryKind = ValueQuery,
>;
- /// Allowance set by an owner for a spender for a token
+ /// Allowance set by a token owner for another user to perform one of certain transactions on a number of pieces of a token.
#[pallet::storage]
pub type Allowance<T: Config> = StorageNMap<
Key = (
pallets/scheduler/src/lib.rsdiffbeforeafterboth--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -24,7 +24,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// <http://www.apache.org/licenses/LICENSE-2.0>
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -50,7 +50,7 @@
//! Also possible to book a call with a certain frequency.
//!
//! Key differences from the original pallet:
-//! https://crates.io/crates/pallet-scheduler
+//! <https://crates.io/crates/pallet-scheduler>
//! Schedule Id restricted by 16 bytes. Identificator for booked call.
//! Priority limited by HARD DEADLINE (<= 63). Calls over maximum weight don't include to block.
//! The maximum weight that may be scheduled per block for any dispatchables of less priority than `schedule::HARD_DEADLINE`.
@@ -267,6 +267,7 @@
/// A Scheduler-Runtime interface for finer payment handling.
pub trait DispatchCall<T: frame_system::Config + Config, SelfContainedSignedInfo> {
+ /// Reserve (lock) the maximum spendings on a call, calculated from its weight and the repetition count.
fn reserve_balance(
id: ScheduledId,
sponsor: <T as frame_system::Config>::AccountId,
@@ -274,7 +275,7 @@
count: u32,
) -> Result<(), DispatchError>;
- /// Unlock centain amount from payer
+ /// Unreserve (unlock) a certain amount from the payer's reserved funds, returning the change.
fn pay_for_call(
id: ScheduledId,
sponsor: <T as frame_system::Config>::AccountId,
@@ -290,6 +291,7 @@
TransactionValidityError,
>;
+ /// Release unspent reserved funds in case of a schedule cancel.
fn cancel_reserve(
id: ScheduledId,
sponsor: <T as frame_system::Config>::AccountId,
@@ -494,9 +496,8 @@
Agenda::<T>::append(wake, Some(s));
}
}
- /// Weight should be 0, because transaction already paid
+ // Total weight should be 0, because the transaction is already paid for
0
- //total_weight
}
}
pallets/structure/src/lib.rsdiffbeforeafterboth--- a/pallets/structure/src/lib.rs
+++ b/pallets/structure/src/lib.rs
@@ -78,19 +78,19 @@
#[pallet::error]
pub enum Error<T> {
- /// While searched for owner, got already checked account
+ /// While nesting, encountered an already checked account, detecting a loop.
OuroborosDetected,
- /// While searched for owner, encountered depth limit
+ /// While nesting, reached the depth limit of nesting, exceeding the provided budget.
DepthLimit,
- /// While iterating over children, encountered breadth limit
+ /// While nesting, reached the breadth limit of nesting, exceeding the provided budget.
BreadthLimit,
- /// While searched for owner, found token owner by not-yet-existing token
+ /// Couldn't find the token owner that is itself a token.
TokenNotFound,
}
#[pallet::event]
pub enum Event<T> {
- /// Executed call on behalf of token
+ /// Executed call on behalf of the token.
Executed(DispatchResult),
}
@@ -126,11 +126,11 @@
#[derive(PartialEq)]
pub enum Parent<CrossAccountId> {
- /// Token owned by normal account
+ /// Token owned by a normal account.
User(CrossAccountId),
- /// Passed token not found
+ /// Could not find the token provided as the owner.
TokenNotFound,
- /// Token owner is another token (target token still may not exist)
+ /// Token owner is another token (still, the target token may not exist).
Token(CollectionId, TokenId),
}
pallets/unique/src/eth/mod.rsdiffbeforeafterboth--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+//! Implementation of CollectionHelpers contract.
+
use core::marker::PhantomData;
use evm_coder::{execution::*, generate_stubgen, solidity_interface, weight, types::*};
use ethereum as _;
@@ -33,7 +35,8 @@
use sp_std::vec::Vec;
use alloc::format;
-struct EvmCollectionHelpers<T: Config>(SubstrateRecorder<T>);
+/// See [`CollectionHelpersCall`]
+pub struct EvmCollectionHelpers<T: Config>(SubstrateRecorder<T>);
impl<T: Config> WithRecorder<T> for EvmCollectionHelpers<T> {
fn recorder(&self) -> &SubstrateRecorder<T> {
&self.0
@@ -44,8 +47,14 @@
}
}
+/// @title Contract, which allows users to operate with collections
#[solidity_interface(name = "CollectionHelpers", events(CollectionHelpersEvents))]
impl<T: Config + pallet_nonfungible::Config> EvmCollectionHelpers<T> {
+ /// Create an NFT collection
+ /// @param name Name of the collection
+ /// @param description Informative description of the collection
+ /// @param token_prefix Token prefix to represent the collection tokens in UI and user applications
+ /// @return address Address of the newly created collection
#[weight(<SelfWeightOf<T>>::create_collection())]
fn create_nonfungible_collection(
&mut self,
@@ -100,6 +109,9 @@
Ok(address)
}
+ /// Check if a collection exists
+ /// @param collection_address Address of the collection in question
+ /// @return bool Does the collection exist?
fn is_collection_exist(&self, _caller: caller, collection_address: address) -> Result<bool> {
if let Some(id) = pallet_common::eth::map_eth_to_id(&collection_address) {
let collection_id = id;
@@ -110,6 +122,7 @@
}
}
+/// Implements [`OnMethodCall`], which delegates call to [`EvmCollectionHelpers`]
pub struct CollectionHelpersOnMethodCall<T: Config>(PhantomData<*const T>);
impl<T: Config + pallet_nonfungible::Config> OnMethodCall<T> for CollectionHelpersOnMethodCall<T> {
fn is_reserved(contract: &sp_core::H160) -> bool {
pallets/unique/src/lib.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! # Unique Pallet18//!19//! A pallet governing Unique transactions.20//!21//! - [`Config`]22//! - [`Call`]23//! - [`Pallet`]24//!25//! ## Overview26//!27//! The Unique pallet's purpose is to be the primary interface between28//! external users and the inner structure of the Unique chains.29//!30//! It also contains an implementation of [`CollectionHelpers`][`eth`],31//! an Ethereum contract dealing with collection operations.32//!33//! ## Interface34//!35//! ### Dispatchables36//!37//! - `create_collection` - Create a collection of tokens. **Deprecated**, use `create_collection_ex`.38//! - `create_collection_ex` - Create a collection of tokens with explicit parameters.39//! - `destroy_collection` - Destroy a collection if no tokens exist within.40//! - `add_to_allow_list` - Add an address to allow list.41//! - `remove_from_allow_list` - Remove an address from allow list.42//! - `change_collection_owner` - Change the owner of the collection.43//! - `add_collection_admin` - Add an admin to a collection.44//! - `remove_collection_admin` - Remove admin of a collection.45//! - `set_collection_sponsor` - Invite a new collection sponsor.46//! - `confirm_sponsorship` - Confirm own sponsorship of a collection, becoming the sponsor.47//! - `remove_collection_sponsor` - Remove a sponsor from a collection.48//! - `create_item` - Create an item within a collection.49//! - `create_multiple_items` - Create multiple items within a collection.50//! - `set_collection_properties` - Add or change collection properties.51//! - `delete_collection_properties` - Delete specified collection properties.52//! - `set_token_properties` - Add or change token properties.53//! - `delete_token_properties` - Delete token properties.54//! - `set_token_property_permissions` - Add or change token property permissions of a collection.55//! - `create_multiple_items_ex` - Create multiple items within a collection with explicitly specified initial parameters.56//! - `set_transfers_enabled_flag` - Completely allow or disallow transfers for a particular collection.57//! - `burn_item` - Destroy an item.58//! - `burn_from` - Destroy an item on behalf of the owner as a non-owner account.59//! - `transfer` - Change ownership of the token.60//! - `transfer_from` - Change ownership of the token on behalf of the owner as a non-owner account.61//! - `approve` - Allow a non-permissioned address to transfer or burn an item.62//! - `set_collection_limits` - Set specific limits of a collection.63//! - `set_collection_permissions` - Set specific permissions of a collection.64//! - `repartition` - Re-partition a refungible token, while owning all of its parts.166517#![recursion_limit = "1024"]66#![recursion_limit = "1024"]18#![cfg_attr(not(feature = "std"), no_std)]67#![cfg_attr(not(feature = "std"), no_std)]54pub mod weights;103pub mod weights;55use weights::WeightInfo;104use weights::WeightInfo;56105106/// Maximum number of levels of depth in the token nesting tree.57const NESTING_BUDGET: u32 = 5;107pub const NESTING_BUDGET: u32 = 5;5810859decl_error! {109decl_error! {60 /// Error for non-fungible-token module.110 /// Errors for the common Unique transactions.61 pub enum Error for Module<T: Config> {111 pub enum Error for Module<T: Config> {62 /// Decimal_points parameter must be lower than MAX_DECIMAL_POINTS constant, currently it is 30.112 /// Decimal_points parameter must be lower than [`up_data_structs::MAX_DECIMAL_POINTS`].63 CollectionDecimalPointLimitExceeded,113 CollectionDecimalPointLimitExceeded,64 /// This address is not set as sponsor, use setCollectionSponsor first.114 /// This address is not set as sponsor, use setCollectionSponsor first.65 ConfirmUnsetSponsorFail,115 ConfirmUnsetSponsorFail,66 /// Length of items properties must be greater than 0.116 /// Length of items properties must be greater than 0.67 EmptyArgument,117 EmptyArgument,68 /// Repertition is only supported by refungible collection118 /// Repertition is only supported by refungible collection.69 RepartitionCalledOnNonRefungibleCollection,119 RepartitionCalledOnNonRefungibleCollection,70 }120 }71}121}72122123/// Configuration trait of this pallet.73pub trait Config: system::Config + pallet_common::Config + Sized + TypeInfo {124pub trait Config: system::Config + pallet_common::Config + Sized + TypeInfo {125 /// Overarching event type.74 type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;126 type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;7512776 /// Weight information for extrinsics in this pallet.128 /// Weight information for extrinsics in this pallet.77 type WeightInfo: WeightInfo;129 type WeightInfo: WeightInfo;130131 /// Weight information for common pallet operations.78 type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;132 type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;133134 /// Weight info information for extra refungible pallet operations.79 type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo;135 type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo;80}136}8113788 /// Collection sponsor was removed144 /// Collection sponsor was removed89 ///145 ///90 /// # Arguments146 /// # Arguments91 ///92 /// * collection_id: Globally unique collection identifier.147 /// * collection_id: ID of the affected collection.93 CollectionSponsorRemoved(CollectionId),148 CollectionSponsorRemoved(CollectionId),9414995 /// Collection admin was added150 /// Collection admin was added96 ///151 ///97 /// # Arguments152 /// # Arguments98 ///99 /// * collection_id: Globally unique collection identifier.153 /// * collection_id: ID of the affected collection.100 ///101 /// * admin: Admin address.154 /// * admin: Admin address.102 CollectionAdminAdded(CollectionId, CrossAccountId),155 CollectionAdminAdded(CollectionId, CrossAccountId),103156104 /// Collection owned was change157 /// Collection owned was changed105 ///158 ///106 /// # Arguments159 /// # Arguments107 ///108 /// * collection_id: Globally unique collection identifier.160 /// * collection_id: ID of the affected collection.109 ///110 /// * owner: New owner address.161 /// * owner: New owner address.111 CollectionOwnedChanged(CollectionId, AccountId),162 CollectionOwnedChanged(CollectionId, AccountId),112163113 /// Collection sponsor was set164 /// Collection sponsor was set114 ///165 ///115 /// # Arguments166 /// # Arguments116 ///117 /// * collection_id: Globally unique collection identifier.167 /// * collection_id: ID of the affected collection.118 ///119 /// * owner: New sponsor address.168 /// * owner: New sponsor address.120 CollectionSponsorSet(CollectionId, AccountId),169 CollectionSponsorSet(CollectionId, AccountId),121170122 /// New sponsor was confirm171 /// New sponsor was confirm123 ///172 ///124 /// # Arguments173 /// # Arguments125 ///126 /// * collection_id: Globally unique collection identifier.174 /// * collection_id: ID of the affected collection.127 ///128 /// * sponsor: New sponsor address.175 /// * sponsor: New sponsor address.129 SponsorshipConfirmed(CollectionId, AccountId),176 SponsorshipConfirmed(CollectionId, AccountId),130177131 /// Collection admin was removed178 /// Collection admin was removed132 ///179 ///133 /// # Arguments180 /// # Arguments134 ///135 /// * collection_id: Globally unique collection identifier.181 /// * collection_id: ID of the affected collection.136 ///137 /// * admin: Admin address.182 /// * admin: Removed admin address.138 CollectionAdminRemoved(CollectionId, CrossAccountId),183 CollectionAdminRemoved(CollectionId, CrossAccountId),139184140 /// Address was remove from allow list185 /// Address was removed from the allow list141 ///186 ///142 /// # Arguments187 /// # Arguments143 ///144 /// * collection_id: Globally unique collection identifier.188 /// * collection_id: ID of the affected collection.145 ///146 /// * user: Address.189 /// * user: Address of the removed account.147 AllowListAddressRemoved(CollectionId, CrossAccountId),190 AllowListAddressRemoved(CollectionId, CrossAccountId),148191149 /// Address was add to allow list192 /// Address was added to the allow list150 ///193 ///151 /// # Arguments194 /// # Arguments152 ///153 /// * collection_id: Globally unique collection identifier.195 /// * collection_id: ID of the affected collection.154 ///155 /// * user: Address.196 /// * user: Address of the added account.156 AllowListAddressAdded(CollectionId, CrossAccountId),197 AllowListAddressAdded(CollectionId, CrossAccountId),157198158 /// Collection limits was set199 /// Collection limits were set159 ///200 ///160 /// # Arguments201 /// # Arguments161 ///162 /// * collection_id: Globally unique collection identifier.202 /// * collection_id: ID of the affected collection.163 CollectionLimitSet(CollectionId),203 CollectionLimitSet(CollectionId),164204205 /// Collection permissions were set206 ///207 /// # Arguments208 /// * collection_id: ID of the affected collection.165 CollectionPermissionSet(CollectionId),209 CollectionPermissionSet(CollectionId),166 }210 }167}211}198 ChainVersion: u64;242 ChainVersion: u64;199 //#endregion243 //#endregion200244201 //#region Tokens transfer rate limit baskets245 //#region Tokens transfer sponosoring rate limit baskets202 /// (Collection id (controlled?2), who created (real))246 /// (Collection id (controlled?2), who created (real))203 /// TODO: Off chain worker should remove from this map when collection gets removed247 /// TODO: Off chain worker should remove from this map when collection gets removed204 pub CreateItemBasket get(fn create_item_basket): map hasher(blake2_128_concat) (CollectionId, T::AccountId) => Option<T::BlockNumber>;248 pub CreateItemBasket get(fn create_item_basket): map hasher(blake2_128_concat) (CollectionId, T::AccountId) => Option<T::BlockNumber>;214 /// Collection id (controlled?2), token id (controlled?2)258 /// Collection id (controlled?2), token id (controlled?2)215 #[deprecated]259 #[deprecated]216 pub VariableMetaDataBasket get(fn variable_meta_data_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;260 pub VariableMetaDataBasket get(fn variable_meta_data_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;261 /// Last sponsoring of token property setting // todo:doc rephrase this and the following217 pub TokenPropertyBasket get(fn token_property_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;262 pub TokenPropertyBasket get(fn token_property_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;218263219 /// Approval sponsoring264 /// Last sponsoring of NFT approval in a collection220 pub NftApproveBasket get(fn nft_approve_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;265 pub NftApproveBasket get(fn nft_approve_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId => Option<T::BlockNumber>;266 /// Last sponsoring of fungible tokens approval in a collection221 pub FungibleApproveBasket get(fn fungible_approve_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(twox_64_concat) T::AccountId => Option<T::BlockNumber>;267 pub FungibleApproveBasket get(fn fungible_approve_basket): double_map hasher(blake2_128_concat) CollectionId, hasher(twox_64_concat) T::AccountId => Option<T::BlockNumber>;268 /// Last sponsoring of RFT approval in a collection222 pub RefungibleApproveBasket get(fn refungible_approve_basket): nmap hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId, hasher(twox_64_concat) T::AccountId => Option<T::BlockNumber>;269 pub RefungibleApproveBasket get(fn refungible_approve_basket): nmap hasher(blake2_128_concat) CollectionId, hasher(blake2_128_concat) TokenId, hasher(twox_64_concat) T::AccountId => Option<T::BlockNumber>;223 }270 }224}271}225272226decl_module! {273decl_module! {274 /// Type alias to Pallet, to be used by construct_runtime.227 pub struct Module<T: Config> for enum Call275 pub struct Module<T: Config> for enum Call228 where276 where229 origin: T::Origin277 origin: T::Origin244 0292 0245 }293 }246294247 /// This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner of the collection is set to the address that signed the transaction and can be changed later.295 /// Create a collection of tokens.296 ///297 /// Each Token may have multiple properties encoded as an array of bytes298 /// of certain length. The initial owner of the collection is set299 /// to the address that signed the transaction and can be changed later.300 ///301 /// Prefer the more advanced [`create_collection_ex`][`Pallet::create_collection_ex`] instead.248 ///302 ///249 /// # Permissions303 /// # Permissions250 ///304 ///251 /// * Anyone.305 /// * Anyone - becomes the owner of the new collection.252 ///306 ///253 /// # Arguments307 /// # Arguments254 ///308 ///255 /// * collection_name: UTF-16 string with collection name (limit 64 characters), will be stored as zero-terminated.309 /// * `collection_name`: Wide-character string with collection name256 ///310 /// (limit [`MAX_COLLECTION_NAME_LENGTH`]).257 /// * collection_description: UTF-16 string with collection description (limit 256 characters), will be stored as zero-terminated.311 /// * `collection_description`: Wide-character string with collection description258 ///312 /// (limit [`MAX_COLLECTION_DESCRIPTION_LENGTH`]).259 /// * token_prefix: UTF-8 string with token prefix.313 /// * `token_prefix`: Byte string containing the token prefix to mark a collection260 ///314 /// to which a token belongs (limit [`MAX_TOKEN_PREFIX_LENGTH`]).261 /// * mode: [CollectionMode] collection type and type dependent data.315 /// * `mode`: Type of items stored in the collection and type dependent data.262 // returns collection ID316 // returns collection ID263 #[weight = <SelfWeightOf<T>>::create_collection()]317 #[weight = <SelfWeightOf<T>>::create_collection()]264 #[transactional]318 #[transactional]265 #[deprecated]319 #[deprecated(note = "`create_collection_ex` is more up-to-date and advanced, prefer it instead")]266 pub fn create_collection(origin,320 pub fn create_collection(321 origin,267 collection_name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,322 collection_name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,278 Self::create_collection_ex(origin, data)334 Self::create_collection_ex(origin, data)279 }335 }280336281 /// This method creates a collection337 /// Create a collection with explicit parameters.282 ///338 ///283 /// Prefer it to deprecated [`created_collection`] method339 /// Prefer it to the deprecated [`create_collection`][`Pallet::create_collection`] method.340 ///341 /// # Permissions342 ///343 /// * Anyone - becomes the owner of the new collection.344 ///345 /// # Arguments346 ///347 /// * `data`: Explicit data of a collection used for its creation.284 #[weight = <SelfWeightOf<T>>::create_collection()]348 #[weight = <SelfWeightOf<T>>::create_collection()]285 #[transactional]349 #[transactional]286 pub fn create_collection_ex(origin, data: CreateCollectionData<T::AccountId>) -> DispatchResult {350 pub fn create_collection_ex(origin, data: CreateCollectionData<T::AccountId>) -> DispatchResult {293 Ok(())357 Ok(())294 }358 }295359296 /// Destroys collection if no tokens within this collection360 /// Destroy a collection if no tokens exist within.297 ///361 ///298 /// # Permissions362 /// # Permissions299 ///363 ///300 /// * Collection Owner.364 /// * Collection owner301 ///365 ///302 /// # Arguments366 /// # Arguments303 ///367 ///304 /// * collection_id: collection to destroy.368 /// * `collection_id`: Collection to destroy.305 #[weight = <SelfWeightOf<T>>::destroy_collection()]369 #[weight = <SelfWeightOf<T>>::destroy_collection()]306 #[transactional]370 #[transactional]307 pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {371 pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {328 ///392 ///329 /// # Permissions393 /// # Permissions330 ///394 ///331 /// * Collection Owner395 /// * Collection owner332 /// * Collection Admin396 /// * Collection admin333 ///397 ///334 /// # Arguments398 /// # Arguments335 ///399 ///336 /// * collection_id.400 /// * `collection_id`: ID of the modified collection.337 ///401 /// * `address`: ID of the address to be added to the allowlist.338 /// * address.339 #[weight = <SelfWeightOf<T>>::add_to_allow_list()]402 #[weight = <SelfWeightOf<T>>::add_to_allow_list()]340 #[transactional]403 #[transactional]341 pub fn add_to_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{404 pub fn add_to_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{363 ///426 ///364 /// # Permissions427 /// # Permissions365 ///428 ///366 /// * Collection Owner429 /// * Collection owner367 /// * Collection Admin430 /// * Collection admin368 ///431 ///369 /// # Arguments432 /// # Arguments370 ///433 ///371 /// * collection_id.434 /// * `collection_id`: ID of the modified collection.372 ///435 /// * `address`: ID of the address to be removed from the allowlist.373 /// * address.374 #[weight = <SelfWeightOf<T>>::remove_from_allow_list()]436 #[weight = <SelfWeightOf<T>>::remove_from_allow_list()]375 #[transactional]437 #[transactional]376 pub fn remove_from_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{438 pub fn remove_from_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{398 ///460 ///399 /// # Permissions461 /// # Permissions400 ///462 ///401 /// * Collection Owner.463 /// * Collection owner402 ///464 ///403 /// # Arguments465 /// # Arguments404 ///466 ///405 /// * collection_id.467 /// * `collection_id`: ID of the modified collection.406 ///468 /// * `new_owner`: ID of the account that will become the owner.407 /// * new_owner.408 #[weight = <SelfWeightOf<T>>::change_collection_owner()]469 #[weight = <SelfWeightOf<T>>::change_collection_owner()]409 #[transactional]470 #[transactional]410 pub fn change_collection_owner(origin, collection_id: CollectionId, new_owner: T::AccountId) -> DispatchResult {471 pub fn change_collection_owner(origin, collection_id: CollectionId, new_owner: T::AccountId) -> DispatchResult {424 target_collection.save()485 target_collection.save()425 }486 }426487427 /// Adds an admin of the Collection.488 /// Add an admin to a collection.428 /// NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.489 ///490 /// NFT Collection can be controlled by multiple admin addresses491 /// (some which can also be servers, for example). Admins can issue492 /// and burn NFTs, as well as add and remove other admins,493 /// but cannot change NFT or Collection ownership.429 ///494 ///430 /// # Permissions495 /// # Permissions431 ///496 ///432 /// * Collection Owner.497 /// * Collection owner433 /// * Collection Admin.498 /// * Collection admin434 ///499 ///435 /// # Arguments500 /// # Arguments436 ///501 ///437 /// * collection_id: ID of the Collection to add admin for.502 /// * `collection_id`: ID of the Collection to add an admin for.438 ///439 /// * new_admin_id: Address of new admin to add.503 /// * `new_admin`: Address of new admin to add.440 #[weight = <SelfWeightOf<T>>::add_collection_admin()]504 #[weight = <SelfWeightOf<T>>::add_collection_admin()]441 #[transactional]505 #[transactional]442 pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin_id: T::CrossAccountId) -> DispatchResult {506 pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin: T::CrossAccountId) -> DispatchResult {443 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);507 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);444 let collection = <CollectionHandle<T>>::try_get(collection_id)?;508 let collection = <CollectionHandle<T>>::try_get(collection_id)?;445 collection.check_is_internal()?;509 collection.check_is_internal()?;446510447 <Pallet<T>>::deposit_event(Event::<T>::CollectionAdminAdded(511 <Pallet<T>>::deposit_event(Event::<T>::CollectionAdminAdded(448 collection_id,512 collection_id,449 new_admin_id.clone()513 new_admin.clone()450 ));514 ));451515452 <PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin_id, true)516 <PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin, true)453 }517 }454518455 /// Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.519 /// Remove admin of a collection.520 ///521 /// An admin address can remove itself. List of admins may become empty,522 /// in which case only Collection Owner will be able to add an Admin.456 ///523 ///457 /// # Permissions524 /// # Permissions458 ///525 ///459 /// * Collection Owner.526 /// * Collection owner460 /// * Collection Admin.527 /// * Collection admin461 ///528 ///462 /// # Arguments529 /// # Arguments463 ///530 ///464 /// * collection_id: ID of the Collection to remove admin for.531 /// * `collection_id`: ID of the collection to remove the admin for.465 ///466 /// * account_id: Address of admin to remove.532 /// * `account_id`: Address of the admin to remove.467 #[weight = <SelfWeightOf<T>>::remove_collection_admin()]533 #[weight = <SelfWeightOf<T>>::remove_collection_admin()]468 #[transactional]534 #[transactional]469 pub fn remove_collection_admin(origin, collection_id: CollectionId, account_id: T::CrossAccountId) -> DispatchResult {535 pub fn remove_collection_admin(origin, collection_id: CollectionId, account_id: T::CrossAccountId) -> DispatchResult {479 <PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)545 <PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)480 }546 }481547548 /// Set (invite) a new collection sponsor.549 ///550 /// If successful, confirmation from the sponsor-to-be will be pending.551 ///482 /// # Permissions552 /// # Permissions483 ///553 ///484 /// * Collection Owner554 /// * Collection owner555 /// * Collection admin485 ///556 ///486 /// # Arguments557 /// # Arguments487 ///558 ///488 /// * collection_id.559 /// * `collection_id`: ID of the modified collection.489 ///560 /// * `new_sponsor`: ID of the account of the sponsor-to-be.490 /// * new_sponsor.491 #[weight = <SelfWeightOf<T>>::set_collection_sponsor()]561 #[weight = <SelfWeightOf<T>>::set_collection_sponsor()]492 #[transactional]562 #[transactional]493 pub fn set_collection_sponsor(origin, collection_id: CollectionId, new_sponsor: T::AccountId) -> DispatchResult {563 pub fn set_collection_sponsor(origin, collection_id: CollectionId, new_sponsor: T::AccountId) -> DispatchResult {507 target_collection.save()577 target_collection.save()508 }578 }509579580 /// Confirm own sponsorship of a collection, becoming the sponsor.581 ///582 /// An invitation must be pending, see [`set_collection_sponsor`][`Pallet::set_collection_sponsor`].583 /// Sponsor can pay the fees of a transaction instead of the sender,584 /// but only within specified limits.585 ///510 /// # Permissions586 /// # Permissions511 ///587 ///512 /// * Sponsor.588 /// * Sponsor-to-be513 ///589 ///514 /// # Arguments590 /// # Arguments515 ///591 ///516 /// * collection_id.592 /// * `collection_id`: ID of the collection with the pending sponsor.517 #[weight = <SelfWeightOf<T>>::confirm_sponsorship()]593 #[weight = <SelfWeightOf<T>>::confirm_sponsorship()]518 #[transactional]594 #[transactional]519 pub fn confirm_sponsorship(origin, collection_id: CollectionId) -> DispatchResult {595 pub fn confirm_sponsorship(origin, collection_id: CollectionId) -> DispatchResult {534 target_collection.save()610 target_collection.save()535 }611 }536612537 /// Switch back to pay-per-own-transaction model.613 /// Remove a collection's a sponsor, making everyone pay for their own transactions.538 ///614 ///539 /// # Permissions615 /// # Permissions540 ///616 ///541 /// * Collection owner.617 /// * Collection owner542 ///618 ///543 /// # Arguments619 /// # Arguments544 ///620 ///545 /// * collection_id.621 /// * `collection_id`: ID of the collection with the sponsor to remove.546 #[weight = <SelfWeightOf<T>>::remove_collection_sponsor()]622 #[weight = <SelfWeightOf<T>>::remove_collection_sponsor()]547 #[transactional]623 #[transactional]548 pub fn remove_collection_sponsor(origin, collection_id: CollectionId) -> DispatchResult {624 pub fn remove_collection_sponsor(origin, collection_id: CollectionId) -> DispatchResult {560 target_collection.save()636 target_collection.save()561 }637 }562638563 /// This method creates a concrete instance of NFT Collection created with CreateCollection method.639 /// Mint an item within a collection.640 ///641 /// A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].564 ///642 ///565 /// # Permissions643 /// # Permissions566 ///644 ///567 /// * Collection Owner.645 /// * Collection owner568 /// * Collection Admin.646 /// * Collection admin569 /// * Anyone if647 /// * Anyone if570 /// * Allow List is enabled, and648 /// * Allow List is enabled, and571 /// * Address is added to allow list, and649 /// * Address is added to allow list, and572 /// * MintPermission is enabled (see SetMintPermission method)650 /// * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])573 ///651 ///574 /// # Arguments652 /// # Arguments575 ///653 ///576 /// * collection_id: ID of the collection.654 /// * `collection_id`: ID of the collection to which an item would belong.577 ///578 /// * owner: Address, initial owner of the NFT.655 /// * `owner`: Address of the initial owner of the item.579 ///580 /// * data: Token data to store on chain.656 /// * `data`: Token data describing the item to store on chain.581 #[weight = T::CommonWeightInfo::create_item()]657 #[weight = T::CommonWeightInfo::create_item()]582 #[transactional]658 #[transactional]583 pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResultWithPostInfo {659 pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResultWithPostInfo {587 dispatch_tx::<T, _>(collection_id, |d| d.create_item(sender, owner, data, &budget))663 dispatch_tx::<T, _>(collection_id, |d| d.create_item(sender, owner, data, &budget))588 }664 }589665590 /// This method creates multiple items in a collection created with CreateCollection method.666 /// Create multiple items within a collection.667 ///668 /// A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].591 ///669 ///592 /// # Permissions670 /// # Permissions593 ///671 ///594 /// * Collection Owner.672 /// * Collection owner595 /// * Collection Admin.673 /// * Collection admin596 /// * Anyone if674 /// * Anyone if597 /// * Allow List is enabled, and675 /// * Allow List is enabled, and598 /// * Address is added to allow list, and676 /// * Address is added to the allow list, and599 /// * MintPermission is enabled (see SetMintPermission method)677 /// * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])600 ///678 ///601 /// # Arguments679 /// # Arguments602 ///680 ///603 /// * collection_id: ID of the collection.681 /// * `collection_id`: ID of the collection to which the tokens would belong.604 ///605 /// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].606 ///607 /// * owner: Address, initial owner of the NFT.682 /// * `owner`: Address of the initial owner of the tokens.683 /// * `items_data`: Vector of data describing each item to be created.608 #[weight = T::CommonWeightInfo::create_multiple_items(&items_data)]684 #[weight = T::CommonWeightInfo::create_multiple_items(&items_data)]609 #[transactional]685 #[transactional]610 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResultWithPostInfo {686 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResultWithPostInfo {615 dispatch_tx::<T, _>(collection_id, |d| d.create_multiple_items(sender, owner, items_data, &budget))691 dispatch_tx::<T, _>(collection_id, |d| d.create_multiple_items(sender, owner, items_data, &budget))616 }692 }617693694 /// Add or change collection properties.695 ///696 /// # Permissions697 ///698 /// * Collection owner699 /// * Collection admin700 ///701 /// # Arguments702 ///703 /// * `collection_id`: ID of the modified collection.704 /// * `properties`: Vector of key-value pairs stored as the collection's metadata.705 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.618 #[weight = T::CommonWeightInfo::set_collection_properties(properties.len() as u32)]706 #[weight = T::CommonWeightInfo::set_collection_properties(properties.len() as u32)]619 #[transactional]707 #[transactional]620 pub fn set_collection_properties(708 pub fn set_collection_properties(629 dispatch_tx::<T, _>(collection_id, |d| d.set_collection_properties(sender, properties))717 dispatch_tx::<T, _>(collection_id, |d| d.set_collection_properties(sender, properties))630 }718 }631719720 /// Delete specified collection properties.721 ///722 /// # Permissions723 ///724 /// * Collection Owner725 /// * Collection Admin726 ///727 /// # Arguments728 ///729 /// * `collection_id`: ID of the modified collection.730 /// * `property_keys`: Vector of keys of the properties to be deleted.731 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.632 #[weight = T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32)]732 #[weight = T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32)]633 #[transactional]733 #[transactional]634 pub fn delete_collection_properties(734 pub fn delete_collection_properties(643 dispatch_tx::<T, _>(collection_id, |d| d.delete_collection_properties(&sender, property_keys))743 dispatch_tx::<T, _>(collection_id, |d| d.delete_collection_properties(&sender, property_keys))644 }744 }645745746 /// Add or change token properties according to collection's permissions.747 /// Currently properties only work with NFTs.748 ///749 /// # Permissions750 ///751 /// * Depends on collection's token property permissions and specified property mutability:752 /// * Collection owner753 /// * Collection admin754 /// * Token owner755 ///756 /// See [`set_token_property_permissions`][`Pallet::set_token_property_permissions`].757 ///758 /// # Arguments759 ///760 /// * `collection_id: ID of the collection to which the token belongs.761 /// * `token_id`: ID of the modified token.762 /// * `properties`: Vector of key-value pairs stored as the token's metadata.763 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.646 #[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]764 #[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]647 #[transactional]765 #[transactional]648 pub fn set_token_properties(766 pub fn set_token_properties(659 dispatch_tx::<T, _>(collection_id, |d| d.set_token_properties(sender, token_id, properties, &budget))777 dispatch_tx::<T, _>(collection_id, |d| d.set_token_properties(sender, token_id, properties, &budget))660 }778 }661779780 /// Delete specified token properties. Currently properties only work with NFTs.781 ///782 /// # Permissions783 ///784 /// * Depends on collection's token property permissions and specified property mutability:785 /// * Collection owner786 /// * Collection admin787 /// * Token owner788 ///789 /// # Arguments790 ///791 /// * `collection_id`: ID of the collection to which the token belongs.792 /// * `token_id`: ID of the modified token.793 /// * `property_keys`: Vector of keys of the properties to be deleted.794 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.662 #[weight = T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32)]795 #[weight = T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32)]663 #[transactional]796 #[transactional]664 pub fn delete_token_properties(797 pub fn delete_token_properties(675 dispatch_tx::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, property_keys, &budget))808 dispatch_tx::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, property_keys, &budget))676 }809 }677810811 /// Add or change token property permissions of a collection.812 ///813 /// Without a permission for a particular key, a property with that key814 /// cannot be created in a token.815 ///816 /// # Permissions817 ///818 /// * Collection owner819 /// * Collection admin820 ///821 /// # Arguments822 ///823 /// * `collection_id`: ID of the modified collection.824 /// * `property_permissions`: Vector of permissions for property keys.825 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.678 #[weight = T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32)]826 #[weight = T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32)]679 #[transactional]827 #[transactional]680 pub fn set_token_property_permissions(828 pub fn set_token_property_permissions(689 dispatch_tx::<T, _>(collection_id, |d| d.set_token_property_permissions(&sender, property_permissions))837 dispatch_tx::<T, _>(collection_id, |d| d.set_token_property_permissions(&sender, property_permissions))690 }838 }691839840 /// Create multiple items within a collection with explicitly specified initial parameters.841 ///842 /// # Permissions843 ///844 /// * Collection owner845 /// * Collection admin846 /// * Anyone if847 /// * Allow List is enabled, and848 /// * Address is added to allow list, and849 /// * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])850 ///851 /// # Arguments852 ///853 /// * `collection_id`: ID of the collection to which the tokens would belong.854 /// * `data`: Explicit item creation data.692 #[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]855 #[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]693 #[transactional]856 #[transactional]694 pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {857 pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {698 dispatch_tx::<T, _>(collection_id, |d| d.create_multiple_items_ex(sender, data, &budget))861 dispatch_tx::<T, _>(collection_id, |d| d.create_multiple_items_ex(sender, data, &budget))699 }862 }700863701 /// Set transfers_enabled value for particular collection864 /// Completely allow or disallow transfers for a particular collection.702 ///865 ///703 /// # Permissions866 /// # Permissions704 ///867 ///705 /// * Collection Owner.868 /// * Collection owner706 ///869 ///707 /// # Arguments870 /// # Arguments708 ///871 ///709 /// * collection_id: ID of the collection.872 /// * `collection_id`: ID of the collection.710 ///873 /// * `value`: New value of the flag, are transfers allowed?711 /// * value: New flag value.712 #[weight = <SelfWeightOf<T>>::set_transfers_enabled_flag()]874 #[weight = <SelfWeightOf<T>>::set_transfers_enabled_flag()]713 #[transactional]875 #[transactional]714 pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {876 pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {723 target_collection.save()885 target_collection.save()724 }886 }725887726 /// Destroys a concrete instance of NFT.888 /// Destroy an item.727 ///889 ///728 /// # Permissions890 /// # Permissions729 ///891 ///730 /// * Collection Owner.892 /// * Collection owner731 /// * Collection Admin.893 /// * Collection admin732 /// * Current NFT Owner.894 /// * Current item owner733 ///895 ///734 /// # Arguments896 /// # Arguments735 ///897 ///736 /// * collection_id: ID of the collection.898 /// * `collection_id`: ID of the collection to which the item belongs.737 ///738 /// * item_id: ID of NFT to burn.899 /// * `item_id`: ID of item to burn.900 /// * `value`: Number of pieces of the item to destroy.901 /// * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.902 /// * Fungible Mode: The desired number of pieces to burn.903 /// * Re-Fungible Mode: The desired number of pieces to burn.739 #[weight = T::CommonWeightInfo::burn_item()]904 #[weight = T::CommonWeightInfo::burn_item()]740 #[transactional]905 #[transactional]741 pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {906 pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {752 Ok(post_info)917 Ok(post_info)753 }918 }754919755 /// Destroys a concrete instance of NFT on behalf of the owner920 /// Destroy a token on behalf of the owner as a non-owner account.921 ///756 /// See also: [`approve`]922 /// See also: [`approve`][`Pallet::approve`].923 ///924 /// After this method executes, one approval is removed from the total so that925 /// the approved address will not be able to transfer this item again from this owner.757 ///926 ///758 /// # Permissions927 /// # Permissions759 ///928 ///760 /// * Collection Owner.929 /// * Collection owner761 /// * Collection Admin.930 /// * Collection admin762 /// * Current NFT Owner.931 /// * Current token owner932 /// * Address approved by current item owner763 ///933 ///764 /// # Arguments934 /// # Arguments765 ///935 ///936 /// * `from`: The owner of the burning item.766 /// * collection_id: ID of the collection.937 /// * `collection_id`: ID of the collection to which the item belongs.767 ///768 /// * item_id: ID of NFT to burn.938 /// * `item_id`: ID of item to burn.769 ///939 /// * `value`: Number of pieces to burn.770 /// * from: owner of item940 /// * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.941 /// * Fungible Mode: The desired number of pieces to burn.942 /// * Re-Fungible Mode: The desired number of pieces to burn.771 #[weight = T::CommonWeightInfo::burn_from()]943 #[weight = T::CommonWeightInfo::burn_from()]772 #[transactional]944 #[transactional]773 pub fn burn_from(origin, collection_id: CollectionId, from: T::CrossAccountId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {945 pub fn burn_from(origin, collection_id: CollectionId, from: T::CrossAccountId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {781 ///953 ///782 /// # Permissions954 /// # Permissions783 ///955 ///784 /// * Collection Owner956 /// * Collection owner785 /// * Collection Admin957 /// * Collection admin786 /// * Current NFT owner958 /// * Current token owner787 ///959 ///788 /// # Arguments960 /// # Arguments789 ///961 ///790 /// * recipient: Address of token recipient.962 /// * `recipient`: Address of token recipient.791 ///963 /// * `collection_id`: ID of the collection the item belongs to.792 /// * collection_id.793 ///794 /// * item_id: ID of the item964 /// * `item_id`: ID of the item.795 /// * Non-Fungible Mode: Required.965 /// * Non-Fungible Mode: Required.796 /// * Fungible Mode: Ignored.966 /// * Fungible Mode: Ignored.797 /// * Re-Fungible Mode: Required.967 /// * Re-Fungible Mode: Required.798 ///968 ///799 /// * value: Amount to transfer.969 /// * `value`: Amount to transfer.800 /// * Non-Fungible Mode: Ignored970 /// * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.801 /// * Fungible Mode: Must specify transferred amount971 /// * Fungible Mode: The desired number of pieces to transfer.802 /// * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)972 /// * Re-Fungible Mode: The desired number of pieces to transfer.803 #[weight = T::CommonWeightInfo::transfer()]973 #[weight = T::CommonWeightInfo::transfer()]804 #[transactional]974 #[transactional]805 pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {975 pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {809 dispatch_tx::<T, _>(collection_id, |d| d.transfer(sender, recipient, item_id, value, &budget))979 dispatch_tx::<T, _>(collection_id, |d| d.transfer(sender, recipient, item_id, value, &budget))810 }980 }811981812 /// Set, change, or remove approved address to transfer the ownership of the NFT.982 /// Allow a non-permissioned address to transfer or burn an item.813 ///983 ///814 /// # Permissions984 /// # Permissions815 ///985 ///816 /// * Collection Owner986 /// * Collection owner817 /// * Collection Admin987 /// * Collection admin818 /// * Current NFT owner988 /// * Current item owner819 ///989 ///820 /// # Arguments990 /// # Arguments821 ///991 ///822 /// * approved: Address that is approved to transfer this NFT or zero (if needed to remove approval).992 /// * `spender`: Account to be approved to make specific transactions on non-owned tokens.823 ///993 /// * `collection_id`: ID of the collection the item belongs to.824 /// * collection_id.825 ///826 /// * item_id: ID of the item.994 /// * `item_id`: ID of the item transactions on which are now approved.995 /// * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).996 /// Set to 0 to revoke the approval.827 #[weight = T::CommonWeightInfo::approve()]997 #[weight = T::CommonWeightInfo::approve()]828 #[transactional]998 #[transactional]829 pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResultWithPostInfo {999 pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResultWithPostInfo {832 dispatch_tx::<T, _>(collection_id, |d| d.approve(sender, spender, item_id, amount))1002 dispatch_tx::<T, _>(collection_id, |d| d.approve(sender, spender, item_id, amount))833 }1003 }8341004835 /// Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.1005 /// Change ownership of an item on behalf of the owner as a non-owner account.836 ///1006 ///837 /// # Permissions1007 /// See the [`approve`][`Pallet::approve`] method for additional information.838 /// * Collection Owner839 /// * Collection Admin840 /// * Current NFT owner841 /// * Address approved by current NFT owner842 ///1008 ///843 /// # Arguments1009 /// After this method executes, one approval is removed from the total so that1010 /// the approved address will not be able to transfer this item again from this owner.844 ///1011 ///845 /// * from: Address that owns token.1012 /// # Permissions846 ///1013 ///847 /// * recipient: Address of token recipient.1014 /// * Collection owner848 ///849 /// * collection_id.1015 /// * Collection admin1016 /// * Current item owner1017 /// * Address approved by current item owner850 ///1018 ///851 /// * item_id: ID of the item.1019 /// # Arguments852 ///1020 ///1021 /// * `from`: Address that currently owns the token.1022 /// * `recipient`: Address of the new token-owner-to-be.1023 /// * `collection_id`: ID of the collection the item.1024 /// * `item_id`: ID of the item to be transferred.853 /// * value: Amount to transfer.1025 /// * `value`: Amount to transfer.1026 /// * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.1027 /// * Fungible Mode: The desired number of pieces to transfer.1028 /// * Re-Fungible Mode: The desired number of pieces to transfer.854 #[weight = T::CommonWeightInfo::transfer_from()]1029 #[weight = T::CommonWeightInfo::transfer_from()]855 #[transactional]1030 #[transactional]856 pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResultWithPostInfo {1031 pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResultWithPostInfo {860 dispatch_tx::<T, _>(collection_id, |d| d.transfer_from(sender, from, recipient, item_id, value, &budget))1035 dispatch_tx::<T, _>(collection_id, |d| d.transfer_from(sender, from, recipient, item_id, value, &budget))861 }1036 }86210371038 /// Set specific limits of a collection. Empty, or None fields mean chain default.1039 ///1040 /// # Permissions1041 ///1042 /// * Collection owner1043 /// * Collection admin1044 ///1045 /// # Arguments1046 ///1047 /// * `collection_id`: ID of the modified collection.1048 /// * `new_limit`: New limits of the collection. Fields that are not set (None)1049 /// will not overwrite the old ones.863 #[weight = <SelfWeightOf<T>>::set_collection_limits()]1050 #[weight = <SelfWeightOf<T>>::set_collection_limits()]864 #[transactional]1051 #[transactional]865 pub fn set_collection_limits(1052 pub fn set_collection_limits(882 target_collection.save()1069 target_collection.save()883 }1070 }88410711072 /// Set specific permissions of a collection. Empty, or None fields mean chain default.1073 ///1074 /// # Permissions1075 ///1076 /// * Collection owner1077 /// * Collection admin1078 ///1079 /// # Arguments1080 ///1081 /// * `collection_id`: ID of the modified collection.1082 /// * `new_permission`: New permissions of the collection. Fields that are not set (None)1083 /// will not overwrite the old ones.885 #[weight = <SelfWeightOf<T>>::set_collection_limits()]1084 #[weight = <SelfWeightOf<T>>::set_collection_limits()]886 #[transactional]1085 #[transactional]887 pub fn set_collection_permissions(1086 pub fn set_collection_permissions(888 origin,1087 origin,889 collection_id: CollectionId,1088 collection_id: CollectionId,890 new_limit: CollectionPermissions,1089 new_permission: CollectionPermissions,891 ) -> DispatchResult {1090 ) -> DispatchResult {892 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1091 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);893 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;1092 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;894 target_collection.check_is_internal()?;1093 target_collection.check_is_internal()?;895 target_collection.check_is_owner_or_admin(&sender)?;1094 target_collection.check_is_owner_or_admin(&sender)?;896 let old_limit = &target_collection.permissions;1095 let old_limit = &target_collection.permissions;8971096898 target_collection.permissions = <PalletCommon<T>>::clamp_permissions(target_collection.mode.clone(), &old_limit, new_limit)?;1097 target_collection.permissions = <PalletCommon<T>>::clamp_permissions(target_collection.mode.clone(), &old_limit, new_permission)?;8991098900 <Pallet<T>>::deposit_event(Event::<T>::CollectionPermissionSet(1099 <Pallet<T>>::deposit_event(Event::<T>::CollectionPermissionSet(901 collection_id1100 collection_id904 target_collection.save()1103 target_collection.save()905 }1104 }90611051106 /// Re-partition a refungible token, while owning all of its parts/pieces.1107 ///1108 /// # Permissions1109 ///1110 /// * Token owner (must own every part)1111 ///1112 /// # Arguments1113 ///1114 /// * `collection_id`: ID of the collection the RFT belongs to.1115 /// * `token_id`: ID of the RFT.1116 /// * `amount`: New number of parts/pieces into which the token shall be partitioned.907 #[weight = T::RefungibleExtensionsWeightInfo::repartition()]1117 #[weight = T::RefungibleExtensionsWeightInfo::repartition()]908 #[transactional]1118 #[transactional]909 pub fn repartition(1119 pub fn repartition(910 origin,1120 origin,911 collection_id: CollectionId,1121 collection_id: CollectionId,912 token: TokenId,1122 token_id: TokenId,913 amount: u128,1123 amount: u128,914 ) -> DispatchResultWithPostInfo {1124 ) -> DispatchResultWithPostInfo {915 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1125 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);916 dispatch_tx::<T, _>(collection_id, |d| {1126 dispatch_tx::<T, _>(collection_id, |d| {917 if let Some(refungible_extensions) = d.refungible_extensions() {1127 if let Some(refungible_extensions) = d.refungible_extensions() {918 refungible_extensions.repartition(&sender, token, amount)1128 refungible_extensions.repartition(&sender, token_id, amount)919 } else {1129 } else {920 fail!(<Error<T>>::RepartitionCalledOnNonRefungibleCollection)1130 fail!(<Error<T>>::RepartitionCalledOnNonRefungibleCollection)921 }1131 }primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -197,7 +197,6 @@
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub enum CollectionMode {
NFT,
- // decimal points
Fungible(DecimalPoints),
ReFungible,
}
@@ -252,12 +251,14 @@
pub enum SponsorshipState<AccountId> {
/// The fees are applied to the transaction sender
Disabled,
+ /// Pending confirmation from a sponsor-to-be
Unconfirmed(AccountId),
/// Transactions are sponsored by specified account
Confirmed(AccountId),
}
impl<AccountId> SponsorshipState<AccountId> {
+ /// Get the acting sponsor account, if present
pub fn sponsor(&self) -> Option<&AccountId> {
match self {
Self::Confirmed(sponsor) => Some(sponsor),
@@ -265,6 +266,7 @@
}
}
+ /// Get the sponsor account currently pending confirmation, if present
pub fn pending_sponsor(&self) -> Option<&AccountId> {
match self {
Self::Unconfirmed(sponsor) | Self::Confirmed(sponsor) => Some(sponsor),
@@ -272,6 +274,7 @@
}
}
+ /// Is sponsorship set and acting
pub fn confirmed(&self) -> bool {
matches!(self, Self::Confirmed(_))
}
@@ -283,7 +286,7 @@
}
}
-/// Used in storage
+/// Collection parameters, used in storage (see [`RpcCollection`] for the RPC version).
#[struct_versioning::versioned(version = 2, upper)]
#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
pub struct Collection<AccountId> {
@@ -324,7 +327,7 @@
pub meta_update_permission: MetaUpdatePermission,
}
-/// Used in RPC calls
+/// Collection parameters, used in RPC calls (see [`Collection`] for the storage version).
#[derive(Encode, Decode, Clone, PartialEq, TypeInfo)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub struct RpcCollection<AccountId> {
@@ -362,26 +365,41 @@
pub type CollectionPropertiesVec = BoundedVec<Property, ConstU32<MAX_PROPERTIES_PER_ITEM>>;
-/// All fields are wrapped in `Option`s, where None means chain default
-// When adding/removing fields from this struct - don't forget to also update clamp_limits
+/// Limits and restrictions of a collection.
+/// All fields are wrapped in `Option`s, where None means chain default.
+///
+/// todo:doc links to chain defaults
+// IMPORTANT: When adding/removing fields from this struct - don't forget to also
+// update clamp_limits() in pallet-common.
#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub struct CollectionLimits {
+ /// Maximum number of owned tokens per account. Chain default: [`ACCOUNT_TOKEN_OWNERSHIP_LIMIT`]
pub account_token_ownership_limit: Option<u32>,
+ /// Maximum size of data in bytes of a sponsored transaction. Chain default: [`CUSTOM_DATA_LIMIT`]
pub sponsored_data_size: Option<u32>,
/// FIXME should we delete this or repurpose it?
/// None - setVariableMetadata is not sponsored
/// Some(v) - setVariableMetadata is sponsored
/// if there is v block between txs
+ ///
+ /// In any case, chain default: [`SponsoringRateLimit::SponsoringDisabled`]
pub sponsored_data_rate_limit: Option<SponsoringRateLimit>,
+ /// Maximum amount of tokens inside the collection. Chain default: [`COLLECTION_TOKEN_LIMIT`]
pub token_limit: Option<u32>,
- // Timeouts for item types in passed blocks
+ /// Timeout for sponsoring a token transfer in passed blocks. Chain default:
+ /// either [`NFT_SPONSOR_TRANSFER_TIMEOUT`], [`FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT`], or [`REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT`],
+ /// depending on the collection type.
pub sponsor_transfer_timeout: Option<u32>,
+ /// Timeout for sponsoring an approval in passed blocks. Chain default: [`SPONSOR_APPROVE_TIMEOUT`]
pub sponsor_approve_timeout: Option<u32>,
+ /// Can a token be transferred by the owner. Chain default: `false`
pub owner_can_transfer: Option<bool>,
+ /// Can a token be burned by the owner. Chain default: `true`
pub owner_can_destroy: Option<bool>,
+ /// Can a token be transferred at all. Chain default: `true`
pub transfers_enabled: Option<bool>,
}
@@ -434,7 +452,10 @@
}
}
-// When adding/removing fields from this struct - don't forget to also update clamp_limits
+/// Permissions on certain operations within a collection.
+/// All fields are wrapped in `Option`s, where None means chain default.
+// IMPORTANT: When adding/removing fields from this struct - don't forget to also
+// update clamp_limits() in pallet-common.
#[derive(Encode, Decode, Debug, Default, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub struct CollectionPermissions {
@@ -489,6 +510,7 @@
}
}
+/// Part of collection permissions, if set, defines who is able to nest tokens into other tokens.
#[derive(Encode, Decode, Clone, PartialEq, TypeInfo, MaxEncodedLen, Derivative)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
#[derivative(Debug)]
@@ -505,38 +527,49 @@
pub permissive: bool,
}
+/// Enum denominating how often can sponsoring occur if it is enabled.
#[derive(Encode, Decode, Debug, Clone, Copy, PartialEq, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub enum SponsoringRateLimit {
+ /// Sponsoring is disabled, and the collection sponsor will not pay for transactions
SponsoringDisabled,
+ /// Once per how many blocks can sponsorship of a transaction type occur
Blocks(u32),
}
+/// Data used to describe an NFT at creation.
#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
#[derivative(Debug)]
pub struct CreateNftData {
+ /// Key-value pairs used to describe the token as metadata
#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
#[derivative(Debug(format_with = "bounded::vec_debug"))]
pub properties: CollectionPropertiesVec,
}
+/// Data used to describe a Fungible token at creation.
#[derive(Encode, Decode, MaxEncodedLen, Default, Debug, Clone, PartialEq, TypeInfo)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub struct CreateFungibleData {
+ /// Number of fungible coins minted
pub value: u128,
}
+/// Data used to describe a Refungible token at creation.
#[derive(Encode, Decode, MaxEncodedLen, Default, PartialEq, Clone, Derivative, TypeInfo)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
#[derivative(Debug)]
pub struct CreateReFungibleData {
+ /// Immutable metadata of the token
#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
#[derivative(Debug(format_with = "bounded::vec_debug"))]
pub const_data: BoundedVec<u8, CustomDataLimit>,
+ /// Number of pieces the RFT is split into
pub pieces: u128,
+ /// Key-value pairs used to describe the token as metadata
#[cfg_attr(feature = "serde1", serde(with = "bounded::vec_serde"))]
#[derivative(Debug(format_with = "bounded::vec_debug"))]
pub properties: CollectionPropertiesVec,
@@ -550,6 +583,7 @@
None,
}
+/// Enum holding data used for creation of all three item types.
#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
pub enum CreateItemData {
@@ -558,6 +592,7 @@
ReFungible(CreateReFungibleData),
}
+/// Explicit NFT creation data with meta parameters.
#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]
#[derivative(Debug)]
pub struct CreateNftExData<CrossAccountId> {
@@ -566,6 +601,7 @@
pub owner: CrossAccountId,
}
+/// Explicit RFT creation data with meta parameters.
#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]
#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]
pub struct CreateRefungibleExData<CrossAccountId> {
@@ -577,6 +613,7 @@
pub properties: CollectionPropertiesVec,
}
+/// Explicit item creation data with meta parameters, namely the owner.
#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, TypeInfo, Derivative)]
#[derivative(Debug(bound = "CrossAccountId: fmt::Debug + Ord"))]
pub enum CreateItemExData<CrossAccountId> {
@@ -624,6 +661,7 @@
}
}
+/// Token's address, dictated by its collection and token IDs.
#[derive(Encode, Decode, MaxEncodedLen, PartialEq, Clone, Debug, TypeInfo)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
// todo possibly rename to be used generally as an address pair
tests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-errors.ts
+++ b/tests/src/interfaces/augment-api-errors.ts
@@ -57,7 +57,7 @@
**/
AddressNotInAllowlist: AugmentedError<ApiType>;
/**
- * Requested value more than approved.
+ * Requested value is more than the approved
**/
ApprovedValueTooLow: AugmentedError<ApiType>;
/**
@@ -113,7 +113,7 @@
**/
EmptyPropertyKey: AugmentedError<ApiType>;
/**
- * Only ASCII letters, digits, and '_', '-' are allowed
+ * Only ASCII letters, digits, and symbols `_`, `-`, and `.` are allowed
**/
InvalidCharacterInPropertyKey: AugmentedError<ApiType>;
/**
@@ -133,7 +133,7 @@
**/
NoSpaceForProperty: AugmentedError<ApiType>;
/**
- * Not sufficient funds to perform action
+ * Insufficient funds to perform an action
**/
NotSufficientFounds: AugmentedError<ApiType>;
/**
@@ -153,15 +153,15 @@
**/
PublicMintingNotAllowed: AugmentedError<ApiType>;
/**
- * Only tokens from specific collections may nest tokens under this
+ * Only tokens from specific collections may nest tokens under this one
**/
SourceCollectionIsNotAllowedToNest: AugmentedError<ApiType>;
/**
- * Item not exists.
+ * Item does not exist
**/
TokenNotFound: AugmentedError<ApiType>;
/**
- * Item balance not enough.
+ * Item is balance not enough
**/
TokenValueTooLow: AugmentedError<ApiType>;
/**
@@ -173,11 +173,11 @@
**/
TransferNotAllowed: AugmentedError<ApiType>;
/**
- * Target collection doesn't supports this operation
+ * Target collection doesn't support this operation
**/
UnsupportedOperation: AugmentedError<ApiType>;
/**
- * User not passed nesting rule
+ * User does not satisfy the nesting rule
**/
UserIsNotAllowedToNest: AugmentedError<ApiType>;
/**
@@ -285,8 +285,7 @@
**/
FungibleItemsDontHaveData: AugmentedError<ApiType>;
/**
- * Not default id passed as TokenId argument.
- * The default value of TokenId for Fungible collection is 0.
+ * Fungible tokens hold no ID, and the default value of TokenId for Fungible collection is 0.
**/
FungibleItemsHaveNoId: AugmentedError<ApiType>;
/**
@@ -426,19 +425,19 @@
**/
NotRefungibleDataUsedToMintFungibleCollectionToken: AugmentedError<ApiType>;
/**
- * Refungible token can't nest other tokens
+ * Refungible token can't nest other tokens.
**/
RefungibleDisallowsNesting: AugmentedError<ApiType>;
/**
- * Refungible token can't be repartitioned by user who isn't owns all pieces
+ * Refungible token can't be repartitioned by user who isn't owns all pieces.
**/
RepartitionWhileNotOwningAllPieces: AugmentedError<ApiType>;
/**
- * Setting item properties is not allowed
+ * Setting item properties is not allowed.
**/
SettingPropertiesNotAllowed: AugmentedError<ApiType>;
/**
- * Maximum refungibility exceeded
+ * Maximum refungibility exceeded.
**/
WrongRefungiblePieces: AugmentedError<ApiType>;
/**
@@ -509,19 +508,19 @@
};
structure: {
/**
- * While iterating over children, encountered breadth limit
+ * While iterating over children, reached the breadth limit.
**/
BreadthLimit: AugmentedError<ApiType>;
/**
- * While searched for owner, encountered depth limit
+ * While searching for the owner, reached the depth limit.
**/
DepthLimit: AugmentedError<ApiType>;
/**
- * While searched for owner, got already checked account
+ * While searching for the owner, encountered an already checked account, detecting a loop.
**/
OuroborosDetected: AugmentedError<ApiType>;
/**
- * While searched for owner, found token owner by not-yet-existing token
+ * Couldn't find the token owner that is itself a token.
**/
TokenNotFound: AugmentedError<ApiType>;
/**
@@ -597,7 +596,7 @@
};
unique: {
/**
- * Decimal_points parameter must be lower than MAX_DECIMAL_POINTS constant, currently it is 30.
+ * Decimal_points parameter must be lower than [`up_data_structs::MAX_DECIMAL_POINTS`].
**/
CollectionDecimalPointLimitExceeded: AugmentedError<ApiType>;
/**
@@ -609,7 +608,7 @@
**/
EmptyArgument: AugmentedError<ApiType>;
/**
- * Repertition is only supported by refungible collection
+ * Repertition is only supported by refungible collection.
**/
RepartitionCalledOnNonRefungibleCollection: AugmentedError<ApiType>;
/**
tests/src/interfaces/augment-api-events.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-events.ts
+++ b/tests/src/interfaces/augment-api-events.ts
@@ -75,7 +75,7 @@
**/
CollectionPropertyDeleted: AugmentedEvent<ApiType, [u32, Bytes]>;
/**
- * The colletion property has been set.
+ * The colletion property has been added or edited.
**/
CollectionPropertySet: AugmentedEvent<ApiType, [u32, Bytes]>;
/**
@@ -87,7 +87,7 @@
**/
ItemDestroyed: AugmentedEvent<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, u128]>;
/**
- * The colletion property permission has been set.
+ * The token property permission of a collection has been set.
**/
PropertyPermissionSet: AugmentedEvent<ApiType, [u32, Bytes]>;
/**
@@ -95,7 +95,7 @@
**/
TokenPropertyDeleted: AugmentedEvent<ApiType, [u32, u32, Bytes]>;
/**
- * The token property has been set.
+ * The token property has been added or edited.
**/
TokenPropertySet: AugmentedEvent<ApiType, [u32, u32, Bytes]>;
/**
@@ -407,7 +407,7 @@
};
structure: {
/**
- * Executed call on behalf of token
+ * Executed call on behalf of the token.
**/
Executed: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>;
/**
@@ -499,90 +499,80 @@
};
unique: {
/**
- * Address was add to allow list
+ * Address was added to the allow list
*
* # Arguments
- *
- * * collection_id: Globally unique collection identifier.
- *
- * * user: Address.
+ * * collection_id: ID of the affected collection.
+ * * user: Address of the added account.
**/
AllowListAddressAdded: AugmentedEvent<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
- * Address was remove from allow list
+ * Address was removed from the allow list
*
* # Arguments
- *
- * * collection_id: Globally unique collection identifier.
- *
- * * user: Address.
+ * * collection_id: ID of the affected collection.
+ * * user: Address of the removed account.
**/
AllowListAddressRemoved: AugmentedEvent<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
* Collection admin was added
*
* # Arguments
- *
- * * collection_id: Globally unique collection identifier.
- *
- * * admin: Admin address.
+ * * collection_id: ID of the affected collection.
+ * * admin: Admin address.
**/
CollectionAdminAdded: AugmentedEvent<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
* Collection admin was removed
*
* # Arguments
- *
- * * collection_id: Globally unique collection identifier.
- *
- * * admin: Admin address.
+ * * collection_id: ID of the affected collection.
+ * * admin: Removed admin address.
**/
CollectionAdminRemoved: AugmentedEvent<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
- * Collection limits was set
+ * Collection limits were set
*
* # Arguments
- *
- * * collection_id: Globally unique collection identifier.
+ * * collection_id: ID of the affected collection.
**/
CollectionLimitSet: AugmentedEvent<ApiType, [u32]>;
/**
- * Collection owned was change
+ * Collection owned was changed
*
* # Arguments
- *
- * * collection_id: Globally unique collection identifier.
- *
- * * owner: New owner address.
+ * * collection_id: ID of the affected collection.
+ * * owner: New owner address.
**/
CollectionOwnedChanged: AugmentedEvent<ApiType, [u32, AccountId32]>;
+ /**
+ * Collection permissions were set
+ *
+ * # Arguments
+ * * collection_id: ID of the affected collection.
+ **/
CollectionPermissionSet: AugmentedEvent<ApiType, [u32]>;
/**
* Collection sponsor was removed
*
* # Arguments
- *
- * * collection_id: Globally unique collection identifier.
+ * * collection_id: ID of the affected collection.
**/
CollectionSponsorRemoved: AugmentedEvent<ApiType, [u32]>;
/**
* Collection sponsor was set
*
* # Arguments
- *
- * * collection_id: Globally unique collection identifier.
- *
- * * owner: New sponsor address.
+ * * collection_id: ID of the affected collection.
+ * * owner: New sponsor address.
**/
CollectionSponsorSet: AugmentedEvent<ApiType, [u32, AccountId32]>;
/**
* New sponsor was confirm
*
* # Arguments
- *
- * * collection_id: Globally unique collection identifier.
- *
- * * sponsor: New sponsor address.
+ * * collection_id: ID of the affected collection.
+ * * sponsor: New sponsor address.
**/
SponsorshipConfirmed: AugmentedEvent<ApiType, [u32, AccountId32]>;
/**
tests/src/interfaces/augment-api-query.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-query.ts
+++ b/tests/src/interfaces/augment-api-query.ts
@@ -70,11 +70,11 @@
};
common: {
/**
- * Storage of collection admins count.
+ * Storage of the amount of collection admins.
**/
adminAmount: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
- * Allowlisted collection users
+ * Allowlisted collection users.
**/
allowlist: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
@@ -86,11 +86,11 @@
**/
collectionProperties: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
- * Storage of collection properties permissions.
+ * Storage of token property permissions of a collection.
**/
collectionPropertyPermissions: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<BTreeMap<Bytes, UpDataStructsPropertyPermission>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
- * Storage of the count of created collections.
+ * Storage of the count of created collections. Essentially contains the last collection ID.
**/
createdCollectionCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
/**
@@ -102,7 +102,7 @@
**/
dummyStorageValue: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[UpDataStructsCollectionStats, u32, u32, UpDataStructsTokenChild, PhantomTypeUpDataStructs]>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
- * List of collection admins
+ * List of collection admins.
**/
isAdmin: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
@@ -200,7 +200,7 @@
};
fungible: {
/**
- * Storage for delegated assets.
+ * Storage for assets delegated to a limited extent to other users.
**/
allowance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg3: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u128>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
@@ -244,11 +244,11 @@
};
nonfungible: {
/**
- * Amount of tokens owned by account.
+ * Amount of tokens owned by an account in a collection.
**/
accountBalance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u32>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
- * Allowance set by an owner for a spender for a token.
+ * Allowance set by a token owner for another user to perform one of certain transactions on a token.
**/
allowance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
@@ -256,7 +256,14 @@
**/
owned: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg3: u32 | AnyNumber | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]>;
/**
- * Custom data that is serialized to bytes and attached to a token property.
+ * Custom data of a token that is serialized to bytes,
+ * primarily reserved for on-chain operations,
+ * normally obscured from the external users.
+ *
+ * Auxiliary properties are slightly different from
+ * usual [`TokenProperties`] due to an unlimited number
+ * and separately stored and written-to key-value pairs.
+ *
* Currently used to store RMRK data.
**/
tokenAuxProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: UpDataStructsPropertyScope | 'None' | 'Rmrk' | number | Uint8Array, arg4: Bytes | string | Uint8Array) => Observable<Option<Bytes>>, [u32, u32, UpDataStructsPropertyScope, Bytes]> & QueryableStorageEntry<ApiType, [u32, u32, UpDataStructsPropertyScope, Bytes]>;
@@ -265,19 +272,19 @@
**/
tokenChildren: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: ITuple<[u32, u32]> | [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array]) => Observable<bool>, [u32, u32, ITuple<[u32, u32]>]> & QueryableStorageEntry<ApiType, [u32, u32, ITuple<[u32, u32]>]>;
/**
- * Custom data serialized to bytes for token.
+ * Token data, used to partially describe a token.
**/
tokenData: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNonfungibleItemData>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
- * Key-Value map stored for token.
+ * Map of key-value pairs, describing the metadata of a token.
**/
tokenProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
- * Amount of burnt tokens for collection.
+ * Amount of burnt tokens in a collection.
**/
tokensBurnt: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
- * Amount of tokens minted for collection.
+ * Total amount of minted tokens in a collection.
**/
tokensMinted: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
@@ -444,32 +451,35 @@
};
refungible: {
/**
- * Amount of tokens owned by account
+ * Amount of tokens (not pieces) partially owned by an account within a collection.
**/
accountBalance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u32>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
- * Allowance set by an owner for a spender for a token
+ * Allowance set by a token owner for another user to perform one of certain transactions on a number of pieces of a token.
**/
allowance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg4: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u128>, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
- * Amount of token pieces owned by account
+ * Amount of token pieces owned by account.
**/
balance: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => Observable<u128>, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr]> & QueryableStorageEntry<ApiType, [u32, u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
- * Used to enumerate tokens owned by account
+ * Used to enumerate tokens owned by account.
**/
owned: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg3: u32 | AnyNumber | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]>;
/**
- * Custom data serialized to bytes for token
+ * Token data, used to partially describe a token.
**/
tokenData: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<PalletRefungibleItemData>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
+ /**
+ * Amount of pieces a refungible token is split into.
+ **/
tokenProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
- * Amount of burnt tokens for collection
+ * Amount of tokens burnt in a collection.
**/
tokensBurnt: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
- * Amount of tokens minted for collection
+ * Total amount of minted tokens in a collection.
**/
tokensMinted: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
@@ -663,24 +673,33 @@
* TODO: Off chain worker should remove from this map when collection gets removed
**/
createItemBasket: AugmentedQuery<ApiType, (arg: ITuple<[u32, AccountId32]> | [u32 | AnyNumber | Uint8Array, AccountId32 | string | Uint8Array]) => Observable<Option<u32>>, [ITuple<[u32, AccountId32]>]> & QueryableStorageEntry<ApiType, [ITuple<[u32, AccountId32]>]>;
+ /**
+ * Last sponsoring of fungible tokens approval in a collection
+ **/
fungibleApproveBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
/**
* Collection id (controlled?2), owning user (real)
**/
fungibleTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, AccountId32]>;
/**
- * Approval sponsoring
+ * Last sponsoring of NFT approval in a collection
**/
nftApproveBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
* Collection id (controlled?2), token id (controlled?2)
**/
nftTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
+ /**
+ * Last sponsoring of RFT approval in a collection
+ **/
refungibleApproveBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, u32, AccountId32]>;
/**
* Collection id (controlled?2), token id (controlled?2)
**/
reFungibleTransferBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array, arg3: AccountId32 | string | Uint8Array) => Observable<Option<u32>>, [u32, u32, AccountId32]> & QueryableStorageEntry<ApiType, [u32, u32, AccountId32]>;
+ /**
+ * Last sponsoring of token property setting // todo:doc rephrase this and the following
+ **/
tokenPropertyBasket: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
* Variable metadata sponsoring
tests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-rpc.ts
+++ b/tests/src/interfaces/augment-api-rpc.ts
@@ -629,47 +629,47 @@
};
unique: {
/**
- * Get amount of different user tokens
+ * Get the amount of any user tokens owned by an account
**/
accountBalance: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;
/**
- * Get tokens owned by account
+ * Get tokens owned by an account in a collection
**/
accountTokens: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<u32>>>;
/**
- * Get admin list
+ * Get the list of admin accounts of a collection
**/
adminlist: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletEvmAccountBasicCrossAccountIdRepr>>>;
/**
- * Get allowed amount
+ * Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor
**/
allowance: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, sender: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, spender: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
/**
- * Check if user is allowed to use collection
+ * Check if a user is allowed to operate within a collection
**/
allowed: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;
/**
- * Get allowlist
+ * Get the list of accounts allowed to operate within a collection
**/
allowlist: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletEvmAccountBasicCrossAccountIdRepr>>>;
/**
- * Get amount of specific account token
+ * Get the amount of a specific token owned by an account
**/
balance: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u128>>;
/**
- * Get collection by specified id
+ * Get a collection by the specified ID
**/
collectionById: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<UpDataStructsRpcCollection>>>;
/**
- * Get collection properties
+ * Get collection properties, optionally limited to the provided keys
**/
collectionProperties: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsProperty>>>;
/**
- * Get collection stats
+ * Get chain stats about collections
**/
collectionStats: AugmentedRpc<(at?: Hash | string | Uint8Array) => Observable<UpDataStructsCollectionStats>>;
/**
- * Get tokens contained in collection
+ * Get tokens contained within a collection
**/
collectionTokens: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<u32>>>;
/**
@@ -681,15 +681,15 @@
**/
effectiveCollectionLimits: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<UpDataStructsCollectionLimits>>>;
/**
- * Get last token id
+ * Get the last token ID created in a collection
**/
lastTokenId: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;
/**
- * Get number of blocks when sponsored transaction is available
+ * Get the number of blocks until sponsoring a transaction is available
**/
nextSponsored: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, account: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u64>>>;
/**
- * Get property permissions
+ * Get property permissions, optionally limited to the provided keys
**/
propertyPermissions: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsPropertyKeyPermission>>>;
/**
@@ -697,15 +697,15 @@
**/
tokenChildren: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsTokenChild>>>;
/**
- * Get token data
+ * Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT
**/
tokenData: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<UpDataStructsTokenData>>;
/**
- * Check if token exists
+ * Check if the token exists
**/
tokenExists: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<bool>>;
/**
- * Get token owner
+ * Get the token owner
**/
tokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;
/**
@@ -713,19 +713,19 @@
**/
tokenOwners: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Vec<PalletEvmAccountBasicCrossAccountIdRepr>>>;
/**
- * Get token properties
+ * Get token properties, optionally limited to the provided keys
**/
tokenProperties: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, propertyKeys?: Vec<Text> | (Text | string)[], at?: Hash | string | Uint8Array) => Observable<Vec<UpDataStructsProperty>>>;
/**
- * Get token owner, in case of nested token - find parent recursive
+ * Get the topmost token owner in the hierarchy of a possibly nested token
**/
topmostTokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;
/**
- * Get total pieces of token
+ * Get the total amount of pieces of an RFT
**/
totalPieces: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<u128>>>;
/**
- * Get amount of unique collection tokens
+ * Get the amount of distinctive tokens present in a collection
**/
totalSupply: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<u32>>;
/**
tests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-tx.ts
+++ b/tests/src/interfaces/augment-api-tx.ts
@@ -730,87 +730,99 @@
};
unique: {
/**
- * Adds an admin of the Collection.
- * NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.
+ * Add an admin to a collection.
+ *
+ * NFT Collection can be controlled by multiple admin addresses
+ * (some which can also be servers, for example). Admins can issue
+ * and burn NFTs, as well as add and remove other admins,
+ * but cannot change NFT or Collection ownership.
*
* # Permissions
*
- * * Collection Owner.
- * * Collection Admin.
+ * * Collection owner
+ * * Collection admin
*
* # Arguments
- *
- * * collection_id: ID of the Collection to add admin for.
*
- * * new_admin_id: Address of new admin to add.
+ * * `collection_id`: ID of the Collection to add an admin for.
+ * * `new_admin`: Address of new admin to add.
**/
- addCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newAdminId: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
+ addCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newAdmin: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
* Add an address to allow list.
*
* # Permissions
*
- * * Collection Owner
- * * Collection Admin
+ * * Collection owner
+ * * Collection admin
*
* # Arguments
*
- * * collection_id.
- *
- * * address.
+ * * `collection_id`: ID of the modified collection.
+ * * `address`: ID of the address to be added to the allowlist.
**/
addToAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
- * Set, change, or remove approved address to transfer the ownership of the NFT.
+ * Allow a non-permissioned address to transfer or burn an item.
*
* # Permissions
*
- * * Collection Owner
- * * Collection Admin
- * * Current NFT owner
+ * * Collection owner
+ * * Collection admin
+ * * Current item owner
*
* # Arguments
- *
- * * approved: Address that is approved to transfer this NFT or zero (if needed to remove approval).
*
- * * collection_id.
- *
- * * item_id: ID of the item.
+ * * `spender`: Account to be approved to make specific transactions on non-owned tokens.
+ * * `collection_id`: ID of the collection the item belongs to.
+ * * `item_id`: ID of the item transactions on which are now approved.
+ * * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).
+ * Set to 0 to revoke the approval.
**/
approve: AugmentedSubmittable<(spender: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
/**
- * Destroys a concrete instance of NFT on behalf of the owner
- * See also: [`approve`]
+ * Destroy a token on behalf of the owner as a non-owner account.
+ *
+ * See also: [`approve`][`Pallet::approve`].
+ *
+ * After this method executes, one approval is removed from the total so that
+ * the approved address will not be able to transfer this item again from this owner.
*
* # Permissions
*
- * * Collection Owner.
- * * Collection Admin.
- * * Current NFT Owner.
+ * * Collection owner
+ * * Collection admin
+ * * Current token owner
+ * * Address approved by current item owner
*
* # Arguments
*
- * * collection_id: ID of the collection.
- *
- * * item_id: ID of NFT to burn.
- *
- * * from: owner of item
+ * * `from`: The owner of the burning item.
+ * * `collection_id`: ID of the collection to which the item belongs.
+ * * `item_id`: ID of item to burn.
+ * * `value`: Number of pieces to burn.
+ * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+ * * Fungible Mode: The desired number of pieces to burn.
+ * * Re-Fungible Mode: The desired number of pieces to burn.
**/
burnFrom: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, from: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32, u128]>;
/**
- * Destroys a concrete instance of NFT.
+ * Destroy an item.
*
* # Permissions
*
- * * Collection Owner.
- * * Collection Admin.
- * * Current NFT Owner.
+ * * Collection owner
+ * * Collection admin
+ * * Current item owner
*
* # Arguments
*
- * * collection_id: ID of the collection.
- *
- * * item_id: ID of NFT to burn.
+ * * `collection_id`: ID of the collection to which the item belongs.
+ * * `item_id`: ID of item to burn.
+ * * `value`: Number of pieces of the item to destroy.
+ * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+ * * Fungible Mode: The desired number of pieces to burn.
+ * * Re-Fungible Mode: The desired number of pieces to burn.
**/
burnItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;
/**
@@ -818,131 +830,200 @@
*
* # Permissions
*
- * * Collection Owner.
+ * * Collection owner
*
* # Arguments
*
- * * collection_id.
- *
- * * new_owner.
+ * * `collection_id`: ID of the modified collection.
+ * * `new_owner`: ID of the account that will become the owner.
**/
changeCollectionOwner: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newOwner: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, AccountId32]>;
/**
+ * Confirm own sponsorship of a collection, becoming the sponsor.
+ *
+ * An invitation must be pending, see [`set_collection_sponsor`][`Pallet::set_collection_sponsor`].
+ * Sponsor can pay the fees of a transaction instead of the sender,
+ * but only within specified limits.
+ *
* # Permissions
*
- * * Sponsor.
+ * * Sponsor-to-be
*
* # Arguments
*
- * * collection_id.
+ * * `collection_id`: ID of the collection with the pending sponsor.
**/
confirmSponsorship: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
/**
- * This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner of the collection is set to the address that signed the transaction and can be changed later.
+ * Create a collection of tokens.
+ *
+ * Each Token may have multiple properties encoded as an array of bytes
+ * of certain length. The initial owner of the collection is set
+ * to the address that signed the transaction and can be changed later.
+ *
+ * Prefer the more advanced [`create_collection_ex`][`Pallet::create_collection_ex`] instead.
*
* # Permissions
*
- * * Anyone.
+ * * Anyone - becomes the owner of the new collection.
*
* # Arguments
*
- * * collection_name: UTF-16 string with collection name (limit 64 characters), will be stored as zero-terminated.
+ * * `collection_name`: Wide-character string with collection name
+ * (limit [`MAX_COLLECTION_NAME_LENGTH`]).
+ * * `collection_description`: Wide-character string with collection description
+ * (limit [`MAX_COLLECTION_DESCRIPTION_LENGTH`]).
+ * * `token_prefix`: Byte string containing the token prefix to mark a collection
+ * to which a token belongs (limit [`MAX_TOKEN_PREFIX_LENGTH`]).
+ * * `mode`: Type of items stored in the collection and type dependent data.
+ **/
+ createCollection: AugmentedSubmittable<(collectionName: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], collectionDescription: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], tokenPrefix: Bytes | string | Uint8Array, mode: UpDataStructsCollectionMode | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<u16>, Vec<u16>, Bytes, UpDataStructsCollectionMode]>;
+ /**
+ * Create a collection with explicit parameters.
*
- * * collection_description: UTF-16 string with collection description (limit 256 characters), will be stored as zero-terminated.
+ * Prefer it to the deprecated [`create_collection`][`Pallet::create_collection`] method.
+ *
+ * # Permissions
*
- * * token_prefix: UTF-8 string with token prefix.
+ * * Anyone - becomes the owner of the new collection.
*
- * * mode: [CollectionMode] collection type and type dependent data.
- **/
- createCollection: AugmentedSubmittable<(collectionName: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], collectionDescription: Vec<u16> | (u16 | AnyNumber | Uint8Array)[], tokenPrefix: Bytes | string | Uint8Array, mode: UpDataStructsCollectionMode | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Vec<u16>, Vec<u16>, Bytes, UpDataStructsCollectionMode]>;
- /**
- * This method creates a collection
+ * # Arguments
*
- * Prefer it to deprecated [`created_collection`] method
+ * * `data`: Explicit data of a collection used for its creation.
**/
createCollectionEx: AugmentedSubmittable<(data: UpDataStructsCreateCollectionData | { mode?: any; access?: any; name?: any; description?: any; tokenPrefix?: any; pendingSponsor?: any; limits?: any; permissions?: any; tokenPropertyPermissions?: any; properties?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [UpDataStructsCreateCollectionData]>;
/**
- * This method creates a concrete instance of NFT Collection created with CreateCollection method.
+ * Mint an item within a collection.
*
+ * A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].
+ *
* # Permissions
*
- * * Collection Owner.
- * * Collection Admin.
+ * * Collection owner
+ * * Collection admin
* * Anyone if
* * Allow List is enabled, and
* * Address is added to allow list, and
- * * MintPermission is enabled (see SetMintPermission method)
+ * * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])
*
* # Arguments
*
- * * collection_id: ID of the collection.
+ * * `collection_id`: ID of the collection to which an item would belong.
+ * * `owner`: Address of the initial owner of the item.
+ * * `data`: Token data describing the item to store on chain.
+ **/
+ createItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, data: UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, UpDataStructsCreateItemData]>;
+ /**
+ * Create multiple items within a collection.
*
- * * owner: Address, initial owner of the NFT.
+ * A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].
+ *
+ * # Permissions
+ *
+ * * Collection owner
+ * * Collection admin
+ * * Anyone if
+ * * Allow List is enabled, and
+ * * Address is added to the allow list, and
+ * * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])
*
- * * data: Token data to store on chain.
+ * # Arguments
+ *
+ * * `collection_id`: ID of the collection to which the tokens would belong.
+ * * `owner`: Address of the initial owner of the tokens.
+ * * `items_data`: Vector of data describing each item to be created.
**/
- createItem: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, data: UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, UpDataStructsCreateItemData]>;
+ createMultipleItems: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemsData: Vec<UpDataStructsCreateItemData> | (UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, Vec<UpDataStructsCreateItemData>]>;
/**
- * This method creates multiple items in a collection created with CreateCollection method.
+ * Create multiple items within a collection with explicitly specified initial parameters.
*
* # Permissions
*
- * * Collection Owner.
- * * Collection Admin.
+ * * Collection owner
+ * * Collection admin
* * Anyone if
* * Allow List is enabled, and
* * Address is added to allow list, and
- * * MintPermission is enabled (see SetMintPermission method)
+ * * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])
*
* # Arguments
*
- * * collection_id: ID of the collection.
+ * * `collection_id`: ID of the collection to which the tokens would belong.
+ * * `data`: Explicit item creation data.
+ **/
+ createMultipleItemsEx: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, data: UpDataStructsCreateItemExData | { NFT: any } | { Fungible: any } | { RefungibleMultipleItems: any } | { RefungibleMultipleOwners: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCreateItemExData]>;
+ /**
+ * Delete specified collection properties.
*
- * * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
+ * # Permissions
+ *
+ * * Collection Owner
+ * * Collection Admin
+ *
+ * # Arguments
*
- * * owner: Address, initial owner of the NFT.
+ * * `collection_id`: ID of the modified collection.
+ * * `property_keys`: Vector of keys of the properties to be deleted.
+ * Keys support Latin letters, `-`, `_`, and `.` as symbols.
**/
- createMultipleItems: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, owner: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, itemsData: Vec<UpDataStructsCreateItemData> | (UpDataStructsCreateItemData | { NFT: any } | { Fungible: any } | { ReFungible: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, Vec<UpDataStructsCreateItemData>]>;
- createMultipleItemsEx: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, data: UpDataStructsCreateItemExData | { NFT: any } | { Fungible: any } | { RefungibleMultipleItems: any } | { RefungibleMultipleOwners: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCreateItemExData]>;
deleteCollectionProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, propertyKeys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<Bytes>]>;
+ /**
+ * Delete specified token properties. Currently properties only work with NFTs.
+ *
+ * # Permissions
+ *
+ * * Depends on collection's token property permissions and specified property mutability:
+ * * Collection owner
+ * * Collection admin
+ * * Token owner
+ *
+ * # Arguments
+ *
+ * * `collection_id`: ID of the collection to which the token belongs.
+ * * `token_id`: ID of the modified token.
+ * * `property_keys`: Vector of keys of the properties to be deleted.
+ * Keys support Latin letters, `-`, `_`, and `.` as symbols.
+ **/
deleteTokenProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, propertyKeys: Vec<Bytes> | (Bytes | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, u32, Vec<Bytes>]>;
/**
- * Destroys collection if no tokens within this collection
+ * Destroy a collection if no tokens exist within.
*
* # Permissions
*
- * * Collection Owner.
+ * * Collection owner
*
* # Arguments
*
- * * collection_id: collection to destroy.
+ * * `collection_id`: Collection to destroy.
**/
destroyCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
/**
- * Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which case only Collection Owner will be able to add an Admin.
+ * Remove admin of a collection.
+ *
+ * An admin address can remove itself. List of admins may become empty,
+ * in which case only Collection Owner will be able to add an Admin.
*
* # Permissions
*
- * * Collection Owner.
- * * Collection Admin.
+ * * Collection owner
+ * * Collection admin
*
* # Arguments
*
- * * collection_id: ID of the Collection to remove admin for.
- *
- * * account_id: Address of admin to remove.
+ * * `collection_id`: ID of the collection to remove the admin for.
+ * * `account_id`: Address of the admin to remove.
**/
removeCollectionAdmin: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, accountId: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
/**
- * Switch back to pay-per-own-transaction model.
+ * Remove a collection's a sponsor, making everyone pay for their own transactions.
*
* # Permissions
*
- * * Collection owner.
+ * * Collection owner
*
* # Arguments
*
- * * collection_id.
+ * * `collection_id`: ID of the collection with the sponsor to remove.
**/
removeCollectionSponsor: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
/**
@@ -950,46 +1031,140 @@
*
* # Permissions
*
- * * Collection Owner
- * * Collection Admin
+ * * Collection owner
+ * * Collection admin
*
* # Arguments
*
- * * collection_id.
+ * * `collection_id`: ID of the modified collection.
+ * * `address`: ID of the address to be removed from the allowlist.
+ **/
+ removeFromAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
+ /**
+ * Re-partition a refungible token, while owning all of its parts/pieces.
+ *
+ * # Permissions
+ *
+ * * Token owner (must own every part)
+ *
+ * # Arguments
+ *
+ * * `collection_id`: ID of the collection the RFT belongs to.
+ * * `token_id`: ID of the RFT.
+ * * `amount`: New number of parts/pieces into which the token shall be partitioned.
+ **/
+ repartition: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;
+ /**
+ * Set specific limits of a collection. Empty, or None fields mean chain default.
+ *
+ * # Permissions
*
- * * address.
+ * * Collection owner
+ * * Collection admin
+ *
+ * # Arguments
+ *
+ * * `collection_id`: ID of the modified collection.
+ * * `new_limit`: New limits of the collection. Fields that are not set (None)
+ * will not overwrite the old ones.
**/
- removeFromAllowList: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, address: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, PalletEvmAccountBasicCrossAccountIdRepr]>;
- repartition: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, token: u32 | AnyNumber | Uint8Array, amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, u32, u128]>;
setCollectionLimits: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newLimit: UpDataStructsCollectionLimits | { accountTokenOwnershipLimit?: any; sponsoredDataSize?: any; sponsoredDataRateLimit?: any; tokenLimit?: any; sponsorTransferTimeout?: any; sponsorApproveTimeout?: any; ownerCanTransfer?: any; ownerCanDestroy?: any; transfersEnabled?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCollectionLimits]>;
- setCollectionPermissions: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newLimit: UpDataStructsCollectionPermissions | { access?: any; mintMode?: any; nesting?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCollectionPermissions]>;
- setCollectionProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, properties: Vec<UpDataStructsProperty> | (UpDataStructsProperty | { key?: any; value?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<UpDataStructsProperty>]>;
/**
+ * Set specific permissions of a collection. Empty, or None fields mean chain default.
+ *
* # Permissions
*
- * * Collection Owner
+ * * Collection owner
+ * * Collection admin
*
* # Arguments
*
- * * collection_id.
+ * * `collection_id`: ID of the modified collection.
+ * * `new_permission`: New permissions of the collection. Fields that are not set (None)
+ * will not overwrite the old ones.
+ **/
+ setCollectionPermissions: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newPermission: UpDataStructsCollectionPermissions | { access?: any; mintMode?: any; nesting?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, UpDataStructsCollectionPermissions]>;
+ /**
+ * Add or change collection properties.
+ *
+ * # Permissions
+ *
+ * * Collection owner
+ * * Collection admin
*
- * * new_sponsor.
+ * # Arguments
+ *
+ * * `collection_id`: ID of the modified collection.
+ * * `properties`: Vector of key-value pairs stored as the collection's metadata.
+ * Keys support Latin letters, `-`, `_`, and `.` as symbols.
**/
+ setCollectionProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, properties: Vec<UpDataStructsProperty> | (UpDataStructsProperty | { key?: any; value?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<UpDataStructsProperty>]>;
+ /**
+ * Set (invite) a new collection sponsor.
+ *
+ * If successful, confirmation from the sponsor-to-be will be pending.
+ *
+ * # Permissions
+ *
+ * * Collection owner
+ * * Collection admin
+ *
+ * # Arguments
+ *
+ * * `collection_id`: ID of the modified collection.
+ * * `new_sponsor`: ID of the account of the sponsor-to-be.
+ **/
setCollectionSponsor: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, newSponsor: AccountId32 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, AccountId32]>;
+ /**
+ * Add or change token properties according to collection's permissions.
+ * Currently properties only work with NFTs.
+ *
+ * # Permissions
+ *
+ * * Depends on collection's token property permissions and specified property mutability:
+ * * Collection owner
+ * * Collection admin
+ * * Token owner
+ *
+ * See [`set_token_property_permissions`][`Pallet::set_token_property_permissions`].
+ *
+ * # Arguments
+ *
+ * * `collection_id: ID of the collection to which the token belongs.
+ * * `token_id`: ID of the modified token.
+ * * `properties`: Vector of key-value pairs stored as the token's metadata.
+ * Keys support Latin letters, `-`, `_`, and `.` as symbols.
+ **/
setTokenProperties: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, properties: Vec<UpDataStructsProperty> | (UpDataStructsProperty | { key?: any; value?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, u32, Vec<UpDataStructsProperty>]>;
- setTokenPropertyPermissions: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, propertyPermissions: Vec<UpDataStructsPropertyKeyPermission> | (UpDataStructsPropertyKeyPermission | { key?: any; permission?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<UpDataStructsPropertyKeyPermission>]>;
/**
- * Set transfers_enabled value for particular collection
+ * Add or change token property permissions of a collection.
+ *
+ * Without a permission for a particular key, a property with that key
+ * cannot be created in a token.
*
* # Permissions
*
- * * Collection Owner.
+ * * Collection owner
+ * * Collection admin
*
* # Arguments
*
- * * collection_id: ID of the collection.
+ * * `collection_id`: ID of the modified collection.
+ * * `property_permissions`: Vector of permissions for property keys.
+ * Keys support Latin letters, `-`, `_`, and `.` as symbols.
+ **/
+ setTokenPropertyPermissions: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, propertyPermissions: Vec<UpDataStructsPropertyKeyPermission> | (UpDataStructsPropertyKeyPermission | { key?: any; permission?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [u32, Vec<UpDataStructsPropertyKeyPermission>]>;
+ /**
+ * Completely allow or disallow transfers for a particular collection.
*
- * * value: New flag value.
+ * # Permissions
+ *
+ * * Collection owner
+ *
+ * # Arguments
+ *
+ * * `collection_id`: ID of the collection.
+ * * `value`: New value of the flag, are transfers allowed?
**/
setTransfersEnabledFlag: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array, value: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32, bool]>;
/**
@@ -997,47 +1172,50 @@
*
* # Permissions
*
- * * Collection Owner
- * * Collection Admin
- * * Current NFT owner
+ * * Collection owner
+ * * Collection admin
+ * * Current token owner
*
* # Arguments
*
- * * recipient: Address of token recipient.
- *
- * * collection_id.
- *
- * * item_id: ID of the item
+ * * `recipient`: Address of token recipient.
+ * * `collection_id`: ID of the collection the item belongs to.
+ * * `item_id`: ID of the item.
* * Non-Fungible Mode: Required.
* * Fungible Mode: Ignored.
* * Re-Fungible Mode: Required.
*
- * * value: Amount to transfer.
- * * Non-Fungible Mode: Ignored
- * * Fungible Mode: Must specify transferred amount
- * * Re-Fungible Mode: Must specify transferred portion (between 0 and 1)
+ * * `value`: Amount to transfer.
+ * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+ * * Fungible Mode: The desired number of pieces to transfer.
+ * * Re-Fungible Mode: The desired number of pieces to transfer.
**/
transfer: AugmentedSubmittable<(recipient: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
/**
- * Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this owner.
- *
- * # Permissions
- * * Collection Owner
- * * Collection Admin
- * * Current NFT owner
- * * Address approved by current NFT owner
+ * Change ownership of an item on behalf of the owner as a non-owner account.
*
- * # Arguments
+ * See the [`approve`][`Pallet::approve`] method for additional information.
*
- * * from: Address that owns token.
+ * After this method executes, one approval is removed from the total so that
+ * the approved address will not be able to transfer this item again from this owner.
*
- * * recipient: Address of token recipient.
+ * # Permissions
*
- * * collection_id.
+ * * Collection owner
+ * * Collection admin
+ * * Current item owner
+ * * Address approved by current item owner
*
- * * item_id: ID of the item.
+ * # Arguments
*
- * * value: Amount to transfer.
+ * * `from`: Address that currently owns the token.
+ * * `recipient`: Address of the new token-owner-to-be.
+ * * `collection_id`: ID of the collection the item.
+ * * `item_id`: ID of the item to be transferred.
+ * * `value`: Amount to transfer.
+ * * Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.
+ * * Fungible Mode: The desired number of pieces to transfer.
+ * * Re-Fungible Mode: The desired number of pieces to transfer.
**/
transferFrom: AugmentedSubmittable<(from: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, recipient: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, collectionId: u32 | AnyNumber | Uint8Array, itemId: u32 | AnyNumber | Uint8Array, value: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr, PalletEvmAccountBasicCrossAccountIdRepr, u32, u32, u128]>;
/**
tests/src/interfaces/default/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -1672,7 +1672,7 @@
readonly isAddCollectionAdmin: boolean;
readonly asAddCollectionAdmin: {
readonly collectionId: u32;
- readonly newAdminId: PalletEvmAccountBasicCrossAccountIdRepr;
+ readonly newAdmin: PalletEvmAccountBasicCrossAccountIdRepr;
} & Struct;
readonly isRemoveCollectionAdmin: boolean;
readonly asRemoveCollectionAdmin: {
@@ -1784,12 +1784,12 @@
readonly isSetCollectionPermissions: boolean;
readonly asSetCollectionPermissions: {
readonly collectionId: u32;
- readonly newLimit: UpDataStructsCollectionPermissions;
+ readonly newPermission: UpDataStructsCollectionPermissions;
} & Struct;
readonly isRepartition: boolean;
readonly asRepartition: {
readonly collectionId: u32;
- readonly token: u32;
+ readonly tokenId: u32;
readonly amount: u128;
} & Struct;
readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition';
tests/src/interfaces/lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -1269,7 +1269,7 @@
},
add_collection_admin: {
collectionId: 'u32',
- newAdminId: 'PalletEvmAccountBasicCrossAccountIdRepr',
+ newAdmin: 'PalletEvmAccountBasicCrossAccountIdRepr',
},
remove_collection_admin: {
collectionId: 'u32',
@@ -1361,11 +1361,11 @@
},
set_collection_permissions: {
collectionId: 'u32',
- newLimit: 'UpDataStructsCollectionPermissions',
+ newPermission: 'UpDataStructsCollectionPermissions',
},
repartition: {
collectionId: 'u32',
- token: 'u32',
+ tokenId: 'u32',
amount: 'u128'
}
}
tests/src/interfaces/types-lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -1385,7 +1385,7 @@
readonly isAddCollectionAdmin: boolean;
readonly asAddCollectionAdmin: {
readonly collectionId: u32;
- readonly newAdminId: PalletEvmAccountBasicCrossAccountIdRepr;
+ readonly newAdmin: PalletEvmAccountBasicCrossAccountIdRepr;
} & Struct;
readonly isRemoveCollectionAdmin: boolean;
readonly asRemoveCollectionAdmin: {
@@ -1497,12 +1497,12 @@
readonly isSetCollectionPermissions: boolean;
readonly asSetCollectionPermissions: {
readonly collectionId: u32;
- readonly newLimit: UpDataStructsCollectionPermissions;
+ readonly newPermission: UpDataStructsCollectionPermissions;
} & Struct;
readonly isRepartition: boolean;
readonly asRepartition: {
readonly collectionId: u32;
- readonly token: u32;
+ readonly tokenId: u32;
readonly amount: u128;
} & Struct;
readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition';
tests/src/interfaces/unique/definitions.tsdiffbeforeafterboth--- a/tests/src/interfaces/unique/definitions.ts
+++ b/tests/src/interfaces/unique/definitions.ts
@@ -37,49 +37,143 @@
export default {
types: {},
rpc: {
- adminlist: fun('Get admin list', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),
- allowlist: fun('Get allowlist', [collectionParam], 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>'),
+ accountTokens: fun(
+ 'Get tokens owned by an account in a collection',
+ [collectionParam, crossAccountParam()],
+ 'Vec<u32>',
+ ),
+ collectionTokens: fun(
+ 'Get tokens contained within a collection',
+ [collectionParam],
+ 'Vec<u32>',
+ ),
+ tokenExists: fun(
+ 'Check if the token exists',
+ [collectionParam, tokenParam],
+ 'bool',
+ ),
- accountTokens: fun('Get tokens owned by account', [collectionParam, crossAccountParam()], 'Vec<u32>'),
- collectionTokens: fun('Get tokens contained in collection', [collectionParam], 'Vec<u32>'),
+ tokenOwner: fun(
+ 'Get the token owner',
+ [collectionParam, tokenParam],
+ `Option<${CROSS_ACCOUNT_ID_TYPE}>`,
+ ),
+ topmostTokenOwner: fun(
+ 'Get the topmost token owner in the hierarchy of a possibly nested token',
+ [collectionParam, tokenParam],
+ `Option<${CROSS_ACCOUNT_ID_TYPE}>`,
+ ),
+ tokenOwners: fun(
+ 'Returns 10 tokens owners in no particular order',
+ [collectionParam, tokenParam],
+ `Vec<${CROSS_ACCOUNT_ID_TYPE}>`,
+ ),
+ tokenChildren: fun(
+ 'Get tokens nested directly into the token',
+ [collectionParam, tokenParam],
+ 'Vec<UpDataStructsTokenChild>',
+ ),
- lastTokenId: fun('Get last token id', [collectionParam], 'u32'),
- totalSupply: fun('Get amount of unique collection tokens', [collectionParam], 'u32'),
- accountBalance: fun('Get amount of different user tokens', [collectionParam, crossAccountParam()], 'u32'),
- balance: fun('Get amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),
- allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),
- tokenOwner: fun('Get token owner', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
- tokenOwners: fun('Returns 10 tokens owners in no particular order', [collectionParam, tokenParam], `Vec<${CROSS_ACCOUNT_ID_TYPE}>`),
- topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
- tokenChildren: fun('Get tokens nested directly into the token', [collectionParam, tokenParam], 'Vec<UpDataStructsTokenChild>'),
- constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),
- variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),
collectionProperties: fun(
- 'Get collection properties',
+ 'Get collection properties, optionally limited to the provided keys',
[collectionParam, propertyKeysParam],
'Vec<UpDataStructsProperty>',
),
tokenProperties: fun(
- 'Get token properties',
+ 'Get token properties, optionally limited to the provided keys',
[collectionParam, tokenParam, propertyKeysParam],
'Vec<UpDataStructsProperty>',
),
propertyPermissions: fun(
- 'Get property permissions',
+ 'Get property permissions, optionally limited to the provided keys',
[collectionParam, propertyKeysParam],
'Vec<UpDataStructsPropertyKeyPermission>',
),
+
+ constMetadata: fun(
+ 'Get token constant metadata',
+ [collectionParam, tokenParam],
+ 'Vec<u8>',
+ ),
+ variableMetadata: fun(
+ 'Get token variable metadata',
+ [collectionParam, tokenParam],
+ 'Vec<u8>',
+ ),
+
tokenData: fun(
- 'Get token data',
+ 'Get token data, including properties, optionally limited to the provided keys, and total pieces for an RFT',
[collectionParam, tokenParam, propertyKeysParam],
'UpDataStructsTokenData',
),
- tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),
- collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsRpcCollection>'),
- collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),
- allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),
- nextSponsored: fun('Get number of blocks when sponsored transaction is available', [collectionParam, crossAccountParam(), tokenParam], 'Option<u64>'),
- effectiveCollectionLimits: fun('Get effective collection limits', [collectionParam], 'Option<UpDataStructsCollectionLimits>'),
- totalPieces: fun('Get total pieces of token', [collectionParam, tokenParam], 'Option<u128>'),
+ totalSupply: fun(
+ 'Get the amount of distinctive tokens present in a collection',
+ [collectionParam],
+ 'u32',
+ ),
+
+ accountBalance: fun(
+ 'Get the amount of any user tokens owned by an account',
+ [collectionParam, crossAccountParam()],
+ 'u32',
+ ),
+ balance: fun(
+ 'Get the amount of a specific token owned by an account',
+ [collectionParam, crossAccountParam(), tokenParam],
+ 'u128',
+ ),
+ allowance: fun(
+ 'Get the amount of currently possible sponsored transactions on a token for the fee to be taken off a sponsor',
+ [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam],
+ 'u128',
+ ),
+
+ adminlist: fun(
+ 'Get the list of admin accounts of a collection',
+ [collectionParam],
+ 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>',
+ ),
+ allowlist: fun(
+ 'Get the list of accounts allowed to operate within a collection',
+ [collectionParam],
+ 'Vec<PalletEvmAccountBasicCrossAccountIdRepr>',
+ ),
+ allowed: fun(
+ 'Check if a user is allowed to operate within a collection',
+ [collectionParam, crossAccountParam()],
+ 'bool',
+ ),
+
+ lastTokenId: fun(
+ 'Get the last token ID created in a collection',
+ [collectionParam],
+ 'u32',
+ ),
+ collectionById: fun(
+ 'Get a collection by the specified ID',
+ [collectionParam],
+ 'Option<UpDataStructsRpcCollection>',
+ ),
+ collectionStats: fun(
+ 'Get chain stats about collections',
+ [],
+ 'UpDataStructsCollectionStats',
+ ),
+
+ nextSponsored: fun(
+ 'Get the number of blocks until sponsoring a transaction is available',
+ [collectionParam, crossAccountParam(), tokenParam],
+ 'Option<u64>',
+ ),
+ effectiveCollectionLimits: fun(
+ 'Get effective collection limits',
+ [collectionParam],
+ 'Option<UpDataStructsCollectionLimits>',
+ ),
+ totalPieces: fun(
+ 'Get the total amount of pieces of an RFT',
+ [collectionParam, tokenParam],
+ 'Option<u128>',
+ ),
},
};