fix / correct Gateway connector import, save_pool content-type, and FastAPI redirect_slashes#159
Merged
Merged
Conversation
…e, 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) <noreply@anthropic.com>
rapcmia
approved these changes
May 15, 2026
rapcmia
left a comment
Contributor
There was a problem hiding this comment.
- Test LP executor on Meteora CLMM ✅
- Started from a live Meteora SOL-USDC CLMM pool on solana-mainnet-beta
- Created the lp_executor successfully through POST /executors/ ok
- Executor logs showed the open-position flow calling Gateway successfully
- Gateway returned a transaction signature instead of failing on the first control-task tick
- A live position was created at aRSXTycuNLZ9jVY4aynPPa447Q69Q8rpmxvgtSNshyZ
- No AttributeError related to missing Gateway LP methods was seen in the executor logs
- Test save Solana CLMM pool ✅
- Called
POST /gateway/networks/solana-mainnet-beta/pools/save/3C5YE97HADPDxZehYq9Cis8AXr9aNyrUsczKzE1nDbW9 (TRUMP-USDC) - Route returned success with pool data for the Meteora TRUMP-USDC CLMM pool
- Response included the saved pool metadata instead of the earlier unsupported media type failure
- Gateway auto-added the TRUMP token during the save flow
- Called
- Test trailing-slash behavior
- GET /accounts returned 404 and GET /accounts/ returned 200
- POST /portfolio/state returned 200 and POST /portfolio/state/ returned 404
- GET /accounts/master_account/credentials returned 200 and GET /accounts/master_account/credentials/ returned 404
- GET /bot-orchestration/status returned 200 and GET /bot-orchestration/status/ returned 404
- No 307 redirects were observed on these sampled routes ✅
- GET /docker/available-images/ returned 500, which appears to be a separate existing route issue ❌
- Created separate issue #160
Contributor
Author
|
@rapcmia Thanks - the issue below is caused by the GET /docker/available-images/ returned 500, which appears to be a separate existing route issue ❌ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three small but impactful fixes to the gateway integration layer.
1.
services/unified_connector_service.py— Gateway connector instantiates wrong classPreviously:
from hummingbot.connector.gateway.gateway_base import GatewayBase as GatewayThe alias made
_create_trading_connectorinstantiateGatewayBasefor every Solana/EVM network connector.GatewayBaselacks the CLMM and swap methods that live on theGatewaysubclass, so all LP executor operations on Gateway networks fail with errors like:Fix: import the real
Gatewaysubclass. Its__init__is*args, **kwargs→super().__init__(), so the existingGateway(connector_name=..., trading_pairs=[], trading_required=True)call site is unchanged.2.
services/gateway_client.py—save_pooltriggers 415 Unsupported Media Typesave_poolwas the only POST in this client that didn't passjson=. Without a JSON body, aiohttp sends noContent-Typeheader, and Fastify on the Gateway side rejects with:This broke
POST /gateway/networks/{network_id}/pools/save/{pool_address}entirely (the endpoint the Swagger UI fronts directly). Fix: passjson={}so aiohttp setsContent-Type: application/json.3.
main.py— disable trailing-slash redirectsSet
redirect_slashes=Falseon the FastAPI app. Trailing-slash variants of routes were 307-redirecting, which interferes with Mintlify-driven docs routes that need to resolve cleanly without redirect indirection.Test plan
lp_executoragainst a Solana CLMM pool (e.g., Meteora) — verify the executor reachesOPENINGstate and successfully submitsadd_liquidity(previously failed withAttributeErroron first control-task tick).POST /gateway/networks/solana-mainnet-beta/pools/save/<known-pool-address>from the Swagger UI — verify a 200 response with pool data (previously returned 400 with the octet-stream error).GET /accountsvsGET /accounts/) no longer 307-redirect.🤖 Generated with Claude Code