Skip to content

Comments

feat: add optional details field to Transaction type#445

Open
danroc wants to merge 3 commits intomainfrom
dr/tx-details
Open

feat: add optional details field to Transaction type#445
danroc wants to merge 3 commits intomainfrom
dr/tx-details

Conversation

@danroc
Copy link
Contributor

@danroc danroc commented Jan 22, 2026

Description

This PR adds an optional details field to the Transaction type to support transaction origin tracking and security alert responses.

Current State

The Transaction type currently lacks fields to track:

  • Where a transaction originated (MetaMask internally or a dapp)
  • Security assessment results from the Security Alert API

Solution

Adds an optional details object containing:

  • origin (optional string): Transaction request source (e.g., 'metamask' or dapp URL)
  • securityAlertResponse (optional enum): Security Alert API response (benign, warning, malicious)

The implementation is backward compatibile.

Examples

N/A - This is an API enhancement that consumers can adopt incrementally.


Note

Low Risk
Adds a backward-compatible optional field to a public type plus validation/tests; main risk is downstream consumers assuming the old shape or mishandling the new optional object.

Overview
Adds an optional details object to Transaction to carry extra context about a transaction, including an origin string and a securityAlertResponse value.

Introduces the SecurityAlertResponse enum and TransactionDetailsStruct, wires details into TransactionStruct using exactOptional (disallowing explicit undefined), and adds both runtime (TransactionStruct) and type-level (tsd) tests plus changelog documentation.

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

@danroc danroc requested a review from a team as a code owner January 22, 2026 16:45
@danroc danroc self-assigned this Jan 22, 2026
@danroc danroc added DO-NOT-MERGE PRs related to this issue should not be merged enhancement New feature or request labels Jan 22, 2026
Add optional details field containing transaction origin and security
alert response. The details field includes:
- origin: transaction request source (e.g., 'metamask' or dapp URL)
- securityAlertResponse: Security Alert API response enum (benign, warning, malicious)

The implementation uses exactOptional for full backward compatibility.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Copy link

@wzrdk3lly wzrdk3lly left a comment

Choose a reason for hiding this comment

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

Thanks this looks good. Correct the successful responses types from security alerts are Benign | Warning | Malicious .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO-NOT-MERGE PRs related to this issue should not be merged enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants