Skip to content

useNft() 0.10.0: on-chain punks and new NFT fields

Compare
Choose a tag to compare
@bpierre bpierre released this 19 Aug 15:11
· 23 commits to main since this release

On-chain Cryptopunks

The images of Cryptopunks are now fetched directly from the new image contract, as SVG files rather than PNG. The quality is improved, and it allows to not rely on Larvalabs hosting these files anymore.

Related pull request

  • Cryptopunks: fetch images on chain (#155)

Ethers is now an optional peer dependency

By doing this change, injecting ethers is now unnecessary, even though it will continue working to support advanced scenarios.

You might want to upgrade your code from this:

import ethers from 'ethers'

const provider = getDefaultProvider("homestead")

function App() {
  return (
    <NftProvider fetcher={["ethers", { ethers, provider }]} />
  )
}

To this:

const provider = getDefaultProvider("homestead")

function App() {
  return (
    <NftProvider fetcher={["ethers", { provider }]} />
  )
}

Related pull request

  • Make Ethers an optional peer dependency (#153)

New fields: rawData, imageType

Two new fields have been added on the nft object:

  • rawData contains the entire JSON data as being fetched from the source.
  • imageType can be image, video or unknown. useNft() tries to detect its type based on the URL extension, so it should only be used as an indicative information.

Related pull requests

  • Add rawData (#150)
  • Add imageType (#149)

Other changes

  • Fix an issue where error was sometimes an array of errors (#132)
  • Upgrade SWR to the latest version (#120, #148)