From 4c213aeedcfec406ced19d67d8373ff41c8b9b29 Mon Sep 17 00:00:00 2001 From: Lam Nguyen <32935491+xlamn@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:12:56 +0100 Subject: [PATCH 1/2] fix: increase realunit buy and sell to level 30 (#3142) --- .../supporting/realunit/realunit.service.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/subdomains/supporting/realunit/realunit.service.ts b/src/subdomains/supporting/realunit/realunit.service.ts index 886bce1bbd..21a29bd545 100644 --- a/src/subdomains/supporting/realunit/realunit.service.ts +++ b/src/subdomains/supporting/realunit/realunit.service.ts @@ -214,24 +214,24 @@ export class RealUnitService { throw new RegistrationRequiredException(); } - // 2. KYC Level check - Level 20 for amounts <= 1000 CHF, Level 50 for higher amounts + // 2. KYC Level check - Level 30 for amounts <= 1000 CHF, Level 50 for higher amounts const currency = await this.fiatService.getFiatByName(currencyName); const amountChf = currencyName === 'CHF' ? dto.amount : (await this.pricingService.getPrice(currency, PriceCurrency.CHF, PriceValidity.ANY)).convert(dto.amount); - const maxAmountForLevel20 = Config.tradingLimits.monthlyDefaultWoKyc; - const requiresLevel50 = amountChf > maxAmountForLevel20; - const requiredLevel = requiresLevel50 ? KycLevel.LEVEL_50 : KycLevel.LEVEL_20; + const maxAmountForLevel30 = Config.tradingLimits.monthlyDefaultWoKyc; + const requiresLevel50 = amountChf > maxAmountForLevel30; + const requiredLevel = requiresLevel50 ? KycLevel.LEVEL_50 : KycLevel.LEVEL_30; if (userData.kycLevel < requiredLevel) { throw new KycLevelRequiredException( requiredLevel, userData.kycLevel, requiresLevel50 - ? `KYC Level 50 required for amounts above ${maxAmountForLevel20} CHF` - : 'KYC Level 20 required for RealUnit', + ? `KYC Level 50 required for amounts above ${maxAmountForLevel30} CHF` + : 'KYC Level 30 required for RealUnit', ); } @@ -678,10 +678,10 @@ export class RealUnitService { throw new RegistrationRequiredException(); } - // 2. KYC Level check - Level 20 minimum - const requiredLevel = KycLevel.LEVEL_20; + // 2. KYC Level check - Level 30 minimum + const requiredLevel = KycLevel.LEVEL_30; if (userData.kycLevel < requiredLevel) { - throw new KycLevelRequiredException(requiredLevel, userData.kycLevel, 'KYC Level 20 required for RealUnit sell'); + throw new KycLevelRequiredException(requiredLevel, userData.kycLevel, 'KYC Level 30 required for RealUnit sell'); } // 3. Get REALU asset From a7dec73e176563c888b8c36f873caa7178399e77 Mon Sep 17 00:00:00 2001 From: David May <85513542+davidleomay@users.noreply.github.com> Date: Thu, 5 Feb 2026 16:31:53 +0100 Subject: [PATCH 2/2] Fix: circular reference (#3144) * fix: circular reference * fix: custody order inputs * chore: cleanup --- .../core/custody/services/custody.service.ts | 6 +++--- .../generic/kyc/services/kyc-admin.service.ts | 4 ++-- .../generic/user/models/auth/auth.service.ts | 4 ++-- .../payment/services/transaction-request.service.ts | 10 ++++++++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/subdomains/core/custody/services/custody.service.ts b/src/subdomains/core/custody/services/custody.service.ts index c47e89117f..7feda31aad 100644 --- a/src/subdomains/core/custody/services/custody.service.ts +++ b/src/subdomains/core/custody/services/custody.service.ts @@ -1,4 +1,4 @@ -import { Injectable, NotFoundException } from '@nestjs/common'; +import { forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common'; import { Config } from 'src/config/config'; import { EvmUtil } from 'src/integration/blockchain/shared/evm/evm.util'; import { UserRole } from 'src/shared/auth/user-role.enum'; @@ -32,10 +32,10 @@ interface CustodyOrderSingle { export class CustodyService { constructor( private readonly userService: UserService, - private readonly userDataService: UserDataService, + @Inject(forwardRef(() => UserDataService)) private readonly userDataService: UserDataService, private readonly walletService: WalletService, private readonly refService: RefService, - private readonly authService: AuthService, + @Inject(forwardRef(() => AuthService)) private readonly authService: AuthService, private readonly custodyOrderRepo: CustodyOrderRepository, private readonly custodyBalanceRepo: CustodyBalanceRepository, private readonly assetPricesService: AssetPricesService, diff --git a/src/subdomains/generic/kyc/services/kyc-admin.service.ts b/src/subdomains/generic/kyc/services/kyc-admin.service.ts index 59749a0499..35db623abd 100644 --- a/src/subdomains/generic/kyc/services/kyc-admin.service.ts +++ b/src/subdomains/generic/kyc/services/kyc-admin.service.ts @@ -1,4 +1,4 @@ -import { Injectable, NotFoundException } from '@nestjs/common'; +import { forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common'; import { UpdateResult } from 'src/shared/models/entity'; import { DfxLogger } from 'src/shared/services/dfx-logger'; import { FindOptionsRelations } from 'typeorm'; @@ -27,7 +27,7 @@ export class KycAdminService { private readonly webhookService: WebhookService, private readonly kycService: KycService, private readonly kycNotificationService: KycNotificationService, - private readonly userDataService: UserDataService, + @Inject(forwardRef(() => UserDataService)) private readonly userDataService: UserDataService, ) {} async getKycSteps(userDataId: number, relations: FindOptionsRelations = {}): Promise { diff --git a/src/subdomains/generic/user/models/auth/auth.service.ts b/src/subdomains/generic/user/models/auth/auth.service.ts index 8f00fb693f..af1dd580ca 100644 --- a/src/subdomains/generic/user/models/auth/auth.service.ts +++ b/src/subdomains/generic/user/models/auth/auth.service.ts @@ -81,7 +81,7 @@ export class AuthService { private readonly cryptoService: CryptoService, private readonly refService: RefService, private readonly feeService: FeeService, - private readonly userDataService: UserDataService, + @Inject(forwardRef(() => UserDataService)) private readonly userDataService: UserDataService, private readonly notificationService: NotificationService, private readonly ipLogService: IpLogService, private readonly siftService: SiftService, @@ -89,7 +89,7 @@ export class AuthService { private readonly geoLocationService: GeoLocationService, private readonly settingService: SettingService, private readonly recommendationService: RecommendationService, - private readonly kycAdminService: KycAdminService, + @Inject(forwardRef(() => KycAdminService)) private readonly kycAdminService: KycAdminService, @Inject(forwardRef(() => KycService)) private readonly kycService: KycService, ) {} diff --git a/src/subdomains/supporting/payment/services/transaction-request.service.ts b/src/subdomains/supporting/payment/services/transaction-request.service.ts index 373a0af4a1..02219fe062 100644 --- a/src/subdomains/supporting/payment/services/transaction-request.service.ts +++ b/src/subdomains/supporting/payment/services/transaction-request.service.ts @@ -20,6 +20,8 @@ import { GetSellPaymentInfoDto } from 'src/subdomains/core/sell-crypto/route/dto import { SellPaymentInfoDto } from 'src/subdomains/core/sell-crypto/route/dto/sell-payment-info.dto'; import { SellService } from 'src/subdomains/core/sell-crypto/route/sell.service'; import { Between, FindOptionsRelations, In, IsNull, LessThan, MoreThan } from 'typeorm'; +import { CustodyOrder } from '../../../core/custody/entities/custody-order.entity'; +import { CustodyOrderStatus } from '../../../core/custody/enums/custody'; import { Deposit } from '../../address-pool/deposit/deposit.entity'; import { DepositRoute } from '../../address-pool/route/deposit-route.entity'; import { CryptoPaymentMethod, FiatPaymentMethod } from '../dto/payment-method.enum'; @@ -335,9 +337,13 @@ export class TransactionRequestService { .distinct() .innerJoin(DepositRoute, 'dr', 'tr.routeId = dr.id') .innerJoin(Deposit, 'd', 'dr.depositId = d.id') + .leftJoin(CustodyOrder, 'co', 'co.transactionRequestId = tr.id') .where('tr.type IN (:...types)', { types: [TransactionRequestType.SELL, TransactionRequestType.SWAP] }) - .andWhere('tr.status = :status', { status: TransactionRequestStatus.CREATED }) - .andWhere('tr.created > :created', { created }) + .andWhere('tr.status = :trStatus', { trStatus: TransactionRequestStatus.CREATED }) + .andWhere('(tr.created > :created OR co.status = :coStatus)', { + created, + coStatus: CustodyOrderStatus.IN_PROGRESS, + }) .andWhere('d.blockchains LIKE :blockchain', { blockchain: `%${blockchain}%` }) .getRawMany<{ address: string }>() .then((transactionRequests) => transactionRequests.map((deposit) => deposit.address));