Skip to content

Commit

Permalink
feat: markets page support more assets (#8573)
Browse files Browse the repository at this point in the history
* feat: markets page support more assets

* fix: derp
  • Loading branch information
gomesalexandre authored Jan 15, 2025
1 parent 53c6e6b commit 691f3b4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/caip/src/adapters/coingecko/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
gnosisChainId,
optimismChainId,
polygonChainId,
solanaChainId,
thorchainChainId,
} from '../../constants'
import * as adapters from './generated'
Expand Down Expand Up @@ -141,6 +142,8 @@ export const coingeckoAssetPlatformToChainId = (
return cosmosChainId
case CoingeckoAssetPlatform.Thorchain:
return thorchainChainId
case CoingeckoAssetPlatform.Solana:
return solanaChainId
default:
return undefined
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib/coingecko/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
gnosisAssetId,
ltcAssetId,
polygonAssetId,
solAssetId,
thorchainAssetId,
} from '@shapeshiftoss/caip'

Expand All @@ -28,4 +29,5 @@ export const COINGECKO_NATIVE_ASSET_ID_TO_ASSET_ID: Partial<Record<string, Asset
[adapters.CoingeckoAssetPlatform.Base]: baseAssetId,
// This isn't a mistake - the network and id are different in the case of BSC
binanceCoin: bscAssetId,
solana: solAssetId,
}
11 changes: 10 additions & 1 deletion src/lib/coingecko/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import {
ASSET_NAMESPACE,
avalancheChainId,
baseChainId,
bchChainId,
bscChainId,
btcChainId,
cosmosChainId,
ethChainId,
gnosisChainId,
ltcChainId,
optimismChainId,
polygonChainId,
solanaChainId,
thorchainChainId,
toAssetId,
} from '@shapeshiftoss/caip'
Expand Down Expand Up @@ -53,7 +57,8 @@ const getCoinDetails = async (

const address = data.platforms?.[asset_platform_id]

if (!address) return
// No token address, and not present in our native assets mapping - this is most likely a native asset we don't support
if (!address && !COINGECKO_NATIVE_ASSET_ID_TO_ASSET_ID[id]) return

const assetId = (() => {
// Handles native assets, which *may* not contain a platform_id
Expand Down Expand Up @@ -189,6 +194,10 @@ export const getCoingeckoSupportedChainIds = () => {
baseChainId,
cosmosChainId,
thorchainChainId,
btcChainId,
bchChainId,
ltcChainId,
solanaChainId,
...(getConfig().REACT_APP_FEATURE_ARBITRUM_NOVA ? [arbitrumNovaChainId] : []),
]
}

0 comments on commit 691f3b4

Please sign in to comment.