在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Coderrob/pinata-ipfs-scripts-for-nft-projects开源软件地址:https://github.com/Coderrob/pinata-ipfs-scripts-for-nft-projects开源编程语言:JavaScript 100.0%开源软件介绍:Pinata IPFS scripts for NFT projectsScriptsThe scripts contained in this repository were created to help automate the import and processing of NFT profile pic projects. Each script serves a unique purpose and when combined will help import both NFT images and the associated image metadata. A brief description of the scripts is below:
Getting StartedClone the repository. git clone https://github.com/Coderrob/pinata-ipfs-scripts-for-nft-projects.git Change directory to the cd pinata-ipfs-scripts-for-nft-projects Install dependencies. npm install Some scripts require environment variables to connect with the Pinata API. These environment variables are needed to download pinned files, or to upload files and folders. Environment Variables
The repo is setup with dotenv and configured to allow using an If the env file does not already exist simply create a new The contents of the PINATA_API_KEY="a1237a8dcd87766ff4"
PINATA_API_SECRET="fb8654309ca8777asdf7558758123456asdf817166927aknnk888877" To generate these Pinata API keys you'll need to follow the Getting Started Pinata documentation Calculate File IPFS CIDs
The calculate file CIDs script will iterate the contents of a specified folder, and for each file will compute the IPFS hash CID mapped to the file name. Once complete the script will output the file name and CID mappings to a file. Settings
Commandnode ./src/calculate-cids.js Output
Contents{
"one.png": "QmZPnX4481toHABEtvKFoCWoVuzFFQRBiA5QR2Cij9pjon",
"two.png": "QmazpAaWf3Bb4qhSW9PnQXfj2URbQwdNbZvDr77RbwH7xb"
} Calculate File sha256 Hashes
The calculate file hashes script will iterate the contents of a specified folder, and for each file will compute the sha256 hash mapped to the file name. Once complete the script will output the file name and sha256 hash mappings to a file. Settings
Commandnode ./src/calculate-hashes.js Output
Contents{
"one.png": "f8e50b5c45e6304b41f87686db539dd52138b873a3af98cc60f623d47a133df2",
"two.png": "76d9c6f8dc113fff71a180195077526fce3d0279034a37f23860c1f519512e94"
} Download Pinata Pinned CIDs
The download file CIDs script will iterate all pinned files associated with the Pinata API Key. The script will map each row's file name and IPFS hash CID. Once complete the script will output the file name and CID mappings to a file. Settings
Commandnode ./src/download-cids.js Output
Contents{
"one.png": "QmZPnX4481toHABEtvKFoCWoVuzFFQRBiA5QR2Cij9pjon",
"two.png": "QmazpAaWf3Bb4qhSW9PnQXfj2URbQwdNbZvDr77RbwH7xb"
} Upload Files
The upload files script will iterate the contents of a specified folder and will upload and pin each individual file to Pinata. After a successful upload the file name will be mapped to the IPFS hash CID from the response. Once complete the script will output the file name and CID mappings to a file. Settings
Commandnode ./src/upload-files.js Output
Contents{
"one.png": "QmZPnX4481toHABEtvKFoCWoVuzFFQRBiA5QR2Cij9pjon",
"two.png": "QmazpAaWf3Bb4qhSW9PnQXfj2URbQwdNbZvDr77RbwH7xb"
} Upload Folder
The upload folder script will iterate the contents of a specified folder and will upload and pin each file under a folder container in Pinata. After a successful upload the folder name will be mapped to the IPFS hash CID from the response. Once complete the script will output the folder name and CID mapping to a file.
Settings
Commandnode ./src/upload-metadata.js Output
Contents{
"metadata": "QmR5m9zJDSmrLnYMawrySYu3wLgN5afo3yizevAaimjvmD"
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论