Trait frame_support::traits::tokens::nonfungible::Inspect
source · [−]pub trait Inspect<AccountId> {
type InstanceId;
fn owner(instance: &Self::InstanceId) -> Option<AccountId>;
fn attribute(_instance: &Self::InstanceId, _key: &[u8]) -> Option<Vec<u8>> { ... }
fn typed_attribute<K: Encode, V: Decode>(
instance: &Self::InstanceId,
key: &K
) -> Option<V> { ... }
fn can_transfer(_instance: &Self::InstanceId) -> bool { ... }
}
Expand description
Trait for providing an interface to a read-only NFT-like set of asset instances.
Associated Types
type InstanceId
type InstanceId
Type for identifying an asset instance.
Required methods
fn owner(instance: &Self::InstanceId) -> Option<AccountId>
fn owner(instance: &Self::InstanceId) -> Option<AccountId>
Returns the owner of asset instance
, or None
if the asset doesn’t exist or has no
owner.
Provided methods
Returns the attribute value of instance
corresponding to key
.
By default this is None
; no attributes are defined.
fn typed_attribute<K: Encode, V: Decode>(
instance: &Self::InstanceId,
key: &K
) -> Option<V>
fn typed_attribute<K: Encode, V: Decode>(
instance: &Self::InstanceId,
key: &K
) -> Option<V>
Returns the strongly-typed attribute value of instance
corresponding to key
.
By default this just attempts to use attribute
.
fn can_transfer(_instance: &Self::InstanceId) -> bool
fn can_transfer(_instance: &Self::InstanceId) -> bool
Returns true
if the asset instance
may be transferred.
Default implementation is that all assets are transferable.