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

Conversation

@fengtality
Copy link
Contributor

@fengtality fengtality commented Oct 30, 2025

Summary

This PR includes multiple improvements to Gateway's chain and connector functionality:

  1. Dynamic Wrapped Token Lookup - Fixes Polygon wrap issue
  2. Meteora SDK Upgrade - Updates to v1.7.5 with breaking changes
  3. Unlisted Token Support - Enables trading any ERC20 token by address
  4. BigInt Conversion Fixes - Fixes errors with large token amounts
  5. Improved Error Messages - Better guidance for CLMM swap approvals

1. Dynamic Wrapped Token Lookup

Problem: Polygon wrap endpoint was trying to wrap MATIC to bridged WETH instead of POL to WPOL due to hardcoded address mappings.

Solution: Replace hardcoded WRAPPED_ADDRESSES mapping with dynamic lookup from token lists.

The wrap/unwrap endpoints now:

  1. Read nativeCurrencySymbol from network config (e.g., "POL" for Polygon)
  2. Construct wrapped symbol as W+nativeSymbol (e.g., "WPOL")
  3. Look up the token address from the loaded token list

Additional Fix: Changed Optimism nativeCurrencySymbol from "OETH" to "ETH" to match WETH in token list.

Files Changed:

  • src/chains/ethereum/routes/wrap.ts
  • src/chains/ethereum/routes/unwrap.ts
  • src/templates/chains/ethereum/optimism.yml

2. Meteora SDK Upgrade to v1.7.5

Changes: Updated @meteora-ag/dlmm from 1.3.12 to 1.7.5 and fixed breaking changes:

  • TokenReserve API: decimalmint.decimals
  • StrategyType enum: Removed SpotBalanced/SpotImBalanced, use Spot
  • Transaction handling: Handle Transaction[] returns in collectFees/removeLiquidity
  • removeLiquidity API: Changed from binIds array to fromBinId/toBinId parameters

Testing: Added comprehensive integration tests (meteora-sdk-integration.test.ts). All 44 Meteora tests pass.

Files Changed:

  • package.json (SDK version)
  • src/connectors/meteora/meteora.ts
  • src/connectors/meteora/schemas.ts
  • src/connectors/meteora/clmm-routes/collectFees.ts
  • src/connectors/meteora/clmm-routes/removeLiquidity.ts
  • test/connectors/meteora/meteora-sdk-integration.test.ts (new)

3. Unlisted Token Support

Problem: Could only trade tokens that exist in the token list.

Solution: Added dynamic token fetching that queries the blockchain for token info when not found in token list.

Ethereum Chain (src/chains/ethereum/ethereum.ts):

  • Added getOrFetchToken() method that:
    • First checks token list by symbol or address
    • Falls back to querying ERC20 contract for name, symbol, decimals
    • Returns TokenInfo object or undefined

Updated Connectors:

  • Router connectors (PancakeSwap, Uniswap, 0x): Use ethereum.getOrFetchToken()
  • Uniswap connector: Added async getOrFetchTokenByAddress() and getOrFetchTokenBySymbol() methods
  • Updated routes: Uniswap CLMM/AMM quote-swap, Uniswap AMM quote-liquidity

Files Changed:

  • src/chains/ethereum/ethereum.ts
  • src/connectors/pancakeswap/router-routes/quoteSwap.ts
  • src/connectors/uniswap/router-routes/quoteSwap.ts
  • src/connectors/0x/router-routes/quoteSwap.ts
  • src/connectors/uniswap/uniswap.ts
  • src/connectors/uniswap/clmm-routes/quoteSwap.ts
  • src/connectors/uniswap/amm-routes/quoteSwap.ts
  • src/connectors/uniswap/amm-routes/quoteLiquidity.ts

4. BigInt Scientific Notation Fixes

Problem: Errors like "Cannot convert 1e+21 to a BigInt" when using large token amounts (>1000 tokens with 18 decimals).

Root Cause: Using Math.floor(amount * Math.pow(10, decimals)) creates scientific notation for large numbers, which JSBI.BigInt() cannot parse.

Solution: Use utils.parseUnits(amount.toString(), decimals) instead, which properly handles large numbers without scientific notation.

Fixed in Uniswap:

  • src/connectors/uniswap/clmm-routes/quoteSwap.ts - exactIn and exactOut cases

Fixed in PancakeSwap:

  • src/connectors/pancakeswap/clmm-routes/openPosition.ts - baseToken and quoteToken amounts
  • src/connectors/pancakeswap/clmm-routes/quotePosition.ts - all JSBI.BigInt conversions (4 locations)
  • src/connectors/pancakeswap/clmm-routes/addLiquidity.ts - baseToken and quoteToken amounts
  • src/connectors/pancakeswap/clmm-routes/quoteSwap.ts - exactIn and exactOut cases

Related Issue: Fixes #542


5. Improved CLMM Allowance Error Messages

Problem: Confusing error messages when users approved wrong spender for CLMM swaps.

Context:

  • uniswap/clmm → NonfungiblePositionManager (for liquidity operations)
  • uniswap/clmm/swap → SwapRouter02 (for executing swaps)

Solution: Enhanced error messages in execute-swap to explain:

  • Current allowance vs. required amount
  • Correct spender to use for approval (connector/clmm/swap not connector/clmm)
  • SwapRouter02 address that needs approval
  • Difference between the two spenders

Example Error:

Insufficient allowance for USDC. Current: 0 USDC, Required: 0.027 USDC. 
To swap with Uniswap CLMM, you need to approve the spender "uniswap/clmm/swap" 
instead of "uniswap/clmm". This will approve the SwapRouter02 address 
(0x2626664c2603336E57B271c5C0b26F421741e481), which is used for routing 
swaps to CLMM pools. The "uniswap/clmm" spender is only for adding liquidity.

Files Changed:

  • src/connectors/uniswap/clmm-routes/executeSwap.ts
  • src/connectors/pancakeswap/clmm-routes/executeSwap.ts

Tests Performed

  • ✅ All 44 Meteora tests pass (including new SDK integration tests)
  • ✅ Verified wrap/unwrap with dynamic token lookup
  • ✅ Tested unlisted token trading by address
  • ✅ Tested large token amounts (1000+ tokens) in swaps and positions
  • ✅ Verified improved error messages display correctly

Breaking Changes

None - all changes are backward compatible.

🤖 Generated with Claude Code

fengtality and others added 4 commits October 29, 2025 18:34
…ndpoints

Replace hardcoded WRAPPED_ADDRESSES mapping with dynamic lookup from token lists.
The wrap/unwrap endpoints now automatically resolve wrapped tokens by:
1. Reading nativeCurrencySymbol from network config (e.g., "POL" for Polygon)
2. Constructing wrapped symbol as W+nativeSymbol (e.g., "WPOL")
3. Looking up the token address from the loaded token list

This fixes the Polygon wrap issue where it was incorrectly trying to wrap
MATIC to bridged WETH instead of POL to WPOL.

Also fixed Optimism nativeCurrencySymbol from "OETH" to "ETH" to match
the WETH token in its token list.

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Updated @meteora-ag/dlmm from 1.3.12 to 1.7.5
- Fixed TokenReserve API changes (decimal → mint.decimals)
- Updated StrategyType enum (removed SpotBalanced/SpotImBalanced, use Spot)
- Fixed Transaction array handling in collectFees and removeLiquidity
- Updated removeLiquidity to use fromBinId/toBinId instead of binIds array

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Added meteora-sdk-integration.test.ts to validate SDK v1.7.5 compatibility
- Tests TokenReserve API changes (decimal → mint.decimals)
- Tests StrategyType enum changes (removed SpotBalanced/SpotImBalanced)
- Tests pool creation, data access, and bin data fetching
- All 44 meteora tests pass including new integration tests

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

Co-Authored-By: Claude <noreply@anthropic.com>
fengtality and others added 2 commits October 29, 2025 20:15
Added `getOrFetchToken()` method to Ethereum class that:
- First checks the token list for the token by symbol or address
- If not found, validates the address and fetches token info from blockchain
- Queries token contract for name, symbol, and decimals

Updated router quote-swap endpoints to use getOrFetchToken():
- PancakeSwap: router/quote-swap now supports unlisted tokens
- Uniswap: router/quote-swap now supports unlisted tokens
- 0x: router/quote-swap now supports unlisted tokens

This allows trading any ERC20 token by address, not just those in the token list.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Added new async methods to Uniswap connector:
- `getOrFetchTokenByAddress()` - fetches token info from blockchain if not in list
- `getOrFetchTokenBySymbol()` - wrapper for getOrFetchTokenByAddress

Updated routes to support unlisted tokens:
- Uniswap CLMM quote-swap: now accepts any ERC20 token address
- Uniswap AMM quote-swap: now accepts any ERC20 token address
- Uniswap AMM quote-liquidity: now accepts any ERC20 token address

Kept existing synchronous methods unchanged to avoid breaking other routes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed "Cannot convert 1e+21 to a BigInt" error when quoting swaps with
large amounts (e.g., 1000 tokens with 18 decimals).

Changed from Math.floor(amount * Math.pow(10, decimals)) which creates
scientific notation, to utils.parseUnits() which handles large numbers
correctly. Applied to both exactIn (SELL) and exactOut (BUY) cases.

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

Co-Authored-By: Claude <noreply@anthropic.com>
…error

Fixed "Cannot convert 1.5e+21 to a BigInt" error when opening positions or
adding liquidity with large amounts (>1000 tokens) in PancakeSwap CLMM.

Changed from Math.floor(amount * Math.pow(10, decimals)) which creates
scientific notation, to utils.parseUnits() which handles large numbers
correctly.

Fixed in:
- openPosition.ts: baseTokenAmount and quoteTokenAmount conversion
- quotePosition.ts: all JSBI.BigInt conversions for position quotes
- addLiquidity.ts: baseTokenAmount and quoteTokenAmount conversion
- quoteSwap.ts: exactIn and exactOut amount conversions

This is the same fix as was applied to Uniswap CLMM in commit 17e7620.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Updated insufficient allowance error messages in Uniswap and PancakeSwap
CLMM execute-swap to provide clear guidance on using the correct spender.

The error now explains that users need to approve "uniswap/clmm/swap" or
"pancakeswap/clmm/swap" instead of "uniswap/clmm" or "pancakeswap/clmm"
for swaps, as these route to different contract addresses:
- "connector/clmm/swap" → SwapRouter02 (for executing swaps)
- "connector/clmm" → NonfungiblePositionManager (for liquidity operations)

Error message now includes:
- Current allowance vs. required amount
- Specific spender name to use for approval
- SwapRouter02 address that needs approval
- Explanation of the difference between spenders

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

Co-Authored-By: Claude <noreply@anthropic.com>
@fengtality fengtality changed the title fix(chains): implement dynamic wrapped token lookup for wrap/unwrap e… feat: multiple improvements - wrap/unwrap, meteora v1.7.5, unlisted tokens, bigint fixes, error messages Oct 30, 2025
@fengtality fengtality marked this pull request as ready for review October 30, 2025 04:02
fengtality and others added 9 commits October 30, 2025 10:53
…extraction

Fixed issue where baseFeeAmountCollected was showing 0 in collect-fees
response. The bug was in extractBalanceChangesAndFee call which was
passing the pool address as owner instead of the wallet address.

The extractBalanceChangesAndFee function looks for token balance changes
for the specified owner account. Using the pool address meant it couldn't
find any balance changes for the wallet's tokens.

Changed line 85 from:
  await solana.extractBalanceChangesAndFee(signature, dlmmPool.pubkey.toBase58(), ...)
To:
  await solana.extractBalanceChangesAndFee(signature, wallet.publicKey.toBase58(), ...)

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Add default values and examples to all /trading/clmm routes using Meteora CLMM parameters
- Apply default walletAddress pattern (Solana config first, Ethereum fallback) across routes
- Create unified GET /trading/clmm/quote-position supporting all CLMM connectors
- Export standalone quotePosition functions from Uniswap and PancakeSwap connectors
- Update all PancakeSwap CLMM endpoints to use BSC network with USDT-WBNB pool (0x172fcd41e0913e95784454622d1c3724f546f849)
- Set appropriate price ranges (0.0008-0.001) and amounts (10 USDT) for BSC pool
- Remove unnecessary baseToken/quoteToken fields from quote-position routes

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Update getFee() to extract and calculate priority fee from ComputeBudget instructions
- Priority fee = (microlamports per CU from SetComputeUnitPrice instruction) * (compute units consumed) / 1,000,000
- Total fee now reports base fee + priority fee instead of just base fee
- Update extractBalanceChangesAndFee() to use the enhanced getFee() method
- Add detailed logging showing base, priority, and total fees in lamports and SOL

Previously, txData.meta.fee only included the base transaction fee (~5,000-15,000 lamports).
Now correctly includes both base and priority fees for accurate fee reporting.

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

Co-Authored-By: Claude <noreply@anthropic.com>
…point

- Added new getPositionInfoByAddress() method that fetches position info directly by address
- Method parses position account to extract pool address (lbPair)
- Uses Meteora SDK's dlmmPool.getPosition() method for clean implementation
- Removed walletAddress from MeteoraClmmGetPositionInfoRequest schema
- Updated unified /trading/clmm/position-info to not require walletAddress for Meteora
- Simplifies API usage - only position address needed to fetch position details

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Removed walletAddress parameter from all CLMM position-info routes
- Updated Uniswap, PancakeSwap, Meteora, Raydium, and PancakeSwap-Sol connectors
- Removed from unified /trading/clmm/position-info route and schema
- Position NFT token ID is sufficient to fetch position details
- Cleaned up unused wallet validation logic

Position info endpoints now only require:
- connector
- chainNetwork
- positionAddress

Note: walletAddress still required for positions-owned endpoints

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Changed all /trading/clmm POST routes from 'network' to 'chainNetwork'
- Updated format to chain-network (e.g., solana-mainnet-beta, ethereum-mainnet)
- Added parseChainNetwork() function to all POST route files
- Parse chainNetwork to extract network before calling connector functions
- Consistent with GET routes which already use chainNetwork

Routes updated:
- POST /trading/clmm/open
- POST /trading/clmm/add
- POST /trading/clmm/remove
- POST /trading/clmm/close
- POST /trading/clmm/collect-fees

All routes now use consistent parameter naming across GET and POST operations.

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

Co-Authored-By: Claude <noreply@anthropic.com>
…ct token amounts

Changed balance tracking from pool address to wallet address in extractBalanceChangesAndFee call. This fixes the issue where baseTokenAmountRemoved and quoteTokenAmountRemoved were returning 0 instead of the actual amounts removed from the position.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed transaction failure detection in WebSocket signatureNotification handler.
The err field is nested in result.value, not directly in result.

Changes:
- Fixed notification handler to check result.value.err instead of result.err
- Updated WebSocketMessage interface to include context field
- Added comprehensive test suite for WebSocket functionality
- Created verification documentation against Solana RPC spec

This bug was causing failed transactions to be incorrectly reported as successful.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Displays chain configurations at startup with real-time block numbers
and RPC URLs for both Solana and Ethereum chains.

Features:
- Shows default network for each chain
- Fetches and displays current block/slot numbers
- Displays configured RPC URLs (Helius/Infura or standard nodeURL)
- Properly merges API keys from helius/infura namespaces
- Graceful error handling with fallback messages

Output format:
📡 Solana (defaultNetwork: mainnet-beta): Block #376,930,587 - https://mainnet.helius-rpc.com/?api-key=...
📡 Ethereum (defaultNetwork: mainnet): Block #23,694,869 - https://mainnet.infura.io/v3/...

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

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed critical bug where WebSocket notifications were not triggering API responses.
The issue was that subscriptions were stored using local IDs but server responses
used different subscription IDs.

Root cause:
- Client sends subscription with local ID (e.g., 1)
- Server responds with its own subscription ID (e.g., 20100749)
- Notifications arrive with server ID, but subscription was stored under local ID
- This caused the promise to never resolve, making API requests hang

Solution:
- Remap subscription from local ID to server ID when confirmation is received
- Now notifications can find and resolve the correct subscription

This fixes the hanging API issue where transactions would confirm via WebSocket
but the API would never return a response.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed all 15 Helius WebSocket tests by updating the mock setup to automatically
trigger the 'open' event when callbacks are registered. This allows the initialize()
promise to resolve properly.

Changes:
- Updated beforeEach to auto-trigger 'open' callback via setImmediate
- Removed manual onOpenCallback triggering from all tests
- Kept subscription confirmation pattern for transaction monitoring
- Fixed ESLint error by using specific callback type signature
- All tests now pass in ~3.7s (previously timing out at 10s+)

Test coverage includes:
- WebSocket connection (mainnet/devnet)
- Transaction monitoring (success/failure/timeout)
- Subscription management and unsubscribe
- Error handling and reconnection
- Message parsing and malformed JSON

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

Co-Authored-By: Claude <noreply@anthropic.com>
fengtality and others added 2 commits October 30, 2025 21:43
Fixed 17 failing tests across 4 test suites by adding missing mock methods
that were introduced with the dynamic token lookup feature.

Changes:
- Added getOrFetchToken mock to Ethereum instances in all router tests
- Added getOrFetchTokenBySymbol mock to Uniswap instances in AMM tests
- Both methods support lookup by symbol or address
- Mocks return proper token objects matching the test expectations

Test fixes:
- test/connectors/uniswap/router-routes/universal-router-quoteSwap.test.ts (5 tests)
- test/connectors/pancakeswap/router-routes/universal-router-quoteSwap.test.ts (6 tests)
- test/connectors/0x/router-routes/quoteSwap.test.ts (5 tests)
- test/connectors/uniswap/amm-routes/quote-swap.test.ts (2 tests)

All tests now passing: 18 passed, 2 skipped, 4 suites

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

Co-Authored-By: Claude <noreply@anthropic.com>
Optimize balance calculations by using the pre-calculated uiAmount
value from the RPC node instead of manually calculating
Number(amount) / Math.pow(10, decimals).

This leverages Helius's (and other RPC providers') pre-calculated
token amounts, resulting in ~95% performance improvement for large
wallets (~500ms total vs previous approach).

Changes:
- Line 592: Unlisted token processing
- Line 758: Store uiAmount in parsedAccount data structure
- Line 899: getTokenBalance() helper method
- Lines 914, 919: getTokenBalanceWithMintInfo() success/error paths
- Lines 506, 533, 567: Main balance fetching code paths

All changes include fallback to manual calculation when uiAmount
is null/undefined for backwards compatibility.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@fengtality fengtality force-pushed the fix/dynamic-wrap-token-lookup branch from e7fbc35 to 8174150 Compare October 31, 2025 05:26
fengtality and others added 5 commits October 30, 2025 22:38
Remove Helius Sender endpoint integration and all related functionality:
- Remove useSender, regionCode, and jitoTipSOL configs from helius.yml templates
- Remove config fields from helius-schema.json
- Remove REGION_ENDPOINTS mapping and regional endpoint logic from HeliusService
- Remove sendWithSender() method and connection warming functionality
- Remove JITO_TIP_ACCOUNTS constant and addJitoTipToTransaction() method
- Simplify sendAndConfirmRawTransaction to use standard RPC only
- Update tests to remove references to removed configs

Gateway now uses only Helius's standard WebSocket monitoring feature
for transaction confirmation, removing the complexity of Sender endpoint
and Jito tip integration.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Implement URL redaction to prevent sensitive API keys from being logged
in clear text. This addresses a security vulnerability where API keys
for Helius and Infura were exposed in log output.

Changes:
- Add redactUrl() utility function in logger.ts
  - Redacts query parameter API keys (?api-key=XXX)
  - Redacts Infura path-based API keys (/v3/API_KEY)
- Update all RPC URL logging statements to use redactUrl():
  - Solana chain initialization logs
  - Ethereum chain initialization logs
  - Startup banner chain configuration logs
- Add tests to verify redaction works correctly

Example output:
- Before: https://mainnet.helius-rpc.com/?api-key=abc123
- After:  https://mainnet.helius-rpc.com/?api-key=***

Fixes CodeQL security warning: Clear-text logging of sensitive information

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

Co-Authored-By: Claude <noreply@anthropic.com>
Add mockRedactUrl to test mocks to fix test failures after adding
redactUrl function to logger service. Updates both shared-mocks and
solana-rate-limit-propagation test file.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Use simulateWithErrorHandling in executeQuote to provide user-friendly
error messages for transaction failures like insufficient funds. This
matches the error handling pattern used by Meteora and Raydium connectors.

Changes:
- Added simulateWithErrorHandling call in executeQuote before sending tx
- Removed redundant simulateTransaction calls from buildSwapTransaction methods
- Errors like "insufficient lamports" now return proper 400 badRequest
  with message: "Transaction failed: Insufficient funds. Please check your token balance."

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

Co-Authored-By: Claude <noreply@anthropic.com>
@rapcmia rapcmia self-requested a review October 31, 2025 16:22
@rapcmia rapcmia moved this to Backlog in Pull Request Board Oct 31, 2025
fengtality and others added 2 commits October 31, 2025 13:44
Replace docker run commands with docker compose workflow following Hummingbot convention. Includes prerequisites, configuration steps, and container management commands.

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

Co-Authored-By: Claude <noreply@anthropic.com>
…ging

1. Optimize closePosition to use single SDK call:
   - Use removeLiquidity with shouldClaimAndClose=true parameter
   - Combines remove liquidity, collect fees, and close position in one call
   - Reduces from 3 separate transactions to 1
   - Separately track fees vs liquidity amounts in response

2. Improve bin limit error messaging:
   - Clarify 70 bin limit is recommended, not absolute (SDK supports up to 1400)
   - Show actual number of bins requested in error
   - Explain reason: single-transaction efficiency
   - Provide actionable solutions: create multiple positions or narrow range
   - Add inline documentation about bin limits

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

Co-Authored-By: Claude <noreply@anthropic.com>
@rapcmia rapcmia moved this from Backlog to Under Review in Pull Request Board Nov 3, 2025
@rapcmia
Copy link
Contributor

rapcmia commented Nov 3, 2025

Commit b4af80d initial tests

  • Review file changes and setup this PR with hummingbot dev branch ok
    image
  • Observed rpcProvider {helius, infura} keys are masked by *** to hide apiKey ✅
    image

Test dynamic wrapped token lookup by wrap and unwrap tokens

  • Results are crosschecked with development branch
  • If token is unlisted or not available while wrap/unwrap. returns error for user ✅
    image
  • Tested AVAX ok
  • Tested polygon ok
    $ curl -sS -X POST http://localhost:15888/chains/ethereum/wrap -H 'Content-Type: application/json' -d '{"network":"polygon","amount":"28"}' | jq
    {
      "signature": "0xf499ac2de8b387438821df6d108ffb6cb684029c547f567102449c672ab4b65c",
      "status": 1,
      "data": {
        "nonce": 22,
        "fee": "0.002775585464865527",
        "amount": "28.000000000000000000",
        "wrappedAddress": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
        "nativeToken": "POL",
        "wrappedToken": "WPOL"
      }
    }
    
    $ curl -sS -X POST http://localhost:15888/chains/ethereum/unwrap -H 'Content-Type: application/json' -d '{"network":"polygon","amount":"28"}' | jq
    {
      "signature": "0x21df1d2aed5f3813f82636f51d4579d2d702b27c97cfc3dd8cbf00ac22c7dbb5",
      "status": 1,
      "data": {
        "nonce": 23,
        "fee": "0.00370670353189356",
        "amount": "28.000000000000000000",
        "wrappedAddress": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
        "nativeToken": "POL",
        "wrappedToken": "WPOL"
      }
    }
    

Pending

  • Test Dynamic Wrapped Token Lookup
  • Test meteora SDK upgrade v1.7.5
  • Test unlisted token support
  • Test Improve CLMM allowance error messages
  • Test BigInt Scientific notation fixes

@rapcmia
Copy link
Contributor

rapcmia commented Nov 4, 2025

Commit b4af80d

  • Test update for meteora SDK upgrade v1.7.5
  • Pool to use JUP-USDC, HHMcXebyUakhxnZavV9LBspv8SgsphoEbfhCjz8xPGe1
  • Tested using rpcProvider helius (free ver)

Tested gateway endpoints via fastify ✅ 

  • GET /connectors/meteora/clmm/fetch-pools ✅
  • GET /connectors/meteora/clmm/pool-info ✅
  • GET /connectors/meteora/clmm/pool-info-stream skipped
  • GET /connectors/meteora/clmm/positions-owned ✅
  • GET /connectors/meteora/clmm/quote-swap ✅
  • POST /connectors/meteora/clmm/execute-swap ❗
    • Adjusted minPriorityFeePerCU from 0.01 to {5, 7 and 15} to successfully complete the endpoint
  • POST /connectors/meteora/clmm/open-position ✅
  • POST /connectors/meteora/clmm/add-liquidity ✅
  • POST /connectors/meteora/clmm/remove-liquidity ✅
  • POST /connectors/meteora/clmm/collect-fees ✅
  • POST /connectors/meteora/clmm/close-position ✅

Tested hummingbot + gateway ✅

Incase needed, added log files of tests here: 11042025a.zip


Pending:

  • Test unlisted token support
  • Test Improve CLMM allowance error messages
  • Test BigInt Scientific notation fixes

@rapcmia
Copy link
Contributor

rapcmia commented Nov 4, 2025

Commit b4af80d

Test unlisted token support ✅

  • Connectors to be tested: Pancakeswap and Uniswap on {arbitrum, base}
  • Tokens: LINK-USDC and ARB-USDC(removed from token list)
  • Tested gateway endpoints on fastify
    • quoteSwaps for pancake (in progress) and uniswap on router, clmm and amm routes
      • Observed that it tries to look for the token that is not part of the list
      • For amm/clmm: if pool is not available, user have to add it first
        • User have to use wallet address instead of symbols so the endpoint to be successful
        • v2 0x011f31D20C8778c8Beb1093b73E3A5690Ee6271b
        • v3 0x81c48D31365e6B526f6BBadC5c9aaFd822134863
    • Unable to do swaps, I assume the token must be added to the token .json file ✅
    • Crosscheck tests with development branch ok

Test logs here: 11042025b.zip

Copy link
Contributor

@rapcmia rapcmia left a comment

Choose a reason for hiding this comment

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

  • Setup this PR with hummingbot dev branch on source
  • Compare fastify endpoints using MacOS (optional)
  • Most of the test used rpcProvider Helus (free ver)
  • Tested Dynamic Wrapped Token Lookup, ✅
    • Used polygon and avax for wrap and unwrap tokens
  • Tested meteora SDK upgrade v1.7.5, ✅
    • For most of the test used endpoint then crosscheck on hummingbot+gateway (optional)
    • For the test, modified minPriorityFeePerCU
    • Tested using gateway commands swap/lp ok
  • Tested unlisted token support, ok
    • Tested using pancakeswap and uniswap
    • Tested quoteSwaps on router
  • Tested Improve CLMM allowance error messages, ✅
    • Tested on uniswap and pancakeswap
      • Observed improvement on response when insufficient balance on execute-swaps
  • Tested BigInt Scientific notation fixes, ✅
    • Unable to reproduce issue reported by user
    • Compare this PR with development branch and run the ff endpoints:
      • GET connectors/{uniswap, pancakeswap}/clmm-routes/quoteSwap
        • POST connectors/pancakeswap/clmm-routes/{openPosition, addLiquidity}
  • Build docker image and run with hummingbot docker build, ✅

@fengtality fengtality force-pushed the fix/dynamic-wrap-token-lookup branch from ccc6fb5 to ffc991c Compare November 5, 2025 21:40
@fengtality fengtality merged commit 0fe08ae into development Nov 5, 2025
5 checks passed
@fengtality fengtality deleted the fix/dynamic-wrap-token-lookup branch November 5, 2025 21:42
@rapcmia rapcmia moved this from Under Review to Development v2.11.0 in Pull Request Board Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development v2.11.0

Development

Successfully merging this pull request may close these issues.

3 participants