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"
|
2024-12-06 13:12:47 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
2021-01-20 17:08:06 +00:00
|
|
|
)
|
|
|
|
|
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.
|
2024-10-21 13:27:28 +00:00
|
|
|
type BlockHandler func(context.Context, *block.Block)
|
2021-01-20 17:08:06 +00:00
|
|
|
|
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 {
|
2024-12-06 13:12:47 +00:00
|
|
|
Contract util.Uint160
|
|
|
|
Type Type
|
|
|
|
Parser NotificationParser
|
|
|
|
Handlers []Handler
|
2020-07-10 14:17:51 +00:00
|
|
|
}
|
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
|
|
|
|
}
|