2020-09-08 08:38:23 +00:00
|
|
|
package neofs
|
|
|
|
|
|
|
|
import (
|
2021-10-22 10:06:08 +00:00
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/rpc/response/result/subscriptions"
|
2020-09-08 08:38:23 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Unbind struct {
|
2021-05-31 18:09:02 +00:00
|
|
|
bindCommon
|
2020-09-08 08:38:23 +00:00
|
|
|
}
|
|
|
|
|
2021-10-22 10:06:08 +00:00
|
|
|
func ParseUnbind(e *subscriptions.NotificationEvent) (event.Event, error) {
|
2020-09-08 08:38:23 +00:00
|
|
|
var (
|
|
|
|
ev Unbind
|
|
|
|
err error
|
|
|
|
)
|
|
|
|
|
2021-10-22 10:06:08 +00:00
|
|
|
params, err := event.ParseStackArray(e)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("could not parse stack items from notify event: %w", err)
|
|
|
|
}
|
|
|
|
|
2021-05-31 18:09:02 +00:00
|
|
|
err = parseBind(&ev.bindCommon, params)
|
2020-09-08 08:38:23 +00:00
|
|
|
if err != nil {
|
2021-05-31 18:09:02 +00:00
|
|
|
return nil, err
|
2020-09-08 08:38:23 +00:00
|
|
|
}
|
|
|
|
|
2021-11-11 08:59:14 +00:00
|
|
|
ev.txHash = e.Container
|
|
|
|
|
2020-09-08 08:38:23 +00:00
|
|
|
return ev, nil
|
|
|
|
}
|