0

Im using RainbowKit and Web3.js, theres any way to set transaction fee to be default market or aggressive, when open metamesk pop up to sign the transaction?

1 Answer 1

0

To set the transaction fee to a default or aggressive mode when using RainbowKit and Web3.js, you can do the following:

  1. First, you estimate the gas price with web3.eth.getGasPrice(), which will return the current average gas price.
  2. Then, to set an aggressive gas price, multiply the average gas price by a factor greater than 1 (like 1.2 for 20% higher).
  3. The resulting value can be used as the gasPrice parameter in your transaction object.
  4. When you call web3.eth.sendTransaction(transactionObject), MetaMask will automatically populate the gas fee with your calculated aggressive price.

Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.