From 055f7be6d19f2f03bea9de2ebec368298de7cd12 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 11 Aug 2020 15:04:46 +0300 Subject: [PATCH] [#7] Add new container invocation wrapper for inner ring Signed-off-by: Alex Vanin --- pkg/innerring/invoke/container.go | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 pkg/innerring/invoke/container.go diff --git a/pkg/innerring/invoke/container.go b/pkg/innerring/invoke/container.go new file mode 100644 index 000000000..350efb0c5 --- /dev/null +++ b/pkg/innerring/invoke/container.go @@ -0,0 +1,33 @@ +package invoke + +import ( + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neo-go/pkg/util" + "github.com/nspcc-dev/neofs-node/pkg/morph/client" +) + +type ( + // ContainerParams for container put invocation. + ContainerParams struct { + Key *keys.PublicKey + Container []byte + Signature []byte + } +) + +const ( + putContainerMethod = "put" +) + +// RegisterContainer invokes Put method. +func RegisterContainer(cli *client.Client, con util.Uint160, p *ContainerParams) error { + if cli == nil { + return client.ErrNilClient + } + + return cli.Invoke(con, extraFee, putContainerMethod, + p.Container, + p.Signature, + p.Key.Bytes(), + ) +}