Skip to content

Commit 84391d0

Browse files
committed
chore: retrieving minThreshold from uiConfig
1 parent 89c8fa4 commit 84391d0

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

packages/apps/human-app/frontend/src/modules/worker/profile/components/staking-info.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-use
1111
import { useEffect, useRef, useState } from 'react';
1212
import { useAccessTokenRefresh } from '@/api/hooks/use-access-token-refresh';
1313
import { colorPalette } from '@/shared/styles/color-palette';
14+
import { useGetUiConfig } from '@/shared/hooks/use-get-ui-config';
1415

1516
export function StakingInfo() {
1617
const [isPromptExpanded, setIsPromptExpanded] = useState(false);
@@ -30,6 +31,7 @@ export function StakingInfo() {
3031
refetch,
3132
isRefetching,
3233
} = useGetStakingSummary();
34+
const { data: uiConfig } = useGetUiConfig();
3335

3436
const isConnectButtonDisabled =
3537
!!exchangeApiKeyData?.exchange_name || isExchangeApiKeyLoading;
@@ -46,7 +48,7 @@ export function StakingInfo() {
4648
const isStaked =
4749
isLoading || isStakingError
4850
? false
49-
: stakedAmount >= Number(stakingSummary?.min_threshold);
51+
: stakedAmount >= Number(uiConfig?.minThreshold || '0');
5052

5153
useEffect(() => {
5254
if (isRefetching || isLoading) return;
@@ -99,7 +101,7 @@ export function StakingInfo() {
99101
<Typography variant="body2" mt={1}>
100102
{isPromptExpanded
101103
? t('worker.profile.stakingInfo.prompt', {
102-
amount: stakingSummary?.min_threshold,
104+
amount: uiConfig?.minThreshold,
103105
})
104106
: t('worker.profile.stakingInfo.promptShort')}{' '}
105107
<Button

packages/apps/human-app/frontend/src/modules/worker/services/staking.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ interface StakeSummary {
55
exchange_error?: string;
66
on_chain_stake: string;
77
on_chain_error?: string;
8-
min_threshold: string;
98
}
109

1110
async function getStakingSummary(): Promise<StakeSummary | null> {

packages/apps/human-app/frontend/src/shared/services/ui-config.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const apiPaths = {
88
const uiConfigSchema = z.object({
99
chainIdsEnabled: z.array(z.number()),
1010
stakingEligibilityEnabled: z.boolean().prefault(false),
11+
minThreshold: z.string(),
1112
});
1213

1314
export type UiConfig = z.infer<typeof uiConfigSchema>;

0 commit comments

Comments
 (0)