diff --git a/cli/nep17_test.go b/cli/nep17_test.go index d8b2021ee..3dc095543 100644 --- a/cli/nep17_test.go +++ b/cli/nep17_test.go @@ -116,6 +116,14 @@ func TestNEP17Transfer(t *testing.T) { "--from", validatorAddr, } + t.Run("missing receiver", func(t *testing.T) { + as := append([]string{}, args[:8]...) + as = append(as, args[10:]...) + e.In.WriteString("one\r") + e.RunWithError(t, as...) + e.In.Reset() + }) + t.Run("InvalidPassword", func(t *testing.T) { e.In.WriteString("onetwothree\r") e.RunWithError(t, args...) diff --git a/cli/wallet/nep17.go b/cli/wallet/nep17.go index 270a60c77..9d17975ad 100644 --- a/cli/wallet/nep17.go +++ b/cli/wallet/nep17.go @@ -514,6 +514,9 @@ func transferNEP(ctx *cli.Context, standard string) error { } toFlag := ctx.Generic("to").(*flags.Address) + if !toFlag.IsSet { + return cli.NewExitError(errors.New("missing receiver address (--to)"), 1) + } to := toFlag.Uint160() token, err := getMatchingToken(ctx, wall, ctx.String("token"), standard) if err != nil {