diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index a7780724e..82c3da69f 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -30,7 +30,7 @@ import ( balanceWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper" cntWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" neofsWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofs/wrapper" - neofsid "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid/wrapper" + neofsidWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid/wrapper" nmWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" repWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/reputation/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" @@ -417,7 +417,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - neofsIDClient, err := neofsid.NewFromMorph(server.morphClient, server.contracts.neofsID, fee) + neofsIDClient, err := neofsidWrapper.NewFromMorph(server.morphClient, server.contracts.neofsID, fee, neofsidWrapper.TryNotary()) if err != nil { return nil, err } diff --git a/pkg/morph/client/neofsid/wrapper/client.go b/pkg/morph/client/neofsid/wrapper/client.go index 44a30e6c2..3deffbf21 100644 --- a/pkg/morph/client/neofsid/wrapper/client.go +++ b/pkg/morph/client/neofsid/wrapper/client.go @@ -16,9 +16,33 @@ import ( // Working ClientWrapper must be created via Wrap. type ClientWrapper neofsid.Client +// Option allows to set an optional +// parameter of ClientWrapper. +type Option func(*opts) + +type opts []client.StaticClientOption + +func defaultOpts() *opts { + return new(opts) +} + +// TryNotary returns option to enable +// notary invocation tries. +func TryNotary() Option { + return func(o *opts) { + *o = append(*o, client.TryNotary()) + } +} + // NewFromMorph wraps client to work with NeoFS ID contract. -func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8) (*ClientWrapper, error) { - sc, err := client.NewStatic(cli, contract, fee, client.TryNotary()) +func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8, opts ...Option) (*ClientWrapper, error) { + o := defaultOpts() + + for i := range opts { + opts[i](o) + } + + sc, err := client.NewStatic(cli, contract, fee, ([]client.StaticClientOption)(*o)...) if err != nil { return nil, fmt.Errorf("could not create client of NeoFS ID contract: %w", err) }