Skip to content

Node.js script to update NFT Token metadata on Solana Blockchain

Notifications You must be signed in to change notification settings

rovemind/solana-nft-token-metadata-update

 
 

Repository files navigation

🌅 Script to update Solana NFT Token Metadata

This script updates existing NFTs (replaces json metadata) created with Candy Machine v1 on the blockchain with updated metadata. It have 2 commands: download-meta current metadata and update with new metadata.

Demo

update.token.demo.mp4

Script logs all failed tokens in case of any, so you can retry upload them separately. Also, it do update retry with some sleep time in case of fail. By default it suppose to update tokens in the list between 0 and 10k. you can edit specific range at this line. Also, you can set to update single token here.

Prepare

Install dependencies.

yarn

Set your Candy Machine ID within: src/constans.ts. Place all your tokens addresses (mint id) as string array to the ./src/data/token-list-to-parse.json.

Download current meta.

You need download existing metadata for further reuse on update command. Run

yarn download-metadata

It will get array of tokens from ./src/data/token-list-to-parse.json and fetch all metadata to the file src/data/current-metadata-cache.json (may take ~1hr for 1k items).

Create new updated metadata on Arweave.

It can be done with metaplex upload same as when creating new candy machine. Tip: You can upload to devnet with same result, arweave links will be still valid. Otherwise newly updated links need to be formated to format of metaplex cache file. Put cache file into -> ./src/data/mainnet-beta-temp.json

Update metadata for tokens

Place mainnet-beta-temp.json into ./src/data/.

Local keypair should be the same as keypair used to create related Candy Machine, and assumed to be an Update Authority for each token in the list. Default env is `devnet

yarn run update --keypair <PATH_TO_LOCAL_KEYPAIR> --env mainnet-beta

About

Node.js script to update NFT Token metadata on Solana Blockchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 73.5%
  • JavaScript 26.5%