diff --git a/apps/token/src/hooks/use-search-params.ts b/apps/token/src/hooks/use-search-params.ts index 046d21d36..94476a874 100644 --- a/apps/token/src/hooks/use-search-params.ts +++ b/apps/token/src/hooks/use-search-params.ts @@ -5,7 +5,8 @@ export function useSearchParams() { const location = useLocation(); return React.useMemo(() => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return new URLSearchParams(location.search) as any; + const searchParams = new URLSearchParams(location.search); + // @ts-ignore searchParams doesnt have symbol.iterator + return Object.fromEntries(searchParams); }, [location]); } diff --git a/apps/token/src/routes/staking/associate/associate-page.tsx b/apps/token/src/routes/staking/associate/associate-page.tsx index 933647208..6470cdff6 100644 --- a/apps/token/src/routes/staking/associate/associate-page.tsx +++ b/apps/token/src/routes/staking/associate/associate-page.tsx @@ -30,7 +30,9 @@ export const AssociatePage = ({ const [amount, setAmount] = React.useState(''); const [selectedStakingMethod, setSelectedStakingMethod] = - React.useState(params.method || null); + React.useState( + (params.method as StakingMethod) || null + ); // Clear the amount when the staking method changes React.useEffect(() => { @@ -71,7 +73,7 @@ export const AssociatePage = ({ } else if (!zeroVega && zeroVesting) { setSelectedStakingMethod(StakingMethod.Wallet); } else { - setSelectedStakingMethod(params.method); + setSelectedStakingMethod(params.method as StakingMethod); } }, [params.method, zeroVega, zeroVesting]); diff --git a/apps/token/src/routes/staking/disassociate/disassociate-page-no-vega.tsx b/apps/token/src/routes/staking/disassociate/disassociate-page-no-vega.tsx index d4f26bd5d..c9986bf46 100644 --- a/apps/token/src/routes/staking/disassociate/disassociate-page-no-vega.tsx +++ b/apps/token/src/routes/staking/disassociate/disassociate-page-no-vega.tsx @@ -14,7 +14,9 @@ export const DisassociatePageNoVega = () => { const params = useSearchParams(); const [amount, setAmount] = React.useState(''); const [selectedStakingMethod, setSelectedStakingMethod] = - React.useState(params.method || null); + React.useState( + (params.method as StakingMethod) || null + ); return (
diff --git a/apps/token/src/routes/staking/disassociate/disassociate-page.tsx b/apps/token/src/routes/staking/disassociate/disassociate-page.tsx index d48cccc36..f7f2d60c4 100644 --- a/apps/token/src/routes/staking/disassociate/disassociate-page.tsx +++ b/apps/token/src/routes/staking/disassociate/disassociate-page.tsx @@ -26,7 +26,9 @@ export const DisassociatePage = ({ const params = useSearchParams(); const [amount, setAmount] = React.useState(''); const [selectedStakingMethod, setSelectedStakingMethod] = - React.useState(params.method || null); + React.useState( + (params.method as StakingMethod) || null + ); const refreshBalances = useRefreshAssociatedBalances(); // Clear the amount when the staking method changes diff --git a/apps/token/src/routes/staking/staking-form.tsx b/apps/token/src/routes/staking/staking-form.tsx index 1d4501406..0136fb374 100644 --- a/apps/token/src/routes/staking/staking-form.tsx +++ b/apps/token/src/routes/staking/staking-form.tsx @@ -91,7 +91,9 @@ export const StakingForm = ({ const { sendTx } = useVegaWallet(); const [formState, setFormState] = React.useState(FormState.Default); const { t } = useTranslation(); - const [action, setAction] = React.useState(params.action); + const [action, setAction] = React.useState( + params.action as StakeAction + ); const [amount, setAmount] = React.useState(''); const [removeType, setRemoveType] = React.useState( RemoveType.EndOfEpoch