Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shayan/P2PS-1753/refactor exchange rates hook #11034

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
45c42b7
feat: adding new hook for exchange_rates [WIP]
shayan-deriv Oct 30, 2023
16714fd
chore: removed unnecessary parts from the hook
Oct 30, 2023
b078952
feat: refactoring asset-summary [wip]
Oct 31, 2023
48edf35
Merge branch 'master' of github.com:shayan-deriv/deriv-app into shaya…
Oct 31, 2023
bcde04e
feat: adding global provider for handling subscription
Nov 2, 2023
b7f200b
build: added ts-usehooks to hooks package
Nov 2, 2023
e428816
chore: removed unused code
Nov 2, 2023
a727d31
revert: reverted changes in ExchangeRatesProvider
Nov 2, 2023
6177816
fix: updated the context to store rates in localstorage
Nov 3, 2023
a357728
refactor: refactored tradershub with the new hook
Nov 7, 2023
189117b
fix: fixed typescript error
Nov 7, 2023
8e1c8ba
chore: cleaned the code
Nov 7, 2023
cfa8422
fix: resolved merge conflicts
Nov 7, 2023
c5f1f76
refactor: refactored cashier transfer page
Nov 8, 2023
136c2b5
fix: resolved merge conflicts
Nov 8, 2023
0d43d6f
Merge branch 'binary-com:master' into shayan/p2ps-1753/add-target-cur…
shayan-deriv Nov 8, 2023
71e7444
refactor: replace old exchange rate with the new one
niloofar-deriv Nov 8, 2023
ba4626e
refactor: added exchange rate provider
niloofar-deriv Nov 8, 2023
0c59bf7
fix: removed extra imports
niloofar-deriv Nov 8, 2023
a98c5bb
refactor: added usep2pexchangerate hook for avoiding duplications
niloofar-deriv Nov 8, 2023
841dbc8
test: added tests for usep2pexchangerate hook
niloofar-deriv Nov 8, 2023
71a2d94
fix: fixed crypto-fiat-converter.spec.tsx errors
Nov 8, 2023
f33b606
fix: fixed test errors
Nov 8, 2023
66d20b6
Merge pull request #74 from niloofar-deriv/niloo/replace-p2p-exchange…
shayan-deriv Nov 8, 2023
a7df333
fix: resolved merge conflicts
shayan-deriv Nov 8, 2023
ac19f38
refactor: refactored percentage-selector component
shayan-deriv Nov 8, 2023
a6f315a
feat: added test for the new useExchangeRate
shayan-deriv Nov 9, 2023
98a2e58
feat: added new test
shayan-deriv Nov 9, 2023
f9b570e
fix: resolved pr comment
shayan-deriv Nov 9, 2023
1cac9a3
fix: resolved pr comment
shayan-deriv Nov 9, 2023
688465e
fix: fixing cashier page crashing in test link
shayan-deriv Nov 9, 2023
38bdcee
fix: trigger ci build
shayan-deriv Nov 9, 2023
62a438a
Merge branch 'master' of github.com:shayan-deriv/deriv-app into shaya…
shayan-deriv Nov 9, 2023
f9ae4f2
build: updated package-lock.json
shayan-deriv Nov 9, 2023
53b7a06
fix: fixed test failing
shayan-deriv Nov 9, 2023
fce2691
fix: p2p tests
niloofar-deriv Nov 9, 2023
6c88cd2
Merge branch 'binary-com:master' into shayan/p2ps-1753/add-target-cur…
shayan-deriv Nov 9, 2023
abfaa24
fix: conditions
niloofar-deriv Nov 9, 2023
a150738
Merge pull request #75 from niloofar-deriv/niloo/fix-p2p-tests
shayan-deriv Nov 9, 2023
5084c27
fix: floating rate tests
niloofar-deriv Nov 9, 2023
b963da7
Merge pull request #76 from niloofar-deriv/niloo/fix-p2p-tests
shayan-deriv Nov 9, 2023
f8f668b
Merge branch 'master' of github.com:shayan-deriv/deriv-app into shaya…
shayan-deriv Nov 9, 2023
bc084b3
Merge branch 'master' of github.com:shayan-deriv/deriv-app into shaya…
shayan-deriv Nov 9, 2023
88758bb
fix: resolved pr comments
shayan-deriv Nov 10, 2023
13bf723
Merge branch 'binary-com:master' into shayan/p2ps-1753/add-target-cur…
shayan-deriv Nov 10, 2023
5f5f79e
fix: fixed test failing
shayan-deriv Nov 10, 2023
9404a4d
fix: resolved pr comments
shayan-deriv Nov 10, 2023
e10a0d7
fix: minor fixes
shayan-deriv Nov 10, 2023
cd761df
revert: revert my latest changes for useTotalAccountBalance
shayan-deriv Nov 10, 2023
cb3241a
fix: bug fixed
shayan-deriv Nov 10, 2023
559d465
fix: checking p2p issue
shayan-deriv Nov 10, 2023
7fac83b
Merge branch 'binary-com:master' into shayan/p2ps-1753/add-target-cur…
shayan-deriv Nov 14, 2023
6e31900
Merge branch 'master' of github.com:binary-com/deriv-app into shayan/…
shayan-deriv Nov 14, 2023
e7d12bd
Merge branch 'master' of github.com:binary-com/deriv-app into shayan/…
shayan-deriv Nov 16, 2023
84eefa5
chore: removed console.log
shayan-deriv Nov 16, 2023
7ef704e
fix: fixed crypto withdrawal issue
shayan-deriv Nov 16, 2023
565fdeb
Merge branch 'master' of github.com:binary-com/deriv-app into shayan/…
shayan-deriv Nov 17, 2023
4351f84
chore: removed asset-summary legacy code
shayan-deriv Nov 17, 2023
94dbce6
chore: renamed some variables
shayan-deriv Nov 17, 2023
6775a12
chore: removed legacy useExchangeRate and useTotalAccountBalance hook…
shayan-deriv Nov 17, 2023
eb255f2
refactor: removed legacy code for exchange_rate call
shayan-deriv Nov 17, 2023
848570b
fix: fixing build error
shayan-deriv Nov 17, 2023
898881b
test: removed my-ads-row-renderer test
shayan-deriv Nov 17, 2023
1c41f62
chore: renamed the variables
shayan-deriv Nov 17, 2023
71b5918
chore: removed unused code
shayan-deriv Nov 17, 2023
4074579
fix: added new line at the end of package.json
shayan-deriv Nov 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { isDesktop, isMobile } from '@deriv/shared';
import { splitValidationResultTypes } from '../../real-account-signup/helpers/utils';
import PersonalDetails from '../personal-details';
import { shouldShowIdentityInformation, isDocumentTypeValid, isAdditionalDocumentValid } from 'Helpers/utils';
import { StoreProvider, mockStore } from '@deriv/stores';
import { StoreProvider, mockStore, ExchangeRatesProvider } from '@deriv/stores';

jest.mock('Assets/ic-poi-name-dob-example.svg', () => jest.fn(() => 'PoiNameDobExampleImage'));

Expand Down Expand Up @@ -289,7 +289,9 @@ describe('<PersonalDetails/>', () => {
const mock_store = mockStore({});
render(
<StoreProvider store={mock_store}>
<BrowserRouter>{component}</BrowserRouter>
<ExchangeRatesProvider>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to inject the provider in many places? isn't it defeat the purpose of having a provider?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are only using it at the top level of each package which is app.tsx the other places are in the test files.
first I tried to have the whole context and provider in core package but I faced many errors . that's why I moved it to hooks package.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if there are any general rules/plans around using hooks vs using providers vs both for serving the data?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(just noticed that approach does not seem to be consistent across different parts of deriv-app)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wojciech-deriv so you mean instead of having the useExchangeRate for getting the exchange_rates, we directly get them using useContext()?

I don't think there's is any general rules in the project.
for my case I first tried to just use a hook and handle the api call in it but we could not connect it to the component state and in some cases the subscribe() was not called. that's why @yashim-deriv suggested to use a context for handling the subscriptions( for now it's only handling exchange_rates call but we could make it more general for being used for al subscription calls)

as far a I checked we are using the third approach ( providers + hook ) in the wallet project.
please check APIProvider, APIContext, and useAPI in packages/api

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @markwylde-deriv

<BrowserRouter>{component}</BrowserRouter>
</ExchangeRatesProvider>
</StoreProvider>
);
};
Expand Down
6 changes: 4 additions & 2 deletions packages/appstore/src/components/app.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import CashierStoreProvider from '@deriv/cashier/src/cashier-providers';
import CFDStoreProvider from '@deriv/cfd/src/cfd-providers';
import { StoreProvider } from '@deriv/stores';
import { StoreProvider, ExchangeRatesProvider } from '@deriv/stores';
import AppContent from './app-content';
import './app.scss';

Expand All @@ -15,7 +15,9 @@ const App: React.FC<TProps> = ({ passthrough: { root_store } }) => (
<CashierStoreProvider store={root_store}>
<CFDStoreProvider store={root_store}>
<StoreProvider store={root_store}>
<AppContent />
<ExchangeRatesProvider>
<AppContent />
</ExchangeRatesProvider>
</StoreProvider>
</CFDStoreProvider>
</CashierStoreProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { StoreProvider, mockStore } from '@deriv/stores';
import { StoreProvider, mockStore, ExchangeRatesProvider } from '@deriv/stores';
import { APIProvider /*useFetch*/ } from '@deriv/api';
import MainTitleBar from '..';

Expand Down Expand Up @@ -58,7 +58,9 @@ describe('MainTitleBar', () => {
const mock_store = mockStore({ feature_flags: { data: { wallet: false } } });
const wrapper = ({ children }: React.PropsWithChildren) => (
<APIProvider>
<StoreProvider store={mock_store_override ?? mock_store}>{children}</StoreProvider>
<StoreProvider store={mock_store_override ?? mock_store}>
<ExchangeRatesProvider>{children}</ExchangeRatesProvider>
</StoreProvider>
</APIProvider>
);

Expand Down
shayan-deriv marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ const AssetSummary = observer(() => {
const { current_language } = common;
const { real: platform_real_accounts, demo: platform_demo_account } = usePlatformAccounts();
const { real: cfd_real_accounts, demo: cfd_demo_accounts } = useCFDAccounts();

const platform_real_balance = useTotalAccountBalance(platform_real_accounts);
const cfd_real_balance = useTotalAccountBalance(cfd_real_accounts);
const cfd_demo_balance = useTotalAccountBalance(cfd_demo_accounts);

const is_real = selected_account_type === 'real';

const real_total_balance = platform_real_balance.balance + cfd_real_balance.balance;
const demo_total_balance = (platform_demo_account?.balance || 0) + cfd_demo_balance.balance;

Expand Down
15 changes: 9 additions & 6 deletions packages/appstore/src/modules/traders-hub/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import React from 'react';
import { DesktopWrapper, MobileWrapper, ButtonToggle, Div100vhContainer, Text } from '@deriv/components';
import { isDesktop, routes, ContentFlag } from '@deriv/shared';
Expand Down Expand Up @@ -61,7 +62,7 @@ const TradersHub = observer(() => {
};
if (!is_logged_in) return null;

const renderOrderedPlatformSections = (is_cfd_visible = true, is_options_and_multipliers_visible = true) => {
const OrderedPlatformSections = (is_cfd_visible = true, is_options_and_multipliers_visible = true) => {
return (
<div
data-testid='dt_traders_hub'
Expand All @@ -87,7 +88,9 @@ const TradersHub = observer(() => {
{can_show_notify && <Notifications />}
<div id='traders-hub' className='traders-hub' ref={traders_hub_ref}>
<MainTitleBar />
<DesktopWrapper>{renderOrderedPlatformSections()}</DesktopWrapper>
<DesktopWrapper>
<OrderedPlatformSections />
</DesktopWrapper>
<MobileWrapper>
{is_landing_company_loaded ? (
<ButtonToggle
Expand All @@ -102,10 +105,10 @@ const TradersHub = observer(() => {
) : (
<ButtonToggleLoader />
)}
{renderOrderedPlatformSections(
selected_platform_type === 'cfd',
selected_platform_type === 'options'
)}
<OrderedPlatformSections
is_cfd_visible={selected_platform_type === 'cfd'}
is_options_and_multipliers_visible={selected_platform_type === 'options'}
/>
shayan-deriv marked this conversation as resolved.
Show resolved Hide resolved
</MobileWrapper>
<ModalManager />
{scrolled && <TourGuide />}
Expand Down
5 changes: 4 additions & 1 deletion packages/cashier/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React from 'react';
import AppContent from './app-content';
import CashierProviders from './cashier-providers';
import { ExchangeRatesProvider } from '@deriv/stores';

type TProps = { passthrough: { root_store: React.ComponentProps<typeof CashierProviders>['store'] } };

const App: React.FC<TProps> = ({ passthrough: { root_store } }) => {
return (
<CashierProviders store={root_store}>
<AppContent />
<ExchangeRatesProvider>
<AppContent />
</ExchangeRatesProvider>
</CashierProviders>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @shayan-deriv
could we move ExchangeRatesProvider to CashierProviders ?

);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CryptoFiatConverter from '../crypto-fiat-converter';
import { Formik } from 'formik';
import * as formik from 'formik';
import CashierProviders from '../../../cashier-providers';
import { mockStore } from '@deriv/stores';
import { mockStore, ExchangeRatesProvider } from '@deriv/stores';

describe('<CryptoFiatConverter />', () => {
let mockRootStore: ReturnType<typeof mockStore>, mockProps: React.ComponentProps<typeof CryptoFiatConverter>;
Expand All @@ -16,7 +16,6 @@ describe('<CryptoFiatConverter />', () => {
crypto_fiat_converter: {
converter_from_amount: '100',
converter_to_amount: '200',
is_timer_visible: true,
},
},
},
Expand All @@ -37,9 +36,11 @@ describe('<CryptoFiatConverter />', () => {
const renderCryptoFiatConverter = () => {
return render(
<CashierProviders store={mockRootStore}>
<Formik initialValues={{}} onSubmit={() => Promise.resolve()}>
<CryptoFiatConverter {...mockProps} />
</Formik>
<ExchangeRatesProvider>
<Formik initialValues={{}} onSubmit={() => Promise.resolve()}>
<CryptoFiatConverter {...mockProps} />
</Formik>
</ExchangeRatesProvider>
</CashierProviders>
);
};
Expand All @@ -51,7 +52,6 @@ describe('<CryptoFiatConverter />', () => {
expect(screen.getByText('Amount (USD)')).toBeInTheDocument();
expect(screen.getByText('Transfer limits')).toBeInTheDocument();
expect(screen.getByText('Approximate value')).toBeInTheDocument();
expect(screen.getByText('60s')).toBeInTheDocument();
matin-deriv marked this conversation as resolved.
Show resolved Hide resolved
});

it('should change arrow direction when the focus changes between inputs', () => {
Expand All @@ -74,6 +74,13 @@ describe('<CryptoFiatConverter />', () => {
});

it('should trigger onChange callback when the input field changes', () => {
const mockJson = {
BTC: {
USD: 2.2,
},
};
window.localStorage.setItem('exchange_rates', JSON.stringify(mockJson));

const use_formik_context = jest.spyOn(formik, 'useFormikContext') as any;
use_formik_context.mockReturnValueOnce({ handleChange: jest.fn() });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,10 @@ const CryptoFiatConverter = observer(
validateToAmount,
}: TCryptoFiatConverterProps) => {
const { crypto_fiat_converter } = useCashierStore();
const { getRate } = useExchangeRate();
const { exchange_rates } = useExchangeRate();

const {
converter_from_amount,
converter_from_error,
converter_to_error,
converter_to_amount,
is_timer_visible,
} = crypto_fiat_converter;
const { converter_from_amount, converter_from_error, converter_to_error, converter_to_amount } =
crypto_fiat_converter;

const { handleChange } = useFormikContext();
const [arrow_icon_direction, setArrowIconDirection] = React.useState<string>('right');
Expand All @@ -115,9 +110,8 @@ const CryptoFiatConverter = observer(
setArrowIconDirection('right');
}}
onChange={(e: TReactChangeEvent) => {
const from_rate = getRate(from_currency || '');
const to_rate = getRate(to_currency || '');
const converted_amount = (Number(e.target.value) * to_rate) / from_rate;
const rate = exchange_rates?.[from_currency]?.[to_currency] ?? 1;
const converted_amount = Number(e.target.value) * rate;
onChangeConverterFromAmount(e, from_currency, to_currency, converted_amount);
handleChange(e);
}}
Expand Down Expand Up @@ -154,9 +148,8 @@ const CryptoFiatConverter = observer(
setArrowIconDirection('left');
}}
onChange={(e: TReactChangeEvent) => {
const from_rate = getRate(from_currency || '');
const to_rate = getRate(to_currency || '');
const converted_amount = (Number(e.target.value) * from_rate) / to_rate;
const rate = exchange_rates?.[to_currency]?.[from_currency] ?? 1;
const converted_amount = Number(e.target.value) * rate;
onChangeConverterToAmount(e, to_currency, from_currency, converted_amount);
handleChange(e);
}}
Expand All @@ -171,21 +164,6 @@ const CryptoFiatConverter = observer(
classNameHint='crypto-fiat-converter__hint'
data-testid='dt_converter_to_amount_input'
/>
{is_timer_visible && (
<Timer
onComplete={() => {
const from_rate = getRate(from_currency || '');
const to_rate = getRate(to_currency || '');
const converted_amount = (Number(converter_from_amount) * to_rate) / from_rate;
onChangeConverterFromAmount(
{ target: { value: converter_from_amount } },
from_currency,
to_currency,
converted_amount
);
}}
/>
)}
matin-deriv marked this conversation as resolved.
Show resolved Hide resolved
</InputGroup>
)}
</Field>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { fireEvent, render, screen } from '@testing-library/react';
import PercentageSelector from '../percentage-selector';
import { mockStore } from '@deriv/stores';
import { mockStore, ExchangeRatesProvider } from '@deriv/stores';
import CashierProviders from '../../../cashier-providers';
import CryptoFiatConverter from '../../crypto-fiat-converter';

Expand Down Expand Up @@ -34,7 +34,9 @@ describe('<PercentageSelector />', () => {
it('should render the component', () => {
render(
<CashierProviders store={mockRootStore}>
<PercentageSelector {...percentage_selector_props} />
<ExchangeRatesProvider>
<PercentageSelector {...percentage_selector_props} />
</ExchangeRatesProvider>
</CashierProviders>
);

Expand All @@ -44,7 +46,9 @@ describe('<PercentageSelector />', () => {
it('should calculate the percentage amount on click of percentage block', () => {
render(
<CashierProviders store={mockRootStore}>
<PercentageSelector {...percentage_selector_props} />
<ExchangeRatesProvider>
<PercentageSelector {...percentage_selector_props} />
</ExchangeRatesProvider>
</CashierProviders>
);

Expand All @@ -64,7 +68,9 @@ describe('<PercentageSelector />', () => {
it('should reset the percentage block upon clicking twice', () => {
render(
<CashierProviders store={mockRootStore}>
<PercentageSelector {...percentage_selector_props} />
<ExchangeRatesProvider>
<PercentageSelector {...percentage_selector_props} />
</ExchangeRatesProvider>
</CashierProviders>
);

Expand Down Expand Up @@ -92,7 +98,9 @@ describe('<PercentageSelector />', () => {
it('should reset the percentage', () => {
render(
<CashierProviders store={mockRootStore}>
<PercentageSelector {...percentage_selector_props} should_percentage_reset />
<ExchangeRatesProvider>
<PercentageSelector {...percentage_selector_props} should_percentage_reset />
</ExchangeRatesProvider>
</CashierProviders>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const PercentageSelector = ({
to_currency,
}: TPercentageSelectorProps) => {
const [selected_percentage, setSelectedPercentage] = React.useState<number | string>('0');
const { getRate } = useExchangeRate();
const { exchange_rates } = useExchangeRate();
React.useEffect(() => {
if (should_percentage_reset) {
for (let i = 1; i <= 4; i++) {
Expand All @@ -55,9 +55,9 @@ const PercentageSelector = ({
if (is_percentage_selected) new_percentage -= 25;

setSelectedPercentage(new_percentage || 0);
const from_rate = getRate(from_currency || '');
const to_rate = getRate(to_currency || '');
const converted_amount = (amount * (new_percentage / 100) * to_rate) / from_rate;
const rate = exchange_rates?.[from_currency]?.[to_currency] ?? 1;
const converted_amount = amount * (new_percentage / 100) * rate;

getCalculatedAmount(
(amount * (new_percentage / 100)).toFixed(getDecimalPlaces(from_currency)),
converted_amount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fireEvent, render, screen } from '@testing-library/react';
import { isMobile } from '@deriv/shared';
import AccountTransferForm from '../account-transfer-form';
import CashierProviders from '../../../../cashier-providers';
import { mockStore } from '@deriv/stores';
import { mockStore, ExchangeRatesProvider } from '@deriv/stores';
import { TError } from '../../../../types';

jest.mock('@deriv/shared/src/utils/screen/responsive', () => ({
Expand Down Expand Up @@ -122,7 +122,11 @@ describe('<AccountTransferForm />', () => {

const renderAccountTransferForm = () => {
render(<AccountTransferForm {...props} />, {
wrapper: ({ children }) => <CashierProviders store={mockRootStore}>{children}</CashierProviders>,
wrapper: ({ children }) => (
<CashierProviders store={mockRootStore}>
<ExchangeRatesProvider>{children}</ExchangeRatesProvider>
</CashierProviders>
),
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import AccountPlatformIcon from '../../../components/account-platform-icon';
import { useCashierStore } from '../../../stores/useCashierStores';
import './account-transfer-form.scss';
import AccountTransferReceipt from '../account-transfer-receipt/account-transfer-receipt';
import { useExchangeRate } from '@deriv/hooks';

type TAccountTransferFormProps = {
error?: TError;
Expand Down Expand Up @@ -91,6 +92,7 @@ const AccountTransferForm = observer(
const { is_mobile } = ui;
const { account_limits, authentication_status, is_dxtrade_allowed, getLimits: onMount } = client;
const { account_transfer, crypto_fiat_converter, general_store } = useCashierStore();
const { handleSubscription } = useExchangeRate();

const {
account_transfer_amount,
Expand Down Expand Up @@ -187,6 +189,13 @@ const AccountTransferForm = observer(
return [];
};

React.useEffect(() => {
if (selected_from?.currency && selected_to?.currency) {
const base_currency = selected_from.currency;
const target_currency = selected_to.currency;
handleSubscription(base_currency, target_currency);
}
}, [selected_from, selected_to]);
React.useEffect(() => {
onMount();
}, [onMount]);
Expand Down
Loading