delet TRON wallet type

This commit is contained in:
NW
2025-01-02 16:19:39 +00:00
parent c9bcb09221
commit 22f76c64a6
3 changed files with 17 additions and 94 deletions

View File

@@ -30,9 +30,6 @@ export default class AdminWalletsHandler {
[
{ text: 'Tether (USDT)', callback_data: 'wallet_type_USDT' },
{ text: 'Ethereum (ETH)', callback_data: 'wallet_type_ETH' }
],
[
{ text: 'TRON (TRX)', callback_data: 'wallet_type_TRON' }
]
]
}
@@ -81,7 +78,6 @@ export default class AdminWalletsHandler {
const walletUtilsInstance = new WalletUtils(
wallet.wallet_type.startsWith('BTC') ? wallet.address : null,
wallet.wallet_type.startsWith('LTC') ? wallet.address : null,
wallet.wallet_type.startsWith('TRON') ? wallet.address : null,
wallet.wallet_type.startsWith('ETH') ? wallet.address : null,
null, // userId не нужен для админки
Date.now() - 30 * 24 * 60 * 60 * 1000
@@ -138,7 +134,6 @@ export default class AdminWalletsHandler {
const walletUtilsInstance = new WalletUtils(
wallet.wallet_type.startsWith('BTC') ? wallet.address : null,
wallet.wallet_type.startsWith('LTC') ? wallet.address : null,
wallet.wallet_type.startsWith('TRON') ? wallet.address : null,
wallet.wallet_type.startsWith('ETH') ? wallet.address : null,
null, // userId не нужен для админки
Date.now() - 30 * 24 * 60 * 60 * 1000
@@ -212,7 +207,6 @@ export default class AdminWalletsHandler {
const walletUtilsInstance = new WalletUtils(
wallet.wallet_type.startsWith('BTC') ? wallet.address : null,
wallet.wallet_type.startsWith('LTC') ? wallet.address : null,
wallet.wallet_type.startsWith('TRON') ? wallet.address : null,
wallet.wallet_type.startsWith('ETH') ? wallet.address : null,
null, // userId не нужен для админки
Date.now() - 30 * 24 * 60 * 60 * 1000
@@ -272,9 +266,6 @@ export default class AdminWalletsHandler {
[
{ text: 'Tether (USDT)', callback_data: 'wallet_type_USDT' },
{ text: 'Ethereum (ETH)', callback_data: 'wallet_type_ETH' }
],
[
{ text: 'TRON (TRX)', callback_data: 'wallet_type_TRON' }
]
]
}

View File

@@ -32,7 +32,6 @@ export default class UserWalletsHandler {
const walletUtilsInstance = new WalletUtils(
cryptoWallets.find(w => w.wallet_type === 'BTC')?.address,
cryptoWallets.find(w => w.wallet_type === 'LTC')?.address,
cryptoWallets.find(w => w.wallet_type === 'TRON')?.address,
cryptoWallets.find(w => w.wallet_type === 'ETH')?.address,
user.id,
Date.now() - 30 * 24 * 60 * 60 * 1000
@@ -46,7 +45,6 @@ export default class UserWalletsHandler {
const baseType = this.getBaseWalletType(type);
const wallet = cryptoWallets.find(w =>
w.wallet_type === baseType ||
(type.includes('TRC-20') && w.wallet_type === 'TRON') ||
(type.includes('ERC-20') && w.wallet_type === 'ETH')
);
@@ -187,7 +185,7 @@ export default class UserWalletsHandler {
await bot.sendMessage(chatId, 'Error loading transaction history. Please try again.');
}
}
static async handleRefreshBalance(callbackQuery) {
const chatId = callbackQuery.message.chat.id;
const messageId = callbackQuery.message.message_id;
@@ -231,7 +229,6 @@ export default class UserWalletsHandler {
const cryptoOptions = [
['BTC', 'ETH', 'LTC'],
['USDT TRC-20', 'USDD TRC-20'],
['USDT ERC-20', 'USDC ERC-20']
];
@@ -276,7 +273,7 @@ export default class UserWalletsHandler {
const mnemonic = await WalletGenerator.generateMnemonic();
const wallets = await WalletGenerator.generateWallets(mnemonic);
// Get the base wallet type (ETH for ERC-20, TRON for TRC-20)
// Get the base wallet type (ETH for ERC-20)
const baseType = this.getBaseWalletType(walletType);
// Get existing wallet of this type
@@ -392,7 +389,6 @@ export default class UserWalletsHandler {
const walletUtilsInstance = new WalletUtils(
cryptoWallets.find(w => w.wallet_type === 'BTC')?.address,
cryptoWallets.find(w => w.wallet_type === 'LTC')?.address,
cryptoWallets.find(w => w.wallet_type === 'TRON')?.address,
cryptoWallets.find(w => w.wallet_type === 'ETH')?.address,
user.id,
Date.now() - 30 * 24 * 60 * 60 * 1000
@@ -402,11 +398,9 @@ export default class UserWalletsHandler {
for (const [type, balance] of Object.entries(balances)) {
if (cryptoWallets.some(w => w.wallet_type === type.split(' ')[0] ||
(type.includes('TRC-20') && w.wallet_type === 'TRON') ||
(type.includes('ERC-20') && w.wallet_type === 'ETH'))) {
const wallet = cryptoWallets.find(w =>
w.wallet_type === type.split(' ')[0] ||
(type.includes('TRC-20') && w.wallet_type === 'TRON') ||
(type.includes('ERC-20') && w.wallet_type === 'ETH')
);
message += `🔐 *${type}*\n`;
@@ -547,7 +541,6 @@ export default class UserWalletsHandler {
const walletUtilsInstance = new WalletUtils(
groupedWallets['BTC']?.[0]?.address,
groupedWallets['LTC']?.[0]?.address,
groupedWallets['TRON']?.[0]?.address,
groupedWallets['ETH']?.[0]?.address,
user.id,
Date.now() - 30 * 24 * 60 * 60 * 1000
@@ -587,10 +580,6 @@ export default class UserWalletsHandler {
balance = balances.ETH.amount;
usdValue = balances.ETH.usdValue;
break;
case 'TRON':
balance = balances['USDT TRC-20'].amount + balances['USDD TRC-20'].amount;
usdValue = balances['USDT TRC-20'].usdValue + balances['USDD TRC-20'].usdValue;
break;
}
typeTotal += balance;
@@ -675,13 +664,11 @@ export default class UserWalletsHandler {
// Helper methods
static getBaseWalletType(walletType) {
if (walletType.includes('TRC-20')) return 'TRON';
if (walletType.includes('ERC-20')) return 'ETH';
return walletType;
}
static getWalletAddress(wallets, walletType) {
if (walletType.includes('TRC-20')) return wallets.TRON.address;
if (walletType.includes('ERC-20')) return wallets.ETH.address;
if (walletType === 'BTC') return wallets.BTC.address;
if (walletType === 'LTC') return wallets.LTC.address;
@@ -690,7 +677,6 @@ export default class UserWalletsHandler {
}
static getNetworkName(walletType) {
if (walletType.includes('TRC-20')) return 'Tron Network (TRC-20)';
if (walletType.includes('ERC-20')) return 'Ethereum Network (ERC-20)';
if (walletType === 'BTC') return 'Bitcoin Network';
if (walletType === 'LTC') return 'Litecoin Network';