Skip to content

Conversation

pedronfigueiredo
Copy link
Contributor

@pedronfigueiredo pedronfigueiredo commented Oct 3, 2025

Description

Open in GitHub Codespaces

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Screenshot 2025-10-03 at 18 52 30 Screenshot 2025-10-03 at 18 52 12

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

Introduces a new shieldSubscriptionApprove transaction type with a dedicated confirmation UI, enables Shield crypto payments by creating ERC‑20 approve txs, and updates headers, i18n, utilities, tests, and @metamask/transaction-controller.

  • Transaction confirmations:
    • Add TransactionType.shieldSubscriptionApprove to redesigned flow and Info map, with new components (ShieldSubscriptionApproveInfo, loader, sections) and Jest snapshots.
    • Header tweaks: use alternate header for this type; back button navigates to SHIELD_PLAN_ROUTE; title shows "Confirm membership"; hide advanced details toggle for this type.
  • Shield Plan (subscriptions):
    • Enable crypto payment path: validate balance, build ERC‑20 approval calldata via new util, dispatch tx (addTransaction), and navigate to CONFIRM_TRANSACTION_ROUTE.
  • Utilities:
    • Add TOKEN_APPROVAL_FUNCTION_SIGNATURE and generateERC20ApprovalData; extend send utils/tests.
  • Localization:
    • Add strings for "Annual/Monthly", "Estimated changes", "You approve", tooltips, trial badge, etc. (en, en_GB).
  • Deps:
    • Bump @metamask/transaction-controller to ^60.6.0.

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

@pedronfigueiredo pedronfigueiredo self-assigned this Oct 3, 2025
@pedronfigueiredo pedronfigueiredo requested a review from a team as a code owner October 3, 2025 17:54
@pedronfigueiredo pedronfigueiredo added the team-confirmations Push issues to confirmations team label Oct 3, 2025
Copy link
Contributor

github-actions bot commented Oct 3, 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.

@github-actions github-actions bot added the size-L label Oct 3, 2025
@metamaskbot
Copy link
Collaborator

✨ Files requiring CODEOWNER review ✨

@MetaMask/confirmations (22 files, +1133 -12)
  • 📁 ui/
    • 📁 pages/
      • 📁 confirmations/
        • 📁 components/
          • 📁 confirm/
            • 📁 header/
              • 📄 advanced-details-button.tsx +13 -0
              • 📄 header.tsx +5 -4
              • 📄 wallet-initiated-header.tsx +25 -5
            • 📁 info/
              • 📁 shield-subscription-approve/
                • 📁 __snapshots__/
                  • 📄 account-details.test.tsx.snap +32 -0
                  • 📄 estimated-changes.test.tsx.snap +132 -0
                  • 📄 shield-subscription-approve-loader.test.tsx.snap +82 -0
                  • 📄 shield-subscription-approve.test.tsx.snap +274 -0
                  • 📄 subscription-details.test.tsx.snap +67 -0
                  • 📄 account-details.test.tsx +24 -0
                  • 📄 account-details.tsx +28 -0
                  • 📄 estimated-changes.test.tsx +43 -0
                  • 📄 estimated-changes.tsx +54 -0
                  • 📄 shield-subscription-approve-loader.test.tsx +18 -0
                  • 📄 shield-subscription-approve-loader.tsx +46 -0
                  • 📄 shield-subscription-approve.test.tsx +59 -0
                  • 📄 shield-subscription-approve.tsx +68 -0
                  • 📄 subscription-details.test.tsx +29 -0
                  • 📄 subscription-details.tsx +67 -0
                • 📄 info.tsx +6 -3
        • 📁 send-legacy/
          • 📄 send.constants.js +2 -0
          • 📄 send.utils.js +24 -0
          • 📄 send.utils.test.js +35 -0

cursor[bot]

This comment was marked as outdated.

@pedronfigueiredo pedronfigueiredo force-pushed the pnf/shield-confirmation branch from bd84760 to 3951c1b Compare October 3, 2025 18:18
const approvalData = generateERC20ApprovalData({
spenderAddress,
amount: decimalToHex(selectedToken.approvalAmount.approveAmount),
});
Copy link

Choose a reason for hiding this comment

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

Bug: ERC20 Approval Defaults to Burn Address

The generateERC20ApprovalData function defaults its spenderAddress parameter to the burn address. If a valid spender isn't explicitly provided, the function generates an approval for the burn address, which could lead to tokens being permanently lost. The if (!spenderAddress) check doesn't prevent this, as the burn address is a truthy value.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size-L team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants