Skip to content

verynifty/nft-fetch-metadata

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
uri
 
 
 
 
 
 
 
 
 
 
 
 

NFT Fetch Metadata

We forked Zora's metadata fetcher architechture + adding all the features and customizations we needed to be able to index all NFTs from any contract and fit our NFT indexer.

Feel free to use it and contribute.

https://www.npmjs.com/package/@musedao/nft-fetch-metadata

npm install @musedao/nft-fetch-metadata

Example

require("dotenv").config();

const Fetcher = require("@musedao/nft-fetch-metadata");

let rpc = `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY}`;
  
const infuraIPFS = "https://ipfs.infura.io:5001/api/v0/cat?arg="; //optional to pass ipfs node that works good, otherwise use a public one.


let options = [, , infuraIPFS, , rpc];

const fetch = new Fetcher(...options);

const tokenUri = await fetch.fetchTokenURI(
   "0xe4605d46fd0b3f8329d936a8b258d69276cba264",
    "54"
);

console.log(tokenUri);

const nft = await fetch.fetchMetadata(
    "0xa3518c1008698082057f3c0d49a67683265df6e5", //loot
    "51",
    {
      method: "post",
      auth: process.env.INFURA_IPFS,
      // responseType: "arraybuffer",
      // responseEncoding: "binary",
    }
);

console.log(nft);

The package has many more useful functions, examples are wip.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published