ethereum

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// FeeHistoryBlocks specifies how many blocks to consider for priority fee estimation
	FeeHistoryBlocks = 10
	// FeeHistoryPercentile specifies the percentile of effective priority fees to include
	FeeHistoryPercentile = 5
	// FallbackMaxFeePerGas is the fallback value used when MaxFeePerGas cannot be calculated
	FallbackMaxFeePerGas = 20000000000
)
View Source
const (
	// DefaultClientRPCURL is the RPC URL used by default, to interact with the
	// ethereum node.
	DefaultClientRPCURL = "http://127.0.0.1:8545/"
)

Variables

View Source
var (
	// NewAddressEncodeDecoder re-exports evm.NewAddressEncodeDecoder.
	NewAddressEncodeDecoder = evm.NewAddressEncodeDecoder

	// NewAddressDecoder re-exports evm.NewAddressDecoder.
	NewAddressDecoder = evm.NewAddressDecoder

	// NewAddressEncoder re-exports evm.NewAddressEncoder.
	NewAddressEncoder = evm.NewAddressEncoder

	// NewAddressFromHex re-exports evm.NewAddressFromHex.
	NewAddressFromHex = evm.NewAddressFromHex
)
View Source
var (
	// PriorityFeeEstimationTrigger specifies which base fee to trigger priority fee estimation at
	PriorityFeeEstimationTrigger = big.NewInt(100000000000) // WEI
	// DefaultPriorityFee is returned if above trigger is not met
	DefaultPriorityFee = big.NewInt(3000000000)
	// PriorityFeeIncreaseBoundary signifies a big bump in fee history priority reward, due to which we choose
	// not to consider values under it while calculating the median priority fee.
	PriorityFeeIncreaseBoundary = big.NewInt(200)
)
View Source
var Encode = evm.Encode

Encode re-exports evm.Encode.

View Source
var NewClient = evm.NewClient

NewClient re-exports evm.NewClient.

Functions

This section is empty.

Types

type Address

type Address = evm.Address

Address re-exports evm.Address.

type AddressDecoder

type AddressDecoder = evm.AddressDecoder

AddressDecoder re-exports evm.AddressDecoder.

type AddressEncodeDecoder

type AddressEncodeDecoder = evm.AddressEncodeDecoder

AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.

type AddressEncoder

type AddressEncoder = evm.AddressEncoder

AddressEncoder re-exports evm.AddressEncoder.

type Client

type Client = evm.Client

Client re-exports evm.Client.

type GasEstimator

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

A GasEstimator returns the gas price and the provide gas limit that is needed in order to confirm transactions with an estimated maximum delay of one block.

func NewDefaultGasEstimator

func NewDefaultGasEstimator(client *Client) *GasEstimator

NewDefaultGasEstimator returns a simple gas estimator with default gas options that fetches the ideal gas price for an ethereum transaction to be included in a block with minimal delay.

func NewGasEstimator

func NewGasEstimator(client *Client, opts GasOptions) *GasEstimator

NewGasEstimator returns a simple gas estimator that fetches the ideal gas price for an ethereum transaction to be included in a block with minimal delay.

func (*GasEstimator) EstimateGas

func (gasEstimator *GasEstimator) EstimateGas(ctx context.Context) (pack.U256, pack.U256, error)

EstimateGas returns an estimate of the current gas price and returns the gas limit provided. These numbers change with congestion. These estimates are often a little off, and this should be considered when using them.

type GasOptions

type GasOptions struct {
	FeeHistoryBlocks             uint64
	FeeHistoryPercentile         uint64
	FallbackMaxFeePerGas         uint64
	PriorityFeeEstimationTrigger *big.Int
	DefaultPriorityFee           *big.Int
	PriorityFeeIncreaseBoundary  *big.Int
}

GasOptions allow a user to configure the parameters used while heuristically recommending fees for EIP-1559 compatible transactions.

type Payload

type Payload = evm.Payload

Payload re-exports evm.Payload.

type TxBuilder

type TxBuilder struct {
	ChainID *big.Int
}

TxBuilder represents a transaction builder that builds transactions to be broadcasted to the ethereum network. The TxBuilder is configured using a chain id.

func NewTxBuilder

func NewTxBuilder(chainID *big.Int) TxBuilder

NewTxBuilder creates a new transaction builder.

func (TxBuilder) BuildTx

func (txBuilder TxBuilder) BuildTx(ctx context.Context, fromPubKey *id.PubKey, to address.Address, value, nonce, gas, gasTipCap, gasFeeCap pack.U256, payload pack.Bytes) (account.Tx, error)

BuildTx receives transaction fields and constructs a new transaction.

Jump to

Keyboard shortcuts

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