Page MenuHomePhabricator

[Cashtab] Alternate token icon source for animated images
Needs RevisionPublic

Authored by emack on Wed, Nov 6, 13:00.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

Interim MVP approach to allow the use of animated images as SLP1/NFT icons by checking for the existence of gif urls in the token's url attribute and then render accordingly.

A more complex upgrade of the token server/cashtab to allow users to upload their own gif/mp4 files will be explored later on if there is material uptake of animated icons. Until then, proposing this approach as a trial.

Test Plan

npm test
create an NFT with a gif url in the url field (upload to imgur...etc)
verify the icon used in the token listing and the token landing page is the animated image

Diff Detail

Repository
rABC Bitcoin ABC
Branch
animatedTokenIcons
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31033
Build 61569: Build Diffcashtab-tests
Build 61568: arc lint + arc unit

Event Timeline

emack published this revision for review.Wed, Nov 6, 13:38
bytesofman requested changes to this revision.Wed, Nov 6, 17:51

Not sure I am wrapping my head around this correctly but this does not seem to solve the problem.

Won't this break every token icon that doesn't have tokenDocumentUrl as its image url?

Two possible approaches that readily occur to me:

  1. We modify the TokenIcon component so that it tries an array of urls, say png first and then mp4 next. There is an npm module that supports this: https://www.npmjs.com/package/react-image. If we are always trying the png first, there is probably not much performance impact, since only a handful of tokens will have mp4.
  1. We have a whitelist of premium nfts. We check if this is a premium nft, if it is, we load mp4.

Option 1 is probably the solution here. Option 2 -- if there is demand, we should go that route and charge for the service, but the whitelist should probably be for more than just mp4. Hosting costs will be higher, but we can also expect people paying for premium listings to have higher quality NFTs, be interested in other features like having them featured in Agora, etc.

This revision now requires changes to proceed.Wed, Nov 6, 17:51