Anyone knows how to set up a proper gas price for signTransaction on Polygon network?
I put a token sending feature into Moralis Cloud Function.
But sometimes it returns error: transaction underpriced
because of the gas price.
May I know how much is the perfect gas
and gasPrice
here for Polygon?
const tx = {
from: sender_address,
to: contract_address,
gas: 100000,
gasPrice: '5000000000',
data: contract.methods.bulksendToken(receiver_addresses, amounts).encodeABI()
}
let result
const signResp = await web3.eth.accounts.signTransaction(tx, p_key).then(async (signedTx) => {
I can check the current gas price from curl. But I still do not understand which number and how to put it into Cloud Function.
$ curl https://gasstation-mainnet.matic.network/v2
{
"safeLow":{
"maxPriorityFee":30.186666663866664,
"maxFee":30.186666678866665
},
"standard":{
"maxPriorityFee":31.41988763966667,
"maxFee":31.41988765466667
},
"fast":{
"maxPriorityFee":37.46498296513333,
"maxFee":37.46498298013333
},
"estimatedBaseFee":1.5e-8,
"blockTime":3,
"blockNumber":33507368
}