fix: remove O(n) API calls to ENS on the swaps flow#26126
fix: remove O(n) API calls to ENS on the swaps flow#26126
Conversation
bfullam
left a comment
There was a problem hiding this comment.
We should also remove both instances of ensByAccountAddress, since they're not used anywhere.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The change is traced through: Since this affects bridge functionality, SmokeTrade is the appropriate tag as it covers "cross-chain bridging between networks". Per the tag guidance, SmokeConfirmations should also be selected when SmokeTrade is selected for bridge flows, as transaction confirmations are part of the bridge flow. The risk is low because:
Performance Test Selection: |
|



Description
When the bridge/swaps flow opens, useRecipientInitialization calls useDestinationAccounts, which calls useAccounts() with the default fetchENS: true. This triggers doENSReverseLookup() for every account in the wallet, each making an eth_call to the ENS Registry contract. The number of RPC calls scales linearly with the number of accounts, causing unnecessary network traffic and latency.
None of the ENS data is consumed anywhere in the bridge flow:
The fix passes { fetchENS: false } to useAccounts() in useDestinationAccounts, eliminating the wasted ENS lookups with zero impact on functionality. The unused ensByAccountAddress return value is also removed from the hook.
Slack thread
Changelog
CHANGELOG entry: fixed excessive ENS API calls when opening the bridge/swaps flow that scaled with the number of accounts
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2682
Manual testing steps
Screenshots/Recordings
Before
Screen.Recording.2026-02-16.at.15.26.35.mov
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Small, localized change that only affects account display data fetching and a hook return shape; low chance of impacting bridge logic beyond any remaining callers expecting ENS data.
Overview
Prevents per-account ENS network calls in Bridge destination account selection by calling
useAccounts({ fetchENS: false }).Simplifies
useDestinationAccountsto only returndestinationAccounts(dropsensByAccountAddressfrom the hook API).Written by Cursor Bugbot for commit 55a204e. This will update automatically on new commits. Configure here.