Documentation
¶
Index ¶
- Constants
- type Config
- type EventWatcher
- type PushTSSEventListener
- func (l *PushTSSEventListener) GetLastProcessedBlock() uint64
- func (l *PushTSSEventListener) IsHealthy() bool
- func (l *PushTSSEventListener) IsRunning() bool
- func (l *PushTSSEventListener) SetHealthy(healthy bool)
- func (l *PushTSSEventListener) Start(ctx context.Context) error
- func (l *PushTSSEventListener) Stop() error
- func (l *PushTSSEventListener) WithConfig(cfg Config) *PushTSSEventListener
- type TSSProcessEvent
Constants ¶
const ( // EventTypeTssProcessInitiated is emitted when a TSS key process is initiated on-chain. EventTypeTssProcessInitiated = "tss_process_initiated" // Event attribute keys AttrKeyProcessID = "process_id" AttrKeyProcessType = "process_type" AttrKeyParticipants = "participants" AttrKeyExpiryHeight = "expiry_height" // Process type values from the chain ProcessTypeKeygen = "TSS_PROCESS_KEYGEN" ProcessTypeRefresh = "TSS_PROCESS_REFRESH" ProcessTypeQuorumChange = "TSS_PROCESS_QUORUM_CHANGE" )
Event type constants from the utss module.
const ( ProtocolTypeKeygen = "keygen" ProtocolTypeKeyrefresh = "keyrefresh" ProtocolTypeQuorumChange = "quorumchange" )
Protocol type values for TSSEvent.ProtocolType field.
const ( DefaultPollInterval = 5 * time.Second DefaultEventQuery = EventTypeTssProcessInitiated + ".process_id>=0" )
Default configuration values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config holds configuration for the listener.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default listener configuration.
type EventWatcher ¶
type EventWatcher struct {
// contains filtered or unexported fields
}
EventWatcher polls the Push chain for TSS events and stores them in the database.
func NewEventWatcher ¶
func NewEventWatcher( client *pushcore.Client, store *eventstore.Store, logger zerolog.Logger, ) *EventWatcher
NewEventWatcher creates a new event watcher.
func (*EventWatcher) GetLastBlock ¶
func (w *EventWatcher) GetLastBlock() uint64
GetLastBlock returns the last processed block height.
func (*EventWatcher) SetLastBlock ¶
func (w *EventWatcher) SetLastBlock(block uint64)
SetLastBlock sets the starting block for polling.
func (*EventWatcher) SetPollInterval ¶
func (w *EventWatcher) SetPollInterval(interval time.Duration)
SetPollInterval sets the polling interval.
func (*EventWatcher) Start ¶
func (w *EventWatcher) Start(ctx context.Context)
Start begins the event watching loop.
type PushTSSEventListener ¶
type PushTSSEventListener struct {
// contains filtered or unexported fields
}
PushTSSEventListener listens for TSS events from the Push chain and stores them in the database for processing.
func NewPushTSSEventListener ¶
func NewPushTSSEventListener( client *pushcore.Client, store *eventstore.Store, logger zerolog.Logger, ) *PushTSSEventListener
NewPushTSSEventListener creates a new Push TSS event listener.
func (*PushTSSEventListener) GetLastProcessedBlock ¶
func (l *PushTSSEventListener) GetLastProcessedBlock() uint64
GetLastProcessedBlock returns the last block height that was processed.
func (*PushTSSEventListener) IsHealthy ¶
func (l *PushTSSEventListener) IsHealthy() bool
IsHealthy returns whether the listener is operating normally.
func (*PushTSSEventListener) IsRunning ¶
func (l *PushTSSEventListener) IsRunning() bool
IsRunning returns whether the listener is currently running.
func (*PushTSSEventListener) SetHealthy ¶
func (l *PushTSSEventListener) SetHealthy(healthy bool)
SetHealthy sets the health status (useful for testing or external health checks).
func (*PushTSSEventListener) Start ¶
func (l *PushTSSEventListener) Start(ctx context.Context) error
Start begins listening for TSS events from the Push chain.
func (*PushTSSEventListener) Stop ¶
func (l *PushTSSEventListener) Stop() error
Stop stops the listener.
func (*PushTSSEventListener) WithConfig ¶
func (l *PushTSSEventListener) WithConfig(cfg Config) *PushTSSEventListener
WithConfig applies configuration to the listener.
type TSSProcessEvent ¶
type TSSProcessEvent struct {
ProcessID uint64 // Process ID from the event
ProcessType string // "keygen" or "keyrefresh"
Participants []string // List of validator addresses
ExpiryHeight uint64 // Block height when this process expires
BlockHeight uint64 // Block height when the event occurred
TxHash string // Transaction hash containing this event
}
TSSProcessEvent represents a parsed tss_process_initiated event from the chain.
func ParseTSSProcessInitiatedEvent ¶
func ParseTSSProcessInitiatedEvent(events []abci.Event, blockHeight uint64, txHash string) (*TSSProcessEvent, error)
ParseTSSProcessInitiatedEvent parses a tss_process_initiated event from ABCI events. Returns nil if the event is not a tss_process_initiated event.
func (*TSSProcessEvent) EventID ¶
func (e *TSSProcessEvent) EventID() string
EventID returns the unique event ID for this process. Format: "{process_id}"
func (*TSSProcessEvent) ToTSSEventRecord ¶
func (e *TSSProcessEvent) ToTSSEventRecord() *store.TSSEvent
ToTSSEventRecord converts the parsed event to a TSSEvent database record.