Skip to content

[pull] main from MetaMask:main#367

Merged
pull[bot] merged 2 commits into
Reality2byte:mainfrom
MetaMask:main
Nov 29, 2025
Merged

[pull] main from MetaMask:main#367
pull[bot] merged 2 commits into
Reality2byte:mainfrom
MetaMask:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Nov 29, 2025

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 : )

rarquevaux and others added 2 commits November 29, 2025 00:41
<!--
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 enabled gasless swaps with EIP-7702. This is enable only for
Swaps (Bridges are explicitly excluded). It also enable automatic smart
account upgrade if the user did not upgraded beforehand.

## **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: add support for gas-included swaps with EIP-7702

## **Related issues**

https://consensyssoftware.atlassian.net/browse/STX-263

## **Manual testing steps**

```gherkin
Feature: my feature name

  Scenario: user performs a gasless swap
    Given the user is active on a networks with EIP-7702 support and the feature enabled (Base or Arbitrum)
    And the user has <a smart account/no smart account> in the network and no gas
    When user requests a quote for a swap on the chain
    Then the swap quote indicates the gas fees are included
    When the user submit the swap
    Then the swap is executed successfully
```

## **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).
- [ ] 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 EIP-7702 gasless swap support with new capability hooks and
selectors, updates quote/fee logic and relay flow, and replaces legacy
gasIncluded state.
> 
> - **State/Selectors (bridge slice)**
> - Replace `gasIncluded` with `isGasIncludedSTXSendBundleSupported` and
`isGasIncluded7702Supported` in `BridgeState`.
> - Add `selectGasIncludedQuoteParams` to derive
`gasIncluded`/`gasIncluded7702` (prioritize STX send bundle; use 7702
for same-chain swaps).
> - Export selectors for both support flags; update initial state and
tests.
> 
> - **Hooks**
> - Add `useIsGasIncludedSTXSendBundleSupported` and
`useIsGasIncluded7702Supported` to set capability flags from chain
features.
> - Update `useBridgeQuoteRequest` to use `selectGasIncludedQuoteParams`
and send both `gasIncluded` and `gasIncluded7702`.
> - Update `useBridgeQuoteData` price impact logic to treat gasless when
`gasIncluded` or `gasIncluded7702`.
> - Update `useHasSufficientGas` and `useInsufficientBalance` to treat
7702 as gasless.
> 
> - **UI**
> - `BridgeView`: call new gas-included support hooks based on
`sourceToken?.chainId`.
> - `QuoteDetailsCard`: show “Included” network fee and gasless
price-impact tooltip when `gasIncluded7702` (or `gasIncluded`).
> 
> - **Relay/7702 publish hook**
> - In `delegation-7702-publish`: fetch tx state, clear nonce before
relay, and mark `isIntentComplete` after success; support
gasless/sponsored flows without gas fee tokens.
> 
> - **Tests**
> - Comprehensive updates and new tests for selectors, hooks, UI, and
7702 relay behavior (including nonce clearing and intent complete).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f70cd6e9a277565da614fac0c7647b6f62f7dff0. 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**
Due to previous implementation to have social login to default enable
metametric collection, it is made the metametric logic more complex and
hard to debug.
This PR is to simplify the implementation

The new metametric will always 
- enabled for social login user
- disable for srp user ( user will be prompted meta metricscreen for
consent once wallet is created)

This PR also implement migration from `social login metametric flag`
that is used before to metametric flag so that existing social login
user that updated metamask app will enable metametic flag


Old SRP behavior 
metametric flag is persisted after wallet reseted and create new SRP
wallet
New Behaviour
metametric flag will be default to false when user created SRP wallet (
even if enabled before wallet reset)

<!--
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: Social Login user create wallet will always enable
metametric flag
CHANGELOG entry: SRP user create wallet will always disable metametric
flag by default and prompted metametric screen


## **Related issues**

Fixes: https://consensyssoftware.atlassian.net/browse/SL-312

## **Manual testing steps**

```gherkin
Feature: my feature name

  Scenario: user create new wallet
    Given create wallet with social login
    Then metametric will be enabled
    
   
  Scenario: user create new wallet
    Given create wallet with SRP wallet
    Then metametric will be disabled by default and prompt metamteric screen when wallet created
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->


https://github.com/user-attachments/assets/3fefdc27-4ab7-47bf-817b-a5c8b0fc89c3



https://github.com/user-attachments/assets/e2e1be10-d8fd-427c-9d83-88cc42e109dc


## **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]
> Replaces social-login-specific metrics toggle with a single
MetaMetrics.enable flow, migrates prior social-login opt-in to standard
opt-in, and updates onboarding, settings, tracing, and tests
accordingly.
> 
> - **Analytics/Core**
> - Remove `enableSocialLogin` and related state from `MetaMetrics`;
`isEnabled` now reflects only `enable` state.
> - Update `IMetaMetrics`/hook types and `useMetrics` to expose only
`enable(...)`.
>   - Simplify ID retrieval tests and adjust call order expectations.
> - **Onboarding** (`app/components/Views/Onboarding`)
> - Use `metrics.enable(false)` for SRP create/import and
`metrics.enable(true)` after successful OAuth.
>   - Align tests to expect `enable(true|false)` calls.
> - **Settings** (`MetaMetricsAndDataCollectionSection`)
> - Replace social-login-specific enabling with `enable(...)` for
toggles; keep marketing sync and traits updates.
> - Update tests to reflect new enable behavior across SRP/social flows.
> - **Tracing** (`util/trace.ts`)
> - Consent check now only reads `METRICS_OPT_IN`; remove social-login
opt-in fallback.
> - **Migration**
> - Add migration `108`: if `METRICS_OPT_IN_SOCIAL_LOGIN === AGREED` and
`METRICS_OPT_IN !== AGREED`, set `METRICS_OPT_IN` to `AGREED` and remove
the social-login key.
>   - Register migration and add comprehensive tests.
> - **Tests**
> - Widespread updates removing `enableSocialLogin` mocks/assertions;
add new assertions for `enable(...)` and migration behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
bc4a6aa. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@pull pull Bot locked and limited conversation to collaborators Nov 29, 2025
@pull pull Bot added the ⤵️ pull label Nov 29, 2025
@pull pull Bot merged commit 9a297b4 into Reality2byte:main Nov 29, 2025
1 check failed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants