From 67fe2a82bc52713885223a6f7b8efd8e137df888 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Thu, 17 Jun 2021 11:29:16 +0300 Subject: [PATCH] cli: remove `Can't find matching token in the wallet` warning --- cli/wallet/nep11.go | 3 +-- cli/wallet/nep17.go | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cli/wallet/nep11.go b/cli/wallet/nep11.go index 7481fdb6f..d93d3253f 100644 --- a/cli/wallet/nep11.go +++ b/cli/wallet/nep11.go @@ -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 { diff --git a/cli/wallet/nep17.go b/cli/wallet/nep17.go index 549e4c3ba..a7595b0f3 100644 --- a/cli/wallet/nep17.go +++ b/cli/wallet/nep17.go @@ -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) } }