Mint evolved NFTs
Mint or evolve NFTs require connection directly with the blockchain network.
Recomendation: If you are running JS Application, we recommend use SDK.
1) After call Evolve NFTs you will receive a response like this:
// Response after call Create NFTs
{
"result": {
"totalToMint": 1,
"addresses": [
"0x123456543..."
],
"amounts": [
1
],
"uris": [
"QmZygrQQnuEMdBu4qdPCvpggn4S5CXpoVjF1WeqqSJF4W3"
],
"jsons": [
"https://minteandome.s3.eu-west-1.amazonaws.com/nfts-jsons/d28124dbc4a15cf434f85fb14cea9d0d.json?AWSAccessKeyId=AKIA4UF45MWWZJU7EXG4&Expires=1706489001&Signature=HvkyDURzfolsfecCGg%2BOYXxmKKU%3D"
],
"images": [
"https://minteandome.s3.eu-west-1.amazonaws.com/nfts-images/f7821381-0267-4138-a572-87ea4a32b536.png?AWSAccessKeyId=AKIA4UF45MWWZJU7EXG4&Expires=1706489001&Signature=aDosVaRQ4ItQsWR4%2B%2FGlvfwBBtc%3D"
],
"ids": [
0
],
"_ids": [
"65b6f250dc82be020b636ec8"
],
"smartContractId": "65b6b72a18801bf21674b744",
"blockchainId": "7",
"typeBlockchain": 7,
"minteableFree": true,
"nftsCreated": [
{
"smartContractId": "65b6b72a18801bf21674b744",
"ipfsUrl": "QmZygrQQnuEMdBu4qdPCvpggn4S5CXpoVjF1WeqqSJF4W3",
"path": "f7821381-0267-4138-a572-87ea4a32b536.png",
"json": "d28124dbc4a15cf434f85fb14cea9d0d.json",
"idNFT": 0,
"wallet": "0x26c9a6b5f0412f21ff581ac223618f5901ccea3f",
"contentType": "image/png",
"status": 0,
"type": 1,
"attributes": [],
"includeMint": true,
"paid": false,
"_id": "65b6f250dc82be020b636ec8",
"__v": 0,
"createdAt": "2024-01-29T00:33:20.738Z",
"updatedAt": "2024-01-29T00:33:20.738Z"
}
]
},
"error": null
}
This response is prepared for send information to the function in the smart contract.
// ABI MINT FILE EVM:
Inputs Function MintNFTs
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "_id",
"type": "uint256"
},
{
"internalType": "string",
"name": "_uri",
"type": "string"
}
],
"name": "evolveNFT",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]
2) You can use response /create-nfts and send data to blockchain (without parsing).
// PSEUDO-CODE: Example calling funcion to smart contract.
async evolveNFTs (smartContractAddress : string, blockchainId : number, nfts ) {
const evolvedNFT = await MTMService.evolveNFTs(smartContractAddress, nfts); // CALL TO GENERATE NFTS
// You wouldn't need parse the response, just call to smart contract.
// if you send more than one nft, you need call this.mint N times
const mint = await this.mint(smartContractAddress, blockchainId, nfts.ids[0], nfts.uris[0]);
}
async getProvider (blockchainId: string) : ethers.providers.Web3Provider {
const chain = parseInt(blockchainId, 10);
await (window as any).ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId : '0x' + blockchainId }],
})
return new ethers.providers.Web3Provider((window as any).ethereum);
}
async initializeContract (smartContractAddress : string, blockchainId : string, type? : SMART_CONTRACT_TYPE) : any {
const smartContractABI = require(./../smartContracts/smartContractMinGeneric.json')?.abi; // ABI CONTRACT
const provider = await this.getProvider(blockchainId);
const signer = provider.getSigner();
return new ethers.Contract(smartContractAddress, smartContractABI, signer);
}
async evolveNFT(smartContractAddress : string, blockchainId : number , idEvolvedNFT: number, uriEvolvedNFT : string) {
const overrides = {
gasLimit: 1672197,
};
const contract = await initializeContract(smartContract.smartContractAddress!, smartContract.blockchainId!);
let response;
//CALLING TO SMART CONTRACT
response = await contract.evolveNFT(idEvolvedNFT, uriEvolvedNFT, overrides);
await response.wait(1);
}
In that moment , your nfts will be minted in blockchain and you could check in the Blockchain Scanner.
Last updated