Created
February 19, 2022 05:02
-
-
Save jjohnson5253/994fd9a1f4e029a1d9234dc47da5a531 to your computer and use it in GitHub Desktop.
Mint NFT with node.js and ThirdWeb
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
/* | |
npm init -y | |
npm install @3rdweb/sdk ethers dotenv | |
npm install --save-dev typescript @types/node ts-node tslib | |
run: | |
node index.js | |
*/ | |
const { ethers } = require("ethers"); | |
const { ThirdwebSDK } = require('@3rdweb/sdk'); | |
const rpcUrl = "https://polygon-rpc.com/"; | |
const provider = ethers.getDefaultProvider(rpcUrl); | |
const sdk = new ThirdwebSDK( | |
new ethers.Wallet( | |
// Your wallet private key | |
"private key here", | |
// RPC URL | |
ethers.getDefaultProvider("https://rinkeby-light.eth.linkpool.io/") | |
) | |
); | |
const collectionAddr = "0xF372803c9AB9d12Cb3ea2D52d0Bb561026aA9118"; // medieval stuff addr | |
// Initialize nft SDK by passing in contract address | |
const nftModule = sdk.getNFTModule(collectionAddr); | |
// Minting the NFT asynchronously | |
async function mint() { | |
console.log( | |
await nftModule.mint({ | |
name: "Test", | |
description: "Test Description", | |
image: "ipfs://QmbGpe6dJQA9awBbTKEULufp9TTjXw1esVUbZNQrLM57nK", | |
properties: {}, | |
}), | |
); | |
} | |
// Running the entire thing | |
mint(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment