pub trait MetadataGenerator {
type Error: Error + Send + Sync + 'static;
// Required methods
fn metadata_for<'life0, 'async_trait>(
&'life0 self,
token_id: U256,
) -> Pin<Box<dyn Future<Output = Result<Option<NftMetadata>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn contract_metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<ContractMetadata>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A MetadataGenerator
asynchronously generates token and contract Metadata.
Tokens are referenced by the uint256
tokenId used to identify them in the
ERC-721 contract.
A MetadataGenerator
may query an outside API, a DB, the local filesystem,
or any other potential data source. Projects seeking to use this library
should make their own metadata generator
Required Associated Types§
Required Methods§
Sourcefn metadata_for<'life0, 'async_trait>(
&'life0 self,
token_id: U256,
) -> Pin<Box<dyn Future<Output = Result<Option<NftMetadata>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn metadata_for<'life0, 'async_trait>(
&'life0 self,
token_id: U256,
) -> Pin<Box<dyn Future<Output = Result<Option<NftMetadata>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate metadata for a specific token
Sourcefn contract_metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<ContractMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn contract_metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<ContractMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate contract-level metadata (in the OpenSea format). See
ContractMetadata
.
This function returns an option, as contract metadata is not intended to be dynamically generated