web3ui / web3uikit

Lightweight reusable Web3 UI components for dapps.
https://web3uikit.com
MIT License
1.72k stars 269 forks source link

[NFT] Does not display the right contract type #717

Closed ghost closed 2 years ago

ghost commented 2 years ago

Using the <NFT /> component like this does not display the right type. Expecting erc1155, got erc721

<NFT
  address="0xE95A09ed92979622AbaaC65AE72954E61101851a"
  chain="rinkeby"
  metadata={{
    description: 'Aura Protective High Top Sneaker',
    image: 'https://ipfs.moralis.io:2053/ipfs/QmVJ4WmEcahDDnQc3hvV71sGgDVYwLZukXS3TzqEzwfcxc/blank.mp4',
    name: 'Footwear'
  }}
  tokenId="1"
/>

Screenshot 2022-07-11 at 15 35 36 Screenshot 2022-07-11 at 15 38 59

AbhinavMV commented 2 years ago

Hey @iuliannov Thanks for letting us know. When a user is explicitly passing the metadata prop the contract type was hardcoded as ERC721. Now users can pass the contract type as well.

Just an FYI. You can enable fetchMetadata={true} and it will automatically fetch the data for you 😄

<NFT
  address="0xE95A09ed92979622AbaaC65AE72954E61101851a"
  chain="rinkeby"
  fetchMetadata={true}
  tokenId="1"
/>

This was failing for this particular case. Because the fetched video had link in format ipfs://.... This is fixed now.Please check our storybook https://web3ui.github.io/web3uikit/?path=/story/1-web3-nft--crypto-punk-01&args=chain:rinkeby;address:0xE95A09ed92979622AbaaC65AE72954E61101851a .

image

Closing this issue now 🙌🏻