asi-calculator/lib/tokens.ts

15 lines
388 B
TypeScript
Raw Permalink Normal View History

2024-03-31 16:48:31 +02:00
import { tokens } from '@/constants'
import type { Token, TokenAddress } from '@/types'
2024-03-31 16:48:31 +02:00
export function getTokenBySymbol(symbol: string): Token | undefined {
const token = tokens.find((t) => t.symbol === symbol)
return token
}
export function getTokenAddressBySymbol(
symbol: string
): TokenAddress | undefined {
const token = getTokenBySymbol(symbol)
return token?.address
}