Skip to content

Conversation

@jpuri
Copy link
Contributor

@jpuri jpuri commented Dec 9, 2025

Explanation

The PR adds id from the JSON RPC request to the transaction meta object. Thus change is done at 2 places:

  1. Transaction controller
  2. EIP-5792 middleware

References

Related to #67890

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Propagates the JSON-RPC request id into transaction metadata for single and batched flows, wiring through EIP-5792 middleware and TransactionController with updated types, tests, and changelogs.

  • Transaction Controller:
    • Add requestId to TransactionMeta, TransactionBatchMeta, AddTransactionOptions, and TransactionBatchRequest.
    • Plumb requestId through addTransaction, addTransactionBatch, and batch utilities (utils/batch.ts).
    • Update tests to reflect new metadata field.
  • EIP-5792 Middleware:
    • Extract req.id and pass as requestId to addTransaction/addTransactionBatch in processSendCalls.
    • Adjust tests to assert requestId propagation.
  • Changelogs:
    • Document addition of requestId across both packages.

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

@jpuri jpuri marked this pull request as ready for review December 9, 2025 14:39
@jpuri jpuri requested review from a team as code owners December 9, 2025 14:39
const securityAlertId = uuid();
const validateSecurity = validateSecurityHook.bind(null, securityAlertId);

const requestId = String(req.id);
Copy link
Member

Choose a reason for hiding this comment

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

What if we use JsonRpcId type from @metamask/utils in the TransactionController types? As v2 JSONRpcEngine referring the same types https://github.com/MetaMask/core/blob/main/packages/json-rpc-engine/src/v2/JsonRpcEngineV2.ts#L4

Then we wouldn't really need to cast here and just pass as is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

String is I think more useful even later when we use it in the UI

Copy link
Member

@OGPoyraz OGPoyraz Dec 11, 2025

Choose a reason for hiding this comment

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

Sorry not sure I follow, what makes string to be useful and how's that related with UI?

It's a minor thing for sure, but am not completely convinced if casting here necessary. So I will defer this to @dan437

Copy link
Member

Choose a reason for hiding this comment

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

Do we want to note additions in changelog on this package and transaction-controller?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, let me do that.

@jpuri jpuri requested a review from a team as a code owner December 10, 2025 11:38
@jpuri jpuri requested a review from OGPoyraz December 10, 2025 11:43
@jpuri jpuri enabled auto-merge December 10, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants