2025-04-19 15:38:48 +08:00

31 lines
1.3 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatMobileRegistry = exports.formatMobileRegistryEntry = exports.getDappRegistryUrl = exports.getWalletRegistryUrl = void 0;
const API_URL = "https://registry.walletconnect.com";
function getWalletRegistryUrl() {
return API_URL + "/api/v2/wallets";
}
exports.getWalletRegistryUrl = getWalletRegistryUrl;
function getDappRegistryUrl() {
return API_URL + "/api/v2/dapps";
}
exports.getDappRegistryUrl = getDappRegistryUrl;
function formatMobileRegistryEntry(entry, platform = "mobile") {
var _a;
return {
name: entry.name || "",
shortName: entry.metadata.shortName || "",
color: entry.metadata.colors.primary || "",
logo: (_a = entry.image_url.sm) !== null && _a !== void 0 ? _a : "",
universalLink: entry[platform].universal || "",
deepLink: entry[platform].native || "",
};
}
exports.formatMobileRegistryEntry = formatMobileRegistryEntry;
function formatMobileRegistry(registry, platform = "mobile") {
return Object.values(registry)
.filter(entry => !!entry[platform].universal || !!entry[platform].native)
.map((entry) => formatMobileRegistryEntry(entry, platform));
}
exports.formatMobileRegistry = formatMobileRegistry;
//# sourceMappingURL=registry.js.map