From 14cc3be620b51ef266e6a936f9c00760e4a6091081949c2465c642d84e06b57b Mon Sep 17 00:00:00 2001 From: AidarKC Date: Mon, 27 Apr 2026 01:50:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F:=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=BA=D0=B0=20=D1=80=D0=B5=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=B1=D0=B0=D0=BB=D0=B0=D0=BD=D1=81=D0=B0=20wal?= =?UTF-8?q?let.key=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B4=D0=BE=D0=BB=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION.properties | 4 +- .../js/pages/registration-payment-view.js | 51 +++++++++++-------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/VERSION.properties b/VERSION.properties index c6a44b3..cf1bc62 100644 --- a/VERSION.properties +++ b/VERSION.properties @@ -1,2 +1,2 @@ -client.version=1.2.18 -server.version=1.2.18 +client.version=1.2.19 +server.version=1.2.19 diff --git a/shine-UI/js/pages/registration-payment-view.js b/shine-UI/js/pages/registration-payment-view.js index d3b5fbb..9544e8c 100644 --- a/shine-UI/js/pages/registration-payment-view.js +++ b/shine-UI/js/pages/registration-payment-view.js @@ -44,9 +44,7 @@ export function render({ navigate }) { walletValue.className = 'input'; walletValue.type = 'text'; walletValue.value = state.registrationPayment.walletAddress || ''; - walletValue.addEventListener('input', () => { - state.registrationPayment.walletAddress = walletValue.value; - }); + walletValue.readOnly = true; const walletRow = document.createElement('div'); walletRow.className = 'inline-input-row'; @@ -83,8 +81,8 @@ export function render({ navigate }) { refreshButton.textContent = '↻'; refreshButton.title = 'Обновить'; - const refreshBalance = async ({ showError = true } = {}) => { - const address = String(walletValue.value || '').trim(); + const refreshBalance = async ({ showError = true, addressOverride = '' } = {}) => { + const address = String(addressOverride || walletValue.value || '').trim(); if (!address) return null; refreshButton.disabled = true; try { @@ -107,6 +105,19 @@ export function render({ navigate }) { } }; + const deriveUserWalletAddress = async () => { + const draftPassword = String(state.registrationDraft.password ?? ''); + if (!draftPassword) { + throw new Error('Не найден пароль регистрации для вычисления wallet.key'); + } + const wallet = await deriveWalletFromPassword(draftPassword); + const address = String(wallet?.address || '').trim(); + if (!address) throw new Error('Не удалось вычислить адрес wallet.key'); + state.registrationPayment.walletAddress = address; + walletValue.value = address; + return address; + }; + refreshButton.addEventListener('click', () => { void refreshBalance(); }); @@ -117,9 +128,15 @@ export function render({ navigate }) { topupButton.className = 'ghost-btn'; topupButton.type = 'button'; topupButton.textContent = 'Пополнить кошелёк'; - topupButton.addEventListener('click', () => { - const walletAddress = String(walletValue.value || '').trim(); - window.open(getTopupSiteUrl(walletAddress), '_blank', 'noopener,noreferrer'); + topupButton.addEventListener('click', async () => { + try { + const walletAddress = await deriveUserWalletAddress(); + window.open(getTopupSiteUrl(walletAddress), '_blank', 'noopener,noreferrer'); + } catch (error) { + status.className = 'status-line is-unavailable'; + status.textContent = `Не удалось подготовить кошелёк: ${error?.message || 'unknown'}`; + status.style.display = ''; + } }); const submitButton = document.createElement('button'); @@ -141,15 +158,8 @@ export function render({ navigate }) { submitButton.disabled = true; submitButton.textContent = 'Регистрация...'; - const walletAddress = String(walletValue.value || '').trim(); - if (!walletAddress) { - status.className = 'status-line is-unavailable'; - status.textContent = 'Кошелёк не подготовлен. Нажмите «Обновить» и попробуйте снова.'; - status.style.display = ''; - return; - } - - const currentBalance = await refreshBalance({ showError: true }); + const walletAddress = await deriveUserWalletAddress(); + const currentBalance = await refreshBalance({ showError: true, addressOverride: walletAddress }); if (currentBalance == null) return; if (currentBalance < MIN_REQUIRED_SOL) { status.className = 'status-line is-unavailable'; @@ -205,11 +215,8 @@ export function render({ navigate }) { (async () => { try { - const draftPassword = String(state.registrationDraft.password ?? ''); - const wallet = await deriveWalletFromPassword(draftPassword); - state.registrationPayment.walletAddress = wallet.address; - walletValue.value = wallet.address; - await refreshBalance(); + const walletAddress = await deriveUserWalletAddress(); + await refreshBalance({ addressOverride: walletAddress }); } catch (error) { status.className = 'status-line is-unavailable'; status.textContent = `Не удалось подготовить wallet.key: ${error?.message || 'unknown'}`;