aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-01 22:33:04 -0700
committerAdam Soltys <[email protected]>2026-08-01 22:33:04 -0700
commit4d427f8b863c0bd03a7add9ed198d738cc6d14d3 (patch)
treed041dd2818a53bbd76b20971b83890cc0b6807ab /src/features
parent5dbd42fa330da23924335d8287b01bd23b1fcff9 (diff)
downloadcoinosv3-4d427f8b863c0bd03a7add9ed198d738cc6d14d3.tar.gz
coinosv3-4d427f8b863c0bd03a7add9ed198d738cc6d14d3.zip
Actually assign the default payment address
The auto-claim ran once at feature init — before Ark finishes connecting — saw an unavailable wallet and gave up for good, so users got a claim box instead of their npub address. It now retries while Ark comes up (and after a failed claim), and shows a setting-up state rather than the claim form while it works. Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src/features')
-rw-r--r--src/features/names.js25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/features/names.js b/src/features/names.js
index 33bddd7..77b2554 100644
--- a/src/features/names.js
+++ b/src/features/names.js
@@ -83,9 +83,17 @@ export function namesFeature(ctx) {
// prefix of the wallet's npub — unique, boring, and free. Custom names are
// an optional change (and may cost something one day, to keep squatters
// out), so nothing here ever blocks the wallet.
- async function refresh() {
+ let retryTimer = null;
+ async function refresh(attempt = 0) {
+ clearTimeout(retryTimer);
try {
- if (!available()) { checked = true; render(); return; }
+ if (!available()) {
+ // Ark connects lazily AFTER the wallet opens, so the first pass
+ // usually lands too early. Keep looking for a while rather than
+ // giving up and leaving the user staring at a claim box.
+ if (attempt < 40) { retryTimer = setTimeout(() => refresh(attempt + 1), 3000); return; }
+ checked = true; render(); return;
+ }
let st = load();
if (!st.name) { await lookupMine(); st = load(); }
if (!st.name) {
@@ -107,7 +115,12 @@ export function namesFeature(ctx) {
if (!st.name) return;
const uri = await currentUri();
if (uri && uri !== st.uri) await claim(st.name);
- } catch (e) { checked = true; console.warn('names: refresh failed', e.message); }
+ } catch (e) {
+ console.warn('names: refresh failed', e.message);
+ if (attempt < 10) { retryTimer = setTimeout(() => refresh(attempt + 1), 5000); return; }
+ checked = true;
+ render();
+ }
}
// ---- sending to a name -------------------------------------------------
@@ -220,6 +233,11 @@ export function namesFeature(ctx) {
// The Receive tab's default pane: your name, big and scannable.
function namePane(seg) {
const st = load();
+ if (!st.name && !checked) {
+ return h('div', { class: 'card col', style: 'align-items:center;gap:10px' },
+ seg, h('span', { class: 'spinner' }),
+ h('div', { class: 'small muted' }, t('namesSettingUp')));
+ }
if (!st.name) {
return h('div', { class: 'card col', style: 'gap:10px' },
seg,
@@ -237,6 +255,7 @@ export function namesFeature(ctx) {
return {
id: 'names',
init() { checked = false; refresh(); },
+ stop() { clearTimeout(retryTimer); },
receiveModes() {
if (!available()) return [];
return [{