Merged
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/curaos/frontend/7eEypfnJvTtpRvFB6ePMDNmSCVY3 |
bestatigen
reviewed
Nov 4, 2021
bestatigen
reviewed
Nov 5, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the PR
The Goal
building an NFTE component, that relies on
@cura/hooksand@cura/componentsWhat and why?
hooks
NFTdata is scattered on-chain and off-chain. That's why having new hooks that takes care of fetching data would make it look cleaner and it would also be reusable in new projects.The new hooks are:
useViewNFTMethodis used to call view methods from the NEAR blockchain. It's mainly used within others hooksuseNFTContractMetadatais used to get the metadata of thecontract, this was needed in the NFTE component because of thebase_urlthat we used in combination with themediahash to build a full linkuseNFTis used to get the metadata of the NFTtokenuseNFTReferenceis used to fetch the additional NFT info from the referenceURIprovided by the NFT metadatauseNFTContentTypeis used to determine themediatype from givenURIand if the media is a text we return it too, so we don't to call the sameURIagain.Also, some changes has been done:
NFT, to keep things organizeduseNFTContractanduseNFTMethodhave been separated each on their own folder, to stay consistent with other hooksAnd some notes:
READMEfile but decided to remove it, because it would be better if we had hooks documentation with other docs. I will make a new issue for it.networksso the tests can fail if you set the network tomainnet. I made an issue for it Configuration for the hooks package #95components
the NFTE component rely on other components and mainly
MediaObjectandMetadatawhich are used to display the data that we fetched using hooks then processed inside theNFTEThe new components are:
NFTEthe goal of this PRPlaceholderwhich can be used to improve user experience while the we load data and it has been used insideMediaObjectandMetadatacomponentsMediaObjectwhich is used to display the media in the its correct HTML elementOther changes:
Metadatahas been rewritten to display more info about the NFT and it has a loading state nowNotes about
NFTE:NFTErelies on 3 hooks to fetch data, 2 on-chain and 1 off-chain.NFTEgets data first from the NFT on-chain metadata and replace empty strings from off-chain metadata using the reference.NFTEsupport currently Mintbase.io and Paras.id and Cura.run. A different NFT contract than this three may or may not break it.frontend
All edits in the frontend are just to match hooks and components updates.
RenderIframeto display all medias, but now it has been switched toMediaObjectcreatepage now uses an iframe to render the HTMLviewpages have been updated to not pass gas touseNFTMethodhook because the method used is a viewMethod and passing gas breaks it.Github workflow
hooks test has been added to Github workflow