fix(admin): resolve incorrect crypto balance calculation fallback displaying fiat amount

This commit is contained in:
mstfyldz
2026-03-14 18:09:18 +03:00
parent 8800454b60
commit a0e787e03c
17 changed files with 525 additions and 22 deletions

27
testPending.ts Normal file
View File

@@ -0,0 +1,27 @@
import { Client } from 'pg';
import { Connection, PublicKey } from '@solana/web3.js';
async function checkAllPending() {
const client = new Client({ connectionString: process.env.DATABASE_URL });
await client.connect();
const res = await client.query("SELECT * FROM transactions WHERE status = 'pending'");
console.log(`Found ${res.rows.length} pending transactions`);
const connection = new Connection('https://api.devnet.solana.com', 'confirmed');
for (const tx of res.rows) {
const wallets = tx.metadata?.wallets || {};
const solWallet = wallets['SOLANA'];
if (solWallet && solWallet.address) {
try {
const b = await connection.getBalance(new PublicKey(solWallet.address));
console.log(`TX ${tx.id} | Amount: ${tx.amount} TRY | Address: ${solWallet.address} | SOL Balance: ${b / 1e9}`);
} catch(e) {
console.log(`Error on TX ${tx.id}`);
}
}
}
await client.end();
}
checkAllPending().catch(console.error);