import "github.com/ethereum/go-ethereum/eth/gasprice"
type Config struct { Blocks int Percentile int Default *big.Int `toml:",omitempty"` MaxPrice *big.Int `toml:",omitempty"` }
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(backend OracleBackend, params Config) *Oracle
NewOracle returns a new gasprice oracle which can recommend suitable gasprice for newly created transaction.
SuggestPrice returns a gasprice so that newly created transaction can have a very high chance to be included in the following blocks.
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.
Package gasprice imports 9 packages (graph) and is imported by 348 packages. Updated 2020-10-01. Refresh now. Tools for package owners.