mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
adjust client difficulty
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { validate } from 'bitcoin-address-validation';
|
||||
import { registerDecorator, ValidationOptions, ValidatorConstraint, ValidatorConstraintInterface } from 'class-validator';
|
||||
|
||||
@ValidatorConstraint({ name: 'bitcoinAddress', async: false })
|
||||
export class BitcoinAddress implements ValidatorConstraintInterface {
|
||||
validate(value: string): boolean {
|
||||
// Implement your custom validation logic here
|
||||
return validate(value);
|
||||
}
|
||||
|
||||
defaultMessage(): string {
|
||||
return 'Must be a bitcoin address';
|
||||
}
|
||||
}
|
||||
|
||||
export function IsBitcoinAddress(validationOptions?: ValidationOptions) {
|
||||
return function (object: Object, propertyName: string) {
|
||||
registerDecorator({
|
||||
name: 'isBitcoinAddress',
|
||||
target: object.constructor,
|
||||
propertyName: propertyName,
|
||||
constraints: [],
|
||||
options: validationOptions,
|
||||
validator: BitcoinAddress,
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user