fix: recognize spot-only tokens in IsToken
Gate token detection via spot symbol resolution so chat flow accepts spot-only tokens, and add regression coverage for the fallback path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -137,6 +137,14 @@ func TestIsToken(t *testing.T) {
|
|||||||
},
|
},
|
||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "spot only token fallback",
|
||||||
|
input: "abc",
|
||||||
|
marketStub: &resolverMarketStub{
|
||||||
|
spotPairs: map[string]bool{"ABCUSDT": true},
|
||||||
|
},
|
||||||
|
want: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "non alphanumeric input",
|
name: "non alphanumeric input",
|
||||||
input: "bad!",
|
input: "bad!",
|
||||||
|
|||||||
@@ -30,12 +30,10 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func IsToken(s string) bool {
|
func IsToken(s string) bool {
|
||||||
// First check regular symbols
|
if len(Token2SpotSymbols(s)) > 0 {
|
||||||
if len(Token2FutureSymbols(s)) > 0 {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then check Alpha tokens
|
|
||||||
s = strings.ToUpper(s)
|
s = strings.ToUpper(s)
|
||||||
return data.Market.IsAlphaToken(s)
|
return data.Market.IsAlphaToken(s)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user