├── .gitignore ├── README.md ├── flow.gif ├── package.json └── src └── script.ts /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | extension 3 | " 4 | .DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Opensea BULK Script # 2 | 3 | ## :computer: About the project 4 | 5 | This project was made to mint so many NFTs to the opensea using puppeteer and dappeteer. 6 | 7 | ![Script Running](flow.gif) 8 | 9 | ## How To Run 10 | 11 | First run `yarn install` to install the packages: 12 | 13 | ``` bash 14 | yarn install 15 | ``` 16 | 17 | Now configure your `script.ts` with your data 18 | 19 | ```env 20 | const collectionName = "Your Colleciton Name" 21 | 22 | const collectionURL = `https://opensea.io/collection/${collectionName}/assets/create` 23 | 24 | const openseaDescription = `Your description here` 25 | 26 | const lockedContent = `Locked content text here` 27 | 28 | const secretPhase = `here is your secret phase dont share it` 29 | 30 | ``` 31 | 32 | Run the command to run the script 33 | 34 | ```bash 35 | yarn es ./src/script.ts 36 | ``` 37 | 38 | 39 | ## Authors 40 | 41 | | [
@EmanuelCampos](https://github.com/EmanuelCampos) | 42 | | :------------------------------------------------------------------------------------------------------------------------------: | 43 | -------------------------------------------------------------------------------- /flow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmanuelCampos/opensea-script/8a0c207215dc074050b8f50a65b4580d7e7f43dd/flow.gif -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "@chainsafe/dappeteer": "^2.2.0", 8 | "dappeteer": "^1.0.0", 9 | "esbuild": "^0.13.10", 10 | "esbuild-register": "^3.0.0", 11 | "puppeteer": "^10.4.0" 12 | }, 13 | "scripts": { 14 | "es": "node -r esbuild-register" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/script.ts: -------------------------------------------------------------------------------- 1 | import puppeteer, { Page } from 'puppeteer'; 2 | import dappeteer from '@chainsafe/dappeteer'; 3 | import fs from 'fs'; 4 | 5 | const collectionName = "Your Collection Name" 6 | 7 | const collectionURL = `https://opensea.io/${collectionName}/asset/create` 8 | 9 | const openseaDescription = `Your description here` 10 | 11 | const lockedContent = `Locked content text here` 12 | 13 | const secretPhase = `here is your secret phase dont share it` 14 | 15 | const connectWallet = async (page: Page, metamask) => { 16 | const button = await page.$('button.dBFmez:first-child'); 17 | await button.click(); 18 | 19 | await metamask.approve(); 20 | 21 | return; 22 | } 23 | 24 | const uploadImage = async (page: Page, file: string) => { 25 | const elementHandle = await page.$("#media"); 26 | await elementHandle.uploadFile(`images/${file}`); 27 | 28 | return; 29 | } 30 | 31 | const pageTimeout = async (number: number, page: Page) => { 32 | await page.waitForTimeout(number) 33 | return; 34 | } 35 | 36 | const fillFields = async (page: Page, fileName: string) => { 37 | await page.focus('#name') 38 | await page.keyboard.type(fileName) 39 | 40 | await pageTimeout(1000, page) 41 | 42 | await page.$eval('#description', (el, value) => el.value = value, openseaDescription); 43 | await page.focus('#description') 44 | await page.keyboard.type(' ') 45 | 46 | await pageTimeout(1000, page) 47 | 48 | await page.evaluate(() => { 49 | document.querySelector("#unlockable-content-toggle").parentElement.click(); 50 | }); 51 | 52 | await pageTimeout(1000, page) 53 | 54 | await page.$eval('textarea[placeholder="Enter content (access key, code to redeem, link to a file, etc.)"]', (el, value) => el.value = value, lockedContent); 55 | await page.focus('textarea[placeholder="Enter content (access key, code to redeem, link to a file, etc.)"]') 56 | await page.keyboard.type(' ') 57 | 58 | const input = await page.$("#chain") 59 | input.click() 60 | 61 | await pageTimeout(1000, page) 62 | 63 | await page.click('img[src="/static/images/logos/polygon.svg"]') 64 | 65 | return; 66 | } 67 | 68 | (async () => { 69 | const browser = await dappeteer.launch(puppeteer, { metamaskVersion: 'v10.1.1' }); 70 | const metamask = await dappeteer.setupMetamask(browser, { seed: secretPhase}); 71 | const files = await fs.promises.readdir("images/"); 72 | files.shift() 73 | 74 | const page = await browser.newPage(); 75 | await page.goto(collectionURL); 76 | 77 | const firstTabs = await browser.pages() 78 | await firstTabs[0].close() 79 | 80 | await pageTimeout(2000, page) 81 | 82 | await connectWallet(page, metamask) 83 | 84 | for (let i = 0; i <= files.length ; i++) { 85 | const tabs = await browser.pages() 86 | const data = { 87 | name: `Your collection name here #${1 + i}`, 88 | } 89 | 90 | if(i === 0) { 91 | await tabs[1].bringToFront() 92 | await tabs[1].goto(collectionURL) 93 | 94 | await pageTimeout(2000, page) 95 | 96 | await metamask.sign() 97 | await metamask.page.waitForTimeout(2000) 98 | } 99 | 100 | if(i === 0) { 101 | await tabs[1].bringToFront() 102 | await tabs[1].goto(collectionURL) 103 | } else { 104 | await tabs[1].bringToFront() 105 | await tabs[1].goto(collectionURL) 106 | } 107 | 108 | await pageTimeout(2000, page) 109 | 110 | await uploadImage(page, files[i]); 111 | await fillFields(page, data.name); 112 | 113 | const button = await page.$('.AssetForm--action button'); 114 | await button.click() 115 | 116 | await pageTimeout(4000, page) 117 | 118 | fs.renameSync(`images/${files[i]}`, `images/completed-${files[i]}`) 119 | 120 | console.log({ message: `Mint the NFT: ${data.name}`, fileName: files[i]}) 121 | console.log(`Mint the NFT: ${data.name}`) 122 | } 123 | 124 | console.log('Minted all NFTs with success') 125 | })(); --------------------------------------------------------------------------------