mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
Add amalgamation traits for NFT CollectionId and ItemId (#13514)
* Add amalgamation traits for NFT CollectionId, ItemId, and DestroyWitness * Apply @bkchr suggests * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -25,7 +25,10 @@
|
|||||||
//! use.
|
//! use.
|
||||||
|
|
||||||
use super::nonfungibles_v2 as nonfungibles;
|
use super::nonfungibles_v2 as nonfungibles;
|
||||||
use crate::{dispatch::DispatchResult, traits::Get};
|
use crate::{
|
||||||
|
dispatch::{DispatchResult, Parameter},
|
||||||
|
traits::Get,
|
||||||
|
};
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use sp_runtime::TokenError;
|
use sp_runtime::TokenError;
|
||||||
use sp_std::prelude::*;
|
use sp_std::prelude::*;
|
||||||
@@ -33,7 +36,7 @@ use sp_std::prelude::*;
|
|||||||
/// Trait for providing an interface to a read-only NFT-like item.
|
/// Trait for providing an interface to a read-only NFT-like item.
|
||||||
pub trait Inspect<AccountId> {
|
pub trait Inspect<AccountId> {
|
||||||
/// Type for identifying an item.
|
/// Type for identifying an item.
|
||||||
type ItemId;
|
type ItemId: Parameter;
|
||||||
|
|
||||||
/// Returns the owner of `item`, or `None` if the item doesn't exist or has no
|
/// Returns the owner of `item`, or `None` if the item doesn't exist or has no
|
||||||
/// owner.
|
/// owner.
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
//! Implementations of these traits may be converted to implementations of corresponding
|
//! Implementations of these traits may be converted to implementations of corresponding
|
||||||
//! `nonfungible` traits by using the `nonfungible::ItemOf` type adapter.
|
//! `nonfungible` traits by using the `nonfungible::ItemOf` type adapter.
|
||||||
|
|
||||||
use crate::dispatch::{DispatchError, DispatchResult};
|
use crate::dispatch::{DispatchError, DispatchResult, Parameter};
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use sp_runtime::TokenError;
|
use sp_runtime::TokenError;
|
||||||
use sp_std::prelude::*;
|
use sp_std::prelude::*;
|
||||||
@@ -35,11 +35,11 @@ use sp_std::prelude::*;
|
|||||||
/// Trait for providing an interface to many read-only NFT-like sets of items.
|
/// Trait for providing an interface to many read-only NFT-like sets of items.
|
||||||
pub trait Inspect<AccountId> {
|
pub trait Inspect<AccountId> {
|
||||||
/// Type for identifying an item.
|
/// Type for identifying an item.
|
||||||
type ItemId;
|
type ItemId: Parameter;
|
||||||
|
|
||||||
/// Type for identifying a collection (an identifier for an independent collection of
|
/// Type for identifying a collection (an identifier for an independent collection of
|
||||||
/// items).
|
/// items).
|
||||||
type CollectionId;
|
type CollectionId: Parameter;
|
||||||
|
|
||||||
/// Returns the owner of `item` of `collection`, or `None` if the item doesn't exist
|
/// Returns the owner of `item` of `collection`, or `None` if the item doesn't exist
|
||||||
/// (or somehow has no owner).
|
/// (or somehow has no owner).
|
||||||
@@ -193,7 +193,7 @@ pub trait Create<AccountId, CollectionConfig>: Inspect<AccountId> {
|
|||||||
/// Trait for providing the ability to destroy collections of nonfungible items.
|
/// Trait for providing the ability to destroy collections of nonfungible items.
|
||||||
pub trait Destroy<AccountId>: Inspect<AccountId> {
|
pub trait Destroy<AccountId>: Inspect<AccountId> {
|
||||||
/// The witness data needed to destroy an item.
|
/// The witness data needed to destroy an item.
|
||||||
type DestroyWitness;
|
type DestroyWitness: Parameter;
|
||||||
|
|
||||||
/// Provide the appropriate witness data needed to destroy an item.
|
/// Provide the appropriate witness data needed to destroy an item.
|
||||||
fn get_destroy_witness(collection: &Self::CollectionId) -> Option<Self::DestroyWitness>;
|
fn get_destroy_witness(collection: &Self::CollectionId) -> Option<Self::DestroyWitness>;
|
||||||
|
|||||||
Reference in New Issue
Block a user