2020-07-10 14:17:51 +00:00
|
|
|
package event
|
|
|
|
|
2021-01-20 17:08:06 +00:00
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/block"
|
|
|
|
)
|
|
|
|
|
2020-07-10 14:17:51 +00:00
|
|
|
// Handler is an Event processing function.
|
|
|
|
type Handler func(Event)
|
|
|
|
|
2021-01-20 17:08:06 +00:00
|
|
|
// BlockHandler is a chain block processing function.
|
|
|
|
type BlockHandler func(*block.Block)
|
|
|
|
|
2021-08-12 15:24:17 +00:00
|
|
|
// NotificationHandlerInfo is a structure that groups
|
2020-07-10 14:17:51 +00:00
|
|
|
// the parameters of the handler of particular
|
|
|
|
// contract event.
|
2021-08-12 15:24:17 +00:00
|
|
|
type NotificationHandlerInfo struct {
|
2020-07-10 14:17:51 +00:00
|
|
|
scriptHashWithType
|
|
|
|
|
|
|
|
h Handler
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetHandler is an event handler setter.
|
2021-08-12 15:24:17 +00:00
|
|
|
func (s *NotificationHandlerInfo) SetHandler(v Handler) {
|
2020-07-10 14:17:51 +00:00
|
|
|
s.h = v
|
|
|
|
}
|
|
|
|
|
2020-07-24 13:54:03 +00:00
|
|
|
// Handler returns an event handler.
|
2021-08-12 15:24:17 +00:00
|
|
|
func (s NotificationHandlerInfo) Handler() Handler {
|
2020-07-10 14:17:51 +00:00
|
|
|
return s.h
|
|
|
|
}
|