[#76] Implement accounting.balance command in CLI
It prints result as a float type value. With verbose flag it prints decimal precision and value. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
84928527d7
commit
80cd4039a8
2 changed files with 72 additions and 2 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/client"
|
||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/network"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -111,3 +112,24 @@ func getEndpointAddress() (*network.Address, error) {
|
|||
|
||||
return addr, nil
|
||||
}
|
||||
|
||||
// getSDKClient returns default neofs-api-go sdk client. Consider using
|
||||
// opts... to provide TTL or other global configuration flags.
|
||||
func getSDKClient() (*client.Client, error) {
|
||||
key, err := getKey()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
netAddr, err := getEndpointAddress()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ipAddr, err := netAddr.IPAddrString()
|
||||
if err != nil {
|
||||
return nil, errInvalidEndpoint
|
||||
}
|
||||
|
||||
return client.New(key, client.WithAddress(ipAddr))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue