add bitcoin withdraw max fee validation config

This commit is contained in:
2026-09-07 01:35:57 +02:00
parent 6c894d58ba
commit 626f2ea4f0
9 changed files with 23 additions and 3 deletions
+2 -1
View File
@@ -103,7 +103,8 @@ export const getAppConfig = (): AppConfig => {
digitalStockAttachmentsMax: envInt('VALIDATION_DIGITAL_STOCK_ATTACHMENTS_MAX'),
shippingNoteMinLength: envInt('VALIDATION_SHIPPING_NOTE_MIN_LENGTH'),
shippingNoteMaxLength: envInt('VALIDATION_SHIPPING_NOTE_MAX_LENGTH'),
orderMessageMaxLength: envInt('VALIDATION_ORDER_MESSAGE_MAX_LENGTH')
orderMessageMaxLength: envInt('VALIDATION_ORDER_MESSAGE_MAX_LENGTH'),
bitcoinWithdrawMaxFeeRateSatVbyte: envInt('VALIDATION_BITCOIN_WITHDRAW_MAX_FEE_RATE_SAT_VBYTE')
}
};
};
+6
View File
@@ -153,6 +153,12 @@ class EnvironmentVariables {
@Max(10000)
VALIDATION_ORDER_MESSAGE_MAX_LENGTH: number;
@IsNotEmpty()
@IsNumber()
@Min(1)
@Max(1000)
VALIDATION_BITCOIN_WITHDRAW_MAX_FEE_RATE_SAT_VBYTE: number;
@IsNotEmpty()
@IsNumber()
@Min(4)
@@ -1,7 +1,12 @@
import { Transform } from 'class-transformer';
import { IsInt, IsNotEmpty, IsString, Max, Min } from 'class-validator';
import { getAppConfig } from '../../../config';
import { IsBitcoinAddress } from '../../../validation/decorators/isBitcoinAddress';
const {
validation: { bitcoinWithdrawMaxFeeRateSatVbyte }
} = getAppConfig();
export class BitcoinWalletWithdrawDto {
@Transform(({ value }: { value: unknown }) => (typeof value === 'string' ? value.trim() : value))
@IsString()
@@ -11,7 +16,7 @@ export class BitcoinWalletWithdrawDto {
@IsInt()
@Min(1)
@Max(100)
@Max(bitcoinWithdrawMaxFeeRateSatVbyte)
feeRateSatVbyte: number;
@IsString()
+1
View File
@@ -49,6 +49,7 @@ export interface AppConfig {
shippingNoteMinLength: number;
shippingNoteMaxLength: number;
orderMessageMaxLength: number;
bitcoinWithdrawMaxFeeRateSatVbyte: number;
};
}