Skip to content

Releases: bpierre/use-nft

useNft() 0.12.0: farewell CommonJS

03 May 15:19
744e4c3
Compare
Choose a tag to compare

This release removes CommonJS support and makes use-nft a pure ESM module.

To make sure your project is compatible with it, please use the latest version of Node.js and/or add "type": "module" to your package.json.

useNft() 0.11.0: upgrade all the things

28 Apr 21:24
89e7c39
Compare
Choose a tag to compare

Changes:

  • Move from microbundle to Vite to build the library itself (the examples were already using Vite).
  • Move from Jest to Vitest.
  • Update SWR from 1.0.1 to 3.0.0.

Other:

  • Upgrade all examples to React 18.
  • Add an image proxy back to the website.
  • Stop running tsc before running Vite.

useNft() 0.10.2: Bored Ape Yacht Club compatibility

23 Nov 18:14
Compare
Choose a tag to compare

This version brings compatibility with the metadata format used by Bored Ape Yacht Club NFTs.

Thanks to @dibeling for the PR ❤️

useNft() 0.10.1: SWR update

25 Aug 13:22
Compare
Choose a tag to compare

This version adapts to a change in the SWR API while also upgrading SWR to the latest version.

Pull Request

  • Upgrade SWR (#157)

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

19 Aug 15:11
Compare
Choose a tag to compare

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)

useNft() 0.9.0: faster, custom URLs, Meebits support 🐽

31 May 18:48
Compare
Choose a tag to compare

Meebits

Meebits support

Meebits can now be supported despite being CORS restricted, thanks to the new jsonProxy option (see next section for details).

Custom URLs

Three new and optional props have been added to the <NftProvider /> component to allow more control over URLs.

Note: if you are using the FetchWrapper class, these options can also be passed as the second parameter of its constructor. See FetchWrapper documentation for details.

jsonProxy

jsonProxy allows to fetch the NFT metadata through a proxy by transforming the base URLs. For example, this can be used to get around CORS restrictions or to cache the responses to improve the performances. See API documentation for details.

imageProxy

imageProxy allows to fetch the images through a proxy. This is useful to optimize (compress / resize) the raw NFT images by passing the URL to a service. See API documentation for details.

ipfsUrl

ipfsUrl allows to change the IPFS gateway (defaults to the ipfs.io gateway). See API documentation for details.

Related Pull Request

  • Add ipfsUrl, proxyJson, proxyImage (#98)

Faster metadata fetching

useNft used to call the supportsInterface() method (from ERC 165) to determine the nature of an NFT (ERC721 or ERC1155). A problem with this approach is that it requires an initial call before fetching the metadata from a contract, slowing down the fetching process.

Another issue, that became more and more apparent, is that some contracts support a metadata-fetching method from either ERC721 or ERC1155 without declaraing it properly, or the other way around, requiring to maintain a list of contracts “known to be compatible”.

The new approach stops using supportsInterface(), and attempts to use the two metadata fetching methods at the same time. The first positive response is assumed to be correct.

Related Pull request

  • Remove the supportsInterface() (ERC165) calls (#90)

Throw an error when fetcher is not set

An error is now thrown when fetcher is missing on <NftProvider />.

Related Pull request

  • Throw an error when the fetcher is not set (#91)

Other changes

  • Upgrade dependencies + yarn versions (#87, #97, #99, #100, #101)
  • Fix type issues (#89, #92)
  • Remove unused NFT lists (#88)
  • Website build action: set the Infura API key (#93)

useNft() 0.8: nft.metadataUrl

20 May 14:48
Compare
Choose a tag to compare

This version adds nft.metadataUrl, which contains the URL of the JSON file representing the NFT metadata.

Pull request:

  • Add metadataUrl (#80)

Other changes

  • Website tweaks (#81)
  • Website: serve images through a CDN (#79)
  • Add more examples: Aito, JOYWORLD (#83)

useNft() 0.7.0: nft.owner, full Decentraland support 🪐

19 May 17:21
Compare
Choose a tag to compare

Decentraland

This version provides a full support for Decentraland NFTs: wearables were already supported, and support for Parcels and Estates have been added.

Decentraland NFTs

Related pull request

  • Add support for Decentraland Estates + Parcels (#73)

NFT owner field

Another change is the addition of the nft.owner field. When available, it will contain the address of the current owner of the NFT.

Related pull request

  • Add new field: nft.owner (#78)

Other changes

  • Demo: don’t display missing images (#75)
  • Move more addresses to the known contracts list (#74)
  • Bump dependencies (#76, #77)

useNft() 0.6.2

14 May 08:07
Compare
Choose a tag to compare

Changes

  • IPFS protocol: make the ipfs/ prefix optional (#68)

useNft() 0.6.1

05 May 16:11
Compare
Choose a tag to compare

Changes

  • Cache NFT data between mounts (#59)
  • Upgrade dependencies (#58)
  • Typing: minor tweaks (#54)