diff --git a/packages/suite/src/hooks/wallet/useStakeEthForm.ts b/packages/suite/src/hooks/wallet/useStakeEthForm.ts index 2d2391298c14..06da5c042f2a 100644 --- a/packages/suite/src/hooks/wallet/useStakeEthForm.ts +++ b/packages/suite/src/hooks/wallet/useStakeEthForm.ts @@ -171,6 +171,7 @@ export const useStakeEthForm = ({ selectedAccount }: UseStakeFormsProps): StakeC const composedFee = useMemo(() => { const transactionInfo = composedLevels?.[selectedFee]; + return transactionInfo !== undefined && transactionInfo.type !== 'error' ? new BigNumber(fromWei(transactionInfo.fee)) : new BigNumber('0'); @@ -200,7 +201,7 @@ export const useStakeEthForm = ({ selectedAccount }: UseStakeFormsProps): StakeC if (currentRate) { const fiatValue = toFiatCurrency(amount, localCurrency, { - [currentRate.locale]: currentRate?.rate, + [localCurrency]: currentRate?.rate, }); setValue(FIAT_INPUT, fiatValue || '', { shouldValidate: true }); } @@ -232,7 +233,7 @@ export const useStakeEthForm = ({ selectedAccount }: UseStakeFormsProps): StakeC amount, localCurrency, { - [currentRate.locale]: currentRate?.rate, + [localCurrency]: currentRate?.rate, }, network.decimals, ); @@ -312,7 +313,7 @@ export const useStakeEthForm = ({ selectedAccount }: UseStakeFormsProps): StakeC const fiatValue = currentRate ? toFiatCurrency(max, localCurrency, { - [currentRate.locale]: currentRate?.rate, + [localCurrency]: currentRate?.rate, }) : ''; setValue(FIAT_INPUT, fiatValue || '', { shouldValidate: true, shouldDirty: true }); @@ -391,5 +392,6 @@ export const useStakeEthForm = ({ selectedAccount }: UseStakeFormsProps): StakeC export const useStakeEthFormContext = () => { const ctx = useContext(StakeEthFormContext); if (ctx === null) throw Error('useStakeEthFormContext used without Context'); + return ctx; }; diff --git a/packages/suite/src/hooks/wallet/useUnstakeEthForm.ts b/packages/suite/src/hooks/wallet/useUnstakeEthForm.ts index 6e7f754ff7d8..f46dcdf26e08 100644 --- a/packages/suite/src/hooks/wallet/useUnstakeEthForm.ts +++ b/packages/suite/src/hooks/wallet/useUnstakeEthForm.ts @@ -166,7 +166,7 @@ export const useUnstakeEthForm = ({ async (amount: string) => { if (currentRate) { const fiatValue = toFiatCurrency(amount, localCurrency, { - [currentRate.locale]: currentRate?.rate, + [localCurrency]: currentRate?.rate, }); setValue(FIAT_INPUT, fiatValue || '', { shouldValidate: true }); } @@ -184,7 +184,7 @@ export const useUnstakeEthForm = ({ const cryptoValue = fromFiatCurrency( amount, localCurrency, - { [currentRate.locale]: currentRate?.rate }, + { [localCurrency]: currentRate?.rate }, network.decimals, ); setValue(CRYPTO_INPUT, cryptoValue || '', { shouldDirty: true, shouldValidate: true }); @@ -253,5 +253,6 @@ export const useUnstakeEthForm = ({ export const useUnstakeEthFormContext = () => { const ctx = useContext(UnstakeEthFormContext); if (ctx === null) throw Error('useUnstakeEthFormContext used without Context'); + return ctx; };