Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot prevent site suggested gas price in Metamask #7303

Closed
jalaguerom opened this issue Oct 4, 2024 · 12 comments · Fixed by #7320
Closed

Cannot prevent site suggested gas price in Metamask #7303

jalaguerom opened this issue Oct 4, 2024 · 12 comments · Fixed by #7320
Assignees
Labels
4.x 4.0 related Bug Addressing a bug

Comments

@jalaguerom
Copy link

jalaguerom commented Oct 4, 2024

Expected behavior

Passing maxPriorityFeePerGas and maxFeePerGas as undefined to contract.method.send function should make Metamask calculate gas prices on its own based on market value.

Actual behavior

Metamask shows site suggested gas price and incorrect speed time values

Steps to reproduce the behavior

  1. Install latest Metamask version
  2. Try to send a transaction to a smart contract abi method using send function, without sending maxPriorityFeePerGas and maxFeePerGas

Related issue: #7081. Solution talks about ignoreGasPricing parameter but it is not present in the send function

Captura de pantalla 2024-10-04 a las 14 55 02

web3js version: 4.13.0

@mconnelly8
Copy link

Hey @jalaguerom, I'll have someone look into this soon.

@jdevcs
Copy link
Contributor

jdevcs commented Oct 8, 2024

@jalaguerom we will expose this ignore gas pricing flag at contract send level ( for each send() call and also I think at contract instance level).
cc: @mconnelly8

@luu-alex
Copy link
Contributor

luu-alex commented Oct 8, 2024

Hey there in the meantime of fixing this, you can encode your abi contract into data and send it as a transaction. @jdevcs we can add this as a ignoregas as a config as well.


        const contract = new web3.eth.Contract(yourContract)
        const data = marketplaceContract.methods.yourmethod("param1", "param2").encodeABI();
        web3.eth.sendTransaction({from: accounts[0], data, to: "address"}, undefined, {ignoreGasPricing: false})

@zikyfranky
Copy link

Hey @luu-alex, going through this problem as well.

While your fix works, it's tedious to rewrite every instance where I used the .send function, is it possible to specify the ignoreGasPricing flag on the Contract Instance? That way I run my code as is.

@luu-alex
Copy link
Contributor

luu-alex commented Oct 8, 2024

@zikyfranky a fix will be created soon, sorry your also running into this issue.

@jalaguerom
Copy link
Author

Thanks a lot. I'll be waiting until that feature is included @jdevcs

@jdevcs
Copy link
Contributor

jdevcs commented Oct 9, 2024

cc: @mconnelly8 for next sprint.

@luu-alex
Copy link
Contributor

luu-alex commented Oct 9, 2024

@jdevcs i think we should include it in this sprint, i can fix this and get it released this sprint.

@lukatavcer
Copy link

@jdevcs i think we should include it in this sprint, i can fix this and get it released this sprint.

I would also appreciate if you include it in the current sprint, thanks :)

@mconnelly8 mconnelly8 added Bug Addressing a bug 4.x 4.0 related labels Oct 9, 2024
@mconnelly8
Copy link

@luu-alex, added it to the sprint! Do your thing!

@lukatavcer
Copy link

Expected behavior

Passing maxPriorityFeePerGas and maxFeePerGas as undefined to contract.method.send function should make Metamask calculate gas prices on its own based on market value.

Actual behavior

Metamask shows site suggested gas price and incorrect speed time values

Steps to reproduce the behavior

  1. Install latest Metamask version
  2. Try to send a transaction to a smart contract abi method using send function, without sending maxPriorityFeePerGas and maxFeePerGas

Related issue: #7081. Solution talks about ignoreGasPricing parameter but it is not present in the send function

Captura de pantalla 2024-10-04 a las 14 55 02

web3js version: 4.13.0

what also works is setting gasPrice: ""

someContract.methods.someMethod().send({
    from: activeAccountAddress,
    gasPrice: "",
}

@luu-alex
Copy link
Contributor

luu-alex commented Oct 17, 2024

Added ignoregaspricing config to prevent site suggested gas price in metamask. This release will be aiming for monday, you can see usage here
Thanks everyone :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants