Skip to content

Commit

Permalink
support float MaxPriorityFeePerGasGwei (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxiaobleach authored Feb 24, 2023
1 parent 0e1729c commit 6d7f342
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions eth/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type txOptions struct {
forceGasGwei *uint64 // use pointer to allow forcing zero gas
// EIP-1559 Tx gas price
maxFeePerGasGwei uint64
maxPriorityFeePerGasGwei uint64
maxPriorityFeePerGasGwei float64
// Gas limit
gasLimit uint64
addGasEstimateRatio float64
Expand Down Expand Up @@ -116,7 +116,7 @@ func WithMaxFeePerGasGwei(g uint64) TxOption {
})
}

func WithMaxPriorityFeePerGasGwei(g uint64) TxOption {
func WithMaxPriorityFeePerGasGwei(g float64) TxOption {
return newFuncTxOption(func(o *txOptions) {
o.maxPriorityFeePerGasGwei = g
})
Expand Down
2 changes: 1 addition & 1 deletion eth/transactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (t *Transactor) determineGas(method TxMethod, signer *bind.TransactOpts, tx
func determine1559GasPrice(
ctx context.Context, signer *bind.TransactOpts, txopts txOptions, client *ethclient.Client, head *types.Header) error {
if txopts.maxPriorityFeePerGasGwei > 0 {
signer.GasTipCap = new(big.Int).SetUint64(txopts.maxPriorityFeePerGasGwei * 1e9)
signer.GasTipCap = new(big.Int).SetUint64(uint64(txopts.maxPriorityFeePerGasGwei * 1e9))
}
if txopts.maxFeePerGasGwei > 0 {
signer.GasFeeCap = new(big.Int).SetUint64(txopts.maxFeePerGasGwei * 1e9)
Expand Down

0 comments on commit 6d7f342

Please sign in to comment.