From 817f7ee1e75e5761408097cff5a215af137a50a6 Mon Sep 17 00:00:00 2001 From: L B Date: Mon, 3 Jan 2022 11:00:20 -0800 Subject: [PATCH] Removed unnecessary claim type mapping const --- src/custom/state/claim/hooks/index.ts | 12 +----------- src/custom/state/claim/hooks/utils.ts | 10 ++-------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/custom/state/claim/hooks/index.ts b/src/custom/state/claim/hooks/index.ts index c63c8be45..f9bde0d34 100644 --- a/src/custom/state/claim/hooks/index.ts +++ b/src/custom/state/claim/hooks/index.ts @@ -22,7 +22,7 @@ export * from './hooksMod' // TODO: replace with real repo when known export const CLAIMS_REPO = 'https://raw.githubusercontent.com/gnosis/cow-mrkl-drop-data-chunks/final/chunks/' -export const enum ClaimType { +export enum ClaimType { Airdrop, // free, no vesting, can be available on both mainnet and gchain GnoOption, // paid, with vesting, must use GNO, can be available on both mainnet and gchain UserOption, // paid, with vesting, must use Native currency, can be available on both mainnet and gchain @@ -33,16 +33,6 @@ export const enum ClaimType { type RepoClaimType = keyof typeof ClaimType -// TODO: also, is there a smarter way of doing this? -export const REVERSE_CLAIM_TYPE_MAPPING: Record = { - Airdrop: ClaimType.Airdrop, - GnoOption: ClaimType.GnoOption, - UserOption: ClaimType.UserOption, - Investor: ClaimType.Investor, - Team: ClaimType.Team, - Advisor: ClaimType.Advisor, -} - export const FREE_CLAIM_TYPES: ClaimType[] = [ClaimType.Airdrop, ClaimType.Team, ClaimType.Advisor] export const PAID_CLAIM_TYPES: ClaimType[] = [ClaimType.GnoOption, ClaimType.UserOption, ClaimType.Investor] diff --git a/src/custom/state/claim/hooks/utils.ts b/src/custom/state/claim/hooks/utils.ts index 61c99e4b1..8bff20d9e 100644 --- a/src/custom/state/claim/hooks/utils.ts +++ b/src/custom/state/claim/hooks/utils.ts @@ -1,10 +1,4 @@ -import { - FREE_CLAIM_TYPES, - PAID_CLAIM_TYPES, - RepoClaims, - REVERSE_CLAIM_TYPE_MAPPING, - UserClaims, -} from 'state/claim/hooks/index' +import { ClaimType, FREE_CLAIM_TYPES, PAID_CLAIM_TYPES, RepoClaims, UserClaims } from 'state/claim/hooks/index' /** * Helper function to check whether any claim is an investment option @@ -31,5 +25,5 @@ export function hasFreeClaim(claims: UserClaims | null): boolean { * Airdrop -> 0 */ export function transformRepoClaimsToUserClaims(repoClaims: RepoClaims): UserClaims { - return repoClaims.map((claim) => ({ ...claim, type: REVERSE_CLAIM_TYPE_MAPPING[claim.type] })) + return repoClaims.map((claim) => ({ ...claim, type: ClaimType[claim.type] })) }