[#927] neofs-adm: fix dump-config command

```
Error: can't to initialize context: can't read alphabet wallets dir: open : no such file or directory
```
It needs neither contracts nor wallets, just N3 client.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
remotes/fyrchik/fix-env-file
Evgenii Stratonikov 2021-10-18 15:14:32 +03:00 committed by Alex Vanin
parent c93c5e726c
commit f1202a5738
1 changed files with 5 additions and 5 deletions

View File

@ -102,22 +102,22 @@ func dumpContractHashes(cmd *cobra.Command, _ []string) error {
}
func dumpNetworkConfig(cmd *cobra.Command, _ []string) error {
wCtx, err := newInitializeContext(cmd, viper.GetViper())
c, err := getN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't to initialize context: %w", err)
return fmt.Errorf("can't create N3 client: %w", err)
}
cs, err := wCtx.Client.GetContractStateByID(1)
cs, err := c.GetContractStateByID(1)
if err != nil {
return fmt.Errorf("can't get NNS contract info: %w", err)
}
nmHash, err := nnsResolveHash(wCtx.Client, cs.Hash, netmapContract+".neofs")
nmHash, err := nnsResolveHash(c, cs.Hash, netmapContract+".neofs")
if err != nil {
return fmt.Errorf("can't get netmap contract hash: %w", err)
}
res, err := wCtx.Client.InvokeFunction(nmHash, "listConfig",
res, err := c.InvokeFunction(nmHash, "listConfig",
[]smartcontract.Parameter{}, []transaction.Signer{{}})
if err != nil || res.State != vm.HaltState.String() || len(res.Stack) == 0 {
return errors.New("can't fetch list of network config keys from the netmap contract")