Skip to content

feat: Add metadata to sentinel requests#24507

Merged
nthpool merged 14 commits intomainfrom
txmeta-sentinel-requests
Jan 15, 2026
Merged

feat: Add metadata to sentinel requests#24507
nthpool merged 14 commits intomainfrom
txmeta-sentinel-requests

Conversation

@nthpool
Copy link
Copy Markdown
Contributor

@nthpool nthpool commented Jan 13, 2026

Description

This PR adds transaction metadata context to Sentinel relay transactions and Smart Transactions controller requests. This enables the backend services to have access to transaction type information when processing relay and batch transactions for improved analytics and handling.

Changes:

  1. Added metadata field (with txType) to RelaySubmitRequest interface and included it in delegation-7702 publish relay requests
  2. Patched @metamask/smart-transactions-controller to:
    • Add new types: SentinelMeta and SignedTransactionWithMetadata
    • Extend submitSignedTransactions to accept signedTransactionsWithMetadata
    • Include rawTxsWithMetadata in the batch submit payload sent to the STX API
  3. Updated smart-publish-hook.ts to build signedTransactionsWithMetadata array with each transaction's type from its metadata

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: Transaction metadata in relay requests

  Scenario: User sends a sponsored transaction via relay
    Given user has a wallet with EIP-7702 delegation support
    And user is on a supported network

    When user initiates a sponsored transaction
    Then the relay request payload should include metadata.txType field
    And the transaction should complete successfully

  Scenario: User sends a batch Smart Transaction
    Given user has a wallet with STX enabled
    And user is on a supported network

    When user initiates a swap that includes an approval and swap transaction
    Then the STX batch submit should include rawTxsWithMetadata with each transaction's type
    And the transaction should complete successfully

Screenshots/Recordings

Before

After

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 transaction metadata to Sentinel and STX flows for better context on backend processing.

  • Patch @metamask/smart-transactions-controller to accept signedTransactionsWithMetadata and send rawTxsWithMetadata in submit payload; export new types (SentinelMeta, SignedTransactionWithMetadata)
  • Update smart-publish-hook.ts to build signedTransactionsWithMetadata (deriving txType from each transaction) and pass alongside signedTransactions
  • Extend relay types and usage: add optional metadata to RelaySubmitRequest and include { txType } in delegation-7702-publish.ts relay requests; import SentinelMeta in transaction-relay.ts
  • Wire up Yarn patch in package.json and yarn.lock to apply the controller changes

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

@nthpool nthpool requested review from a team as code owners January 13, 2026 23:05
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 13, 2026

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.

@metamaskbot metamaskbot added the team-transactions Transactions team label Jan 13, 2026
@nthpool nthpool marked this pull request as draft January 13, 2026 23:13
rarquevaux
rarquevaux previously approved these changes Jan 14, 2026
Copy link
Copy Markdown
Contributor

@rarquevaux rarquevaux left a comment

Choose a reason for hiding this comment

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

I approve as I understand that we want to move fast with this but I have some concerns about the overall approach of sending the full TxMeta to sentinel:

  • We certainly do not need everything so we are not really following the principle of sharing the minimum. We could have PII in there and until now the txMeta was living in the client.
  • I sound like a broken record 😅 , but I think that we are creating a system that is different from bridge-api (metametrics event) and that will be only half satisfying because we will miss some non smart-transactions and it will be very hard to reconcile data between preset, mixpanel,...

chainId: Hex;
data: Hex;
to: Hex;
txMeta?: TransactionMeta;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a massive object, with tons and tons of data, I'd strongly recommend sending the minimum payload required with explicit fields for what is actually required, via a new dedicated type.

// Get transactionMeta based on the last transaction ID
const lastTransaction = transactions[transactions.length - 1];
// Find the first non-approval transaction in the batch
const approvalTypes = [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This could be moved into some util function, e.g. getFirstNonApprovalTransaction

@github-actions github-actions bot added size-M and removed size-S labels Jan 14, 2026
@nthpool nthpool changed the title Add TransactionMeta to sentinel requests Add metadata to sentinel requests Jan 14, 2026
@rarquevaux rarquevaux self-requested a review January 14, 2026 21:31
rarquevaux
rarquevaux previously approved these changes Jan 14, 2026
@nthpool nthpool marked this pull request as ready for review January 15, 2026 13:42
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.63636% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.60%. Comparing base (42a758f) to head (a1bc0bc).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
app/util/smart-transactions/smart-publish-hook.ts 63.63% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24507      +/-   ##
==========================================
- Coverage   79.61%   79.60%   -0.02%     
==========================================
  Files        4191     4201      +10     
  Lines      107856   108359     +503     
  Branches    22185    22318     +133     
==========================================
+ Hits        85873    86256     +383     
- Misses      15987    16071      +84     
- Partials     5996     6032      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

matthewwalsh0
matthewwalsh0 previously approved these changes Jan 15, 2026
weitingsun
weitingsun previously approved these changes Jan 15, 2026
@nthpool nthpool enabled auto-merge January 15, 2026 18:23
@nthpool
Copy link
Copy Markdown
Contributor Author

nthpool commented Jan 15, 2026

I have read the CLA Document and I hereby sign the CLA

@nthpool nthpool dismissed stale reviews from matthewwalsh0, rarquevaux, and weitingsun via 7d5b623 January 15, 2026 19:25
@nthpool nthpool changed the title Add metadata to sentinel requests feat: Add metadata to sentinel requests Jan 15, 2026
Copy link
Copy Markdown
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

LGTM. Let's make sure to follow up with a PR to apply these to the core repo and remove this patch once that's done.

@nthpool nthpool added skip-e2e skip E2E test jobs skip-e2e-quality-gate Skips the E2E Quality gate (flakiness detection) labels Jan 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeConfirmationsRedesigned
  • Risk Level: medium
  • AI Confidence: 78%
click to see 🤖 AI reasoning details

The changes add transaction type metadata (txType) to smart transaction submissions and EIP-7702 delegation relay requests. Key changes:

  1. package.json + patch file: Patches @metamask/smart-transactions-controller to support signedTransactionsWithMetadata parameter with transaction type metadata
  2. smart-publish-hook.ts: Modified to pass transaction metadata along with signed transactions when submitting to the smart transactions controller - this affects swaps, bridges, and other smart transaction flows
  3. delegation-7702-publish.ts: Added metadata with txType to relay requests for EIP-7702 delegation transactions (gasless/sponsored transactions)
  4. transaction-relay.ts: Added SentinelMeta type and metadata field to RelaySubmitRequest interface

The changes are additive (adding metadata for tracking/analytics) rather than modifying core transaction logic, which reduces risk. However, they touch critical transaction submission paths:

  • Smart transactions are used for swaps and bridges (SmokeTrade)
  • EIP-7702 delegation is used for gasless transactions and smart account features (SmokeConfirmationsRedesigned has 7702 tests)

No direct E2E tests exist for smart-transactions or delegation-7702 specifically, but the functionality is exercised through swap/bridge flows and confirmation flows.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@nthpool nthpool added this pull request to the merge queue Jan 15, 2026
Merged via the queue into main with commit fadc0d3 Jan 15, 2026
56 checks passed
@nthpool nthpool deleted the txmeta-sentinel-requests branch January 15, 2026 22:45
@github-actions github-actions bot locked and limited conversation to collaborators Jan 15, 2026
@metamaskbot metamaskbot added the release-7.63.0 Issue or pull request that will be included in release 7.63.0 label Jan 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.63.0 Issue or pull request that will be included in release 7.63.0 size-M skip-e2e skip E2E test jobs skip-e2e-quality-gate Skips the E2E Quality gate (flakiness detection) team-transactions Transactions team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants