NOTE
this code is live and work almost 5 month on live network but now it cause error that transaction underpriced
hi @everyone i have an issue on the code during transfer the nft ,< error: the error is transaction underpriced> the error came at this
""" const fromm =process.env.PUBLIC_ADDRESS
//this is the address that contains the ERC1155 tokens which will be used in transferring the tokens
const tx = await contractw.methods.safeTransferFrom(fromm, useraddress, verify.data.nft.id, 1, '0x').send({ from: fromm, gasLimit: 2000000 })"""
First I think the error came due to fix gas limit so I fix the gas limit you can see down in the code. I want to set the gas limit dynamically in transaction.so that in future we do'not have any issue. I'm adding estimate gas functionality but it still give error about transaction underpriced. There are some guys who said that error may caused by web3 provider. I used bsc web3 provider.
One more thing I provide is the exact line of transaction where that error came so that's why I did not provide the whole code. The error came when all conditions were met and time came for transaction error came.
code
const providerr = 'https://bsc-dataseed3.binance.org/'
const web3Provider = new Web3(providerr);
fromm= process.env.PUBLIC_ADDRESS;
var gasPrice = await web3Provider.eth.getGasPrice();
var gas_estimate = await contractw.methods
.safeTransferFrom(fromm, useraddress, verify.data.nft.id, 1, '0x').estimateGas({ from: fromm, });
gas_estimate = Math.round(gas_estimate * 1.2);
//transfer the nft
var tx = await contractw.methods.safeTransferFrom(fromm, userSaddress, verify.data.nft.id, 1, '0x').send({
from: fromm,
gas: web3Obj.utils.toHex(gas_estimate),
gasPrice: web3Obj.utils.toHex(gasPrice),
});`