@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
26 lines • 809 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractURLFromManifest = extractURLFromManifest;
const extractDappURLFromManifest_1 = require("./extractDappURLFromManifest");
/** Returns dapp dappURL or live app URL from manifest. */
function extractURLFromManifest(manifest) {
if (!manifest) {
return undefined;
}
const dappUrl = (0, extractDappURLFromManifest_1.extractDappURLFromManifest)(manifest);
if (dappUrl) {
return dappUrl;
}
try {
if (manifest.url && manifest.url instanceof URL) {
return manifest.url;
}
const url = new URL(manifest.url);
return url;
}
catch {
// Invalid URL
return undefined;
}
}
//# sourceMappingURL=extractURLFromManifest.js.map