public-awesome / cw-ics721

CosmWasm IBC NFT Transfers
MIT License
56 stars 30 forks source link

feature request: handling onchain metadata #85

Open taitruong opened 4 months ago

taitruong commented 4 months ago

This hasnt been considered yet for ICS721 version one, but for upcoming release.

Standard cw721 is designed by having onchain metadatat called extension here: https://github.com/CosmWasm/cw-nfts/blob/main/packages/cw721/src/query.rs#L126-L133

pub struct NftInfoResponse<T> {
    /// Universal resource identifier for this NFT
    /// Should point to a JSON file that conforms to the ERC721
    /// Metadata JSON Schema
    pub token_uri: Option<String>,
    /// You can add any custom metadata here when you extend cw721-base
    pub extension: T,
}

ICS721 allows optional token metadata (token_data) to be transferred as binary. So on receival we just need to unwrap and check whether it matchs with NftInfoResponse struct. If so we can store onchain metadata.

Currently, ICS721 stores cw721-base code id, here we need another code id for cw721-metadata-onchain. Then we're good to go.

shanev commented 1 month ago

Sounds good to me.