conn

package
v2.0.0-...-22dfcf9 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: Apache-2.0 Imports: 21 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) (*Conn, error)

New creates a new execution client.

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) 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.

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) 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,
) (
	*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
}

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