cli/wallet: swap name/address checks for token identification

Address identification must have a priority, another token can have this
address in its name, but when there is a hash specified we should take the one
with proper hash.
This commit is contained in:
Roman Khimov 2020-12-13 21:04:10 +03:00
parent 8e2df8902c
commit e3dfb5d165

View file

@ -228,7 +228,7 @@ func getMatchingTokenAux(ctx *cli.Context, get func(i int) *wallet.Token, n int,
var count int
for i := 0; i < n; i++ {
t := get(i)
if t != nil && (t.Name == name || t.Symbol == name || t.Address() == name || t.Hash.StringLE() == name) {
if t != nil && (t.Hash.StringLE() == name || t.Address() == name || t.Symbol == name || t.Name == name) {
if count == 1 {
printTokenInfo(ctx, token)
printTokenInfo(ctx, t)