To use the API key:
- Execute the specified commands.
- Paste the generated API key in the “Your ChainGPT API key” placeholder.
const { Nft } = require('@chaingpt/nft');
const nftInstance = new Nft({
apiKey: 'Your ChainGPT API Key',
});
async function main() {
const generatedImage = await nftInstance.generateNft({
walletAddress: "", // Public Key of the wallet that will mint NFT
prompt: "", // Prompt to be used to generate the NFT art
model: "" // Model to be used to generate the NFT art
});
}
We provide TypeScript/ JavaScript libraries with support for Node.js. Install it by running:
Once installed, you can use the library and your secret key to run the following:
const { Nft } = require('@chaingpt/nft');
const nftInstance = new Nft({
apiKey: 'Your ChainGPT API Key',
});
async function main() {
const generatedImage = await nftInstance.generateNft({
walletAddress: "", // Public Key of the wallet that will mint NFT
prompt: "", // Prompt to be used to generate the NFT art
model: "" // Model to be used to generate the NFT art
});
}
main();
ChainGPT NFT Generator SDK provides following features
-
User’s wallet Address (String)
-
User’s Prompt (String)
-
Model name (String)
- ChainGPT
- RealMimic
- Animatrix
- PixelMaster
- ThreeDImageForge
- DrawDreamer
- DrawDreamerV2’
- AnimeVerse
- RealVision
- FantasyVerse
- VisionaryForge
Note: You must have to select any of the model above.
\\
const { Nft } = require('@chaingpt/nft');
const nftInstance = new Nft({
apiKey: 'Your ChainGPT API Key',
});
async function main() {
const generatedImage = await nftInstance.generateNft({
walletAddress: "", // Public Key of the wallet that will mint NFT
prompt: "", // Prompt to be used to generate the NFT art
model: "" // Model to be used to generate the NFT art
});
}
main();
const { Nft } = require('@chaingpt/nft');
const nftInstance = new Nft({
apiKey: 'Your ChainGPT API Key',
});
async function main() {
const generatedImageQueue = await nftInstance.generateNftWithQueue({
walletAddress: "", // Public Key of the wallet that will mint NFT
prompt: "", // Prompt to be used to generate the NFT art
model: "" // Model to be used to generate the NFT art
});
}
main();
It's useful with the function: generateNftWithQueue(). It allows users to see the progress of their NFT generation. If users generate a huge amount of NFTs, they can always see how many NFTs are generated and remaining.
const { Nft } = require('@chaingpt/nft');
const nftInstance = new Nft({
apiKey: 'Your ChainGPT API Key',
});
async function main() {
const getProgress = await nftInstance.getNftProgress({
collectionId: "" // your NFT generation collection ID
});
}
main();
After generating the NFT, users can now mint the NFT on the chain using the code below. This chunk of code will provide the required data for minting the generated NFT
const { Nft } = require('@chaingpt/nft');
const nftInstance = new Nft({
apiKey: 'Your ChainGPT API Key',
});
async function main() {
const mint = await nftInstance.mintNft({
collectionId: "", // Your NFT generation Collection ID
name: "", // A name for your NFT
description: "" // A description for your NFT
});
}
main();
const { Nft } = require('@chaingpt/nft');
const nftInstance = new Nft({
apiKey: 'Your ChainGPT API Key',
});
async function main() {
const abi = await nftInstance.abi();
}
main();
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), an error will be thrown:
// Error handler of NFT SDK
const { Nft } = require('@chaingpt/nft');
const nftInstance = new Nft({
apiKey: 'Your ChainGPT API Key',
});
async function main() {
try {
const mint = await nftInstance.mintNft({
collectionId: "", // Your NFT generation Collection ID
name: "", // A name for your NFT
description: "" // A description for your NFT
});
} catch (error) {
console.log("error", error.message);
}
}
main();
Our SDK supports Javascript language and will run on Node applications.
- To ensure security, the SDK is made accessible using an authentication key. Users having credits in the web-app and a valid API key shall be able to access the SDK
Release history is maintained. However, this is the first release; in the future, more features will be added, and the latest version will be released for users.
Please check out this link for SDK code documentation
https://www.npmjs.com/package/@chaingpt/nft
If you need further assistance, explore the available support channels provided on our website https://www.chaingpt.org/ or check our Discord.
\
\