Обновить настройки серверов и выбор Solana RPC

This commit is contained in:
AidarKC
2026-12-05 18:07:01 +03:00
parent 5664da6fc1
commit 37a04dde4d
16 changed files with 240 additions and 145 deletions
+27
View File
@@ -0,0 +1,27 @@
import { t } from '../i18n/index.js';
import { rpcEndpointFromShineHttp } from '../services/solana-rpc-gateway.js';
export function createSolanaRpcMode({ draft, input, onChange }) {
const select = document.createElement('select');
select.className = 'input';
input.setAttribute('aria-label', t('screens.entry_settings_view.rpc_custom'));
select.setAttribute('aria-label', t('screens.entry_settings_view.rpc_mode'));
for (const [value, label] of [['gateway', t('screens.entry_settings_view.rpc_gateway')], ['custom', t('screens.entry_settings_view.rpc_custom')]]) {
const option = document.createElement('option');
option.value = value;
option.textContent = label;
select.append(option);
}
select.value = draft.solanaRpcMode;
const sync = () => {
const custom = select.value === 'custom';
draft.solanaRpcMode = select.value;
input.hidden = !custom;
input.disabled = !custom;
input.value = custom ? draft.customSolanaServer : '';
draft.solanaServer = custom ? input.value.trim() : rpcEndpointFromShineHttp(draft.shineServerHttp);
};
sync();
select.addEventListener('change', () => { sync(); onChange(); });
return select;
}