Documentation
¶
Overview ¶
Package push provides a client for listening to Push Chain events.
Index ¶
Constants ¶
const ( DefaultPollInterval = 5 * time.Second DefaultChunkSize = 1000 DefaultQueryLimit = 100 )
Default configuration values
const ( TSSEventQuery = EventTypeTSSProcessInitiated + ".process_id>=0" OutboundEventQuery = EventTypeOutboundCreated + ".tx_id EXISTS" )
Event queries for fetching specific event types from the chain.
const ( EventTypeTSSProcessInitiated = utsstypes.EventTypeTssProcessInitiated EventTypeOutboundCreated = uexecutortypes.EventTypeOutboundCreated )
Event type constants
const ( AttrKeyProcessID = "process_id" AttrKeyProcessType = "process_type" AttrKeyParticipants = "participants" AttrKeyExpiryHeight = "expiry_height" )
TSS event attribute keys.
const ( ChainProcessTypeKeygen = "TSS_PROCESS_KEYGEN" ChainProcessTypeRefresh = "TSS_PROCESS_REFRESH" ChainProcessTypeQuorumChange = "TSS_PROCESS_QUORUM_CHANGE" )
TSS process type values as defined in the Push chain.
const ( AttrKeyTxID = "tx_id" AttrKeyUniversalTxID = "utx_id" AttrKeyOutboundID = "outbound_id" AttrKeyDestinationChain = "destination_chain" AttrKeyRecipient = "recipient" AttrKeyAmount = "amount" AttrKeyAssetAddr = "asset_addr" AttrKeySender = "sender" AttrKeyPayload = "payload" AttrKeyGasLimit = "gas_limit" AttrKeyTxType = "tx_type" AttrKeyPcTxHash = "pc_tx_hash" AttrKeyLogIndex = "log_index" AttrKeyRevertMsg = "revert_msg" AttrKeyData = "data" )
Outbound event attribute keys.
const OutboundExpiryOffset = 400
OutboundExpiryOffset is the number of blocks after event detection before an outbound event expires.
Variables ¶
var ( ErrNilClient = errors.New("push client is nil") ErrNilDatabase = errors.New("database is nil") ErrAlreadyRunning = errors.New("event listener is already running") ErrNotRunning = errors.New("event listener is not running") )
Errors
var ( ErrMissingProcessID = errors.New("missing required attribute: process_id") ErrMissingProcessType = errors.New("missing required attribute: process_type") ErrMissingTxID = errors.New("missing required attribute: tx_id") ErrInvalidProcessID = errors.New("invalid process_id format") ErrInvalidExpiryHeight = errors.New("invalid expiry_height format") ErrInvalidParticipants = errors.New("invalid participants format") )
Parser errors.
Functions ¶
Types ¶
type Client ¶ added in v0.0.13
type Client struct {
// contains filtered or unexported fields
}
Client implements the ChainClient interface for Push chain
func NewClient ¶ added in v0.0.13
func NewClient( database *db.DB, chainConfig *config.ChainSpecificConfig, pushCore *pushcore.Client, chainID string, logger zerolog.Logger, ) (*Client, error)
NewClient creates a new Push chain client
func (*Client) GetTxBuilder ¶ added in v0.0.13
func (c *Client) GetTxBuilder() (common.OutboundTxBuilder, error)
GetTxBuilder returns the OutboundTxBuilder for this chain Push chain does not support outbound transactions, so this always returns an error
func (*Client) IsHealthy ¶ added in v0.0.13
IsHealthy checks if the Push chain RPC Client is healthy
type EventListener ¶ added in v0.0.13
type EventListener struct {
// contains filtered or unexported fields
}
EventListener listens for events from the Push chain and stores them in the database
func NewEventListener ¶ added in v0.0.13
func NewEventListener( pushCore *pushcore.Client, database *db.DB, logger zerolog.Logger, chainConfig *config.ChainSpecificConfig, ) (*EventListener, error)
NewEventListener creates a new Push event listener
func (*EventListener) IsRunning ¶ added in v0.0.13
func (el *EventListener) IsRunning() bool
IsRunning returns whether the event listener is currently running
func (*EventListener) Start ¶ added in v0.0.13
func (el *EventListener) Start(ctx context.Context) error
Start begins listening for events from the Push chain
func (*EventListener) Stop ¶ added in v0.0.13
func (el *EventListener) Stop() error
Stop gracefully stops the event listener