UI: уточнить шаг пополнения регистрации

This commit is contained in:
AidarKC
2026-07-22 19:28:46 +04:00
parent 681437acb1
commit 07b1623c5e
3 changed files with 36 additions and 11 deletions
+2 -2
View File
@@ -1,2 +1,2 @@
client.version=1.2.345 client.version=1.2.346
server.version=1.2.317 server.version=1.2.318
+1 -1
View File
@@ -6,4 +6,4 @@ export const defaultServerAddress = 'shineup.me';
export const defaultServerHttp = `https://${defaultServerAddress}`; export const defaultServerHttp = `https://${defaultServerAddress}`;
export const defaultServerWs = `wss://${defaultServerAddress}/ws`; export const defaultServerWs = `wss://${defaultServerAddress}/ws`;
export const defaultSolanaCluster = 'mainnet-beta'; export const defaultSolanaCluster = 'mainnet-beta';
export const defaultSolanaEndpoint = 'https://solana-rpc.publicnode.com'; export const defaultSolanaEndpoint = 'https://public.rpc.solanavibestation.com/';
+33 -8
View File
@@ -25,6 +25,7 @@ import { defaultServerLogin } from '../deploy-config.js';
export const pageMeta = { id: 'registration-payment-view', title: 'Оплата регистрации', showAppChrome: false }; export const pageMeta = { id: 'registration-payment-view', title: 'Оплата регистрации', showAppChrome: false };
const MIN_REQUIRED_SOL = 0.01; const MIN_REQUIRED_SOL = 0.01;
const RECOMMENDED_TOPUP_SOL = 0.02;
const AUTO_LOGIN_INITIAL_DELAY_MS = 1000; const AUTO_LOGIN_INITIAL_DELAY_MS = 1000;
const AUTO_LOGIN_RETRY_MS = 2000; const AUTO_LOGIN_RETRY_MS = 2000;
const REGISTRATION_PROGRESS_DURATION_MS = 12000; const REGISTRATION_PROGRESS_DURATION_MS = 12000;
@@ -42,6 +43,20 @@ function getExplorerClusterName(endpoint) {
return 'mainnet-beta'; return 'mainnet-beta';
} }
function isTestRegistrationContour() {
const solanaCluster = getExplorerClusterName(state.entrySettings.solanaServer);
if (solanaCluster !== 'mainnet-beta') return true;
const shineServer = String(state.entrySettings.shineServer || '').trim().toLowerCase();
const shineServerLogin = String(state.entrySettings.shineServerLogin || '').trim().toLowerCase();
return (
shineServer.includes('t1.shineup.me')
|| shineServer.includes('t2.shineup.me')
|| shineServer.includes('t3.shineup.me')
|| shineServer.includes('t4.shineup.me')
|| ['t1', 't2', 't3', 't4'].includes(shineServerLogin)
);
}
function makeSolanaExplorerTxUrl(signature, endpoint) { function makeSolanaExplorerTxUrl(signature, endpoint) {
const cleanSignature = String(signature || '').trim(); const cleanSignature = String(signature || '').trim();
if (!cleanSignature) return ''; if (!cleanSignature) return '';
@@ -152,14 +167,16 @@ export function render({ navigate }) {
walletValue.type = 'text'; walletValue.type = 'text';
walletValue.value = state.registrationPayment.walletAddress || ''; walletValue.value = state.registrationPayment.walletAddress || '';
walletValue.readOnly = true; walletValue.readOnly = true;
walletValue.style.width = '100%';
const walletRow = document.createElement('div'); const walletRow = document.createElement('div');
walletRow.className = 'inline-input-row'; walletRow.className = 'stack';
const copyButton = document.createElement('button'); const copyButton = document.createElement('button');
copyButton.className = 'ghost-btn'; copyButton.className = 'ghost-btn';
copyButton.type = 'button'; copyButton.type = 'button';
copyButton.textContent = 'Скопировать номер'; copyButton.textContent = 'Скопировать номер';
copyButton.style.width = '100%';
copyButton.addEventListener('click', async () => { copyButton.addEventListener('click', async () => {
try { try {
await navigator.clipboard.writeText(walletValue.value); await navigator.clipboard.writeText(walletValue.value);
@@ -232,6 +249,7 @@ export function render({ navigate }) {
balanceRow.append(balanceValue, refreshButton); balanceRow.append(balanceValue, refreshButton);
const isTestContour = isTestRegistrationContour();
const topupButton = document.createElement('button'); const topupButton = document.createElement('button');
topupButton.className = 'ghost-btn'; topupButton.className = 'ghost-btn';
topupButton.type = 'button'; topupButton.type = 'button';
@@ -277,11 +295,15 @@ export function render({ navigate }) {
if (currentBalance == null) return; if (currentBalance == null) return;
if (currentBalance < MIN_REQUIRED_SOL) { if (currentBalance < MIN_REQUIRED_SOL) {
status.className = 'status-line is-unavailable'; status.className = 'status-line is-unavailable';
status.textContent = `Для регистрации нужно минимум ${MIN_REQUIRED_SOL} SOL. Сейчас на кошельке ${formatSol(currentBalance, 6)} SOL. Пополните на промо-странице или попросите перевод у знакомого с тестовыми SOL.`; status.textContent = isTestContour
? `Для регистрации нужно минимум ${MIN_REQUIRED_SOL} SOL. Рекомендуем пополнить кошелёк примерно на ${RECOMMENDED_TOPUP_SOL} SOL. Сейчас на кошельке ${formatSol(currentBalance, 6)} SOL.`
: `Для регистрации пополните этот кошелёк соланами примерно на ${RECOMMENDED_TOPUP_SOL} SOL. Сейчас на кошельке ${formatSol(currentBalance, 6)} SOL. Минимум для продолжения: ${MIN_REQUIRED_SOL} SOL.`;
status.style.display = ''; status.style.display = '';
const openTopup = window.confirm('Открыть страницу пополнения с вашим кошельком?'); if (isTestContour) {
if (openTopup) { const openTopup = window.confirm('Открыть страницу пополнения с вашим кошельком?');
window.open(getTopupSiteUrl(walletAddress), '_blank', 'noopener,noreferrer'); if (openTopup) {
window.open(getTopupSiteUrl(walletAddress), '_blank', 'noopener,noreferrer');
}
} }
return; return;
} }
@@ -323,15 +345,18 @@ export function render({ navigate }) {
}); });
card.innerHTML = ` card.innerHTML = `
<p class="auth-copy">Для регистрации в тестовой Solana нужно минимум 0,01 SOL на вашем кошельке.</p> <p class="auth-copy">Для регистрации пополните этот кошелёк соланами примерно на ${RECOMMENDED_TOPUP_SOL} SOL.</p>
<label class="stack"><span class="field-label">Номер кошелька (client.key)</span></label> <label class="stack"><span class="field-label">Номер кошелька</span></label>
<div class="stack"> <div class="stack">
<span class="field-label">Баланс (Solana)</span> <span class="field-label">Баланс (Solana)</span>
</div> </div>
`; `;
card.children[1].append(walletRow); card.children[1].append(walletRow);
card.children[2].append(balanceRow); card.children[2].append(balanceRow);
card.append(topupButton, showKeysButton, submitButton, status); if (isTestContour) {
card.append(topupButton);
}
card.append(showKeysButton, submitButton, status);
screen.append( screen.append(
renderHeader({ renderHeader({