Skip to content

Commit

Permalink
Added chaintype to graphql validator and project verification form
Browse files Browse the repository at this point in the history
  • Loading branch information
aminlatifi committed Dec 13, 2023
1 parent dcacbfe commit 65c9ea4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/entities/projectVerificationForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Field, ID, ObjectType } from 'type-graphql';
import { Project } from './project';
import { User } from './user';
import { SocialProfile } from './socialProfile';
import { ChainType } from '../types/network';

export enum PROJECT_VERIFICATION_STATUSES {
VERIFIED = 'verified',
Expand Down Expand Up @@ -96,6 +97,8 @@ export class FormRelatedAddress {
address: string;
@Field({ nullable: true })
networkId: number;
@Field(type => ChainType, { defaultValue: ChainType.EVM })
chainType?: ChainType;
}

@ObjectType()
Expand Down
5 changes: 5 additions & 0 deletions src/utils/validators/graphqlQueryValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { NETWORK_IDS } from '../../provider';
import { DONATION_STATUS } from '../../entities/donation';
import { PROJECT_VERIFICATION_STATUSES } from '../../entities/projectVerificationForm';
import { countriesList } from '../utils';
import { ChainType } from '../../types/network';

const filterDateRegex = new RegExp('^[0-9]{8} [0-9]{2}:[0-9]{2}:[0-9]{2}$');
const resourcePerDateRegex = new RegExp(
Expand Down Expand Up @@ -156,6 +157,7 @@ const managingFundsValidator = Joi.object({
title: Joi.string().required(),
address: Joi.string().required().pattern(ethereumWalletAddressRegex),
networkId: Joi.number()?.valid(
0, // Solana
NETWORK_IDS.MAIN_NET,
NETWORK_IDS.ROPSTEN,
NETWORK_IDS.GOERLI,
Expand All @@ -165,6 +167,9 @@ const managingFundsValidator = Joi.object({
NETWORK_IDS.OPTIMISTIC,
NETWORK_IDS.XDAI,
),
chainType: Joi.string()
.valid(ChainType.EVM, ChainType.SOLANA)
.default(ChainType.EVM),
}),
),
});
Expand Down

0 comments on commit 65c9ea4

Please sign in to comment.