gasprice

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: GPL-3.0 Imports: 9 Imported by: 627

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultMaxPrice    = big.NewInt(500 * params.GWei)
	DefaultIgnorePrice = big.NewInt(2 * params.Wei)
)

Functions

This section is empty.

Types

type Config added in v1.6.0

type Config struct {
	Blocks      int
	Percentile  int
	Default     *big.Int `toml:",omitempty"`
	MaxPrice    *big.Int `toml:",omitempty"`
	IgnorePrice *big.Int `toml:",omitempty"`
}

type Oracle added in v1.6.0

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

Oracle recommends gas prices based on the content of recent blocks. Suitable for both light and full clients.

func NewOracle added in v1.6.0

func NewOracle(backend OracleBackend, params Config) *Oracle

NewOracle returns a new gasprice oracle which can recommend suitable gasprice for newly created transaction.

func (*Oracle) SuggestTipCap added in v1.10.4

func (gpo *Oracle) SuggestTipCap(ctx context.Context) (*big.Int, error)

SuggestTipCap returns a tip cap so that newly created transaction can have a very high chance to be included in the following blocks.

Note, for legacy transactions and the legacy eth_gasPrice RPC call, it will be necessary to add the basefee to the returned number to fall back to the legacy behavior.

type OracleBackend added in v1.9.16

type OracleBackend interface {
	HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
	BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)
	ChainConfig() *params.ChainConfig
}

OracleBackend includes all necessary background APIs for oracle.

Jump to

Keyboard shortcuts

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