@metamask-previews/network-controller 24.1.0-preview-8029191 → 24.1.0-preview-e85a6854
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 +1 -2
- package/dist/NetworkController.cjs +20 -3
- package/dist/NetworkController.cjs.map +1 -1
- package/dist/NetworkController.d.cts +1 -23
- package/dist/NetworkController.d.cts.map +1 -1
- package/dist/NetworkController.d.mts +1 -23
- package/dist/NetworkController.d.mts.map +1 -1
- package/dist/NetworkController.mjs +20 -3
- package/dist/NetworkController.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,8 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
12
|
- Add two new controller state metadata properties: `includeInStateLogs` and `usedInUi` ([#6525](https://github.com/MetaMask/core/pull/6525))
|
|
13
|
-
- Add `lookupNetwork` option to `initializeProvider`, to allow for skipping the request used to populate metadata for the globally selected network ([#6575](https://github.com/MetaMask/core/pull/6575)
|
|
14
|
-
- If `lookupNetwork` is set to `false`, the function is fully synchronous, and does not return a promise.
|
|
13
|
+
- Add `lookupNetwork` option to `initializeProvider`, to allow for skipping the request used to populate metadata for the globally selected network ([#6575](https://github.com/MetaMask/core/pull/6575))
|
|
15
14
|
|
|
16
15
|
### Changed
|
|
17
16
|
|
|
@@ -565,12 +565,29 @@ class NetworkController extends base_controller_1.BaseController {
|
|
|
565
565
|
}
|
|
566
566
|
return customNetworkClient;
|
|
567
567
|
}
|
|
568
|
-
|
|
568
|
+
/**
|
|
569
|
+
* Creates proxies for accessing the global network client and its block
|
|
570
|
+
* tracker. You must call this method in order to use
|
|
571
|
+
* `getProviderAndBlockTracker` (or its replacement,
|
|
572
|
+
* `getSelectedNetworkClient`).
|
|
573
|
+
*
|
|
574
|
+
* @param options - Optional arguments.
|
|
575
|
+
* @param options.lookupNetwork - Usually, metadata for the global network
|
|
576
|
+
* will be populated via a call to `lookupNetwork` after creating the provider
|
|
577
|
+
* and block tracker proxies. This allows for responding to the status of the
|
|
578
|
+
* global network after initializing this controller; however, it requires
|
|
579
|
+
* making a request to the network to do so. In the clients, where controllers
|
|
580
|
+
* are initialized before the UI is shown, this may be undesirable, as it
|
|
581
|
+
* means that if the user has just installed MetaMask, their IP address may be
|
|
582
|
+
* shared with a third party before they have a chance to finish onboarding.
|
|
583
|
+
* You can pass `false` if you'd like to disable this request and call
|
|
584
|
+
* `lookupNetwork` yourself.
|
|
585
|
+
*/
|
|
586
|
+
async initializeProvider({ lookupNetwork = true, } = {}) {
|
|
569
587
|
__classPrivateFieldGet(this, _NetworkController_instances, "m", _NetworkController_applyNetworkSelection).call(this, this.state.selectedNetworkClientId);
|
|
570
588
|
if (lookupNetwork) {
|
|
571
|
-
|
|
589
|
+
await this.lookupNetwork();
|
|
572
590
|
}
|
|
573
|
-
return undefined;
|
|
574
591
|
}
|
|
575
592
|
/**
|
|
576
593
|
* Uses a request for the latest block to gather the following information on
|