Skip to content

fix(card): track cashback redeem tx on estimation network#32006

Merged
Brunonascdev merged 3 commits into
mainfrom
fix/card-cashback-redeem-network
Jun 18, 2026
Merged

fix(card): track cashback redeem tx on estimation network#32006
Brunonascdev merged 3 commits into
mainfrom
fix/card-cashback-redeem-network

Conversation

@Brunonascdev

@Brunonascdev Brunonascdev commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description

Cashback withdrawals can now settle on Linea or Monad depending on the user's priority list, but redeem transaction monitoring always polled Linea (0xe708). This caused successful Monad redemptions to appear stuck or fail monitoring.

This PR reads the network field from /v1/wallet/reward/withdraw-estimation, maps it to a chain ID via cardNetworkInfos, and uses that chain when polling for the redeem transaction receipt. Falls back to Linea when the network is missing.

Changelog

CHANGELOG entry: Remove hard-coded Linea polling on Cashback redeeming transaction

Related issues

Fixes: null

Manual testing steps

Feature: Cashback redeem on dynamic network

  Scenario: user redeems cashback when estimation returns monad
    Given the user is authenticated with withdrawable cashback
    And withdraw-estimation returns network "monad"
    When the user completes a cashback withdrawal
    Then the app monitors the redeem tx on Monad (chain 143)
    And the user sees a success toast when the tx confirms

  Scenario: user redeems cashback when estimation returns linea
    Given the user is authenticated with withdrawable cashback
    And withdraw-estimation returns network "linea"
    When the user completes a cashback withdrawal
    Then the app monitors the redeem tx on Linea (chain 59144)
    And the user sees a success toast when the tx confirms

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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

Medium Risk
Changes post-withdraw confirmation UX on the correct chain; scope is limited to Card cashback monitoring with Linea fallback and new tests.

Overview
Cashback redeem transaction monitoring no longer always polls Linea (0xe708). After a withdrawal, the hook uses the network value from withdraw-estimation (typed on UI and Card controller responses), maps it to a chain ID through cardNetworkInfos / safeFormatChainIdToHex, and passes that chain into receipt polling. If network is missing, polling still defaults to Linea.

Unit tests cover Linea, Monad (0x8f), and the missing-network fallback.

Reviewed by Cursor Bugbot for commit 18d10af. Bugbot is set up for automated code reviews on this repo. Configure here.

Use the network field from withdraw-estimation (linea or monad) to
resolve the chain ID for redeem transaction receipt polling instead
of hardcoding Linea.
@Brunonascdev Brunonascdev requested a review from a team as a code owner June 18, 2026 13:46
@Brunonascdev Brunonascdev self-assigned this Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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.

@mm-token-exchange-service mm-token-exchange-service Bot added the team-card Card Team label Jun 18, 2026
@github-actions github-actions Bot added pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. size-M labels Jun 18, 2026
@github-actions github-actions Bot added the risk:low AI analysis: low risk label Jun 18, 2026
@Brunonascdev Brunonascdev enabled auto-merge June 18, 2026 16:57
@Brunonascdev Brunonascdev removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeMoney
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused on the MetaMask Card cashback withdrawal flow:

  1. provider-types.ts (card-controller): Added network field to CashbackWithdrawEstimationResponse - this is a type extension, not a breaking change.
  2. types.ts: Mirrors the same type change in the UI layer.
  3. useCashbackWallet.ts: The key functional change - the startTxPolling function now accepts a chainId parameter and uses resolvePollingChainId() to determine which network to poll based on the estimation response's network field. Previously hardcoded to Linea (0xe708), now supports multiple networks (Linea and Monad). This is a behavioral change in the cashback withdrawal flow.
  4. Test files: Unit tests added/updated to cover the new multi-network polling behavior.

Tag selection rationale:

  • SmokeMoney: Directly covers MetaMask Card flows including cashback/withdrawal functionality. The changed code is in the Card UI component hooks and card-controller types.
  • No other tags are needed as this is isolated to the Card feature's cashback withdrawal flow.
  • The changes don't touch confirmations UI, swap flows, network management UI, or other cross-cutting concerns.
  • The card-controller file is marked critical due to the Controller keyword, but the actual change is a minor type extension (adding a network field) with no breaking changes to the controller's behavior.

Risk assessment: Medium - the functional change in useCashbackWallet.ts modifies which chain is polled for transaction receipts during cashback withdrawal. If resolvePollingChainId returns an incorrect chain ID, withdrawals could appear stuck. However, the logic has good fallback behavior (defaults to Linea) and is well-tested with unit tests.

Performance Test Selection:
The changes are limited to the Card cashback withdrawal flow - specifically adding multi-network support for transaction receipt polling. This is a network I/O operation that doesn't affect app rendering performance, asset loading, onboarding, login, or any other performance-sensitive flows covered by the available performance test tags.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@Brunonascdev Brunonascdev added this pull request to the merge queue Jun 18, 2026
Merged via the queue into main with commit 74ea638 Jun 18, 2026
149 of 150 checks passed
@Brunonascdev Brunonascdev deleted the fix/card-cashback-redeem-network branch June 18, 2026 18:55
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

risk:low AI analysis: low risk size-M team-card Card Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants