@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
25 lines • 866 B
JavaScript
import { formatAddress } from "../../utils/addressUtils";
/**
* Get the display value for a recipient (formatted address with optional ENS name).
*/
export function getRecipientDisplayValue(recipient, options) {
if (!recipient?.address)
return "";
const formattedAddress = formatAddress(recipient.address, {
prefixLength: options?.prefixLength ?? 5,
suffixLength: options?.suffixLength ?? 5,
});
if (recipient.ensName?.trim()) {
return `${recipient.ensName} (${formattedAddress})`;
}
return formattedAddress;
}
/**
* Get the prefill value for recipient search when editing from Amount step.
*/
export function getRecipientSearchPrefillValue(recipient) {
if (!recipient)
return "";
return recipient.ensName?.trim() ? recipient.ensName : recipient.address;
}
//# sourceMappingURL=utils.js.map