Skip to main content

PhishingController Actions

11 actions registered.

NameDeprecated
bulkScanTokens
bulkScanUrls
bypass
checkAddressPoisoning
getApprovals
getState
isBlockedRequest
maybeUpdateState
scanAddress
scanUrl
testOrigin

PhishingController:bulkScanTokens​

Package: @metamask/phishing-controller

Scan multiple tokens for malicious activity in bulk.

Parameters:

NameDescription
requestThe bulk scan request containing chainId and tokens.
request.chainIdThe chain identifier. Accepts a hex chain ID for EVM chains (e.g. '0x1' for Ethereum) or a chain name for non-EVM chains (e.g. 'solana').
request.tokensArray of token addresses to scan.

Returns: A mapping of token addresses to their scan results. For EVM chains, addresses are lowercased; for non-EVM chains, original casing is preserved. Tokens that fail to scan are omitted.

Handler signature:

(request: BulkTokenScanRequest) => Promise<BulkTokenScanResponse>

PhishingController:bulkScanUrls​

Package: @metamask/phishing-controller

Scan multiple URLs for phishing in bulk. It will only scan the hostnames of the URLs. It also only supports web URLs.

Parameters:

NameDescription
urlsThe URLs to scan.
flowProduct flow used to attribute a network scan in the x-request-source header. If omitted, the header uses an unknown flow. Cached results do not make a network scan or emit a header.

Returns: A mapping of URLs to their phishing detection scan results and errors.

Handler signature:

(urls: string[], flow?: RequestSourceFlow) => Promise<BulkPhishingDetectionScanResponse>

PhishingController:bypass​

Package: @metamask/phishing-controller

Temporarily marks a given origin as approved.

Parameters:

NameDescription
originThe origin to mark as approved.

Handler signature:

(origin: string) => void

PhishingController:checkAddressPoisoning​

Package: @metamask/phishing-controller

Finds known recipient addresses that look like an address poisoning match.

Parameters:

NameDescription
candidateThe recipient address being checked.

Returns: Similar known recipient matches sorted by score.

Handler signature:

(candidate: string) => SimilarAddressMatch[]

PhishingController:getApprovals​

Package: @metamask/phishing-controller

Handler signature:

PhishingController['getApprovals']

PhishingController:getState​

Package: @metamask/phishing-controller

Handler signature:

() => PhishingControllerState

PhishingController:isBlockedRequest​

Package: @metamask/phishing-controller

Checks if a request URL's domain is blocked against the request blocklist.

This method is used to determine if a specific request URL is associated with a malicious command and control (C2) domain. The URL's hostname is hashed and checked against a configured blocklist of known malicious domains.

Parameters:

NameDescription
originThe full request URL to be checked.

Returns: An object indicating whether the URL's domain is blocked and relevant metadata.

Handler signature:

(origin: string) => PhishingDetectorResult

PhishingController:maybeUpdateState​

Package: @metamask/phishing-controller

Conditionally update the phishing configuration.

If the stalelist configuration is out of date, this function will call updateStalelist to update the configuration. This will automatically grab the hotlist, so it isn't necessary to continue on to download the hotlist and the c2 domain blocklist.

Handler signature:

() => Promise<void>

PhishingController:scanAddress​

Package: @metamask/phishing-controller

Scan an address for security alerts.

Parameters:

NameDescription
chainIdThe chain ID in hex format (e.g., '0x1' for Ethereum).
addressThe address to scan.

Returns: The address scan result.

Handler signature:

(chainId: string, address: string) => Promise<AddressScanResult>

PhishingController:scanUrl​

Package: @metamask/phishing-controller

Scan a URL for phishing. For most hosts only the hostname is sent to the API; for known shared gateways the pathname is included (see PHISHING_DETECTION_PATH_BASED_ROOT_DOMAINS). Only supports web URLs (http: / https:).

Parameters:

NameDescription
urlThe URL to scan.
flowProduct flow used to attribute a network scan in the x-request-source header. If omitted, the header uses an unknown flow. Cached results do not make a network scan or emit a header.

Returns: The phishing detection scan result.

Handler signature:

(url: string, flow?: RequestSourceFlow) => Promise<PhishingDetectionScanResult>

PhishingController:testOrigin​

Package: @metamask/phishing-controller

Determines if a given origin is unapproved.

It is strongly recommended that you call maybeUpdateState before calling this, to check whether the phishing configuration is up-to-date. It will be updated if necessary by calling updateStalelist or updateHotlist.

Parameters:

NameDescription
originDomain origin of a website.

Returns: Whether the origin is an unapproved origin.

Handler signature:

(origin: string) => PhishingDetectorResult