Skip to content

Commit

Permalink
Tweak zap logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Staab committed Jan 27, 2025
1 parent a7082b6 commit a131870
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/app/views/Zap.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import {init, launchPaymentModal, onModalClosed} from "@getalby/bitcoin-connect"
import {ctx, now, sortBy, tryCatch, fetchJson} from "@welshman/lib"
import {ctx, partition, now, sortBy, tryCatch, fetchJson} from "@welshman/lib"
import {createEvent} from "@welshman/util"
import {Nip01Signer} from "@welshman/signer"
import {signer, profilesByPubkey, displayProfileByPubkey, zappersByLnurl} from "@welshman/app"
Expand Down Expand Up @@ -104,16 +104,16 @@
// Close the router once we can show the next modal
router.pop()
for (const {invoice, error, relays, zapper, pubkey} of preppedZaps) {
if (!invoice) {
const profileDisplay = displayProfileByPubkey(pubkey)
const message = error || "no error given"
const [ok, missingInvoice] = partition(z => z.invoice, preppedZaps)
alert(`Failed to get an invoice for ${profileDisplay}: ${message}`)
for (const {pubkey, error} of missingInvoice) {
const profileDisplay = displayProfileByPubkey(pubkey)
const message = error || "no error given"
continue
}
alert(`Failed to get an invoice for ${profileDisplay}: ${message}`)
}
for (const {invoice, error, relays, zapper, pubkey} of ok) {
launchPaymentModal({invoice})
await new Promise<void>(resolve => {
Expand Down

0 comments on commit a131870

Please sign in to comment.