ethtxn

package
v1.19.3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: LGPL-3.0, MIT Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsMessage added in v1.17.7

func AsMessage(txn *types.Transaction) (types.Message, error)

func AsMessageWithSigner added in v1.17.7

func AsMessageWithSigner(txn *types.Transaction, signer types.Signer, baseFee *big.Int) (types.Message, error)

AsMessageWithSigner decodes a transaction payload, and will check v, r, s values and skips zero'd numbers which is the case for Polygon state sync transactions: https://wiki.polygon.technology/docs/pos/state-sync/how-state-sync-works#state-sync-logs-and-bor-block-receipt

func NewTransaction

func NewTransaction(ctx context.Context, provider *ethrpc.Provider, txnRequest *TransactionRequest) (*types.Transaction, error)

NewTransaction prepares a transaction for delivery, however the transaction still needs to be signed before it can be sent.

Types

type TransactionRequest

type TransactionRequest struct {
	// Ethereum account to send the transaction from. Optional, will automatically be set.
	From common.Address

	// To is the recipient address, can be account, contract or nil. If `to` is nil, it will assume contract creation
	To *common.Address

	// Nonce is the nonce of the transaction for the sender. If this value is left empty (nil), it will
	// automatically be assigned.
	Nonce *big.Int

	// GasLimit is the total gas the transaction is expected the consume. If this value is left empty (0), it will
	// automatically be estimated and assigned.
	GasLimit uint64

	// GasPrice (in WEI) offering to pay for per unit of gas. If this value is left empty (nil), it will
	// automatically be sampled and assigned.
	// Used as GasFeeCap, but name kept for compatibility reasons
	GasPrice *big.Int

	// GasTip (in WEI) optional offering to pay for per unit of gas to the miner.
	// If this value is left empty (nil), it will be considered a pre-EIP1559 or "legacy" transaction
	GasTip *big.Int

	// AccessList optional key-values to pre-import
	// saves cost by pre-importing storage related values before executing the tx
	AccessList types.AccessList

	// ETHValue (in WEI) amount of ETH currency to send with this transaction. Optional.
	ETHValue *big.Int

	// Data is calldata / input when calling or creating a contract. Optional.
	Data []byte
}

type WaitReceipt

type WaitReceipt func(ctx context.Context) (*types.Receipt, error)

func SendTransaction

func SendTransaction(ctx context.Context, provider *ethrpc.Provider, signedTx *types.Transaction) (*types.Transaction, WaitReceipt, error)

Jump to

Keyboard shortcuts

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