import { checkAddress } from '@polkadot/util-crypto/address';

export const validateAddress = ({
  address,
  message,
  ss58Format,
}: {
  address: string;
  message: string;
  ss58Format?: number;
}) => {
  try {
    const [isValid] = checkAddress(address, ss58Format || 42);
    return isValid || message;
  } catch (error) {
    return message;
  }
};
