conn

package
v2.10.13 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is a connection to an Ethereum execution client.

func New

func New(ctx context.Context, url string, debug bool) (*Conn, error)

New creates a new execution client.

func (*Conn) Address added in v2.10.12

func (c *Conn) Address(address string, privateKey string) (common.Address, error)

Address obtains the address given a range of inputs.

func (*Conn) CalculateFees

func (c *Conn) CalculateFees() (*big.Int, *big.Int, error)

CalculateFees calculates the base and priority fees.

func (*Conn) ChainID

func (c *Conn) ChainID() *big.Int

ChainID returns the chain ID for the connection.

func (*Conn) Client

func (c *Conn) Client() *ethclient.Client

Client returns the ethclient for the connection.

func (*Conn) CreateAccessList added in v2.10.0

func (c *Conn) CreateAccessList(ctx context.Context,
	txData *TransactionData,
) (
	*types.AccessList,
	uint64,
	error,
)

CreateAccessList creates an access list for the given transaction. Consider using CreateTransaction instead of this call, for a more comprehensive process.

func (*Conn) CreateSignedTransaction

func (c *Conn) CreateSignedTransaction(ctx context.Context,
	txData *TransactionData,
) (
	*types.Transaction,
	error,
)

CreateSignedTransaction creates a signed transaction.

func (*Conn) CreateTransaction

func (c *Conn) CreateTransaction(ctx context.Context,
	txData *TransactionData,
) (
	*types.Transaction,
	error,
)

CreateTransaction creates a transaction.

func (*Conn) CurrentBaseFee

func (c *Conn) CurrentBaseFee(ctx context.Context) (*big.Int, error)

CurrentBaseFee returns the current base fee of the chain.

func (*Conn) CurrentNonce

func (c *Conn) CurrentNonce(ctx context.Context,
	address common.Address,
) (
	uint64,
	error,
)

CurrentNonce provides the current nonce for the given address.

func (*Conn) EstimateGas

func (c *Conn) EstimateGas(ctx context.Context,
	txData *TransactionData,
) (
	uint64,
	error,
)

EstimateGas estimates the gas required for the given transaction. Consider using CreateTransaction instead of this call, for a more comprehensive process.

func (*Conn) HandleSubmittedTransaction added in v2.10.12

func (c *Conn) HandleSubmittedTransaction(tx *types.Transaction, logFields log.Fields) bool

HandleSubmittedTransaction handles logging and waiting for a submitted transaction to be mined. It will not log the transaction if logFields is nil. This function will return false if asked to wait and the transaction is not mined, otherwise true.

func (*Conn) NextNonce

func (c *Conn) NextNonce(ctx context.Context,
	address common.Address,
) (
	uint64,
	error,
)

NextNonce obtains the next nonce for the given address.

func (*Conn) PrepareTx added in v2.10.0

func (c *Conn) PrepareTx(ctx context.Context,
	txData *TransactionData,
) error

PrepareTx prepares a transaction, setting the gas limit and access list if applicable. Consider using CreateTransaction instead of this call, for a more comprehensive process.

func (*Conn) Resolve

func (c *Conn) Resolve(name string) (common.Address, error)

Resolve resolves a name to an address.

func (*Conn) ReverseResolve

func (c *Conn) ReverseResolve(address common.Address) (string, error)

ReverseResolve resolves an address to a name.

func (*Conn) SendTransaction

func (c *Conn) SendTransaction(ctx context.Context,
	tx *types.Transaction,
) error

SendTransaction send the supplied transaction to the network.

func (*Conn) SignTransaction

func (c *Conn) SignTransaction(_ context.Context,
	signer common.Address,
	tx *types.Transaction,
	debug bool,
) (
	*types.Transaction,
	error,
)

SignTransaction signs the given transaction, returning a signed transaction.

type TransactionData

type TransactionData struct {
	From common.Address
	To   *common.Address

	GasLimit *uint64

	Value *big.Int
	Data  []byte

	Nonce *int64

	MaxFeePerGas         *big.Int
	MaxPriorityFeePerGas *big.Int

	AccessList types.AccessList
}

TransactionData contains data to build a transaction.

Jump to

Keyboard shortcuts

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