2020-07-10 17:17:51 +03:00
|
|
|
package event
|
|
|
|
|
2021-01-20 20:08:06 +03:00
|
|
|
import (
|
2024-10-21 12:21:01 +03:00
|
|
|
"context"
|
|
|
|
|
2021-01-20 20:08:06 +03:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/core/block"
|
2024-12-06 16:12:47 +03:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
2021-01-20 20:08:06 +03:00
|
|
|
)
|
|
|
|
|
2020-07-10 17:17:51 +03:00
|
|
|
// Handler is an Event processing function.
|
2024-10-21 12:21:01 +03:00
|
|
|
type Handler func(context.Context, Event)
|
2020-07-10 17:17:51 +03:00
|
|
|
|
2021-01-20 20:08:06 +03:00
|
|
|
// BlockHandler is a chain block processing function.
|
2024-10-21 16:27:28 +03:00
|
|
|
type BlockHandler func(context.Context, *block.Block)
|
2021-01-20 20:08:06 +03:00
|
|
|
|
2021-08-12 18:24:17 +03:00
|
|
|
// NotificationHandlerInfo is a structure that groups
|
2020-07-10 17:17:51 +03:00
|
|
|
// the parameters of the handler of particular
|
|
|
|
// contract event.
|
2021-08-12 18:24:17 +03:00
|
|
|
type NotificationHandlerInfo struct {
|
2024-12-06 16:12:47 +03:00
|
|
|
Contract util.Uint160
|
|
|
|
Type Type
|
|
|
|
Parser NotificationParser
|
|
|
|
Handlers []Handler
|
2020-07-10 17:17:51 +03:00
|
|
|
}
|
2021-08-15 20:03:15 +03: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
|
|
|
|
}
|