Skip to content

Commit 338a687

Browse files
committed
lint
1 parent 00695ca commit 338a687

5 files changed

Lines changed: 15 additions & 19 deletions

File tree

src/pages/stakingPage/components/RewardsCard.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useAccount } from 'wagmi';
44

55
import { GrixLogo } from '@/components/commons/Logo';
66
import { EthLogo } from '@/components/commons/Logo/EthLogo';
7+
import { AssetPriceResponse } from '@/types/api';
78
import { claim, compound } from '@/web3Config/staking/hooks';
89

910
import { useVesting } from '../hooks/useVesting';
@@ -18,12 +19,6 @@ type RewardsCardProps = {
1819
refetchData: () => Promise<void>;
1920
};
2021

21-
type DexScreenerResponse = {
22-
grix: {
23-
usd: number;
24-
};
25-
};
26-
2722
export const RewardsCard = ({ data, refetchData }: RewardsCardProps): JSX.Element => {
2823
const { address } = useAccount();
2924
const [isClaiming, setIsClaiming] = useState(false);
@@ -42,7 +37,7 @@ export const RewardsCard = ({ data, refetchData }: RewardsCardProps): JSX.Elemen
4237
origin: 'https://app.grix.finance',
4338
},
4439
});
45-
const json = await res.json();
40+
const json = (await res.json()) as AssetPriceResponse;
4641
const price = json.assetPrice;
4742
setGrixPrice(price);
4843
} catch {

src/pages/stakingPage/components/StakingCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { useCallback, useEffect, useState } from 'react';
33
import { parseEther } from 'viem';
44
import { useAccount } from 'wagmi';
55

6+
import { AssetPriceResponse } from '@/types/api';
67
import { stakingContracts } from '@/web3Config/staking/config';
78
import {
89
approveStaking,
@@ -116,7 +117,7 @@ export const StakingCard: React.FC<StakingCardProps> = ({
116117
origin: 'https://app.grix.finance',
117118
},
118119
});
119-
const json = await res.json();
120+
const json = (await res.json()) as AssetPriceResponse;
120121
const price = json.assetPrice;
121122
setGrixPrice(price);
122123
} catch {

src/pages/stakingPage/components/VestingModal.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { useEffect, useState } from 'react';
1818
import { FaEquals, FaPlus } from 'react-icons/fa';
1919

2020
import { GrixLogo } from '@/components/commons/Logo';
21+
import { AssetPriceResponse } from '@/types/api';
2122

2223
type VestingModalProps = {
2324
isOpen: boolean;
@@ -29,12 +30,6 @@ type VestingModalProps = {
2930
claimableRewards: string;
3031
};
3132

32-
type DexScreenerResponse = {
33-
grix: {
34-
usd: number;
35-
};
36-
};
37-
3833
export const VestingModal = ({
3934
isOpen,
4035
onClose,
@@ -58,7 +53,7 @@ export const VestingModal = ({
5853
origin: 'https://app.grix.finance',
5954
},
6055
});
61-
const json = await res.json();
56+
const json = (await res.json()) as AssetPriceResponse;
6257
const price = json.assetPrice;
6358
setGrixPrice(price);
6459
} catch {

src/types/api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// API Response Types
2+
3+
export type AssetPriceResponse = {
4+
assetPrice: number;
5+
};

src/web3Config/staking/hooks.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ export const calculateAPR = async () => {
307307
functionName: 'tokensPerInterval',
308308
args: [],
309309
});
310-
} catch (error) {
311-
console.error('Error fetching ETH reward rate:', error);
310+
} catch {
311+
// Error fetching ETH reward rate
312312
}
313313
}
314314

@@ -323,8 +323,8 @@ export const calculateAPR = async () => {
323323

324324
// Convert to percentage with 2 decimal places
325325
return Number(apr) / 100;
326-
} catch (error) {
327-
console.error('Error calculating APR:', error);
326+
} catch {
327+
// Error calculating APR
328328
return 0;
329329
}
330330
};

0 commit comments

Comments
 (0)