UNPKG

@ledgerhq/live-common

Version:
29 lines 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRecipientDisplayValue = getRecipientDisplayValue; exports.getRecipientSearchPrefillValue = getRecipientSearchPrefillValue; const addressUtils_1 = require("../../utils/addressUtils"); /** * Get the display value for a recipient (formatted address with optional ENS name). */ function getRecipientDisplayValue(recipient, options) { if (!recipient?.address) return ""; const formattedAddress = (0, addressUtils_1.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. */ function getRecipientSearchPrefillValue(recipient) { if (!recipient) return ""; return recipient.ensName?.trim() ? recipient.ensName : recipient.address; } //# sourceMappingURL=utils.js.map