Documentation
¶
Index ¶
- Constants
- func CreateEVMClientFactory() rpcpool.ClientFactory
- func CreateEVMHealthChecker(expectedChainID int64) rpcpool.HealthChecker
- func GetEthClientFromPool(endpoint *rpcpool.Endpoint) (*ethclient.Client, error)
- type Client
- func (c *Client) GetChainID() int64
- func (c *Client) GetGasPrice(ctx context.Context) (*big.Int, error)
- func (c *Client) GetLatestBlock(ctx context.Context) (uint64, error)
- func (c *Client) GetLatestBlockNumber(ctx context.Context) (*big.Int, error)
- func (c *Client) GetRPCURL() string
- func (c *Client) GetTransactionConfirmations(ctx context.Context, txHash string) (uint64, error)
- func (c *Client) IsConfirmed(ctx context.Context, txHash string) (bool, error)
- func (c *Client) IsHealthy() bool
- func (c *Client) SetVoteHandler(handler common.VoteHandler)
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) Stop() error
- func (c *Client) WatchGatewayEvents(ctx context.Context, fromBlock uint64) (<-chan *common.GatewayEvent, error)
- type EventParser
- type EventWatcher
- type GatewayHandler
- func (h *GatewayHandler) GetConfirmationTracker() *common.ConfirmationTracker
- func (h *GatewayHandler) GetLatestBlock(ctx context.Context) (uint64, error)
- func (h *GatewayHandler) GetStartBlock(ctx context.Context) (uint64, error)
- func (h *GatewayHandler) GetTransactionConfirmations(ctx context.Context, txHash string) (uint64, error)
- func (h *GatewayHandler) IsConfirmed(ctx context.Context, txHash string) (bool, error)
- func (h *GatewayHandler) SetVoteHandler(handler common.VoteHandler)
- func (h *GatewayHandler) UpdateLastProcessedBlock(blockNumber uint64) error
- func (h *GatewayHandler) WatchGatewayEvents(ctx context.Context, fromBlock uint64) (<-chan *common.GatewayEvent, error)
- type TransactionVerifier
- func (tv *TransactionVerifier) GetTransactionConfirmations(ctx context.Context, txHash string) (uint64, error)
- func (tv *TransactionVerifier) VerifyPendingTransactions(ctx context.Context) error
- func (tv *TransactionVerifier) VerifyTransactionExistence(ctx context.Context, tx *store.ChainTransaction) (bool, error)
Constants ¶
const (
AddFundsEventID = "0xb28f49668e7e76dc96d7aabe5b7f63fecfbd1c3574774c05e8204e749fd96fbd"
)
Variables ¶
This section is empty.
Functions ¶
func CreateEVMClientFactory ¶
func CreateEVMClientFactory() rpcpool.ClientFactory
CreateEVMClientFactory returns a ClientFactory for EVM endpoints
func CreateEVMHealthChecker ¶
func CreateEVMHealthChecker(expectedChainID int64) rpcpool.HealthChecker
CreateEVMHealthChecker creates a health checker for EVM endpoints
Types ¶
type Client ¶
type Client struct {
*common.BaseChainClient
// contains filtered or unexported fields
}
Client implements the ChainClient interface for EVM chains
func NewClient ¶
func NewClient(config *uregistrytypes.ChainConfig, database *db.DB, appConfig *config.Config, logger zerolog.Logger) (*Client, error)
NewClient creates a new EVM chain client
func (*Client) GetChainID ¶
GetChainID returns the numeric chain ID
func (*Client) GetGasPrice ¶
GetGasPrice fetches the current gas price from the EVM chain Returns the price in Wei
func (*Client) GetLatestBlock ¶
GetLatestBlock returns the latest block number
func (*Client) GetLatestBlockNumber ¶
GetLatestBlockNumber returns the latest block number with automatic failover
func (*Client) GetTransactionConfirmations ¶
GetTransactionConfirmations returns the number of confirmations for a transaction
func (*Client) IsConfirmed ¶
IsConfirmed checks if a transaction has enough confirmations
func (*Client) SetVoteHandler ¶
func (c *Client) SetVoteHandler(handler common.VoteHandler)
SetVoteHandler sets the vote handler for confirmed transactions
func (*Client) WatchGatewayEvents ¶
func (c *Client) WatchGatewayEvents(ctx context.Context, fromBlock uint64) (<-chan *common.GatewayEvent, error)
WatchGatewayEvents starts watching for gateway events
type EventParser ¶
type EventParser struct {
// contains filtered or unexported fields
}
EventParser handles parsing of EVM gateway events
func NewEventParser ¶
func NewEventParser( gatewayAddr ethcommon.Address, config *uregistrytypes.ChainConfig, logger zerolog.Logger, ) *EventParser
NewEventParser creates a new event parser
func (*EventParser) GetEventTopics ¶
func (ep *EventParser) GetEventTopics() []ethcommon.Hash
GetEventTopics returns the configured event topics
func (*EventParser) ParseGatewayEvent ¶
func (ep *EventParser) ParseGatewayEvent(log *types.Log) *common.GatewayEvent
ParseGatewayEvent parses a log into a GatewayEvent
type EventWatcher ¶
type EventWatcher struct {
// contains filtered or unexported fields
}
EventWatcher handles watching for events on EVM chains
func NewEventWatcher ¶
func NewEventWatcher( parentClient *Client, gatewayAddr ethcommon.Address, eventParser *EventParser, tracker *common.ConfirmationTracker, appConfig *config.Config, chainID string, logger zerolog.Logger, ) *EventWatcher
NewEventWatcher creates a new event watcher
func (*EventWatcher) WatchEvents ¶
func (ew *EventWatcher) WatchEvents( ctx context.Context, fromBlock uint64, updateLastBlock func(uint64) error, verifyTransactions func(context.Context) error, ) (<-chan *common.GatewayEvent, error)
WatchEvents starts watching for events from a specific block
type GatewayHandler ¶
type GatewayHandler struct {
// contains filtered or unexported fields
}
GatewayHandler handles gateway operations for EVM chains
func NewGatewayHandler ¶
func NewGatewayHandler( parentClient *Client, config *uregistrytypes.ChainConfig, database *db.DB, appConfig *config.Config, logger zerolog.Logger, ) (*GatewayHandler, error)
NewGatewayHandler creates a new EVM gateway handler
func (*GatewayHandler) GetConfirmationTracker ¶
func (h *GatewayHandler) GetConfirmationTracker() *common.ConfirmationTracker
GetConfirmationTracker returns the confirmation tracker
func (*GatewayHandler) GetLatestBlock ¶
func (h *GatewayHandler) GetLatestBlock(ctx context.Context) (uint64, error)
GetLatestBlock returns the latest block number
func (*GatewayHandler) GetStartBlock ¶
func (h *GatewayHandler) GetStartBlock(ctx context.Context) (uint64, error)
GetStartBlock returns the block to start watching from
func (*GatewayHandler) GetTransactionConfirmations ¶
func (h *GatewayHandler) GetTransactionConfirmations(ctx context.Context, txHash string) (uint64, error)
GetTransactionConfirmations returns the number of confirmations for a transaction
func (*GatewayHandler) IsConfirmed ¶
IsConfirmed checks if a transaction has enough confirmations
func (*GatewayHandler) SetVoteHandler ¶
func (h *GatewayHandler) SetVoteHandler(handler common.VoteHandler)
SetVoteHandler sets the vote handler on the confirmation tracker
func (*GatewayHandler) UpdateLastProcessedBlock ¶
func (h *GatewayHandler) UpdateLastProcessedBlock(blockNumber uint64) error
UpdateLastProcessedBlock updates the last processed block in the database
func (*GatewayHandler) WatchGatewayEvents ¶
func (h *GatewayHandler) WatchGatewayEvents(ctx context.Context, fromBlock uint64) (<-chan *common.GatewayEvent, error)
WatchGatewayEvents delegates to event watcher
type TransactionVerifier ¶
type TransactionVerifier struct {
// contains filtered or unexported fields
}
TransactionVerifier handles transaction verification for EVM
func NewTransactionVerifier ¶
func NewTransactionVerifier( parentClient *Client, config *uregistrytypes.ChainConfig, database *db.DB, tracker *common.ConfirmationTracker, logger zerolog.Logger, ) *TransactionVerifier
NewTransactionVerifier creates a new transaction verifier
func (*TransactionVerifier) GetTransactionConfirmations ¶
func (tv *TransactionVerifier) GetTransactionConfirmations(ctx context.Context, txHash string) (uint64, error)
GetTransactionConfirmations returns the number of confirmations for a transaction
func (*TransactionVerifier) VerifyPendingTransactions ¶
func (tv *TransactionVerifier) VerifyPendingTransactions(ctx context.Context) error
VerifyPendingTransactions checks all pending transactions for reorgs
func (*TransactionVerifier) VerifyTransactionExistence ¶
func (tv *TransactionVerifier) VerifyTransactionExistence( ctx context.Context, tx *store.ChainTransaction, ) (bool, error)
VerifyTransactionExistence checks if an EVM transaction still exists on chain (reorg detection)