Обновить серверный UI под recovery key

This commit is contained in:
AidarKC
2026-06-23 13:44:18 +04:00
parent 365b22d778
commit 95daa230bb
6 changed files with 70 additions and 17 deletions
+44 -12
View File
@@ -653,6 +653,28 @@ function parseHex32(value) {
return out;
}
async function attachSolanaLogs(error, connection) {
if (!error || typeof error.getLogs !== 'function' || !connection) {
return error;
}
try {
const logs = await error.getLogs(connection);
if (Array.isArray(logs) && logs.length) {
error.logs = logs;
error.transactionLogs = logs;
error.simulationLogs = logs;
if (!String(error.message || '').includes('Logs:')) {
error.message = `${String(error.message || 'Solana transaction failed')} :: Logs: ${logs.join(' | ')}`;
}
}
} catch {
// Если RPC не вернул логи, оставляем исходную ошибку как есть.
}
return error;
}
async function buildCreateContext({ login, keyBundle, solanaEndpoint }) {
const cleanLogin = normalizeLogin(login);
const endpoint = String(solanaEndpoint || '').trim();
@@ -816,12 +838,17 @@ async function createShineUserPdaOnSolana({
data: ixData,
});
const signature = await ctx.solana.sendAndConfirmTransaction(
ctx.connection,
new ctx.solana.Transaction().add(ed25519RootIx, ed25519BchIx, createIx),
[ctx.clientKeypair],
{ commitment: 'confirmed' },
);
let signature;
try {
signature = await ctx.solana.sendAndConfirmTransaction(
ctx.connection,
new ctx.solana.Transaction().add(ed25519RootIx, ed25519BchIx, createIx),
[ctx.clientKeypair],
{ commitment: 'confirmed' },
);
} catch (error) {
throw await attachSolanaLogs(error, ctx.connection);
}
return {
signature,
@@ -1030,12 +1057,17 @@ export async function updateShineUserPdaOnSolana({
const computeIx = solana.ComputeBudgetProgram.setComputeUnitLimit({ units: 800_000 });
const heapIx = solana.ComputeBudgetProgram.requestHeapFrame({ bytes: 262_144 });
const signature = await solana.sendAndConfirmTransaction(
connection,
new solana.Transaction().add(computeIx, heapIx, edIxRoot, edIxBch, updateIx),
[clientKeypair],
{ commitment: 'confirmed' },
);
let signature;
try {
signature = await solana.sendAndConfirmTransaction(
connection,
new solana.Transaction().add(computeIx, heapIx, edIxRoot, edIxBch, updateIx),
[clientKeypair],
{ commitment: 'confirmed' },
);
} catch (error) {
throw await attachSolanaLogs(error, connection);
}
return {
signature,