@metamask-previews/assets-controller 1.0.0-preview-1ad6631 → 1.0.0-preview-e7b1aa6

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +0 -1
  2. package/dist/AssetsController-method-action-types.cjs.map +1 -1
  3. package/dist/AssetsController-method-action-types.d.cts +1 -26
  4. package/dist/AssetsController-method-action-types.d.cts.map +1 -1
  5. package/dist/AssetsController-method-action-types.d.mts +1 -26
  6. package/dist/AssetsController-method-action-types.d.mts.map +1 -1
  7. package/dist/AssetsController-method-action-types.mjs.map +1 -1
  8. package/dist/AssetsController.cjs +9 -84
  9. package/dist/AssetsController.cjs.map +1 -1
  10. package/dist/AssetsController.d.cts +2 -47
  11. package/dist/AssetsController.d.cts.map +1 -1
  12. package/dist/AssetsController.d.mts +2 -47
  13. package/dist/AssetsController.d.mts.map +1 -1
  14. package/dist/AssetsController.mjs +9 -84
  15. package/dist/AssetsController.mjs.map +1 -1
  16. package/dist/data-sources/RpcDataSource.cjs +4 -117
  17. package/dist/data-sources/RpcDataSource.cjs.map +1 -1
  18. package/dist/data-sources/RpcDataSource.d.cts +0 -14
  19. package/dist/data-sources/RpcDataSource.d.cts.map +1 -1
  20. package/dist/data-sources/RpcDataSource.d.mts +0 -14
  21. package/dist/data-sources/RpcDataSource.d.mts.map +1 -1
  22. package/dist/data-sources/RpcDataSource.mjs +4 -117
  23. package/dist/data-sources/RpcDataSource.mjs.map +1 -1
  24. package/dist/data-sources/TokenDataSource.cjs +0 -5
  25. package/dist/data-sources/TokenDataSource.cjs.map +1 -1
  26. package/dist/data-sources/TokenDataSource.d.cts.map +1 -1
  27. package/dist/data-sources/TokenDataSource.d.mts.map +1 -1
  28. package/dist/data-sources/TokenDataSource.mjs +0 -5
  29. package/dist/data-sources/TokenDataSource.mjs.map +1 -1
  30. package/dist/data-sources/evm-rpc-services/index.cjs +1 -5
  31. package/dist/data-sources/evm-rpc-services/index.cjs.map +1 -1
  32. package/dist/data-sources/evm-rpc-services/index.d.cts +1 -1
  33. package/dist/data-sources/evm-rpc-services/index.d.cts.map +1 -1
  34. package/dist/data-sources/evm-rpc-services/index.d.mts +1 -1
  35. package/dist/data-sources/evm-rpc-services/index.d.mts.map +1 -1
  36. package/dist/data-sources/evm-rpc-services/index.mjs +1 -1
  37. package/dist/data-sources/evm-rpc-services/index.mjs.map +1 -1
  38. package/dist/data-sources/evm-rpc-services/services/index.cjs +1 -6
  39. package/dist/data-sources/evm-rpc-services/services/index.cjs.map +1 -1
  40. package/dist/data-sources/evm-rpc-services/services/index.d.cts +0 -1
  41. package/dist/data-sources/evm-rpc-services/services/index.d.cts.map +1 -1
  42. package/dist/data-sources/evm-rpc-services/services/index.d.mts +0 -1
  43. package/dist/data-sources/evm-rpc-services/services/index.d.mts.map +1 -1
  44. package/dist/data-sources/evm-rpc-services/services/index.mjs +0 -1
  45. package/dist/data-sources/evm-rpc-services/services/index.mjs.map +1 -1
  46. package/dist/data-sources/evm-rpc-services/utils/index.cjs +1 -9
  47. package/dist/data-sources/evm-rpc-services/utils/index.cjs.map +1 -1
  48. package/dist/data-sources/evm-rpc-services/utils/index.d.cts +0 -2
  49. package/dist/data-sources/evm-rpc-services/utils/index.d.cts.map +1 -1
  50. package/dist/data-sources/evm-rpc-services/utils/index.d.mts +0 -2
  51. package/dist/data-sources/evm-rpc-services/utils/index.d.mts.map +1 -1
  52. package/dist/data-sources/evm-rpc-services/utils/index.mjs +0 -2
  53. package/dist/data-sources/evm-rpc-services/utils/index.mjs.map +1 -1
  54. package/dist/data-sources/index.cjs +1 -3
  55. package/dist/data-sources/index.cjs.map +1 -1
  56. package/dist/data-sources/index.d.cts +0 -1
  57. package/dist/data-sources/index.d.cts.map +1 -1
  58. package/dist/data-sources/index.d.mts +0 -1
  59. package/dist/data-sources/index.d.mts.map +1 -1
  60. package/dist/data-sources/index.mjs +0 -1
  61. package/dist/data-sources/index.mjs.map +1 -1
  62. package/package.json +1 -1
  63. package/dist/data-sources/StakedBalanceDataSource.cjs +0 -536
  64. package/dist/data-sources/StakedBalanceDataSource.cjs.map +0 -1
  65. package/dist/data-sources/StakedBalanceDataSource.d.cts +0 -72
  66. package/dist/data-sources/StakedBalanceDataSource.d.cts.map +0 -1
  67. package/dist/data-sources/StakedBalanceDataSource.d.mts +0 -72
  68. package/dist/data-sources/StakedBalanceDataSource.d.mts.map +0 -1
  69. package/dist/data-sources/StakedBalanceDataSource.mjs +0 -532
  70. package/dist/data-sources/StakedBalanceDataSource.mjs.map +0 -1
  71. package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.cjs +0 -133
  72. package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.cjs.map +0 -1
  73. package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.d.cts +0 -78
  74. package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.d.cts.map +0 -1
  75. package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.d.mts +0 -78
  76. package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.d.mts.map +0 -1
  77. package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.mjs +0 -127
  78. package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.mjs.map +0 -1
  79. package/dist/data-sources/evm-rpc-services/utils/parsing.cjs +0 -34
  80. package/dist/data-sources/evm-rpc-services/utils/parsing.cjs.map +0 -1
  81. package/dist/data-sources/evm-rpc-services/utils/parsing.d.cts +0 -18
  82. package/dist/data-sources/evm-rpc-services/utils/parsing.d.cts.map +0 -1
  83. package/dist/data-sources/evm-rpc-services/utils/parsing.d.mts +0 -18
  84. package/dist/data-sources/evm-rpc-services/utils/parsing.d.mts.map +0 -1
  85. package/dist/data-sources/evm-rpc-services/utils/parsing.mjs +0 -29
  86. package/dist/data-sources/evm-rpc-services/utils/parsing.mjs.map +0 -1
  87. package/dist/data-sources/evm-rpc-services/utils/staking-contracts.cjs +0 -50
  88. package/dist/data-sources/evm-rpc-services/utils/staking-contracts.cjs.map +0 -1
  89. package/dist/data-sources/evm-rpc-services/utils/staking-contracts.d.cts +0 -24
  90. package/dist/data-sources/evm-rpc-services/utils/staking-contracts.d.cts.map +0 -1
  91. package/dist/data-sources/evm-rpc-services/utils/staking-contracts.d.mts +0 -24
  92. package/dist/data-sources/evm-rpc-services/utils/staking-contracts.d.mts.map +0 -1
  93. package/dist/data-sources/evm-rpc-services/utils/staking-contracts.mjs +0 -44
  94. package/dist/data-sources/evm-rpc-services/utils/staking-contracts.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -9,7 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Added
11
11
 
12
- - Add `StakedBalanceDataSource` that polls supported staking contracts on enabled chains and merges staked balances into `assetsBalance`. Configurable via `stakedBalanceDataSourceConfig` (`enabled`, `pollInterval`); the controller subscribes to it when enabled and cleans up on destroy ([#7936](https://github.com/MetaMask/core/pull/7936))
13
12
  - Add optional `trackMetaMetricsEvent` callback to measure and report first init/fetch historical time (duration in ms) to MetaMetrics when the initial asset fetch completes after unlock or app open ([#7871](https://github.com/MetaMask/core/pull/7871))
14
13
  - Add `AccountsApiDataSourceConfig` and `PriceDataSourceConfig` types; add `accountsApiDataSourceConfig` and `priceDataSourceConfig` options to `AssetsControllerOptions` for per-data-source configuration (pollInterval, tokenDetectionEnabled, etc.). When `tokenDetectionEnabled` is false, `AccountsApiDataSource` only returns balances for tokens already in state and does not add new tokens ([#7926](https://github.com/MetaMask/core/pull/7926))
15
14
  - Add `useExternalService` option to `TokenDetector`, `TokenDetectionOptions`, `RpcDataSourceConfig`, and `RpcDataSourceOptions`. Token detection runs only when both `tokenDetectionEnabled` and `useExternalService` are true and stops when either is false ([#7924](https://github.com/MetaMask/core/pull/7924))
@@ -1 +1 @@
1
- {"version":3,"file":"AssetsController-method-action-types.cjs","sourceRoot":"","sources":["../src/AssetsController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { AssetsController } from './AssetsController';\n\nexport type AssetsControllerGetAssetsAction = {\n type: `AssetsController:getAssets`;\n handler: AssetsController['getAssets'];\n};\n\nexport type AssetsControllerGetAssetsBalanceAction = {\n type: `AssetsController:getAssetsBalance`;\n handler: AssetsController['getAssetsBalance'];\n};\n\nexport type AssetsControllerGetAssetMetadataAction = {\n type: `AssetsController:getAssetMetadata`;\n handler: AssetsController['getAssetMetadata'];\n};\n\nexport type AssetsControllerGetAssetsPriceAction = {\n type: `AssetsController:getAssetsPrice`;\n handler: AssetsController['getAssetsPrice'];\n};\n\n/**\n * Refresh balances from RPC for selected accounts/chains and update state.\n * Exposed for UI (e.g. pull-to-refresh). Only used when RPC is the data source;\n * websocket/API update automatically. Also triggered on transaction events (RPC path).\n */\nexport type AssetsControllerRefreshBalancesAction = {\n type: `AssetsController:refreshBalances`;\n handler: AssetsController['refreshBalances'];\n};\n\n/**\n * Run token detection for selected accounts/chains (RPC path) and update state.\n * Exposed for UI. Only used when RPC is the data source; websocket/API update automatically.\n */\nexport type AssetsControllerRefreshDetectedTokensAction = {\n type: `AssetsController:refreshDetectedTokens`;\n handler: AssetsController['refreshDetectedTokens'];\n};\n\n/**\n * Refresh staked balances for all subscribed accounts/chains and update state.\n * Exposed for UI. Also triggered automatically on transaction events.\n */\nexport type AssetsControllerRefreshStakedBalanceAction = {\n type: `AssetsController:refreshStakedBalance`;\n handler: AssetsController['refreshStakedBalance'];\n};\n\n/**\n * Add a custom asset for an account.\n * Custom assets are included in subscription and fetch operations.\n * Adding a custom asset also unhides it if it was previously hidden.\n *\n * @param accountId - The account ID to add the custom asset for.\n * @param assetId - The CAIP-19 asset ID to add.\n */\nexport type AssetsControllerAddCustomAssetAction = {\n type: `AssetsController:addCustomAsset`;\n handler: AssetsController['addCustomAsset'];\n};\n\n/**\n * Remove a custom asset from an account.\n *\n * @param accountId - The account ID to remove the custom asset from.\n * @param assetId - The CAIP-19 asset ID to remove.\n */\nexport type AssetsControllerRemoveCustomAssetAction = {\n type: `AssetsController:removeCustomAsset`;\n handler: AssetsController['removeCustomAsset'];\n};\n\n/**\n * Get all custom assets for an account.\n *\n * @param accountId - The account ID to get custom assets for.\n * @returns Array of CAIP-19 asset IDs for the account's custom assets.\n */\nexport type AssetsControllerGetCustomAssetsAction = {\n type: `AssetsController:getCustomAssets`;\n handler: AssetsController['getCustomAssets'];\n};\n\n/**\n * Hide an asset globally.\n * Hidden assets are excluded from the asset list returned by getAssets.\n * The hidden state is stored in assetPreferences.\n *\n * @param assetId - The CAIP-19 asset ID to hide.\n */\nexport type AssetsControllerHideAssetAction = {\n type: `AssetsController:hideAsset`;\n handler: AssetsController['hideAsset'];\n};\n\n/**\n * Unhide an asset globally.\n *\n * @param assetId - The CAIP-19 asset ID to unhide.\n */\nexport type AssetsControllerUnhideAssetAction = {\n type: `AssetsController:unhideAsset`;\n handler: AssetsController['unhideAsset'];\n};\n\n/**\n * Union of all AssetsController action types.\n */\nexport type AssetsControllerMethodActions =\n | AssetsControllerGetAssetsAction\n | AssetsControllerGetAssetsBalanceAction\n | AssetsControllerGetAssetMetadataAction\n | AssetsControllerGetAssetsPriceAction\n | AssetsControllerRefreshBalancesAction\n | AssetsControllerRefreshDetectedTokensAction\n | AssetsControllerRefreshStakedBalanceAction\n | AssetsControllerAddCustomAssetAction\n | AssetsControllerRemoveCustomAssetAction\n | AssetsControllerGetCustomAssetsAction\n | AssetsControllerHideAssetAction\n | AssetsControllerUnhideAssetAction;\n"]}
1
+ {"version":3,"file":"AssetsController-method-action-types.cjs","sourceRoot":"","sources":["../src/AssetsController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { AssetsController } from './AssetsController';\n\nexport type AssetsControllerGetAssetsAction = {\n type: `AssetsController:getAssets`;\n handler: AssetsController['getAssets'];\n};\n\nexport type AssetsControllerGetAssetsBalanceAction = {\n type: `AssetsController:getAssetsBalance`;\n handler: AssetsController['getAssetsBalance'];\n};\n\nexport type AssetsControllerGetAssetMetadataAction = {\n type: `AssetsController:getAssetMetadata`;\n handler: AssetsController['getAssetMetadata'];\n};\n\nexport type AssetsControllerGetAssetsPriceAction = {\n type: `AssetsController:getAssetsPrice`;\n handler: AssetsController['getAssetsPrice'];\n};\n\n/**\n * Add a custom asset for an account.\n * Custom assets are included in subscription and fetch operations.\n * Adding a custom asset also unhides it if it was previously hidden.\n *\n * @param accountId - The account ID to add the custom asset for.\n * @param assetId - The CAIP-19 asset ID to add.\n */\nexport type AssetsControllerAddCustomAssetAction = {\n type: `AssetsController:addCustomAsset`;\n handler: AssetsController['addCustomAsset'];\n};\n\n/**\n * Remove a custom asset from an account.\n *\n * @param accountId - The account ID to remove the custom asset from.\n * @param assetId - The CAIP-19 asset ID to remove.\n */\nexport type AssetsControllerRemoveCustomAssetAction = {\n type: `AssetsController:removeCustomAsset`;\n handler: AssetsController['removeCustomAsset'];\n};\n\n/**\n * Get all custom assets for an account.\n *\n * @param accountId - The account ID to get custom assets for.\n * @returns Array of CAIP-19 asset IDs for the account's custom assets.\n */\nexport type AssetsControllerGetCustomAssetsAction = {\n type: `AssetsController:getCustomAssets`;\n handler: AssetsController['getCustomAssets'];\n};\n\n/**\n * Hide an asset globally.\n * Hidden assets are excluded from the asset list returned by getAssets.\n * The hidden state is stored in assetPreferences.\n *\n * @param assetId - The CAIP-19 asset ID to hide.\n */\nexport type AssetsControllerHideAssetAction = {\n type: `AssetsController:hideAsset`;\n handler: AssetsController['hideAsset'];\n};\n\n/**\n * Unhide an asset globally.\n *\n * @param assetId - The CAIP-19 asset ID to unhide.\n */\nexport type AssetsControllerUnhideAssetAction = {\n type: `AssetsController:unhideAsset`;\n handler: AssetsController['unhideAsset'];\n};\n\n/**\n * Union of all AssetsController action types.\n */\nexport type AssetsControllerMethodActions =\n | AssetsControllerGetAssetsAction\n | AssetsControllerGetAssetsBalanceAction\n | AssetsControllerGetAssetMetadataAction\n | AssetsControllerGetAssetsPriceAction\n | AssetsControllerAddCustomAssetAction\n | AssetsControllerRemoveCustomAssetAction\n | AssetsControllerGetCustomAssetsAction\n | AssetsControllerHideAssetAction\n | AssetsControllerUnhideAssetAction;\n"]}
@@ -19,31 +19,6 @@ export type AssetsControllerGetAssetsPriceAction = {
19
19
  type: `AssetsController:getAssetsPrice`;
20
20
  handler: AssetsController['getAssetsPrice'];
21
21
  };
22
- /**
23
- * Refresh balances from RPC for selected accounts/chains and update state.
24
- * Exposed for UI (e.g. pull-to-refresh). Only used when RPC is the data source;
25
- * websocket/API update automatically. Also triggered on transaction events (RPC path).
26
- */
27
- export type AssetsControllerRefreshBalancesAction = {
28
- type: `AssetsController:refreshBalances`;
29
- handler: AssetsController['refreshBalances'];
30
- };
31
- /**
32
- * Run token detection for selected accounts/chains (RPC path) and update state.
33
- * Exposed for UI. Only used when RPC is the data source; websocket/API update automatically.
34
- */
35
- export type AssetsControllerRefreshDetectedTokensAction = {
36
- type: `AssetsController:refreshDetectedTokens`;
37
- handler: AssetsController['refreshDetectedTokens'];
38
- };
39
- /**
40
- * Refresh staked balances for all subscribed accounts/chains and update state.
41
- * Exposed for UI. Also triggered automatically on transaction events.
42
- */
43
- export type AssetsControllerRefreshStakedBalanceAction = {
44
- type: `AssetsController:refreshStakedBalance`;
45
- handler: AssetsController['refreshStakedBalance'];
46
- };
47
22
  /**
48
23
  * Add a custom asset for an account.
49
24
  * Custom assets are included in subscription and fetch operations.
@@ -99,5 +74,5 @@ export type AssetsControllerUnhideAssetAction = {
99
74
  /**
100
75
  * Union of all AssetsController action types.
101
76
  */
102
- export type AssetsControllerMethodActions = AssetsControllerGetAssetsAction | AssetsControllerGetAssetsBalanceAction | AssetsControllerGetAssetMetadataAction | AssetsControllerGetAssetsPriceAction | AssetsControllerRefreshBalancesAction | AssetsControllerRefreshDetectedTokensAction | AssetsControllerRefreshStakedBalanceAction | AssetsControllerAddCustomAssetAction | AssetsControllerRemoveCustomAssetAction | AssetsControllerGetCustomAssetsAction | AssetsControllerHideAssetAction | AssetsControllerUnhideAssetAction;
77
+ export type AssetsControllerMethodActions = AssetsControllerGetAssetsAction | AssetsControllerGetAssetsBalanceAction | AssetsControllerGetAssetMetadataAction | AssetsControllerGetAssetsPriceAction | AssetsControllerAddCustomAssetAction | AssetsControllerRemoveCustomAssetAction | AssetsControllerGetCustomAssetsAction | AssetsControllerHideAssetAction | AssetsControllerUnhideAssetAction;
103
78
  //# sourceMappingURL=AssetsController-method-action-types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssetsController-method-action-types.d.cts","sourceRoot":"","sources":["../src/AssetsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA2B;AAE3D,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;CACpD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACrC,+BAA+B,GAC/B,sCAAsC,GACtC,sCAAsC,GACtC,oCAAoC,GACpC,qCAAqC,GACrC,2CAA2C,GAC3C,0CAA0C,GAC1C,oCAAoC,GACpC,uCAAuC,GACvC,qCAAqC,GACrC,+BAA+B,GAC/B,iCAAiC,CAAC"}
1
+ {"version":3,"file":"AssetsController-method-action-types.d.cts","sourceRoot":"","sources":["../src/AssetsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA2B;AAE3D,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACrC,+BAA+B,GAC/B,sCAAsC,GACtC,sCAAsC,GACtC,oCAAoC,GACpC,oCAAoC,GACpC,uCAAuC,GACvC,qCAAqC,GACrC,+BAA+B,GAC/B,iCAAiC,CAAC"}
@@ -19,31 +19,6 @@ export type AssetsControllerGetAssetsPriceAction = {
19
19
  type: `AssetsController:getAssetsPrice`;
20
20
  handler: AssetsController['getAssetsPrice'];
21
21
  };
22
- /**
23
- * Refresh balances from RPC for selected accounts/chains and update state.
24
- * Exposed for UI (e.g. pull-to-refresh). Only used when RPC is the data source;
25
- * websocket/API update automatically. Also triggered on transaction events (RPC path).
26
- */
27
- export type AssetsControllerRefreshBalancesAction = {
28
- type: `AssetsController:refreshBalances`;
29
- handler: AssetsController['refreshBalances'];
30
- };
31
- /**
32
- * Run token detection for selected accounts/chains (RPC path) and update state.
33
- * Exposed for UI. Only used when RPC is the data source; websocket/API update automatically.
34
- */
35
- export type AssetsControllerRefreshDetectedTokensAction = {
36
- type: `AssetsController:refreshDetectedTokens`;
37
- handler: AssetsController['refreshDetectedTokens'];
38
- };
39
- /**
40
- * Refresh staked balances for all subscribed accounts/chains and update state.
41
- * Exposed for UI. Also triggered automatically on transaction events.
42
- */
43
- export type AssetsControllerRefreshStakedBalanceAction = {
44
- type: `AssetsController:refreshStakedBalance`;
45
- handler: AssetsController['refreshStakedBalance'];
46
- };
47
22
  /**
48
23
  * Add a custom asset for an account.
49
24
  * Custom assets are included in subscription and fetch operations.
@@ -99,5 +74,5 @@ export type AssetsControllerUnhideAssetAction = {
99
74
  /**
100
75
  * Union of all AssetsController action types.
101
76
  */
102
- export type AssetsControllerMethodActions = AssetsControllerGetAssetsAction | AssetsControllerGetAssetsBalanceAction | AssetsControllerGetAssetMetadataAction | AssetsControllerGetAssetsPriceAction | AssetsControllerRefreshBalancesAction | AssetsControllerRefreshDetectedTokensAction | AssetsControllerRefreshStakedBalanceAction | AssetsControllerAddCustomAssetAction | AssetsControllerRemoveCustomAssetAction | AssetsControllerGetCustomAssetsAction | AssetsControllerHideAssetAction | AssetsControllerUnhideAssetAction;
77
+ export type AssetsControllerMethodActions = AssetsControllerGetAssetsAction | AssetsControllerGetAssetsBalanceAction | AssetsControllerGetAssetMetadataAction | AssetsControllerGetAssetsPriceAction | AssetsControllerAddCustomAssetAction | AssetsControllerRemoveCustomAssetAction | AssetsControllerGetCustomAssetsAction | AssetsControllerHideAssetAction | AssetsControllerUnhideAssetAction;
103
78
  //# sourceMappingURL=AssetsController-method-action-types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssetsController-method-action-types.d.mts","sourceRoot":"","sources":["../src/AssetsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA2B;AAE3D,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;CACpD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACrC,+BAA+B,GAC/B,sCAAsC,GACtC,sCAAsC,GACtC,oCAAoC,GACpC,qCAAqC,GACrC,2CAA2C,GAC3C,0CAA0C,GAC1C,oCAAoC,GACpC,uCAAuC,GACvC,qCAAqC,GACrC,+BAA+B,GAC/B,iCAAiC,CAAC"}
1
+ {"version":3,"file":"AssetsController-method-action-types.d.mts","sourceRoot":"","sources":["../src/AssetsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA2B;AAE3D,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;CAChD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACrC,+BAA+B,GAC/B,sCAAsC,GACtC,sCAAsC,GACtC,oCAAoC,GACpC,oCAAoC,GACpC,uCAAuC,GACvC,qCAAqC,GACrC,+BAA+B,GAC/B,iCAAiC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AssetsController-method-action-types.mjs","sourceRoot":"","sources":["../src/AssetsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { AssetsController } from './AssetsController';\n\nexport type AssetsControllerGetAssetsAction = {\n type: `AssetsController:getAssets`;\n handler: AssetsController['getAssets'];\n};\n\nexport type AssetsControllerGetAssetsBalanceAction = {\n type: `AssetsController:getAssetsBalance`;\n handler: AssetsController['getAssetsBalance'];\n};\n\nexport type AssetsControllerGetAssetMetadataAction = {\n type: `AssetsController:getAssetMetadata`;\n handler: AssetsController['getAssetMetadata'];\n};\n\nexport type AssetsControllerGetAssetsPriceAction = {\n type: `AssetsController:getAssetsPrice`;\n handler: AssetsController['getAssetsPrice'];\n};\n\n/**\n * Refresh balances from RPC for selected accounts/chains and update state.\n * Exposed for UI (e.g. pull-to-refresh). Only used when RPC is the data source;\n * websocket/API update automatically. Also triggered on transaction events (RPC path).\n */\nexport type AssetsControllerRefreshBalancesAction = {\n type: `AssetsController:refreshBalances`;\n handler: AssetsController['refreshBalances'];\n};\n\n/**\n * Run token detection for selected accounts/chains (RPC path) and update state.\n * Exposed for UI. Only used when RPC is the data source; websocket/API update automatically.\n */\nexport type AssetsControllerRefreshDetectedTokensAction = {\n type: `AssetsController:refreshDetectedTokens`;\n handler: AssetsController['refreshDetectedTokens'];\n};\n\n/**\n * Refresh staked balances for all subscribed accounts/chains and update state.\n * Exposed for UI. Also triggered automatically on transaction events.\n */\nexport type AssetsControllerRefreshStakedBalanceAction = {\n type: `AssetsController:refreshStakedBalance`;\n handler: AssetsController['refreshStakedBalance'];\n};\n\n/**\n * Add a custom asset for an account.\n * Custom assets are included in subscription and fetch operations.\n * Adding a custom asset also unhides it if it was previously hidden.\n *\n * @param accountId - The account ID to add the custom asset for.\n * @param assetId - The CAIP-19 asset ID to add.\n */\nexport type AssetsControllerAddCustomAssetAction = {\n type: `AssetsController:addCustomAsset`;\n handler: AssetsController['addCustomAsset'];\n};\n\n/**\n * Remove a custom asset from an account.\n *\n * @param accountId - The account ID to remove the custom asset from.\n * @param assetId - The CAIP-19 asset ID to remove.\n */\nexport type AssetsControllerRemoveCustomAssetAction = {\n type: `AssetsController:removeCustomAsset`;\n handler: AssetsController['removeCustomAsset'];\n};\n\n/**\n * Get all custom assets for an account.\n *\n * @param accountId - The account ID to get custom assets for.\n * @returns Array of CAIP-19 asset IDs for the account's custom assets.\n */\nexport type AssetsControllerGetCustomAssetsAction = {\n type: `AssetsController:getCustomAssets`;\n handler: AssetsController['getCustomAssets'];\n};\n\n/**\n * Hide an asset globally.\n * Hidden assets are excluded from the asset list returned by getAssets.\n * The hidden state is stored in assetPreferences.\n *\n * @param assetId - The CAIP-19 asset ID to hide.\n */\nexport type AssetsControllerHideAssetAction = {\n type: `AssetsController:hideAsset`;\n handler: AssetsController['hideAsset'];\n};\n\n/**\n * Unhide an asset globally.\n *\n * @param assetId - The CAIP-19 asset ID to unhide.\n */\nexport type AssetsControllerUnhideAssetAction = {\n type: `AssetsController:unhideAsset`;\n handler: AssetsController['unhideAsset'];\n};\n\n/**\n * Union of all AssetsController action types.\n */\nexport type AssetsControllerMethodActions =\n | AssetsControllerGetAssetsAction\n | AssetsControllerGetAssetsBalanceAction\n | AssetsControllerGetAssetMetadataAction\n | AssetsControllerGetAssetsPriceAction\n | AssetsControllerRefreshBalancesAction\n | AssetsControllerRefreshDetectedTokensAction\n | AssetsControllerRefreshStakedBalanceAction\n | AssetsControllerAddCustomAssetAction\n | AssetsControllerRemoveCustomAssetAction\n | AssetsControllerGetCustomAssetsAction\n | AssetsControllerHideAssetAction\n | AssetsControllerUnhideAssetAction;\n"]}
1
+ {"version":3,"file":"AssetsController-method-action-types.mjs","sourceRoot":"","sources":["../src/AssetsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { AssetsController } from './AssetsController';\n\nexport type AssetsControllerGetAssetsAction = {\n type: `AssetsController:getAssets`;\n handler: AssetsController['getAssets'];\n};\n\nexport type AssetsControllerGetAssetsBalanceAction = {\n type: `AssetsController:getAssetsBalance`;\n handler: AssetsController['getAssetsBalance'];\n};\n\nexport type AssetsControllerGetAssetMetadataAction = {\n type: `AssetsController:getAssetMetadata`;\n handler: AssetsController['getAssetMetadata'];\n};\n\nexport type AssetsControllerGetAssetsPriceAction = {\n type: `AssetsController:getAssetsPrice`;\n handler: AssetsController['getAssetsPrice'];\n};\n\n/**\n * Add a custom asset for an account.\n * Custom assets are included in subscription and fetch operations.\n * Adding a custom asset also unhides it if it was previously hidden.\n *\n * @param accountId - The account ID to add the custom asset for.\n * @param assetId - The CAIP-19 asset ID to add.\n */\nexport type AssetsControllerAddCustomAssetAction = {\n type: `AssetsController:addCustomAsset`;\n handler: AssetsController['addCustomAsset'];\n};\n\n/**\n * Remove a custom asset from an account.\n *\n * @param accountId - The account ID to remove the custom asset from.\n * @param assetId - The CAIP-19 asset ID to remove.\n */\nexport type AssetsControllerRemoveCustomAssetAction = {\n type: `AssetsController:removeCustomAsset`;\n handler: AssetsController['removeCustomAsset'];\n};\n\n/**\n * Get all custom assets for an account.\n *\n * @param accountId - The account ID to get custom assets for.\n * @returns Array of CAIP-19 asset IDs for the account's custom assets.\n */\nexport type AssetsControllerGetCustomAssetsAction = {\n type: `AssetsController:getCustomAssets`;\n handler: AssetsController['getCustomAssets'];\n};\n\n/**\n * Hide an asset globally.\n * Hidden assets are excluded from the asset list returned by getAssets.\n * The hidden state is stored in assetPreferences.\n *\n * @param assetId - The CAIP-19 asset ID to hide.\n */\nexport type AssetsControllerHideAssetAction = {\n type: `AssetsController:hideAsset`;\n handler: AssetsController['hideAsset'];\n};\n\n/**\n * Unhide an asset globally.\n *\n * @param assetId - The CAIP-19 asset ID to unhide.\n */\nexport type AssetsControllerUnhideAssetAction = {\n type: `AssetsController:unhideAsset`;\n handler: AssetsController['unhideAsset'];\n};\n\n/**\n * Union of all AssetsController action types.\n */\nexport type AssetsControllerMethodActions =\n | AssetsControllerGetAssetsAction\n | AssetsControllerGetAssetsBalanceAction\n | AssetsControllerGetAssetMetadataAction\n | AssetsControllerGetAssetsPriceAction\n | AssetsControllerAddCustomAssetAction\n | AssetsControllerRemoveCustomAssetAction\n | AssetsControllerGetCustomAssetsAction\n | AssetsControllerHideAssetAction\n | AssetsControllerUnhideAssetAction;\n"]}
@@ -13,7 +13,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- var _AssetsController_instances, _AssetsController_isEnabled, _AssetsController_isBasicFunctionality, _AssetsController_defaultUpdateInterval, _AssetsController_pricePollInterval, _AssetsController_trackMetaMetricsEvent, _AssetsController_firstInitFetchReported, _AssetsController_controllerMutex, _AssetsController_activeSubscriptions, _AssetsController_enabledChains, _AssetsController_selectedAccounts_get, _AssetsController_backendWebsocketDataSource, _AssetsController_accountsApiDataSource, _AssetsController_snapDataSource, _AssetsController_rpcDataSource, _AssetsController_stakedBalanceDataSource, _AssetsController_allBalanceDataSources_get, _AssetsController_priceDataSource, _AssetsController_detectionMiddleware, _AssetsController_tokenDataSource, _AssetsController_unsubscribeBasicFunctionality, _AssetsController_constructionState, _AssetsController_initializeState, _AssetsController_extractEnabledChains, _AssetsController_normalizeChainReference, _AssetsController_subscribeToEvents, _AssetsController_registerActionHandlers, _AssetsController_executeMiddlewares, _AssetsController_updateState, _AssetsController_getAssetsFromState, _AssetsController_tokenStandardToAssetType, _AssetsController_start, _AssetsController_stop, _AssetsController_subscribeAssets, _AssetsController_subscribeAssetsBalance, _AssetsController_subscribeStakedBalance, _AssetsController_buildChainToAccountsMap, _AssetsController_subscribeDataSource, _AssetsController_unsubscribeDataSource, _AssetsController_buildDataRequest, _AssetsController_getEnabledChainsForAccount, _AssetsController_handleAccountGroupChanged, _AssetsController_handleEnabledNetworksChanged;
16
+ var _AssetsController_instances, _AssetsController_isEnabled, _AssetsController_isBasicFunctionality, _AssetsController_defaultUpdateInterval, _AssetsController_trackMetaMetricsEvent, _AssetsController_firstInitFetchReported, _AssetsController_controllerMutex, _AssetsController_activeSubscriptions, _AssetsController_enabledChains, _AssetsController_selectedAccounts_get, _AssetsController_backendWebsocketDataSource, _AssetsController_accountsApiDataSource, _AssetsController_snapDataSource, _AssetsController_rpcDataSource, _AssetsController_allBalanceDataSources_get, _AssetsController_priceDataSource, _AssetsController_detectionMiddleware, _AssetsController_tokenDataSource, _AssetsController_unsubscribeBasicFunctionality, _AssetsController_initializeState, _AssetsController_extractEnabledChains, _AssetsController_normalizeChainReference, _AssetsController_subscribeToEvents, _AssetsController_registerActionHandlers, _AssetsController_executeMiddlewares, _AssetsController_updateState, _AssetsController_getAssetsFromState, _AssetsController_tokenStandardToAssetType, _AssetsController_start, _AssetsController_stop, _AssetsController_subscribeAssets, _AssetsController_subscribeAssetsBalance, _AssetsController_buildChainToAccountsMap, _AssetsController_subscribeDataSource, _AssetsController_unsubscribeDataSource, _AssetsController_buildDataRequest, _AssetsController_getEnabledChainsForAccount, _AssetsController_handleAccountGroupChanged, _AssetsController_handleEnabledNetworksChanged;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.AssetsController = exports.getDefaultAssetsControllerState = void 0;
19
19
  const base_controller_1 = require("@metamask/base-controller");
@@ -26,7 +26,6 @@ const BackendWebsocketDataSource_1 = require("./data-sources/BackendWebsocketDat
26
26
  const PriceDataSource_1 = require("./data-sources/PriceDataSource.cjs");
27
27
  const RpcDataSource_1 = require("./data-sources/RpcDataSource.cjs");
28
28
  const SnapDataSource_1 = require("./data-sources/SnapDataSource.cjs");
29
- const StakedBalanceDataSource_1 = require("./data-sources/StakedBalanceDataSource.cjs");
30
29
  const TokenDataSource_1 = require("./data-sources/TokenDataSource.cjs");
31
30
  const logger_1 = require("./logger.cjs");
32
31
  const DetectionMiddleware_1 = require("./middlewares/DetectionMiddleware.cjs");
@@ -46,9 +45,6 @@ const MESSENGER_EXPOSED_METHODS = [
46
45
  'getCustomAssets',
47
46
  'hideAsset',
48
47
  'unhideAsset',
49
- 'refreshBalances',
50
- 'refreshDetectedTokens',
51
- 'refreshStakedBalance',
52
48
  ];
53
49
  /** Default polling interval hint for data sources (30 seconds) */
54
50
  const DEFAULT_POLLING_INTERVAL_MS = 30000;
@@ -186,7 +182,7 @@ function normalizeResponse(response) {
186
182
  * - The controller does NOT manage polling - it simply receives pushed updates
187
183
  */
188
184
  class AssetsController extends base_controller_1.BaseController {
189
- constructor({ messenger, state = {}, defaultUpdateInterval = DEFAULT_POLLING_INTERVAL_MS, isEnabled = () => true, isBasicFunctionality, subscribeToBasicFunctionalityChange, queryApiClient, rpcDataSourceConfig, trackMetaMetricsEvent, accountsApiDataSourceConfig, priceDataSourceConfig, stakedBalanceDataSourceConfig, }) {
185
+ constructor({ messenger, state = {}, defaultUpdateInterval = DEFAULT_POLLING_INTERVAL_MS, isEnabled = () => true, isBasicFunctionality, subscribeToBasicFunctionalityChange, queryApiClient, rpcDataSourceConfig, trackMetaMetricsEvent, accountsApiDataSourceConfig, priceDataSourceConfig, }) {
190
186
  super({
191
187
  name: CONTROLLER_NAME,
192
188
  messenger,
@@ -203,8 +199,6 @@ class AssetsController extends base_controller_1.BaseController {
203
199
  _AssetsController_isBasicFunctionality.set(this, void 0);
204
200
  /** Default update interval hint passed to data sources */
205
201
  _AssetsController_defaultUpdateInterval.set(this, void 0);
206
- /** Price polling interval from priceDataSourceConfig (overrides default when set). */
207
- _AssetsController_pricePollInterval.set(this, void 0);
208
202
  /** Optional callback for first init/fetch MetaMetrics (duration). */
209
203
  _AssetsController_trackMetaMetricsEvent.set(this, void 0);
210
204
  /** Whether we have already reported first init fetch for this session (reset on #stop). */
@@ -223,24 +217,16 @@ class AssetsController extends base_controller_1.BaseController {
223
217
  _AssetsController_accountsApiDataSource.set(this, void 0);
224
218
  _AssetsController_snapDataSource.set(this, void 0);
225
219
  _AssetsController_rpcDataSource.set(this, void 0);
226
- _AssetsController_stakedBalanceDataSource.set(this, void 0);
227
220
  _AssetsController_priceDataSource.set(this, void 0);
228
221
  _AssetsController_detectionMiddleware.set(this, void 0);
229
222
  _AssetsController_tokenDataSource.set(this, void 0);
230
223
  _AssetsController_unsubscribeBasicFunctionality.set(this, null);
231
- _AssetsController_constructionState.set(this, { initialized: false });
232
224
  __classPrivateFieldSet(this, _AssetsController_isEnabled, isEnabled(), "f");
233
225
  __classPrivateFieldSet(this, _AssetsController_isBasicFunctionality, isBasicFunctionality ?? (() => true), "f");
234
226
  __classPrivateFieldSet(this, _AssetsController_defaultUpdateInterval, defaultUpdateInterval, "f");
235
- __classPrivateFieldSet(this, _AssetsController_pricePollInterval, priceDataSourceConfig?.pollInterval, "f");
236
227
  __classPrivateFieldSet(this, _AssetsController_trackMetaMetricsEvent, trackMetaMetricsEvent, "f");
237
228
  const rpcConfig = rpcDataSourceConfig ?? {};
238
- const onActiveChainsUpdated = (dataSourceName, chains, previousChains) => {
239
- if (!__classPrivateFieldGet(this, _AssetsController_constructionState, "f").initialized) {
240
- return;
241
- }
242
- this.handleActiveChainsUpdate(dataSourceName, chains, previousChains);
243
- };
229
+ const onActiveChainsUpdated = (dataSourceName, chains, previousChains) => this.handleActiveChainsUpdate(dataSourceName, chains, previousChains);
244
230
  __classPrivateFieldSet(this, _AssetsController_backendWebsocketDataSource, new BackendWebsocketDataSource_1.BackendWebsocketDataSource({
245
231
  messenger: this.messenger,
246
232
  queryApiClient,
@@ -260,11 +246,6 @@ class AssetsController extends base_controller_1.BaseController {
260
246
  onActiveChainsUpdated,
261
247
  ...rpcConfig,
262
248
  }), "f");
263
- __classPrivateFieldSet(this, _AssetsController_stakedBalanceDataSource, new StakedBalanceDataSource_1.StakedBalanceDataSource({
264
- messenger: this.messenger,
265
- onActiveChainsUpdated,
266
- ...stakedBalanceDataSourceConfig,
267
- }), "f");
268
249
  __classPrivateFieldSet(this, _AssetsController_tokenDataSource, new TokenDataSource_1.TokenDataSource({
269
250
  queryApiClient,
270
251
  }), "f");
@@ -283,8 +264,6 @@ class AssetsController extends base_controller_1.BaseController {
283
264
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_initializeState).call(this);
284
265
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeToEvents).call(this);
285
266
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_registerActionHandlers).call(this);
286
- __classPrivateFieldGet(this, _AssetsController_constructionState, "f").initialized = true;
287
- // Subscriptions start only on KeyringController:unlock -> #start(), not here.
288
267
  // Subscribe to basic-functionality changes after construction so a synchronous
289
268
  // onChange during subscribe cannot run before data sources are initialized.
290
269
  if (subscribeToBasicFunctionalityChange) {
@@ -311,9 +290,6 @@ class AssetsController extends base_controller_1.BaseController {
311
290
  * @param previousChains - Previous chains; used to compute added/removed.
312
291
  */
313
292
  handleActiveChainsUpdate(dataSourceId, activeChains, previousChains) {
314
- if (!__classPrivateFieldGet(this, _AssetsController_isEnabled, "f")) {
315
- return;
316
- }
317
293
  log('Data source active chains changed', {
318
294
  dataSourceId,
319
295
  chainCount: activeChains.length,
@@ -367,16 +343,11 @@ class AssetsController extends base_controller_1.BaseController {
367
343
  __classPrivateFieldGet(this, _AssetsController_accountsApiDataSource, "f"),
368
344
  __classPrivateFieldGet(this, _AssetsController_snapDataSource, "f"),
369
345
  __classPrivateFieldGet(this, _AssetsController_rpcDataSource, "f"),
370
- __classPrivateFieldGet(this, _AssetsController_stakedBalanceDataSource, "f"),
371
346
  __classPrivateFieldGet(this, _AssetsController_detectionMiddleware, "f"),
372
347
  __classPrivateFieldGet(this, _AssetsController_tokenDataSource, "f"),
373
348
  __classPrivateFieldGet(this, _AssetsController_priceDataSource, "f"),
374
349
  ]
375
- : [
376
- __classPrivateFieldGet(this, _AssetsController_rpcDataSource, "f"),
377
- __classPrivateFieldGet(this, _AssetsController_stakedBalanceDataSource, "f"),
378
- __classPrivateFieldGet(this, _AssetsController_detectionMiddleware, "f"),
379
- ];
350
+ : [__classPrivateFieldGet(this, _AssetsController_rpcDataSource, "f"), __classPrivateFieldGet(this, _AssetsController_detectionMiddleware, "f")];
380
351
  const { response, durationByDataSource } = await __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_executeMiddlewares).call(this, sources, request);
381
352
  await __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateState).call(this, response);
382
353
  if (__classPrivateFieldGet(this, _AssetsController_trackMetaMetricsEvent, "f") && !__classPrivateFieldGet(this, _AssetsController_firstInitFetchReported, "f")) {
@@ -432,28 +403,6 @@ class AssetsController extends base_controller_1.BaseController {
432
403
  }
433
404
  return result;
434
405
  }
435
- /**
436
- * Refresh balances from RPC for selected accounts/chains and update state.
437
- * Exposed for UI (e.g. pull-to-refresh). Only used when RPC is the data source;
438
- * websocket/API update automatically. Also triggered on transaction events (RPC path).
439
- */
440
- async refreshBalances() {
441
- await __classPrivateFieldGet(this, _AssetsController_rpcDataSource, "f").refreshBalances();
442
- }
443
- /**
444
- * Run token detection for selected accounts/chains (RPC path) and update state.
445
- * Exposed for UI. Only used when RPC is the data source; websocket/API update automatically.
446
- */
447
- async refreshDetectedTokens() {
448
- await __classPrivateFieldGet(this, _AssetsController_rpcDataSource, "f").refreshDetectedTokens();
449
- }
450
- /**
451
- * Refresh staked balances for all subscribed accounts/chains and update state.
452
- * Exposed for UI. Also triggered automatically on transaction events.
453
- */
454
- async refreshStakedBalance() {
455
- await __classPrivateFieldGet(this, _AssetsController_stakedBalanceDataSource, "f").refreshStakedBalance();
456
- }
457
406
  // ============================================================================
458
407
  // CUSTOM ASSETS MANAGEMENT
459
408
  // ============================================================================
@@ -578,7 +527,7 @@ class AssetsController extends base_controller_1.BaseController {
578
527
  if (!__classPrivateFieldGet(this, _AssetsController_isBasicFunctionality, "f").call(this)) {
579
528
  return;
580
529
  }
581
- const { updateInterval = __classPrivateFieldGet(this, _AssetsController_pricePollInterval, "f") ?? __classPrivateFieldGet(this, _AssetsController_defaultUpdateInterval, "f"), } = options;
530
+ const { updateInterval = __classPrivateFieldGet(this, _AssetsController_defaultUpdateInterval, "f") } = options;
582
531
  const subscriptionKey = 'ds:PriceDataSource';
583
532
  const existingSubscription = __classPrivateFieldGet(this, _AssetsController_activeSubscriptions, "f").get(subscriptionKey);
584
533
  const isUpdate = existingSubscription !== undefined;
@@ -666,7 +615,6 @@ class AssetsController extends base_controller_1.BaseController {
666
615
  __classPrivateFieldGet(this, _AssetsController_accountsApiDataSource, "f")?.destroy?.();
667
616
  __classPrivateFieldGet(this, _AssetsController_snapDataSource, "f")?.destroy?.();
668
617
  __classPrivateFieldGet(this, _AssetsController_rpcDataSource, "f")?.destroy?.();
669
- __classPrivateFieldGet(this, _AssetsController_stakedBalanceDataSource, "f")?.destroy?.();
670
618
  // Stop all active subscriptions
671
619
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_stop).call(this);
672
620
  if (__classPrivateFieldGet(this, _AssetsController_unsubscribeBasicFunctionality, "f")) {
@@ -683,13 +631,10 @@ class AssetsController extends base_controller_1.BaseController {
683
631
  this.messenger.unregisterActionHandler('AssetsController:getCustomAssets');
684
632
  this.messenger.unregisterActionHandler('AssetsController:hideAsset');
685
633
  this.messenger.unregisterActionHandler('AssetsController:unhideAsset');
686
- this.messenger.unregisterActionHandler('AssetsController:refreshBalances');
687
- this.messenger.unregisterActionHandler('AssetsController:refreshDetectedTokens');
688
- this.messenger.unregisterActionHandler('AssetsController:refreshStakedBalance');
689
634
  }
690
635
  }
691
636
  exports.AssetsController = AssetsController;
692
- _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctionality = new WeakMap(), _AssetsController_defaultUpdateInterval = new WeakMap(), _AssetsController_pricePollInterval = new WeakMap(), _AssetsController_trackMetaMetricsEvent = new WeakMap(), _AssetsController_firstInitFetchReported = new WeakMap(), _AssetsController_controllerMutex = new WeakMap(), _AssetsController_activeSubscriptions = new WeakMap(), _AssetsController_enabledChains = new WeakMap(), _AssetsController_backendWebsocketDataSource = new WeakMap(), _AssetsController_accountsApiDataSource = new WeakMap(), _AssetsController_snapDataSource = new WeakMap(), _AssetsController_rpcDataSource = new WeakMap(), _AssetsController_stakedBalanceDataSource = new WeakMap(), _AssetsController_priceDataSource = new WeakMap(), _AssetsController_detectionMiddleware = new WeakMap(), _AssetsController_tokenDataSource = new WeakMap(), _AssetsController_unsubscribeBasicFunctionality = new WeakMap(), _AssetsController_constructionState = new WeakMap(), _AssetsController_instances = new WeakSet(), _AssetsController_selectedAccounts_get = function _AssetsController_selectedAccounts_get() {
637
+ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctionality = new WeakMap(), _AssetsController_defaultUpdateInterval = new WeakMap(), _AssetsController_trackMetaMetricsEvent = new WeakMap(), _AssetsController_firstInitFetchReported = new WeakMap(), _AssetsController_controllerMutex = new WeakMap(), _AssetsController_activeSubscriptions = new WeakMap(), _AssetsController_enabledChains = new WeakMap(), _AssetsController_backendWebsocketDataSource = new WeakMap(), _AssetsController_accountsApiDataSource = new WeakMap(), _AssetsController_snapDataSource = new WeakMap(), _AssetsController_rpcDataSource = new WeakMap(), _AssetsController_priceDataSource = new WeakMap(), _AssetsController_detectionMiddleware = new WeakMap(), _AssetsController_tokenDataSource = new WeakMap(), _AssetsController_unsubscribeBasicFunctionality = new WeakMap(), _AssetsController_instances = new WeakSet(), _AssetsController_selectedAccounts_get = function _AssetsController_selectedAccounts_get() {
693
638
  return this.messenger.call('AccountTreeController:getAccountsFromSelectedAccountGroup');
694
639
  }, _AssetsController_allBalanceDataSources_get = function _AssetsController_allBalanceDataSources_get() {
695
640
  return [
@@ -1004,17 +949,13 @@ async function _AssetsController_updateState(response) {
1004
949
  this.unsubscribeAssetsPrice();
1005
950
  // Stop balance subscriptions by properly notifying data sources via messenger
1006
951
  // This ensures data sources stop their polling timers.
1007
- // Use #allBalanceDataSources + staked balance source so we unsubscribe from
1008
- // every source that may have been subscribed.
1009
- const allSources = [
1010
- ...__classPrivateFieldGet(this, _AssetsController_instances, "a", _AssetsController_allBalanceDataSources_get),
1011
- __classPrivateFieldGet(this, _AssetsController_stakedBalanceDataSource, "f"),
1012
- ];
952
+ // Use #allBalanceDataSources so we unsubscribe from every source that may have
953
+ // been subscribed (e.g. when switching from full to basic functionality).
1013
954
  const subscriptionKeys = [...__classPrivateFieldGet(this, _AssetsController_activeSubscriptions, "f").keys()];
1014
955
  for (const subscriptionKey of subscriptionKeys) {
1015
956
  if (subscriptionKey.startsWith('ds:')) {
1016
957
  const sourceId = subscriptionKey.slice(3);
1017
- const source = allSources.find((ds) => ds.getName() === sourceId);
958
+ const source = __classPrivateFieldGet(this, _AssetsController_instances, "a", _AssetsController_allBalanceDataSources_get).find((ds) => ds.getName() === sourceId);
1018
959
  if (source) {
1019
960
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_unsubscribeDataSource).call(this, source);
1020
961
  }
@@ -1029,10 +970,6 @@ async function _AssetsController_updateState(response) {
1029
970
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeAssetsBalance).call(this, __classPrivateFieldGet(this, _AssetsController_instances, "a", _AssetsController_selectedAccounts_get), [
1030
971
  ...__classPrivateFieldGet(this, _AssetsController_enabledChains, "f"),
1031
972
  ]);
1032
- // Subscribe to staked balance updates (separate from regular balance chain-claiming)
1033
- __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeStakedBalance).call(this, __classPrivateFieldGet(this, _AssetsController_instances, "a", _AssetsController_selectedAccounts_get), [
1034
- ...__classPrivateFieldGet(this, _AssetsController_enabledChains, "f"),
1035
- ]);
1036
973
  // Subscribe to price updates for all assets held by selected accounts
1037
974
  this.subscribeAssetsPrice(__classPrivateFieldGet(this, _AssetsController_instances, "a", _AssetsController_selectedAccounts_get), [...__classPrivateFieldGet(this, _AssetsController_enabledChains, "f")]);
1038
975
  }, _AssetsController_subscribeAssetsBalance = function _AssetsController_subscribeAssetsBalance(accounts, chainIds) {
@@ -1063,18 +1000,6 @@ async function _AssetsController_updateState(response) {
1063
1000
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeDataSource).call(this, source, accountsForSource, assignedChains);
1064
1001
  }
1065
1002
  }
1066
- }, _AssetsController_subscribeStakedBalance = function _AssetsController_subscribeStakedBalance(accounts, chainIds) {
1067
- const source = __classPrivateFieldGet(this, _AssetsController_stakedBalanceDataSource, "f");
1068
- if (!source) {
1069
- return;
1070
- }
1071
- const availableChains = new Set(source.getActiveChainsSync());
1072
- const assignedChains = chainIds.filter((chainId) => availableChains.has(chainId));
1073
- if (assignedChains.length === 0) {
1074
- __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_unsubscribeDataSource).call(this, source);
1075
- return;
1076
- }
1077
- __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeDataSource).call(this, source, accounts, assignedChains);
1078
1003
  }, _AssetsController_buildChainToAccountsMap = function _AssetsController_buildChainToAccountsMap(accounts, chainsToSubscribe) {
1079
1004
  const chainToAccounts = new Map();
1080
1005
  for (const account of accounts) {