diff --git a/frontend/src/app/(routes)/staking/components/DelegatePopup.tsx b/frontend/src/app/(routes)/staking/components/DelegatePopup.tsx index 6ba620df6..52582335c 100644 --- a/frontend/src/app/(routes)/staking/components/DelegatePopup.tsx +++ b/frontend/src/app/(routes)/staking/components/DelegatePopup.tsx @@ -121,11 +121,11 @@ const DelegatePopup: React.FC = ({ />

Important

- Staking will lock your funds for 21 days. + Staking will lock your funds for {singleStake.getChainUnbondingPeriod(chainID)} days.

- To make your staked assets liquid, undelegation will take 21 days. + To make your staked assets liquid, undelegation will take {singleStake.getChainUnbondingPeriod(chainID)} days.
diff --git a/frontend/src/app/(routes)/staking/components/NewDelegationDialog.tsx b/frontend/src/app/(routes)/staking/components/NewDelegationDialog.tsx index f954c18f0..b67c23b0f 100644 --- a/frontend/src/app/(routes)/staking/components/NewDelegationDialog.tsx +++ b/frontend/src/app/(routes)/staking/components/NewDelegationDialog.tsx @@ -119,11 +119,11 @@ const NewDelegationDialog: React.FC = ({ />

Important

- Staking will lock your funds for 21 days. + Staking will lock your funds for {singleStake.getChainUnbondingPeriod(chainID)} days.

- To make your staked assets liquid, undelegation will take 21 days. + To make your staked assets liquid, undelegation will take {singleStake.getChainUnbondingPeriod(chainID)} days.
diff --git a/frontend/src/app/(routes)/staking/components/ReDelegatePopup.tsx b/frontend/src/app/(routes)/staking/components/ReDelegatePopup.tsx index b6bc7f6df..7cc93ef01 100644 --- a/frontend/src/app/(routes)/staking/components/ReDelegatePopup.tsx +++ b/frontend/src/app/(routes)/staking/components/ReDelegatePopup.tsx @@ -216,7 +216,7 @@ const ReDelegatePopup: React.FC = ({ />

Important

- Staking will lock your funds for 21 days + Staking will lock your funds for {singleStake.getChainUnbondingPeriod(chainID)} days

diff --git a/frontend/src/app/(routes)/staking/components/UndelegatePopup.tsx b/frontend/src/app/(routes)/staking/components/UndelegatePopup.tsx index ccf832f2d..170f3070a 100644 --- a/frontend/src/app/(routes)/staking/components/UndelegatePopup.tsx +++ b/frontend/src/app/(routes)/staking/components/UndelegatePopup.tsx @@ -119,11 +119,11 @@ const UndelegatePopup: React.FC = ({ />

Important

- Staking will lock your funds for 21 days. + Staking will lock your funds for {singleStake.getChainUnbondingPeriod(chainID)} days.

- To make your staked assets liquid, undelegation will take 21 days. + To make your staked assets liquid, undelegation will take {singleStake.getChainUnbondingPeriod(chainID)} days.
diff --git a/frontend/src/custom-hooks/useSingleStaking.tsx b/frontend/src/custom-hooks/useSingleStaking.tsx index cc546d3f3..80ad4a122 100644 --- a/frontend/src/custom-hooks/useSingleStaking.tsx +++ b/frontend/src/custom-hooks/useSingleStaking.tsx @@ -1,8 +1,9 @@ import { useAppDispatch, useAppSelector } from './StateHooks'; import { RootState } from '@/store/store'; import useGetChainInfo from './useGetChainInfo'; -import { getValidator } from '@/store/features/staking/stakeSlice'; +import { getParams, getValidator } from '@/store/features/staking/stakeSlice'; import useGetAssetsAmount from './useGetAssetsAmount'; +import { useEffect } from 'react'; /* eslint-disable react-hooks/rules-of-hooks */ const useSingleStaking = (chainID: string) => { @@ -16,10 +17,18 @@ const useSingleStaking = (chainID: string) => { // getValueFromToken, getTokenValueByChainId } = useGetChainInfo(); + const { restURLs } = getChainInfo(chainID); + + useEffect(() => { + dispatch(getParams({ chainID: chainID, baseURLs: restURLs })) + }, [chainID]) + const rewardsChains = useAppSelector((state: RootState) => isAuthzMode ? state.distribution.authzChains : state.distribution.chains ); + + // const totalData = useAppSelector((state: RootState) => state.staking) const [ @@ -40,6 +49,22 @@ const useSingleStaking = (chainID: string) => { ); const commonStakingData = useAppSelector((state) => state.staking.chains); + const getChainUnbondingPeriod = (cID: string) => { + const secs = stakeData[cID]?.params?.unbonding_time || '' + + // Use regex to match all digits in the string + const numberInString = secs.match(/\d+/); + + // If a number is found, convert to seconds and then to days + if (numberInString) { + const seconds = parseInt(numberInString[0], 10); + const days = seconds / 86400; + return days; + } + + return 21 + } + const getAvaiailableAmount = (chainID: string) => { let amount = 0; @@ -145,6 +170,7 @@ const useSingleStaking = (chainID: string) => { getDenomWithChainID, getAvaiailableAmount, totalValStakedAssets, + getChainUnbondingPeriod }; }; diff --git a/frontend/src/utils/util.ts b/frontend/src/utils/util.ts index cebc19449..954ef75be 100644 --- a/frontend/src/utils/util.ts +++ b/frontend/src/utils/util.ts @@ -25,7 +25,6 @@ import { GOV_VOTE_OPTIONS } from '@/constants/gov-constants'; export function initializeGA () { ReactGA.initialize('G-RTXGXXDNNS'); console.log("GA INITIALIZED"); - trackEvent('TRANSFER', 'MULTI_SEND', 'SUCCESS') }; export const trackEvent = (category: string, action: string, label: string) => {