All checks were successful
DCO action / DCO (pull_request) Successful in 10m2s
Vulncheck / Vulncheck (pull_request) Successful in 11m30s
Build / Build Components (1.21) (pull_request) Successful in 13m28s
Build / Build Components (1.22) (pull_request) Successful in 13m25s
Tests and linters / gopls check (pull_request) Successful in 12m53s
Tests and linters / Lint (pull_request) Successful in 14m47s
Tests and linters / Staticcheck (pull_request) Successful in 14m27s
Pre-commit hooks / Pre-commit (pull_request) Successful in 17m36s
Tests and linters / Tests (1.21) (pull_request) Successful in 18m0s
Tests and linters / Tests with -race (pull_request) Successful in 18m1s
Tests and linters / Tests (1.22) (pull_request) Successful in 18m23s
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
25 lines
934 B
Go
25 lines
934 B
Go
package nns
|
|
|
|
import (
|
|
client "git.frostfs.info/TrueCloudLab/frostfs-contract/rpcclient/nns"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper"
|
|
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
|
"github.com/nspcc-dev/neo-go/pkg/rpcclient/management"
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func getRPCClient(cmd *cobra.Command) (*client.Contract, *helper.LocalActor, util.Uint160) {
|
|
v := viper.GetViper()
|
|
c, err := helper.GetN3Client(v)
|
|
commonCmd.ExitOnErr(cmd, "unable to create NEO rpc client: %w", err)
|
|
|
|
ac, err := helper.NewLocalActor(cmd, c)
|
|
commonCmd.ExitOnErr(cmd, "can't create actor: %w", err)
|
|
|
|
r := management.NewReader(ac.Invoker)
|
|
nnsCs, err := helper.GetContractByID(r, 1)
|
|
commonCmd.ExitOnErr(cmd, "can't get NNS contract state: %w", err)
|
|
return client.New(ac, nnsCs.Hash), ac, nnsCs.Hash
|
|
}
|