fix: handle null tokens in balance extraction after transaction#569
Merged
fengtality merged 3 commits intodevelopmentfrom Dec 9, 2025
Merged
fix: handle null tokens in balance extraction after transaction#569fengtality merged 3 commits intodevelopmentfrom
fengtality merged 3 commits intodevelopmentfrom
Conversation
When a pool contains tokens not in Gateway's token list, getToken() returns null. Previously, this caused "Cannot read properties of null (reading 'address')" errors AFTER transactions were confirmed on-chain, causing users to lose track of their positions. Fix: Use pool's token addresses directly as fallback when getToken() returns null. Affected connectors: - Meteora CLMM: openPosition - Raydium AMM: addLiquidity, removeLiquidity - Raydium CLMM: addLiquidity, removeLiquidity - Orca CLMM: addLiquidity, removeLiquidity, closePosition, collectFees Also adds regression tests to prevent this bug from recurring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
|
Commit 488d9ff
Added test and gateway logs 12092025a.zip |
rapcmia
approved these changes
Dec 9, 2025
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
Fixes a bug where Gateway returns HTTP 500 errors after transactions are successfully confirmed on-chain when pool tokens are not in Gateway's token list.
Root Cause: When
getToken()returnsnullfor unknown tokens, the code crashes trying to access.addresson null objects during balance extraction.Fix: Use pool token addresses directly as fallback when
getToken()returns null:Affected Connectors
Manual QA Test Plan
Test using pools containing the Franklin token (
CSrwNk6B1DwWCHRMsaoDVUfD5bBMQCJPY72ZG3Nnpump) or another token that is NOT in your Gateway's token list.Prerequisites
Test Cases
1. Meteora CLMM - Open Position
Expected: Returns 200 with signature and position details (not 500 error)
2. Meteora CLMM - Close Position
Expected: Returns 200 with signature and removed amounts
3. Orca CLMM - Open Position
Expected: Returns 200 with signature and position details
4. Orca CLMM - Close Position
Expected: Returns 200 with signature and removed amounts
5. Raydium CLMM - Open Position
Expected: Returns 200 with signature and position details
6. Raydium CLMM - Close Position
Expected: Returns 200 with signature and removed amounts
Verification
Automated Tests
Added regression tests in
test/connectors/null-token-handling.test.ts(12 tests) to prevent this bug from recurring.🤖 Generated with Claude Code