[#25] Use api-go stringers and parsers for ID types in CLI
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
d7c53debb5
commit
c0a4343282
2 changed files with 10 additions and 26 deletions
|
@ -9,7 +9,6 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"github.com/mr-tron/base58"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/client"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
|
||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||
|
@ -165,20 +164,14 @@ func getSDKClient() (*client.Client, error) {
|
|||
|
||||
// ownerFromString converts string with NEO3 wallet address to neofs owner ID.
|
||||
func ownerFromString(s string) (*owner.ID, error) {
|
||||
var w owner.NEO3Wallet
|
||||
result := owner.NewID()
|
||||
|
||||
// todo: move this into neofs-api-go `owner.NEO3WalletFromString` function
|
||||
binaryWallet, err := base58.Decode(s)
|
||||
if err != nil || len(binaryWallet) != len(w) {
|
||||
err := result.Parse(s)
|
||||
if err != nil {
|
||||
return nil, errors.New("can't decode owner ID wallet address")
|
||||
}
|
||||
|
||||
copy(w[:], binaryWallet)
|
||||
|
||||
id := owner.NewID()
|
||||
id.SetNeo3Wallet(&w)
|
||||
|
||||
return id, nil
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func printVerbose(format string, a ...interface{}) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue