Solana RPC gateway для клиента и сервера

This commit is contained in:
AidarKC
2026-10-18 00:03:46 +03:00
parent b67d06ce43
commit aa5addb5d9
17 changed files with 228 additions and 85 deletions
@@ -1,3 +1,4 @@
import { sendAndConfirmSolanaHttp } from './solana-rpc-gateway.js';
import { base58ToBytes, base64ToBytes, bytesToBase58, importPkcs8Ed25519, sha256Bytes, signBytes } from './crypto-utils.js';
import { extractSeed32FromPkcs8B64 } from './client-key-utils.js';
import {
@@ -623,7 +624,7 @@ async function createShineUserPdaOnSolana({
const tx = new ctx.solana.Transaction();
if (promoEdIx) tx.add(promoEdIx);
tx.add(rootIx, recordIx, createIx);
const signature = await ctx.solana.sendAndConfirmTransaction(ctx.connection, tx, [ctx.payerKeypair], { commitment: 'confirmed' });
const signature = await sendAndConfirmSolanaHttp(ctx.connection, tx, [ctx.payerKeypair]);
return { signature, userPda: ctx.userPda.toBase58(), pdaAddress: ctx.userPda.toBase58(), blockchainName: `${cleanLogin}-001` };
} catch (error) { throw await attachSolanaLogs(error, ctx.connection); }
}
@@ -660,7 +661,7 @@ export async function closeLegacyShineUserPdaOnSolana({ login, solanaEndpoint, c
],
data: serializeCloseLegacyArgs(cleanLogin),
});
const signature = await solana.sendAndConfirmTransaction(connection, new solana.Transaction().add(ix), [caller], { commitment: 'confirmed' });
const signature = await sendAndConfirmSolanaHttp(connection, new solana.Transaction().add(ix), [caller]);
return { signature, pdaAddress: userPda.toBase58() };
}
@@ -779,7 +780,7 @@ export async function updateShineUserPdaOnSolana({
data: serializeUpdateUserPdaArgs({ login: current.login, rootKey32: rootKey, updatedAtMs, additionalLimitBytes: addLimit, clientKey32: clientKey, authMode, newBlockchainKey32: appendedKey, serverAddresses: addresses, accessServers: nextAccess, recordSignature64: recordSig }),
});
try {
const signature = await ctx.solana.sendAndConfirmTransaction(ctx.connection, new ctx.solana.Transaction().add(authIx, recordIx, updateIx), [ctx.payerKeypair], { commitment: 'confirmed' });
const signature = await sendAndConfirmSolanaHttp(ctx.connection, new ctx.solana.Transaction().add(authIx, recordIx, updateIx), [ctx.payerKeypair]);
return { signature, userPda: ctx.userPda.toBase58(), pdaAddress: ctx.userPda.toBase58(), paidLimitBytes: forks.at(-1).paidLimitBytes, forkCount: forks.length };
} catch (error) { throw await attachSolanaLogs(error, ctx.connection); }
}