Skip to content

feat(utils, tron): consolidate security alerts api - #397

Open
taran-a wants to merge 2 commits into
mainfrom
feat/consolidate-security-alerts-api
Open

taran-a wants to merge 2 commits into
mainfrom
feat/consolidate-security-alerts-api

Conversation

@taran-a

@taran-a taran-a commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Explanation

Consolidation of the transaction-scan implementations shared by the Solana, Stellar, and Tron snaps: the HTTP envelope of the per-chain Security Alerts (Blockaid) scan clients moves into @metamask/snap-networks-utils, and Tron adopts it. Chain-specific request/response payloads intentionally stay per-snap.

snap-networks-utils (new module):

  • SecurityAlertsApiClient — thin envelope: POSTs a typed JSON body to a single scanUrl (validated once at construction), throws SecurityAlertsHttpError (status + body) on non-2xx, validates the response against a caller-provided Superstruct struct (mandatory — response validation can no longer be skipped)
  • Scan vocabulary: SecurityAlertsScanOption, SecurityAlertsScanStatus, SecurityAlertResponse, SecurityAlertsScanRequestBase, normalizeScanOrigin

tron-wallet-snap (refactor, no behavior change):

  • Deletes the local SecurityAlertsApiClient wrapper; TransactionScanService uses the shared client directly
  • Tron-specific helpers (isContractTypeSupported, request-body build checked via satisfies TronScanRequestBody) move into the service/utils — scanning policy now lives in one layer
  • Dedupes ScanStatus / SecurityAlertResponse / origin-mapping constants

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@taran-a
taran-a requested a review from a team as a code owner September 30, 2026 17:53
@taran-a
taran-a deployed to default-branch September 30, 2026 17:53 — with GitHub Actions Active
@taran-a taran-a changed the title Feat/consolidate security alerts api feat(utils, tron): consolidate security alerts api Sep 30, 2026
@taran-a
taran-a force-pushed the feat/consolidate-security-alerts-api branch from fbf5900 to bbe2c39 Compare September 30, 2026 19:43
@sonarqubecloud

Copy link
Copy Markdown

@taran-a

taran-a commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-preview

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/bitcoin-wallet-snap@3.1.0-preview-bbe2c39
@metamask-previews/snap-networks-utils@1.0.0-preview-bbe2c39
@metamask-previews/solana-wallet-snap@7.0.0-preview-bbe2c39
@metamask-previews/stellar-wallet-snap@1.1.0-preview-bbe2c39
@metamask-previews/tron-wallet-snap@4.0.0-preview-bbe2c39

This branch was successfully deployed

1 active (outdated) deployment
default-branch — fbf5900e Deployed Sep 30, 2026 by taran-a via Determine whether this PR is a release PR #1411
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.

1 participant