aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/ark.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-18 23:12:19 -0700
committerAdam Soltys <[email protected]>2026-09-18 23:12:19 -0700
commite07023af899f6682e088aee9ff3329b16b8f467d (patch)
tree7b3f6926d476ebb3c41ad2f325a1029bf58d82aa /src/features/ark.js
parent703ee6e1281e72ec00f65768d7de7a015c242abb (diff)
downloadcoinosv3-e07023af899f6682e088aee9ff3329b16b8f467d.tar.gz
coinosv3-e07023af899f6682e088aee9ff3329b16b8f467d.zip
Zaps: the sound, the sender, and one action bar for every post.
Tap feedback: a bolt strike, the amount popping off the button, the post trembling, and the zap.mp3 clip. The clip is 62KB of base64 and messages.js is boot code, so it is its own chunk, fetched once a zappable post is on screen and played inside the tap once loaded; the standalone build inlines it. Ark zap receipts are signed by the wallet key, which has no profile: they now carry the login identity as the sender (NIP-57's P tag), readers prefer it, and our own older receipts read as us. The action bar is the same six slots on every post: the zap button and the who-reacted chevron are always there (inert until they have something to do), so the first zap no longer reflows the row, and you can zap your own posts and messages. Community rows centre their unread dot off the edge. Also in here: reactions with custom emoji, reply-composer focus under the tapped post, profile fetch retry, and Lightning zap failures that say so. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Diffstat (limited to 'src/features/ark.js')
-rw-r--r--src/features/ark.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/features/ark.js b/src/features/ark.js
index 22ba5fd..dbc97f6 100644
--- a/src/features/ark.js
+++ b/src/features/ark.js
@@ -1514,7 +1514,16 @@ export function arkFeature(ctx) {
// arkoor send and publishes a receipt referencing the delivered vtxo.
// Kinds are provisional until a NIP lands.
const ARK_INFO_KIND = 10037; // replaceable: ["ark", <address>], ["network", <net>]
- const ARK_ZAP_KIND = 9737; // receipt: ["p", pk], ["e", note?], ["amount", sats], ["vtxo", id], ["network", net]
+ const ARK_ZAP_KIND = 9737; // receipt: ["p", pk], ["e", note?], ["amount", sats], ["vtxo", id], ["network", net], ["P", sender?]
+ // The receipt is signed by the wallet key, which has no profile. When the
+ // wallet is linked to a nostr login, name that identity as the sender (the
+ // same "P" tag NIP-57 receipts use) so the zap reads as the person, not
+ // as an npub nobody recognizes.
+ const zapSenderTag = () => {
+ const id = ctx.hook('nostrLoginIdentity');
+ const me = wallet.nostrPubkey && wallet.nostrPubkey();
+ return id && id.pubkey && id.pubkey !== me ? [['P', id.pubkey]] : [];
+ };
// npub decode without importing the nostr stack (keeps ark-only builds lean)
function npubToHex(s) {
@@ -1671,7 +1680,7 @@ export function arkFeature(ctx) {
kind: ARK_ZAP_KIND,
content: (z.comment || '').slice(0, 280),
tags: [['p', z.pk], ...(z.eventId ? [['e', z.eventId]] : []),
- ['amount', String(sats)], ['vtxo', vtxoId], ['network', getNetwork()]],
+ ['amount', String(sats)], ['vtxo', vtxoId], ['network', getNetwork()], ...zapSenderTag()],
}).catch(() => {});
}
@@ -1715,7 +1724,7 @@ export function arkFeature(ctx) {
kind: ARK_ZAP_KIND,
content: (z.comment || '').slice(0, 280),
tags: [['p', z.pk], ...(z.eventId ? [['e', z.eventId]] : []),
- ['amount', String(sats)], ['network', getNetwork()], ['gift', locked.url]],
+ ['amount', String(sats)], ['network', getNetwork()], ['gift', locked.url], ...zapSenderTag()],
}).catch(() => {});
const dmText = t('giftDmText', { amount: fmtAmount(sats) + ' ' + unitLabel(), link: locked.url, code: locked.claimCode });
if (wallet.sendNostrDM) {