diff --git a/cmd/neofs-adm/internal/modules/morph/container.go b/cmd/neofs-adm/internal/modules/morph/container.go index 11f1cfcce..2d3fbec12 100644 --- a/cmd/neofs-adm/internal/modules/morph/container.go +++ b/cmd/neofs-adm/internal/modules/morph/container.go @@ -10,6 +10,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag" + "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/vm/emit" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" @@ -35,9 +36,16 @@ func dumpContainers(cmd *cobra.Command, _ []string) error { return fmt.Errorf("can't get NNS contract state: %w", err) } - ch, err := nnsResolveHash(c, nnsCs.Hash, containerContract+".neofs") + var ch util.Uint160 + s, err := cmd.Flags().GetString(containerContractFlag) + if err == nil { + ch, err = util.Uint160DecodeStringLE(s) + } if err != nil { - return fmt.Errorf("can't fetch container contract hash: %w", err) + ch, err = nnsResolveHash(c, nnsCs.Hash, containerContract+".neofs") + if err != nil { + return err + } } res, err := c.InvokeFunction(ch, "list", diff --git a/cmd/neofs-adm/internal/modules/morph/root.go b/cmd/neofs-adm/internal/modules/morph/root.go index 74daf97d6..928cb470d 100644 --- a/cmd/neofs-adm/internal/modules/morph/root.go +++ b/cmd/neofs-adm/internal/modules/morph/root.go @@ -28,6 +28,7 @@ const ( withdrawFeeInitFlag = "network.fee.withdraw" withdrawFeeCLIFlag = "withdraw-fee" containerDumpFlag = "dump" + containerContractFlag = "container-contract" ) var ( @@ -169,6 +170,7 @@ func init() { RootCmd.AddCommand(dumpContainersCmd) dumpContainersCmd.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint") dumpContainersCmd.Flags().String(containerDumpFlag, "", "file where to save dumped containers") + dumpContainersCmd.Flags().String(containerContractFlag, "", "container contract hash (for networks without NNS)") RootCmd.AddCommand(restoreContainersCmd) restoreContainersCmd.Flags().String(alphabetWalletsFlag, "", "path to alphabet wallets dir")