import 'reflect-metadata' ; export const isEthAddressMetadataKey = Symbol ( 'ethAddress' ) ; export const isEthAddressArrayMetadataKey = Symbol ( 'ethAddressArray' ) ; export const isEthAddressOrENSMetadataKey = Symbol ( 'ethOrENSAddress' ) ; export const isPositiveMetadataKey = Symbol ( 'isPositive' ) ; export const isPositiveOrMinusOneMetadataKey = Symbol ( 'isPositiveOrMinusOne' ) ; export const is0OrPositiveMetadataKey = Symbol ( 'is0OrPositiveMetadataKey' ) ; export const optionalMetadataKey = Symbol ( 'Optional' ) ; export type paramsType = { index : number ; field : string | undefined ; } ; export function IsEthAddress ( field ? ) { return function ( target , propertyKey , parameterIndex ) : void { const existingPossibleAddresses = Reflect . getOwnMetadata ( isEthAddressMetadataKey , target , propertyKey ) || [ ] ; existingPossibleAddresses . push ( { index : parameterIndex , field , } ) ; Reflect . defineMetadata ( isEthAddressMetadataKey , existingPossibleAddresses , target , propertyKey ) ; } ; } export function IsEthAddressArray ( field ? ) { return function ( target , propertyKey , parameterIndex ) : void { const existingPossibleAddresses = Reflect . getOwnMetadata ( isEthAddressMetadataKey , target , propertyKey ) || [ ] ; existingPossibleAddresses . push ( { index : parameterIndex , field , } ) ; Reflect . defineMetadata ( isEthAddressArrayMetadataKey , existingPossibleAddresses , target , propertyKey ) ; } ; } export function IsEthAddressOrENS ( field ? ) { return function ( target , propertyKey , parameterIndex ) : void { const existingPossibleAddresses = Reflect . getOwnMetadata ( isEthAddressOrENSMetadataKey , target , propertyKey ) || [ ] ; existingPossibleAddresses . push ( { index : parameterIndex , field , } ) ; Reflect . defineMetadata ( isEthAddressOrENSMetadataKey , existingPossibleAddresses , target , propertyKey ) ; } ; } export function IsPositiveAmount ( field ? ) { return function ( target , propertyKey , parameterIndex ) : void { const params = Reflect . getOwnMetadata ( isPositiveMetadataKey , target , propertyKey ) || [ ] ; params . push ( { index : parameterIndex , field } ) ; Reflect . defineMetadata ( isPositiveMetadataKey , params , target , propertyKey ) ; } ; } export function Is0OrPositiveAmount ( field ? ) { return function ( target , propertyKey , parameterIndex ) : void { const params = Reflect . getOwnMetadata ( is0OrPositiveMetadataKey , target , propertyKey ) || [ ] ; params . push ( { index : parameterIndex , field } ) ; Reflect . defineMetadata ( is0OrPositiveMetadataKey , params , target , propertyKey ) ; } ; } export function IsPositiveOrMinusOneAmount ( field ? ) { return function ( target , propertyKey , parameterIndex ) : void { const params = Reflect . getOwnMetadata ( isPositiveOrMinusOneMetadataKey , target , propertyKey ) || [ ] ; params . push ( { index : parameterIndex , field } ) ; Reflect . defineMetadata ( isPositiveOrMinusOneMetadataKey , params , target , propertyKey ) ; } ; } export function Optional ( target , propertyKey , parameterIndex ) { const existingOptionalParameters = Reflect . getOwnMetadata ( optionalMetadataKey , target , propertyKey ) || [ ] ; existingOptionalParameters . push ( parameterIndex ) ; Reflect . defineMetadata ( optionalMetadataKey , existingOptionalParameters , target , propertyKey ) ; }