@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
33 lines • 1.37 kB
TypeScript
export type FormatAddressOptions = {
prefixLength?: number;
suffixLength?: number;
separator?: string;
threshold?: number;
};
/**
* Format an address for display by showing a shortened version with ellipsis.
*
* @param address - The address string to format
* @param options - Optional configuration
* @param options.prefixLength - Number of characters at the start (default: 4)
* @param options.suffixLength - Number of characters at the end (default: 4)
* @param options.separator - Ellipsis string (default: "...")
* @param options.threshold - Minimum length before truncating (default: prefixLength + separator.length + suffixLength)
* @returns Formatted address string (e.g. "0x1234...5678")
*/
export declare function formatAddress(address: string, options?: FormatAddressOptions): string;
/**
* Split an address into start, middle, and end sections
*
* @param address - The address string to split
* @param size - The number of characters to include in the start and end sections
* @returns An object containing the start, middle, and end portions of the address
* @example
* addressSplit("HelloWorld", 2) // => { start: "He", middle: "lloWor", end: "ld" }
*/
export declare function addressSplit(address: string, size: number): {
start: string;
middle: string;
end: string;
};
//# sourceMappingURL=addressUtils.d.ts.map