txmodifier

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainIDProvider added in v0.6.1

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

ChainIDProvider is a transaction modifier that sets the chain ID of the transaction.

To use this modifier, add it using the WithTXModifiers option when creating a new rpc.Client.

func NewChainIDProvider added in v0.6.1

func NewChainIDProvider(opts ChainIDProviderOptions) *ChainIDProvider

NewChainIDProvider returns a new ChainIDProvider.

func (*ChainIDProvider) Modify added in v0.6.1

func (p *ChainIDProvider) Modify(ctx context.Context, client rpc.RPC, tx *types.Transaction) error

Modify implements the rpc.TXModifier interface.

type ChainIDProviderOptions added in v0.6.1

type ChainIDProviderOptions struct {
	// ChainID is the chain ID that will be set for the transaction.
	// If 0, the chain ID will be queried from the node.
	ChainID uint64

	// Replace is true if the transaction chain ID should be replaced even if
	// it is already set.
	Replace bool

	// Cache is true if the chain ID will be cached instead of being queried
	// for each transaction. Cached chain ID will be used for all RPC clients
	// that use the same ChainIDProvider instance.
	//
	// If ChainID is set, this option is ignored.
	Cache bool
}

ChainIDProviderOptions is the options for NewChainIDProvider.

type EIP1559GasFeeEstimator

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

EIP1559GasFeeEstimator is a transaction modifier that estimates gas fee using the rpc.GasPrice and rpc.MaxPriorityFeePerGas methods.

It sets transaction type to types.DynamicFeeTxType.

func NewEIP1559GasFeeEstimator

func NewEIP1559GasFeeEstimator(opts EIP1559GasFeeEstimatorOptions) *EIP1559GasFeeEstimator

NewEIP1559GasFeeEstimator returns a new EIP1559GasFeeEstimator.

To use this modifier, add it using the WithTXModifiers option when creating a new rpc.Client.

func (*EIP1559GasFeeEstimator) Modify

func (e *EIP1559GasFeeEstimator) Modify(ctx context.Context, client rpc.RPC, tx *types.Transaction) error

Modify implements the rpc.TXModifier interface.

type EIP1559GasFeeEstimatorOptions added in v0.5.0

type EIP1559GasFeeEstimatorOptions struct {
	GasPriceMultiplier          float64  // GasPriceMultiplier is applied to the gas price.
	PriorityFeePerGasMultiplier float64  // PriorityFeePerGasMultiplier is applied to the priority fee per gas.
	MinGasPrice                 *big.Int // MinGasPrice is the minimum gas price, or nil if there is no lower bound.
	MaxGasPrice                 *big.Int // MaxGasPrice is the maximum gas price, or nil if there is no upper bound.
	MinPriorityFeePerGas        *big.Int // MinPriorityFeePerGas is the minimum priority fee per gas, or nil if there is no lower bound.
	MaxPriorityFeePerGas        *big.Int // MaxPriorityFeePerGas is the maximum priority fee per gas, or nil if there is no upper bound.
	Replace                     bool     // Replace is true if the gas price should be replaced even if it is already set.
}

EIP1559GasFeeEstimatorOptions is the options for NewEIP1559GasFeeEstimator.

type GasLimitEstimator

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

GasLimitEstimator is a transaction modifier that estimates gas limit using the rpc.EstimateGas method.

To use this modifier, add it using the WithTXModifiers option when creating a new rpc.Client.

func NewGasLimitEstimator

func NewGasLimitEstimator(opts GasLimitEstimatorOptions) *GasLimitEstimator

NewGasLimitEstimator returns a new GasLimitEstimator.

func (*GasLimitEstimator) Modify

func (e *GasLimitEstimator) Modify(ctx context.Context, client rpc.RPC, tx *types.Transaction) error

Modify implements the rpc.TXModifier interface.

type GasLimitEstimatorOptions added in v0.5.0

type GasLimitEstimatorOptions struct {
	Multiplier float64 // Multiplier is applied to the gas limit.
	MinGas     uint64  // MinGas is the minimum gas limit, or 0 if there is no lower bound.
	MaxGas     uint64  // MaxGas is the maximum gas limit, or 0 if there is no upper bound.
	Replace    bool    // Replace is true if the gas limit should be replaced even if it is already set.
}

GasLimitEstimatorOptions is the options for NewGasLimitEstimator.

type LegacyGasFeeEstimator

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

LegacyGasFeeEstimator is a transaction modifier that estimates gas fee using the rpc.GasPrice method.

It sets transaction type to types.LegacyTxType or types.AccessListTxType if an access list is provided.

To use this modifier, add it using the WithTXModifiers option when creating a new rpc.Client.

func NewLegacyGasFeeEstimator

func NewLegacyGasFeeEstimator(opts LegacyGasFeeEstimatorOptions) *LegacyGasFeeEstimator

NewLegacyGasFeeEstimator returns a new LegacyGasFeeEstimator.

func (*LegacyGasFeeEstimator) Modify

func (e *LegacyGasFeeEstimator) Modify(ctx context.Context, client rpc.RPC, tx *types.Transaction) error

Modify implements the rpc.TXModifier interface.

type LegacyGasFeeEstimatorOptions added in v0.5.0

type LegacyGasFeeEstimatorOptions struct {
	Multiplier  float64  // Multiplier is applied to the gas price.
	MinGasPrice *big.Int // MinGasPrice is the minimum gas price, or nil if there is no lower bound.
	MaxGasPrice *big.Int // MaxGasPrice is the maximum gas price, or nil if there is no upper bound.
	Replace     bool     // Replace is true if the gas price should be replaced even if it is already set.
}

LegacyGasFeeEstimatorOptions is the options for NewLegacyGasFeeEstimator.

type NonceProvider

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

NonceProvider is a transaction modifier that sets the nonce for the transaction.

To use this modifier, add it using the WithTXModifiers option when creating a new rpc.Client.

func NewNonceProvider

func NewNonceProvider(opts NonceProviderOptions) *NonceProvider

NewNonceProvider returns a new NonceProvider.

func (*NonceProvider) Modify

func (p *NonceProvider) Modify(ctx context.Context, client rpc.RPC, tx *types.Transaction) error

Modify implements the rpc.TXModifier interface.

type NonceProviderOptions added in v0.5.0

type NonceProviderOptions struct {
	UsePendingBlock bool // UsePendingBlock indicates whether to use the pending block.
	Replace         bool // Replace is true if the nonce should be replaced even if it is already set.
}

NonceProviderOptions is the options for NewNonceProvider.

If UsePendingBlock is true, then the next transaction nonce is fetched from the pending block. Otherwise, the next transaction nonce is fetched from the latest block. Using the pending block is not recommended as the behavior of the GetTransactionCount method on the pending block may be different between different Ethereum clients.

Jump to

Keyboard shortcuts

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