-
Notifications
You must be signed in to change notification settings - Fork 159
refactor(tokenselector): 11 - standardize token key generation across hooks and components #6542
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
base: feat/token-selector-10
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Resolved conflict in apps/explorer/src/hooks/useTokenList.ts: - Combined imports: COW_CDN from @cowprotocol/common-const and getTokenAddressKey from @cowprotocol/common-utils - Kept COW_CDN URLs from feat/token-selector-10 - Kept getTokenAddressKey normalization from feat/token-selector-11
65ec2b9 to
abfc412
Compare
| chainId: number | ||
| } | ||
|
|
||
| export function getTokenId(token: TokenIdentifier): string { |
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.
nitpick: would be nice to define a type for that like export type TokenId = ${number}:${string}
for better understanding
Summary
Addresses review feedback in this comment.
Introduce shared helpers in
@cowprotocol/common-utils(getTokenAddressKey,getTokenId) and wire them into the token selector, account-proxy hooks, and explorer token list so token IDs/keys are normalized in a single place, preparing for future multi-chain integrations (e.g. Solana) without changing current behavior.No UI changes; no screenshots.
To Test
Background
This PR spins off the token-selector waterfall (
feat/token-selector-10) to centralize how we compute both normalized token addresses and token IDs. Instead of inliningchainId:address.toLowerCase()oraddress.toLowerCase()at each call site, everything now goes throughgetTokenAddressKeyandgetTokenId, so adapting behavior for chains with case-sensitive addresses (like Solana) can be done in one place.