Skip to content

Conversation

@rarquevaux
Copy link
Contributor

@rarquevaux rarquevaux commented Oct 24, 2025

Description

Fixes issue #21613

This PR is a follow-up fix on #21604

Feature: gasless transaction
  Scenario: successful gasless transaction with 7702 on network without sendBundle support
    Given user with smart account for the network and smart transaction off
    When user submit a gasless transaction
    Then the transaction is sent via relay and is successful

  Scenario: cancelled gasless transaction on network without sendBundle support
    Given user with smart account for the network and smart transaction on
    When user submit a gasless transaction
    Then the transaction is sent via smartTransaction submission and is cancelled

Changelog

CHANGELOG entry:

null

Fixes:

Manual testing steps

https://docs.google.com/spreadsheets/d/1m0xBMr48fXhfuOFnzgm9xw2QG5L4sUm6r4Hqaun29E4/edit?gid=0#gid=0

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

Note

Gate smart-transaction batching by Sentinel sendBundle support and fall back to external-sign gasless flow; add Sentinel API util and expand tests.

  • Confirmations Hook (useTransactionConfirm):
    • Integrates isSendBundleSupported via useAsyncResult to determine chain capability.
    • Applies smart-transaction handling only when shouldUseSmartTransaction and chainSupportsSendBundle are true; otherwise uses gasless 7702 path by setting txMeta.isExternalSign when a selectedGasFeeToken exists.
    • Preserves batch transactions for bridge quotes; updates dependencies to include chainSupportsSendBundle.
  • Utilities:
    • Adds util/transactions/sentinel-api with getSentinelNetworkFlags, isSendBundleSupported, getSendBundleSupportedChains, and buildUrl (fetches from tx-sentinel service).
  • Tests:
    • Mocks useAsyncResult and Sentinel API; wraps confirmations in act.
    • Adds/updates cases for wait-for-result logic, missing metadata, navigation paths, batch transactions, smart vs gasless behavior based on sendBundle support, and undefined chainId handling.

Written by Cursor Bugbot for commit 3206f7d. This will update automatically on new commits. Configure here.

@rarquevaux rarquevaux requested a review from a team as a code owner October 24, 2025 18:39
@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-transactions Transactions team label Oct 24, 2025
@rarquevaux rarquevaux marked this pull request as draft October 24, 2025 18:40
@rarquevaux
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

cursor[bot]

This comment was marked as outdated.

@rarquevaux rarquevaux force-pushed the fix/gasless-logic branch 3 times, most recently from aa55ed0 to ced2989 Compare October 24, 2025 23:00
vinistevam
vinistevam previously approved these changes Oct 27, 2025
Copy link
Contributor

@vinistevam vinistevam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks great. I will add those changes to the Extension PR as well.
Here might help with the coverage to pass the sonar validation.

  it('returns false for chainSupportsSendBundle when chainId is undefined', async () => {
    useTransactionMetadataRequestMock.mockReturnValue({
      id: transactionIdMock,
      chainId: undefined,
    } as unknown as TransactionMeta);

    isSendBundleSupportedMock.mockResolvedValue(true);

    useAsyncResultMock.mockImplementation((fn) => {
      fn();
      return { pending: false, value: false };
    });

    const { result } = renderHook();

    await act(async () => {
      await result.current.onConfirm();
    });

    expect(isSendBundleSupportedMock).not.toHaveBeenCalled();
    expect(onApprovalConfirm).toHaveBeenCalled();
  });

  it('does nothing when transactionMetadata is missing', async () => {
    useTransactionMetadataRequestMock.mockReturnValue(undefined);

    const { result } = renderHook();

    await act(async () => {
      await result.current.onConfirm();
    });

    expect(onApprovalConfirm).not.toHaveBeenCalled();
  });

@rarquevaux rarquevaux marked this pull request as ready for review October 27, 2025 15:00
@rarquevaux rarquevaux requested a review from vinistevam October 27, 2025 15:01
@rarquevaux rarquevaux added regression-RC-7.58.0 Regression bug that was found in release candidate (RC) for release 7.58.0 release-7.59.0 Issue or pull request that will be included in release 7.59.0 labels Oct 27, 2025
@sonarqubecloud
Copy link

@rarquevaux rarquevaux added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Oct 27, 2025
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Oct 27, 2025
@rarquevaux rarquevaux added this pull request to the merge queue Oct 27, 2025
@rarquevaux rarquevaux changed the title fix: gasless transaction submission method selection logic fix: cp-7.58.0 gasless transaction submission method selection logic Oct 27, 2025
Merged via the queue into main with commit e2c9181 Oct 27, 2025
114 of 121 checks passed
@rarquevaux rarquevaux deleted the fix/gasless-logic branch October 27, 2025 18:10
@github-actions github-actions bot locked and limited conversation to collaborators Oct 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed regression-RC-7.58.0 Regression bug that was found in release candidate (RC) for release 7.58.0 release-7.59.0 Issue or pull request that will be included in release 7.59.0 size-M team-transactions Transactions team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants