frostfs-node/pkg/morph/client/neofs/wrapper/bind.go
Leonard Lyubich d6c0307431 [] morph: Inherit internal.StaticClient interface in all wrappers
There is a need to provide contract address getter from all contract client
wrappers.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-30 14:47:04 +03:00

35 lines
756 B
Go

package neofscontract
import (
neofscontract "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofs"
)
// ManageKeys binds/unbinds list of public keys from NeoFS account by script hash.
func (x *ClientWrapper) ManageKeys(scriptHash []byte, ks [][]byte, bind bool) error {
type args interface {
SetScriptHash([]byte)
SetKeys([][]byte)
}
var (
a args
call func(args) error
)
if bind {
a = new(neofscontract.BindKeysArgs)
call = func(a args) error {
return x.client.BindKeys(*a.(*neofscontract.BindKeysArgs))
}
} else {
a = new(neofscontract.UnbindKeysArgs)
call = func(a args) error {
return x.client.UnbindKeys(*a.(*neofscontract.UnbindKeysArgs))
}
}
a.SetScriptHash(scriptHash)
a.SetKeys(ks)
return call(a)
}