Documentation ¶
Index ¶
- func EstimateHandleOpsGas(opts *Opts) (gas uint64, revert *reverts.FailedOpRevert, err error)
- func HandleOps(opts *Opts) (txn *types.Transaction, err error)
- func SuggestMeanGasFeeCap(basefee *big.Int, tip *big.Int, batch []*aiop.AiOperation) *big.Int
- func SuggestMeanGasPrice(gasPrice *big.Int, batch []*aiop.AiOperation) *big.Int
- func SuggestMeanGasTipCap(tip *big.Int, batch []*aiop.AiOperation) *big.Int
- func ToRawTxHex(txn *types.Transaction) string
- func Wait(txn *types.Transaction, eth *ethclient.Client, timeout time.Duration) (*types.Transaction, error)
- type Opts
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 ¶
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 ¶
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 ¶
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.
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.