From 28c9abf0017cb00c6dd378c596e0a1da2ffff0bb Mon Sep 17 00:00:00 2001 From: KillariDev Date: Fri, 22 Nov 2024 11:33:33 +0200 Subject: [PATCH 1/2] prioritize users entries over onchain entries --- app/ts/background/storageVariables.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/ts/background/storageVariables.ts b/app/ts/background/storageVariables.ts index 130118da..bf256d1e 100644 --- a/app/ts/background/storageVariables.ts +++ b/app/ts/background/storageVariables.ts @@ -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 From 88f235b02b6079957e68dbade48e655da0d779db Mon Sep 17 00:00:00 2001 From: KillariDev Date: Fri, 22 Nov 2024 11:54:00 +0200 Subject: [PATCH 2/2] fix negative sign --- app/ts/background/storageVariables.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ts/background/storageVariables.ts b/app/ts/background/storageVariables.ts index bf256d1e..620e9faa 100644 --- a/app/ts/background/storageVariables.ts +++ b/app/ts/background/storageVariables.ts @@ -250,7 +250,7 @@ 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 (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