[pull] main from MetaMask:main#314
Merged
Merged
Conversation
<!-- 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? --> This PR aims to update minimum BTC amount for send flow. As this is a new feature we will release - I will skip adding any changelog record. ## **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: #22337 ## **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** - [ ] 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] > Lowers the Bitcoin minimum send amount validation to 0.000006 BTC and updates related tests. > > - **Validation**: > - Update `MINIMUM_BITCOIN_TRANSACTION_AMOUNT` to `0.000006` in `useAmountValidation.ts`. > - `isValidBitcoinAmount` now validates against the new threshold. > - **Tests**: > - Adjust BTC threshold cases in `useAmountValidation.test.ts` for below (`0.000005`) and at (`0.000006`) minimum values. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b0da6a3. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Respect safe area in full screen confirmations to accommodate navigation controls. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: [#6161](MetaMask/MetaMask-planning#6161) ## **Manual testing steps** ## **Screenshots/Recordings** ### **Before** ### **After** <img width="300" alt="Confirmation" src="https://github.com/user-attachments/assets/c3e931ba-0224-4eb9-95b8-7046e6523b90" /> ## **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] > Wrap full-screen confirmation and custom-amount loader in SafeAreaView and switch layout to flex to respect device safe areas. > > - **UI/Behavior**: > - Wrap full-screen confirmation (`ConfirmationUIType.FLAT`) and custom-amount loader with `SafeAreaView` using edges `['right','bottom','left']`. > - **Styles**: > - Replace absolute positioning in `styles.flatContainer` with `flex: 1` for proper layout with safe areas. > - **Code Cleanup**: > - Type improvement for `styles` prop (`ReturnType<typeof styleSheet>`); remove unnecessary `StyleSheet` import and TS expect-error comments. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 643c9a4. 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**. This PR consolidates recent changes to improve the sponsored transaction flow, prioritizing Smart Transactions (STX) over EIP-7702, and properly handling insufficient-funds alerts for sponsored transactions. We now consistently favor sponsored flows via STX whenever available. If STX is disabled or unsupported, we fall back to 7702, and only if neither is available do we proceed with a standard transaction. In addition, the `isSponsored` flag logic was refined to accurately reflect when sponsorship is actually used, enabling correct tracking in the activity UI. We also ensure the UI uses the correct sponsorship-support logic (`useGaslessSupported`) when determining whether to display gas inputs. Lastly, the insufficient-funds alert logic has been updated to account for sponsored flows, which previously weren’t considered. Related PRs from extension: - MetaMask/metamask-extension#37300 - MetaMask/metamask-extension#37117 <!-- 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: Fixed order of STX over 7702 for sponsored transactions and improved sponsorship detection in the UI ## **Related issues** Fixes: MetaMask/mobile-planning#2363 ## **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** - [ ] 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] > Centralizes gasless support logic with new hooks, prioritizes Smart Transactions over EIP-7702, updates UI and insufficient-balance alert behavior, and streamlines publish fallback; adds focused tests. > > - **Gasless support logic**: > - Add `useGaslessSupportedSmartTransactions` to determine STX gasless eligibility (`isSmartTransaction`, `isSupported`, `pending`). > - Refactor `useIsGaslessSupported` to use the above and only check 7702 (atomic batch + relay + non-deploy) when STX gasless isn’t supported. > - **Transaction confirm flow** (`useTransactionConfirm`): > - Use new hooks; set `waitForResult` based on `isSmartTransaction`. > - For STX: append batch transfer and gas fields; for 7702: mark `isExternalSign`. > - In both paths, set `txMeta.isGasFeeSponsored` only if gasless is actually supported. > - **UI**: > - Gas fee row (`gas-fee-details-row.tsx`): show sponsorship (“Paid by MetaMask”) only when gasless is supported; otherwise show regular fees. > - Insufficient-balance alert: suppress when transaction is sponsored and gasless is supported. > - **Controller** (`transaction-controller-init.ts`): > - Publish: delegate to 7702 only when not STX or chain doesn’t support send bundle; remove dependency on `isGasFeeSponsored`. > - **Tests**: > - Add/modify tests for new hooks, alert behavior, confirm flow, and gasless support gating. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 6ec4cea. 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**
This bumps the Snaps packages, which mainly contain some bug fixes, and
the addition of client and platform versions in `snap_getClientStatus`.
## **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: Include client version and platform version in
`snap_getClientStatus` response.
## **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]
> Upgrades Snaps packages and adds version reporting for
`snap_getClientStatus` via middleware `getVersion`, with new e2e
assertions; removes unused `dynamicPermissions` from SnapController
init.
>
> - **Snaps middleware**:
> - Add `getVersion` using `react-native-device-info`, formatting by
`METAMASK_BUILD_TYPE` in `app/core/Snaps/SnapsMethodMiddleware.ts`.
> - **Snap controller init**:
> - Remove `dynamicPermissions` argument and
`Caip25EndowmentPermissionName` import in
`app/core/Engine/controllers/snaps/snap-controller-init.ts` (tests
updated accordingly).
> - **E2E tests**:
> - Add `checkClientStatus` helper to verify JSON and version prefix in
`e2e/pages/Browser/TestSnaps.ts`.
> - Update `e2e/specs/snaps/test-snap-client-status.spec.ts` to assert
`clientVersion` (from `package.json`) and `platformVersion` (from
`@metamask/snaps-sdk`).
> - **Dependencies**:
> - Bump `@MetaMask/snaps-*` and `@metamask/preinstalled-example-snap`
versions in `package.json` (lockfile updated).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2b20fc6. 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?
-->
This PR fixes an issue where delegation was failing in certain cases due
to the wallet address being lowercased. The lowercase format did not
comply with the SIWE (Sign-In With Ethereum) standard required by the
delegation flow.
Additionally, this update includes a fix for assets that were not
enabled, ensuring consistent behavior across all supported assets.
## **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: Delegation failing due to lowercased wallet address not
complying with SIWE standard
CHANGELOG entry: Handling of not-enabled assets in the delegation flow
## **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**
- [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]
> Use checksummed EVM addresses for delegation, filter external wallets
with zero/invalid allowances, and only update token priority when
delegation amount > 0, with corresponding tests.
>
> - **Hooks**:
> - `useCardDelegation`: Use `safeToChecksumAddress` for non-Solana
networks; keep raw address for Solana.
> - **SDK**:
> - `CardSDK.getCardExternalWalletDetails`: Filter out wallets with
unsupported networks or zero/invalid `allowance` using `isZeroValue`;
maintain priority mapping and sorting.
> - **UI**:
> - `SpendingLimit`: Only call `updateTokenPriority` when external
wallet details exist and `delegationAmount` is non-zero; otherwise clear
`card-external-wallet-details` cache.
> - **Tests**:
> - Add/expand tests covering checksummed vs raw addresses,
zero/hex-zero allowances filtering, and skipping `updateTokenPriority`
when delegation amount is 0/`0x0`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b03ccdc. 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 : )