Files
DLE/backend/routes/tokens.js
2026-03-01 22:03:48 +03:00

35 lines
1.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Copyright (c) 2024-2026 Тарабанов Александр Викторович
* All rights reserved.
*
* This software is proprietary and confidential.
* Unauthorized copying, modification, or distribution is prohibited.
*
* For licensing inquiries: info@hb3-accelerator.com
* Website: https://hb3-accelerator.com
* GitHub: https://github.com/VC-HB3-Accelerator
*/
const express = require('express');
const router = express.Router();
const logger = require('../utils/logger');
const authService = require('../services/auth-service');
// Получение балансов токенов пользователя по токенам из базы
router.get('/balances', async (req, res, next) => {
try {
const address = req.query.address;
if (!address) {
return res.status(400).json({ success: false, error: 'Не указан адрес кошелька' });
}
logger.info(`Fetching token balances for address: ${address}`);
const balances = await authService.getUserTokenBalances(address);
res.json({ success: true, data: balances });
} catch (error) {
logger.error('Error fetching token balances:', error);
next(error);
}
});
module.exports = router;