[pull] main from MetaMask:main#374
Merged
Merged
Conversation
## **Description** Migrates the changelog-related GitHub Actions workflows from **reusable workflows** to **composite actions** format, as required by github-tools v1.0.0+ breaking change. **Reason for the change:** - github-tools v1.0.0 introduced a breaking change that migrated all reusable workflows to composite actions - The old commit SHA references (`@36dc168...`, `@6a04e4d...`) pointed to the pre-migration workflow format - To use v1.1.0 (which includes auto-changelog v5.2.0), we must use the new composite action format **Changes made:** | Workflow | Before | After | |----------|--------|-------| | `create-release-pr.yml` | `uses: .../workflows/create-release-pr.yml@6a04e4d...` | `uses: .../actions/create-release-pr@v1.1.0` | | `update-release-changelog.yml` | `uses: .../workflows/update-release-changelog.yml@36dc168...` | `uses: .../actions/update-release-changelog@v1.1.0` | **Benefits of v1.1.0:** - Includes `@metamask/auto-changelog` v5.2.0 with improved commit deduplication - Adds deduplication for commits with no PR number in subject (non-"Squash & Merge" commits) - Merge commits are now deduplicated using commit body instead of the generic merge subject ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: [INFRA-3081](https://consensyssoftware.atlassian.net/browse/INFRA-3081) See: https://github.com/MetaMask/github-tools/releases/tag/v1.1.0 See: https://github.com/MetaMask/github-tools/releases/tag/v1.0.0 (breaking change) ## **Manual testing steps** ```gherkin Feature: Changelog workflow migration Scenario: update-release-changelog workflow runs successfully Given a release branch exists (release/x.y.z format) When a commit is pushed to the release branch Then the update-release-changelog workflow triggers And it uses github-tools v1.1.0 composite action And a changelog PR is created/updated Scenario: create-release-pr workflow runs successfully Given the workflow is triggered manually with a semver version When the workflow executes Then it uses github-tools v1.1.0 composite action And a release PR is created with updated changelog ``` ## **Testing Evidence** ✅ **Tested in fork repository:** [consensys-test/metamask-mobile-test](https://github.com/consensys-test/metamask-mobile-test) | Test | Status | Link | |------|--------|------| | `update-release-changelog` workflow | ✅ Passed | [Action Run #2](https://github.com/consensys-test/metamask-mobile-test/actions/runs/19763663101/job/56631269712) | **Test Results:** - Workflow successfully downloaded `MetaMask/github-tools@v1.1.0` - All input parameters passed correctly (`release-branch`, `platform`, `github-tools-version: v1.1.0`) - Repository checkout completed with full history - PR creation failed as expected due to fork token permissions (not a workflow issue) ## **Screenshots/Recordings** ### **Before** N/A - CI/CD workflow migration ### **After** N/A - CI/CD workflow migration ## **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 - [ ] 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. [INFRA-3081]: https://consensyssoftware.atlassian.net/browse/INFRA-3081?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Migrates `create-release-pr` and `update-release-changelog` workflows from reusable workflows to github-tools composite actions v1.1.0, adjusting runners, permissions, and inputs. > > - **CI Workflows**: > - **`create-release-pr.yml`**: > - Replace reusable workflow (`.../workflows/create-release-pr.yml@<sha>`) with composite action `MetaMask/github-tools/.github/actions/create-release-pr@v1.1.0`. > - Add `runs-on: ubuntu-latest` and explicit `steps` block. > - Move tokens/creds to action inputs (`github-token`, `google-application-creds-base64`); retain `contents`/`pull-requests` permissions; remove `id-token`. > - **`update-release-changelog.yml`**: > - Replace reusable workflow (`.../workflows/update-release-changelog.yml@<sha>`) with composite action `MetaMask/github-tools/.github/actions/update-release-changelog@v1.1.0`. > - Add `runs-on: ubuntu-latest` and explicit `steps` block. > - Set inputs: `release-branch`, `repository-url`, `platform`, `previous-version-ref: 'null'`, `github-tools-version: v1.1.0`, `github-token`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5a558d0. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** This PR fixes a bug in the ramp smart routing logic. The condition was checking for `FIAT_ORDER_PROVIDERS.TRANSAK` which is a deprecated provider value. The current valid provider values are only `AGGREGATOR` and `DEPOSIT`. When an order comes from Transak through the aggregator, the correct way to identify it is by checking `order.data.provider.id` for a substring containing "transak" (case-insensitive). **Changes:** - Added `isTransakAggregatorOrder` helper function to correctly identify Transak orders from the aggregator - Updated the routing condition to use the new helper instead of the deprecated `FIAT_ORDER_PROVIDERS.TRANSAK` - Updated tests to use proper mock data structure with `data.provider.id` instead of deprecated provider enum values ## **Changelog** CHANGELOG entry: Fixed Buy decision to deposit according to last provider used ## **Related issues** Fixes: #23547 ## **Manual testing steps** ```gherkin Feature: Ramp Smart Routing Scenario: user is routed to Deposit when last completed order was from Transak via Aggregator Given user has a completed order from Transak via the Aggregator And deposit is supported in user's region When user opens the Buy flow Then user is routed to the Deposit flow Scenario: user is routed to Aggregator when last completed order was from non-Transak provider Given user has a completed order from MoonPay via the Aggregator And deposit is supported in user's region When user opens the Buy flow Then user is routed to the Aggregator flow ``` ## **Screenshots/Recordings** ### **Before** N/A - Logic change, no UI changes ### **After** N/A - Logic change, no UI changes ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Fixes routing by detecting Transak via aggregator using nested provider id and updates tests to reflect the new data shape and scenarios. > > - **Core logic (`app/components/UI/Ramp/hooks/useRampsSmartRouting.ts`)**: > - Add `isTransakAggregatorOrder` to detect Transak when `provider === AGGREGATOR` via `order.data.provider.id` (case-insensitive substring match). > - Update routing: route to `DEPOSIT` if last completed order is `DEPOSIT` or `isTransakAggregatorOrder(order)`; otherwise `AGGREGATOR`. > - **Tests (`app/components/UI/Ramp/hooks/useRampsSmartRouting.test.ts`)**: > - Refactor mocks to include nested provider id; add `createAggregatorOrder` helper. > - Update/expand scenarios for Transak via aggregator (including substring and casing), non-Transak aggregator, legacy providers, missing nested provider, sorting/lifecycle, and region/error handling. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit fcdac28. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Removed the default background color from BottomSheetFooter component styles as part of bottom sheet updates. This change removes the explicit `backgroundColor: theme.colors.background.default` from the BottomSheetFooter styles to allow the background color to be controlled at the bottom sheet dialog level. The changes include: - Removed `backgroundColor` property from BottomSheetFooter base styles - Removed unused `theme` parameter from stylesheet function - Updated 18 snapshot files across various components that use BottomSheetFooter This follows the same pattern as #23355, which removed the HeaderBase background color. ## **Changelog** CHANGELOG entry: null ## **Related issues** Related to #23355 (similar background color removal for HeaderBase) ## **Manual testing steps** ```gherkin Feature: BottomSheetFooter background color Scenario: BottomSheetFooter renders without explicit background color Given user is on any screen with bottom sheet components When user opens a bottom sheet with a footer Then the footer should render without an explicit background color And the background should inherit from parent bottom sheet ``` ## **Screenshots/Recordings** N/A - Style-only change, no visual differences expected as background color will inherit from parent ### **Before** Footer had explicit white background color set <img width="200" height="846" alt="Screenshot 2025-11-28 at 7 21 46 AM" src="https://github.com/user-attachments/assets/40a57b12-d770-475a-b12c-df84e95eee48" /><img width="200" height="838" alt="Screenshot 2025-11-28 at 7 21 53 AM" src="https://github.com/user-attachments/assets/e1426cd5-f040-46b1-a32f-b495a6d1f33a" /> ### **After** Footer background color controlled by parent bottom sheet dialog <img width="200" height="846" alt="Screenshot 2025-11-28 at 7 21 46 AM" src="https://github.com/user-attachments/assets/40a57b12-d770-475a-b12c-df84e95eee48" /><img width="200" height="838" alt="Screenshot 2025-11-28 at 7 21 53 AM" src="https://github.com/user-attachments/assets/e1426cd5-f040-46b1-a32f-b495a6d1f33a" /> ## **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 - [ ] 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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Removes the default background color from BottomSheetFooter and updates dependent snapshots accordingly. > > - **Component Library**: > - **BottomSheetFooter**: Remove `backgroundColor` from `base` style in `app/component-library/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.styles.ts` and drop unused `theme` param. > - **Tests/Snapshots**: > - Update snapshots across multiple consumers (e.g., `Bridge/QuoteExpiredModal`, `SlippageModal`, `ConfirmAddAsset`, `Earn/LendingLearnMoreModal`, `NetworkModal`, `NetworkVerificationInfo`, `PerpsBottomSheetTooltip`, `Ramp/Aggregator/Quotes`, `Stake/GasImpactModal`, `Stake/PoolStakingLearnMoreModal`, `AccountSelector`, `DataCollectionModal`, `ApprovalResult`, `TemplateConfirmation`) to reflect footer without explicit background color. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e7c23c6. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description**
This PR fixes sentence case violations in lines 1001-2000 of the
`locales/languages/en.json` file as part of ongoing content papercut
improvements. The changes convert Title Case strings to Sentence case
following standard capitalization conventions.
**What is the reason for the change?**
Content consistency and adherence to proper sentence case formatting
across the app.
**What is the improvement/solution?**
Updated 52 locale keys from Title Case to Sentence case, and updated all
affected test files to match the new casing.
## **Changelog**
CHANGELOG entry: Fixed sentence case violations in English locale
strings lines 1001-2000
## **Related issues**
Fixes: Part of content papercut improvements batch 2
## **Manual testing steps**
\`\`\`gherkin
Feature: Locale string display
Scenario: user views UI elements with updated locale strings
Given the app is running with the updated locale file
When user navigates to various screens (Perps, Predict, deposits,
withdrawals, etc.)
Then all text labels should display in proper sentence case format
And no Title Case violations should appear in the affected strings
\`\`\`
## **Screenshots/Recordings**
N/A - This is a content-only change with no visual differences beyond
text casing
### **Before**
Text displayed in Title Case (e.g., "Deposit Preview", "Order Placed
Successfully", "Account Summary", "Market Details")
### **After**
Text displayed in Sentence case (e.g., "Deposit preview", "Order placed
successfully", "Account summary", "Market details")
## **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.
---
## **Technical Details**
### Changes Made:
- **Locale file**: Updated 52 keys in \`locales/languages/en.json\`
(lines 1001-2000)
- **Test files**: Updated 3 test files with hardcoded string assertions
- **Snapshots**: Auto-regenerated snapshots to match new casing
### Affected Areas:
- Perps deposit flows
- Perps order management
- Perps position management
- Perps market details
- Perps tooltips and errors
- Predict market details
- Connection error handling
- Cross margin warnings
- Account summary displays
### Validation:
- All affected unit tests pass
- No old Title Case strings remain in updated test files
- Changes are purely cosmetic (text casing only)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Converts Title Case to sentence case across perps/predict locale
strings and aligns affected tests; also adds a new "spread" tooltip
entry.
>
> - **Localization (en.json)**:
> - Convert numerous perps and predict strings to sentence case (e.g.,
`position.list.empty_title`, `order.title`, `market.details.title`,
buttons, errors).
> - Add `perps.tooltips.spread` with `title` and `content`.
> - **Tests**:
> - Update `PerpsPositionsView.test.tsx` expectations (e.g., `Account
summary`, `Open positions`, empty states) to sentence case.
> - Update `PerpsCrossMarginWarningBottomSheet.test.tsx` title to
sentence case.
> - Update `usePerpsToasts.test.ts` labels/buttons (e.g., "Something
went wrong", "Go back").
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5179f21. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> These changes fixes and improves the following: - Includes `extraSources` to account for when generating EAS fingerprint, which is used for finding cached native binaries in CI - Extend sources to include for determining e2e runs for CI - Updated `generateAndroidBinary` in `build.sh` script to support building test APKs - Remove invalid `release` METAMASK_BUILD_TYPE along with associated scripts and docs - Bump Android build APK step from `lg` to `xl` to fix Daemon OOM issue RC build - https://app.bitrise.io/build/b53df208-120b-45cc-981c-edf17982a7d5 expo dev pipeline - https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/da49bed2-c7d0-413b-8af8-1a509896107d ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: #22751 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **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** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] 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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Enables fingerprint-based APK caching and repack in E2E builds, adds `fingerprint.config.js`, broadens change-detection filters, refactors Android build to produce test APKs, and removes legacy `release` build type/scripts. > > - **CI/Workflows**: > - **Android E2E build**: Enable fingerprint generation and cache restore; add repack step; cache artifacts; bump runner to `24.04-xl`; use `gradle.properties.github`. > - **Change detection**: Broaden `needs-e2e-build` shared filters to include `scripts/setup.mjs`, `patches/**`, `.yarn/patches/**`, `.github/workflows/**`, `.github/scripts/**`, and `react-native.config.js`. > - **Build scripts**: > - Refactor `scripts/build.sh` `generateAndroidBinary` to assemble test APKs (Debug/e2e), set `-DtestBuildType`, optimize e2e to `x86_64`, and verify outputs. > - Remove legacy `release`/`releaseE2E` paths and helpers; simplify Sentry props selection; always update Expo channel. > - **Tooling**: > - Add `fingerprint.config.js` with `extraSources` for `.yarn/patches`, GitHub workflows/scripts, `react-native.config.js`, `scripts/build.sh`, and `scripts/setup.mjs`. > - Update `CODEOWNERS` to cover `fingerprint.config.js`. > - **Package/scripts cleanup**: > - Remove obsolete release scripts from `package.json`. > - **Docs**: > - Delete `RELEASE.MD`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit cae78a0. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Merge Verion Bump PRs to main on "merge my PR" comment. https://consensyssoftware.atlassian.net/browse/INFRA-3000 Testing: Stable Sync PR: consensys-test#57, https://github.com/consensys-test/metamask-mobile-test-workflow/actions/runs/19863362645/job/56919203621 Version Bump PR: consensys-test#58, https://github.com/consensys-test/metamask-mobile-test-workflow/actions/runs/19868119714 ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] 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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds GitHub workflows to auto-merge version-bump and stable-main PRs on "Merge my PR" comment, pinning to a new reusable workflow ref and enforcing branch patterns/base. > > - **Workflows (GitHub Actions)**: > - **New**: `.github/workflows/merge-version-bump-pr.yml` > - Auto-merges on comment "Merge my PR" using reusable workflow `merge-approved-pr.yml@7c0ab4d...` > - Enforces `required-base-branch: 'main'` and `head-branch-pattern: '^version-bump/[0-9]+\.[0-9]+\.[0-9]+$'`. > - **Updated**: `.github/workflows/merge-stable-sync-pr.yml` > - Rename to "Merge Stable Sync PR" and bump reusable workflow ref to `@7c0ab4d...`. > - Add `required-base-branch: 'main'` and `head-branch-pattern: '^stable-main-[0-9]+\.[0-9]+\.[0-9]+$'`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d74775a. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…ed calculations (#23543) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Add fee percentage tracking and fix max bet amount calculations to properly account for fees in the prediction betting system. Changes: - Add totalFeePercentage field to PredictFees interface - Implement calculateMaxBetAmount utility to account for fees - Update calculateFees to return totalFeePercentage (0 or FEE_PERCENTAGE) - Fix minimum bet validation to include fees (minimumBetWithFees) - Improve error messaging for insufficient funds vs below minimum - Add conditional error message when balance is below minimum bet - Export MINIMUM_BET constant for reusability Test coverage: - Add comprehensive tests for calculateMaxBetAmount utility - Update all existing tests to include totalFeePercentage in mock fees - Add assertions for totalFeePercentage in fee calculation tests This ensures users can accurately see their maximum bet amount after fees are deducted, preventing order failures due to insufficient funds when fees are applied. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/PRED-342?atlOrigin=eyJpIjoiMzU5NTJmY2I2NjM5NGQ5ZGIyYmFhMzJjM2VhNTY1ZWQiLCJwIjoiaiJ9 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** https://www.loom.com/share/05f87ae8888c4e739819a2b5bdc6c4a5 <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] 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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Track fee percentage in previews, compute fee-adjusted min/max bet amounts, update UI/error messages, and expand tests accordingly. > > - **Predict UI**: > - Add `MINIMUM_BET` constant and compute `minimumBetWithFees` using `fees.totalFeePercentage`. > - Use new `calculateMaxBetAmount` to determine available amount; refine insufficient-funds vs below-minimum messaging. > - Update `PredictBuyPreview` logic and tests for fee-adjusted validation and display. > - **Utils**: > - New `orders.ts`: `generateOrderId`, `calculateMaxBetAmount` (+ comprehensive tests). > - `polymarket/utils.ts`: `calculateFees` now returns `totalFeePercentage`; waive fees sets it to `0`. > - **Types & Providers**: > - Extend `PredictFees` with `totalFeePercentage` and propagate through previews/tests. > - **Localization**: > - Add `predict.order.no_funds_enough` message. > - **Tests**: > - Update/expand unit tests across hooks, provider, utils, and view to include fee percentage and new validation paths. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 92a617e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )