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

refactor(trading): refactor buy section to the new reducer #17175

Open
wants to merge 1 commit into
base: refactor/trading-middleware
Choose a base branch
from

Conversation

adderpositive
Copy link
Contributor

Description

Connect the current trading reducer to the new one.

Related Issue

Resolve #17174

@adderpositive adderpositive added +Invity Related to Invity project chore labels Feb 23, 2025
@adderpositive adderpositive self-assigned this Feb 23, 2025
@adderpositive adderpositive linked an issue Feb 23, 2025 that may be closed by this pull request
@@ -1,243 +0,0 @@
import { BuyTrade, BuyTradeQuoteRequest, CryptoId } from 'invity-api';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deprecated - buy actions are tested in suite-common.

const AVAILABLE_DEVICE = getSuiteDevice({ available: true, connected: true });

export const VERIFY_BUY_ADDRESS_FIXTURES = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The verifying address was refactored to the verifyAddressThunk - tested in suite-common.

@@ -58,25 +55,6 @@ describe('Trading Common Actions', () => {
jest.clearAllMocks();
});

VERIFY_BUY_ADDRESS_FIXTURES.forEach(f => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

-> verifyAddressThunk, also tested there.

@@ -1,171 +0,0 @@
import {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deprecated - refactored version is in suite-common

@@ -85,14 +89,6 @@ export const tradingMiddleware =
);
}

if (isDifferentAccount || !buyInfo) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Loading is handled by loadInitialDataThunk

};

// TODO: trading - is it possible to have buyInfo before render?
useEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Load initial data - before it was in middleware.

useTradingModalCrypto({
receiveCurrency: values.cryptoSelect?.value as CryptoId | undefined,
});

// set payment form method based on quotes
useEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting payment method, extract of the handleRequestThunk

@@ -402,6 +285,19 @@ export const useTradingBuyForm = ({
],
);

useEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added loading status immediately after form change.

@@ -481,15 +378,6 @@ export const useTradingBuyForm = ({
],
);

// eslint-disable-next-line arrow-body-style
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to useTradingHandleChange.

@@ -141,130 +142,12 @@ export const useTradingBuyForm = ({
},
});

const getQuotesRequest = useCallback(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to buyThunks.handleRequestThunk

@adderpositive
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore +Invity Related to Invity project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trading - connect current version of buy section to new one
1 participant