-
-
Notifications
You must be signed in to change notification settings - Fork 269
Feat/add config registry controller #7668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bac9bd9
c36c531
be2165a
e82db65
7987032
a4dbfca
3f3ce9c
6e2a128
77e35fd
d2bee1f
be0831f
d1f2251
416e8e9
61d9942
bd0fd60
980ac4e
945154a
ab102d8
5f11236
0503c7d
339d975
01aabb3
d628f08
4dcacf2
e53de80
b6e620e
aab4f56
b5ebdd0
839e62c
c07d12a
181d1e2
464d78b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,8 @@ scripts/coverage | |
| !.yarn/releases | ||
| !.yarn/sdks | ||
| !.yarn/versions | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these changes necessary here? Can they go in a different PR? |
||
| .yalc | ||
| yalc.lock | ||
| # typescript | ||
| packages/*/*.tsbuildinfo | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,6 @@ | |
| "@metamask/eth-block-tracker": "^15.0.1", | ||
| "@metamask/eth-json-rpc-provider": "^6.0.0", | ||
| "@metamask/json-rpc-engine": "^10.2.1", | ||
| "@metamask/network-controller": "^29.0.0", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these changes necessary? Should they go in a new PR? |
||
| "@metamask/utils": "^11.9.0", | ||
| "@ts-bridge/cli": "^0.6.4", | ||
| "@types/jest": "^27.4.1", | ||
|
|
@@ -112,7 +111,8 @@ | |
| "@keystonehq/bc-ur-registry-eth>hdkey>secp256k1": true, | ||
| "babel-runtime>core-js": false, | ||
| "simple-git-hooks": false, | ||
| "tsx>esbuild": false | ||
| "tsx>esbuild": false, | ||
| "eslint-plugin-import-x>unrs-resolver": false | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## [Unreleased] | ||
|
|
||
| ### Added | ||
|
|
||
| - Initial release of `@metamask/config-registry-controller` ([#7668](https://github.com/MetaMask/core/pull/7668)) | ||
| - Controller for fetching and managing network configurations from a remote API | ||
| - ConfigRegistryApiService with ETag support, retries, circuit breaker, and timeout handling | ||
| - Network filtering to only include featured, active, non-testnet networks | ||
| - Feature flag integration using `config_registry_api_enabled` to enable/disable API fetching | ||
| - Fallback configuration support when API is unavailable or feature flag is disabled | ||
| - State persistence for configs, version, lastFetched, and etag | ||
| - Uses StaticIntervalPollingController for periodic updates (default: 24 hours) | ||
|
|
||
| [Unreleased]: https://github.com/MetaMask/core/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 MetaMask | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # `@metamask/config-registry-controller` | ||
|
|
||
| Manages configuration registry for MetaMask | ||
|
|
||
| ## Installation | ||
|
|
||
| `yarn add @metamask/config-registry-controller` | ||
|
|
||
| or | ||
|
|
||
| `npm install @metamask/config-registry-controller` | ||
|
|
||
| ## Contributing | ||
|
|
||
| This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * For a detailed explanation regarding each configuration property and type check, visit: | ||
| * https://jestjs.io/docs/configuration | ||
| */ | ||
|
|
||
| const merge = require('deepmerge'); | ||
| const path = require('path'); | ||
|
|
||
| const baseConfig = require('../../jest.config.packages'); | ||
|
|
||
| const displayName = path.basename(__dirname); | ||
|
|
||
| module.exports = merge(baseConfig, { | ||
| // The display name when running multiple projects | ||
| displayName, | ||
|
|
||
| // An object that configures minimum threshold enforcement for coverage results | ||
| coverageThreshold: { | ||
| global: { | ||
| branches: 100, | ||
| functions: 100, | ||
| lines: 100, | ||
| statements: 100, | ||
| }, | ||
| }, | ||
| }); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,81 @@ | ||||||
| { | ||||||
| "name": "@metamask/config-registry-controller", | ||||||
| "version": "0.0.1", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New packages start out at 0.0.0. You will establish the first version when you make a release. (If you set this now, then you can't make a release later, because the release workflow looks at which packages have been bumped to know what to release.)
Suggested change
|
||||||
| "description": "Manages configuration registry for MetaMask", | ||||||
| "keywords": [ | ||||||
| "MetaMask", | ||||||
| "Ethereum" | ||||||
| ], | ||||||
| "homepage": "https://github.com/MetaMask/core/tree/main/packages/config-registry-controller#readme", | ||||||
| "bugs": { | ||||||
| "url": "https://github.com/MetaMask/core/issues" | ||||||
| }, | ||||||
| "repository": { | ||||||
| "type": "git", | ||||||
| "url": "https://github.com/MetaMask/core.git" | ||||||
| }, | ||||||
| "license": "MIT", | ||||||
| "sideEffects": false, | ||||||
| "exports": { | ||||||
| ".": { | ||||||
| "import": { | ||||||
| "types": "./dist/index.d.mts", | ||||||
| "default": "./dist/index.mjs" | ||||||
| }, | ||||||
| "require": { | ||||||
| "types": "./dist/index.d.cts", | ||||||
| "default": "./dist/index.cjs" | ||||||
| } | ||||||
| }, | ||||||
| "./package.json": "./package.json" | ||||||
| }, | ||||||
| "main": "./dist/index.cjs", | ||||||
| "types": "./dist/index.d.cts", | ||||||
| "files": [ | ||||||
| "dist/" | ||||||
| ], | ||||||
| "scripts": { | ||||||
| "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", | ||||||
| "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean", | ||||||
| "build:docs": "typedoc", | ||||||
| "changelog:update": "../../scripts/update-changelog.sh @metamask/config-registry-controller", | ||||||
| "changelog:validate": "../../scripts/validate-changelog.sh @metamask/config-registry-controller", | ||||||
| "publish:preview": "yarn npm publish --tag preview", | ||||||
| "since-latest-release": "../../scripts/since-latest-release.sh", | ||||||
| "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter", | ||||||
| "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache", | ||||||
| "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose", | ||||||
| "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch" | ||||||
| }, | ||||||
| "dependencies": { | ||||||
| "@metamask/base-controller": "^9.0.0", | ||||||
| "@metamask/controller-utils": "^11.18.0", | ||||||
| "@metamask/messenger": "^0.3.0", | ||||||
| "@metamask/polling-controller": "^16.0.2", | ||||||
| "@metamask/profile-sync-controller": "^27.0.0", | ||||||
| "@metamask/remote-feature-flag-controller": "^4.0.0", | ||||||
| "@metamask/superstruct": "^3.1.0", | ||||||
| "@metamask/utils": "^11.9.0" | ||||||
| }, | ||||||
| "devDependencies": { | ||||||
| "@lavamoat/allow-scripts": "^3.0.4", | ||||||
| "@metamask/auto-changelog": "^3.4.4", | ||||||
| "@ts-bridge/cli": "^0.6.4", | ||||||
| "@types/jest": "^27.4.1", | ||||||
| "deepmerge": "^4.2.2", | ||||||
| "jest": "^27.5.1", | ||||||
| "nock": "^13.3.1", | ||||||
| "sinon": "^9.2.4", | ||||||
| "ts-jest": "^27.1.4", | ||||||
| "typedoc": "^0.24.8", | ||||||
| "typedoc-plugin-missing-exports": "^2.0.0", | ||||||
| "typescript": "~5.3.3" | ||||||
| }, | ||||||
| "engines": { | ||||||
| "node": "^18.18 || >=20" | ||||||
| }, | ||||||
| "publishConfig": { | ||||||
| "access": "public", | ||||||
| "registry": "https://registry.npmjs.org/" | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the right GitHub team? I wasn't aware that our team was owning this controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't have a team yet - we will change later