diff --git a/onchain/tokens/metadata.py b/onchain/tokens/metadata.py index 32db697..3e98d21 100644 --- a/onchain/tokens/metadata.py +++ b/onchain/tokens/metadata.py @@ -175,9 +175,9 @@ async def _search_token_on_dexscreener( # Filter by chain if specified if chain: - pairs = [pair for pair in pairs if pair["chainId"] == chain] - if len(pairs) == 0: - return None + chain = chain.lower() + if chain not in SUPPORTED_CHAINS: + return None token_address = pairs[0]["baseToken"]["address"] token_chain = pairs[0]["chainId"] diff --git a/server/fastapi_server.py b/server/fastapi_server.py index 3b62382..383ad2d 100644 --- a/server/fastapi_server.py +++ b/server/fastapi_server.py @@ -84,13 +84,24 @@ def create_fastapi_app() -> FastAPI: app = FastAPI() # Configure CORS - app.add_middleware( + app.add_middleware( CORSMiddleware, allow_origins=[ "https://bitquant.io", "https://www.bitquant.io", - r"^http://localhost:(3000|3001|3002|4000|4200|5000|5173|8000|8080|8081|9000)$", - r"^https://defi-chat-hub-git-[\w-]+-open-gradient\.vercel\.app$", + "http://localhost:3000", + "http://localhost:3001", + "http://localhost:3002", + "http://localhost:4000", + "http://localhost:4200", + "http://localhost:5000", + "http://localhost:5173", + "http://localhost:8000", + "http://localhost:8080", + "http://localhost:8081", + "http://localhost:9000", + ], + allow_origin_regex=r"^https://defi-chat-hub-git-[\w-]+-open-gradient\.vercel\.app$", ], allow_credentials=True, allow_methods=["*"],