SHA256
Solana RPC gateway для клиента и сервера
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { confirmSolanaTransactionHttp, sendAndConfirmSolanaHttp } from './solana-rpc-gateway.js';
|
||||
import { extractEd25519Seed32FromStoredValue } from './client-key-utils.js';
|
||||
import { base64ToBytes } from './crypto-utils.js';
|
||||
import { loadEncryptedUserSecrets } from './key-vault.js';
|
||||
@@ -259,7 +260,7 @@ export async function requestAirdropSol({ endpoint, address, amountSol = 1 }) {
|
||||
const pubkey = new solana.PublicKey(String(address || '').trim());
|
||||
const lamports = Math.max(1, Math.floor(Number(amountSol) * solana.LAMPORTS_PER_SOL));
|
||||
const signature = await conn.requestAirdrop(pubkey, lamports);
|
||||
await conn.confirmTransaction(signature, 'confirmed');
|
||||
await confirmSolanaTransactionHttp(conn, signature);
|
||||
return { endpoint: rpc, signature, lamports };
|
||||
}
|
||||
|
||||
@@ -283,9 +284,7 @@ export async function transferSol({ endpoint, fromKeypair, toAddress, amountSol
|
||||
}),
|
||||
);
|
||||
|
||||
const signature = await solana.sendAndConfirmTransaction(conn, tx, [fromKeypair], {
|
||||
commitment: 'confirmed',
|
||||
});
|
||||
const signature = await sendAndConfirmSolanaHttp(conn, tx, [fromKeypair]);
|
||||
return { endpoint: rpc, signature, lamports };
|
||||
}
|
||||
|
||||
@@ -338,11 +337,7 @@ export async function transferAllSol({ endpoint, fromKeypair, toAddress }) {
|
||||
}));
|
||||
tx.sign(fromKeypair);
|
||||
const signature = await conn.sendRawTransaction(tx.serialize(), { skipPreflight: false });
|
||||
await conn.confirmTransaction({
|
||||
signature,
|
||||
blockhash: latest.blockhash,
|
||||
lastValidBlockHeight: latest.lastValidBlockHeight,
|
||||
}, 'confirmed');
|
||||
await confirmSolanaTransactionHttp(conn, signature, { lastValidBlockHeight: latest.lastValidBlockHeight });
|
||||
return {
|
||||
endpoint: rpc,
|
||||
signature,
|
||||
|
||||
Reference in New Issue
Block a user