@metamask-previews/network-controller 37.1.1-preview-677dff22f → 38.0.0-preview-04cf473
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 +15 -3
- package/dist/NetworkController.d.ts +12 -64
- package/dist/NetworkController.d.ts.map +1 -1
- package/dist/NetworkController.js +28 -26
- package/dist/NetworkController.js.map +1 -1
- package/dist/selectors.d.ts +22 -8
- package/dist/selectors.d.ts.map +1 -1
- package/dist/selectors.js +32 -7
- package/dist/selectors.js.map +1 -1
- package/package.json +8 -6
package/dist/selectors.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { RemoteFeatureFlagControllerState } from '@metamask/remote-feature-flag-controller';
|
|
2
2
|
/**
|
|
3
|
-
* The RPC failover behavior for Infura
|
|
4
|
-
* `corePlatformRpcFailoverMode`
|
|
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).
|
|
5
6
|
*
|
|
6
7
|
* - `disabled`: failover URLs are ignored; traffic stays on the primary
|
|
7
8
|
* endpoint.
|
|
@@ -10,13 +11,26 @@ import { RemoteFeatureFlagControllerState } from '@metamask/remote-feature-flag-
|
|
|
10
11
|
* - `forced`: Infura endpoints that have failover URLs route all traffic to
|
|
11
12
|
* those failover URLs, bypassing Infura entirely.
|
|
12
13
|
*/
|
|
13
|
-
export
|
|
14
|
+
export declare const RPC_FAILOVER_MODES: readonly ['disabled', 'enabled', 'forced'];
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* A value to control the RPC failover behavior for Infura networks (also a
|
|
17
|
+
* value of the `corePlatformRpcFailoverMode` feature flag).
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
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.
|
|
20
34
|
*/
|
|
21
|
-
export declare function
|
|
35
|
+
export declare function selectRpcFailoverModeFeatureFlag(state: RemoteFeatureFlagControllerState): RpcFailoverMode | null;
|
|
22
36
|
//# sourceMappingURL=selectors.d.ts.map
|
package/dist/selectors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;
|
|
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"}
|
package/dist/selectors.js
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
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).
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
7
12
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
11
36
|
}
|
|
12
37
|
//# sourceMappingURL=selectors.js.map
|
package/dist/selectors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"
|
|
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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/network-controller",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "38.0.0-preview-04cf473",
|
|
4
4
|
"description": "Provides an interface to the currently selected network via a MetaMask-compatible provider object",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ethereum",
|
|
@@ -32,13 +32,14 @@
|
|
|
32
32
|
"registry": "https://registry.npmjs.org/"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
+
"allow-scripts": "yarn workspace @metamask/core-monorepo run allow-scripts",
|
|
35
36
|
"build": "tsc --project tsconfig.build.json",
|
|
36
37
|
"build:all": "tsc --build tsconfig.build.json --verbose",
|
|
37
38
|
"build:clean": "yarn build:only-clean && yarn build",
|
|
38
39
|
"build:docs": "typedoc",
|
|
39
40
|
"build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
|
|
40
41
|
"changelog:update": "../../scripts/update-changelog.sh @metamask/network-controller",
|
|
41
|
-
"changelog:validate": "../../scripts/validate-changelog.sh
|
|
42
|
+
"changelog:validate": "../../scripts/validate-changelog.sh",
|
|
42
43
|
"lint:tsconfigs": "node --import ../../scripts/resolver/register.ts ../../scripts/lint-tsconfigs/lint-tsconfigs.ts",
|
|
43
44
|
"lint:tsconfigs:fix": "node --import ../../scripts/resolver/register.ts ../../scripts/lint-tsconfigs/lint-tsconfigs.ts --fix",
|
|
44
45
|
"messenger-action-types:check": "node --import ../../scripts/resolver/register.ts ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --esm --check",
|
|
@@ -46,11 +47,12 @@
|
|
|
46
47
|
"since-latest-release": "../../scripts/since-latest-release.sh",
|
|
47
48
|
"test": "vitest",
|
|
48
49
|
"test:clean": "vitest --clearCache",
|
|
50
|
+
"test:coverage": "vitest --coverage",
|
|
49
51
|
"test:verbose": "vitest --reporter=verbose",
|
|
50
52
|
"test:watch": "vitest --watch"
|
|
51
53
|
},
|
|
52
54
|
"dependencies": {
|
|
53
|
-
"@metamask/analytics-controller": "^4.
|
|
55
|
+
"@metamask/analytics-controller": "^4.3.0",
|
|
54
56
|
"@metamask/base-controller": "^10.1.0",
|
|
55
57
|
"@metamask/config-registry-controller": "^5.0.0",
|
|
56
58
|
"@metamask/connectivity-controller": "^1.0.0",
|
|
@@ -72,11 +74,11 @@
|
|
|
72
74
|
"loglevel": "^1.9.2",
|
|
73
75
|
"reselect": "^5.3.0",
|
|
74
76
|
"uri-js": "^4.4.1",
|
|
75
|
-
"uuid": "^14.0.
|
|
77
|
+
"uuid": "^14.0.2"
|
|
76
78
|
},
|
|
77
79
|
"devDependencies": {
|
|
78
80
|
"@json-rpc-specification/meta-schema": "^1.0.6",
|
|
79
|
-
"@metamask/auto-changelog": "^
|
|
81
|
+
"@metamask/auto-changelog": "^7.1.0",
|
|
80
82
|
"@types/deep-freeze-strict": "^1.1.0",
|
|
81
83
|
"@types/lodash-es": "^4.17.12",
|
|
82
84
|
"@types/node-fetch": "^2.6.12",
|
|
@@ -92,7 +94,7 @@
|
|
|
92
94
|
"typedoc": "^0.28.20",
|
|
93
95
|
"typedoc-plugin-missing-exports": "^4.1.4",
|
|
94
96
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
95
|
-
"vitest": "
|
|
97
|
+
"vitest": "5.0.3"
|
|
96
98
|
},
|
|
97
99
|
"engines": {
|
|
98
100
|
"node": "^22.14.0 || ^24 || ^26"
|