Transfer assets using Moralis

Hey guys!
I want to get transaction confirmation after executing Moralis.transfer().
To do this, Moralis document says we would use transaction.wait()
I tried like this but .wait() function is not recognized in TypeScript. (Next.js + TypeScript)
It works fine in dev environment (npm run dev) but it has building error when deploying. (npm run build)
What should I do?

1 Like

Almost there, so we define and execute the function has:

const transaction = await Moralis.executeFunction(options)

Then you should define a new variable which will store the transaction result.

        // Wait until the transaction is confirmed
        const txResolve = await transaction.wait()

Then you could verify that the variable does have property you want from it, example

        if (txResolve.transactionHash) {
            console.log('Transaction Executed', txResolve.transactionHash);
        }

Hope it helps.

Carlos Z