Skip to content

Conversation

@Brunonascdev
Copy link
Contributor

@Brunonascdev Brunonascdev commented Oct 21, 2025

Description

Implements account address validation for the Card feature's "Add Funds" functionality.
The feature now disables swaps when the priority token owner address doesn't match the user's selected EVM or Solana account address.

Changelog

CHANGELOG entry: Disabled "Add Funds" button when priority token address doesn't match selected account on Card feature

Related issues

Fixes:

Manual testing steps

Feature: Card Add Funds Swap Validation

  Scenario: Add Funds button enabled when accounts match
    Given the priority token address matches the selected account
    
    When the Card Home loads
    Then the "Add Funds" button should be enabled

  Scenario: Add Funds button disabled when accounts don't match
    Given the priority token address doesn't match the selected account
    
    When the Card Home loads
    Then the "Add Funds" button should be disabled

  Scenario: EVM addresses compared case-insensitively
    Given an EVM account with address "0x1234...5678"
    And a priority token with address "0xABCD...5678" (different case)
    
    When comparing addresses
    Then they should match (case-insensitive)

  Scenario: Solana addresses compared case-sensitively
    Given a Solana account with address "SolanaAddress123"
    And a priority token with address "solanaaddress123" (different case)
    
    When comparing addresses
    Then they should NOT match (case-sensitive)

Screenshots/Recordings

Before

After

Simulator.Screen.Recording.-.iPhone.16.-.2025-10-20.at.22.24.52.mov

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

Disables the Card Home Add Funds action based on a new address-matching hook, adds disabled styling/tests, and improves SDK error logging for external wallet fetches.

  • Card Home:
    • Integrates useIsSwapEnabledForPriorityToken to gate Add Funds by address match; sets disabled and applies styles.halfWidthButtonDisabled when not allowed.
    • Updates ButtonsSection deps to include isSwapEnabledForPriorityToken.
  • New Hook: useIsSwapEnabledForPriorityToken
    • Returns true when not authenticated; otherwise requires priority token owner address to match selected account (EVM case-insensitive, Solana case-sensitive).
  • Styles: Adds halfWidthButtonDisabled in CardHome.styles.ts.
  • Tests:
    • Adds useIsSwapEnabledForPriorityToken.test.ts covering auth and EVM/Solana comparisons.
    • Extends CardHome.test.tsx to verify Add Funds enabled/disabled behavior and styling; updates snapshots.
  • SDK (CardSDK.ts): Enhances error logging by attempting to parse and log JSON bodies when fetching external and priority wallet details fails.

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

@Brunonascdev Brunonascdev self-assigned this Oct 21, 2025
@Brunonascdev Brunonascdev requested a review from a team as a code owner October 21, 2025 01:25
@Brunonascdev Brunonascdev added the team-card Card Team label Oct 21, 2025
@github-actions
Copy link
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.

cursor[bot]

This comment was marked as outdated.

@github-actions github-actions bot added size-M and removed size-L labels Oct 21, 2025
@sonarqubecloud
Copy link

@Brunonascdev Brunonascdev added this pull request to the merge queue Oct 21, 2025
Merged via the queue into main with commit 2006796 Oct 21, 2025
83 checks passed
@Brunonascdev Brunonascdev deleted the feat/card-handle-swaps branch October 21, 2025 22:47
@github-actions github-actions bot locked and limited conversation to collaborators Oct 21, 2025
@metamaskbot metamaskbot added release-7.59.0 Issue or pull request that will be included in release 7.59.0 release-7.58.0 Issue or pull request that will be included in release 7.58.0 and removed release-7.59.0 Issue or pull request that will be included in release 7.59.0 labels Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.58.0 Issue or pull request that will be included in release 7.58.0 size-M team-card Card Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants