Skip to content

Commit

Permalink
pull chain names from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jubalm committed Nov 14, 2024
1 parent d5cedcc commit 1031eb7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/ts/components/ui-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ export const getAddressBookEntryOrAFiller = (addressMetaData: readonly AddressBo
}

export const rpcEntriesToChainEntriesWithAllChainsEntry = (rpcEntries: RpcEntries): readonly ChainEntry[] => {
const chainsMap = new Map<bigint | string, ChainEntry>()
for (const { chainId, name } of rpcEntries) {
if (chainsMap.has(chainId)) continue
chainsMap.set(chainId, { name, chainId })
}
const entries = rpcEntries.map(({ chainId }): [string, ChainEntry] => {
const chainIdString = String(Number(chainId))
return [chainIdString, { chainId, name: CHAIN_NAMES.get(chainIdString) || chainIdString }]
})
const chainsMap = new Map<string, ChainEntry>(entries)
chainsMap.set('AllChains', { name: 'All Chains', chainId: 'AllChains' })
return [...chainsMap.values()]
}

0 comments on commit 1031eb7

Please sign in to comment.