import { For, createResource } from "solid-js"; import { AutoFaq } from "~/components/AutoZapFaq"; import { getNpubFromHexpub } from "./[id]"; import { CreateAutozapPage } from "~/components/CreateButton"; const PRIMAL_API = "https://primal-cache.mutinywallet.com/api"; async function fetchMostZapped() { try { const restPayload = JSON.stringify(["explore_global_mostzapped_4h"]); const response = await fetch(PRIMAL_API, { method: "POST", headers: { "Content-Type": "application/json", }, body: restPayload, }); if (!response.ok) { throw new Error(`Failed to load profile`); } // an array of profiles const data = await response.json(); const justTheProfiles = data .filter((d: any) => d.kind === 0) .map((d: any) => { console.log(d); const content = JSON.parse(d.content); const pubkey = d.pubkey; const npub = getNpubFromHexpub(pubkey); content.npub = npub; return content; }); console.log(justTheProfiles); return justTheProfiles; } catch (e) { console.error(e); } } function MiniProfiles() { const [mostZapped] = createResource(fetchMostZapped); return ( <> {/*
{JSON.stringify(mostZapped(), null, 2)} */}
{JSON.stringify(profile, null, 2)} */}