Merge pull request #2018 from nspcc-dev/cli/drop-warn

cli: remove `Can't find matching token in the wallet` warning
This commit is contained in:
Roman Khimov 2021-06-17 12:03:51 +03:00 committed by GitHub
commit 2f462f68cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View file

@ -184,10 +184,9 @@ func getNEP11Balance(ctx *cli.Context) error {
}
token, err := getMatchingToken(ctx, wall, name, manifest.NEP11StandardName)
if err != nil {
fmt.Fprintln(ctx.App.ErrWriter, "Can't find matching token in the wallet. Querying RPC-node for token info.")
tokenHash, err := flags.ParseAddress(name)
if err != nil {
return cli.NewExitError(fmt.Sprintf("valid token adress or hash in LE should be specified for RPC-node request: %s", err.Error()), 1)
return cli.NewExitError(fmt.Errorf("can't fetch matching token from RPC-node: %w", err), 1)
}
token, err = c.NEP11TokenInfo(tokenHash)
if err != nil {

View file

@ -440,10 +440,9 @@ func multiTransferNEP17(ctx *cli.Context) error {
if !ok {
token, err = getMatchingToken(ctx, wall, ss[0], manifest.NEP17StandardName)
if err != nil {
fmt.Fprintln(ctx.App.ErrWriter, "Can't find matching token in the wallet. Querying RPC-node for balances.")
token, err = getMatchingTokenRPC(ctx, c, from, ss[0], manifest.NEP17StandardName)
if err != nil {
return cli.NewExitError(err, 1)
return cli.NewExitError(fmt.Errorf("can't fetch matching token from RPC-node: %w", err), 1)
}
}
}
@ -509,10 +508,9 @@ func transferNEP(ctx *cli.Context, standard string) error {
to := toFlag.Uint160()
token, err := getMatchingToken(ctx, wall, ctx.String("token"), standard)
if err != nil {
fmt.Fprintln(ctx.App.ErrWriter, "Can't find matching token in the wallet. Querying RPC-node for balances.")
token, err = getMatchingTokenRPC(ctx, c, from, ctx.String("token"), standard)
if err != nil {
return cli.NewExitError(fmt.Errorf("failed to get matching token: %w", err), 1)
return cli.NewExitError(fmt.Errorf("can't fetch matching token from RPC-node: %w", err), 1)
}
}