Skip to content

Conversation

matthiasgeihs
Copy link
Contributor

@matthiasgeihs matthiasgeihs commented Oct 14, 2025

Explanation

Currently, the only information the GetSimulationConfig callback gets is the simulation server URL.
In MetaMask Shield we identified an edge case, where it would be useful for the backend to be provided with the transaction origin.
We here propose to add txMeta as an optional context parameter to the GetSimulationConfig callback, so that the callback can attach the origin (contained in txMeta) to the backend URL as a URL parameter.

References

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, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Adds optional txMeta to GetSimulationConfig and wires TransactionController to pass txMeta when requesting simulation config, with tests and changelog updates.

  • Types:
    • Extend GetSimulationConfig signature to (url, opts?: { txMeta? }) in src/types.ts.
  • Controller:
    • Wrap getSimulationConfig in TransactionController to inject current txMeta when simulating (#updateSimulationData).
  • Tests:
    • Update simulation tests to expect getSimulationConfig to be called (with URL and { txMeta }) and adjust mocks accordingly.
  • Docs/Changelog:
    • Note addition in CHANGELOG.md under Unreleased.

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

This enables building the package directly from the package directory.
@matthiasgeihs matthiasgeihs marked this pull request as ready for review October 14, 2025 16:56
@matthiasgeihs matthiasgeihs requested review from a team as code owners October 14, 2025 16:56
@matthiasgeihs matthiasgeihs enabled auto-merge (squash) October 15, 2025 08:34
txMeta: transactionMeta,
...opts,
});
},
Copy link

Choose a reason for hiding this comment

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

Bug: Transaction Meta Override Issue

In the getSimulationConfig wrapper, the object spread order ({ txMeta: transactionMeta, ...opts }) allows opts.txMeta to override the controller's transactionMeta. This prevents the simulation from consistently using the current transaction's intended context.

Fix in Cursor Fix in Web

@matthiasgeihs matthiasgeihs merged commit b4e21b8 into main Oct 15, 2025
243 checks passed
@matthiasgeihs matthiasgeihs deleted the mg/transaction/add-txmeta-context branch October 15, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants