Skip to content

Commit

Permalink
forceGasGwei (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhou authored May 26, 2022
1 parent 5237dd1 commit 62a58fe
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions eth/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ package eth

import (
"math/big"
"strconv"
"time"

"github.com/celer-network/goutils/log"
)

type txOptions struct {
Expand All @@ -14,7 +17,7 @@ type txOptions struct {
minGasGwei uint64
maxGasGwei uint64
addGasGwei uint64
forceGasGwei *uint64
forceGasGwei *uint64 // use pointer to allow forcing zero gas
// EIP-1559 Tx gas price
maxFeePerGasGwei uint64
maxPriorityFeePerGasGwei uint64
Expand Down Expand Up @@ -94,9 +97,15 @@ func WithAddGasGwei(g uint64) TxOption {
})
}

func WithForceGasGwei(g uint64) TxOption {
func WithForceGasGwei(g string) TxOption {
return newFuncTxOption(func(o *txOptions) {
o.forceGasGwei = &g
if g != "" {
gwei, err := strconv.ParseUint(g, 10, 64)
if err != nil {
log.Errorln("invalid ForceGasGwei", g)
}
o.forceGasGwei = &gwei
}
})
}

Expand Down

0 comments on commit 62a58fe

Please sign in to comment.