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

View File

@@ -1,11 +1,10 @@
import { CryptoEngine } from './lib/crypto-engine';
import { db } from './lib/db';
async function testSweep() {
console.log("Starting test...");
const result = await db.query("SELECT * FROM transactions WHERE status IN ('pending', 'waiting') ORDER BY created_at DESC LIMIT 1");
if(result.rows.length === 0) return console.log("No pending");
console.log("Starting test for specific TX...");
const result = await db.query("SELECT * FROM transactions WHERE id = $1", ["5fda5442-23ea-4130-8646-d0a882ed2517"]);
if(result.rows.length === 0) return console.log("TX not found");
const tx = result.rows[0];
const wallets = tx.metadata?.wallets || {};
@@ -17,8 +16,13 @@ async function testSweep() {
const depositAddress = solWallet.address;
const depositPrivateKey = solWallet.privateKey;
const verification = await cryptoEngine.verifyPayment(depositAddress, "0.295226", "SOL");
const verification = await cryptoEngine.verifyPayment(depositAddress, "0.164824", "SOL");
console.log("Verify:", verification);
const { Connection, PublicKey } = require('@solana/web3.js');
const connection = new Connection('https://api.devnet.solana.com', 'confirmed');
const b = await connection.getBalance(new PublicKey(depositAddress));
console.log("Direct Balance check:", b / 1e9);
if(verification.success) {
console.log("Sweeping...");