diff --git a/pkg/innerring/invoke/netmap.go b/pkg/innerring/invoke/netmap.go index 7c6cf23a9..37beab59a 100644 --- a/pkg/innerring/invoke/netmap.go +++ b/pkg/innerring/invoke/netmap.go @@ -1,13 +1,23 @@ 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 ( + UpdatePeerArgs struct { + Key *keys.PublicKey + Status uint32 + } +) + const ( - getEpochMethod = "epoch" - setNewEpochMethod = "newEpoch" + getEpochMethod = "epoch" + setNewEpochMethod = "newEpoch" + approvePeerMethod = "addPeer" + updatePeerStateMethod = "updateState" ) // Epoch return epoch value from contract. @@ -37,3 +47,24 @@ func SetNewEpoch(cli *client.Client, con util.Uint160, epoch uint64) error { return cli.Invoke(con, extraFee, setNewEpochMethod, int64(epoch)) } + +// ApprovePeer invokes AddPeer method. +func ApprovePeer(cli *client.Client, con util.Uint160, peer []byte) error { + if cli == nil { + return client.ErrNilClient + } + + return cli.Invoke(con, extraFee, approvePeerMethod, peer) +} + +// UpdatePeerState invokes AddPeer method. +func UpdatePeerState(cli *client.Client, con util.Uint160, args *UpdatePeerArgs) error { + if cli == nil { + return client.ErrNilClient + } + + return cli.Invoke(con, extraFee, updatePeerStateMethod, + args.Key.Bytes(), + int64(args.Status), + ) +}