mars-interface/src/hooks/data/useAsset.tsx
Linkie Link 7c9ae6e337
v1.7.2
2023-11-14 07:42:29 +01:00

19 lines
499 B
TypeScript

import useStore from 'store'
interface Props {
denom?: string
symbol?: string
}
export const useAsset = (props: Props) => {
const whitelistedAssets = useStore((s) => s.networkConfig.assets.whitelist)
const otherAssets = useStore((s) => s.networkConfig.assets.other)
const assets = [...whitelistedAssets, ...otherAssets]
if (props.denom) {
return assets.find((asset) => asset.denom === props.denom)
} else {
return assets.find((asset) => asset.symbol === props.symbol)
}
}