Skip to content
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

prioritize users entries over onchain entries #1198

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/ts/background/storageVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ export const getUserAddressBookEntriesForChainIdMorePreciseFirst = async (chainI
const entries = (await getUserAddressBookEntries()).filter((entry) => entry.chainId === chainId || (entry.chainId === undefined && chainId === 1n) || entry.chainId === 'AllChains')
// sort more precise entries first (one with accurate chain id)
entries.sort((x, y) => {
if (x.entrySource === 'OnChain' && y.entrySource !== 'OnChain') return 1
if (x.entrySource !== 'OnChain' && y.entrySource === 'OnChain') return -1
if (typeof x.chainId === 'bigint' && typeof y.chainId !== 'bigint') return -1
if (typeof x.chainId !== 'bigint' && typeof y.chainId === 'bigint') return 1
return 0
Expand Down
Loading