frostfs-node/cmd/frostfs-adm/internal/modules/morph/nns/tokens.go
Anton Nikiforov 61c58e2f92 [#932] adm: Add commands to manipulate with NNS contract
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-02-28 18:57:16 +00:00

24 lines
799 B
Go

package nns
import (
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
"github.com/spf13/cobra"
)
func initTokensCmd() {
Cmd.AddCommand(tokensCmd)
tokensCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
tokensCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
}
func listTokens(cmd *cobra.Command, _ []string) {
c, _, _ := getRPCClient(cmd)
it, err := c.Tokens()
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 _, token := range toks {
cmd.Println(string(token))
}
}
}