utils

package
v0.3.1-0...-684a909 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(txList []byte) ([]byte, error)

Compress compresses the given txList bytes using zlib.

func Decompress

func Decompress(compressedTxList []byte) ([]byte, error)

Decompress decompresses the given txList bytes using zlib.

func EtherToWei

func EtherToWei(ether float64) (*big.Int, error)

EtherToWei converts ether value to wei value.

func GWeiToWei

func GWeiToWei(gwei float64) (*big.Int, error)

GWeiToWei converts gwei value to wei value.

func IsNil

func IsNil(i interface{}) bool

IsNil checks if the interface is empty.

func LoadEnv

func LoadEnv()

LoadEnv loads all the test environment variables.

func Max

func Max[T constraints.Integer](a, b T) T

Max return the maximum value of two integers.

func Min

func Min[T constraints.Integer](a, b T) T

Min return the minimum value of two integers.

func RandUint32

func RandUint32(max *big.Int) uint32

RandUint32 returns a random uint32 number.

func RandUint64

func RandUint64(max *big.Int) uint64

RandUint64 returns a random uint64 number.

func WeiToEther

func WeiToEther(wei *big.Int) *big.Float

WeiToEther converts wei value to ether value.

func WeiToGWei

func WeiToGWei(wei *big.Int) *big.Float

WeiToGWei converts wei value to gwei value.

Types

type TxMgrSelector

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

TxMgrSelector is responsible for selecting the correct transaction manager, it will choose the transaction manager for a private mempool if it is available and works well, otherwise it will choose the normal transaction manager.

func NewTxMgrSelector

func NewTxMgrSelector(
	txMgr *txmgr.SimpleTxManager,
	privateTxMgr *txmgr.SimpleTxManager,
	privateTxMgrRetryInterval *time.Duration,
) *TxMgrSelector

NewTxMgrSelector creates a new TxMgrSelector instance.

func (*TxMgrSelector) RecordPrivateTxMgrFailed

func (s *TxMgrSelector) RecordPrivateTxMgrFailed()

RecordPrivateTxMgrFailed records the time when the private transaction manager has failed.

func (*TxMgrSelector) Select

func (s *TxMgrSelector) Select() (*txmgr.SimpleTxManager, bool)

Select selects a transaction manager based on the current state.

Jump to

Keyboard shortcuts

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