Skip to content

feat(compliance-controller): add configured Compliance API support#8820

Open
geositta wants to merge 14 commits into
mainfrom
feat/compliance-api-support
Open

feat(compliance-controller): add configured Compliance API support#8820
geositta wants to merge 14 commits into
mainfrom
feat/compliance-api-support

Conversation

@geositta
Copy link
Copy Markdown

@geositta geositta commented May 14, 2026

Explanation

This updates @metamask/compliance-controller so clients can pass an explicit Compliance API URL into ComplianceService, allowing Extension and Mobile to source the endpoint from build configuration instead of hardcoding environment switches in application code. If no apiUrl is provided, the service keeps env as a fallback and defaults to production.

This also moves the blocked-wallet lookup behavior into the shared controller package. Cached EVM wallet compliance statuses now exact-match first, then fall back to case-insensitive matching for valid 0x EVM addresses only; non-EVM addresses remain exact-match only. The package now also exports selectAreAnyWalletsBlocked so clients can share the same selector behavior.

References

Related to Extension and Mobile compliance controller integration work. Client adoption can follow after this package change is released and consumed.

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

Note

Medium Risk
Changes request routing for the compliance API by allowing a configurable base URL and tweaks cached compliance lookups to fall back on case-insensitive matching for EVM addresses, which could affect network calls and blocked-status results if misconfigured.

Overview
Adds ComplianceServiceOptions.apiUrl to allow callers to provide an explicit Compliance API base URL (defaulting env to production when unset), including validation (no query/fragment) and correct URL joining that preserves path components.

Fixes cached blocked-wallet lookups to be casing-tolerant for valid 0x EVM addresses via shared getWalletComplianceStatus, and introduces/export selectAreAnyWalletsBlocked alongside the updated selectIsWalletBlocked.

Updates README/changelog and expands unit coverage for the new URL behavior and EVM-case-insensitive cache fallback in both controller actions and selectors.

Reviewed by Cursor Bugbot for commit ce4d3bf. Bugbot is set up for automated code reviews on this repo. Configure here.

@geositta geositta force-pushed the feat/compliance-api-support branch from e15e182 to dc5b149 Compare May 14, 2026 20:04
@geositta geositta marked this pull request as ready for review May 14, 2026 22:00
@geositta geositta requested review from a team as code owners May 14, 2026 22:00
@geositta geositta temporarily deployed to default-branch May 14, 2026 22:01 — with GitHub Actions Inactive
Comment thread packages/perps-controller/CHANGELOG.md Outdated
Comment thread packages/perps-controller/src/types/messenger.ts Outdated
Comment thread packages/perps-controller/src/utils/accountUtils.ts Outdated
Comment thread packages/perps-controller/src/utils/accountUtils.ts Outdated
Copy link
Copy Markdown

@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.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 1c7c513. Configure here.

Comment thread packages/perps-controller/src/utils/accountUtils.ts Outdated
Copy link
Copy Markdown
Contributor

@abretonc7s abretonc7s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a matching mobile PR? It should be split the compliance controller only on this PR. And separately sync mobile

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.

2 participants