This commit is contained in:
jejolare 2026-02-03 18:33:32 +07:00
parent e2109d1177
commit 0338d6f467

View file

@ -17,6 +17,13 @@ interface ActiveBot {
userId: number; userId: number;
expirationTimestamp: number; expirationTimestamp: number;
} }
interface PairWithCurrencies extends Pair {
first_currency?: Currency | null;
second_currency?: Currency | null;
whitelisted?: boolean;
}
class DexModel { class DexModel {
private activeBots: ActiveBot[]; private activeBots: ActiveBot[];
@ -121,7 +128,7 @@ class DexModel {
}); });
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const pairsWithCurrencies: any = pairs; const pairsWithCurrencies: PairWithCurrencies[] = pairs;
for (let i = 0; i < pairs.length; i++) { for (let i = 0; i < pairs.length; i++) {
pairsWithCurrencies[i].first_currency = await configModel.getCurrencyRow( pairsWithCurrencies[i].first_currency = await configModel.getCurrencyRow(
@ -132,9 +139,11 @@ class DexModel {
); );
} }
pairsWithCurrencies.whitelisted = for (const pwc of pairsWithCurrencies) {
pairsWithCurrencies.first_currency.whitelisted && pwc.whitelisted =
pairsWithCurrencies.second_currency.whitelisted; (pwc.first_currency?.whitelisted || false) &&
(pwc.second_currency?.whitelisted || false);
}
return { success: true, data: pairsWithCurrencies }; return { success: true, data: pairsWithCurrencies };
} catch (err) { } catch (err) {
@ -178,11 +187,6 @@ class DexModel {
if (!pair) return { success: false, data: 'Invalid pair data' }; if (!pair) return { success: false, data: 'Invalid pair data' };
interface PairWithCurrencies extends Pair {
first_currency?: Currency | null;
second_currency?: Currency | null;
}
const pairWithCurrencies: Pair = pair; const pairWithCurrencies: Pair = pair;
const first_currency = await configModel.getCurrencyRow(pair.first_currency_id); const first_currency = await configModel.getCurrencyRow(pair.first_currency_id);