Skip to content

Commit

Permalink
chore: exhaustiveness for assetNamespace switch
Browse files Browse the repository at this point in the history
  • Loading branch information
woodenfurniture committed Jan 7, 2025
1 parent f83b54f commit b1e6cf3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/coingecko/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { getConfig } from 'config'
import { queryClient } from 'context/QueryClientProvider/queryClient'
import type { CoinGeckoSortKey } from 'lib/market-service/coingecko/coingecko'
import type { CoinGeckoMarketCap } from 'lib/market-service/coingecko/coingecko-types'
import { assertUnreachable } from 'lib/utils'

import { COINGECKO_NATIVE_ASSET_ID_TO_ASSET_ID } from './constants'
import type {
Expand Down Expand Up @@ -65,7 +66,8 @@ const getCoinDetails = async (
if (!chainId) return

const assetNamespace = (() => {
switch (chainId) {
const knownChainId = chainId as KnownChainIds
switch (knownChainId) {
case KnownChainIds.BnbSmartChainMainnet:
return ASSET_NAMESPACE.bep20
case KnownChainIds.SolanaMainnet:
Expand All @@ -86,8 +88,9 @@ const getCoinDetails = async (
case KnownChainIds.BitcoinCashMainnet:
case KnownChainIds.DogecoinMainnet:
case KnownChainIds.LitecoinMainnet:
default:
throw Error(`Unhandled case '${chainId}'`)
default:
return assertUnreachable(knownChainId)
}
})()

Expand Down

0 comments on commit b1e6cf3

Please sign in to comment.