sse

package
v0.0.0-...-d1bef67 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sse is the SSE Client for preconf-share

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Data  *MatchMakerEvent // Will be nil if an error occurred during poll
	Error error
}

Event represents a matchmaker event sent from sse subscription

type InternalClient

type InternalClient struct {
	BaseURL string // BaseURL is the base URL for the matchmaker
}

InternalClient is a client for the matchmaker

func (*InternalClient) Subscribe

func (c *InternalClient) Subscribe(eventChan chan<- Event) (SSESubscription, error)

Subscribe to matchmaker events and returns a type that can be used to control the subscription

type MatchMakerEvent

type MatchMakerEvent struct {
	Hash common.Hash          `json:"hash"`
	Logs []types.Log          `json:"logs,omitempty"`
	Txs  []PendingTransaction `json:"txs,omitempty"`
}

MatchMakerEvent represents the pending transaction hints sent by matchmaker

type PendingTransaction

type PendingTransaction struct {
	To               common.Address `json:"to"`
	FunctionSelector [4]byte        `json:"functionSelector,omitempty"`
	CallData         []byte         `json:"callData,omitempty"`
	MevGasPrice      *hexutil.Big   `json:"mevGasPrice,omitempty"`
	GasUsed          *hexutil.Big   `json:"gasUsed,omitempty"`
}

PendingTransaction represents the hits revealed by the matchmaker about the transaction / bundle

type SSEClient

type SSEClient interface {
	// Subscribe to events and returns a subscription
	Subscribe(eventChan chan<- Event) (SSESubscription, error)
}

SSEClient is the SSE Client abstraction

func New

func New(baseURL string) SSEClient

New creates a new InternalClient for the matchmaker with the given base URL

type SSESubscription

type SSESubscription interface {
	// To stop the subscription
	Stop()
}

type Subscription

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

Subscription represents a subscription to matchmaker events

func (*Subscription) Stop

func (s *Subscription) Stop()

Stop stops the subscription to matchmaker events

Jump to

Keyboard shortcuts

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