这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@fengtality
Copy link
Contributor

@fengtality fengtality commented Jul 1, 2025

Summary

  • Fixed estimateAmountIn returning incorrect values for BUY orders in Jupiter quote-swap endpoint
  • Corrected balance change calculations to properly reflect token movements
  • Reduced startup noise from loading unnecessary blockchain instances (contributed by @WuonParticle)

Details

The Jupiter quote-swap endpoint was incorrectly mapping response values for BUY orders:

  • Previously: estimateAmountIn returned 0.01 SOL (the amount to buy) instead of the USDC needed
  • Now: estimateAmountIn correctly returns ~1.47 USDC (the input token amount)

This ensures consistency where:

  • estimatedAmountIn = input token amount (quote for BUY, base for SELL)
  • estimatedAmountOut = output token amount (base for BUY, quote for SELL)

Additional Changes (from @WuonParticle)

  • Stop the startup spam from loading a full Solana instance for an example (3879fb3)
  • Stop the startup spam from loading multiple Ethereum instances to get an example address (eef8c5a)

Test plan

  • Tested BUY order: SOL/USDC amount=0.01 side=BUY - correctly returns USDC needed
  • Tested SELL order: SOL/USDC amount=0.01 side=SELL - still works correctly
  • Build passes without errors

🤖 Generated with Claude Code

WuonParticle and others added 3 commits July 1, 2025 13:06
Previously, estimateAmountIn was incorrectly returning the base token amount
for BUY orders instead of the quote token amount needed. This fix ensures:
- BUY orders: estimateAmountIn = quote token amount needed
- SELL orders: estimateAmountIn = base token amount to sell
- Balance changes correctly reflect token movements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@fengtality fengtality requested review from nikspz and rapcmia July 1, 2025 23:29
@rapcmia rapcmia moved this to In Discussion in Pull Request Board Jul 2, 2025
@rapcmia rapcmia moved this from In Discussion to Backlog in Pull Request Board Jul 2, 2025
Copy link
Contributor

@nikspz nikspz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Test performed:
    • GET /chains/solana/status: ok
    • GET /chains/solana/tokens: ok
    • wallet/add: ok
    • POST /chains/solana/balances: ok
    • GET /connectors/jupiter/quote-swap
      • Reviewed for BUY 0.1 SOL:
        • "estimatedAmountIn": 14.873755, "estimatedAmountOut": 0.1,
      • SELL 0.1 SOL:
        • "estimatedAmountIn": 0.1, "estimatedAmountOut": 14.869012,
    • POST /connectors/jupiter/execute-swap: ok
      • BUY JUP
        • "totalInputSwapped": 4.365742, "totalOutputSwapped": 10,
      • SELL JUP
        • "totalInputSwapped": 10, "totalOutputSwapped": 4.3660000000000005,
    • GET /connectors/meteora/clmm/quote-swap: ok
      • BUY SOL 0.01
        • "estimatedAmountIn": 1.491476, "estimatedAmountOut": 0.01,
      • SELL SOL 0.01
        • "poolAddress": "5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6",
        • "estimatedAmountIn": 0.01, "estimatedAmountOut": 1.492549,
    • POST /connectors/meteora/clmm/execute-swap: ok
      • BUY 0.01 SOL
        • "totalInputSwapped": 0.00992, "totalOutputSwapped": 1.492528,
      • SELL 0.01 SOL
        • "totalInputSwapped": 0.01008, "totalOutputSwapped": 1.490278,
    • connected raydium/amm, raydium/clmm, meteora/clmm, uniswap/amm, uniswap/clmm successfully
    • GET /connectors/raydium/amm/quote-swap
      • pool address not found 58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2 (Going to create separate issue for it)
      • changed pool address to another - not go
    • GET /connectors/raydium/clmm/quote-swap Internal Server Error (Going to create separate issue for it)
      • 500 Undocumented Error: Internal Server Error
        • 2025-07-02 03:00:57 | error | Unhandled error: { "error": "Converting circular structure to JSON\n --> starting at object with constructor 'TLSSocket'\n | property '_httpMessage' -> object with constructor 'ClientRequest'\n --- property 'socket' closes the circle", "url": "/connectors/raydium/clmm/quote-swap?network=mainnet-beta&baseToken=SOL&quoteToken=USDC&amount=0.01&side=BUY&slippagePct=1", "params": {} } 1751454069757 Raydium_Api sdk logger error GET https://api-v3.raydium.io/pools/info/ids?ids=58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2
      • Error: Internal Server Error
        • 2025-07-02 03:01:09 | error | Unhandled error: { "error": "Converting circular structure to JSON\n --> starting at object with constructor 'TLSSocket'\n | property '_httpMessage' -> object with constructor 'ClientRequest'\n --- property 'socket' closes the circle", "url": "/connectors/raydium/clmm/quote-swap?network=mainnet-beta&baseToken=SOL&quoteToken=USDC&amount=0.01&side=SELL&slippagePct=1&poolAddress=58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2", "params": {} }
    • GET /connectors/raydium/clmm/pool-info: ok

Note: Going to create separate issue for raydium

@nikspz nikspz merged commit 37c4dac into development Jul 2, 2025
5 checks passed
@nikspz nikspz deleted the core-2.7-fix branch July 2, 2025 14:40
@rapcmia rapcmia moved this from Backlog to Development 2.7.0 in Pull Request Board Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants