2020-07-10 14:17:51 +00:00
|
|
|
package event
|
|
|
|
|
2021-01-20 17:08:06 +00:00
|
|
|
import (
|
2024-10-21 09:21:01 +00:00
|
|
|
"context"
|
|
|
|
|
2021-01-20 17:08:06 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/block"
|
|
|
|
)
|
|
|
|
|
2020-07-10 14:17:51 +00:00
|
|
|
// Handler is an Event processing function.
|
2024-10-21 09:21:01 +00:00
|
|
|
type Handler func(context.Context, Event)
|
2020-07-10 14:17:51 +00:00
|
|
|
|
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
|
|
|
|
}
|
2021-08-15 17:03:15 +00:00
|
|
|
|
|
|
|
// NotaryHandlerInfo is a structure that groups
|
|
|
|
// the parameters of the handler of particular
|
|
|
|
// notary event.
|
|
|
|
type NotaryHandlerInfo struct {
|
|
|
|
notaryRequestTypes
|
|
|
|
|
|
|
|
h Handler
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetHandler is an event handler setter.
|
|
|
|
func (nhi *NotaryHandlerInfo) SetHandler(v Handler) {
|
|
|
|
nhi.h = v
|
|
|
|
}
|
|
|
|
|
|
|
|
// Handler returns an event handler.
|
|
|
|
func (nhi NotaryHandlerInfo) Handler() Handler {
|
|
|
|
return nhi.h
|
|
|
|
}
|