worker

package
v0.0.0-...-56f20fd Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(paymaster common.Address, config Config, client *web3go.Client, store *store.Store) error

Start starts all background workers in separate goroutines. It returns an error if any worker fails to initialize.

Types

type Config

type Config struct {
	UserOp struct {
		EventScan UserOpEventScanConfig
	}
}

type Sponsorship

type Sponsorship struct {
	Log            types.Log
	SponsoredEvent *contract.VerifyingPaymasterSponsored
	UserOpEvent    *account.EntryPointUserOperationEvent
	UserOp         *contract.PackedUserOperation // Nil when indirect call input cannot be decoded.
}

type UserOpEventParser

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

UserOpEventParser is responsible for parsing Sponsored event and relevant data from the blockchain log.

If bundle transaction contains many user operations too frequently, it's better to add a LRU cache for the retrieved bundle transaction and receipt.

func NewUserOpEventParser

func NewUserOpEventParser(client *web3go.Client, paymaster common.Address) (*UserOpEventParser, error)

func (*UserOpEventParser) Parse

func (parser *UserOpEventParser) Parse(log types.Log) (*Sponsorship, error)

Parse parses a Sponsored event log and retrieves the associated user operation and its details. Indirect calls retain their events for indexing even when the raw UserOperation is unavailable.

type UserOpEventScanConfig

type UserOpEventScanConfig struct {
	// NextBlock is the next block number to start scanning events from, 0 means the finalized block.
	NextBlock uint64

	// Interval is the interval between each scan after catch-up phase.
	Interval time.Duration `default:"10s"`
	// contains filtered or unexported fields
}

type UserOpEventScanner

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

UserOpEventScanner is a worker that scans user op events from the blockchain and updates the database accordingly.

func NewUserOpEventScanner

func NewUserOpEventScanner(paymaster common.Address, config UserOpEventScanConfig, client *web3go.Client, store *store.Store) (*UserOpEventScanner, error)

NewUserOpEventScanner creates a new UserOpEventScanner with the given configuration, web3 client, and store. It initializes the scanner and loads the next block number to scan from the database or configuration. It will return an error if the config is invalid or initialization fails.

func (*UserOpEventScanner) Work

func (scanner *UserOpEventScanner) Work()

Work starts the scanning process for user op events. It first catches up to the latest finalized block, and then continues to scan for new events periodically.

Jump to

Keyboard shortcuts

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