gasprice

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithThresholdPct

func WithThresholdPct(pct float64) func(*Opts)

func WithTicker

func WithTicker(t ticker.Ticker) func(*Opts)

Types

type Buffer

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

func NewBuffer

func NewBuffer(pricers map[uint64]ethereum.GasPricer, opts ...func(*Opts)) *Buffer

NewBuffer creates a new gas price buffer.

A gas price buffer maintains a buffered view of gas prices for multiple chains. Buffered gas prices are not updated unless they are outside the threshold percentage. Start steaming gas prices with Buffer.Stream(ctx).

func (*Buffer) GasPrice

func (b *Buffer) GasPrice(chainID uint64) uint64

GasPrice returns the buffered gas price for the given chainID. If the price is not known, returns 0.

func (*Buffer) Stream

func (b *Buffer) Stream(ctx context.Context)

Stream starts streaming gas prices for all providers into the buffer.

type MockPricer

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

func NewMockPricer

func NewMockPricer(price uint64) *MockPricer

func (*MockPricer) Price

func (m *MockPricer) Price() uint64

func (*MockPricer) SetPrice

func (m *MockPricer) SetPrice(price uint64)

func (*MockPricer) SuggestGasPrice

func (m *MockPricer) SuggestGasPrice(_ context.Context) (*big.Int, error)

type Opts

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

Jump to

Keyboard shortcuts

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