forked from TrueCloudLab/frostfs-node
d6c0307431
There is a need to provide contract address getter from all contract client wrappers. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
35 lines
756 B
Go
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)
|
|
}
|