Skip to content

Commit b5784be

Browse files
fix: minimum amount check in perps deposit (#19738)
## **Description** Minimum deposit validation is incorrectly firing as it's also checking the token amount, rather than just the pending input amount. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: [#5819](MetaMask/MetaMask-planning#5819) ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent 59eaa0f commit b5784be

File tree

1 file changed

+15
-2
lines changed
  • app/components/Views/confirmations/external/perps-temp/components/deposit

1 file changed

+15
-2
lines changed

app/components/Views/confirmations/external/perps-temp/components/deposit/deposit.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ const KEYBOARD_ALERTS: AlertKeys[] = [
2222
AlertKeys.PerpsHardwareAccount,
2323
];
2424

25+
const PENDING_AMOUNT_ALERTS: AlertKeys[] = [
26+
AlertKeys.PerpsDepositMinimum,
27+
AlertKeys.InsufficientPayTokenBalance,
28+
];
29+
2530
export function PerpsDeposit() {
2631
useNavbar(strings('confirm.title.perps_deposit'));
2732
useClearConfirmationOnBackSwipe();
@@ -31,12 +36,20 @@ export function PerpsDeposit() {
3136
const { alerts: confirmationAlerts } = useAlerts();
3237
const pendingAlerts = usePerpsDepositAlerts({ pendingTokenAmount });
3338

39+
const filteredConfirmationAlerts = useMemo(
40+
() =>
41+
confirmationAlerts.filter(
42+
(a) => !PENDING_AMOUNT_ALERTS.includes(a.key as AlertKeys),
43+
),
44+
[confirmationAlerts],
45+
);
46+
3447
const alerts = useMemo(
3548
() =>
36-
[...pendingAlerts, ...confirmationAlerts].filter((a) =>
49+
[...pendingAlerts, ...filteredConfirmationAlerts].filter((a) =>
3750
KEYBOARD_ALERTS.includes(a.key as AlertKeys),
3851
),
39-
[confirmationAlerts, pendingAlerts],
52+
[filteredConfirmationAlerts, pendingAlerts],
4053
);
4154

4255
const { isFullView, isPayTokenSelected } = usePerpsDepositView({

0 commit comments

Comments
 (0)