Hi,
Based on your documentation here I should be able to execute transaction wait function like so:
const transaction = await Moralis.executeFunction(options);
const result = await transaction.wait();
Unfortunately the type you are using in Moralis namespace
for executeFunction
response looks like this:
type ExecuteFunctionCallResult = EthersResult;
type ExecuteFunctionSendResult = EthersTransaction;
type ExecuteFunctionResult = ExecuteFunctionCallResult | ExecuteFunctionSendResult;
...
type EthersTransaction = import('ethers').Transaction; // <- this is the issue
...
let executeFunction: (options: ExecuteFunctionOptions) => Promise<ExecuteFunctionResult>;
The Transaction
type in ethers.js doesnβt include wait()
fn, but when checking the actual executeFunction
response I can see that it includes it.
So what you actually return (I think) is TransactionResponse
from ethers.js.
I think you are using a wrong type in your typings, and because of that itβs impossible to access wait()
function in Typescript projects.
My temporary solution to this is to force-cast like this:
import { TransactionResponse } from '@ethersproject/abstract-provider';
...
const transaction = await Moralis.executeFunction(options) as unknown as TransactionResponse;
const result = await transaction.wait();
Only this way I can access wait()
in a Typescript project.
Thanks
Moralis SDK version: 1.8.0