Fix blank underlying symbol ("/ USD") on default ETH2X buys - #1978
Open
ripples3 wants to merge 1 commit into
Open
Fix blank underlying symbol ("/ USD") on default ETH2X buys#1978ripples3 wants to merge 1 commit into
ripples3 wants to merge 1 commit into
Conversation
A bare /trade URL (e.g. the marketing navbar link) left the hard-coded mainnet ETH2X default token object in use while the wallet was on Arbitrum or Base. mapQuoteToTrade looked that object up by (chainId, address), missed, and saved underlyingAssetSymbol as '' — rendered as "/ USD" in Open Positions and the success dialog. The trade itself was unaffected (quotes resolve the address by symbol). - trade/provider.tsx: re-match URL/default token objects by symbol against the connected chain's token lists - new getUnderlyingAssetSymbol util (+ tests): address lookup with a same-chain symbol fallback; unchanged output for all 41 leverage tokens; '' + console.warn when the underlying is not in the known list - database.ts: use the util Existing blank rows (42 ETH2X buys) are handled separately in the DB. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0167pbkpr5kmXaxQw2EPmL8S
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Problem
Open Positions and the success dialog show "/ USD" for ETH2X buys made from a bare
/tradeURL (e.g. the marketing navbar link) while on Arbitrum/Base. 42Traderows affected (31 Base, 11 Arbitrum), all ETH2X buys.Root cause
defaultParams.outputTokenintrade/provider.tsxis the mainnet ETH2X object.useQueryParamsuses it verbatim when the URL has nobuyparam and only re-resolves on URL changes.mapQuoteToTradethen looks the token up by(chainId, address), misses, and savesunderlyingAssetSymbol: ''. The trade itself was fine (quotes resolve by symbol). The backend'smendOutputTokenAddresshas masked the address half of this since 2025-04.Change
trade/provider.tsx: re-match URL/default token objects by symbol against the connected chain's token lists (trade page only;useQueryParamsuntouched).getUnderlyingAssetSymbolutil + 44 tests: address lookup with a same-chain symbol fallback; output identical to before for all 41 leverage tokens;''+console.warnwhen the underlying is not in the known list.database.tsuses the util.Verified
tsc / eslint / prettier / knip clean; jest 97/97. On the Vercel preview: bare
/tradeon Arbitrum, ETH → ETH2X buy savedunderlyingAssetSymbol = ETH,outputTokenAddress = 0x26d7…— the same flow saved''90 minutes earlier on production.Follow-ups (not in this PR)
underlyingAssetSymbolserver-side (unused helper inutils/coingecko.ts), then retiremendOutputTokenAddress.useQueryParamsmemo deps + the same pattern inearn/provider.tsx; chain-exclusive token fallback while the wallet is disconnected.🤖 Generated with Claude Code
https://claude.ai/code/session_0167pbkpr5kmXaxQw2EPmL8S