banner



How Much Does It Cost To Install A Receptacle

Minting to Opensea

After creating all your NFTs the more hardest step is to mint so many NFTs to Opensea mostly in large quantities without a contract.

Gif from process

To do information technology I'll share my repository that uses puppeteer to automate the procedure of minting the NFTs, you just need an images binder file and the images name to mint all. I'll teach you how to employ the repository beneath.

If you want to add together another property on the mint fourth dimension transport me an email we can hash out information technology oi@manel.dev.

Install the packages

To start nosotros go to install the packages to run the script, on your project run:

            yarn add @chainsafe/dappeteer puppeteer esbuild esbuild-register                      

Enter fullscreen mode Exit fullscreen way

The @chainsafe/dappeteer serves to automate the metamask connect to mint the NFTs.

The puppeteer we volition employ to upload the images and fill the inputs.

And we are going to employ the esbuild and esbuild-register to run our script.

Create the script

Let's start creating a file called script.ts file doing the first imports and adding your first variables.

script.ts

                          import              puppeteer              ,              {              Page              }              from              '              puppeteer              '              ;              import              dappeteer              from              '              @chainsafe/dappeteer              '              ;              import              fs              from              '              fs              '              ;              const              collectionName              =              "              Your Collection Name              "              const              collectionURL              =              `https://opensea.io/drove/              ${              collectionName              }              /avails/create`              const              openseaDescription              =              `Your clarification here`              const              lockedContent              =              `Locked content text here`                      

Enter fullscreen mode Get out fullscreen style

Connect Wallet Function

So to select the Metamask wallet when our script opens the Browser, let's create a role to click on the Metamask button and connect to the wallet.

script.ts

                          const              connectWallet              =              async              (              page              :              Page              ,              metamask              )              =>              {              const              button              =              wait              folio              .              $              (              '              button.dBFmez:first-child              '              );              await              push button              .              click              ();              await              metamask              .              approve              ();              return              ;              }                      

Enter fullscreen mode Exit fullscreen fashion

Create the Upload Image role

Now to upload the prototype on create NFT page let's create the function which receives the page and the file then takes the input element in the HTML and uploads the prototype to it.

script.ts

                          const              uploadImage              =              async              (              page              :              Page              ,              file              :              string              )              =>              {              const              elementHandle              =              await              page              .              $              (              "              #media              "              );              await              elementHandle              .              uploadFile              (              `images/              ${              file              }              `              );              render              ;              }                      

Enter fullscreen mode Exit fullscreen fashion

Create the folio timeout function

This office is to give time for our script to perform the filling or clicks in the application.

script.ts

                          const              pageTimeout              =              async              (              time              :              number              ,              folio              :              Page              )              =>              {              look              folio              .              waitForTimeout              (              time              )              render              ;              }                      

Enter fullscreen mode Go out fullscreen mode

Create the fill fields part

this is the function where we are going to get each field from the create NFT folio and fill it.

the steps this function takes
1- Make full in the field proper noun
2 - Fill in the field input.
iii - Plow on the unlockable content and fill the unlockable content text.
4 - Select the Polygon chain

script.ts

                          const              fillFields              =              async              (              page              :              Folio              ,              fileName              :              string              )              =>              {              // Become and fill up in the input name              wait              page              .              focus              (              '              #name              '              )              expect              page              .              keyboard              .              type              (              fileName              )              await              pageTimeout              (              1000              ,              page              )              //Get and fill in the input name              await              page              .              $eval              (              '              #description              '              ,              (              el              ,              value              )              =>              el              .              value              =              value              ,              openseaDescription              );              await              page              .              focus              (              '              #description              '              )              await              page              .              keyboard              .              type              (              '                                          '              )              await              pageTimeout              (              thou              ,              folio              )              // Click on the unlockable content checkbox              look              page              .              evaluate              (()              =>              {              document              .              querySelector              (              "              #unlockable-content-toggle              "              ).              parentElement              .              click              ();              });              await              pageTimeout              (              grand              ,              page              )              // Make full in the unlockable content text              look              folio              .              $eval              (              '              textarea[placeholder="Enter content (access key, code to redeem, link to a file, etc.)"]              '              ,              (              el              ,              value              )              =>              el              .              value              =              value              ,              lockedContent              );              look              folio              .              focus              (              '              textarea[placeholder="Enter content (admission key, lawmaking to redeem, link to a file, etc.)"]              '              )              await              folio              .              keyboard              .              type              (              '                                          '              )              // Open the select chain input              const              input              =              await              folio              .              $              (              "              #concatenation              "              )              input              .              click              ()              expect              pageTimeout              (              1000              ,              page              )              // Select the polygon concatenation              await              page              .              click              (              '              img[src="/static/images/logos/polygon.svg"]              '              )              return              ;              }                      

Enter fullscreen manner Leave fullscreen mode

Creating the Main Function

In this function nosotros get to create all the main functions to run our scripts the steps are:

1 - Run the dappeteer to fix the Metamask on Opensea.
two - Go our files from the images folder file.
3 - Remove the first file(.DS_Store) - merely for macOS.
4 - Open the create nugget page of the collection.
v - Run the connect wallet function
half dozen - Run a loop for each epitome on the images folder (to create the asset one by one)

See the code below step-past-step:

script.ts

                          (              async              ()              =>              {              // Async part because we need promises to do it              const              browser              =              await              dappeteer              .              launch              (              puppeteer              ,              {              metamaskVersion              :              '              v10.one.one              '              });              // Launch the browser with metamask              const              metamask              =              look              dappeteer              .              setupMetamask              (              browser              ,              {              seed              :              "              Hugger-mugger phase hither              "              });              // Add together your secret phase hither to metamask connect with your business relationship              const              files              =              look              fs              .              promises              .              readdir              (              "              images/              "              );              // Get an Listing with all images on images binder              files              .              shift              ()              // WARN: merely on macOS: remove the first file .DS_Store                            // Open the create assets url of the  drove              const              page              =              await              browser              .              newPage              ();              await              page              .              goto              (              collectionURL              );              // Get the tabs and close the showtime tab openned by the dappeteer              const              firstTabs              =              expect              browser              .              pages              ()              look              firstTabs              [              0              ].              close              ()              await              pageTimeout              (              2000              ,              page              )              // Run our part to click on the Metamask button in the Opensea              look              connectWallet              (              folio              ,              metamask              )              // Start the loop on each image of images binder              for              (              let              i              =              0              ;              i              <=              files              .              length              ;              i              ++              )              {              const              tabs              =              await              browser              .              pages              ()              // Get the tabs on each loop              const              information              =              {              proper noun              :              `Your Asset name here #              ${              1              +              i              }              `              ,              // Add your NFT name (the count kickoff on i and stop on the quantity of the files)              }              // At the first time on loop you demand to practice an sign to create the avails                            if              (              i              ===              0              )              {              await              tabs              [              ane              ].              bringToFront              ()              // Motility i tab              await              tabs              [              1              ].              goto              (              collectionURL              )              // Alter the page to drove url over again              wait              pageTimeout              (              2000              ,              page              )              await              metamask              .              sign              ()              // Use the metamask to exercise the transaction              await              metamask              .              page              .              waitForTimeout              (              2000              )              // look for the transaction              }              // Now if non the offset fourth dimension, later on creating the first NFT just open up the create assets page again to create the 2nd NFT and and then sequentially.              if              (              i              ===              0              )              {              expect              tabs              [              1              ].              bringToFront              ()              wait              tabs              [              1              ].              goto              (              collectionURL              )              }              else              {              await              tabs              [              ane              ].              bringToFront              ()              await              tabs              [              1              ].              goto              (              collectionURL              )              }              look              pageTimeout              (              2000              ,              folio              )              // Upload the current image file              wait              uploadImage              (              page              ,              files              [              i              ]);              // Fill the fields using the asset name with the count              look              fillFields              (              page              ,              data              .              name              );              // Click on create asset button              const              button              =              await              page              .              $              (              '              .AssetForm--action push              '              );              await              button              .              click              ()              await              pageTimeout              (              4000              ,              page              )              // Rename the epitome name to know if already is completed              fs              .              renameSync              (              `images/              ${              files              [              i              ]}              `              ,              `images/completed-              ${              files              [              i              ]}              `              )              panel              .              log              ({              message              :              `Mint the NFT:                            ${              data              .              name              }              `              ,              fileName              :              files              [              i              ]})              console              .              log              (              `Mint the NFT:                            ${              data              .              name              }              `              )              }              console              .              log              (              '              Minted all NFTs with success              '              )              })();                      

Enter fullscreen style Get out fullscreen way

Ready!! at present Let's config our parcel.json to run the script with ane line

package.json

                          {                                          "proper name"              :                                          "node"              ,                                          "version"              :                                          "i.0.0"              ,                                          "main"              :                                          "alphabetize.js"              ,                                          "license"              :                                          "MIT"              ,                                          "dependencies"              :                                          {                                          "@chainsafe/dappeteer"              :                                          "^two.2.0"              ,                                          "dappeteer"              :                                          "^1.0.0"              ,                                          "esbuild"              :                                          "^0.thirteen.10"              ,                                          "esbuild-register"              :                                          "^three.0.0"              ,                                          "puppeteer"              :                                          "^ten.4.0"                                          },                                          "scripts"              :                                          {                                          "es"              :                                          "node -r esbuild-register"                                          }                                          }                                                  

Enter fullscreen style Leave fullscreen mode

Now to run your script just run on the CLI:

            yarn es ./src/script.ts                      

Enter fullscreen style Go out fullscreen style

Download the Repository

Kickoff, you need to download my repository here that contains the script to mint the NFTs.

Star my repository here

It'southward washed, at present the puppeteer will create all your NFTs ane by ane then much fast.

That's it!!

Follow me on Twitter
My Github

Source: https://dev.to/emanuelferreira/how-to-mint-10000-nfts-on-opensea-487c

Posted by: piercehurse1967.blogspot.com

0 Response to "How Much Does It Cost To Install A Receptacle"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel