@metamask-previews/network-controller 12.1.1-preview.d32a7cc
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 +261 -0
- package/LICENSE +20 -0
- package/README.md +15 -0
- package/dist/NetworkController.d.ts +366 -0
- package/dist/NetworkController.d.ts.map +1 -0
- package/dist/NetworkController.js +864 -0
- package/dist/NetworkController.js.map +1 -0
- package/dist/constants.d.ts +28 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +32 -0
- package/dist/constants.js.map +1 -0
- package/dist/create-auto-managed-network-client.d.ts +47 -0
- package/dist/create-auto-managed-network-client.d.ts.map +1 -0
- package/dist/create-auto-managed-network-client.js +120 -0
- package/dist/create-auto-managed-network-client.js.map +1 -0
- package/dist/create-network-client.d.ts +19 -0
- package/dist/create-network-client.d.ts.map +1 -0
- package/dist/create-network-client.js +149 -0
- package/dist/create-network-client.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +5 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +7 -0
- package/dist/logger.js.map +1 -0
- package/dist/types.d.ts +37 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/package.json +70 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './NetworkController';
|
|
2
|
+
export * from './constants';
|
|
3
|
+
export type { BlockTracker, Provider } from './types';
|
|
4
|
+
export type { NetworkClientConfiguration } from './types';
|
|
5
|
+
export { NetworkClientType } from './types';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,YAAY,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.NetworkClientType = void 0;
|
|
18
|
+
__exportStar(require("./NetworkController"), exports);
|
|
19
|
+
__exportStar(require("./constants"), exports);
|
|
20
|
+
var types_1 = require("./types");
|
|
21
|
+
Object.defineProperty(exports, "NetworkClientType", { enumerable: true, get: function () { return types_1.NetworkClientType; } });
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,8CAA4B;AAG5B,iCAA4C;AAAnC,0GAAA,iBAAiB,OAAA","sourcesContent":["export * from './NetworkController';\nexport * from './constants';\nexport type { BlockTracker, Provider } from './types';\nexport type { NetworkClientConfiguration } from './types';\nexport { NetworkClientType } from './types';\n"]}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";AAAA,OAAO,EAAuB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,eAAO,MAAM,aAAa,0BAA4C,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createModuleLogger = exports.projectLogger = void 0;
|
|
4
|
+
const utils_1 = require("@metamask/utils");
|
|
5
|
+
Object.defineProperty(exports, "createModuleLogger", { enumerable: true, get: function () { return utils_1.createModuleLogger; } });
|
|
6
|
+
exports.projectLogger = (0, utils_1.createProjectLogger)('network-controller');
|
|
7
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;AAAA,2CAA0E;AAIjE,mGAJqB,0BAAkB,OAIrB;AAFd,QAAA,aAAa,GAAG,IAAA,2BAAmB,EAAC,oBAAoB,CAAC,CAAC","sourcesContent":["import { createProjectLogger, createModuleLogger } from '@metamask/utils';\n\nexport const projectLogger = createProjectLogger('network-controller');\n\nexport { createModuleLogger };\n"]}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { InfuraNetworkType } from '@metamask/controller-utils';
|
|
2
|
+
import type { SafeEventEmitterProvider } from '@metamask/eth-json-rpc-provider';
|
|
3
|
+
import type { Hex } from '@metamask/utils';
|
|
4
|
+
import type { PollingBlockTracker } from 'eth-block-tracker';
|
|
5
|
+
export declare type Provider = SafeEventEmitterProvider;
|
|
6
|
+
export declare type BlockTracker = PollingBlockTracker;
|
|
7
|
+
/**
|
|
8
|
+
* The type of network client that can be created.
|
|
9
|
+
*/
|
|
10
|
+
export declare enum NetworkClientType {
|
|
11
|
+
Custom = "custom",
|
|
12
|
+
Infura = "infura"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A configuration object that can be used to create a client for a custom
|
|
16
|
+
* network.
|
|
17
|
+
*/
|
|
18
|
+
export declare type CustomNetworkClientConfiguration = {
|
|
19
|
+
chainId: Hex;
|
|
20
|
+
rpcUrl: string;
|
|
21
|
+
type: NetworkClientType.Custom;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A configuration object that can be used to create a client for an Infura
|
|
25
|
+
* network.
|
|
26
|
+
*/
|
|
27
|
+
export declare type InfuraNetworkClientConfiguration = {
|
|
28
|
+
chainId: Hex;
|
|
29
|
+
network: InfuraNetworkType;
|
|
30
|
+
infuraProjectId: string;
|
|
31
|
+
type: NetworkClientType.Infura;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A configuration object that can be used to create a client for a network.
|
|
35
|
+
*/
|
|
36
|
+
export declare type NetworkClientConfiguration = CustomNetworkClientConfiguration | InfuraNetworkClientConfiguration;
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,oBAAY,QAAQ,GAAG,wBAAwB,CAAC;AAEhD,oBAAY,YAAY,GAAG,mBAAmB,CAAC;AAE/C;;GAEG;AACH,oBAAY,iBAAiB;IAC3B,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED;;;GAGG;AACH,oBAAY,gCAAgC,GAAG;IAC7C,OAAO,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC;CAChC,CAAC;AAEF;;;GAGG;AACH,oBAAY,gCAAgC,GAAG;IAC7C,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,EAAE,iBAAiB,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,oBAAY,0BAA0B,GAClC,gCAAgC,GAChC,gCAAgC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NetworkClientType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The type of network client that can be created.
|
|
6
|
+
*/
|
|
7
|
+
var NetworkClientType;
|
|
8
|
+
(function (NetworkClientType) {
|
|
9
|
+
NetworkClientType["Custom"] = "custom";
|
|
10
|
+
NetworkClientType["Infura"] = "infura";
|
|
11
|
+
})(NetworkClientType = exports.NetworkClientType || (exports.NetworkClientType = {}));
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AASA;;GAEG;AACH,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,sCAAiB,CAAA;AACnB,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B","sourcesContent":["import type { InfuraNetworkType } from '@metamask/controller-utils';\nimport type { SafeEventEmitterProvider } from '@metamask/eth-json-rpc-provider';\nimport type { Hex } from '@metamask/utils';\nimport type { PollingBlockTracker } from 'eth-block-tracker';\n\nexport type Provider = SafeEventEmitterProvider;\n\nexport type BlockTracker = PollingBlockTracker;\n\n/**\n * The type of network client that can be created.\n */\nexport enum NetworkClientType {\n Custom = 'custom',\n Infura = 'infura',\n}\n\n/**\n * A configuration object that can be used to create a client for a custom\n * network.\n */\nexport type CustomNetworkClientConfiguration = {\n chainId: Hex;\n rpcUrl: string;\n type: NetworkClientType.Custom;\n};\n\n/**\n * A configuration object that can be used to create a client for an Infura\n * network.\n */\nexport type InfuraNetworkClientConfiguration = {\n chainId: Hex;\n network: InfuraNetworkType;\n infuraProjectId: string;\n type: NetworkClientType.Infura;\n};\n\n/**\n * A configuration object that can be used to create a client for a network.\n */\nexport type NetworkClientConfiguration =\n | CustomNetworkClientConfiguration\n | InfuraNetworkClientConfiguration;\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@metamask-previews/network-controller",
|
|
3
|
+
"version": "12.1.1-preview.d32a7cc",
|
|
4
|
+
"description": "Provides an interface to the currently selected network via a MetaMask-compatible provider object",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"MetaMask",
|
|
7
|
+
"Ethereum"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/MetaMask/core/tree/main/packages/network-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
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build:docs": "typedoc",
|
|
25
|
+
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/network-controller",
|
|
26
|
+
"publish:preview": "yarn npm publish --tag preview",
|
|
27
|
+
"test": "jest",
|
|
28
|
+
"test:watch": "jest --watch"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@metamask-previews/base-controller": "3.2.0-preview.d32a7cc",
|
|
32
|
+
"@metamask-previews/controller-utils": "4.3.1-preview.d32a7cc",
|
|
33
|
+
"@metamask/eth-json-rpc-infura": "^8.1.1",
|
|
34
|
+
"@metamask/eth-json-rpc-middleware": "^11.0.0",
|
|
35
|
+
"@metamask/eth-json-rpc-provider": "^1.0.0",
|
|
36
|
+
"@metamask/eth-query": "^3.0.1",
|
|
37
|
+
"@metamask/swappable-obj-proxy": "^2.1.0",
|
|
38
|
+
"@metamask/utils": "^6.2.0",
|
|
39
|
+
"async-mutex": "^0.2.6",
|
|
40
|
+
"eth-block-tracker": "^7.0.1",
|
|
41
|
+
"eth-rpc-errors": "^4.0.2",
|
|
42
|
+
"immer": "^9.0.6",
|
|
43
|
+
"json-rpc-engine": "^6.1.0",
|
|
44
|
+
"uuid": "^8.3.2"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@json-rpc-specification/meta-schema": "^1.0.6",
|
|
48
|
+
"@metamask/auto-changelog": "^3.1.0",
|
|
49
|
+
"@types/jest": "^27.4.1",
|
|
50
|
+
"@types/jest-when": "^2.7.3",
|
|
51
|
+
"@types/lodash": "^4.14.191",
|
|
52
|
+
"deepmerge": "^4.2.2",
|
|
53
|
+
"jest": "^27.5.1",
|
|
54
|
+
"jest-when": "^3.4.2",
|
|
55
|
+
"lodash": "^4.17.21",
|
|
56
|
+
"nock": "^13.3.1",
|
|
57
|
+
"sinon": "^9.2.4",
|
|
58
|
+
"ts-jest": "^27.1.4",
|
|
59
|
+
"typedoc": "^0.22.15",
|
|
60
|
+
"typedoc-plugin-missing-exports": "^0.22.6",
|
|
61
|
+
"typescript": "~4.6.3"
|
|
62
|
+
},
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=16.0.0"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public",
|
|
68
|
+
"registry": "https://registry.npmjs.org/"
|
|
69
|
+
}
|
|
70
|
+
}
|