import { renderHeader } from '../components/header.js?v=20260330001044'; import { state } from '../state.js?v=20260330001044'; export const pageMeta = { id: 'topup-view', title: 'Пополнение счета', showAppChrome: false }; const BUY_LINK = 'https://www.moonpay.com/buy/sol'; export function render({ navigate }) { const screen = document.createElement('section'); screen.className = 'stack'; const walletValue = document.createElement('input'); walletValue.className = 'input'; walletValue.type = 'text'; walletValue.value = state.registrationPayment.walletAddress; walletValue.readOnly = true; walletValue.style.fontSize = '13px'; const copyButton = document.createElement('button'); copyButton.className = 'ghost-btn'; copyButton.type = 'button'; copyButton.textContent = 'Скопировать'; copyButton.addEventListener('click', async () => { try { await navigator.clipboard.writeText(walletValue.value); copyButton.textContent = 'Скопировано'; window.setTimeout(() => { copyButton.textContent = 'Скопировать'; }, 1500); } catch { window.alert('Не удалось скопировать номер кошелька.'); } }); const walletRow = document.createElement('div'); walletRow.className = 'inline-input-row'; walletRow.append(walletValue, copyButton); const card = document.createElement('div'); card.className = 'card stack'; card.innerHTML = `

Для пополнения счета скопируйте номер кошелька.

1. Пополните через любое свое приложение, используя этот кошелек в сети Solana.

2. Либо откройте страницу для покупки SOL.

3. Либо используйте кнопку «Тестовое пополнение» (работает в тестовой Solana).

Открыть страницу покупки SOL
Кошелёк для пополнения
`; card.children[3].append(walletRow); const testButton = document.createElement('button'); testButton.className = 'ghost-btn'; testButton.type = 'button'; testButton.textContent = 'Тестовое пополнение'; testButton.addEventListener('click', () => { state.registrationPayment.balanceSOL = '0.0250'; window.alert('Тестовое пополнение выполнено. Баланс обновлён.'); }); const backButton = document.createElement('button'); backButton.className = 'primary-btn'; backButton.type = 'button'; backButton.textContent = 'Назад'; backButton.addEventListener('click', () => navigate('registration-payment-view')); const actions = document.createElement('div'); actions.className = 'auth-footer-actions'; actions.append(testButton, backButton); screen.append( renderHeader({ title: 'Пополнение счета', leftAction: { label: '←', onClick: () => navigate('registration-payment-view') }, }), card, actions, ); return screen; }