Trait polkadot_sdk_frame::traits::tokens::nonfungibles_v2::Inspect
pub trait Inspect<AccountId> {
type ItemId: Parameter;
type CollectionId: Parameter;
// 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 custom_attribute(
_account: &AccountId,
_collection: &Self::CollectionId,
_item: &Self::ItemId,
_key: &[u8],
) -> Option<Vec<u8>> { ... }
fn system_attribute(
_collection: &Self::CollectionId,
_item: Option<&Self::ItemId>,
_key: &[u8],
) -> Option<Vec<u8>> { ... }
fn typed_attribute<K, V>(
collection: &Self::CollectionId,
item: &Self::ItemId,
key: &K,
) -> Option<V>
where K: Encode,
V: Decode { ... }
fn typed_custom_attribute<K, V>(
account: &AccountId,
collection: &Self::CollectionId,
item: &Self::ItemId,
key: &K,
) -> Option<V>
where K: Encode,
V: Decode { ... }
fn typed_system_attribute<K, V>(
collection: &Self::CollectionId,
item: Option<&Self::ItemId>,
key: &K,
) -> Option<V>
where K: Encode,
V: Decode { ... }
fn collection_attribute(
_collection: &Self::CollectionId,
_key: &[u8],
) -> Option<Vec<u8>> { ... }
fn typed_collection_attribute<K, V>(
collection: &Self::CollectionId,
key: &K,
) -> Option<V>
where K: Encode,
V: Decode { ... }
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§
type ItemId: Parameter
type ItemId: Parameter
Type for identifying an item.
type CollectionId: Parameter
type CollectionId: Parameter
Type for identifying a collection (an identifier for an independent collection of items).
Required Methods§
fn owner(
collection: &Self::CollectionId,
item: &Self::ItemId,
) -> Option<AccountId>
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§
fn collection_owner(_collection: &Self::CollectionId) -> Option<AccountId>
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.
fn attribute(
_collection: &Self::CollectionId,
_item: &Self::ItemId,
_key: &[u8],
) -> Option<Vec<u8>>
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.
fn custom_attribute(
_account: &AccountId,
_collection: &Self::CollectionId,
_item: &Self::ItemId,
_key: &[u8],
) -> Option<Vec<u8>>
fn custom_attribute( _account: &AccountId, _collection: &Self::CollectionId, _item: &Self::ItemId, _key: &[u8], ) -> Option<Vec<u8>>
Returns the custom attribute value of item
of collection
corresponding to key
.
By default this is None
; no attributes are defined.
fn system_attribute(
_collection: &Self::CollectionId,
_item: Option<&Self::ItemId>,
_key: &[u8],
) -> Option<Vec<u8>>
fn system_attribute( _collection: &Self::CollectionId, _item: Option<&Self::ItemId>, _key: &[u8], ) -> Option<Vec<u8>>
Returns the system attribute value of item
of collection
corresponding to key
if
item
is Some
. Otherwise, returns the system attribute value of collection
corresponding to key
.
By default this is None
; no attributes are defined.
fn typed_attribute<K, V>(
collection: &Self::CollectionId,
item: &Self::ItemId,
key: &K,
) -> Option<V>
fn typed_attribute<K, V>( 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
.
fn typed_custom_attribute<K, V>(
account: &AccountId,
collection: &Self::CollectionId,
item: &Self::ItemId,
key: &K,
) -> Option<V>
fn typed_custom_attribute<K, V>( account: &AccountId, collection: &Self::CollectionId, item: &Self::ItemId, key: &K, ) -> Option<V>
Returns the strongly-typed custom attribute value of item
of collection
corresponding to
key
.
By default this just attempts to use custom_attribute
.
fn typed_system_attribute<K, V>(
collection: &Self::CollectionId,
item: Option<&Self::ItemId>,
key: &K,
) -> Option<V>
fn typed_system_attribute<K, V>( collection: &Self::CollectionId, item: Option<&Self::ItemId>, key: &K, ) -> Option<V>
Returns the strongly-typed system attribute value of item
corresponding to key
if
item
is Some
. Otherwise, returns the strongly-typed system attribute value of
collection
corresponding to key
.
By default this just attempts to use system_attribute
.
fn collection_attribute(
_collection: &Self::CollectionId,
_key: &[u8],
) -> Option<Vec<u8>>
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.
fn typed_collection_attribute<K, V>(
collection: &Self::CollectionId,
key: &K,
) -> Option<V>
fn typed_collection_attribute<K, V>( 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
.
fn can_transfer(_collection: &Self::CollectionId, _item: &Self::ItemId) -> bool
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.