relay

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: 8 Imported by: 0

Documentation

Overview

Package relay implements a module for private bundlers to send batches to the AiMiddleware through regular EOA transactions.

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultWaitTimeout = 72 * time.Second
)

Functions

This section is empty.

Types

type Relayer

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

Relayer provides a module that can relay batches with a regular EOA. Relaying batches to the AiMiddleware through a regular transaction comes with several important notes:

  • The bundler will NOT be operating as a block builder.
  • This opens the bundler up to frontrunning.

This module only works in the case of a private mempool and will not work in the P2P case where ops are propagated through the network and it is impossible to prevent collisions from multiple bundlers trying to relay the same ops.

func New

func New(
	eoa *signer.EOA,
	eth *ethclient.Client,
	chainID *big.Int,
	beneficiary common.Address,
	l logr.Logger,
) *Relayer

New initializes a new EOA relayer for sending batches to the AiMiddleware.

func (*Relayer) SendAiOperation

func (r *Relayer) SendAiOperation() modules.BatchHandlerFunc

SendAiOperation returns a BatchHandler that is used by the Bundler to send batches in a regular EOA transaction.

func (*Relayer) SetWaitTimeout

func (r *Relayer) SetWaitTimeout(timeout time.Duration)

SetWaitTimeout sets the total time to wait for a transaction to be included. When a timeout is reached, the BatchHandler will throw an error if the transaction has not been included or has been included but with a failed status.

The default value is 30 seconds. Setting the value to 0 will skip waiting for a transaction to be included.

Jump to

Keyboard shortcuts

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