import { formatEther, parseEther, isAddress } from 'ethers';

export function formatGNX(weiAmount: bigint): string {
  return formatEther(weiAmount);
}

export function parseGNX(gnxAmount: string): bigint {
  return parseEther(gnxAmount);
}

export function isValidAddress(address: string): boolean {
  return isAddress(address);
}

export function encodeCouponType(type: 'utility' | 'security'): number {
  return type === 'utility' ? 0 : 1;
}

export function decodeCouponType(type: number): 'utility' | 'security' {
  return type === 0 ? 'utility' : 'security';
}
