* refactor(solana): remove support for solana * chore: update @thirdweb-dev/react and @thirdweb-dev/sdk versions * remove unused code & re-update-next-versions * refactor: Remove unused Solana currency metadata * fix build
20 lines
495 B
TypeScript
20 lines
495 B
TypeScript
import { isPossibleEVMAddress } from "lib/address-utils";
|
|
|
|
export function shortenString(str: string, extraShort = true) {
|
|
return `${str.substring(0, extraShort ? 4 : 6)}...${str.substring(
|
|
str.length - (extraShort ? 3 : 4),
|
|
)}`;
|
|
}
|
|
export function shortenIfAddress(
|
|
address?: string | null | false,
|
|
extraShort?: true,
|
|
): string {
|
|
if (!address) {
|
|
return "";
|
|
}
|
|
if (isPossibleEVMAddress(address, true)) {
|
|
return shortenString(address, extraShort);
|
|
}
|
|
return address;
|
|
}
|