About the initial estimate of gas prices

I would like to transfer my token using Moralis.
However, on the confirmation screen, it says “Processing time is unknown”, indicating that my gas fee is low.

If I manually set my gas fee higher, I can transfer the money. However, it is not user friendly.
I want to set the default value of the gas price to standard because my site keeps confirming it.

By the way, this was not the case a few weeks ago.

I’ll write the source I’m using for your reference.


const options = {
type: “native”,
amount: Moralis.Units.ETH(this.sendFee),
receiver: 0xhoge,
};
await Moralis.transfer(options);


let txOptions = {
type: “erc1155”,
receiver: address,
contractAddress: this.contractAddress,
tokenId: this.tokenId,
amount: 1,
};
await Moralis.transfer(txOptions);

I think that initial gas estimation will be done by metamask and not by moralis (even though it says site suggested there in metamask), and metamsk will query a node for that gas estimation

what version of Moralis SDK are you using now? with what version it was working fine?

Hmmm. Is it really so?

I tried to transfer the token using a method other than Moralis.
When I replaced the code in ① with “ethers” and transferred the data, the gas estimated correctly and no warning message was displayed.

The version of the Moralis SDK is 0.0.135. It has not changed since the previous success.

that shouldn’t be a problem for Moralis SDK then, maybe you changed the RPC node in metamask recently

Indeed, I recently changed my PC and installed a new wallet.

But I tried all the RPC URLs with reference to Polygon’s site, but no improvement.

did you try the RPC from moralis speedy node?

Yes.

After upgrading Moralis, the problem was solved.

To isolate the problem, I created a new project and installed Moralis.
After that, I performed a token transfer, and the problem stopped occurring, so I was able to isolate the cause of the problem.

The version was 1.2.0 when I solved the problem.

strange, you say that if you use now an older version of the SDK you can replicate that problem?

Yes.

You can check it on my site.
On my site, there is a donation form.
I’d like you to make a donation there.
(Of course, you don’t need to actually send money, you just need to see the confirmation screen.)

■Success(Ver1.2.0)

■Fail(Ver0.0.135)

The only difference in the source code of the projects is the version of Moralis.

(I recently changed the domain of my site, but the problem occurred in my local environment, so it should not be a problem.)

I tested with BSC and it seems to work fine on both websites

I’m sorry. I did not specify the chain.
It is happening with Polygon.

It looks like I don’t have enough matic to test on polygon now, it will be expected to fail the gas estimation if I don’t have enough matic in the account

I have same problem on Polygon.


Dont know how to set the default value of the gas price to standard via site. If i set gas price manually, it works good.

can you try with different RPC addresses in metamask for polygon?

yep, now it work normally for my metamask but other users can face with same problem. Is the way to set gas fees via site?

you may be able to do it directly with web3, executeFunction doesn’t have that parameter

Cannot estimate gas; transaction may fail or may require gas limit

This error message means that MetaMask cannot estimate the fee for that particular transaction. You can read more about that in Cannot estimate gas metamask article. but maybe needs to another source.