diff --git a/cli/nep17_test.go b/cli/nep17_test.go index 3dee91c61..5d35888a4 100644 --- a/cli/nep17_test.go +++ b/cli/nep17_test.go @@ -280,7 +280,7 @@ func TestNEP17ImportToken(t *testing.T) { e.checkNextLine(t, "^Hash:\\s*"+gasContractHash.StringLE()) e.checkNextLine(t, "^Decimals:\\s*8") e.checkNextLine(t, "^Address:\\s*"+address.Uint160ToString(gasContractHash)) - e.checkNextLine(t, "^Standard:\\s*"+manifest.NEP17StandardName) + e.checkNextLine(t, "^Standard:\\s*"+string(manifest.NEP17StandardName)) } t.Run("WithToken", func(t *testing.T) { e.Run(t, "neo-go", "wallet", "nep17", "info", @@ -298,7 +298,7 @@ func TestNEP17ImportToken(t *testing.T) { e.checkNextLine(t, "^Hash:\\s*"+neoContractHash.StringLE()) e.checkNextLine(t, "^Decimals:\\s*0") e.checkNextLine(t, "^Address:\\s*"+address.Uint160ToString(neoContractHash)) - e.checkNextLine(t, "^Standard:\\s*"+manifest.NEP17StandardName) + e.checkNextLine(t, "^Standard:\\s*"+string(manifest.NEP17StandardName)) }) t.Run("Remove", func(t *testing.T) { e.In.WriteString("y\r") diff --git a/pkg/rpc/client/nep.go b/pkg/rpc/client/nep.go index af22c95f0..8fb07db1b 100644 --- a/pkg/rpc/client/nep.go +++ b/pkg/rpc/client/nep.go @@ -1,6 +1,8 @@ package client import ( + "fmt" + "github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/wallet" @@ -78,6 +80,16 @@ func (c *Client) nepTokenInfo(tokenHash util.Uint160, standard string) (*wallet. if err != nil { return nil, err } + var isStandardOK bool + for _, st := range cs.Manifest.SupportedStandards { + if st == standard { + isStandardOK = true + break + } + } + if !isStandardOK { + return nil, fmt.Errorf("token %s does not support %s standard", tokenHash.StringLE(), standard) + } symbol, err := c.nepSymbol(tokenHash) if err != nil { return nil, err