diff --git a/src/javascript/app/common/helpers.js b/src/javascript/app/common/helpers.js index b9d5ad48457..eed46e0fb80 100644 --- a/src/javascript/app/common/helpers.js +++ b/src/javascript/app/common/helpers.js @@ -7,6 +7,7 @@ import { getLocalTime } from '../base/clock'; import common_independent from '../pages/trade/common_independent'; import Defaults, { PARAM_NAMES } from '../pages/trade/defaults'; import { triggerSessionChange } from '../hooks/events'; +import { isCryptocurrency } from '../../_common/base/currency_base'; const parseData = (raw_data) => !raw_data ? '' : parse(raw_data); @@ -130,7 +131,12 @@ const paramsMap = { const setDefaultParams = (elementId, value) => { if (paramsMap[elementId]) { - Defaults.set(paramsMap[elementId], value); + const currency = Defaults.get(PARAM_NAMES.CURRENCY); + if (elementId === 'amount' && isCryptocurrency(currency)) { + Defaults.set('amount_crypto', value); + } else { + Defaults.set(paramsMap[elementId], value); + } triggerSessionChange(); } }; diff --git a/src/javascript/app/pages/form/currency-dropdown.jsx b/src/javascript/app/pages/form/currency-dropdown.jsx index 4319d0b57a1..7ee4d845336 100644 --- a/src/javascript/app/pages/form/currency-dropdown.jsx +++ b/src/javascript/app/pages/form/currency-dropdown.jsx @@ -1,15 +1,21 @@ import React from 'react'; import { CustomDropdown, DropdownItem, DropdownTitle, useDropdown } from '@deriv-com/quill-ui'; import { setDefaultParams } from '../../common/helpers'; +import { localize } from '../../../_common/localize'; const CurrencyContent = ({ currency_list, currency, onUpdate, elementId }) => { const { close } = useDropdown(); + const getCurrencyGroupMap = { + fiat : localize('Fiat'), + crypto: localize('Crypto'), + }; + return (