export const shortenAddress = (address: string, maxLength = 20) => { // to avoid trimming small names by default if (address.length < maxLength) return address; return ( address.substring(0, maxLength / 2) + '...' + address.substring(address.length - maxLength / 2, address.length) ); }; export function calculateColorFromAddress(address: string) { // Simple hash function to convert a string into a numerical hash let hash = 0; for (let i = 0; i < address.length; i++) { hash = address.charCodeAt(i) + ((hash << 5) - hash); } // Convert hash into a HSL color const hue = hash % 360; // Hue value (0-360) const saturation = 50 + (hash % 50); // Saturation value (50-100%) const lightness = 50; // Lightness value (fixed at 50%) // Return the HSL color string return `hsl(${hue}, ${saturation}%, ${lightness}%)`; } export async function getWalletPermissions(arweaveWallet: any) { try { return await arweaveWallet.getPermissions(); } catch { return []; } }