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?
To set the transaction fee to a default or aggressive mode when using RainbowKit and Web3.js, you can do the following:
- First, you estimate the gas price with
web3.eth.getGasPrice(), which will return the current average gas price.
- Then, to set an aggressive gas price, multiply the average gas price by a factor greater than 1 (like 1.2 for 20% higher).
- The resulting value can be used as the
gasPriceparameter in your transaction object.
- When you call
web3.eth.sendTransaction(transactionObject), MetaMask will automatically populate the gas fee with your calculated aggressive price.