You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ProcessStacksEvent is the main interface for processing Stacks events within the Stacks Provider. It should use the ParseStacksEvent() function below and handle any additional provider-specific logic or error handling.
Stacks events
Define constants for the xCall event names we'll be monitoring on the Stacks blockchain:
This function should create a mapping between Stacks contract addresses and their associated events. It will be used to determine which events to monitor for each contract. The returned map should use contract addresses as keys and providerTypes.EventMap as values, where EventMap contains the contract name and a mapping of event signatures to event types.
This function should return a list of event filters based on the eventMap(). These filters will be used by the Stacks Blockchain Listener to determine which events to monitor. Each EventFilter should specify the contract address and event signature to watch for.
These functions will be used for event processing and routing.
Implement ParseStacksEvent()
This is the main entry point for parsing Stacks events. It should determine the event type and call the appropriate parsing function (parseEmitMessage or parseCallMessage). The function should return a types.Message that can be processed by the relay system.
Implement parseEmitMessage and parseCallMessage that handle the specific parsing logic for each event type. They should extract relevant data from the Stacks event and construct a types.Message. Use the ClarityValue types to parse the event data correctly.
ProcessStacksEvent
is the main interface for processing Stacks events within the Stacks Provider. It should use theParseStacksEvent()
function below and handle any additional provider-specific logic or error handling.Stacks events
Define constants for the xCall event names we'll be monitoring on the Stacks blockchain:
Implement
eventMap()
This function should create a mapping between Stacks contract addresses and their associated events. It will be used to determine which events to monitor for each contract. The returned map should use contract addresses as keys and providerTypes.EventMap as values, where EventMap contains the contract name and a mapping of event signatures to event types.
func (p *Config) eventMap() map[string]providerTypes.EventMap
Implement
GetMonitorEventFilters()
This function should return a list of event filters based on the
eventMap()
. These filters will be used by the Stacks Blockchain Listener to determine which events to monitor. EachEventFilter
should specify the contract address and event signature to watch for.func (p *Provider) GetMonitorEventFilters() []*types.EventFilter
Implement
GetEventName()
andGetAddressByEventType()
GetEventName()
should return the human-readable event name (e.g., "EmitMessage") given an event signature.func (p *Provider) GetEventName(sig string) string
GetAddressByEventType()
should return the contract address associated with a given event type.func (p *Provider) GetAddressByEventType(eventType string) types.Address
These functions will be used for event processing and routing.
Implement
ParseStacksEvent()
This is the main entry point for parsing Stacks events. It should determine the event type and call the appropriate parsing function (
parseEmitMessage
orparseCallMessage
). The function should return atypes.Message
that can be processed by the relay system.func (p *Provider) ParseStacksEvent(event StacksEvent) (*types.Message, error)
Implement
parseEmitMessage
andparseCallMessage
that handle the specific parsing logic for each event type. They should extract relevant data from the Stacks event and construct a types.Message. Use theClarityValue
types to parse the event data correctly.func (p *Provider) parseEmitMessage(event StacksEvent) (*types.Message, error)
func (p *Provider) parseCallMessage(event StacksEvent) (*types.Message, error)
Acceptance Criteria
The text was updated successfully, but these errors were encountered: