Clear lud06 when setting the wallet's address as the receiving address, and convert sats with toMsats

This commit is contained in:
Jon Staab 2026-09-25 15:46:22 -07:00
parent aabd41e017
commit 790700dd9f
5 changed files with 9 additions and 7 deletions

View file

@ -22,7 +22,7 @@
loading = true loading = true
try { try {
const command = await $profiles.update(writer => writer.update({lud16})) const command = await $profiles.update(writer => writer.update({lud06: undefined, lud16}))
const error = await command.publish().waitForError() const error = await command.publish().waitForError()
if (error) { if (error) {
@ -47,7 +47,7 @@
<ModalHeader> <ModalHeader>
<ModalTitle>Set as Receiving Address?</ModalTitle> <ModalTitle>Set as Receiving Address?</ModalTitle>
</ModalHeader> </ModalHeader>
{#if $userProfile?.values.lud16} {#if $userProfile?.lnurl()}
<p> <p>
Your current receiving address is different from the one provided by your connected wallet. Your current receiving address is different from the one provided by your connected wallet.
</p> </p>

View file

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import {gt} from "@welshman/lib" import {gt} from "@welshman/lib"
import {toMsats} from "@welshman/util"
import {Invoice} from "@getalby/lightning-tools/bolt11" import {Invoice} from "@getalby/lightning-tools/bolt11"
import {debounce} from "throttle-debounce" import {debounce} from "throttle-debounce"
import Bolt from "@assets/icons/bolt.svg?dataurl" import Bolt from "@assets/icons/bolt.svg?dataurl"
@ -34,7 +35,7 @@
if (gt(invoice!.satoshi, 0)) { if (gt(invoice!.satoshi, 0)) {
await payInvoice(invoice!.paymentRequest) await payInvoice(invoice!.paymentRequest)
} else { } else {
await payInvoice(invoice!.paymentRequest, sats * 1000) await payInvoice(invoice!.paymentRequest, toMsats(sats))
} }
pushToast({message: `Payment sent!`}) pushToast({message: `Payment sent!`})

View file

@ -45,6 +45,7 @@
back() back()
} }
} catch (error) { } catch (error) {
console.error(error)
pushToast({theme: "error", message: "Failed to update profile"}) pushToast({theme: "error", message: "Failed to update profile"})
} finally { } finally {
loading = false loading = false

View file

@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import {onDestroy} from "svelte" import {onDestroy} from "svelte"
import {first, removeUndefined} from "@welshman/lib" import {first, removeUndefined} from "@welshman/lib"
import {relay} from "@welshman/util" import {relay, toMsats} from "@welshman/util"
import type {TrustedEvent} from "@welshman/util" import type {TrustedEvent} from "@welshman/util"
import {ZapRequest} from "@welshman/domain" import {ZapRequest} from "@welshman/domain"
import {Zappers} from "@welshman/app" import {Zappers} from "@welshman/app"
@ -45,7 +45,7 @@
const writer = $domain const writer = $domain
.writer(ZapRequest) .writer(ZapRequest)
.setContent(content) .setContent(content)
.setAmount(amount * 1000) .setAmount(toMsats(amount))
.setLnurl(currentZapper.lnurl) .setLnurl(currentZapper.lnurl)
.setRecipient(pubkey) .setRecipient(pubkey)

View file

@ -2,7 +2,7 @@ import {writable} from "svelte/store"
import {nwc} from "@getalby/sdk" import {nwc} from "@getalby/sdk"
import {bech32ToHex, displayUrl, tryCatch} from "@welshman/lib" import {bech32ToHex, displayUrl, tryCatch} from "@welshman/lib"
import type {Maybe} from "@welshman/lib" import type {Maybe} from "@welshman/lib"
import {isNWCWallet, isWebLNWallet} from "@welshman/util" import {isNWCWallet, isWebLNWallet, toMsats} from "@welshman/util"
import type {Wallet} from "@welshman/util" import type {Wallet} from "@welshman/util"
import {withGetter} from "@welshman/store" import {withGetter} from "@welshman/store"
@ -86,7 +86,7 @@ export const createInvoice = async ({
if (isNWCWallet($wallet)) { if (isNWCWallet($wallet)) {
const createdInvoice = await getNwcClient().makeInvoice({ const createdInvoice = await getNwcClient().makeInvoice({
amount: satAmount * 1000, amount: toMsats(satAmount),
description, description,
}) })