Skip to content

feat: add getApprovals to PhishingController#8074

Open
AugmentedMode wants to merge 7 commits intomainfrom
feat/get-evm-approvals
Open

feat: add getApprovals to PhishingController#8074
AugmentedMode wants to merge 7 commits intomainfrom
feat/get-evm-approvals

Conversation

@AugmentedMode
Copy link
Contributor

@AugmentedMode AugmentedMode commented Mar 1, 2026

Summary

  • Adds getApprovals method to PhishingController that wraps the security alerts API POST /address/evm/approvals endpoint (Blockaid's approvals endpoint)
  • Returns token approvals for an EVM address with security enrichments (verdict, spender info, exposure data, allowance details)
  • Follows the existing scanAddress pattern (input validation, chain resolution, safelyExecuteWithTimeout) but intentionally does not cache — the frontend manages state

Changes

  • src/types.ts — Added ApprovalResultType/ApprovalFeatureType enums and types: Approval, ApprovalsResponse, Allowance, ApprovalAsset, Exposure, Spender, ApprovalFeature
  • src/PhishingController.ts — Added APPROVALS_ENDPOINT constant, PhishingControllerGetApprovalsAction action type, messenger registration, and getApprovals method
  • src/index.ts — Exported all new types and enums
  • src/PhishingController.test.ts — Added 8 test cases covering: valid response, missing address/chainId, unknown chain, HTTP errors, timeout, address/chainId normalization

Note

Medium Risk
Adds a new networked controller action (getApprovals) that calls an external Security Alerts API and changes the public API surface via new exported types; failures are handled by returning empty results, but correctness depends on chain support/normalization and endpoint behavior.

Overview
Adds token-approval fetching to PhishingController. Introduces getApprovals (and messenger action PhishingController:getApprovals) to call POST /address/evm/approvals on the Security Alerts API with a 5s timeout, normalizing chainId/address and returning { approvals: [] } for invalid inputs, unsupported chains, HTTP errors, or timeouts.

Expands exported approval typing and chain gating. Adds approval-related enums/types (ApprovalsResponse, Approval, etc.), a fixed allowlist of supported approval chains plus isApprovalSupportedChain, updates package exports, adds comprehensive unit tests for success/error/timeout/normalization paths, and updates the changelog and eslint suppression tracking.

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

@AugmentedMode AugmentedMode requested a review from a team as a code owner March 1, 2026 02:33
@AugmentedMode AugmentedMode self-assigned this Mar 1, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AugmentedMode AugmentedMode requested a review from a team as a code owner March 1, 2026 02:37
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 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

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.

1 participant