Struct pallet_nft::pallet::Pallet

source ·
pub struct Pallet<T>(_);
Expand description

The pallet implementing the on-chain logic.

Implementations§

Creates an NFT collection of the given collection type and sets its metadata. The collection ID needs to be outside of the range of reserved IDs. The creation of a collection needs to be enabled in the permissions for the given collection type.

Parameters:

  • origin: The owner of the newly created collection.
  • collection_id: Identifier of a collection.
  • collection_type: The collection type determines its purpose and usage.
  • metadata: Arbitrary data about a collection, e.g. IPFS hash or name.

Emits CollectionCreated event

Mints an NFT in the specified collection and sets its metadata. Minting of new items needs to be enabled in the permissions for the given collection type.

Parameters:

  • origin: The owner of the newly minted NFT.
  • collection_id: The collection of the asset to be minted.
  • item_id: The item of the asset to be minted.
  • metadata: Arbitrary data about an item, e.g. IPFS hash or symbol.

Transfers NFT from account A to account B. Transfers need to be enabled in the permissions for the given collection type.

Parameters:

  • origin: The NFT owner
  • collection_id: The collection of the asset to be transferred.
  • item_id: The instance of the asset to be transferred.
  • dest: The account to receive ownership of the asset.

Removes a token from existence. Burning needs to be enabled in the permissions for the given collection type.

Parameters:

  • origin: The NFT owner.
  • collection_id: The collection of the asset to be burned.
  • item_id: The instance of the asset to be burned.

Removes a collection from existence. Destroying of collections need to be enabled in the permissions for the given collection type. Fails if the collection is not empty.

Parameters:

  • origin: The collection owner.
  • collection_id: The identifier of the asset collection to be destroyed.

Stores collection info

Stores item info

Trait Implementations§

Get the benchmarks available for this pallet. Generally there is one benchmark per extrinsic, so these are sometimes just called “extrinsics”. Read more
Run the benchmarks for this pallet.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Creates an NFT collection of the given collection type and sets its metadata. The collection ID does not need to be outside of the range of reserved IDs. The permissions for the creation of a collection are not enforced. Metadata is set to the default value if not provided.

Parameters:

  • owner: The collection owner.
  • collection_id: Identifier of a collection.
  • collection_type: The collection type.
  • metadata: Optional arbitrary data about a collection, e.g. IPFS hash or name.

Emits CollectionCreated event

Formats the value using the given formatter. Read more

The witness data needed to destroy an item.

Removes a collection from existence. Destroying of collections is not enforced by the permissions for the given collection type. Fails if the collection is not empty and contains items.

Parameters:

  • collection: The CollectionId to be destroyed.
  • witness: Empty witness data that needs to be provided to complete the operation successfully.
  • maybe_check_owner: An optional account id that can be used to authorize the destroy command. If not provided, we will not do any authorization checks before destroying the item.

If successful, this function will return empty witness data from the destroyed item.

The witness data needed to destroy an item.
Returns the current storage version as supported by the pallet.
Returns the on-chain storage version of the pallet as stored in the storage.
The block is being finalized. Implement to have something happen.
This will be run when the block is being finalized (before on_finalize). Implement to have something happen using the remaining weight. Will not fire if the remaining weight is 0. Return the weight used, the hook will subtract it from current weight used and pass the result to the next on_idle hook if it exists. Read more
The block is being initialized. Implement to have something happen. Read more
Perform a module upgrade. Read more
Execute the sanity checks of this pallet, per block. Read more
Execute some pre-checks prior to a runtime upgrade. Read more
Execute some post-checks after a runtime upgrade. Read more
Implementing this function on a module allows you to perform long-running tasks that make (by default) validators generate transactions that feed results of those long-running computations back on chain. Read more
Run integrity test. Read more

Returns the owner of item of collection, or None if the item doesn’t exist.

Returns the owner of the collection, or None if the collection doesn’t exist.

Returns true if the item of collection may be transferred.

Type for identifying an item.
Type for identifying a collection (an identifier for an independent collection of items). Read more
Returns the attribute value of item of collection corresponding to key. Read more
Returns the strongly-typed attribute value of item of collection corresponding to key. Read more
Returns the attribute value of collection corresponding to key. Read more
Returns the strongly-typed attribute value of collection corresponding to key. Read more

Returns an iterator of the collections in existence.

Returns an iterator of the items of a collection in existence.

Returns an iterator of the items of all collections owned by who.

Returns an iterator of the items of collection owned by who.

Run integrity test. Read more

Mints an NFT in the specified collection and sets its metadata. The minting permissions are not enforced. Metadata is set to the default value.

Parameters:

  • collection: The collection of the asset to be minted.
  • item: The item of the asset to be minted.
  • who: The owner of the newly minted NFT.

Removes an item from existence. The burning permissions are not enforced.

Parameters:

  • collection: The collection of the asset to be burned.
  • item: The instance of the asset to be burned.
  • maybe_check_owner: Optional value.
Set attribute value of item of collection’s key. Read more
Attempt to set the strongly-typed attribute value of item of collection’s key. Read more
Set attribute value of collection’s key. Read more
Attempt to set the strongly-typed attribute value of collection’s key. Read more
This function is being called after every block import (when fully synced). Read more
The block is being finalized. Implement to have something happen. Read more
Something that should happen at genesis.
The block is being finalized. Implement to have something happen in case there is leftover weight. Check the passed remaining_weight to make sure it is high enough to allow for your pallet’s extra computation. Read more
The block is being initialized. Implement to have something happen. Read more
Perform a module upgrade. Read more
Execute some pre-checks prior to a runtime upgrade. Read more
Execute some post-checks after a runtime upgrade. Read more
Index of the pallet as configured in the runtime.
Name of the pallet as configured in the runtime.
Name of the Rust module containing the pallet.
Version of the crate containing the pallet.
The number of pallets’ information that this type represents. Read more
All of the pallets’ information that this type represents.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Checks if the provided collection ID is within the range of reserved IDs.

Transfer item of collection into destination account.

Execute the state checks.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert from a value of T into an equivalent instance of Option<Self>. Read more
Consume self to return Some equivalent value of Option<T>. Read more
Converts self into T using Into<T>. Read more
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more
Compare self to key and return true if they are equal.
Causes self to use its Binary implementation when Debug-formatted. Read more
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted. Read more
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more
Formats each item in a sequence. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Cast reference.
Cast reference.
Cast mutable reference.
Cast mutable reference.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Generate a storage key unique to this runtime upgrade. Read more
Get temporary storage data written by Self::set_temp_storage. Read more
Write some temporary data to a specific storage that can be read (potentially in post-upgrade hook) via Self::get_temp_storage. Read more
Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
Convert from a value of T into an equivalent instance of Self. Read more
Consume self to return an equivalent value of T. Read more
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The counterpart to unchecked_from.
Consume self to return an equivalent value of T.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more