Улучшить ссылки и прокрутку личных чатов

This commit is contained in:
AidarKC
2026-11-18 15:50:14 +03:00
parent 76bbc9d023
commit 02c705d41e
10 changed files with 130 additions and 5 deletions
@@ -7,6 +7,16 @@ export function setSolanaCluster(value) {
cluster = next;
}
export function getSolanaCluster() { return cluster; }
export function makeSolanaExplorerTxUrl(signature, endpoint = '') {
const cleanSignature = String(signature || '').trim();
if (!cleanSignature) return '';
const configured = getSolanaCluster();
const source = String(endpoint || '').trim().toLowerCase();
const network = configured || (source.includes('devnet') ? 'devnet' : source.includes('testnet') ? 'testnet' : 'mainnet-beta');
const url = new URL(`https://explorer.solana.com/tx/${encodeURIComponent(cleanSignature)}`);
if (network !== 'mainnet-beta') url.searchParams.set('cluster', network);
return url.toString();
}
export function rpcEndpointFromShineHttp(httpBase) {
const base = String(httpBase || '').trim();
if (!/^https?:\/\//i.test(base)) throw new Error('SHiNE server HTTP address is unavailable');