rpc: check token standard in nepTokenInfo

This commit is contained in:
Anna Shaleva 2021-04-23 17:47:43 +03:00
parent 40ae78cb88
commit c3264c065d
2 changed files with 14 additions and 2 deletions

View file

@ -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