referrerpolicy=no-referrer-when-downgrade

Trait frame_support::traits::tokens::nonfungibles::Inspect

source ·
pub trait Inspect<AccountId> {
    type ItemId;
    type CollectionId;

    // Required method
    fn owner(
        collection: &Self::CollectionId,
        item: &Self::ItemId,
    ) -> Option<AccountId>;

    // Provided methods
    fn collection_owner(_collection: &Self::CollectionId) -> Option<AccountId> { ... }
    fn attribute(
        _collection: &Self::CollectionId,
        _item: &Self::ItemId,
        _key: &[u8],
    ) -> Option<Vec<u8>> { ... }
    fn typed_attribute<K: Encode, V: Decode>(
        collection: &Self::CollectionId,
        item: &Self::ItemId,
        key: &K,
    ) -> Option<V> { ... }
    fn collection_attribute(
        _collection: &Self::CollectionId,
        _key: &[u8],
    ) -> Option<Vec<u8>> { ... }
    fn typed_collection_attribute<K: Encode, V: Decode>(
        collection: &Self::CollectionId,
        key: &K,
    ) -> Option<V> { ... }
    fn can_transfer(
        _collection: &Self::CollectionId,
        _item: &Self::ItemId,
    ) -> bool { ... }
}
Expand description

Trait for providing an interface to many read-only NFT-like sets of items.

Required Associated Types§

source

type ItemId

Type for identifying an item.

source

type CollectionId

Type for identifying a collection (an identifier for an independent collection of items).

Required Methods§

source

fn owner( collection: &Self::CollectionId, item: &Self::ItemId, ) -> Option<AccountId>

Returns the owner of item of collection, or None if the item doesn’t exist (or somehow has no owner).

Provided Methods§

source

fn collection_owner(_collection: &Self::CollectionId) -> Option<AccountId>

Returns the owner of the collection, if there is one. For many NFTs this may not make any sense, so users of this API should not be surprised to find a collection results in None here.

source

fn attribute( _collection: &Self::CollectionId, _item: &Self::ItemId, _key: &[u8], ) -> Option<Vec<u8>>

Returns the attribute value of item of collection corresponding to key.

By default this is None; no attributes are defined.

source

fn typed_attribute<K: Encode, V: Decode>( collection: &Self::CollectionId, item: &Self::ItemId, key: &K, ) -> Option<V>

Returns the strongly-typed attribute value of item of collection corresponding to key.

By default this just attempts to use attribute.

source

fn collection_attribute( _collection: &Self::CollectionId, _key: &[u8], ) -> Option<Vec<u8>>

Returns the attribute value of collection corresponding to key.

By default this is None; no attributes are defined.

source

fn typed_collection_attribute<K: Encode, V: Decode>( collection: &Self::CollectionId, key: &K, ) -> Option<V>

Returns the strongly-typed attribute value of collection corresponding to key.

By default this just attempts to use collection_attribute.

source

fn can_transfer(_collection: &Self::CollectionId, _item: &Self::ItemId) -> bool

Returns true if the item of collection may be transferred.

Default implementation is that all items are transferable.

Object Safety§

This trait is not object safe.

Implementors§