Allow to set gas limit in "Moralis.executeFunction" options

When using ether.js directly I can set a gas limit, but with Moralis.executeFunction the only override that is being exposed is “msgValue” (value), why not expose the rest of the override options from ethers/web3? (using moralis 1.3.2)

I get errors where ethers fail to evaluate the gas price for the function, and now I have to use ethers directly instead of relying on Moralis to execute functions because of that, can you please expose the gasLimit/gas option or add the other overrides that come through ethers/web3?

ethers.js: https://docs.ethers.io/v5/api/contract/contract/#contract-functionsSend
web3.js - https://web3js.readthedocs.io/en/v1.2.2/web3-eth-contract.html#eth-contract

If it’s already available, it’s not in the typescript/documentation, this is the options type:

  interface ExecuteFunctionOptions {
    contractAddress: string;
    abi: object;
    functionName: string;
    msgValue?: string;
    params?: ExecuteFunctionParams;
    /* missing this -> gasLimit?: number; */ 
  }

you can propose this on roadmap.moralis.io, or add a PR to the code: https://github.com/MoralisWeb3/Moralis-JS-SDK

most of the time it is not needed to specify the gas limit

I know, but in many cases it’s useful, anyway I will make a PR =)

1 Like

Has this issue been addressed? I also need to set the gas limit in Moralis.executeFunction.

You will have to use web3 or ethers directly if you want to change the gas limit or gas price.

1 Like

This is an important feature. Some of my polygon transactions fail due to insufficient gas error. And just because of that I have to register on ifura, get an RPC node and use web3 directly. Had Moralis had this feature it would’ve been much easier for the users.

1 Like

Moralis seems to not care so much about their user base or the companies who already use them, they keep breaking features and not being backwards compatible, also they don’t play nicely with other web3 tools, I’d suggest to drop the use of moralis now before it becomes too hard to do so later.

The latest updates have broke most of our web3 systems and forced us to do a lot of refactor work just to keep things alive, 9 months into using moralis, I truly regret ever using them :cold_sweat:, I would recommend alchemy or infura + ethers.

2 Likes

Your story is sad. But I understand what you’re saying. I’m using the old version of SDK - 1.5.9. because the new one gave me a strange “Right side error…” and the only solution recommended here was to downgrade to 1.4.0, which also didn’t solve the problem. Right now I’m just hoping that my 1.5.9 keeps working. :slight_smile: But I like their full-stack service with many simplifications, which is what keeps me from starting to investigate alternatives. Hope the Moralis team reads this and focuses more on building stable products instead of quick releases and new design.

just because of that I have to register on ifura, get an RPC node and use web3 directly

If you’re using your wallet as the web3 provider, you don’t need a separate RPC from a node provider (although it’s always preferred over using public RPC URLs in general). It is just the setting of gas that isn’t possible with Moralis.executeFunction.

gave me a strange “Right side error…

For the right hand side error, the latest stable versions you can use in a React project currently are [email protected] and [email protected].

also they don’t play nicely with other web3 tools

@liron Can you please elaborate on which tools and how they don’t work? Which updates broke your systems?

I’m honestly tired of repeating it, you can just see all my other posts in the blog, moralis is just not planned in a way that it would play well with other tools and the layers of obfuscation makes it hard to do anything slightly advanced with it.

not to talk about moralis 2 which completely broke any app working with moralis 1.

Ok, I’m not seeing any posts from you involving other tools/libraries breaking. Some more details would help.