@metamask-previews/assets-controller 3.1.1-preview-55f73f6ce → 3.2.1-preview-246ad42b8
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 +33 -2
- package/dist/AssetsController.cjs +9 -14
- package/dist/AssetsController.cjs.map +1 -1
- package/dist/AssetsController.d.cts +3 -2
- package/dist/AssetsController.d.cts.map +1 -1
- package/dist/AssetsController.d.mts +3 -2
- package/dist/AssetsController.d.mts.map +1 -1
- package/dist/AssetsController.mjs +9 -14
- package/dist/AssetsController.mjs.map +1 -1
- package/dist/data-sources/SnapDataSource.cjs.map +1 -1
- package/dist/data-sources/SnapDataSource.d.cts +2 -2
- package/dist/data-sources/SnapDataSource.d.cts.map +1 -1
- package/dist/data-sources/SnapDataSource.d.mts +2 -2
- package/dist/data-sources/SnapDataSource.d.mts.map +1 -1
- package/dist/data-sources/SnapDataSource.mjs.map +1 -1
- package/dist/data-sources/TokenDataSource.cjs +93 -9
- package/dist/data-sources/TokenDataSource.cjs.map +1 -1
- package/dist/data-sources/TokenDataSource.d.cts +11 -7
- package/dist/data-sources/TokenDataSource.d.cts.map +1 -1
- package/dist/data-sources/TokenDataSource.d.mts +11 -7
- package/dist/data-sources/TokenDataSource.d.mts.map +1 -1
- package/dist/data-sources/TokenDataSource.mjs +94 -10
- package/dist/data-sources/TokenDataSource.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/selectors/balance.cjs +11 -16
- package/dist/selectors/balance.cjs.map +1 -1
- package/dist/selectors/balance.d.cts.map +1 -1
- package/dist/selectors/balance.d.mts.map +1 -1
- package/dist/selectors/balance.mjs +11 -16
- package/dist/selectors/balance.mjs.map +1 -1
- package/package.json +17 -16
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- `TokenDataSource` constructor now takes `(messenger, options)` instead of `(options)`; `messenger` must be the same `AssetsControllerMessenger` used by `AssetsController` so token metadata enrichment can call `PhishingController:bulkScanTokens` ([#8329](https://github.com/MetaMask/core/pull/8329))
|
|
13
|
+
|
|
14
|
+
- `TokenDataSource` removes tokens flagged malicious by Blockaid (via `PhishingController:bulkScanTokens`) before merging metadata, instead of filtering non-native tokens by a minimum occurrence count ([#8329](https://github.com/MetaMask/core/pull/8329))
|
|
15
|
+
|
|
16
|
+
## [3.2.1]
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Bump `@metamask/snaps-controllers` from `^17.2.0` to `^19.0.0` ([#8319](https://github.com/MetaMask/core/pull/8319))
|
|
21
|
+
- Bump `@metamask/snaps-utils` from `^11.7.0` to `^12.1.2` ([#8319](https://github.com/MetaMask/core/pull/8319))
|
|
22
|
+
- Bump `@metamask/account-tree-controller` from `^6.0.0` to `^7.0.0` ([#8325](https://github.com/MetaMask/core/pull/8325))
|
|
23
|
+
- Bump `@metamask/assets-controllers` from `^102.0.0` to `^103.0.0` ([#8325](https://github.com/MetaMask/core/pull/8325))
|
|
24
|
+
|
|
25
|
+
## [3.2.0]
|
|
26
|
+
|
|
10
27
|
### Added
|
|
11
28
|
|
|
12
29
|
- Add Sentry traces for Assets Health dashboard ([#8310](https://github.com/MetaMask/core/pull/8310))
|
|
@@ -21,7 +38,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
21
38
|
|
|
22
39
|
### Changed
|
|
23
40
|
|
|
24
|
-
- Bump `@metamask/
|
|
41
|
+
- Bump `@metamask/account-tree-controller` from `^5.0.1` to `^6.0.0` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
42
|
+
- Bump `@metamask/assets-controllers` from `^101.0.1` to `^102.0.0` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
43
|
+
- Bump `@metamask/base-controller` from `^9.0.0` to `^9.0.1` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
44
|
+
- Bump `@metamask/client-controller` from `^1.0.0` to `^1.0.1` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
45
|
+
- Bump `@metamask/core-backend` from `^6.2.0` to `^6.2.1` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
46
|
+
- Bump `@metamask/keyring-controller` from `^25.1.0` to `^25.1.1` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
47
|
+
- Bump `@metamask/messenger` from `^0.3.0` to `^1.0.0` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
48
|
+
- Bump `@metamask/network-controller` from `^30.0.0` to `^30.0.1` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
49
|
+
- Bump `@metamask/network-enablement-controller` from `^5.0.0` to `^5.0.1` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
50
|
+
- Bump `@metamask/permission-controller` from `^12.2.1` to `^12.3.0` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
51
|
+
- Bump `@metamask/polling-controller` from `^16.0.3` to `^16.0.4` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
52
|
+
- Bump `@metamask/preferences-controller` from `^23.0.0` to `^23.1.0` ([#8317](https://github.com/MetaMask/core/pull/8317))
|
|
53
|
+
- Bump `@metamask/transaction-controller` from `^63.1.0` to `^63.3.1` ([#8301](https://github.com/MetaMask/core/pull/8301), [#8313](https://github.com/MetaMask/core/pull/8313), [#8317](https://github.com/MetaMask/core/pull/8317))
|
|
25
54
|
|
|
26
55
|
## [3.1.1]
|
|
27
56
|
|
|
@@ -224,7 +253,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
224
253
|
- Refactor `RpcDataSource` to delegate polling to `BalanceFetcher` and `TokenDetector` services ([#7709](https://github.com/MetaMask/core/pull/7709))
|
|
225
254
|
- Refactor `BalanceFetcher` and `TokenDetector` to extend `StaticIntervalPollingControllerOnly` for independent polling management ([#7709](https://github.com/MetaMask/core/pull/7709))
|
|
226
255
|
|
|
227
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@3.
|
|
256
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@3.2.1...HEAD
|
|
257
|
+
[3.2.1]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@3.2.0...@metamask/assets-controller@3.2.1
|
|
258
|
+
[3.2.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@3.1.1...@metamask/assets-controller@3.2.0
|
|
228
259
|
[3.1.1]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@3.1.0...@metamask/assets-controller@3.1.1
|
|
229
260
|
[3.1.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@3.0.0...@metamask/assets-controller@3.1.0
|
|
230
261
|
[3.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controller@2.4.0...@metamask/assets-controller@3.0.0
|
|
@@ -288,7 +288,7 @@ class AssetsController extends base_controller_1.BaseController {
|
|
|
288
288
|
onActiveChainsUpdated: __classPrivateFieldGet(this, _AssetsController_onActiveChainsUpdated, "f"),
|
|
289
289
|
...stakedBalanceDataSourceConfig,
|
|
290
290
|
}), "f");
|
|
291
|
-
__classPrivateFieldSet(this, _AssetsController_tokenDataSource, new TokenDataSource_1.TokenDataSource({
|
|
291
|
+
__classPrivateFieldSet(this, _AssetsController_tokenDataSource, new TokenDataSource_1.TokenDataSource(this.messenger, {
|
|
292
292
|
queryApiClient,
|
|
293
293
|
getNativeAssetIds: () => {
|
|
294
294
|
const { nativeAssetIdentifiers } = this.messenger.call('NetworkEnablementController:getState');
|
|
@@ -347,7 +347,7 @@ class AssetsController extends base_controller_1.BaseController {
|
|
|
347
347
|
customAssets.push(...accountCustomAssets);
|
|
348
348
|
}
|
|
349
349
|
if (options?.forceUpdate) {
|
|
350
|
-
const startTime =
|
|
350
|
+
const startTime = performance.now();
|
|
351
351
|
const request = __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_buildDataRequest).call(this, accounts, chainIds, {
|
|
352
352
|
assetTypes,
|
|
353
353
|
dataTypes,
|
|
@@ -381,7 +381,7 @@ class AssetsController extends base_controller_1.BaseController {
|
|
|
381
381
|
options.chainIds.length < __classPrivateFieldGet(this, _AssetsController_enabledChains, "f").size;
|
|
382
382
|
const updateMode = options?.updateMode ?? (isPartialChainFetch ? 'merge' : 'full');
|
|
383
383
|
await __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateState).call(this, { ...response, updateMode });
|
|
384
|
-
const durationMs =
|
|
384
|
+
const durationMs = performance.now() - startTime;
|
|
385
385
|
// Emit trace for every full fetch (Assets Health dashboard)
|
|
386
386
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_emitTrace).call(this, TRACE_FULL_FETCH, {
|
|
387
387
|
duration_ms: durationMs,
|
|
@@ -728,7 +728,7 @@ class AssetsController extends base_controller_1.BaseController {
|
|
|
728
728
|
* @param request - Optional original request for context when enriching
|
|
729
729
|
*/
|
|
730
730
|
async handleAssetsUpdate(response, sourceId, request) {
|
|
731
|
-
const updateStart =
|
|
731
|
+
const updateStart = performance.now();
|
|
732
732
|
log('Assets updated from data source', {
|
|
733
733
|
sourceId,
|
|
734
734
|
hasBalance: Boolean(response.assetsBalance),
|
|
@@ -750,7 +750,7 @@ class AssetsController extends base_controller_1.BaseController {
|
|
|
750
750
|
await __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateState).call(this, enrichedResponse);
|
|
751
751
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_emitTrace).call(this, TRACE_UPDATE_PIPELINE, {
|
|
752
752
|
source: sourceId,
|
|
753
|
-
duration_ms:
|
|
753
|
+
duration_ms: performance.now() - updateStart,
|
|
754
754
|
has_balance: Boolean(response.assetsBalance),
|
|
755
755
|
has_price: Boolean(response.assetsPrice),
|
|
756
756
|
has_metadata: Boolean(enrichedResponse.assetsInfo),
|
|
@@ -800,14 +800,9 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
800
800
|
if (!__classPrivateFieldGet(this, _AssetsController_trace, "f")) {
|
|
801
801
|
return;
|
|
802
802
|
}
|
|
803
|
-
|
|
804
|
-
__classPrivateFieldGet(this, _AssetsController_trace, "f").call(this, { name, data, tags }, () => undefined).catch(() => {
|
|
805
|
-
// Telemetry failure must not break.
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
catch {
|
|
803
|
+
__classPrivateFieldGet(this, _AssetsController_trace, "f").call(this, { name, data, tags }, () => undefined).catch(() => {
|
|
809
804
|
// Telemetry failure must not break.
|
|
810
|
-
}
|
|
805
|
+
});
|
|
811
806
|
}, _AssetsController_emitStateSizeTrace = function _AssetsController_emitStateSizeTrace() {
|
|
812
807
|
if (!__classPrivateFieldGet(this, _AssetsController_trace, "f") || __classPrivateFieldGet(this, _AssetsController_stateSizeReported, "f")) {
|
|
813
808
|
return;
|
|
@@ -967,12 +962,12 @@ async function _AssetsController_executeMiddlewares(sources, request, initialRes
|
|
|
967
962
|
const middlewares = sources.map((source) => source.assetsMiddleware);
|
|
968
963
|
const inclusive = [];
|
|
969
964
|
const wrapped = middlewares.map((middleware, i) => (async (ctx, next) => {
|
|
970
|
-
const start =
|
|
965
|
+
const start = performance.now();
|
|
971
966
|
try {
|
|
972
967
|
return await middleware(ctx, next);
|
|
973
968
|
}
|
|
974
969
|
finally {
|
|
975
|
-
inclusive[i] =
|
|
970
|
+
inclusive[i] = performance.now() - start;
|
|
976
971
|
}
|
|
977
972
|
}));
|
|
978
973
|
const middlewareErrors = [];
|