SHA256
Улучшить UI регистрации и связанные сценарии
This commit is contained in:
@@ -34,6 +34,9 @@ async function run(){
|
||||
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 type=Number(options.type),minimum=Number(options['min-length']);
|
||||
// Формат namespace 1.1 хранит валюту явно; создание через legacy tag=7 всегда задаёт SOL.
|
||||
const currencyCode=Number(options.currency ?? '1');
|
||||
if(currencyCode!==1)throw Error('Код 2 USDT зарезервирован; создание namespace доступно только в SOL (код 1)');
|
||||
const fee=BigInt(options['fee-lamports']);
|
||||
if(![1,2].includes(type) || !Number.isInteger(minimum) || minimum<1 || minimum+1+namespace.length>30 || fee<0n || fee>0xffffffffffffffffn)
|
||||
throw Error('Некорректные тип, длина или цена');
|
||||
@@ -71,7 +74,7 @@ async function run(){
|
||||
{pubkey:programdata,isSigner:false,isWritable:false},
|
||||
...(serverPda?[{pubkey:serverPda,isSigner:false,isWritable:false}]:[]),
|
||||
],data:payload});
|
||||
console.log(JSON.stringify({namespace,type,minimum,fee:fee.toString(),pda:pda.toBase58(),bump,economy:economy.toBase58(),programdata:programdata.toBase58(),mode:options.send?'SEND':'DRY-RUN'},null,2));
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user