@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
22 lines • 753 B
JavaScript
import network from "@ledgerhq/live-network/network";
import { getEnv } from "@ledgerhq/live-env";
// expose a function to fetch data from the cdn (data from ledger-live-assets)
// https://cdn.live.ledger.com/
const baseAnnouncementsUrl = () => getEnv("ANNOUNCEMENTS_API_URL");
const announcementsVersion = () => getEnv("ANNOUNCEMENTS_API_VERSION");
async function fetchAnnouncements() {
const url = `${baseAnnouncementsUrl()}/v${announcementsVersion()}/data.json?t=${Date.now()}`;
const { data } = await network({
method: "GET",
headers: {
Origin: "http://localhost:3000",
},
url,
});
return data;
}
const api = {
fetchAnnouncements,
};
export default api;
//# sourceMappingURL=api.js.map