referrerpolicy=no-referrer-when-downgrade

Trait polkadot_sdk_frame::traits::tokens::nonfungible::Inspect

pub trait Inspect<AccountId> {
    type ItemId;

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

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

Trait for providing an interface to a read-only NFT-like set of items.

Required Associated Types§

type ItemId

Type for identifying an item.

Required Methods§

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

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

Provided Methods§

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

Returns the attribute value of item corresponding to key.

By default this is None; no attributes are defined.

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

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

By default this just attempts to use attribute.

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

Returns true if the item may be transferred.

Default implementation is that all items are transferable.

Object Safety§

This trait is not object safe.

Implementors§

§

impl<F, A, AccountId> Inspect<AccountId> for ItemOf<F, A, AccountId>
where F: Inspect<AccountId>, A: Get<<F as Inspect<AccountId>>::CollectionId>,

§

type ItemId = <F as Inspect<AccountId>>::ItemId