Re-sync metadata for an NFT but it doesn't seem to work

I’m trying to re-sync metadata for an NFT but it doesn’t seem to work.

For Example:

  1. I call Moralis.Web3API.token.reSyncMetadata(options); to resync the metadata for Apes in Space

  2. Hours later I call Moralis.Web3API.token.getTokenIdMetadata(options) to get the updated metadata.
    However, the metadata is not synced. I have tried this for days now and the metadata doesn’t seem to resync.
    I get the date which the NFT was synced_at: "2021-12-10T04:02:54.823Z" and it’s before the reveal date.

  3. Opensea has the updated image and moralis has the outdated image
    Current moralis NFT metadata image is unrevealed => https://ipfs.io/ipfs/QmPk2g4NxCs7po7Q3pb78V4uc9dxxmyqX3vH4hjJjxDy9m/
    Opensea has the updated revealed image => https://opensea.io/assets/0x7a3b97a7400e44dadd929431a3640e4fc47daebd/8873

reSyncMetadata: async () => {
  try {
    // Apes In Space Contract Address
    const AIS_CONTRACT_ADDRESS = "0xf6ff50d383e4ac839df4076709787f887781d28b";
    const TOKEN_ID = "8873";

    const options = { 
      address: AIS_CONTRACT_ADDRESS, 
      token_id: TOKEN_ID, 
      flag: "metadata" 
    };

    const syncMetadata = await Moralis.Web3API.token.reSyncMetadata(options);
  } catch (error) {
    console.log("reSyncMetadata error", error);
  }
}
getTokenIdMetadata: async () => {
  try {
    const AIS_CONTRACT_ADDRESS = "0x7a3b97a7400e44dadd929431a3640e4fc47daebd";
    const TOKEN_ID = "8873";

    const options = { 
      address: AIS_CONTRACT_ADDRESS, 
      token_id: TOKEN_ID, 
      chain: "eth" 
    };

    const tokenIdMetadata = await Moralis.Web3API.token.getTokenIdMetadata(options);

    console.log("tokenIdMetadata", JSON.stringify(tokenIdMetadata));
  } catch (error) {
    console.log("tokenIdMetadata error", error);
  }
}

Result :

  {
    synced_at: "2021-12-10T04:02:54.823Z", // <= NOTE SYNC DATE
    syncing: 2,

    token_address: "0x7a3b97a7400e44dadd929431a3640e4fc47daebd",
    token_id: "8873",
    block_number_minted: "13775091",
    owner_of: "0x3225fe1dc2445c343cc1f96e2d7a49ffccbf99ca",
    block_number: "13775091",
    amount: "1",
    contract_type: "ERC721",
    name: "Apes In Space",
    symbol: "AIS",
    token_uri: "https://ipfs.moralis.io:2053/ipfs/QmZFg1x9VqukWKGFmQvuSfWDZWk6qCc4XW9geXcVdvQbmW",
    metadata: {
      name: "Apes In Space",
      description: "Ready for Takeoff!",
      image: "ipfs://QmPk2g4NxCs7po7Q3pb78V4uc9dxxmyqX3vH4hjJjxDy9m/",
      external_link: "https://apesinspace.io/",
    },
    is_valid: 1,
    frozen: 0,
  },
];
1 Like

I get an error when I try to run this function. Maybe they pulled it?

The only way I got it working is to do the following:

  1. resync URI
  2. resync Metadata
  3. getToekIdMetadta

Moralis now supports refresh for all NFTs automatically Moralis Updates NFT Metadata