Trait frame_support::traits::tokens::nonfungibles::Inspect [−][src]
pub trait Inspect<AccountId> {
type InstanceId;
type ClassId;
fn owner(
class: &Self::ClassId,
instance: &Self::InstanceId
) -> Option<AccountId>;
fn class_owner(_class: &Self::ClassId) -> Option<AccountId> { ... }
fn attribute(
_class: &Self::ClassId,
_instance: &Self::InstanceId,
_key: &[u8]
) -> Option<Vec<u8>> { ... }
fn typed_attribute<K: Encode, V: Decode>(
class: &Self::ClassId,
instance: &Self::InstanceId,
key: &K
) -> Option<V> { ... }
fn class_attribute(_class: &Self::ClassId, _key: &[u8]) -> Option<Vec<u8>> { ... }
fn typed_class_attribute<K: Encode, V: Decode>(
class: &Self::ClassId,
key: &K
) -> Option<V> { ... }
fn can_transfer(
_class: &Self::ClassId,
_instance: &Self::InstanceId
) -> bool { ... }
}Expand description
Trait for providing an interface to many read-only NFT-like sets of asset instances.
Associated Types
type InstanceId
type InstanceIdType for identifying an asset instance.
Required methods
fn owner(
class: &Self::ClassId,
instance: &Self::InstanceId
) -> Option<AccountId>
fn owner(
class: &Self::ClassId,
instance: &Self::InstanceId
) -> Option<AccountId>Returns the owner of asset instance of class, or None if the asset doesn’t exist (or
somehow has no owner).
Provided methods
fn class_owner(_class: &Self::ClassId) -> Option<AccountId>
fn class_owner(_class: &Self::ClassId) -> Option<AccountId>Returns the owner of the asset class, if there is one. For many NFTs this may not make
any sense, so users of this API should not be surprised to find an asset class results in
None here.
Returns the attribute value of instance of class corresponding to key.
By default this is None; no attributes are defined.
fn typed_attribute<K: Encode, V: Decode>(
class: &Self::ClassId,
instance: &Self::InstanceId,
key: &K
) -> Option<V>
fn typed_attribute<K: Encode, V: Decode>(
class: &Self::ClassId,
instance: &Self::InstanceId,
key: &K
) -> Option<V>Returns the strongly-typed attribute value of instance of class corresponding to key.
By default this just attempts to use attribute.
Returns the attribute value of class corresponding to key.
By default this is None; no attributes are defined.
Returns the strongly-typed attribute value of class corresponding to key.
By default this just attempts to use class_attribute.
fn can_transfer(_class: &Self::ClassId, _instance: &Self::InstanceId) -> bool
fn can_transfer(_class: &Self::ClassId, _instance: &Self::InstanceId) -> boolReturns true if the asset instance of class may be transferred.
Default implementation is that all assets are transferable.