@metamask-previews/network-controller 37.1.1-preview-486391fb9 → 37.1.1-preview-677dff22f

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.
@@ -1,8 +1,7 @@
1
1
  import { RemoteFeatureFlagControllerState } from '@metamask/remote-feature-flag-controller';
2
2
  /**
3
- * The list of possible values to control the RPC failover behavior for Infura
4
- * networks (also the list of values for the `corePlatformRpcFailoverMode`
5
- * feature flag).
3
+ * The RPC failover behavior for Infura networks, controlled by the
4
+ * `corePlatformRpcFailoverMode` remote feature flag.
6
5
  *
7
6
  * - `disabled`: failover URLs are ignored; traffic stays on the primary
8
7
  * endpoint.
@@ -11,26 +10,13 @@ import { RemoteFeatureFlagControllerState } from '@metamask/remote-feature-flag-
11
10
  * - `forced`: Infura endpoints that have failover URLs route all traffic to
12
11
  * those failover URLs, bypassing Infura entirely.
13
12
  */
14
- export declare const RPC_FAILOVER_MODES: readonly ['disabled', 'enabled', 'forced'];
13
+ export type RpcFailoverMode = 'disabled' | 'enabled' | 'forced';
15
14
  /**
16
- * A value to control the RPC failover behavior for Infura networks (also a
17
- * value of the `corePlatformRpcFailoverMode` feature flag).
15
+ * Reads the RPC failover mode from the remote feature flags, defaulting to
16
+ * `disabled` when the flag is absent or not a recognized value.
18
17
  *
19
- * - `disabled`: failover URLs are ignored; traffic stays on the primary
20
- * endpoint.
21
- * - `enabled`: traffic automatically diverts to failover URLs when the primary
22
- * endpoint is unavailable.
23
- * - `forced`: Infura endpoints that have failover URLs route all traffic to
24
- * those failover URLs, bypassing Infura entirely.
25
- */
26
- export type RpcFailoverMode = (typeof RPC_FAILOVER_MODES)[number];
27
- /**
28
- * Reads the `corePlatformRpcFailoverMode` feature flag and attempts to
29
- * interpret it.
30
- *
31
- * @param state - The RemoteFeatureFlagController state.
32
- * @returns The RPC failover mode from `corePlatformRpcFailoverMode` if
33
- * recognized, or `null` otherwise.
18
+ * @param state - The remote feature flag controller state.
19
+ * @returns The RPC failover mode.
34
20
  */
35
- export declare function selectRpcFailoverModeFeatureFlag(state: RemoteFeatureFlagControllerState): RpcFailoverMode | null;
21
+ export declare function getRpcFailoverMode(state: RemoteFeatureFlagControllerState): RpcFailoverMode;
36
22
  //# sourceMappingURL=selectors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAG5F;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,YAAI,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAclE;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,gCAAgC,GACtC,eAAe,GAAG,IAAI,CAGxB"}
1
+ {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAE5F;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,gCAAgC,GACtC,eAAe,CAGjB"}
package/dist/selectors.js CHANGED
@@ -1,37 +1,12 @@
1
1
  /**
2
- * The list of possible values to control the RPC failover behavior for Infura
3
- * networks (also the list of values for the `corePlatformRpcFailoverMode`
4
- * feature flag).
2
+ * Reads the RPC failover mode from the remote feature flags, defaulting to
3
+ * `disabled` when the flag is absent or not a recognized value.
5
4
  *
6
- * - `disabled`: failover URLs are ignored; traffic stays on the primary
7
- * endpoint.
8
- * - `enabled`: traffic automatically diverts to failover URLs when the primary
9
- * endpoint is unavailable.
10
- * - `forced`: Infura endpoints that have failover URLs route all traffic to
11
- * those failover URLs, bypassing Infura entirely.
5
+ * @param state - The remote feature flag controller state.
6
+ * @returns The RPC failover mode.
12
7
  */
13
- export const RPC_FAILOVER_MODES = ['disabled', 'enabled', 'forced'];
14
- /**
15
- * Type guard to determine whether the given value (which could come from the
16
- * `corePlatformRpcFailoverMode` feature flag) is one of the possible RPC
17
- * failover modes.
18
- *
19
- * @param value - A value to check.
20
- * @returns True if given a true RPC failover mode, false otherwise.
21
- */
22
- function isRpcFailoverMode(value) {
23
- return RPC_FAILOVER_MODES.includes(value);
24
- }
25
- /**
26
- * Reads the `corePlatformRpcFailoverMode` feature flag and attempts to
27
- * interpret it.
28
- *
29
- * @param state - The RemoteFeatureFlagController state.
30
- * @returns The RPC failover mode from `corePlatformRpcFailoverMode` if
31
- * recognized, or `null` otherwise.
32
- */
33
- export function selectRpcFailoverModeFeatureFlag(state) {
34
- const rpcFailoverMode = state.remoteFeatureFlags.corePlatformRpcFailoverMode;
35
- return isRpcFailoverMode(rpcFailoverMode) ? rpcFailoverMode : null;
8
+ export function getRpcFailoverMode(state) {
9
+ const mode = state.remoteFeatureFlags.corePlatformRpcFailoverMode;
10
+ return mode === 'enabled' || mode === 'forced' ? mode : 'disabled';
36
11
  }
37
12
  //# sourceMappingURL=selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAe7E;;;;;;;GAOG;AACH,SAAS,iBAAiB,CAAC,KAAW;IACpC,OAAO,kBAAkB,CAAC,QAAQ,CAAC,KAAwB,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAAuC;IAEvC,MAAM,eAAe,GAAG,KAAK,CAAC,kBAAkB,CAAC,2BAA2B,CAAC;IAC7E,OAAO,iBAAiB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC","sourcesContent":["import { RemoteFeatureFlagControllerState } from '@metamask/remote-feature-flag-controller';\nimport { Json } from '@metamask/utils';\n\n/**\n * The list of possible values to control the RPC failover behavior for Infura\n * networks (also the list of values for the `corePlatformRpcFailoverMode`\n * feature flag).\n *\n * - `disabled`: failover URLs are ignored; traffic stays on the primary\n * endpoint.\n * - `enabled`: traffic automatically diverts to failover URLs when the primary\n * endpoint is unavailable.\n * - `forced`: Infura endpoints that have failover URLs route all traffic to\n * those failover URLs, bypassing Infura entirely.\n */\nexport const RPC_FAILOVER_MODES = ['disabled', 'enabled', 'forced'] as const;\n\n/**\n * A value to control the RPC failover behavior for Infura networks (also a\n * value of the `corePlatformRpcFailoverMode` feature flag).\n *\n * - `disabled`: failover URLs are ignored; traffic stays on the primary\n * endpoint.\n * - `enabled`: traffic automatically diverts to failover URLs when the primary\n * endpoint is unavailable.\n * - `forced`: Infura endpoints that have failover URLs route all traffic to\n * those failover URLs, bypassing Infura entirely.\n */\nexport type RpcFailoverMode = (typeof RPC_FAILOVER_MODES)[number];\n\n/**\n * Type guard to determine whether the given value (which could come from the\n * `corePlatformRpcFailoverMode` feature flag) is one of the possible RPC\n * failover modes.\n *\n * @param value - A value to check.\n * @returns True if given a true RPC failover mode, false otherwise.\n */\nfunction isRpcFailoverMode(value: Json): value is RpcFailoverMode {\n return RPC_FAILOVER_MODES.includes(value as RpcFailoverMode);\n}\n\n/**\n * Reads the `corePlatformRpcFailoverMode` feature flag and attempts to\n * interpret it.\n *\n * @param state - The RemoteFeatureFlagController state.\n * @returns The RPC failover mode from `corePlatformRpcFailoverMode` if\n * recognized, or `null` otherwise.\n */\nexport function selectRpcFailoverModeFeatureFlag(\n state: RemoteFeatureFlagControllerState,\n): RpcFailoverMode | null {\n const rpcFailoverMode = state.remoteFeatureFlags.corePlatformRpcFailoverMode;\n return isRpcFailoverMode(rpcFailoverMode) ? rpcFailoverMode : null;\n}\n"]}
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAuC;IAEvC,MAAM,IAAI,GAAG,KAAK,CAAC,kBAAkB,CAAC,2BAA2B,CAAC;IAClE,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;AACrE,CAAC","sourcesContent":["import { RemoteFeatureFlagControllerState } from '@metamask/remote-feature-flag-controller';\n\n/**\n * The RPC failover behavior for Infura networks, controlled by the\n * `corePlatformRpcFailoverMode` remote feature flag.\n *\n * - `disabled`: failover URLs are ignored; traffic stays on the primary\n * endpoint.\n * - `enabled`: traffic automatically diverts to failover URLs when the primary\n * endpoint is unavailable.\n * - `forced`: Infura endpoints that have failover URLs route all traffic to\n * those failover URLs, bypassing Infura entirely.\n */\nexport type RpcFailoverMode = 'disabled' | 'enabled' | 'forced';\n\n/**\n * Reads the RPC failover mode from the remote feature flags, defaulting to\n * `disabled` when the flag is absent or not a recognized value.\n *\n * @param state - The remote feature flag controller state.\n * @returns The RPC failover mode.\n */\nexport function getRpcFailoverMode(\n state: RemoteFeatureFlagControllerState,\n): RpcFailoverMode {\n const mode = state.remoteFeatureFlags.corePlatformRpcFailoverMode;\n return mode === 'enabled' || mode === 'forced' ? mode : 'disabled';\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/network-controller",
3
- "version": "37.1.1-preview-486391fb9",
3
+ "version": "37.1.1-preview-677dff22f",
4
4
  "description": "Provides an interface to the currently selected network via a MetaMask-compatible provider object",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -32,14 +32,13 @@
32
32
  "registry": "https://registry.npmjs.org/"
33
33
  },
34
34
  "scripts": {
35
- "allow-scripts": "yarn workspace @metamask/core-monorepo run allow-scripts",
36
35
  "build": "tsc --project tsconfig.build.json",
37
36
  "build:all": "tsc --build tsconfig.build.json --verbose",
38
37
  "build:clean": "yarn build:only-clean && yarn build",
39
38
  "build:docs": "typedoc",
40
39
  "build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
41
40
  "changelog:update": "../../scripts/update-changelog.sh @metamask/network-controller",
42
- "changelog:validate": "../../scripts/validate-changelog.sh",
41
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/network-controller",
43
42
  "lint:tsconfigs": "node --import ../../scripts/resolver/register.ts ../../scripts/lint-tsconfigs/lint-tsconfigs.ts",
44
43
  "lint:tsconfigs:fix": "node --import ../../scripts/resolver/register.ts ../../scripts/lint-tsconfigs/lint-tsconfigs.ts --fix",
45
44
  "messenger-action-types:check": "node --import ../../scripts/resolver/register.ts ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --esm --check",
@@ -47,12 +46,11 @@
47
46
  "since-latest-release": "../../scripts/since-latest-release.sh",
48
47
  "test": "vitest",
49
48
  "test:clean": "vitest --clearCache",
50
- "test:coverage": "vitest --coverage",
51
49
  "test:verbose": "vitest --reporter=verbose",
52
50
  "test:watch": "vitest --watch"
53
51
  },
54
52
  "dependencies": {
55
- "@metamask/analytics-controller": "^4.2.0",
53
+ "@metamask/analytics-controller": "^4.1.0",
56
54
  "@metamask/base-controller": "^10.1.0",
57
55
  "@metamask/config-registry-controller": "^5.0.0",
58
56
  "@metamask/connectivity-controller": "^1.0.0",
@@ -74,11 +72,11 @@
74
72
  "loglevel": "^1.9.2",
75
73
  "reselect": "^5.3.0",
76
74
  "uri-js": "^4.4.1",
77
- "uuid": "^14.0.2"
75
+ "uuid": "^14.0.0"
78
76
  },
79
77
  "devDependencies": {
80
78
  "@json-rpc-specification/meta-schema": "^1.0.6",
81
- "@metamask/auto-changelog": "^7.1.0",
79
+ "@metamask/auto-changelog": "^6.2.1",
82
80
  "@types/deep-freeze-strict": "^1.1.0",
83
81
  "@types/lodash-es": "^4.17.12",
84
82
  "@types/node-fetch": "^2.6.12",
@@ -94,7 +92,7 @@
94
92
  "typedoc": "^0.28.20",
95
93
  "typedoc-plugin-missing-exports": "^4.1.4",
96
94
  "typescript": "npm:@typescript/typescript6@^6.0.2",
97
- "vitest": "5.0.3"
95
+ "vitest": "^5.0.0"
98
96
  },
99
97
  "engines": {
100
98
  "node": "^22.14.0 || ^24 || ^26"