monitored

package
v0.0.0-...-bce7607 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2025 License: LGPL-3.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GasPricer

type GasPricer interface {
	GasPrice(priority *uint8) ([]*big.Int, error)
}

type GasTracker

type GasTracker interface {
	TrackGasUsage(domainID uint8, gasUsed uint64, gasPrice *big.Int)
}

type MonitoredTransactor

type MonitoredTransactor struct {
	// contains filtered or unexported fields
}

func NewMonitoredTransactor

func NewMonitoredTransactor(
	domainID uint8,
	txFabric transaction.TxFabric,
	gasPriceClient GasPricer,
	gasTracker GasTracker,
	client client.Client,
	maxGasPrice *big.Int,
	increasePercentage *big.Int,
) *MonitoredTransactor

NewMonitoredTransactor creates an instance of a transactor that periodically checks sent transactions and resends them with higher gas if they are stuck.

Gas price is increased by increasePercentage param which is a percentage value with which old gas price should be increased (e.g 15)

func (*MonitoredTransactor) IncreaseGas

func (t *MonitoredTransactor) IncreaseGas(oldGp []*big.Int) []*big.Int

increase gas bumps gas price by preset percentage.

If gas was 10 and the increaseFactor is 15 the new gas price would be 11 (it floors the value). In case the gas price didn't change it increases it by 1.

func (*MonitoredTransactor) Monitor

func (t *MonitoredTransactor) Monitor(
	ctx context.Context,
	resendInterval time.Duration,
	txTimeout time.Duration,
	tooNewTransaction time.Duration,
)

func (*MonitoredTransactor) Transact

func (t *MonitoredTransactor) Transact(to *common.Address, data []byte, opts transactor.TransactOptions) (*common.Hash, error)

type RawTx

type RawTx struct {
	// contains filtered or unexported fields
}

func (*RawTx) GasPrice

func (tx *RawTx) GasPrice() *big.Int

GasPrice returns transaction gas price in gwei

It returns base fee for both London and legacy transactions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL