-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix(perps): route deposit flow to redesigned confirmations with perps header cp-7.69.0 #27106
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
Changes from all commits
276592f
6ac4967
c0976a5
b8df207
48571b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,8 +19,9 @@ import { useIsPerpsBalanceSelected } from './useIsPerpsBalanceSelected'; | |
| import { usePerpsPaymentToken } from './usePerpsPaymentToken'; | ||
| import Routes from '../../../../constants/navigation/Routes'; | ||
| import { usePerpsTrading } from './usePerpsTrading'; | ||
| import { useNavigation } from '@react-navigation/native'; | ||
| import useApprovalRequest from '../../../Views/confirmations/hooks/useApprovalRequest'; | ||
| import { usePerpsNetworkManagement } from './usePerpsNetworkManagement'; | ||
| import { useConfirmNavigation } from '../../../Views/confirmations/hooks/useConfirmNavigation'; | ||
|
|
||
| /** URI for the perps balance token icon, shared with PerpsPayRow and pay-with modal. */ | ||
| const resolvedPerpsIcon = Image.resolveAssetSource(perpsPayTokenIcon); | ||
|
|
@@ -46,27 +47,38 @@ export function usePerpsBalanceTokenFilter(): ( | |
| const formatFiat = useFiatFormatter({ currency: 'usd' }); | ||
|
|
||
| const { depositWithConfirmation } = usePerpsTrading(); | ||
| const { ensureArbitrumNetworkExists } = usePerpsNetworkManagement(); | ||
| const { navigateToConfirmation } = useConfirmNavigation(); | ||
|
|
||
| const isPerpsDepositAndOrder = hasTransactionType(transactionMeta, [ | ||
| TransactionType.perpsDepositAndOrder, | ||
| ]); | ||
|
|
||
| const { onReject: handleReject } = useApprovalRequest(); | ||
| const { ensureArbitrumNetworkExists } = usePerpsNetworkManagement(); | ||
|
|
||
| const navigation = useNavigation(); | ||
|
|
||
| const handlePerpsDepositPress = useCallback(() => { | ||
| ensureArbitrumNetworkExists() | ||
| .then(() => { | ||
| navigateToConfirmation({ stack: Routes.PERPS.ROOT }); | ||
| handleReject(); | ||
| return depositWithConfirmation(); | ||
| }) | ||
| .catch((_err) => { | ||
| .then(() => { | ||
| navigation.navigate( | ||
| Routes.FULL_SCREEN_CONFIRMATIONS.REDESIGNED_CONFIRMATIONS, | ||
| { | ||
| showPerpsHeader: true, | ||
| }, | ||
| ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded
|
||
| }) | ||
| .catch(() => { | ||
| // Deposit flow handles errors (e.g. user rejection or missing network). | ||
| // ensureArbitrumNetworkExists errors are logged inside the hook itself. | ||
| }); | ||
| }, [ | ||
| ensureArbitrumNetworkExists, | ||
| navigateToConfirmation, | ||
| navigation, | ||
| depositWithConfirmation, | ||
| handleReject, | ||
| ensureArbitrumNetworkExists, | ||
| ]); | ||
|
|
||
| const { onPaymentTokenChange: onPerpsPaymentTokenChange } = | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.