transaction

package
v0.0.0-...-a4145b4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateHandleOpsGas

func EstimateHandleOpsGas(opts *Opts) (gas uint64, revert *reverts.FailedOpRevert, err error)

EstimateHandleOpsGas returns a gas estimate required to call handleOps() with a given batch. A failed call will return the cause of the revert.

func HandleOps

func HandleOps(opts *Opts) (txn *types.Transaction, err error)

HandleOps submits a transaction to send a batch of AiOperations to the AiMiddleware.

func SuggestMeanGasFeeCap

func SuggestMeanGasFeeCap(basefee *big.Int, tip *big.Int, batch []*aiop.AiOperation) *big.Int

SuggestMeanGasFeeCap suggests a Max Fee for an EIP-1559 transaction to submit a batch of AiOperations to the AiMiddleware. It returns the larger value between the recommended max fee or the average maxFeePerGas of the entire batch.

func SuggestMeanGasPrice

func SuggestMeanGasPrice(gasPrice *big.Int, batch []*aiop.AiOperation) *big.Int

SuggestMeanGasPrice suggests a Gas Price for a legacy transaction to submit a batch of AiOperations to the AiMiddleware. It returns the larger value between a given gas price or the average maxFeePerGas of the entire batch.

func SuggestMeanGasTipCap

func SuggestMeanGasTipCap(tip *big.Int, batch []*aiop.AiOperation) *big.Int

SuggestMeanGasTipCap suggests a Max Priority Fee for an EIP-1559 transaction to submit a batch of AiOperations to the AiMiddleware. It returns the larger value between the suggested gas tip or the average maxPriorityFeePerGas of the entire batch.

func ToRawTxHex

func ToRawTxHex(txn *types.Transaction) string

ToRawTxHex Takes a Geth types.Transaction and returns the encoded raw hex string.

func Wait

func Wait(txn *types.Transaction, eth *ethclient.Client, timeout time.Duration) (*types.Transaction, error)

Wait blocks the process until a given transaction has been included on-chain or timeout has been reached.

Types

type Opts

type Opts struct {
	// Options for the network
	EOA     *signer.EOA
	Eth     *ethclient.Client
	ChainID *big.Int

	// Options for the AiMiddleware
	AiMiddleware common.Address
	Batch        []*aiop.AiOperation
	Beneficiary  common.Address

	// Options for the EOA transaction
	BaseFee     *big.Int
	Tip         *big.Int
	GasPrice    *big.Int
	GasLimit    uint64
	NoSend      bool
	WaitTimeout time.Duration
}

Opts contains all the fields required for submitting a transaction to call HandleOps on the AiMiddleware contract.

Jump to

Keyboard shortcuts

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