From 306c65532eec2c51785618d59c8efb903f65e5b9 Mon Sep 17 00:00:00 2001 From: SatoshiQaziMuhammed Date: Thu, 5 Nov 2026 03:21:41 +0400 Subject: [PATCH] Name each wallet step on the root signing page (#82) The wallet answers DApp requests one at a time and waits without limit for each, so a tap that reaches a stalled wallet showed nothing. The page now names the step it is waiting on, says after 45 s that the wallet is not answering and how to reset it, and disables the button while a request is pending so repeated taps do not queue more. --- docs/root-signing/index.html | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/root-signing/index.html b/docs/root-signing/index.html index b3faa81..b6d56be 100644 --- a/docs/root-signing/index.html +++ b/docs/root-signing/index.html @@ -216,16 +216,34 @@ return; } show('signButton'); + // The wallet answers DApp requests one at a time and waits without limit for each, so a request it never + // shows blocks every later one. Each step is named on the page, so a stalled wallet says where it stopped. + const step = (text) => { + $('signResult').textContent = text; + $('signResult').className = 'note'; + show('signResult'); + }; + const waitFor = (promise, text) => { + step(text); + const stalled = setTimeout(() => { + $('signResult').textContent = text + ' Cîzdan bersiv nade: geroka DApp bi tevahî bigire, rûpelê dîsa veke û carekê bitikîne.'; + $('signResult').className = 'note warn'; + }, 45000); + return promise.finally(() => clearTimeout(stalled)); + }; $('signButton').onclick = async () => { + $('signButton').disabled = true; try { - const extension = await injected.enable('Pezkuwi root signing'); - const accounts = await extension.accounts.get(); + const extension = await waitFor(injected.enable('Pezkuwi root signing'), 'Bi cîzdanê ve tê girêdan…'); + const accounts = await waitFor(extension.accounts.get(), 'Hesab têne xwendin…'); const mine = accounts.map((a) => ({ address: a.address, keyId: null, public: pz.decodeAddress(a.address) })); for (const account of mine) account.keyId = hex(await sha256(account.public)); const holder = mine.find((a) => holders.has(a.keyId)); if (!holder) throw new Error('Di vê cîzdanê de hesabekî xwediyê kokê tune.'); - const { signature } = await extension.signer.signRaw({ address: holder.address, data: pzu.u8aToHex(message), type: 'bytes' }); + const { signature } = await waitFor( + extension.signer.signRaw({ address: holder.address, data: pzu.u8aToHex(message), type: 'bytes' }), + 'Li benda îmzeyê ye: di cîzdanê de peyamê piştrast bike…'); let sig = pzu.hexToU8a(signature); if (sig.length === 65 && sig[0] === 1) sig = sig.slice(1); // MultiSignature: 0x01 = sr25519 const context = classify(holder.keyId, sig); @@ -250,6 +268,8 @@ $('signResult').textContent = e.message || String(e); $('signResult').className = 'note bad'; show('signResult'); + } finally { + $('signButton').disabled = false; } }; } catch (e) {