This is your contract createPayment
function createPayment(string memory txId,
address payable seller,
address token) public payable
on client side, you are not passing correct arguments:
const val = await contract.createPayment(id,
trxData.seller_wallet_address,
token['bnb'].address,
{value});
what is argument. Make sure you are passing correct value types. If error still persists, make sure your metamask is connected to the correct networkid
You can set the gas limit with an object as the last argument, for a simple transfer transaction, you could do something like this:
const tx = {
to: toAddress,
value: ethers.utils.parseEther(value),
gasLimit: 50000,
nonce: nonce || undefined,
};
await signer.sendTransaction(tx);
If you are doing a transaction to a smart contract, the idea is the same, but make sure you set the last parameter in one of your abi methods, example:
const tx = await contract.safeTransferFrom(from, to, tokenId, amount, [], {
gasLimit: 100000,
nonce: nonce || undefined,
});
This can fix the UNPREDICTABLE_GAS_LIMIT error, since informing it manually the ethers skips a rpc method call to the provider requesting the calculated gas_limit.
I was having same issue yesterday, what you can do is add a gas limit manually to the transection, in your case when calling the mint function in the hardhat script, you can add manual gasLimit to it, for example.
YourInstanceName.mint(10, { gasLimit: 1 * 10 ** 6 })
btw I found another similar stackoverflow question link you can check it out.