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
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()
if (error) {
@ -47,7 +47,7 @@
<ModalHeader>
<ModalTitle>Set as Receiving Address?</ModalTitle>
</ModalHeader>
{#if $userProfile?.values.lud16}
{#if $userProfile?.lnurl()}
<p>
Your current receiving address is different from the one provided by your connected wallet.
</p>

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@ import {writable} from "svelte/store"
import {nwc} from "@getalby/sdk"
import {bech32ToHex, displayUrl, tryCatch} 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 {withGetter} from "@welshman/store"
@ -86,7 +86,7 @@ export const createInvoice = async ({
if (isNWCWallet($wallet)) {
const createdInvoice = await getNwcClient().makeInvoice({
amount: satAmount * 1000,
amount: toMsats(satAmount),
description,
})