From d686ab49e80f33fa91b213ff9ceeb3caecff2597 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 12 Apr 2023 13:58:54 +0300 Subject: [PATCH] [#202] adm: Remove deprecated RPC client methods Signed-off-by: Evgenii Stratonikov --- cmd/frostfs-adm/internal/modules/morph/initialize_nns.go | 8 +++++--- .../internal/modules/morph/initialize_register.go | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize_nns.go b/cmd/frostfs-adm/internal/modules/morph/initialize_nns.go index edb7d6de..15657a6d 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize_nns.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize_nns.go @@ -15,6 +15,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/rpcclient" "github.com/nspcc-dev/neo-go/pkg/rpcclient/invoker" + nnsClient "github.com/nspcc-dev/neo-go/pkg/rpcclient/nns" "github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap" "github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag" "github.com/nspcc-dev/neo-go/pkg/util" @@ -284,10 +285,11 @@ func parseNNSResolveResult(res stackitem.Item) (util.Uint160, error) { } func nnsIsAvailable(c Client, nnsHash util.Uint160, name string) (bool, error) { - switch ct := c.(type) { + switch c.(type) { case *rpcclient.Client: - //lint:ignore SA1019 https://git.frostfs.info/TrueCloudLab/frostfs-node/issues/202 - return ct.NNSIsAvailable(nnsHash, name) + inv := invoker.New(c, nil) + reader := nnsClient.NewReader(inv, nnsHash) + return reader.IsAvailable(name) default: b, err := unwrap.Bool(invokeFunction(c, nnsHash, "isAvailable", []any{name}, nil)) if err != nil { diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize_register.go b/cmd/frostfs-adm/internal/modules/morph/initialize_register.go index 27e1590c..b1542cc9 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize_register.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize_register.go @@ -9,6 +9,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/rpcclient" + "github.com/nspcc-dev/neo-go/pkg/rpcclient/invoker" "github.com/nspcc-dev/neo-go/pkg/rpcclient/neo" "github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap" "github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag" @@ -116,10 +117,11 @@ func (c *initializeContext) transferNEOFinished(neoHash util.Uint160) (bool, err var errGetPriceInvalid = errors.New("`getRegisterPrice`: invalid response") func (c *initializeContext) getCandidateRegisterPrice() (int64, error) { - switch ct := c.Client.(type) { + switch c.Client.(type) { case *rpcclient.Client: - //lint:ignore SA1019 https://git.frostfs.info/TrueCloudLab/frostfs-node/issues/202 - return ct.GetCandidateRegisterPrice() + inv := invoker.New(c.Client, nil) + reader := neo.NewReader(inv) + return reader.GetRegisterPrice() default: neoHash := neo.Hash res, err := invokeFunction(c.Client, neoHash, "getRegisterPrice", nil, nil)