-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
base: refactor/trading-middleware
Are you sure you want to change the base?
Conversation
@@ -1,243 +0,0 @@ | |||
import { BuyTrade, BuyTradeQuoteRequest, CryptoId } from 'invity-api'; |
There was a problem hiding this comment.
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 = [ |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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(() => { |
There was a problem hiding this comment.
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(() => { |
There was a problem hiding this comment.
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(() => { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to buyThunks.handleRequestThunk
Some issues with test - https://github.com/trezor/trezor-suite/actions/runs/13496626997/job/37705568914#step:6:473 |
Description
Connect the current trading reducer to the new one.
Related Issue
Resolve #17174