synapsecns/sanguine

View on GitHub
packages/rest-api/src/utils/tokenAddressToToken.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { BRIDGE_MAP } from '../constants/bridgeMap'

export const tokenAddressToToken = (chain: string, tokenAddress: string) => {
  const chainData = BRIDGE_MAP[chain]
  if (!chainData) {
    return null
  }

  const tokenInfo = chainData[tokenAddress]

  if (!tokenInfo) {
    return null
  }

  return {
    address: tokenAddress,
    symbol: tokenInfo.symbol,
    decimals: tokenInfo.decimals,
    swappable: tokenInfo.swappable,
  }
}