This script is designed to refresh the metadata of NFTs for a specific Ethereum smart contract. It iterates through all NFTs based on the contract's total supply and refreshes their metadata using the OpenSea API.
- Node.js
- NPM (Node Package Manager)
- An Infura account with an API key for Ethereum mainnet access
- An OpenSea API key
Clone the Repository:
git clone https://github.com/kashn11/OS-entire-collection-metadata-update
cd OS-entire-collection-metadata-update
Install Dependencies: npm install
Set Up Environment Variables:
Create a .env file in the root directory of your project. Add the following lines to it:
PORT=5000
INFURA_API_KEY=[Your Infura API Key]
OS_API_KEY=[Your OpenSea API Key]
contract_Address=[Your contract Address]
Usage
Set the Contract ABI:
Place the ABI JSON file in the root directory and name it abi.json.
Run the Script:
npm start
TypeError: contract.totalSupply is not a function: Ensure that your ABI file correctly represents the contract and that totalSupply is a function in your smart contract.
If you encounter rate limit errors from Infura or OpenSea, consider increasing the delay in the script or implementing a more sophisticated rate limiting strategy.
Ensure that the Infura endpoint you are using matches the network of your smart contract.
Contributions to the script are welcome. Please ensure to follow the coding standards and submit a pull request for review.