synapsecns/sanguine

View on GitHub
packages/synapse-interface/utils/isBlacklisted.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Address, getAddress } from 'viem'

import { EXCLUDED_ADDRESSES } from '@/constants/blacklist'

export const isBlacklisted = (address: Address | string) => {
  if (!address) return
  try {
    const checksummedAddress = getAddress(address)

    const normalizedExcludedAddresses = EXCLUDED_ADDRESSES.map((addr) =>
      getAddress(addr)
    )

    return normalizedExcludedAddresses.includes(checksummedAddress)
  } catch (error) {
    console.error('Invalid address:', error)
    return false
  }
}