From 0705e909dce45a84af4255afe3860f98b6cb59a5 Mon Sep 17 00:00:00 2001 From: thuanle Date: Mon, 27 Apr 2026 03:59:32 +0700 Subject: [PATCH] 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 --- internal/helper/binancex/resolver_test.go | 8 ++++++++ internal/helper/binancex/symbol.go | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/helper/binancex/resolver_test.go b/internal/helper/binancex/resolver_test.go index b3f13fc..1782b78 100644 --- a/internal/helper/binancex/resolver_test.go +++ b/internal/helper/binancex/resolver_test.go @@ -137,6 +137,14 @@ func TestIsToken(t *testing.T) { }, want: true, }, + { + name: "spot only token fallback", + input: "abc", + marketStub: &resolverMarketStub{ + spotPairs: map[string]bool{"ABCUSDT": true}, + }, + want: true, + }, { name: "non alphanumeric input", input: "bad!", diff --git a/internal/helper/binancex/symbol.go b/internal/helper/binancex/symbol.go index b45c06d..ea74329 100644 --- a/internal/helper/binancex/symbol.go +++ b/internal/helper/binancex/symbol.go @@ -30,12 +30,10 @@ var ( ) func IsToken(s string) bool { - // First check regular symbols - if len(Token2FutureSymbols(s)) > 0 { + if len(Token2SpotSymbols(s)) > 0 { return true } - // Then check Alpha tokens s = strings.ToUpper(s) return data.Market.IsAlphaToken(s) }