Skip to content

Fix token lookup keying: preserve enum keys in dynamic EVM token merge#1061

Merged
ebma merged 5 commits into
chore/change-token-selection-sortfrom
copilot/sub-pr-1058
Feb 6, 2026
Merged

Fix token lookup keying: preserve enum keys in dynamic EVM token merge#1061
ebma merged 5 commits into
chore/change-token-selection-sortfrom
copilot/sub-pr-1058

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 6, 2026

The mergeWithStaticConfig function was keying merged tokens by normalized symbol ("USDC.AXL") instead of preserving static config enum keys (EvmToken.AXLUSDC), breaking enum-based lookups throughout the codebase.

Changes

  • dynamicEvmTokens.ts: Iterate over Object.entries() instead of Object.values() to preserve enum keys from static config
  • Dual-keying strategy: Store tokens under both enum key (e.g., "AXLUSDC") and normalized symbol (e.g., "USDC.AXL") as aliases to the same object
  • helpers.ts: Remove AXLUSDC special case in getOnChainTokenDetailsOrDefault - no longer needed with proper keying

Example

// Before: enum lookup fails, returns undefined
const token = getOnChainTokenDetails(Networks.Polygon, EvmToken.AXLUSDC);
// undefined (token was keyed as "USDC.AXL")

// After: both enum and symbol lookups work
const token1 = getOnChainTokenDetails(Networks.Polygon, EvmToken.AXLUSDC);    // ✓
const token2 = getOnChainTokenDetails(Networks.Polygon, "USDC.AXL");         // ✓
console.log(token1 === token2);  // true (same object reference)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 6, 2026

Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit 1b0959f
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/69862f2c7f2a01000753165e
😎 Deploy Preview https://deploy-preview-1061--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI and others added 3 commits February 6, 2026 18:06
- Fix mergeWithStaticConfig to preserve static config enum keys (e.g., EvmToken.AXLUSDC)
- Add alias entries under normalized symbols for flexible lookups
- Remove special case for AXLUSDC in getOnChainTokenDetailsOrDefault
- This fixes broken enum-based lookups like getOnChainTokenDetails(..., EvmToken.AXLUSDC)

Co-authored-by: ebma <6690623+ebma@users.noreply.github.com>
Co-authored-by: ebma <6690623+ebma@users.noreply.github.com>
Co-authored-by: ebma <6690623+ebma@users.noreply.github.com>
Copilot AI changed the title [WIP] Update token selection list sorting logic Fix token lookup keying: preserve enum keys in dynamic EVM token merge Feb 6, 2026
Copilot AI requested a review from ebma February 6, 2026 18:10
@ebma ebma marked this pull request as ready for review February 6, 2026 18:13
@ebma ebma merged commit 816333b into chore/change-token-selection-sort Feb 6, 2026
3 of 4 checks passed
@ebma ebma deleted the copilot/sub-pr-1058 branch February 6, 2026 18:13
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.

2 participants