aboutsummaryrefslogtreecommitdiffstats
path: root/src/recipient-search.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-02 18:17:27 -0700
committerAdam Soltys <[email protected]>2026-08-02 18:17:27 -0700
commit8da44392be513929802a5f4329b29bfa125aaa04 (patch)
treead147686220f5a64b7c8bc9c3287f9ba0bb12020 /src/recipient-search.js
parentdf01e3fb245c3e8d75a335d94e95df5f76a3b30a (diff)
downloadcoinosv3-8da44392be513929802a5f4329b29bfa125aaa04.tar.gz
coinosv3-8da44392be513929802a5f4329b29bfa125aaa04.zip
Pay an npub: ark > lightning > on-chain, and fix the orphaned LN seams
Picking a search result (or pasting an npub) now resolves every way the person can be paid and takes the best: their kind-10037 ark advert; an ark= instruction in BIP-353 via their coinos name (registrar /pubkey returns the URI directly) or their nip05 name's own DNS record (a bare domain is the BIP-353 "_" user); then Lightning from profile lud16/ lud06 through the zap flow; then a BIP-353 on-chain address as last resort. Search results no longer put the nip05 identifier in the fill value — that's how fiatjaf.com ended up as a dead recipient. Along the way: the zaps feature's canLnPay/startLnPay seams had no provider since the swaps feature retired, so the whole Lightning-zap path was unreachable. Ark provides both now (the ASP pays invoices natively), which also revives zapping any LN-only npub. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Wvj4aoeMZwA7VUGdJP9Swi
Diffstat (limited to 'src/recipient-search.js')
-rw-r--r--src/recipient-search.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/recipient-search.js b/src/recipient-search.js
index 32319ab..d3e69eb 100644
--- a/src/recipient-search.js
+++ b/src/recipient-search.js
@@ -95,7 +95,7 @@ export async function searchRecipients(qRaw) {
try {
const m = JSON.parse(e.content);
profileCache.set(e.pubkey, { name: m.display_name || m.name || null, picture: m.picture || null });
- add(e.pubkey, { name: m.display_name || m.name, picture: m.picture, address: typeof m.nip05 === 'string' ? m.nip05.replace(/^_@/, '') : undefined }, pri);
+ add(e.pubkey, { name: m.display_name || m.name, picture: m.picture, nip05: typeof m.nip05 === 'string' ? m.nip05.replace(/^_@/, '') : undefined }, pri);
} catch {}
};
const primal = await primalSearch(q);
@@ -108,7 +108,7 @@ export async function searchRecipients(qRaw) {
// Within a source, a name that actually contains the query outranks the
// search relay's looser relevance matches.
- const score = (r) => ((r.name || '').toLowerCase().includes(q) || (r.address || '').toLowerCase().includes(q)) ? 0 : 1;
+ const score = (r) => ((r.name || '').toLowerCase().includes(q) || (r.address || r.nip05 || '').toLowerCase().includes(q)) ? 0 : 1;
const rows = [...out.values()].sort((a, b) => a.pri - b.pri || score(a) - score(b)).slice(0, MAX_RESULTS);
await fillProfiles(rows).catch(() => {});
if (queryCache.size > 200) queryCache.clear();
@@ -147,5 +147,5 @@ export function resultRows(h, rows, onPick) {
: h('div', { class: 'chat-avatar fallback' }, (r.name || npubOf(r.pk) || '??').slice(0, 2)),
h('div', { class: 'col grow', style: 'min-width:0;gap:1px' },
h('div', { class: 'chat-name' }, r.name || (npubOf(r.pk) || '').slice(0, 14) + '…'),
- h('div', { class: 'muted small chat-preview' }, r.address || (npubOf(r.pk) || '').slice(0, 24) + '…'))));
+ h('div', { class: 'muted small chat-preview' }, r.address || r.nip05 || (npubOf(r.pk) || '').slice(0, 24) + '…'))));
}