Created
January 21, 2024 17:41
-
-
Save MichaelTaylor3D/c45f8ff918551590dd415a50a38c3452 to your computer and use it in GitHub Desktop.
create a batch file to bulk create offers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const readline = require('readline'); | |
// Input file path with one NFT ID per line | |
const inputFile = 'nft.csv'; | |
// Output batch script file path | |
const outputFile = 'generate_offers.bat'; | |
// Read the NFT IDs from the input file | |
const nftIds = []; | |
const fileStream = fs.createReadStream(inputFile); | |
const rl = readline.createInterface({ | |
input: fileStream, | |
crlfDelay: Infinity, | |
}); | |
rl.on('line', (line) => { | |
// Store each NFT ID in the array | |
nftIds.push(line.trim()); | |
}); | |
rl.on('close', () => { | |
// Generate the batch script | |
const batchScript = nftIds | |
.map((nftId, index) => { | |
const delaySeconds = index * 15; | |
console.log(`Generating offer for NFT ID ${nftId} after ${delaySeconds} seconds`); | |
return `timeout ${delaySeconds} && powershell -Command "& { echo Y | chia.exe wallet make_offer -f 855886855 -m 0.001000000000 -o ${nftId}:1 -r 1:0.1 -p ./offers/${nftId}.offer }"`; | |
}) | |
.join('\n'); | |
// Write the batch script to the output file | |
fs.writeFileSync(outputFile, batchScript); | |
console.log(`Batch script saved to ${outputFile}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment