@ikalasdev/nftgenerator
v1.2.7
Published
generate nft easily
Downloads
19
Readme
NftGenerator
installation
npm install @ikalasdev/nft-generator
usage
you need to specify a network rpc url and a privateKey.
the nft file and the metadata is publish on pinata ipfs. you can change the pinata api key and secret in the properties.
only the deployer of the contract can mint new nfts so if you need to add new nfts to the collection you need to use the same deployer wallet.
Exemple
create new nft
const nftGenerator = require('@ikalasdev/nftgenerator');
const properties = {
name: "collection Name ",
description: "collection description ",
nfts: [
{
//required properties
filePath: "./nfts/1.png", // can be a url or a local path
//optional properties (you can add as many as you want)
name: "nft name",
description: "nft description",
attributes: [
{
"trait_type": "Background",
"value": "Black"
}
]
}
],
//optional by default the nft owner will be the deployer of the contract
owner: "0xSFsdfs....",
//optional if you need to specify a network
network: {
rpcUrl: "https://polygon-mumbai.g.alchemy.com/v2/FSDFS...",
privateKey: YOUR_PRIVATE_KEY
},
//optional if you want to use a different pinata api key and secret
pinata: {
apiKey: "YOUR_API_KEY",
apiSecret: "YOUR_SECRET"
}
};
async function main() {
await nftGenerator.create(properties);
}
add new nft to collection
const nftGenerator = require('@ikalasdev/nftgenerator');
const properties = {
name: "collection Name ",
description: "collection description ",
nfts: [
{
//required properties
name: "nft name ",
filePath: "./nfts/1.png", // can be a url or a local path
//optional properties (you can add as many as you want)
description: "nft description",
attributes: [
{
"trait_type": "Background",
"value": "Black"
}
]
}
],
owner: "0xSFsdfs....", // futur owner of the nft
contractAddress: "0xCF793afc84B8a9415579022CC00551dA146E80d3", // contract address of the collection
//optional if you need to specify a network
network: {
rpcUrl: "https://polygon-mumbai.g.alchemy.com/v2/FSDFS...",
privateKey: YOUR_PRIVATE_KEY
},
//optional if you want to use a different pinata api key and secret
pinata: {
apiKey: "YOUR_API_KEY",
apiSecret: "YOUR_SECRET"
}
};
async function main() {
await nftGenerator.addToCollection(properties);
}