feat: add getApprovals to PhishingController#8074
Open
AugmentedMode wants to merge 7 commits intomainfrom
Open
feat: add getApprovals to PhishingController#8074AugmentedMode wants to merge 7 commits intomainfrom
AugmentedMode wants to merge 7 commits intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getApprovalsmethod toPhishingControllerthat wraps the security alerts APIPOST /address/evm/approvalsendpoint (Blockaid's approvals endpoint)scanAddresspattern (input validation, chain resolution,safelyExecuteWithTimeout) but intentionally does not cache — the frontend manages stateChanges
src/types.ts— AddedApprovalResultType/ApprovalFeatureTypeenums and types:Approval,ApprovalsResponse,Allowance,ApprovalAsset,Exposure,Spender,ApprovalFeaturesrc/PhishingController.ts— AddedAPPROVALS_ENDPOINTconstant,PhishingControllerGetApprovalsActionaction type, messenger registration, andgetApprovalsmethodsrc/index.ts— Exported all new types and enumssrc/PhishingController.test.ts— Added 8 test cases covering: valid response, missing address/chainId, unknown chain, HTTP errors, timeout, address/chainId normalizationNote
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. IntroducesgetApprovals(and messenger actionPhishingController:getApprovals) to callPOST /address/evm/approvalson the Security Alerts API with a 5s timeout, normalizingchainId/addressand 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 plusisApprovalSupportedChain, 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.