From 1a480e589078edd8194a1f9f1145d55f460c0ef6 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Fri, 6 Sep 2024 12:58:49 -0700 Subject: [PATCH] Fix zapper fetching --- packages/app/src/zappers.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/app/src/zappers.ts b/packages/app/src/zappers.ts index c80ec04..fc33bf2 100644 --- a/packages/app/src/zappers.ts +++ b/packages/app/src/zappers.ts @@ -2,7 +2,7 @@ import {writable, derived} from 'svelte/store' import {withGetter} from '@welshman/store' import {type Zapper} from '@welshman/util' import {type SubscribeRequest} from "@welshman/net" -import {ctx, fetchJson, uniq, bech32ToHex, hexToBech32, tryCatch, batcher, postJson} from '@welshman/lib' +import {ctx, identity, fetchJson, uniq, bech32ToHex, hexToBech32, tryCatch, batcher, postJson} from '@welshman/lib' import {collection} from './collection' import {deriveProfile} from './profiles' @@ -14,7 +14,8 @@ export const fetchZappers = async (lnurls: string[]) => { // Use dufflepud if we it's set up to protect user privacy, otherwise fetch directly if (base) { - const res: any = await postJson(`${base}/zapper/info`, {lnurls}) + const hexUrls = lnurls.map(lnurl => tryCatch(() => bech32ToHex(lnurl))).filter(identity) + const res: any = await postJson(`${base}/zapper/info`, {lnurls: hexUrls}) for (const {lnurl, info} of res?.data || []) { tryCatch(() => zappersByLnurl.set(hexToBech32("lnurl", lnurl), info))