From 34cf93065734d7496c37e1722d404e2de06ea310 Mon Sep 17 00:00:00 2001 From: SkateSpots Date: Mon, 5 Oct 2026 19:06:22 +0700 Subject: [PATCH] fix(supporters): resolve avatars by hex pubkey (was passing npub to useAuthor) --- src/pages/SupportersPage.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/pages/SupportersPage.tsx b/src/pages/SupportersPage.tsx index d951752..3af8a77 100644 --- a/src/pages/SupportersPage.tsx +++ b/src/pages/SupportersPage.tsx @@ -22,6 +22,17 @@ const ANGOR_PROJECT_URL = 'https://angor.io/project/angor1qtunna00uqyx52rr0nvqa0 const SUPPORTERS_SINCE = Math.floor(Date.UTC(2025, 11, 1) / 1000); // 2025-12-01 const VISIBLE_LIMIT = 21; +/** npub → hex pubkey (useAuthor queries relays by HEX authors). */ +function npubToHex(npub?: string): string | undefined { + if (!npub) return undefined; + try { + const d = nip19.decode(npub); + return d.type === 'npub' ? d.data : undefined; + } catch { + return undefined; + } +} + // ─── Static data — edit these arrays to add/remove entries ────────────────── interface Collaborator { @@ -233,6 +244,7 @@ function FriendCard({ friend }: { friend: Friend }) { interface SupporterEntry { key: string; + pubkey?: string; npub?: string; name?: string; logo?: string; @@ -261,7 +273,7 @@ const TIER_RANGE: Record<(typeof TIER_ORDER)[number], string> = { }; function MemberAvatar({ entry }: { entry: SupporterEntry }) { - const { data } = useAuthor(entry.anonymous ? undefined : entry.npub); + const { data } = useAuthor(entry.anonymous ? undefined : entry.pubkey); const meta = data?.metadata; const name = entry.anonymous ? '★' @@ -321,7 +333,7 @@ function TierLadder({ supporters }: { supporters: SupporterEntry[] }) { function SupporterRow({ rank, entry }: { rank: number; entry: SupporterEntry }) { const { t } = useTranslation(); - const { data } = useAuthor(entry.anonymous ? undefined : entry.npub); + const { data } = useAuthor(entry.anonymous ? undefined : entry.pubkey); const meta = data?.metadata; const name = entry.anonymous ? t('walletUi.supporters.anonymousBacker') @@ -435,6 +447,7 @@ export default function SupportersPage() { const key = (npub || b.url || b.name || `anon-${i}`).toLowerCase(); map.set(key, { key, + pubkey: npub ? npubToHex(npub) : undefined, npub, name: b.anonymous ? undefined : b.name, logo: b.anonymous ? undefined : b.logo, @@ -458,6 +471,7 @@ export default function SupportersPage() { } else { map.set(npub, { key: npub, + pubkey: z.pubkey, npub, sats: z.sats, angorSats: 0,