feat(card): add MMM_CARD origin for Card delegation transactions#27437
feat(card): add MMM_CARD origin for Card delegation transactions#27437rarquevaux wants to merge 2 commits intomainfrom
Conversation
|
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. |
|
Analytics note: |
Introduce a dedicated `MMM_CARD` origin so Card delegation transactions are distinguishable from generic internal transactions while preserving identical runtime behavior (internal origin checks, permission shortcuts, unapproved-transaction guard, approval-screen origin hiding).
13f58ea to
b62cbba
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Because transaction types underpin native transfers, token approvals, swaps, staking, perps deposits, predictions positions, and card funding (swap-based), SmokeConfirmations must run along with all features that rely on on-chain transactions (SmokeTrade, SmokePerps, SmokePredictions, SmokeCard). Changes to Permissions/index.ts may affect chain permissions, dApp session handling, and multi-chain scope management; therefore SmokeNetworkAbstractions, SmokeNetworkExpansion, and SmokeMultiChainAPI are required to validate permission flows and provider behavior. Per tag dependency rules:
SmokeWalletPlatform is included because transaction history, provider events, and Trending-integrated sections (Perps/Predictions) may be indirectly affected by transaction type or permission logic. Given the centrality of transaction and permission layers, this is high risk for user-critical flows. Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|



Description
Card delegation transactions currently use the generic
TransactionTypes.MMM('MetaMask Mobile') origin, making them indistinguishable from other internal transactions in analytics and debugging.This PR introduces a dedicated
MMM_CARDorigin ('MetaMask Mobile Card') and threads it through all internal-origin checks so Card delegation transactions are identifiable while preserving identical runtime behavior:MMM_CARD: 'MetaMask Mobile Card'toTransactionTypesMMM_CARDto bothINTERNAL_ORIGINSarrays (constants/transaction.tsandPermissions/index.ts)onUnapprovedTransactionguard to also early-return forMMM_CARDuseCardDelegationto emitMMM_CARDinstead ofMMMChangelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk: this is a new origin constant threaded through internal-origin allowlists and a guard in
onUnapprovedTransaction, with tests updated; transaction execution logic is unchanged aside from labeling.Overview
Introduces a dedicated internal transaction origin
TransactionTypes.MMM_CARD("MetaMask Mobile Card") so Card delegation approval transactions are distinguishable from genericMMMtransactions.Threads
MMM_CARDthrough internal-origin handling by (1) emitting it fromuseCardDelegationwhen submitting the approval transaction, (2) treating it as an internal origin inconstants/transaction.tsandPermissions/index.ts, and (3) extending theonUnapprovedTransactionearly-return guard to skip auto-sign processing for this origin, with matching test updates.Written by Cursor Bugbot for commit 558aba5. This will update automatically on new commits. Configure here.