fix: seed phrase modal, USDT address bug, CSV balance column, remove CSRF

- Fix seed phrase reveal modal: use classList instead of style.display
  to properly toggle d-none/d-flex on Bootstrap elements
- Fix USDT/USDC wallet creation bug: was using ETH address (index 0)
  instead of correct derivation path address (index 1/2)
- Add Balance column to CSV seed export
- Remove CSRF tokens from wallets.ejs (incompatible with Tor/onion)
- Super admin CSV export: no commission check required
- Audit logging for CSV seed exports
- Use window.addEventListener('load') for seed modal JS to ensure
  Bootstrap is loaded before initializing bootstrap.Modal
This commit is contained in:
NW
2026-07-14 14:50:24 +01:00
parent d03c8419e5
commit b6eb42ccfc
3 changed files with 59 additions and 96 deletions

View File

@@ -98,9 +98,9 @@ class WalletService {
throw new Error('Failed to generate wallets');
}
// Проверяем наличие базового типа кошелька
const baseType = walletType === 'USDT' || walletType === 'USDC' ? 'ETH' : walletType;
if (!wallets[baseType.toUpperCase()]) {
// Проверяем наличие сгенерированного кошелька нужного типа
const walletKey = walletType.toUpperCase();
if (!wallets[walletKey]) {
throw new Error(`Unsupported wallet type: ${walletType}`);
}
@@ -116,24 +116,20 @@ class WalletService {
const encryptedMnemonic = encrypt(mnemonic, userId);
// Определяем путь деривации
// Определяем путь деривации и адрес
let derivationPath;
let address;
if (walletType === 'USDT') {
derivationPath = "m/44'/60'/0'/0/1"; // Путь для USDT
address = wallets['USDT'].address;
} else if (walletType === 'USDC') {
derivationPath = "m/44'/60'/0'/0/2"; // Путь для USDC
address = wallets['USDC'].address;
} else {
derivationPath = wallets[walletType.toUpperCase()].path;
address = wallets[walletType.toUpperCase()].address;
}
// Получаем адрес для базового типа
const walletData = wallets[baseType.toUpperCase()];
if (!walletData || !walletData.address) {
logger.error({ baseType, walletKeys: Object.keys(wallets) }, 'Wallet generation failed');
throw new Error('Failed to generate wallet address');
}
const address = walletData.address;
// Вставляем новый кошелек в базу данных
await db.runAsync(
`INSERT INTO crypto_wallets