relay

package
v0.0.2-tenderly Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: GPL-3.0, LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultServiceConfig = ServiceConfig{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type Config

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

type PrivateTxGetter

type PrivateTxGetter interface {
	IsTxPrivate(hash common.Hash) bool
}

type PrivateTxSetter

type PrivateTxSetter interface {
	Add(hash common.Hash)
	Purge(hash common.Hash)
}

type PrivateTxStore

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

func NewPrivateTxStore

func NewPrivateTxStore() *PrivateTxStore

func (*PrivateTxStore) Add

func (s *PrivateTxStore) Add(hash common.Hash)

func (*PrivateTxStore) Close

func (s *PrivateTxStore) Close()

func (*PrivateTxStore) IsTxPrivate

func (s *PrivateTxStore) IsTxPrivate(hash common.Hash) bool

func (*PrivateTxStore) Purge

func (s *PrivateTxStore) Purge(hash common.Hash)

func (*PrivateTxStore) SetchainEventSubFn

func (s *PrivateTxStore) SetchainEventSubFn(fn func(ch chan<- core.ChainEvent) event.Subscription)

type RelayService

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

RelayService handles all preconf and private transaction related services

func Init

func Init(enablePreconf, enablePrivateTx, acceptPreconfTx, acceptPrivateTx bool, blockProducerURLs []string) *RelayService

func (*RelayService) AcceptPreconfTxs

func (s *RelayService) AcceptPreconfTxs() bool

func (*RelayService) AcceptPrivateTxs

func (s *RelayService) AcceptPrivateTxs() bool

func (*RelayService) CheckPreconfStatus

func (s *RelayService) CheckPreconfStatus(hash common.Hash) (bool, error)

CheckPreconfStatus checks the preconfirmation status of a transaction

func (*RelayService) Close

func (s *RelayService) Close()

Close closes the relay service and all its components

func (*RelayService) GetPrivateTxGetter

func (s *RelayService) GetPrivateTxGetter() PrivateTxGetter

func (*RelayService) PreconfEnabled

func (s *RelayService) PreconfEnabled() bool

func (*RelayService) PrivateTxEnabled

func (s *RelayService) PrivateTxEnabled() bool

func (*RelayService) PurgePrivateTx

func (s *RelayService) PurgePrivateTx(hash common.Hash)

func (*RelayService) RecordPrivateTx

func (s *RelayService) RecordPrivateTx(hash common.Hash)

func (*RelayService) SetTxGetter

func (s *RelayService) SetTxGetter(getter TxGetter)

func (*RelayService) SetchainEventSubFn

func (s *RelayService) SetchainEventSubFn(fn func(ch chan<- core.ChainEvent) event.Subscription)

func (*RelayService) SubmitPreconfTransaction

func (s *RelayService) SubmitPreconfTransaction(tx *types.Transaction) error

SubmitPreconfTransaction submits a transaction for preconfirmation to block producers

func (*RelayService) SubmitPrivateTransaction

func (s *RelayService) SubmitPrivateTransaction(tx *types.Transaction) error

SubmitPrivateTransaction submits a private transaction to block producers

type SendTxForPreconfResponse

type SendTxForPreconfResponse struct {
	TxHash       common.Hash `json:"hash"`
	Preconfirmed bool        `json:"preconfirmed"`
}

type Service

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

func NewService

func NewService(urls []string, config *ServiceConfig) *Service

func (*Service) CheckTxPreconfStatus

func (s *Service) CheckTxPreconfStatus(hash common.Hash) (bool, error)

CheckTxPreconfStatus checks whether a given transaction hash has been preconfirmed or not. It checks things in following order: - Checks the availability of preconf status of the task in cache - Checks locally if the transaction is already included in a block - Queries all block producers via multiclient to get the preconf status

func (*Service) SetTxGetter

func (s *Service) SetTxGetter(getter TxGetter)

SetTxGetter sets the transaction getter function for querying local database

func (*Service) SubmitPrivateTx

func (s *Service) SubmitPrivateTx(tx *types.Transaction, retry bool) error

SubmitPrivateTx attempts to submit a private transaction to all block producers

func (*Service) SubmitTransactionForPreconf

func (s *Service) SubmitTransactionForPreconf(tx *types.Transaction) error

SubmitTransactionForPreconf attempts to queue a transaction submission task for preconf and returns true if the task is successfully queued. It fails if either the rpc clients are unavailable or if the task queue is full.

type ServiceConfig

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

type TxGetter

type TxGetter func(hash common.Hash) (bool, *types.Transaction, common.Hash, uint64, uint64)

TxGetter defines a function that retrieves a transaction by its hash from local database. Returns: found (bool), transaction, blockHash, blockNumber, txIndex

type TxTask

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

TxTask represents a transaction submission task

Jump to

Keyboard shortcuts

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