Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete NFT class metadata support #742

Closed
zone117x opened this issue Sep 7, 2021 · 3 comments
Closed

Complete NFT class metadata support #742

zone117x opened this issue Sep 7, 2021 · 3 comments
Labels
enhancement New feature or request P4 Priority 4 Edge cases, improvements, items to be refactored soon

Comments

@zone117x
Copy link
Member

zone117x commented Sep 7, 2021

Originally posted by @zone117x in #576 (comment)

Processing token metadata works pretty well for SIP-010 compliant FTs. Here's an example from Citycoins on testnet:
http://localhost:3999/extended/v1/tokens/ST3CK642B6119EVC6CT550PW5EZZ1AJW6608HK60A.citycoin-token/ft/metadata

{
"token_uri": "https://cdn.citycoins.co/metadata/citycoin.json",
"name": "citycoins",
"description": "The CityCoin template used for testing, mine and stack to support your favorite city while earning STX yield!",
"image_uri": "https://stacks-api.imgix.net/https%3A%2F%2Fcdn.citycoins.co%2Flogos%2Fcitycoin.png?s=b30bf0315b374c32e4d9e953c46bb759",
"image_canonical_uri": "https://cdn.citycoins.co/logos/citycoin.png",
"symbol": "CYCN",
"decimals": 0,
"tx_id": "0x6c2c95a2404199a2ff0e8372d39cdf1be06f5ce1173b680a56dfdf27467ab6b2",
"sender_address": "ST3CK642B6119EVC6CT550PW5EZZ1AJW6608HK60A"
}

NFTs aren't working so well -- the code needs updated to use draft SIP-012 which defines NFT class metadata. Draft SIP-012 is still WIP, and after looking through various NFT contracts on mainnet, it looks like there's a few different ways authors have been defining metadata, examples:

https://explorer.stacks.co/txid/0x3f85e8d2a5453179438ed00e466e38b6c4acb3d2cefa579d20389b84602a12e7?chain=mainnet
(define-read-only (get-nft-meta)
  (ok {name: "Friedger Pool", uri: "https://pool.friedger.de/nft.png", mime-type: "image/png"}))
(define-read-only (get-token-uri (token-id uint))
  (ok (some "https://pool.friedger.de/nft.json")))

https://explorer.stacks.co/txid/0x7246cfb663ddd90041781919961a131938d34345879d708ed7d855039c70b84d?chain=mainnet
(define-read-only (get-nft-meta)
  (ok (some {name: "Clarity Developer OG", uri: "https://bafybeif4p2ukltj5eofwriclz4ru3p7izitprrs7a2rjhtp6qat673wagu.ipfs.dweb.link/", mime-type: "video/webm"})))

https://explorer.stacks.co/txid/0x5d1704291538dbeb201161f9f052f79281bea2a944f8c22e4ebdf67005d2b429?chain=mainnet
(define-read-only (get-nft-meta)
  (ok {name: "First Ever Hiro Hackathon Winner", uri: "https://ipfs.io/ipfs/QmXTeyFsiCGsB6st5FTbvc78RkXG8hKo5SxtCN8cv8ity3/hiro-first-hackathon.webm", mime-type: "video/webm",
        hash: "e4ce55dd89113b846c4d43f7018f66e57e7b12d6af960e2a143f91457d27e1f0"}))

https://explorer.stacks.co/txid/0xe865963227144aec75259f9c1f8e67b2d2b5764a29ba88a5794a700818659748?chain=mainnet
(define-read-only (get-nft-meta)
  {uri: "https://boom-nft-41369b66-36da-4442-be60-fff6d755b065.s3.amazonaws.com/24762181-0ba6-4c5b-9065-1c874fb334d2.svg", name: "Boomboxes", mime-type: "image/svg+xml"})

https://explorer.stacks.co/txid/0x10555a156fbd5931f2b33e843221ce73e3fd661127c64d840c3f8392dbd6887c?chain=mainnet
(define-read-only (get-nft-meta)
  (ok {name: "Friedger Pool", uri: "https://pool.friedger.de/nft.webp", mime-type: "image/webp"}))

https://explorer.stacks.co/txid/0x8f0393265a8a4102701ef6240b03022c567cf67f04e472e077709fe975424921?chain=mainnet
(define-read-only (get-nft-meta)
  (ok (some {name: "beeple", uri: "https://ipfsgateway.makersplace.com/ipfs/QmZ15eQX8FPjfrtdX3QYbrhZxJpbLpvDpsgb2p3VEH8Bqq", mime-type: "image/jpeg"})))
(define-read-only (get-token-uri (token-id uint))
  (ok (some "ipfs://ipfs/QmPAg1mjxcEQPPtqsLoEcauVedaeMH81WXDPvPx3VC5zUz")))

https://explorer.stacks.co/txid/0x8a8b1bd754664715c3280cb41fdf566c741789f200efa74681b79e4409e9800a?chain=mainnet
(define-read-only (get-nft-meta)
  (ok (some {name: "beeple", uri: "https://ipfsgateway.makersplace.com/ipfs/QmZ15eQX8FPjfrtdX3QYbrhZxJpbLpvDpsgb2p3VEH8Bqq", mime-type: "image/jpeg"})))


https://explorer.stacks.co/txid/0x5d8f968111be4556a13d8d0d25f39d998a749a982d673ae6ba7180ee7ccf1f62?chain=mainnet
(define-read-only (get-token-uri (id uint))
  (ok (some "https://cloudflare-ipfs.com/ipfs/bafkreidmfmsjiqunj4tkln57ozw2yhazufqv63j5zohhsqchwol6lznsfy")))

The NFT metadata processing code needs updated to handle the 2 or 3 common ways metadata is defined.

@unclemantis
Copy link

I am having trouble with local stacks api.

"error": "FT metadata processing is not enabled on this server"

I have the flag to allow it set to 1. What gives? I am currently synching and at block height 1854

@zone117x
Copy link
Member Author

zone117x commented Dec 7, 2021

This issue is related to NFT class metadata, the error FT metadata processing is not enabled on this server is for FT class metadata.

@rafaelcr
Copy link
Collaborator

Replaced by #1222

Repository owner moved this from Backlog to Done in API Board Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P4 Priority 4 Edge cases, improvements, items to be refactored soon
Projects
Archived in project
Development

No branches or pull requests

5 participants