From dae94aa230fc5b0ae23ffbb5faa800d80231be04 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 21 Oct 2020 19:19:06 +0300 Subject: [PATCH] [#60] morph/netmap: Implement Epoch method on netmap client wrapper Signed-off-by: Leonard Lyubich --- pkg/morph/client/netmap/wrapper/epoch.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pkg/morph/client/netmap/wrapper/epoch.go diff --git a/pkg/morph/client/netmap/wrapper/epoch.go b/pkg/morph/client/netmap/wrapper/epoch.go new file mode 100644 index 000000000..9bfe3360d --- /dev/null +++ b/pkg/morph/client/netmap/wrapper/epoch.go @@ -0,0 +1,19 @@ +package wrapper + +import ( + "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap" + "github.com/pkg/errors" +) + +// Epoch receives number of current NeoFS epoch +// through the Netmap contract call. +func (w *Wrapper) Epoch() (uint64, error) { + args := netmap.EpochArgs{} + + vals, err := w.client.Epoch(args) + if err != nil { + return 0, errors.Wrapf(err, "(%T) could not get epoch number", w) + } + + return uint64(vals.Number()), nil +}