@metamask-previews/phishing-controller 17.1.2-preview-fe92f4bb3 → 17.2.0-preview-9b6bf0851

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +12 -5
  2. package/dist/PhishingController-method-action-types.cjs.map +1 -1
  3. package/dist/PhishingController-method-action-types.d.cts +11 -1
  4. package/dist/PhishingController-method-action-types.d.cts.map +1 -1
  5. package/dist/PhishingController-method-action-types.d.mts +11 -1
  6. package/dist/PhishingController-method-action-types.d.mts.map +1 -1
  7. package/dist/PhishingController-method-action-types.mjs.map +1 -1
  8. package/dist/PhishingController.cjs +195 -20
  9. package/dist/PhishingController.cjs.map +1 -1
  10. package/dist/PhishingController.d.cts +12 -4
  11. package/dist/PhishingController.d.cts.map +1 -1
  12. package/dist/PhishingController.d.mts +12 -4
  13. package/dist/PhishingController.d.mts.map +1 -1
  14. package/dist/PhishingController.mjs +196 -21
  15. package/dist/PhishingController.mjs.map +1 -1
  16. package/dist/address-poisoning.cjs +71 -0
  17. package/dist/address-poisoning.cjs.map +1 -0
  18. package/dist/address-poisoning.d.cts +3 -0
  19. package/dist/address-poisoning.d.cts.map +1 -0
  20. package/dist/address-poisoning.d.mts +3 -0
  21. package/dist/address-poisoning.d.mts.map +1 -0
  22. package/dist/address-poisoning.mjs +67 -0
  23. package/dist/address-poisoning.mjs.map +1 -0
  24. package/dist/index.cjs +3 -1
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +3 -2
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.mts +3 -2
  29. package/dist/index.d.mts.map +1 -1
  30. package/dist/index.mjs +1 -0
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/types.cjs.map +1 -1
  33. package/dist/types.d.cts +39 -0
  34. package/dist/types.d.cts.map +1 -1
  35. package/dist/types.d.mts +39 -0
  36. package/dist/types.d.mts.map +1 -1
  37. package/dist/types.mjs.map +1 -1
  38. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -7,8 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [17.2.0]
11
+
10
12
  ### Added
11
13
 
14
+ - Add `findSimilarAddresses` utility and `PhishingController:checkAddressPoisoning` messenger action to detect address poisoning attempts against known recipients ([#8171](https://github.com/MetaMask/core/pull/8171))
15
+ - The controller now hydrates and maintains a set of known recipient addresses from confirmed transactions (`TransactionController`) and the address book (`AddressBookController`)
16
+ - Exposes match metadata including prefix/suffix match lengths, poisoning score, and diff indices
17
+ - Add `@metamask/address-book-controller` as a dependency ([#8171](https://github.com/MetaMask/core/pull/8171))
12
18
  - Support path-based phishing lists (`blocklistPaths`, `whitelistPaths`) and path-aware URL scanning for shared gateways (for example IPFS gateways and `sites.google.com`) via `getPhishingDetectionScanUrlParam`, `isPhishingDetectionPathBasedHostname`, and `PHISHING_DETECTION_PATH_BASED_ROOT_DOMAINS` ([#8662](https://github.com/MetaMask/core/pull/8662))
13
19
 
14
20
  ### Changed
@@ -284,8 +290,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
284
290
 
285
291
  ### Changed
286
292
 
287
- - Bump `@metamask/base-controller` from `^7.0.2` to `^8.0.0` ([#5079](https://github.com/MetaMask/core/pull/5079)), ([#5135](https://github.com/MetaMask/core/pull/5135)), ([#5305](https://github.com/MetaMask/core/pull/5305))
288
- - Bump `@metamask/controller-utils` from `^11.4.4` to `^11.5.0` ([#5135](https://github.com/MetaMask/core/pull/5135)), ([#5272](https://github.com/MetaMask/core/pull/5272))
293
+ - Bump `@metamask/base-controller` from `^7.0.2` to `^8.0.0`,, ([#5079](https://github.com/MetaMask/core/pull/5079), [#5135](https://github.com/MetaMask/core/pull/5135), [#5305](https://github.com/MetaMask/core/pull/5305))
294
+ - Bump `@metamask/controller-utils` from `^11.4.4` to `^11.5.0`, ([#5135](https://github.com/MetaMask/core/pull/5135), [#5272](https://github.com/MetaMask/core/pull/5272))
289
295
 
290
296
  ## [12.3.1]
291
297
 
@@ -329,7 +335,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
329
335
  ["Are the Types Wrong?"](https://arethetypeswrong.github.io/) tool as
330
336
  ["masquerading as CJS"](https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md).
331
337
  All of the ATTW checks now pass.
332
- - Remove chunk files ([#4648](https://github.com/MetaMask/core/pull/4648)).
338
+ - Remove chunk files. ([#4648](https://github.com/MetaMask/core/pull/4648))
333
339
  - Previously, the build tool we used to generate JavaScript files extracted
334
340
  common code to "chunk" files. While this was intended to make this package
335
341
  more tree-shakeable, it also made debugging more difficult for our
@@ -357,7 +363,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
357
363
 
358
364
  ### Added
359
365
 
360
- - Add allowlist functionality to the C2 domain detection system ([#4464](https://github.com/MetaMask/core/pull/4644))
366
+ - Add allowlist functionality to the C2 domain detection system ([#4464](https://github.com/MetaMask/core/pull/4464))
361
367
  - Add `PhishingController` functionality for blocking client-side C2 requests by managing a hashed C2 request blocklist ([#4526](https://github.com/MetaMask/core/pull/4526))
362
368
  - Add `requestBlocklist` type to `ListTypes`.
363
369
  - Add `isBlockedRequest` method to `PhishingController`.
@@ -595,7 +601,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
595
601
 
596
602
  All changes listed after this point were applied to this package following the monorepo conversion.
597
603
 
598
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@17.1.2...HEAD
604
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@17.2.0...HEAD
605
+ [17.2.0]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@17.1.2...@metamask/phishing-controller@17.2.0
599
606
  [17.1.2]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@17.1.1...@metamask/phishing-controller@17.1.2
600
607
  [17.1.1]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@17.1.0...@metamask/phishing-controller@17.1.1
601
608
  [17.1.0]: https://github.com/MetaMask/core/compare/@metamask/phishing-controller@17.0.0...@metamask/phishing-controller@17.1.0
@@ -1 +1 @@
1
- {"version":3,"file":"PhishingController-method-action-types.cjs","sourceRoot":"","sources":["../src/PhishingController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { PhishingController } from './PhishingController';\n\n/**\n * Conditionally update the phishing configuration.\n *\n * If the stalelist configuration is out of date, this function will call `updateStalelist`\n * to update the configuration. This will automatically grab the hotlist,\n * so it isn't necessary to continue on to download the hotlist and the c2 domain blocklist.\n *\n */\nexport type PhishingControllerMaybeUpdateStateAction = {\n type: `PhishingController:maybeUpdateState`;\n handler: PhishingController['maybeUpdateState'];\n};\n\n/**\n * Determines if a given origin is unapproved.\n *\n * It is strongly recommended that you call {@link maybeUpdateState} before calling this,\n * to check whether the phishing configuration is up-to-date. It will be updated if necessary\n * by calling {@link updateStalelist} or {@link updateHotlist}.\n *\n * @param origin - Domain origin of a website.\n * @returns Whether the origin is an unapproved origin.\n */\nexport type PhishingControllerTestOriginAction = {\n type: `PhishingController:testOrigin`;\n handler: PhishingController['testOrigin'];\n};\n\n/**\n * Checks if a request URL's domain is blocked against the request blocklist.\n *\n * This method is used to determine if a specific request URL is associated with a malicious\n * command and control (C2) domain. The URL's hostname is hashed and checked against a configured\n * blocklist of known malicious domains.\n *\n * @param origin - The full request URL to be checked.\n * @returns An object indicating whether the URL's domain is blocked and relevant metadata.\n */\nexport type PhishingControllerIsBlockedRequestAction = {\n type: `PhishingController:isBlockedRequest`;\n handler: PhishingController['isBlockedRequest'];\n};\n\n/**\n * Temporarily marks a given origin as approved.\n *\n * @param origin - The origin to mark as approved.\n */\nexport type PhishingControllerBypassAction = {\n type: `PhishingController:bypass`;\n handler: PhishingController['bypass'];\n};\n\n/**\n * Scan a URL for phishing. For most hosts only the hostname is sent to the API; for known\n * shared gateways the pathname is included (see `PHISHING_DETECTION_PATH_BASED_ROOT_DOMAINS`).\n * Only supports web URLs (`http:` / `https:`).\n *\n * @param url - The URL to scan.\n * @returns The phishing detection scan result.\n */\nexport type PhishingControllerScanUrlAction = {\n type: `PhishingController:scanUrl`;\n handler: PhishingController['scanUrl'];\n};\n\n/**\n * Scan multiple URLs for phishing in bulk. It will only scan the hostnames of the URLs.\n * It also only supports web URLs.\n *\n * @param urls - The URLs to scan.\n * @returns A mapping of URLs to their phishing detection scan results and errors.\n */\nexport type PhishingControllerBulkScanUrlsAction = {\n type: `PhishingController:bulkScanUrls`;\n handler: PhishingController['bulkScanUrls'];\n};\n\n/**\n * Scan an address for security alerts.\n *\n * @param chainId - The chain ID in hex format (e.g., '0x1' for Ethereum).\n * @param address - The address to scan.\n * @returns The address scan result.\n */\nexport type PhishingControllerScanAddressAction = {\n type: `PhishingController:scanAddress`;\n handler: PhishingController['scanAddress'];\n};\n\n/**\n * Scan multiple tokens for malicious activity in bulk.\n *\n * @param request - The bulk scan request containing chainId and tokens.\n * @param request.chainId - The chain identifier. Accepts a hex chain ID for\n * EVM chains (e.g. `'0x1'` for Ethereum) or a chain name for non-EVM chains\n * (e.g. `'solana'`).\n * @param request.tokens - Array of token addresses to scan.\n * @returns A mapping of token addresses to their scan results. For EVM chains,\n * addresses are lowercased; for non-EVM chains, original casing is preserved.\n * Tokens that fail to scan are omitted.\n */\nexport type PhishingControllerBulkScanTokensAction = {\n type: `PhishingController:bulkScanTokens`;\n handler: PhishingController['bulkScanTokens'];\n};\n\nexport type PhishingControllerGetApprovalsAction = {\n type: `PhishingController:getApprovals`;\n handler: PhishingController['getApprovals'];\n};\n\n/**\n * Union of all PhishingController action types.\n */\nexport type PhishingControllerMethodActions =\n | PhishingControllerMaybeUpdateStateAction\n | PhishingControllerTestOriginAction\n | PhishingControllerIsBlockedRequestAction\n | PhishingControllerBypassAction\n | PhishingControllerScanUrlAction\n | PhishingControllerBulkScanUrlsAction\n | PhishingControllerScanAddressAction\n | PhishingControllerBulkScanTokensAction\n | PhishingControllerGetApprovalsAction;\n"]}
1
+ {"version":3,"file":"PhishingController-method-action-types.cjs","sourceRoot":"","sources":["../src/PhishingController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { PhishingController } from './PhishingController';\n\n/**\n * Finds known recipient addresses that look like an address poisoning match.\n *\n * @param candidate - The recipient address being checked.\n * @returns Similar known recipient matches sorted by score.\n */\nexport type PhishingControllerCheckAddressPoisoningAction = {\n type: `PhishingController:checkAddressPoisoning`;\n handler: PhishingController['checkAddressPoisoning'];\n};\n\n/**\n * Conditionally update the phishing configuration.\n *\n * If the stalelist configuration is out of date, this function will call `updateStalelist`\n * to update the configuration. This will automatically grab the hotlist,\n * so it isn't necessary to continue on to download the hotlist and the c2 domain blocklist.\n *\n */\nexport type PhishingControllerMaybeUpdateStateAction = {\n type: `PhishingController:maybeUpdateState`;\n handler: PhishingController['maybeUpdateState'];\n};\n\n/**\n * Determines if a given origin is unapproved.\n *\n * It is strongly recommended that you call {@link maybeUpdateState} before calling this,\n * to check whether the phishing configuration is up-to-date. It will be updated if necessary\n * by calling {@link updateStalelist} or {@link updateHotlist}.\n *\n * @param origin - Domain origin of a website.\n * @returns Whether the origin is an unapproved origin.\n */\nexport type PhishingControllerTestOriginAction = {\n type: `PhishingController:testOrigin`;\n handler: PhishingController['testOrigin'];\n};\n\n/**\n * Checks if a request URL's domain is blocked against the request blocklist.\n *\n * This method is used to determine if a specific request URL is associated with a malicious\n * command and control (C2) domain. The URL's hostname is hashed and checked against a configured\n * blocklist of known malicious domains.\n *\n * @param origin - The full request URL to be checked.\n * @returns An object indicating whether the URL's domain is blocked and relevant metadata.\n */\nexport type PhishingControllerIsBlockedRequestAction = {\n type: `PhishingController:isBlockedRequest`;\n handler: PhishingController['isBlockedRequest'];\n};\n\n/**\n * Temporarily marks a given origin as approved.\n *\n * @param origin - The origin to mark as approved.\n */\nexport type PhishingControllerBypassAction = {\n type: `PhishingController:bypass`;\n handler: PhishingController['bypass'];\n};\n\n/**\n * Scan a URL for phishing. For most hosts only the hostname is sent to the API; for known\n * shared gateways the pathname is included (see `PHISHING_DETECTION_PATH_BASED_ROOT_DOMAINS`).\n * Only supports web URLs (`http:` / `https:`).\n *\n * @param url - The URL to scan.\n * @returns The phishing detection scan result.\n */\nexport type PhishingControllerScanUrlAction = {\n type: `PhishingController:scanUrl`;\n handler: PhishingController['scanUrl'];\n};\n\n/**\n * Scan multiple URLs for phishing in bulk. It will only scan the hostnames of the URLs.\n * It also only supports web URLs.\n *\n * @param urls - The URLs to scan.\n * @returns A mapping of URLs to their phishing detection scan results and errors.\n */\nexport type PhishingControllerBulkScanUrlsAction = {\n type: `PhishingController:bulkScanUrls`;\n handler: PhishingController['bulkScanUrls'];\n};\n\n/**\n * Scan an address for security alerts.\n *\n * @param chainId - The chain ID in hex format (e.g., '0x1' for Ethereum).\n * @param address - The address to scan.\n * @returns The address scan result.\n */\nexport type PhishingControllerScanAddressAction = {\n type: `PhishingController:scanAddress`;\n handler: PhishingController['scanAddress'];\n};\n\n/**\n * Scan multiple tokens for malicious activity in bulk.\n *\n * @param request - The bulk scan request containing chainId and tokens.\n * @param request.chainId - The chain identifier. Accepts a hex chain ID for\n * EVM chains (e.g. `'0x1'` for Ethereum) or a chain name for non-EVM chains\n * (e.g. `'solana'`).\n * @param request.tokens - Array of token addresses to scan.\n * @returns A mapping of token addresses to their scan results. For EVM chains,\n * addresses are lowercased; for non-EVM chains, original casing is preserved.\n * Tokens that fail to scan are omitted.\n */\nexport type PhishingControllerBulkScanTokensAction = {\n type: `PhishingController:bulkScanTokens`;\n handler: PhishingController['bulkScanTokens'];\n};\n\nexport type PhishingControllerGetApprovalsAction = {\n type: `PhishingController:getApprovals`;\n handler: PhishingController['getApprovals'];\n};\n\n/**\n * Union of all PhishingController action types.\n */\nexport type PhishingControllerMethodActions =\n | PhishingControllerCheckAddressPoisoningAction\n | PhishingControllerMaybeUpdateStateAction\n | PhishingControllerTestOriginAction\n | PhishingControllerIsBlockedRequestAction\n | PhishingControllerBypassAction\n | PhishingControllerScanUrlAction\n | PhishingControllerBulkScanUrlsAction\n | PhishingControllerScanAddressAction\n | PhishingControllerBulkScanTokensAction\n | PhishingControllerGetApprovalsAction;\n"]}
@@ -3,6 +3,16 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  import type { PhishingController } from "./PhishingController.cjs";
6
+ /**
7
+ * Finds known recipient addresses that look like an address poisoning match.
8
+ *
9
+ * @param candidate - The recipient address being checked.
10
+ * @returns Similar known recipient matches sorted by score.
11
+ */
12
+ export type PhishingControllerCheckAddressPoisoningAction = {
13
+ type: `PhishingController:checkAddressPoisoning`;
14
+ handler: PhishingController['checkAddressPoisoning'];
15
+ };
6
16
  /**
7
17
  * Conditionally update the phishing configuration.
8
18
  *
@@ -109,5 +119,5 @@ export type PhishingControllerGetApprovalsAction = {
109
119
  /**
110
120
  * Union of all PhishingController action types.
111
121
  */
112
- export type PhishingControllerMethodActions = PhishingControllerMaybeUpdateStateAction | PhishingControllerTestOriginAction | PhishingControllerIsBlockedRequestAction | PhishingControllerBypassAction | PhishingControllerScanUrlAction | PhishingControllerBulkScanUrlsAction | PhishingControllerScanAddressAction | PhishingControllerBulkScanTokensAction | PhishingControllerGetApprovalsAction;
122
+ export type PhishingControllerMethodActions = PhishingControllerCheckAddressPoisoningAction | PhishingControllerMaybeUpdateStateAction | PhishingControllerTestOriginAction | PhishingControllerIsBlockedRequestAction | PhishingControllerBypassAction | PhishingControllerScanUrlAction | PhishingControllerBulkScanUrlsAction | PhishingControllerScanAddressAction | PhishingControllerBulkScanTokensAction | PhishingControllerGetApprovalsAction;
113
123
  //# sourceMappingURL=PhishingController-method-action-types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PhishingController-method-action-types.d.cts","sourceRoot":"","sources":["../src/PhishingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAA6B;AAE/D;;;;;;;GAOG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC7C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,wCAAwC,GACxC,kCAAkC,GAClC,wCAAwC,GACxC,8BAA8B,GAC9B,+BAA+B,GAC/B,oCAAoC,GACpC,mCAAmC,GACnC,sCAAsC,GACtC,oCAAoC,CAAC"}
1
+ {"version":3,"file":"PhishingController-method-action-types.d.cts","sourceRoot":"","sources":["../src/PhishingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAA6B;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC7C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,6CAA6C,GAC7C,wCAAwC,GACxC,kCAAkC,GAClC,wCAAwC,GACxC,8BAA8B,GAC9B,+BAA+B,GAC/B,oCAAoC,GACpC,mCAAmC,GACnC,sCAAsC,GACtC,oCAAoC,CAAC"}
@@ -3,6 +3,16 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  import type { PhishingController } from "./PhishingController.mjs";
6
+ /**
7
+ * Finds known recipient addresses that look like an address poisoning match.
8
+ *
9
+ * @param candidate - The recipient address being checked.
10
+ * @returns Similar known recipient matches sorted by score.
11
+ */
12
+ export type PhishingControllerCheckAddressPoisoningAction = {
13
+ type: `PhishingController:checkAddressPoisoning`;
14
+ handler: PhishingController['checkAddressPoisoning'];
15
+ };
6
16
  /**
7
17
  * Conditionally update the phishing configuration.
8
18
  *
@@ -109,5 +119,5 @@ export type PhishingControllerGetApprovalsAction = {
109
119
  /**
110
120
  * Union of all PhishingController action types.
111
121
  */
112
- export type PhishingControllerMethodActions = PhishingControllerMaybeUpdateStateAction | PhishingControllerTestOriginAction | PhishingControllerIsBlockedRequestAction | PhishingControllerBypassAction | PhishingControllerScanUrlAction | PhishingControllerBulkScanUrlsAction | PhishingControllerScanAddressAction | PhishingControllerBulkScanTokensAction | PhishingControllerGetApprovalsAction;
122
+ export type PhishingControllerMethodActions = PhishingControllerCheckAddressPoisoningAction | PhishingControllerMaybeUpdateStateAction | PhishingControllerTestOriginAction | PhishingControllerIsBlockedRequestAction | PhishingControllerBypassAction | PhishingControllerScanUrlAction | PhishingControllerBulkScanUrlsAction | PhishingControllerScanAddressAction | PhishingControllerBulkScanTokensAction | PhishingControllerGetApprovalsAction;
113
123
  //# sourceMappingURL=PhishingController-method-action-types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PhishingController-method-action-types.d.mts","sourceRoot":"","sources":["../src/PhishingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAA6B;AAE/D;;;;;;;GAOG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC7C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,wCAAwC,GACxC,kCAAkC,GAClC,wCAAwC,GACxC,8BAA8B,GAC9B,+BAA+B,GAC/B,oCAAoC,GACpC,mCAAmC,GACnC,sCAAsC,GACtC,oCAAoC,CAAC"}
1
+ {"version":3,"file":"PhishingController-method-action-types.d.mts","sourceRoot":"","sources":["../src/PhishingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAA6B;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC7C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,6CAA6C,GAC7C,wCAAwC,GACxC,kCAAkC,GAClC,wCAAwC,GACxC,8BAA8B,GAC9B,+BAA+B,GAC/B,oCAAoC,GACpC,mCAAmC,GACnC,sCAAsC,GACtC,oCAAoC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PhishingController-method-action-types.mjs","sourceRoot":"","sources":["../src/PhishingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { PhishingController } from './PhishingController';\n\n/**\n * Conditionally update the phishing configuration.\n *\n * If the stalelist configuration is out of date, this function will call `updateStalelist`\n * to update the configuration. This will automatically grab the hotlist,\n * so it isn't necessary to continue on to download the hotlist and the c2 domain blocklist.\n *\n */\nexport type PhishingControllerMaybeUpdateStateAction = {\n type: `PhishingController:maybeUpdateState`;\n handler: PhishingController['maybeUpdateState'];\n};\n\n/**\n * Determines if a given origin is unapproved.\n *\n * It is strongly recommended that you call {@link maybeUpdateState} before calling this,\n * to check whether the phishing configuration is up-to-date. It will be updated if necessary\n * by calling {@link updateStalelist} or {@link updateHotlist}.\n *\n * @param origin - Domain origin of a website.\n * @returns Whether the origin is an unapproved origin.\n */\nexport type PhishingControllerTestOriginAction = {\n type: `PhishingController:testOrigin`;\n handler: PhishingController['testOrigin'];\n};\n\n/**\n * Checks if a request URL's domain is blocked against the request blocklist.\n *\n * This method is used to determine if a specific request URL is associated with a malicious\n * command and control (C2) domain. The URL's hostname is hashed and checked against a configured\n * blocklist of known malicious domains.\n *\n * @param origin - The full request URL to be checked.\n * @returns An object indicating whether the URL's domain is blocked and relevant metadata.\n */\nexport type PhishingControllerIsBlockedRequestAction = {\n type: `PhishingController:isBlockedRequest`;\n handler: PhishingController['isBlockedRequest'];\n};\n\n/**\n * Temporarily marks a given origin as approved.\n *\n * @param origin - The origin to mark as approved.\n */\nexport type PhishingControllerBypassAction = {\n type: `PhishingController:bypass`;\n handler: PhishingController['bypass'];\n};\n\n/**\n * Scan a URL for phishing. For most hosts only the hostname is sent to the API; for known\n * shared gateways the pathname is included (see `PHISHING_DETECTION_PATH_BASED_ROOT_DOMAINS`).\n * Only supports web URLs (`http:` / `https:`).\n *\n * @param url - The URL to scan.\n * @returns The phishing detection scan result.\n */\nexport type PhishingControllerScanUrlAction = {\n type: `PhishingController:scanUrl`;\n handler: PhishingController['scanUrl'];\n};\n\n/**\n * Scan multiple URLs for phishing in bulk. It will only scan the hostnames of the URLs.\n * It also only supports web URLs.\n *\n * @param urls - The URLs to scan.\n * @returns A mapping of URLs to their phishing detection scan results and errors.\n */\nexport type PhishingControllerBulkScanUrlsAction = {\n type: `PhishingController:bulkScanUrls`;\n handler: PhishingController['bulkScanUrls'];\n};\n\n/**\n * Scan an address for security alerts.\n *\n * @param chainId - The chain ID in hex format (e.g., '0x1' for Ethereum).\n * @param address - The address to scan.\n * @returns The address scan result.\n */\nexport type PhishingControllerScanAddressAction = {\n type: `PhishingController:scanAddress`;\n handler: PhishingController['scanAddress'];\n};\n\n/**\n * Scan multiple tokens for malicious activity in bulk.\n *\n * @param request - The bulk scan request containing chainId and tokens.\n * @param request.chainId - The chain identifier. Accepts a hex chain ID for\n * EVM chains (e.g. `'0x1'` for Ethereum) or a chain name for non-EVM chains\n * (e.g. `'solana'`).\n * @param request.tokens - Array of token addresses to scan.\n * @returns A mapping of token addresses to their scan results. For EVM chains,\n * addresses are lowercased; for non-EVM chains, original casing is preserved.\n * Tokens that fail to scan are omitted.\n */\nexport type PhishingControllerBulkScanTokensAction = {\n type: `PhishingController:bulkScanTokens`;\n handler: PhishingController['bulkScanTokens'];\n};\n\nexport type PhishingControllerGetApprovalsAction = {\n type: `PhishingController:getApprovals`;\n handler: PhishingController['getApprovals'];\n};\n\n/**\n * Union of all PhishingController action types.\n */\nexport type PhishingControllerMethodActions =\n | PhishingControllerMaybeUpdateStateAction\n | PhishingControllerTestOriginAction\n | PhishingControllerIsBlockedRequestAction\n | PhishingControllerBypassAction\n | PhishingControllerScanUrlAction\n | PhishingControllerBulkScanUrlsAction\n | PhishingControllerScanAddressAction\n | PhishingControllerBulkScanTokensAction\n | PhishingControllerGetApprovalsAction;\n"]}
1
+ {"version":3,"file":"PhishingController-method-action-types.mjs","sourceRoot":"","sources":["../src/PhishingController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { PhishingController } from './PhishingController';\n\n/**\n * Finds known recipient addresses that look like an address poisoning match.\n *\n * @param candidate - The recipient address being checked.\n * @returns Similar known recipient matches sorted by score.\n */\nexport type PhishingControllerCheckAddressPoisoningAction = {\n type: `PhishingController:checkAddressPoisoning`;\n handler: PhishingController['checkAddressPoisoning'];\n};\n\n/**\n * Conditionally update the phishing configuration.\n *\n * If the stalelist configuration is out of date, this function will call `updateStalelist`\n * to update the configuration. This will automatically grab the hotlist,\n * so it isn't necessary to continue on to download the hotlist and the c2 domain blocklist.\n *\n */\nexport type PhishingControllerMaybeUpdateStateAction = {\n type: `PhishingController:maybeUpdateState`;\n handler: PhishingController['maybeUpdateState'];\n};\n\n/**\n * Determines if a given origin is unapproved.\n *\n * It is strongly recommended that you call {@link maybeUpdateState} before calling this,\n * to check whether the phishing configuration is up-to-date. It will be updated if necessary\n * by calling {@link updateStalelist} or {@link updateHotlist}.\n *\n * @param origin - Domain origin of a website.\n * @returns Whether the origin is an unapproved origin.\n */\nexport type PhishingControllerTestOriginAction = {\n type: `PhishingController:testOrigin`;\n handler: PhishingController['testOrigin'];\n};\n\n/**\n * Checks if a request URL's domain is blocked against the request blocklist.\n *\n * This method is used to determine if a specific request URL is associated with a malicious\n * command and control (C2) domain. The URL's hostname is hashed and checked against a configured\n * blocklist of known malicious domains.\n *\n * @param origin - The full request URL to be checked.\n * @returns An object indicating whether the URL's domain is blocked and relevant metadata.\n */\nexport type PhishingControllerIsBlockedRequestAction = {\n type: `PhishingController:isBlockedRequest`;\n handler: PhishingController['isBlockedRequest'];\n};\n\n/**\n * Temporarily marks a given origin as approved.\n *\n * @param origin - The origin to mark as approved.\n */\nexport type PhishingControllerBypassAction = {\n type: `PhishingController:bypass`;\n handler: PhishingController['bypass'];\n};\n\n/**\n * Scan a URL for phishing. For most hosts only the hostname is sent to the API; for known\n * shared gateways the pathname is included (see `PHISHING_DETECTION_PATH_BASED_ROOT_DOMAINS`).\n * Only supports web URLs (`http:` / `https:`).\n *\n * @param url - The URL to scan.\n * @returns The phishing detection scan result.\n */\nexport type PhishingControllerScanUrlAction = {\n type: `PhishingController:scanUrl`;\n handler: PhishingController['scanUrl'];\n};\n\n/**\n * Scan multiple URLs for phishing in bulk. It will only scan the hostnames of the URLs.\n * It also only supports web URLs.\n *\n * @param urls - The URLs to scan.\n * @returns A mapping of URLs to their phishing detection scan results and errors.\n */\nexport type PhishingControllerBulkScanUrlsAction = {\n type: `PhishingController:bulkScanUrls`;\n handler: PhishingController['bulkScanUrls'];\n};\n\n/**\n * Scan an address for security alerts.\n *\n * @param chainId - The chain ID in hex format (e.g., '0x1' for Ethereum).\n * @param address - The address to scan.\n * @returns The address scan result.\n */\nexport type PhishingControllerScanAddressAction = {\n type: `PhishingController:scanAddress`;\n handler: PhishingController['scanAddress'];\n};\n\n/**\n * Scan multiple tokens for malicious activity in bulk.\n *\n * @param request - The bulk scan request containing chainId and tokens.\n * @param request.chainId - The chain identifier. Accepts a hex chain ID for\n * EVM chains (e.g. `'0x1'` for Ethereum) or a chain name for non-EVM chains\n * (e.g. `'solana'`).\n * @param request.tokens - Array of token addresses to scan.\n * @returns A mapping of token addresses to their scan results. For EVM chains,\n * addresses are lowercased; for non-EVM chains, original casing is preserved.\n * Tokens that fail to scan are omitted.\n */\nexport type PhishingControllerBulkScanTokensAction = {\n type: `PhishingController:bulkScanTokens`;\n handler: PhishingController['bulkScanTokens'];\n};\n\nexport type PhishingControllerGetApprovalsAction = {\n type: `PhishingController:getApprovals`;\n handler: PhishingController['getApprovals'];\n};\n\n/**\n * Union of all PhishingController action types.\n */\nexport type PhishingControllerMethodActions =\n | PhishingControllerCheckAddressPoisoningAction\n | PhishingControllerMaybeUpdateStateAction\n | PhishingControllerTestOriginAction\n | PhishingControllerIsBlockedRequestAction\n | PhishingControllerBypassAction\n | PhishingControllerScanUrlAction\n | PhishingControllerBulkScanUrlsAction\n | PhishingControllerScanAddressAction\n | PhishingControllerBulkScanTokensAction\n | PhishingControllerGetApprovalsAction;\n"]}
@@ -10,12 +10,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _PhishingController_instances, _PhishingController_detector, _PhishingController_stalelistRefreshInterval, _PhishingController_hotlistRefreshInterval, _PhishingController_c2DomainBlocklistRefreshInterval, _PhishingController_urlScanCache, _PhishingController_tokenScanCache, _PhishingController_addressScanCache, _PhishingController_inProgressHotlistUpdate, _PhishingController_inProgressStalelistUpdate, _PhishingController_isProgressC2DomainBlocklistUpdate, _PhishingController_transactionControllerStateChangeHandler, _PhishingController_subscribeToTransactionControllerStateChange, _PhishingController_isTransactionPatch, _PhishingController_isSimulationDataPatch, _PhishingController_onTransactionControllerStateChange, _PhishingController_getTokensFromTransaction, _PhishingController_scanTokensByChain, _PhishingController_fetchTokenScanBulkResults, _PhishingController_processBatch, _PhishingController_updateStalelist, _PhishingController_updateHotlist, _PhishingController_updateC2DomainBlocklist, _PhishingController_queryConfig;
13
+ var _PhishingController_instances, _PhishingController_detector, _PhishingController_stalelistRefreshInterval, _PhishingController_hotlistRefreshInterval, _PhishingController_c2DomainBlocklistRefreshInterval, _PhishingController_urlScanCache, _PhishingController_tokenScanCache, _PhishingController_addressScanCache, _PhishingController_knownRecipients, _PhishingController_transactionRecipients, _PhishingController_transactionRecipientsByTransactionId, _PhishingController_transactionRecipientCounts, _PhishingController_addressBookRecipients, _PhishingController_inProgressHotlistUpdate, _PhishingController_inProgressStalelistUpdate, _PhishingController_isProgressC2DomainBlocklistUpdate, _PhishingController_transactionControllerStateChangeHandler, _PhishingController_addressBookControllerStateChangeHandler, _PhishingController_subscribeToAddressBookControllerStateChange, _PhishingController_subscribeToTransactionControllerStateChange, _PhishingController_isTransactionPatch, _PhishingController_isSimulationDataPatch, _PhishingController_onTransactionControllerStateChange, _PhishingController_onAddressBookControllerStateChange, _PhishingController_getTokensFromTransaction, _PhishingController_scanTokensByChain, _PhishingController_hydrateKnownRecipients, _PhishingController_hydrateKnownRecipientsFromTransactionState, _PhishingController_hydrateKnownRecipientsFromAddressBookState, _PhishingController_setKnownRecipientsFromTransactionState, _PhishingController_updateKnownRecipientsFromTransactionPatches, _PhishingController_getTransactionFromPatchValue, _PhishingController_updateTransactionRecipients, _PhishingController_addTransactionRecipients, _PhishingController_removeTransactionRecipients, _PhishingController_setKnownRecipientsFromAddressBookState, _PhishingController_rebuildKnownRecipients, _PhishingController_getAddressBookRecipients, _PhishingController_getRecipientAddressesFromTransaction, _PhishingController_normalizeAddress, _PhishingController_fetchTokenScanBulkResults, _PhishingController_processBatch, _PhishingController_updateStalelist, _PhishingController_updateHotlist, _PhishingController_updateC2DomainBlocklist, _PhishingController_queryConfig;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.PhishingController = exports.phishingListKeyNameMap = exports.ListNames = exports.ListKeys = exports.C2_DOMAIN_BLOCKLIST_URL = exports.METAMASK_HOTLIST_DIFF_URL = exports.METAMASK_STALELIST_URL = exports.STALELIST_REFRESH_INTERVAL = exports.HOTLIST_REFRESH_INTERVAL = exports.C2_DOMAIN_BLOCKLIST_REFRESH_INTERVAL = exports.DEFAULT_ADDRESS_SCAN_CACHE_MAX_SIZE = exports.DEFAULT_ADDRESS_SCAN_CACHE_TTL = exports.DEFAULT_TOKEN_SCAN_CACHE_MAX_SIZE = exports.DEFAULT_TOKEN_SCAN_CACHE_TTL = exports.DEFAULT_URL_SCAN_CACHE_MAX_SIZE = exports.DEFAULT_URL_SCAN_CACHE_TTL = exports.APPROVALS_ENDPOINT = exports.ADDRESS_SCAN_ENDPOINT = exports.TOKEN_BULK_SCANNING_ENDPOINT = exports.SECURITY_ALERTS_BASE_URL = exports.PHISHING_DETECTION_BULK_SCAN_ENDPOINT = exports.PHISHING_DETECTION_SCAN_ENDPOINT = exports.PHISHING_DETECTION_BASE_URL = exports.C2_DOMAIN_BLOCKLIST_ENDPOINT = exports.CLIENT_SIDE_DETECION_BASE_URL = exports.METAMASK_HOTLIST_DIFF_FILE = exports.METAMASK_STALELIST_FILE = exports.PHISHING_CONFIG_BASE_URL = void 0;
16
16
  const base_controller_1 = require("@metamask/base-controller");
17
17
  const controller_utils_1 = require("@metamask/controller-utils");
18
+ const transaction_controller_1 = require("@metamask/transaction-controller");
18
19
  const punycode_js_1 = require("punycode/punycode.js");
20
+ const address_poisoning_1 = require("./address-poisoning.cjs");
19
21
  const CacheManager_1 = require("./CacheManager.cjs");
20
22
  const PathTrie_1 = require("./PathTrie.cjs");
21
23
  const PhishingDetector_1 = require("./PhishingDetector.cjs");
@@ -160,6 +162,7 @@ const MESSENGER_EXPOSED_METHODS = [
160
162
  'bulkScanTokens',
161
163
  'scanAddress',
162
164
  'getApprovals',
165
+ 'checkAddressPoisoning',
163
166
  ];
164
167
  /**
165
168
  * Controller that manages community-maintained lists of approved and unapproved website origins.
@@ -201,10 +204,16 @@ class PhishingController extends base_controller_1.BaseController {
201
204
  _PhishingController_urlScanCache.set(this, void 0);
202
205
  _PhishingController_tokenScanCache.set(this, void 0);
203
206
  _PhishingController_addressScanCache.set(this, void 0);
207
+ _PhishingController_knownRecipients.set(this, void 0);
208
+ _PhishingController_transactionRecipients.set(this, void 0);
209
+ _PhishingController_transactionRecipientsByTransactionId.set(this, void 0);
210
+ _PhishingController_transactionRecipientCounts.set(this, void 0);
211
+ _PhishingController_addressBookRecipients.set(this, void 0);
204
212
  _PhishingController_inProgressHotlistUpdate.set(this, void 0);
205
213
  _PhishingController_inProgressStalelistUpdate.set(this, void 0);
206
214
  _PhishingController_isProgressC2DomainBlocklistUpdate.set(this, void 0);
207
215
  _PhishingController_transactionControllerStateChangeHandler.set(this, void 0);
216
+ _PhishingController_addressBookControllerStateChangeHandler.set(this, void 0);
208
217
  /**
209
218
  * Determines if a given origin is unapproved.
210
219
  *
@@ -252,10 +261,9 @@ class PhishingController extends base_controller_1.BaseController {
252
261
  console.error(`Error scanning tokens: timeout of ${timeout}ms exceeded`);
253
262
  return null;
254
263
  }
255
- if ('error' in apiResponse &&
256
- 'status' in apiResponse &&
257
- 'statusText' in apiResponse) {
258
- console.warn(`Token bulk screening API error: ${apiResponse.status} ${apiResponse.statusText}`);
264
+ if (apiResponse.error) {
265
+ const { status, statusText } = apiResponse;
266
+ console.warn(`Token bulk screening API error: ${status} ${statusText}`);
259
267
  return null;
260
268
  }
261
269
  return apiResponse;
@@ -295,8 +303,10 @@ class PhishingController extends base_controller_1.BaseController {
295
303
  const data = await res.json();
296
304
  return data;
297
305
  }, true, 5000);
298
- if (!apiResponse ||
299
- 'error' in apiResponse ||
306
+ if (!apiResponse) {
307
+ return { approvals: [] };
308
+ }
309
+ if (apiResponse.error ||
300
310
  !Array.isArray(apiResponse.approvals)) {
301
311
  return { approvals: [] };
302
312
  }
@@ -338,13 +348,12 @@ class PhishingController extends base_controller_1.BaseController {
338
348
  };
339
349
  }
340
350
  // Handle HTTP error responses
341
- if ('error' in apiResponse &&
342
- 'status' in apiResponse &&
343
- 'statusText' in apiResponse) {
351
+ if (apiResponse.error) {
352
+ const { status, statusText } = apiResponse;
344
353
  return {
345
354
  results: {},
346
355
  errors: {
347
- api_error: [`${apiResponse.status} ${apiResponse.statusText}`],
356
+ api_error: [`${status} ${statusText}`],
348
357
  },
349
358
  };
350
359
  }
@@ -353,7 +362,13 @@ class PhishingController extends base_controller_1.BaseController {
353
362
  __classPrivateFieldSet(this, _PhishingController_stalelistRefreshInterval, stalelistRefreshInterval, "f");
354
363
  __classPrivateFieldSet(this, _PhishingController_hotlistRefreshInterval, hotlistRefreshInterval, "f");
355
364
  __classPrivateFieldSet(this, _PhishingController_c2DomainBlocklistRefreshInterval, c2DomainBlocklistRefreshInterval, "f");
365
+ __classPrivateFieldSet(this, _PhishingController_knownRecipients, new Set(), "f");
366
+ __classPrivateFieldSet(this, _PhishingController_transactionRecipients, new Set(), "f");
367
+ __classPrivateFieldSet(this, _PhishingController_transactionRecipientsByTransactionId, new Map(), "f");
368
+ __classPrivateFieldSet(this, _PhishingController_transactionRecipientCounts, new Map(), "f");
369
+ __classPrivateFieldSet(this, _PhishingController_addressBookRecipients, new Set(), "f");
356
370
  __classPrivateFieldSet(this, _PhishingController_transactionControllerStateChangeHandler, __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_onTransactionControllerStateChange).bind(this), "f");
371
+ __classPrivateFieldSet(this, _PhishingController_addressBookControllerStateChangeHandler, __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_onAddressBookControllerStateChange).bind(this), "f");
357
372
  __classPrivateFieldSet(this, _PhishingController_urlScanCache, new CacheManager_1.CacheManager({
358
373
  cacheTTL: urlScanCacheTTL,
359
374
  maxCacheSize: urlScanCacheMaxSize,
@@ -386,6 +401,8 @@ class PhishingController extends base_controller_1.BaseController {
386
401
  }), "f");
387
402
  this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
388
403
  this.updatePhishingDetector();
404
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_hydrateKnownRecipients).call(this);
405
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_subscribeToAddressBookControllerStateChange).call(this);
389
406
  __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_subscribeToTransactionControllerStateChange).call(this);
390
407
  }
391
408
  /**
@@ -394,6 +411,15 @@ class PhishingController extends base_controller_1.BaseController {
394
411
  updatePhishingDetector() {
395
412
  __classPrivateFieldSet(this, _PhishingController_detector, new PhishingDetector_1.PhishingDetector(this.state.phishingLists), "f");
396
413
  }
414
+ /**
415
+ * Finds known recipient addresses that look like an address poisoning match.
416
+ *
417
+ * @param candidate - The recipient address being checked.
418
+ * @returns Similar known recipient matches sorted by score.
419
+ */
420
+ checkAddressPoisoning(candidate) {
421
+ return (0, address_poisoning_1.findSimilarAddresses)(candidate, Array.from(__classPrivateFieldGet(this, _PhishingController_knownRecipients, "f")));
422
+ }
397
423
  /**
398
424
  * Determine if an update to the stalelist configuration is needed.
399
425
  *
@@ -613,16 +639,17 @@ class PhishingController extends base_controller_1.BaseController {
613
639
  fetchError: 'timeout of 8000ms exceeded',
614
640
  };
615
641
  }
616
- else if ('error' in apiResponse) {
642
+ else if (apiResponse.error) {
617
643
  return {
618
644
  hostname: '',
619
645
  recommendedAction: types_1.RecommendedAction.None,
620
646
  fetchError: apiResponse.error,
621
647
  };
622
648
  }
649
+ const scanResult = apiResponse;
623
650
  const result = {
624
651
  hostname,
625
- recommendedAction: apiResponse.recommendedAction,
652
+ recommendedAction: scanResult.recommendedAction,
626
653
  };
627
654
  __classPrivateFieldGet(this, _PhishingController_urlScanCache, "f").set(scanUrlParam, result);
628
655
  return result;
@@ -773,20 +800,21 @@ class PhishingController extends base_controller_1.BaseController {
773
800
  label: '',
774
801
  };
775
802
  }
776
- else if ('error' in apiResponse) {
803
+ else if (apiResponse.error) {
777
804
  return {
778
805
  result_type: types_1.AddressScanResultType.ErrorResult,
779
806
  label: '',
780
807
  };
781
808
  }
809
+ const scanResult = apiResponse;
782
810
  const result = {
783
- result_type: apiResponse.result_type,
784
- label: apiResponse.label,
811
+ result_type: scanResult.result_type,
812
+ label: scanResult.label,
785
813
  };
786
814
  __classPrivateFieldGet(this, _PhishingController_addressScanCache, "f").set(cacheKey, result);
787
815
  return {
788
- result_type: apiResponse.result_type,
789
- label: apiResponse.label,
816
+ result_type: scanResult.result_type,
817
+ label: scanResult.label,
790
818
  };
791
819
  }
792
820
  /**
@@ -853,8 +881,14 @@ class PhishingController extends base_controller_1.BaseController {
853
881
  }
854
882
  }
855
883
  exports.PhishingController = PhishingController;
856
- _PhishingController_detector = new WeakMap(), _PhishingController_stalelistRefreshInterval = new WeakMap(), _PhishingController_hotlistRefreshInterval = new WeakMap(), _PhishingController_c2DomainBlocklistRefreshInterval = new WeakMap(), _PhishingController_urlScanCache = new WeakMap(), _PhishingController_tokenScanCache = new WeakMap(), _PhishingController_addressScanCache = new WeakMap(), _PhishingController_inProgressHotlistUpdate = new WeakMap(), _PhishingController_inProgressStalelistUpdate = new WeakMap(), _PhishingController_isProgressC2DomainBlocklistUpdate = new WeakMap(), _PhishingController_transactionControllerStateChangeHandler = new WeakMap(), _PhishingController_fetchTokenScanBulkResults = new WeakMap(), _PhishingController_processBatch = new WeakMap(), _PhishingController_instances = new WeakSet(), _PhishingController_subscribeToTransactionControllerStateChange = function _PhishingController_subscribeToTransactionControllerStateChange() {
857
- this.messenger.subscribe('TransactionController:stateChange', __classPrivateFieldGet(this, _PhishingController_transactionControllerStateChangeHandler, "f"));
884
+ _PhishingController_detector = new WeakMap(), _PhishingController_stalelistRefreshInterval = new WeakMap(), _PhishingController_hotlistRefreshInterval = new WeakMap(), _PhishingController_c2DomainBlocklistRefreshInterval = new WeakMap(), _PhishingController_urlScanCache = new WeakMap(), _PhishingController_tokenScanCache = new WeakMap(), _PhishingController_addressScanCache = new WeakMap(), _PhishingController_knownRecipients = new WeakMap(), _PhishingController_transactionRecipients = new WeakMap(), _PhishingController_transactionRecipientsByTransactionId = new WeakMap(), _PhishingController_transactionRecipientCounts = new WeakMap(), _PhishingController_addressBookRecipients = new WeakMap(), _PhishingController_inProgressHotlistUpdate = new WeakMap(), _PhishingController_inProgressStalelistUpdate = new WeakMap(), _PhishingController_isProgressC2DomainBlocklistUpdate = new WeakMap(), _PhishingController_transactionControllerStateChangeHandler = new WeakMap(), _PhishingController_addressBookControllerStateChangeHandler = new WeakMap(), _PhishingController_fetchTokenScanBulkResults = new WeakMap(), _PhishingController_processBatch = new WeakMap(), _PhishingController_instances = new WeakSet(), _PhishingController_subscribeToAddressBookControllerStateChange = function _PhishingController_subscribeToAddressBookControllerStateChange() {
885
+ this.messenger.subscribe(
886
+ // eslint-disable-next-line no-restricted-syntax
887
+ 'AddressBookController:stateChange', __classPrivateFieldGet(this, _PhishingController_addressBookControllerStateChangeHandler, "f"));
888
+ }, _PhishingController_subscribeToTransactionControllerStateChange = function _PhishingController_subscribeToTransactionControllerStateChange() {
889
+ this.messenger.subscribe(
890
+ // eslint-disable-next-line no-restricted-syntax
891
+ 'TransactionController:stateChange', __classPrivateFieldGet(this, _PhishingController_transactionControllerStateChangeHandler, "f"));
858
892
  }, _PhishingController_isTransactionPatch = function _PhishingController_isTransactionPatch(patch) {
859
893
  const { path } = patch;
860
894
  return (path.length === 2 &&
@@ -868,6 +902,12 @@ _PhishingController_detector = new WeakMap(), _PhishingController_stalelistRefre
868
902
  path[2] === 'simulationData');
869
903
  }, _PhishingController_onTransactionControllerStateChange = function _PhishingController_onTransactionControllerStateChange(_state, patches) {
870
904
  try {
905
+ try {
906
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_updateKnownRecipientsFromTransactionPatches).call(this, _state, patches);
907
+ }
908
+ catch (error) {
909
+ console.error('Error updating known recipients from transaction state:', error);
910
+ }
871
911
  const tokensByChain = new Map();
872
912
  for (const patch of patches) {
873
913
  if (patch.op === 'remove') {
@@ -889,6 +929,8 @@ _PhishingController_detector = new WeakMap(), _PhishingController_stalelistRefre
889
929
  catch (error) {
890
930
  console.error('Error processing transaction state change:', error);
891
931
  }
932
+ }, _PhishingController_onAddressBookControllerStateChange = function _PhishingController_onAddressBookControllerStateChange(state) {
933
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_setKnownRecipientsFromAddressBookState).call(this, state);
892
934
  }, _PhishingController_getTokensFromTransaction = function _PhishingController_getTokensFromTransaction(transaction, tokensByChain) {
893
935
  // extract token addresses from simulation data
894
936
  const tokenAddresses = transaction.simulationData?.tokenBalanceChanges?.map((tokenChange) => tokenChange.address.toLowerCase());
@@ -915,6 +957,139 @@ _PhishingController_detector = new WeakMap(), _PhishingController_stalelistRefre
915
957
  }).catch((error) => console.error(`Error scanning tokens for chain ${chainId}:`, error));
916
958
  }
917
959
  }
960
+ }, _PhishingController_hydrateKnownRecipients = function _PhishingController_hydrateKnownRecipients() {
961
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_hydrateKnownRecipientsFromTransactionState).call(this);
962
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_hydrateKnownRecipientsFromAddressBookState).call(this);
963
+ }, _PhishingController_hydrateKnownRecipientsFromTransactionState = function _PhishingController_hydrateKnownRecipientsFromTransactionState() {
964
+ try {
965
+ const state = this.messenger.call('TransactionController:getState');
966
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_setKnownRecipientsFromTransactionState).call(this, state);
967
+ }
968
+ catch (error) {
969
+ console.error('Unable to hydrate known recipients from TransactionController state; address poisoning checks will not include existing confirmed transactions.', error);
970
+ }
971
+ }, _PhishingController_hydrateKnownRecipientsFromAddressBookState = function _PhishingController_hydrateKnownRecipientsFromAddressBookState() {
972
+ try {
973
+ const state = this.messenger.call('AddressBookController:getState');
974
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_setKnownRecipientsFromAddressBookState).call(this, state);
975
+ }
976
+ catch (error) {
977
+ console.error('Unable to hydrate known recipients from AddressBookController state; address poisoning checks will not include existing address book entries.', error);
978
+ }
979
+ }, _PhishingController_setKnownRecipientsFromTransactionState = function _PhishingController_setKnownRecipientsFromTransactionState(state) {
980
+ __classPrivateFieldGet(this, _PhishingController_transactionRecipients, "f").clear();
981
+ __classPrivateFieldGet(this, _PhishingController_transactionRecipientsByTransactionId, "f").clear();
982
+ __classPrivateFieldGet(this, _PhishingController_transactionRecipientCounts, "f").clear();
983
+ for (const transaction of state.transactions) {
984
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_addTransactionRecipients).call(this, transaction);
985
+ }
986
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_rebuildKnownRecipients).call(this);
987
+ }, _PhishingController_updateKnownRecipientsFromTransactionPatches = function _PhishingController_updateKnownRecipientsFromTransactionPatches(state, patches) {
988
+ let recipientsChanged = false;
989
+ for (const patch of patches) {
990
+ if (patch.path[0] !== 'transactions') {
991
+ continue;
992
+ }
993
+ if (patch.path.length === 1) {
994
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_setKnownRecipientsFromTransactionState).call(this, state);
995
+ return;
996
+ }
997
+ const transactionIndex = patch.path[1];
998
+ if (transactionIndex === 'length') {
999
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_setKnownRecipientsFromTransactionState).call(this, state);
1000
+ return;
1001
+ }
1002
+ if (patch.op === 'remove') {
1003
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_setKnownRecipientsFromTransactionState).call(this, state);
1004
+ return;
1005
+ }
1006
+ if (typeof transactionIndex !== 'number') {
1007
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_setKnownRecipientsFromTransactionState).call(this, state);
1008
+ return;
1009
+ }
1010
+ const transaction = __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_getTransactionFromPatchValue).call(this, patch.value) ??
1011
+ state.transactions[transactionIndex];
1012
+ if (!transaction) {
1013
+ continue;
1014
+ }
1015
+ recipientsChanged =
1016
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_updateTransactionRecipients).call(this, transaction) || recipientsChanged;
1017
+ }
1018
+ if (recipientsChanged) {
1019
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_rebuildKnownRecipients).call(this);
1020
+ }
1021
+ }, _PhishingController_getTransactionFromPatchValue = function _PhishingController_getTransactionFromPatchValue(value) {
1022
+ const transaction = value;
1023
+ if (value &&
1024
+ typeof value === 'object' &&
1025
+ typeof transaction.id === 'string' &&
1026
+ transaction.txParams !== undefined) {
1027
+ return value;
1028
+ }
1029
+ return undefined;
1030
+ }, _PhishingController_updateTransactionRecipients = function _PhishingController_updateTransactionRecipients(transaction) {
1031
+ const recipientsRemoved = __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_removeTransactionRecipients).call(this, transaction.id);
1032
+ const recipientsAdded = __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_addTransactionRecipients).call(this, transaction);
1033
+ return recipientsRemoved || recipientsAdded;
1034
+ }, _PhishingController_addTransactionRecipients = function _PhishingController_addTransactionRecipients(transaction) {
1035
+ const recipients = __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_getRecipientAddressesFromTransaction).call(this, transaction);
1036
+ if (recipients.length === 0) {
1037
+ return false;
1038
+ }
1039
+ __classPrivateFieldGet(this, _PhishingController_transactionRecipientsByTransactionId, "f").set(transaction.id, new Set(recipients));
1040
+ for (const address of recipients) {
1041
+ const count = __classPrivateFieldGet(this, _PhishingController_transactionRecipientCounts, "f").get(address) ?? 0;
1042
+ __classPrivateFieldGet(this, _PhishingController_transactionRecipientCounts, "f").set(address, count + 1);
1043
+ __classPrivateFieldGet(this, _PhishingController_transactionRecipients, "f").add(address);
1044
+ }
1045
+ return true;
1046
+ }, _PhishingController_removeTransactionRecipients = function _PhishingController_removeTransactionRecipients(transactionId) {
1047
+ const recipients = __classPrivateFieldGet(this, _PhishingController_transactionRecipientsByTransactionId, "f").get(transactionId);
1048
+ if (!recipients) {
1049
+ return false;
1050
+ }
1051
+ __classPrivateFieldGet(this, _PhishingController_transactionRecipientsByTransactionId, "f").delete(transactionId);
1052
+ for (const address of recipients) {
1053
+ const count = __classPrivateFieldGet(this, _PhishingController_transactionRecipientCounts, "f").get(address);
1054
+ if (count <= 1) {
1055
+ __classPrivateFieldGet(this, _PhishingController_transactionRecipientCounts, "f").delete(address);
1056
+ __classPrivateFieldGet(this, _PhishingController_transactionRecipients, "f").delete(address);
1057
+ }
1058
+ else {
1059
+ __classPrivateFieldGet(this, _PhishingController_transactionRecipientCounts, "f").set(address, count - 1);
1060
+ }
1061
+ }
1062
+ return true;
1063
+ }, _PhishingController_setKnownRecipientsFromAddressBookState = function _PhishingController_setKnownRecipientsFromAddressBookState(state) {
1064
+ __classPrivateFieldGet(this, _PhishingController_addressBookRecipients, "f").clear();
1065
+ for (const address of __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_getAddressBookRecipients).call(this, state)) {
1066
+ __classPrivateFieldGet(this, _PhishingController_addressBookRecipients, "f").add(address);
1067
+ }
1068
+ __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_rebuildKnownRecipients).call(this);
1069
+ }, _PhishingController_rebuildKnownRecipients = function _PhishingController_rebuildKnownRecipients() {
1070
+ __classPrivateFieldGet(this, _PhishingController_knownRecipients, "f").clear();
1071
+ for (const address of __classPrivateFieldGet(this, _PhishingController_transactionRecipients, "f")) {
1072
+ __classPrivateFieldGet(this, _PhishingController_knownRecipients, "f").add(address);
1073
+ }
1074
+ for (const address of __classPrivateFieldGet(this, _PhishingController_addressBookRecipients, "f")) {
1075
+ __classPrivateFieldGet(this, _PhishingController_knownRecipients, "f").add(address);
1076
+ }
1077
+ }, _PhishingController_getAddressBookRecipients = function _PhishingController_getAddressBookRecipients(state) {
1078
+ return new Set(Object.values(state.addressBook)
1079
+ .flatMap((entriesByAddress) => Object.values(entriesByAddress))
1080
+ .map((entry) => entry.address.toLowerCase()));
1081
+ }, _PhishingController_getRecipientAddressesFromTransaction = function _PhishingController_getRecipientAddressesFromTransaction(transaction) {
1082
+ if (transaction.status !== transaction_controller_1.TransactionStatus.confirmed) {
1083
+ return [];
1084
+ }
1085
+ const transactionRecipient = __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_normalizeAddress).call(this, transaction.txParams.to);
1086
+ const swapAndSendRecipient = __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_normalizeAddress).call(this, transaction.swapAndSendRecipient);
1087
+ return Array.from(new Set([transactionRecipient, swapAndSendRecipient].filter((address) => Boolean(address))));
1088
+ }, _PhishingController_normalizeAddress = function _PhishingController_normalizeAddress(address) {
1089
+ if (!address || !(0, controller_utils_1.isValidHexAddress)(address, { allowNonPrefixed: false })) {
1090
+ return null;
1091
+ }
1092
+ return address.toLowerCase();
918
1093
  }, _PhishingController_updateStalelist =
919
1094
  /**
920
1095
  * Update the stalelist configuration.