diff --git a/src/app/components/ProfileEdit.svelte b/src/app/components/ProfileEdit.svelte
index ba27c90..843dd26 100644
--- a/src/app/components/ProfileEdit.svelte
+++ b/src/app/components/ProfileEdit.svelte
@@ -1,22 +1,13 @@
+
+
+
+ {#snippet title()}
+ Set as Receiving Address?
+ {/snippet}
+
+ {#if $userProfile?.lud16}
+
+ Your current receiving address is different from the one provided by your connected wallet.
+
+
+ Would you like to update your receiving address to {lud16}?
+
+ {:else}
+
+ You don't currently have a receiving address set, which means other people can't send you
+ lightning payments.
+
+
Would you like to use the one associated with your connected wallet?
+ {/if}
+
+
+
+
+
diff --git a/src/app/components/WalletConnect.svelte b/src/app/components/WalletConnect.svelte
index de090e2..d6f9750 100644
--- a/src/app/components/WalletConnect.svelte
+++ b/src/app/components/WalletConnect.svelte
@@ -3,7 +3,8 @@
import {nwc} from "@getalby/sdk"
import {sleep, assoc} from "@welshman/lib"
import type {NWCInfo} from "@welshman/util"
- import {pubkey, updateSession} from "@welshman/app"
+ import {pubkey, userProfile, updateSession, profilesByPubkey} from "@welshman/app"
+ import {makeProfile} from "@welshman/util"
import Link from "@lib/components/Link.svelte"
import Cpu from "@assets/icons/cpu-bolt.svg?dataurl"
import Lock from "@assets/icons/lock-keyhole.svg?dataurl"
@@ -15,11 +16,13 @@
import Scanner from "@lib/components/Scanner.svelte"
import Spinner from "@lib/components/Spinner.svelte"
import Field from "@lib/components/Field.svelte"
- import Divider from "@lib/components/Divider.svelte"
import ModalHeader from "@lib/components/ModalHeader.svelte"
import ModalFooter from "@lib/components/ModalFooter.svelte"
import {getWebLn} from "@app/core/commands"
import {pushToast} from "@app/util/toast"
+ import {pushModal} from "@app/util/modal"
+ import WalletAsReceivingAddress from "@app/components/WalletAsReceivingAddress.svelte"
+ import Divider from "@src/lib/components/Divider.svelte"
const back = () => history.back()
@@ -76,6 +79,10 @@
await sleep(400)
back()
+
+ if (info.lud16 && info.lud16 !== $userProfile?.lud16) {
+ pushModal(WalletAsReceivingAddress)
+ }
}
} catch (e) {
console.error(e)
@@ -109,7 +116,7 @@
Connect a Wallet
{/snippet}
{#snippet info()}
- Use Nostr Wallet Connect to send Bitcoin payments over Bolt.
+ Use Nostr Wallet Connect to send Bitcoin payments over lightning.
{/snippet}
{#if getWebLn()}
diff --git a/src/app/components/WalletUpdateReceivingAddress.svelte b/src/app/components/WalletUpdateReceivingAddress.svelte
new file mode 100644
index 0000000..f058eb1
--- /dev/null
+++ b/src/app/components/WalletUpdateReceivingAddress.svelte
@@ -0,0 +1,100 @@
+
+
+
+
+ {#snippet title()}
+ Update Lightning Address
+ {/snippet}
+ {#snippet info()}
+ Update your lightning address for receiving payments.
+ {/snippet}
+
+
+
+
+
Lightning Address
+
+
+ You can enter one manually or use your connected wallet's address (if available). Leave
+ empty to remove your lightning address
+
+
+
+ {#if walletLud16 && walletLud16 !== address}
+
+
+
+
+
+ Wallet Address
+
+
{walletLud16}
+
+
+
+
+ {/if}
+
+
+
+
+
+
+
diff --git a/src/app/core/commands.ts b/src/app/core/commands.ts
index f607f8d..bba8cd9 100644
--- a/src/app/core/commands.ts
+++ b/src/app/core/commands.ts
@@ -19,12 +19,13 @@ import {
last,
simpleCache,
normalizeUrl,
+ nthNe,
} from "@welshman/lib"
import {decrypt, Nip01Signer} from "@welshman/signer"
import type {UploadTask} from "@welshman/editor"
import type {Feed} from "@welshman/feeds"
import {makeIntersectionFeed, feedFromFilters, makeRelayFeed} from "@welshman/feeds"
-import type {TrustedEvent, EventContent} from "@welshman/util"
+import type {TrustedEvent, EventContent, Profile} from "@welshman/util"
import {
WRAP,
DELETE,
@@ -63,6 +64,10 @@ import {
canUploadBlob,
encryptFile,
makeBlossomAuthEvent,
+ isPublishedProfile,
+ editProfile,
+ createProfile,
+ uniqTags,
} from "@welshman/util"
import {Pool, AuthStatus, SocketStatus} from "@welshman/net"
import {Router} from "@welshman/router"
@@ -102,6 +107,7 @@ import {
canDecrypt,
ensureUnwrapped,
userInboxRelays,
+ getMembershipUrls,
} from "@app/core/state"
import {loadAlertStatuses} from "@app/core/requests"
import {platform, platformName, getPushInfo} from "@app/util/push"
@@ -772,3 +778,29 @@ export const uploadFile = async (file: File, options: UploadFileOptions = {}) =>
return {error: e.toString()}
}
}
+
+// Update Profile
+
+export const updateProfile = async ({
+ profile,
+ shouldBroadcast = !getTag(PROTECTED, profile.event?.tags || []),
+}: {
+ profile: Profile
+ shouldBroadcast?: boolean
+}) => {
+ const router = Router.get()
+ const template = isPublishedProfile(profile) ? editProfile(profile) : createProfile(profile)
+ const scenarios = [router.FromRelays(getMembershipUrls(userMembership.get()))]
+
+ if (shouldBroadcast) {
+ scenarios.push(router.FromUser(), router.Index())
+ template.tags = template.tags.filter(nthNe(0, "-"))
+ } else {
+ template.tags = uniqTags([...template.tags, PROTECTED])
+ }
+
+ const event = makeEvent(template.kind, template)
+ const relays = router.merge(scenarios).getUrls()
+
+ await publishThunk({event, relays}).result
+}
diff --git a/src/routes/settings/wallet/+page.svelte b/src/routes/settings/wallet/+page.svelte
index e914dbc..83e0c2d 100644
--- a/src/routes/settings/wallet/+page.svelte
+++ b/src/routes/settings/wallet/+page.svelte
@@ -1,22 +1,32 @@
@@ -89,4 +99,23 @@
{/if}
+
+
+
Lightning Address
+
+
+ {profileLightningAddress ? profileLightningAddress : "Not set"}
+
+
+
+
+ {#if profileLightningAddress && walletLud16 && profile?.lud16 !== walletLud16}
+
+
+ Your profile has a different lightning address than your connected wallet.
+
+ {/if}
+
diff --git a/tailwind.config.js b/tailwind.config.js
index f5c279a..77a9a61 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -37,6 +37,7 @@ export default {
light: {
...themes["winter"],
neutral: '#F2F7FF',
+ warning: '#FD8D0B',
primary: process.env.VITE_PLATFORM_ACCENT,
"primary-content": process.env.VITE_PLATFORM_ACCENT_CONTENT || "#EAE7FF",
secondary: process.env.VITE_PLATFORM_SECONDARY,