Перевести донаты на Stars и обновить Devnet

This commit is contained in:
AidarKC
2026-11-14 00:55:02 +03:00
parent c972a975fd
commit 97db033eb8
39 changed files with 1020 additions and 198 deletions
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env node
/** One-shot, zero-dependency diagnostic for the configured SHiNE Solana JSON-RPC. */
import { parseVerifiedPythPriceAccount, PYTH_SOL_USD_FEED_ID, PYTH_USDT_USD_FEED_ID, PYTH_RECEIVER_PROGRAM_ID } from '../shine-UI/js/services/shine-stars-pyth.js';
const endpoint = process.argv[2] || process.env.SHINE_SOLANA_RPC_URL;
if (!endpoint || !/^https?:\/\//.test(endpoint)) {
console.error('Usage: node scripts/check_stars_pyth_rpc.mjs https://your-server/solana-rpc');
process.exit(2);
}
const addresses = [
'7UVimffxr9ow1uXYxsr4LHAcV58mLzhmwaeKvJ1pjLiE',
'HT2PLQBcG5EiCcNSaMHAjSgd9F98ecpATbk4Sk5oYuM',
];
try {
const response = await fetch(endpoint, {
method: 'POST', headers: {'Content-Type':'application/json'},
body: JSON.stringify({jsonrpc:'2.0', id:1, method:'getMultipleAccounts', params:[addresses, {commitment:'confirmed', encoding:'base64'}]}),
signal: AbortSignal.timeout(20000),
});
if (!response.ok) throw new Error(`RPC HTTP ${response.status}`);
const payload = await response.json();
if (payload.error) throw new Error(`RPC error: ${JSON.stringify(payload.error)}`);
const infos = payload.result?.value;
if (!Array.isArray(infos) || infos.length !== 2) throw new Error('RPC returned invalid accounts payload');
for (let i = 0; i < infos.length; i++) {
const row = infos[i];
const name = i === 0 ? 'SOL/USD' : 'USDT/USD';
if (!row) throw new Error(`${name}: Pyth shard-0 account does not exist in this network`);
const account = {data: Uint8Array.from(Buffer.from(row.data?.[0] || '', 'base64')),
owner: {toBase58: () => row.owner}};
const price = parseVerifiedPythPriceAccount(account, i === 0 ? PYTH_SOL_USD_FEED_ID : PYTH_USDT_USD_FEED_ID);
console.log(`${name}: verified, priceE8=${price.priceE8}, publish_time=${new Date(price.publishTimeSeconds*1000).toISOString()}, account=${addresses[i]}`);
}
console.log('OK: both Pyth accounts are current, can construct Stars quote.');
} catch (error) {
console.error('FAIL:', error.message);
console.error('The app intentionally blocks donations until both feeds are fresh.');
process.exitCode = 1;
}