synapsecns/sanguine

View on GitHub
packages/synapse-constants/src/utils/validateAddresses.ts

Summary

Maintainability
A
3 hrs
Test Coverage
import { getAddress } from '@ethersproject/address'

export const validateAddresses = (addresses: {
  [x: number]: string
}): { [x: number]: string } => {
  const reformatted: { [x: number]: string } = {}
  for (const chainId in addresses) {
    reformatted[chainId] = addresses[chainId]
      ? getAddress(addresses[chainId])
      : ''
  }
  return reformatted
}