From 83f68bfeb72792ef8172a52f18d213cfddebbfdd Mon Sep 17 00:00:00 2001 From: Michael Feng Date: Thu, 14 May 2026 16:25:19 -0400 Subject: [PATCH] fix(gateway): correct Gateway connector import, save_pool content-type, and FastAPI redirect_slashes Three small but impactful fixes to gateway integration: 1. services/unified_connector_service.py: import the Gateway subclass, not GatewayBase. The previous `GatewayBase as Gateway` alias instantiated the base class for Solana/EVM network connectors, which lacks every CLMM and swap method. All LP executor operations failed with `AttributeError: 'GatewayBase' object has no attribute 'get_pool_info_by_address'` / `_clmm_add_liquidity`. 2. services/gateway_client.py: pass `json={}` to the save_pool POST. Without it aiohttp sends no Content-Type, and Fastify rejects with HTTP 415 "Unsupported Media Type: application/octet-stream". This broke POST /gateway/networks/{network_id}/pools/save/{pool_address} entirely. 3. main.py: set `redirect_slashes=False` on the FastAPI app so trailing-slash variants of routes are not 307-redirected (needed for Mintlify-driven docs routes to resolve cleanly). Co-Authored-By: Claude Opus 4.7 (1M context) --- main.py | 1 + services/gateway_client.py | 2 +- services/unified_connector_service.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 22e1e00a..990c892f 100644 --- a/main.py +++ b/main.py @@ -305,6 +305,7 @@ async def lifespan(app: FastAPI): description="API for managing Hummingbot trading instances", version=VERSION, lifespan=lifespan, + redirect_slashes=False, ) # Add CORS middleware diff --git a/services/gateway_client.py b/services/gateway_client.py index 84754826..5d1f1f39 100644 --- a/services/gateway_client.py +++ b/services/gateway_client.py @@ -353,7 +353,7 @@ async def save_pool(self, chain_network: str, address: str) -> Dict: """Save a pool by address using GeckoTerminal lookup""" return await self._request("POST", f"pools/save/{address}", params={ "chainNetwork": chain_network - }) + }, json={}) async def delete_pool(self, chain: str, network: str, address: str) -> Dict: """Delete a pool from Gateway's pool list""" diff --git a/services/unified_connector_service.py b/services/unified_connector_service.py index bf1388c8..830a29ed 100644 --- a/services/unified_connector_service.py +++ b/services/unified_connector_service.py @@ -22,7 +22,7 @@ from hummingbot.connector.connector_base import ConnectorBase from hummingbot.connector.connector_metrics_collector import TradeVolumeMetricCollector from hummingbot.connector.exchange_py_base import ExchangePyBase -from hummingbot.connector.gateway.gateway_base import GatewayBase as Gateway +from hummingbot.connector.gateway.gateway import Gateway from hummingbot.connector.perpetual_derivative_py_base import PerpetualDerivativePyBase from hummingbot.core.data_type.common import OrderType, PositionAction, PositionMode, TradeType from hummingbot.core.data_type.in_flight_order import InFlightOrder, OrderState