Skip to content

Commit

Permalink
fix validation check
Browse files Browse the repository at this point in the history
  • Loading branch information
luistorres committed May 10, 2024
1 parent cea2f2f commit d390a25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
17 changes: 4 additions & 13 deletions packages/web-app/app/_lib/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useTotalInvestedUsdcCtznd,
} from './queries';
import { useKyc } from '../_providers/kyc/context';
import { compareAddresses, isValidGrant } from './utils';
import { compareAddresses } from './utils';
import { TProjectInfoArgs } from '../_server/info';
import {
ctzndSaleAddress,
Expand Down Expand Up @@ -91,10 +91,7 @@ export const useHasCitizendGrant = () => {
const hasGrant = useMemo(() => {
if (!citizendGrants?.length || !shares) return false;

return citizendGrants.some(
(grant) =>
shares.includes(grant.dataId) && isValidGrant(grant.lockedUntil),
);
return citizendGrants.some((grant) => shares.includes(grant.dataId));
}, [citizendGrants, shares]);

return useMemo(() => {
Expand Down Expand Up @@ -132,10 +129,7 @@ export const useMyProjects = () => {
);
if (!projectGrants?.length) return false;

return projectGrants.some(
(grant) =>
shares.includes(grant.dataId) && isValidGrant(grant.lockedUntil),
);
return projectGrants.some((grant) => shares.includes(grant.dataId));
});
}, [saleDetails, shares, grants]);

Expand Down Expand Up @@ -177,10 +171,7 @@ export const useHasProjectGrant = (projectId: string) => {
const hasGrant = useMemo(() => {
if (!projectGrants?.length || !shares) return false;

return projectGrants.some(
(grant) =>
shares.includes(grant.dataId) && isValidGrant(grant.lockedUntil),
);
return projectGrants.some((grant) => shares.includes(grant.dataId));
}, [projectGrants, shares]);

return useMemo(() => {
Expand Down
5 changes: 1 addition & 4 deletions packages/web-app/app/_server/idos/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ServerPublicInfo } from '../types';
import { getGrants, getProjectApplicants } from './grants';
import { addressesListSchema, grantsSchema } from '../../_types/schemas';
import { isValidGrant } from '@/app/_lib/utils';
import { blockedCountries } from '../blocked-countries';
import { idOSGrantee } from './idos-grantee';
import {
Expand All @@ -21,9 +20,7 @@ const userFilter = async (grantee: idOSGrantee, userAddress: string) => {
owner: userAddress,
grantee: evmGrantee.address,
});
const grants = grantsSchema
.parse(grantsResult)
?.filter((grant) => isValidGrant(grant.lockedUntil));
const grants = grantsSchema.parse(grantsResult);

if (!grants.length) return null;

Expand Down

0 comments on commit d390a25

Please sign in to comment.