ethereum

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: GPL-3.0 Imports: 10 Imported by: 1

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 added in v0.2.1

type AddressEncodeDecoder = evm.AddressEncodeDecoder

AddressEncodeDecoder re-exports evm.AddressEncodeDecoder.

type AddressEncoder

type AddressEncoder = evm.AddressEncoder

AddressEncoder re-exports evm.AddressEncoder.

type Client added in v0.3.14

type Client = evm.Client

Client re-exports evm.Client.

type GasEstimator added in v0.3.14

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 added in v0.4.0

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 added in v0.3.14

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 added in v0.3.14

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 added in v0.4.0

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 added in v0.3.14

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 added in v0.3.14

func NewTxBuilder(chainID *big.Int) TxBuilder

NewTxBuilder creates a new transaction builder.

func (TxBuilder) BuildTx added in v0.3.14

func (txBuilder TxBuilder) BuildTx(ctx context.Context, from, 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