Moralis.executeFunction return type

Hi,

I would like to get the return value of my smart contract function when I call executeFunction. I am returning an integer value (for the token id that I am generating in the smart contract) but when I assign the result to a variable, I get an entire JSON yet it does not include the return value that I am passing. Any clues how to get the return value. Also for some reason I cant see events in the result. So these are 2 issues altogether.

1 Like

when you get the result after the transaction is confirmed (you may need to use a wait, the events should be in the returned data.
about that returned number, you may not be able to get it with executeFunction (assuming that you are calling a write function that will pop up metamask)

Thanks a lot. This is a wrapped mint function actually which is creating an 1155 NFT and I am trying to return the token id. Is there a way to get the token id of the minted NFT. I am generating an event and that returns data with the token id , so I will try to put wait. Is there a better way to get the token id. Can I use the transaction hash in some Moralis function to get the token id?

I know that you can get it from events, if you have the transaction hash you can use the API to get the transaction details and from there to look in events too, but you will still have to wait somehow until the transaction is mined on chain

Hi, is there an example of this?

I think the API should return the output as well.

How do you use it now? What do you get now as response?