@metamask-previews/compliance-controller 0.0.0-preview-9848b08

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Initial release ([#7945](https://github.com/MetaMask/core/pull/7945))
13
+ - Add `ComplianceController` for managing OFAC compliance state for wallet addresses.
14
+ - Add `ComplianceService` for fetching compliance data from the Compliance API.
15
+
16
+ [Unreleased]: https://github.com/MetaMask/core/
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MetaMask
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # `@metamask/compliance-controller`
2
+
3
+ Manages OFAC compliance checks for wallet addresses by interfacing with the Compliance API.
4
+
5
+ ## Overview
6
+
7
+ This package provides:
8
+
9
+ - **`ComplianceService`** — A data service that communicates with the Compliance API to check whether wallet addresses are sanctioned under OFAC regulations.
10
+ - **`ComplianceController`** — A controller that manages compliance state, caching wallet compliance results and blocked wallet lists.
11
+
12
+ ## Installation
13
+
14
+ `yarn add @metamask/compliance-controller`
15
+
16
+ or
17
+
18
+ `npm install @metamask/compliance-controller`
19
+
20
+ ## Usage
21
+
22
+ ```typescript
23
+ import { Messenger } from '@metamask/messenger';
24
+ import {
25
+ ComplianceController,
26
+ ComplianceService,
27
+ } from '@metamask/compliance-controller';
28
+ import type {
29
+ ComplianceControllerActions,
30
+ ComplianceControllerEvents,
31
+ ComplianceServiceActions,
32
+ ComplianceServiceEvents,
33
+ } from '@metamask/compliance-controller';
34
+
35
+ // Set up the root messenger
36
+ const rootMessenger = new Messenger<
37
+ 'Root',
38
+ ComplianceServiceActions | ComplianceControllerActions,
39
+ ComplianceServiceEvents | ComplianceControllerEvents
40
+ >({ namespace: 'Root' });
41
+
42
+ // Create service messenger and service
43
+ const serviceMessenger = new Messenger({
44
+ namespace: 'ComplianceService',
45
+ parent: rootMessenger,
46
+ });
47
+ new ComplianceService({
48
+ messenger: serviceMessenger,
49
+ fetch,
50
+ env: 'production',
51
+ });
52
+
53
+ // Create controller messenger and controller
54
+ const controllerMessenger = new Messenger({
55
+ namespace: 'ComplianceController',
56
+ parent: rootMessenger,
57
+ });
58
+ const controller = new ComplianceController({
59
+ messenger: controllerMessenger,
60
+ });
61
+
62
+ // Check a single wallet
63
+ await rootMessenger.call(
64
+ 'ComplianceController:checkWalletCompliance',
65
+ '0x1234...',
66
+ );
67
+
68
+ // Check multiple wallets
69
+ await rootMessenger.call('ComplianceController:checkWalletsCompliance', [
70
+ '0x1234...',
71
+ '0x5678...',
72
+ ]);
73
+
74
+ // Fetch the full blocked wallets list
75
+ await rootMessenger.call('ComplianceController:updateBlockedWallets');
76
+ ```
77
+
78
+ ## Contributing
79
+
80
+ This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@metamask-previews/compliance-controller",
3
+ "version": "0.0.0-preview-9848b08",
4
+ "description": "Manages OFAC compliance checks for wallet addresses",
5
+ "keywords": [
6
+ "MetaMask",
7
+ "Ethereum"
8
+ ],
9
+ "homepage": "https://github.com/MetaMask/core/tree/main/packages/compliance-controller#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/MetaMask/core/issues"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/MetaMask/core.git"
16
+ },
17
+ "license": "MIT",
18
+ "sideEffects": false,
19
+ "exports": {
20
+ ".": {
21
+ "import": {
22
+ "types": "./dist/index.d.mts",
23
+ "default": "./dist/index.mjs"
24
+ },
25
+ "require": {
26
+ "types": "./dist/index.d.cts",
27
+ "default": "./dist/index.cjs"
28
+ }
29
+ },
30
+ "./package.json": "./package.json"
31
+ },
32
+ "main": "./dist/index.cjs",
33
+ "types": "./dist/index.d.cts",
34
+ "files": [
35
+ "dist/"
36
+ ],
37
+ "scripts": {
38
+ "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
39
+ "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
40
+ "build:docs": "typedoc",
41
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/compliance-controller",
42
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/compliance-controller",
43
+ "publish:preview": "yarn npm publish --tag preview",
44
+ "since-latest-release": "../../scripts/since-latest-release.sh",
45
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
46
+ "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
47
+ "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
48
+ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
49
+ },
50
+ "dependencies": {
51
+ "@metamask/base-controller": "^9.0.0",
52
+ "@metamask/controller-utils": "^11.18.0",
53
+ "@metamask/messenger": "^0.3.0",
54
+ "@metamask/superstruct": "^3.1.0",
55
+ "@metamask/utils": "^11.9.0",
56
+ "reselect": "^5.1.1"
57
+ },
58
+ "devDependencies": {
59
+ "@metamask/auto-changelog": "^3.4.4",
60
+ "@ts-bridge/cli": "^0.6.4",
61
+ "@types/jest": "^29.5.14",
62
+ "deepmerge": "^4.2.2",
63
+ "jest": "^29.7.0",
64
+ "nock": "^13.3.1",
65
+ "ts-jest": "^29.2.5",
66
+ "typedoc": "^0.25.13",
67
+ "typedoc-plugin-missing-exports": "^2.0.0",
68
+ "typescript": "~5.3.3"
69
+ },
70
+ "engines": {
71
+ "node": "^18.18 || >=20"
72
+ },
73
+ "publishConfig": {
74
+ "access": "public",
75
+ "registry": "https://registry.npmjs.org/"
76
+ }
77
+ }