diff --git a/cli/nep11_test.go b/cli/nep11_test.go index 6ba752ec3..e2b6acbc8 100644 --- a/cli/nep11_test.go +++ b/cli/nep11_test.go @@ -1,6 +1,7 @@ package main import ( + "io" "os" "path" "testing" @@ -61,4 +62,14 @@ func TestNEP11Import(t *testing.T) { checkNNSInfo(t) }) }) + + t.Run("Remove", func(t *testing.T) { + e.In.WriteString("y\r") + e.Run(t, "neo-go", "wallet", "nep11", "remove", + "--wallet", walletPath, "--token", nnsContractHash.StringLE()) + e.Run(t, "neo-go", "wallet", "nep11", "info", + "--wallet", walletPath) + _, err := e.Out.ReadString('\n') + require.Equal(t, err, io.EOF) + }) } diff --git a/cli/wallet/nep11.go b/cli/wallet/nep11.go index 7a126edb0..7408d5837 100644 --- a/cli/wallet/nep11.go +++ b/cli/wallet/nep11.go @@ -24,6 +24,17 @@ func newNEP11Commands() []cli.Command { tokenFlag, }, }, + { + Name: "remove", + Usage: "remove NEP11 token from the wallet", + UsageText: "remove --wallet --token ", + Action: removeNEP11Token, + Flags: []cli.Flag{ + walletPathFlag, + tokenFlag, + forceFlag, + }, + }, } } @@ -34,3 +45,7 @@ func importNEP11Token(ctx *cli.Context) error { func printNEP11Info(ctx *cli.Context) error { return printNEPInfo(ctx, manifest.NEP11StandardName) } + +func removeNEP11Token(ctx *cli.Context) error { + return removeNEPToken(ctx, manifest.NEP11StandardName) +} diff --git a/cli/wallet/nep17.go b/cli/wallet/nep17.go index 34deb606a..8f8b9191c 100644 --- a/cli/wallet/nep17.go +++ b/cli/wallet/nep17.go @@ -345,13 +345,17 @@ func printNEPInfo(ctx *cli.Context, standard string) error { } func removeNEP17Token(ctx *cli.Context) error { + return removeNEPToken(ctx, manifest.NEP17StandardName) +} + +func removeNEPToken(ctx *cli.Context, standard string) error { wall, err := openWallet(ctx.String("wallet")) if err != nil { return cli.NewExitError(err, 1) } defer wall.Close() - token, err := getMatchingToken(ctx, wall, ctx.String("token"), manifest.NEP17StandardName) + token, err := getMatchingToken(ctx, wall, ctx.String("token"), standard) if err != nil { return cli.NewExitError(err, 1) }