SHA256
Обновить настройки серверов и выбор Solana RPC
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user