import { ValidatorConstraint , ValidatorConstraintInterface } from 'class-validator' ; import BN from 'bn.js' ; @ ValidatorConstraint ( ) export class BNStringValidator implements ValidatorConstraintInterface { validate ( text ) { try { new BN ( text ) ; } catch ( e ) { return false ; } return true ; } }