go-sdk
go-sdk copied to clipboard
transaction underpriced
Hi.
I get an error while sending transaction in Polygon network: "transaction underpriced" or "execution reverted".
tx, err := contract.Transfer(context.Background(), trx.ToAddress, trx.Amount)
...
tx, err := contract.TransferBatch(context.Background(), transactions)
Looks like I need to increase gas price to send transaction.
I've found that transaction options are hardcoded to 2500000000 and maybe this is an issue:
block, err := provider.BlockByNumber(context.Background(), nil)
if err == nil && block.BaseFee() != nil {
tipCap, _ = big.NewInt(0).SetString("**2500000000**", 10)
baseFee := big.NewInt(0).Mul(block.BaseFee(), big.NewInt(2))
feeCap = big.NewInt(0).Add(baseFee, tipCap)
}
How can I fix this error?
Thanks