-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(swap): default 1 native to usdc on the swap page #3347
Conversation
This pull request is being automatically deployed with Vercel (learn more). interface – ./🔍 Inspect: https://vercel.com/uniswap/interface/3bhVHb6reATmGLVcyFHm7q8yDHHC widgets – ./🔍 Inspect: https://vercel.com/uniswap/widgets/B27DjD6H4vQHQP6cEb38Jb8mtd3c |
alternately, we shouldn't show this warning if the token came from a shorthand |
const address = isAddress(tokenAddress) | ||
const token: Token | undefined = address ? tokens[address] : undefined | ||
|
||
const tokenFromNetwork = useTokenFromNetwork(token ? undefined : address ? address : undefined) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be simplified as useTokenFromNetwork(token ?? address ? address : undefined)
? Nested ternary is hard to read.
If you change address to be isAddress(tokenAddress) || undefined
, you can just have it be token ?? address
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think that's the same. we want to not load from the network if the token is on the token data map. token ?? address ? address : undefined
would evaluate to address
if token
was defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
token || (address ? ...)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also not equivalent, we want it to be undefined if token is defined
No description provided.