[SOLVED] executeFunction get response events null

Hi, after minting nft in smart contract, in need to get the token id of newly minted nft. For that i try to get transfer event, but response events value is null. How can i solve this issue please…

My code:

`async createToken() {

        const ABI = [{
            "inputs": [{
                "internalType": "string",
                "name": "tokenURI",
                "type": "string"
            }],
            "name": "createToken",
            "outputs": [],
            "stateMutability": "nonpayable",
            "type": "function"
        }]; // Add ABI of 0xdAC17F958D2ee523a2206206994597C13D831ec7
        const options = {
            contractAddress: this.authenticated,
            functionName: "createToken",
            abi: ABI,
            params: {
                tokenURI: "https://ipfs.moralis.io:2053/ipfs/QmasrxHNz5sy3GSSv4hxtY9WftfeeGW74aB3KdUw46dwvj",
            }
        };
        // Run smart contract function  
        const transaction = await Moralis.executeFunction(options);
        const receipt = await transaction.wait(1);
        const events = receipt.events[0];

        console.log('(executeFunction) receipt', receipt);
        console.log('(executeFunction) events', events);

        this.saveProgress = false;
    }`

Response:

{
        "to": "0xD51E2B298668b490Cd1BB29C5F595048BDcafda1",
        "from": "0xD51E2B298668b490Cd1BB29C5F595048BDcafda1",
        "contractAddress": null,
        "transactionIndex": 6,
        "gasUsed": {
            "type": "BigNumber",
            "hex": "0x58a0"
        },
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "blockHash": "0x776261baea598069619ca139053f6f80c3510d92b3f2e4ce31d942597af4e485",
        "transactionHash": "0x8d175b72b2c7ef49ddc7474920baf13450f0d84b6cf962fc1fcc28e3e9fafc99",
        "logs": [],
        "blockNumber": 12693208,
        "confirmations": 1,
        "cumulativeGasUsed": {
            "type": "BigNumber",
            "hex": "0x07eaa6"
        },
        "effectiveGasPrice": {
            "type": "BigNumber",
            "hex": "0x59682f07"
        },
        "status": 1,
        "type": 2,
        "byzantium": true,
        "events": []
    }

The transaction was successful? You see the event on chain?

1 Like

Yes, Transaction was successfull!

what blockchain it is?

from there I don’t see that particular transaction hash that you pasted, now I also notice that to address is the same as from address?

1 Like

Thank you so much, Finally get the events. Actually it was my mistake. I pass my contract address as ā€œcontractAddressā€ parameter, It should be that address where we push our metadata. Thank’s again for quick response.

1 Like