adm: Do not use actor for readonly commands #1514
11 changed files with 47 additions and 61 deletions
|
@ -61,7 +61,6 @@ var (
|
||||||
Use: "list-namespaces",
|
Use: "list-namespaces",
|
||||||
Short: "List all namespaces in frostfsid",
|
Short: "List all namespaces in frostfsid",
|
||||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
||||||
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
||||||
},
|
},
|
||||||
Run: frostfsidListNamespaces,
|
Run: frostfsidListNamespaces,
|
||||||
|
@ -91,7 +90,6 @@ var (
|
||||||
Use: "list-subjects",
|
Use: "list-subjects",
|
||||||
Short: "List subjects in namespace",
|
Short: "List subjects in namespace",
|
||||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
||||||
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
||||||
},
|
},
|
||||||
Run: frostfsidListSubjects,
|
Run: frostfsidListSubjects,
|
||||||
|
@ -121,7 +119,6 @@ var (
|
||||||
Use: "list-groups",
|
Use: "list-groups",
|
||||||
Short: "List groups in namespace",
|
Short: "List groups in namespace",
|
||||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
||||||
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
||||||
},
|
},
|
||||||
Run: frostfsidListGroups,
|
Run: frostfsidListGroups,
|
||||||
|
@ -151,7 +148,6 @@ var (
|
||||||
Use: "list-group-subjects",
|
Use: "list-group-subjects",
|
||||||
Short: "List subjects in group",
|
Short: "List subjects in group",
|
||||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
||||||
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
||||||
},
|
},
|
||||||
Run: frostfsidListGroupSubjects,
|
Run: frostfsidListGroupSubjects,
|
||||||
|
@ -169,7 +165,6 @@ func initFrostfsIDCreateNamespaceCmd() {
|
||||||
func initFrostfsIDListNamespacesCmd() {
|
func initFrostfsIDListNamespacesCmd() {
|
||||||
Cmd.AddCommand(frostfsidListNamespacesCmd)
|
Cmd.AddCommand(frostfsidListNamespacesCmd)
|
||||||
frostfsidListNamespacesCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
frostfsidListNamespacesCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
||||||
frostfsidListNamespacesCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func initFrostfsIDCreateSubjectCmd() {
|
func initFrostfsIDCreateSubjectCmd() {
|
||||||
|
@ -193,7 +188,6 @@ func initFrostfsIDListSubjectsCmd() {
|
||||||
frostfsidListSubjectsCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
frostfsidListSubjectsCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
||||||
frostfsidListSubjectsCmd.Flags().String(namespaceFlag, "", "Namespace to list subjects")
|
frostfsidListSubjectsCmd.Flags().String(namespaceFlag, "", "Namespace to list subjects")
|
||||||
frostfsidListSubjectsCmd.Flags().Bool(includeNamesFlag, false, "Whether include subject name (require additional requests)")
|
frostfsidListSubjectsCmd.Flags().Bool(includeNamesFlag, false, "Whether include subject name (require additional requests)")
|
||||||
frostfsidListSubjectsCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func initFrostfsIDCreateGroupCmd() {
|
func initFrostfsIDCreateGroupCmd() {
|
||||||
|
@ -217,7 +211,6 @@ func initFrostfsIDListGroupsCmd() {
|
||||||
Cmd.AddCommand(frostfsidListGroupsCmd)
|
Cmd.AddCommand(frostfsidListGroupsCmd)
|
||||||
frostfsidListGroupsCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
frostfsidListGroupsCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
||||||
frostfsidListGroupsCmd.Flags().String(namespaceFlag, "", "Namespace to list groups")
|
frostfsidListGroupsCmd.Flags().String(namespaceFlag, "", "Namespace to list groups")
|
||||||
frostfsidListGroupsCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func initFrostfsIDAddSubjectToGroupCmd() {
|
func initFrostfsIDAddSubjectToGroupCmd() {
|
||||||
|
@ -242,7 +235,6 @@ func initFrostfsIDListGroupSubjectsCmd() {
|
||||||
frostfsidListGroupSubjectsCmd.Flags().String(namespaceFlag, "", "Namespace name")
|
frostfsidListGroupSubjectsCmd.Flags().String(namespaceFlag, "", "Namespace name")
|
||||||
frostfsidListGroupSubjectsCmd.Flags().Int64(groupIDFlag, 0, "Group id")
|
frostfsidListGroupSubjectsCmd.Flags().Int64(groupIDFlag, 0, "Group id")
|
||||||
frostfsidListGroupSubjectsCmd.Flags().Bool(includeNamesFlag, false, "Whether include subject name (require additional requests)")
|
frostfsidListGroupSubjectsCmd.Flags().Bool(includeNamesFlag, false, "Whether include subject name (require additional requests)")
|
||||||
frostfsidListGroupSubjectsCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func frostfsidCreateNamespace(cmd *cobra.Command, _ []string) {
|
func frostfsidCreateNamespace(cmd *cobra.Command, _ []string) {
|
||||||
|
|
|
@ -38,38 +38,24 @@ func NewLocalActor(cmd *cobra.Command, c actor.RPCActor, accName string) (*Local
|
||||||
walletDir := config.ResolveHomePath(viper.GetString(commonflags.AlphabetWalletsFlag))
|
walletDir := config.ResolveHomePath(viper.GetString(commonflags.AlphabetWalletsFlag))
|
||||||
var act *actor.Actor
|
var act *actor.Actor
|
||||||
var accounts []*wallet.Account
|
var accounts []*wallet.Account
|
||||||
if walletDir == "" {
|
|
||||||
account, err := wallet.NewAccount()
|
|
||||||
commonCmd.ExitOnErr(cmd, "unable to create dummy account: %w", err)
|
|
||||||
act, err = actor.New(c, []actor.SignerAccount{{
|
|
||||||
Signer: transaction.Signer{
|
|
||||||
Account: account.Contract.ScriptHash(),
|
|
||||||
Scopes: transaction.Global,
|
|
||||||
},
|
|
||||||
Account: account,
|
|
||||||
}})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
wallets, err := GetAlphabetWallets(viper.GetViper(), walletDir)
|
|
||||||
commonCmd.ExitOnErr(cmd, "unable to get alphabet wallets: %w", err)
|
|
||||||
|
|
||||||
for _, w := range wallets {
|
wallets, err := GetAlphabetWallets(viper.GetViper(), walletDir)
|
||||||
acc, err := GetWalletAccount(w, accName)
|
commonCmd.ExitOnErr(cmd, "unable to get alphabet wallets: %w", err)
|
||||||
commonCmd.ExitOnErr(cmd, fmt.Sprintf("can't find %s account: %%w", accName), err)
|
|
||||||
accounts = append(accounts, acc)
|
for _, w := range wallets {
|
||||||
}
|
acc, err := GetWalletAccount(w, accName)
|
||||||
act, err = actor.New(c, []actor.SignerAccount{{
|
commonCmd.ExitOnErr(cmd, fmt.Sprintf("can't find %s account: %%w", accName), err)
|
||||||
Signer: transaction.Signer{
|
accounts = append(accounts, acc)
|
||||||
Account: accounts[0].Contract.ScriptHash(),
|
}
|
||||||
Scopes: transaction.Global,
|
act, err = actor.New(c, []actor.SignerAccount{{
|
||||||
},
|
Signer: transaction.Signer{
|
||||||
Account: accounts[0],
|
Account: accounts[0].Contract.ScriptHash(),
|
||||||
}})
|
Scopes: transaction.Global,
|
||||||
if err != nil {
|
},
|
||||||
return nil, err
|
Account: accounts[0],
|
||||||
}
|
}})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
return &LocalActor{
|
return &LocalActor{
|
||||||
neoActor: act,
|
neoActor: act,
|
||||||
|
|
|
@ -12,7 +12,6 @@ var (
|
||||||
Short: "List netmap candidates nodes",
|
Short: "List netmap candidates nodes",
|
||||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
||||||
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
||||||
},
|
},
|
||||||
Run: listNetmapCandidatesNodes,
|
Run: listNetmapCandidatesNodes,
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ func initRegisterCmd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func registerDomain(cmd *cobra.Command, _ []string) {
|
func registerDomain(cmd *cobra.Command, _ []string) {
|
||||||
c, actor, _ := getRPCClient(cmd)
|
c, actor := nnsWriter(cmd)
|
||||||
|
|
||||||
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
||||||
email, _ := cmd.Flags().GetString(nnsEmailFlag)
|
email, _ := cmd.Flags().GetString(nnsEmailFlag)
|
||||||
|
@ -53,7 +53,7 @@ func initDeleteCmd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteDomain(cmd *cobra.Command, _ []string) {
|
func deleteDomain(cmd *cobra.Command, _ []string) {
|
||||||
c, actor, _ := getRPCClient(cmd)
|
c, actor := nnsWriter(cmd)
|
||||||
|
|
||||||
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
||||||
h, vub, err := c.DeleteDomain(name)
|
h, vub, err := c.DeleteDomain(name)
|
||||||
|
|
|
@ -5,13 +5,13 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/helper"
|
||||||
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/rpcclient/invoker"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/management"
|
"github.com/nspcc-dev/neo-go/pkg/rpcclient/management"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getRPCClient(cmd *cobra.Command) (*client.Contract, *helper.LocalActor, util.Uint160) {
|
func nnsWriter(cmd *cobra.Command) (*client.Contract, *helper.LocalActor) {
|
||||||
v := viper.GetViper()
|
v := viper.GetViper()
|
||||||
c, err := helper.GetN3Client(v)
|
c, err := helper.GetN3Client(v)
|
||||||
commonCmd.ExitOnErr(cmd, "unable to create NEO rpc client: %w", err)
|
commonCmd.ExitOnErr(cmd, "unable to create NEO rpc client: %w", err)
|
||||||
|
@ -22,5 +22,17 @@ func getRPCClient(cmd *cobra.Command) (*client.Contract, *helper.LocalActor, uti
|
||||||
r := management.NewReader(ac.Invoker)
|
r := management.NewReader(ac.Invoker)
|
||||||
nnsCs, err := helper.GetContractByID(r, 1)
|
nnsCs, err := helper.GetContractByID(r, 1)
|
||||||
commonCmd.ExitOnErr(cmd, "can't get NNS contract state: %w", err)
|
commonCmd.ExitOnErr(cmd, "can't get NNS contract state: %w", err)
|
||||||
return client.New(ac, nnsCs.Hash), ac, nnsCs.Hash
|
return client.New(ac, nnsCs.Hash), ac
|
||||||
|
}
|
||||||
|
|
||||||
|
func nnsReader(cmd *cobra.Command) (*client.ContractReader, *invoker.Invoker) {
|
||||||
|
c, err := helper.GetN3Client(viper.GetViper())
|
||||||
|
commonCmd.ExitOnErr(cmd, "unable to create NEO rpc client: %w", err)
|
||||||
|
|
||||||
|
inv := invoker.New(c, nil)
|
||||||
|
r := management.NewReader(inv)
|
||||||
|
nnsCs, err := helper.GetContractByID(r, 1)
|
||||||
|
commonCmd.ExitOnErr(cmd, "can't get NNS contract state: %w", err)
|
||||||
|
|
||||||
|
return client.NewReader(inv, nnsCs.Hash), inv
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-contract/nns"
|
"git.frostfs.info/TrueCloudLab/frostfs-contract/nns"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
|
||||||
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap"
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -29,7 +28,6 @@ func initAddRecordCmd() {
|
||||||
func initGetRecordsCmd() {
|
func initGetRecordsCmd() {
|
||||||
Cmd.AddCommand(getRecordsCmd)
|
Cmd.AddCommand(getRecordsCmd)
|
||||||
getRecordsCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
getRecordsCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
||||||
getRecordsCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
||||||
getRecordsCmd.Flags().String(nnsNameFlag, "", nnsNameFlagDesc)
|
getRecordsCmd.Flags().String(nnsNameFlag, "", nnsNameFlagDesc)
|
||||||
getRecordsCmd.Flags().String(nnsRecordTypeFlag, "", nnsRecordTypeFlagDesc)
|
getRecordsCmd.Flags().String(nnsRecordTypeFlag, "", nnsRecordTypeFlagDesc)
|
||||||
|
|
||||||
|
@ -61,7 +59,7 @@ func initDelRecordCmd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func addRecord(cmd *cobra.Command, _ []string) {
|
func addRecord(cmd *cobra.Command, _ []string) {
|
||||||
c, actor, _ := getRPCClient(cmd)
|
c, actor := nnsWriter(cmd)
|
||||||
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
||||||
data, _ := cmd.Flags().GetString(nnsRecordDataFlag)
|
data, _ := cmd.Flags().GetString(nnsRecordDataFlag)
|
||||||
recordType, _ := cmd.Flags().GetString(nnsRecordTypeFlag)
|
recordType, _ := cmd.Flags().GetString(nnsRecordTypeFlag)
|
||||||
|
@ -77,16 +75,16 @@ func addRecord(cmd *cobra.Command, _ []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getRecords(cmd *cobra.Command, _ []string) {
|
func getRecords(cmd *cobra.Command, _ []string) {
|
||||||
c, act, hash := getRPCClient(cmd)
|
c, inv := nnsReader(cmd)
|
||||||
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
||||||
recordType, _ := cmd.Flags().GetString(nnsRecordTypeFlag)
|
recordType, _ := cmd.Flags().GetString(nnsRecordTypeFlag)
|
||||||
if recordType == "" {
|
if recordType == "" {
|
||||||
sid, r, err := unwrap.SessionIterator(act.Invoker.Call(hash, "getAllRecords", name))
|
sid, r, err := c.GetAllRecords(name)
|
||||||
commonCmd.ExitOnErr(cmd, "unable to get records: %w", err)
|
commonCmd.ExitOnErr(cmd, "unable to get records: %w", err)
|
||||||
defer func() {
|
defer func() {
|
||||||
_ = act.Invoker.TerminateSession(sid)
|
_ = inv.TerminateSession(sid)
|
||||||
}()
|
}()
|
||||||
items, err := act.Invoker.TraverseIterator(sid, &r, 0)
|
items, err := inv.TraverseIterator(sid, &r, 0)
|
||||||
commonCmd.ExitOnErr(cmd, "unable to get records: %w", err)
|
commonCmd.ExitOnErr(cmd, "unable to get records: %w", err)
|
||||||
for len(items) != 0 {
|
for len(items) != 0 {
|
||||||
for j := range items {
|
for j := range items {
|
||||||
|
@ -97,7 +95,7 @@ func getRecords(cmd *cobra.Command, _ []string) {
|
||||||
recordTypeToString(nns.RecordType(rs[1].Value().(*big.Int).Int64())),
|
recordTypeToString(nns.RecordType(rs[1].Value().(*big.Int).Int64())),
|
||||||
string(bs))
|
string(bs))
|
||||||
}
|
}
|
||||||
items, err = act.Invoker.TraverseIterator(sid, &r, 0)
|
items, err = inv.TraverseIterator(sid, &r, 0)
|
||||||
commonCmd.ExitOnErr(cmd, "unable to get records: %w", err)
|
commonCmd.ExitOnErr(cmd, "unable to get records: %w", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -114,7 +112,7 @@ func getRecords(cmd *cobra.Command, _ []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func delRecords(cmd *cobra.Command, _ []string) {
|
func delRecords(cmd *cobra.Command, _ []string) {
|
||||||
c, actor, _ := getRPCClient(cmd)
|
c, actor := nnsWriter(cmd)
|
||||||
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
||||||
recordType, _ := cmd.Flags().GetString(nnsRecordTypeFlag)
|
recordType, _ := cmd.Flags().GetString(nnsRecordTypeFlag)
|
||||||
typ, err := getRecordType(recordType)
|
typ, err := getRecordType(recordType)
|
||||||
|
@ -129,7 +127,7 @@ func delRecords(cmd *cobra.Command, _ []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func delRecord(cmd *cobra.Command, _ []string) {
|
func delRecord(cmd *cobra.Command, _ []string) {
|
||||||
c, actor, _ := getRPCClient(cmd)
|
c, actor := nnsWriter(cmd)
|
||||||
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
||||||
data, _ := cmd.Flags().GetString(nnsRecordDataFlag)
|
data, _ := cmd.Flags().GetString(nnsRecordDataFlag)
|
||||||
recordType, _ := cmd.Flags().GetString(nnsRecordTypeFlag)
|
recordType, _ := cmd.Flags().GetString(nnsRecordTypeFlag)
|
||||||
|
|
|
@ -14,7 +14,7 @@ func initRenewCmd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func renewDomain(cmd *cobra.Command, _ []string) {
|
func renewDomain(cmd *cobra.Command, _ []string) {
|
||||||
c, actor, _ := getRPCClient(cmd)
|
c, actor := nnsWriter(cmd)
|
||||||
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
||||||
h, vub, err := c.Renew(name)
|
h, vub, err := c.Renew(name)
|
||||||
commonCmd.ExitOnErr(cmd, "unable to renew domain: %w", err)
|
commonCmd.ExitOnErr(cmd, "unable to renew domain: %w", err)
|
||||||
|
|
|
@ -18,12 +18,11 @@ const (
|
||||||
func initTokensCmd() {
|
func initTokensCmd() {
|
||||||
Cmd.AddCommand(tokensCmd)
|
Cmd.AddCommand(tokensCmd)
|
||||||
tokensCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
tokensCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
||||||
tokensCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
||||||
tokensCmd.Flags().BoolP(commonflags.Verbose, commonflags.VerboseShorthand, false, verboseDesc)
|
tokensCmd.Flags().BoolP(commonflags.Verbose, commonflags.VerboseShorthand, false, verboseDesc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func listTokens(cmd *cobra.Command, _ []string) {
|
func listTokens(cmd *cobra.Command, _ []string) {
|
||||||
c, _, _ := getRPCClient(cmd)
|
c, _ := nnsReader(cmd)
|
||||||
it, err := c.Tokens()
|
it, err := c.Tokens()
|
||||||
commonCmd.ExitOnErr(cmd, "unable to get tokens: %w", err)
|
commonCmd.ExitOnErr(cmd, "unable to get tokens: %w", err)
|
||||||
for toks, err := it.Next(10); err == nil && len(toks) > 0; toks, err = it.Next(10) {
|
for toks, err := it.Next(10); err == nil && len(toks) > 0; toks, err = it.Next(10) {
|
||||||
|
@ -41,7 +40,7 @@ func listTokens(cmd *cobra.Command, _ []string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCnameRecord(c *client.Contract, token []byte) (string, error) {
|
func getCnameRecord(c *client.ContractReader, token []byte) (string, error) {
|
||||||
items, err := c.GetRecords(string(token), big.NewInt(int64(nns.CNAME)))
|
items, err := c.GetRecords(string(token), big.NewInt(int64(nns.CNAME)))
|
||||||
|
|
||||||
// GetRecords returns the error "not an array" if the domain does not contain records.
|
// GetRecords returns the error "not an array" if the domain does not contain records.
|
||||||
|
|
|
@ -30,7 +30,7 @@ func initUpdateCmd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateSOA(cmd *cobra.Command, _ []string) {
|
func updateSOA(cmd *cobra.Command, _ []string) {
|
||||||
c, actor, _ := getRPCClient(cmd)
|
c, actor := nnsWriter(cmd)
|
||||||
|
|
||||||
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
||||||
email, _ := cmd.Flags().GetString(nnsEmailFlag)
|
email, _ := cmd.Flags().GetString(nnsEmailFlag)
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -4,7 +4,7 @@ go 1.22
|
||||||
|
|
||||||
require (
|
require (
|
||||||
code.gitea.io/sdk/gitea v0.17.1
|
code.gitea.io/sdk/gitea v0.17.1
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.20.0
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.21.0-rc.4
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0
|
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-locode-db v0.4.1-0.20240710074952-65761deb5c0d
|
git.frostfs.info/TrueCloudLab/frostfs-locode-db v0.4.1-0.20240710074952-65761deb5c0d
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88
|
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20241112082307-f17779933e88
|
||||||
|
|
BIN
go.sum
BIN
go.sum
Binary file not shown.
Loading…
Reference in a new issue