mirror of
https://github.com/cerc-io/mars-interface.git
synced 2025-09-16 06:34:06 +00:00
19 lines
499 B
TypeScript
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)
|
|
}
|
|
}
|