Обновить HEADER, теги CORE и конфигурацию основного сервера

This commit is contained in:
AidarKC
2026-12-04 00:12:50 +03:00
parent cc010a8eea
commit 3c91014469
40 changed files with 526 additions and 103 deletions
@@ -13,7 +13,7 @@ const options={};
for(let i=2;i<process.argv.length;i++){
if(!process.argv[i].startsWith('--'))throw Error('Неожиданный аргумент');
const name=process.argv[i].slice(2);
if(name==='send'){options[name]=true;continue;}
if(name==='send'||name==='mainnet'){options[name]=true;continue;}
if(i+1>=process.argv.length)throw Error(`Отсутствует значение --${name}`);
options[name]=process.argv[++i];
}
@@ -29,10 +29,11 @@ function accountData(type,name,minLocalLen,fee,registrar,serverLogin){
async function run(){
const rpc=options.rpc,secret=options.keypair,namespace=options.namespace;
if(!rpc || !secret || !namespace)throw Error('Обязательные параметры: --rpc --keypair --namespace --type --min-length --fee-lamports');
// Выбранный сценарий создаёт только localnet/devnet; никакого скрытого доступа к mainnet.
// Mainnet разрешён только с отдельным явным флагом.
const endpoint=new URL(rpc);
if(!(['localhost','127.0.0.1'].includes(endpoint.hostname)||endpoint.hostname.endsWith('.devnet.solana.com')))
throw Error('Разрешены только localhost/127.0.0.1 и *.devnet.solana.com; production запрещён');
const isMainnet=endpoint.hostname==='solana-rpc.publicnode.com'||endpoint.hostname==='api.mainnet-beta.solana.com';
if(isMainnet?!options.mainnet:options.mainnet || !(['localhost','127.0.0.1'].includes(endpoint.hostname)||endpoint.hostname.endsWith('.devnet.solana.com')))
throw Error('Для mainnet нужен --mainnet и разрешённый RPC; для devnet/localnet флаг --mainnet запрещён');
const type=Number(options.type),minimum=Number(options['min-length']);
// Формат namespace 1.1 хранит валюту явно; создание через legacy tag=7 всегда задаёт SOL.
const currencyCode=Number(options.currency ?? '1');
@@ -77,7 +78,7 @@ async function run(){
console.log(JSON.stringify({namespace,type,minimum,currencyCode,fee:fee.toString(),pda:pda.toBase58(),bump,economy:economy.toBase58(),programdata:programdata.toBase58(),mode:options.send?'SEND':'DRY-RUN'},null,2));
if(!options.send)return;
const signature=await sendAndConfirmTransaction(connection,new Transaction().add(instruction),[wallet],{commitment:'confirmed'});
console.log('Подтверждённая devnet/localnet транзакция:',signature);
console.log('Подтверждённая транзакция:',signature);
const state=await connection.getAccountInfo(pda,'confirmed');
if(!state)throw Error('После транзакции namespace отсутствует');
console.log('Считанный PDA:',decodeNamespace(state.data));