@metamask-previews/assets-controller 9.0.1-preview-153490ebd → 9.0.1-preview-8f1765558

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 (62) hide show
  1. package/CHANGELOG.md +12 -2
  2. package/dist/AssetsController-method-action-types.cjs.map +1 -1
  3. package/dist/AssetsController-method-action-types.d.cts +25 -1
  4. package/dist/AssetsController-method-action-types.d.cts.map +1 -1
  5. package/dist/AssetsController-method-action-types.d.mts +25 -1
  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 +146 -28
  9. package/dist/AssetsController.cjs.map +1 -1
  10. package/dist/AssetsController.d.cts +18 -0
  11. package/dist/AssetsController.d.cts.map +1 -1
  12. package/dist/AssetsController.d.mts +18 -0
  13. package/dist/AssetsController.d.mts.map +1 -1
  14. package/dist/AssetsController.mjs +146 -28
  15. package/dist/AssetsController.mjs.map +1 -1
  16. package/dist/data-sources/SnapDataSource.cjs +10 -0
  17. package/dist/data-sources/SnapDataSource.cjs.map +1 -1
  18. package/dist/data-sources/SnapDataSource.d.cts +8 -0
  19. package/dist/data-sources/SnapDataSource.d.cts.map +1 -1
  20. package/dist/data-sources/SnapDataSource.d.mts +8 -0
  21. package/dist/data-sources/SnapDataSource.d.mts.map +1 -1
  22. package/dist/data-sources/SnapDataSource.mjs +10 -0
  23. package/dist/data-sources/SnapDataSource.mjs.map +1 -1
  24. package/dist/index.cjs +13 -1
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +4 -1
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.mts +4 -1
  29. package/dist/index.d.mts.map +1 -1
  30. package/dist/index.mjs +3 -0
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/services/AccountAssetEnrichmentService.cjs +111 -0
  33. package/dist/services/AccountAssetEnrichmentService.cjs.map +1 -0
  34. package/dist/services/AccountAssetEnrichmentService.d.cts +34 -0
  35. package/dist/services/AccountAssetEnrichmentService.d.cts.map +1 -0
  36. package/dist/services/AccountAssetEnrichmentService.d.mts +34 -0
  37. package/dist/services/AccountAssetEnrichmentService.d.mts.map +1 -0
  38. package/dist/services/AccountAssetEnrichmentService.mjs +107 -0
  39. package/dist/services/AccountAssetEnrichmentService.mjs.map +1 -0
  40. package/dist/types.cjs.map +1 -1
  41. package/dist/types.d.cts +14 -0
  42. package/dist/types.d.cts.map +1 -1
  43. package/dist/types.d.mts +14 -0
  44. package/dist/types.d.mts.map +1 -1
  45. package/dist/types.mjs.map +1 -1
  46. package/dist/utils/account-asset-enrichment.cjs +201 -0
  47. package/dist/utils/account-asset-enrichment.cjs.map +1 -0
  48. package/dist/utils/account-asset-enrichment.d.cts +103 -0
  49. package/dist/utils/account-asset-enrichment.d.cts.map +1 -0
  50. package/dist/utils/account-asset-enrichment.d.mts +103 -0
  51. package/dist/utils/account-asset-enrichment.d.mts.map +1 -0
  52. package/dist/utils/account-asset-enrichment.mjs +190 -0
  53. package/dist/utils/account-asset-enrichment.mjs.map +1 -0
  54. package/dist/utils/stellar.cjs +66 -0
  55. package/dist/utils/stellar.cjs.map +1 -0
  56. package/dist/utils/stellar.d.cts +24 -0
  57. package/dist/utils/stellar.d.cts.map +1 -0
  58. package/dist/utils/stellar.d.mts +24 -0
  59. package/dist/utils/stellar.d.mts.map +1 -0
  60. package/dist/utils/stellar.mjs +62 -0
  61. package/dist/utils/stellar.mjs.map +1 -0
  62. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -7,11 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Add Stellar classic trustline enrichment to `AssetsController` via explicit `refreshAccountAssetInfo` and `invalidateAccountAssetExtras` messenger actions ([#TODO](https://github.com/MetaMask/core/pull/TODO))
13
+ - Store trustline fields on `FungibleAssetBalance.extra` (`limit`, `authorized`, `sponsored`)
14
+ - Apply Stellar classic trustline enrichment incrementally per snap batch so successful batches are not blocked by later hung requests ([#TODO](https://github.com/MetaMask/core/pull/TODO))
15
+ - Batch Stellar classic `getAccountAssetInfo` snap requests and serialize per snap id to avoid mobile snap termination on bulk enrichment ([#TODO](https://github.com/MetaMask/core/pull/TODO))
16
+ - Refresh Stellar classic trustline enrichment on keyring unlock and after balance sync for tracked classic assets in `assetsBalance` and `customAssets`
17
+ - `addCustomAsset` triggers async enrichment for Stellar classic assets; `removeCustomAsset` sets `extra.limit` to `'0'`
18
+ - Export `isStellarClassicTrustlineInactiveForDisplay` for client trustline UX
19
+
10
20
  ### Changed
11
21
 
12
- - Bump `@metamask/assets-controllers` from `^109.0.0` to `^109.2.0` ([#9110](https://github.com/MetaMask/core/pull/9110), [#9202](https://github.com/MetaMask/core/pull/9202))
22
+ - Bump `@metamask/assets-controllers` from `^109.0.0` to `^109.1.0` ([#9110](https://github.com/MetaMask/core/pull/9110))
13
23
  - Bump `@metamask/utils` from `^11.9.0` to `^11.11.0` ([#9074](https://github.com/MetaMask/core/pull/9074))
14
- - Bump `@metamask/transaction-controller` from `^67.1.0` to `^68.1.0` ([#9089](https://github.com/MetaMask/core/pull/9089), [#9177](https://github.com/MetaMask/core/pull/9177), [#9203](https://github.com/MetaMask/core/pull/9203))
24
+ - Bump `@metamask/transaction-controller` from `^67.1.0` to `^68.0.1` ([#9089](https://github.com/MetaMask/core/pull/9089), [#9177](https://github.com/MetaMask/core/pull/9177))
15
25
  - Bump `@metamask/keyring-controller` from `^27.0.0` to `^27.1.0` ([#9129](https://github.com/MetaMask/core/pull/9129))
16
26
 
17
27
  ### Fixed
@@ -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.\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 * Returns exchange rates in the format expected by the bridge controller\n * (conversionRates, currencyRates, marketData, currentCurrency) so that\n * when useAssetsControllerForRates is true the bridge can use a single\n * action instead of MultichainAssetsRatesController, TokenRatesController,\n * and CurrencyRateController.\n *\n * @returns Bridge-compatible exchange rate state derived from assetsPrice and selectedCurrency.\n */\nexport type AssetsControllerGetExchangeRatesForBridgeAction = {\n type: `AssetsController:getExchangeRatesForBridge`;\n handler: AssetsController['getExchangeRatesForBridge'];\n};\n\n/**\n * Returns state in the legacy format expected by transaction-pay-controller\n * (TokenBalancesController, AccountTrackerController, TokensController,\n * TokenRatesController, CurrencyRateController shapes) so that when\n * useAssetsController is true the transaction-pay-controller can use a\n * single action instead of five separate getState calls.\n *\n * @returns Legacy-compatible state for transaction-pay-controller.\n */\nexport type AssetsControllerGetStateForTransactionPayAction = {\n type: `AssetsController:getStateForTransactionPay`;\n handler: AssetsController['getStateForTransactionPay'];\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 * When `pendingMetadata` is provided (e.g. from the extension's pending-tokens\n * flow), the token metadata is persisted immediately into `assetsInfo` so the\n * UI can render it without waiting for the next pipeline fetch.\n *\n * @param accountId - The account ID to add the custom asset for.\n * @param assetId - The CAIP-19 asset ID to add.\n * @param pendingMetadata - Optional token metadata from the UI (pendingTokens format).\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 * Set the current currency.\n *\n * @param selectedCurrency - The ISO 4217 currency code to set.\n */\nexport type AssetsControllerSetSelectedCurrencyAction = {\n type: `AssetsController:setSelectedCurrency`;\n handler: AssetsController['setSelectedCurrency'];\n};\n\n/**\n * Union of all AssetsController action types.\n */\nexport type AssetsControllerMethodActions =\n | AssetsControllerGetAssetsAction\n | AssetsControllerGetAssetsBalanceAction\n | AssetsControllerGetAssetMetadataAction\n | AssetsControllerGetAssetsPriceAction\n | AssetsControllerGetExchangeRatesForBridgeAction\n | AssetsControllerGetStateForTransactionPayAction\n | AssetsControllerAddCustomAssetAction\n | AssetsControllerRemoveCustomAssetAction\n | AssetsControllerGetCustomAssetsAction\n | AssetsControllerHideAssetAction\n | AssetsControllerUnhideAssetAction\n | AssetsControllerSetSelectedCurrencyAction;\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.\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 * Returns exchange rates in the format expected by the bridge controller\n * (conversionRates, currencyRates, marketData, currentCurrency) so that\n * when useAssetsControllerForRates is true the bridge can use a single\n * action instead of MultichainAssetsRatesController, TokenRatesController,\n * and CurrencyRateController.\n *\n * @returns Bridge-compatible exchange rate state derived from assetsPrice and selectedCurrency.\n */\nexport type AssetsControllerGetExchangeRatesForBridgeAction = {\n type: `AssetsController:getExchangeRatesForBridge`;\n handler: AssetsController['getExchangeRatesForBridge'];\n};\n\n/**\n * Returns state in the legacy format expected by transaction-pay-controller\n * (TokenBalancesController, AccountTrackerController, TokensController,\n * TokenRatesController, CurrencyRateController shapes) so that when\n * useAssetsController is true the transaction-pay-controller can use a\n * single action instead of five separate getState calls.\n *\n * @returns Legacy-compatible state for transaction-pay-controller.\n */\nexport type AssetsControllerGetStateForTransactionPayAction = {\n type: `AssetsController:getStateForTransactionPay`;\n handler: AssetsController['getStateForTransactionPay'];\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 * When `pendingMetadata` is provided (e.g. from the extension's pending-tokens\n * flow), the token metadata is persisted immediately into `assetsInfo` so the\n * UI can render it without waiting for the next pipeline fetch.\n *\n * @param accountId - The account ID to add the custom asset for.\n * @param assetId - The CAIP-19 asset ID to add.\n * @param pendingMetadata - Optional token metadata from the UI (pendingTokens format).\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 * Fetches and merges snap account-asset enrichment for eligible assets.\n * Only Stellar classic `asset:` tokens on enrichment-enabled chains are processed.\n * No-ops when the keyring is locked or the snap request fails.\n *\n * @param accountId - Internal account UUID.\n * @param assetIds - CAIP-19 asset ids to enrich.\n */\nexport type AssetsControllerRefreshAccountAssetInfoAction = {\n type: `AssetsController:refreshAccountAssetInfo`;\n handler: AssetsController['refreshAccountAssetInfo'];\n};\n\n/**\n * Marks Stellar classic trustline enrichment as inactive for the given assets.\n * Sets `extra.limit` to `'0'` rather than deleting `extra`, so UI can distinguish\n * inactive trustlines from not-yet-enriched state.\n *\n * @param accountId - Internal account UUID.\n * @param assetIds - CAIP-19 asset ids to invalidate.\n */\nexport type AssetsControllerInvalidateAccountAssetExtrasAction = {\n type: `AssetsController:invalidateAccountAssetExtras`;\n handler: AssetsController['invalidateAccountAssetExtras'];\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 * Set the current currency.\n *\n * @param selectedCurrency - The ISO 4217 currency code to set.\n */\nexport type AssetsControllerSetSelectedCurrencyAction = {\n type: `AssetsController:setSelectedCurrency`;\n handler: AssetsController['setSelectedCurrency'];\n};\n\n/**\n * Union of all AssetsController action types.\n */\nexport type AssetsControllerMethodActions =\n | AssetsControllerGetAssetsAction\n | AssetsControllerGetAssetsBalanceAction\n | AssetsControllerGetAssetMetadataAction\n | AssetsControllerGetAssetsPriceAction\n | AssetsControllerGetExchangeRatesForBridgeAction\n | AssetsControllerGetStateForTransactionPayAction\n | AssetsControllerAddCustomAssetAction\n | AssetsControllerRemoveCustomAssetAction\n | AssetsControllerGetCustomAssetsAction\n | AssetsControllerRefreshAccountAssetInfoAction\n | AssetsControllerInvalidateAccountAssetExtrasAction\n | AssetsControllerHideAssetAction\n | AssetsControllerUnhideAssetAction\n | AssetsControllerSetSelectedCurrencyAction;\n"]}
@@ -82,6 +82,30 @@ export type AssetsControllerGetCustomAssetsAction = {
82
82
  type: `AssetsController:getCustomAssets`;
83
83
  handler: AssetsController['getCustomAssets'];
84
84
  };
85
+ /**
86
+ * Fetches and merges snap account-asset enrichment for eligible assets.
87
+ * Only Stellar classic `asset:` tokens on enrichment-enabled chains are processed.
88
+ * No-ops when the keyring is locked or the snap request fails.
89
+ *
90
+ * @param accountId - Internal account UUID.
91
+ * @param assetIds - CAIP-19 asset ids to enrich.
92
+ */
93
+ export type AssetsControllerRefreshAccountAssetInfoAction = {
94
+ type: `AssetsController:refreshAccountAssetInfo`;
95
+ handler: AssetsController['refreshAccountAssetInfo'];
96
+ };
97
+ /**
98
+ * Marks Stellar classic trustline enrichment as inactive for the given assets.
99
+ * Sets `extra.limit` to `'0'` rather than deleting `extra`, so UI can distinguish
100
+ * inactive trustlines from not-yet-enriched state.
101
+ *
102
+ * @param accountId - Internal account UUID.
103
+ * @param assetIds - CAIP-19 asset ids to invalidate.
104
+ */
105
+ export type AssetsControllerInvalidateAccountAssetExtrasAction = {
106
+ type: `AssetsController:invalidateAccountAssetExtras`;
107
+ handler: AssetsController['invalidateAccountAssetExtras'];
108
+ };
85
109
  /**
86
110
  * Hide an asset globally.
87
111
  * Hidden assets are excluded from the asset list returned by getAssets.
@@ -114,5 +138,5 @@ export type AssetsControllerSetSelectedCurrencyAction = {
114
138
  /**
115
139
  * Union of all AssetsController action types.
116
140
  */
117
- export type AssetsControllerMethodActions = AssetsControllerGetAssetsAction | AssetsControllerGetAssetsBalanceAction | AssetsControllerGetAssetMetadataAction | AssetsControllerGetAssetsPriceAction | AssetsControllerGetExchangeRatesForBridgeAction | AssetsControllerGetStateForTransactionPayAction | AssetsControllerAddCustomAssetAction | AssetsControllerRemoveCustomAssetAction | AssetsControllerGetCustomAssetsAction | AssetsControllerHideAssetAction | AssetsControllerUnhideAssetAction | AssetsControllerSetSelectedCurrencyAction;
141
+ export type AssetsControllerMethodActions = AssetsControllerGetAssetsAction | AssetsControllerGetAssetsBalanceAction | AssetsControllerGetAssetMetadataAction | AssetsControllerGetAssetsPriceAction | AssetsControllerGetExchangeRatesForBridgeAction | AssetsControllerGetStateForTransactionPayAction | AssetsControllerAddCustomAssetAction | AssetsControllerRemoveCustomAssetAction | AssetsControllerGetCustomAssetsAction | AssetsControllerRefreshAccountAssetInfoAction | AssetsControllerInvalidateAccountAssetExtrasAction | AssetsControllerHideAssetAction | AssetsControllerUnhideAssetAction | AssetsControllerSetSelectedCurrencyAction;
118
142
  //# 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":[],"mapp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qC,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;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACrC,+BAA+B,GAC/B,sCAAsC,GACtC,sCAAsC,GACtC,oCAAoC,GACpC,+CAA+C,GAC/C,+CAA+C,GAC/C,oCAAoC,GACpC,uCAAuC,GACvC,qCAAqC,GACrC,+BAA+B,GAC/B,iCAAiC,GACjC,yCAAyC,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,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A8B,CAAC,CAAC;CAC3D,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;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACrC,+BAA+B,GAC/B,sCAAsC,GACtC,sCAAsC,GACtC,oCAAoC,GACpC,+CAA+C,GAC/C,+CAA+C,GAC/C,oCAAoC,GACpC,uCAAuC,GACvC,qCAAqC,GACrC,6CAA6C,GAC7C,kDAAkD,GAClD,+BAA+B,GAC/B,iCAAiC,GACjC,yCAAyC,CAAC"}
@@ -82,6 +82,30 @@ export type AssetsControllerGetCustomAssetsAction = {
82
82
  type: `AssetsController:getCustomAssets`;
83
83
  handler: AssetsController['getCustomAssets'];
84
84
  };
85
+ /**
86
+ * Fetches and merges snap account-asset enrichment for eligible assets.
87
+ * Only Stellar classic `asset:` tokens on enrichment-enabled chains are processed.
88
+ * No-ops when the keyring is locked or the snap request fails.
89
+ *
90
+ * @param accountId - Internal account UUID.
91
+ * @param assetIds - CAIP-19 asset ids to enrich.
92
+ */
93
+ export type AssetsControllerRefreshAccountAssetInfoAction = {
94
+ type: `AssetsController:refreshAccountAssetInfo`;
95
+ handler: AssetsController['refreshAccountAssetInfo'];
96
+ };
97
+ /**
98
+ * Marks Stellar classic trustline enrichment as inactive for the given assets.
99
+ * Sets `extra.limit` to `'0'` rather than deleting `extra`, so UI can distinguish
100
+ * inactive trustlines from not-yet-enriched state.
101
+ *
102
+ * @param accountId - Internal account UUID.
103
+ * @param assetIds - CAIP-19 asset ids to invalidate.
104
+ */
105
+ export type AssetsControllerInvalidateAccountAssetExtrasAction = {
106
+ type: `AssetsController:invalidateAccountAssetExtras`;
107
+ handler: AssetsController['invalidateAccountAssetExtras'];
108
+ };
85
109
  /**
86
110
  * Hide an asset globally.
87
111
  * Hidden assets are excluded from the asset list returned by getAssets.
@@ -114,5 +138,5 @@ export type AssetsControllerSetSelectedCurrencyAction = {
114
138
  /**
115
139
  * Union of all AssetsController action types.
116
140
  */
117
- export type AssetsControllerMethodActions = AssetsControllerGetAssetsAction | AssetsControllerGetAssetsBalanceAction | AssetsControllerGetAssetMetadataAction | AssetsControllerGetAssetsPriceAction | AssetsControllerGetExchangeRatesForBridgeAction | AssetsControllerGetStateForTransactionPayAction | AssetsControllerAddCustomAssetAction | AssetsControllerRemoveCustomAssetAction | AssetsControllerGetCustomAssetsAction | AssetsControllerHideAssetAction | AssetsControllerUnhideAssetAction | AssetsControllerSetSelectedCurrencyAction;
141
+ export type AssetsControllerMethodActions = AssetsControllerGetAssetsAction | AssetsControllerGetAssetsBalanceAction | AssetsControllerGetAssetMetadataAction | AssetsControllerGetAssetsPriceAction | AssetsControllerGetExchangeRatesForBridgeAction | AssetsControllerGetStateForTransactionPayAction | AssetsControllerAddCustomAssetAction | AssetsControllerRemoveCustomAssetAction | AssetsControllerGetCustomAssetsAction | AssetsControllerRefreshAccountAssetInfoAction | AssetsControllerInvalidateAccountAssetExtrasAction | AssetsControllerHideAssetAction | AssetsControllerUnhideAssetAction | AssetsControllerSetSelectedCurrencyAction;
118
142
  //# 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,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AE,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;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACrC,+BAA+B,GAC/B,sCAAsC,GACtC,sCAAsC,GACtC,oCAAoC,GACpC,+CAA+C,GAC/C,+CAA+C,GAC/C,oCAAoC,GACpC,uCAAuC,GACvC,qCAAqC,GACrC,+BAA+B,GAC/B,iCAAiC,GACjC,yCAAyC,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,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M,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;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GACrC,+BAA+B,GAC/B,sCAAsC,GACtC,sCAAsC,GACtC,oCAAoC,GACpC,+CAA+C,GAC/C,+CAA+C,GAC/C,oCAAoC,GACpC,uCAAuC,GACvC,qCAAqC,GACrC,6CAA6C,GAC7C,kDAAkD,GAClD,+BAA+B,GAC/B,iCAAiC,GACjC,yCAAyC,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.\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 * Returns exchange rates in the format expected by the bridge controller\n * (conversionRates, currencyRates, marketData, currentCurrency) so that\n * when useAssetsControllerForRates is true the bridge can use a single\n * action instead of MultichainAssetsRatesController, TokenRatesController,\n * and CurrencyRateController.\n *\n * @returns Bridge-compatible exchange rate state derived from assetsPrice and selectedCurrency.\n */\nexport type AssetsControllerGetExchangeRatesForBridgeAction = {\n type: `AssetsController:getExchangeRatesForBridge`;\n handler: AssetsController['getExchangeRatesForBridge'];\n};\n\n/**\n * Returns state in the legacy format expected by transaction-pay-controller\n * (TokenBalancesController, AccountTrackerController, TokensController,\n * TokenRatesController, CurrencyRateController shapes) so that when\n * useAssetsController is true the transaction-pay-controller can use a\n * single action instead of five separate getState calls.\n *\n * @returns Legacy-compatible state for transaction-pay-controller.\n */\nexport type AssetsControllerGetStateForTransactionPayAction = {\n type: `AssetsController:getStateForTransactionPay`;\n handler: AssetsController['getStateForTransactionPay'];\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 * When `pendingMetadata` is provided (e.g. from the extension's pending-tokens\n * flow), the token metadata is persisted immediately into `assetsInfo` so the\n * UI can render it without waiting for the next pipeline fetch.\n *\n * @param accountId - The account ID to add the custom asset for.\n * @param assetId - The CAIP-19 asset ID to add.\n * @param pendingMetadata - Optional token metadata from the UI (pendingTokens format).\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 * Set the current currency.\n *\n * @param selectedCurrency - The ISO 4217 currency code to set.\n */\nexport type AssetsControllerSetSelectedCurrencyAction = {\n type: `AssetsController:setSelectedCurrency`;\n handler: AssetsController['setSelectedCurrency'];\n};\n\n/**\n * Union of all AssetsController action types.\n */\nexport type AssetsControllerMethodActions =\n | AssetsControllerGetAssetsAction\n | AssetsControllerGetAssetsBalanceAction\n | AssetsControllerGetAssetMetadataAction\n | AssetsControllerGetAssetsPriceAction\n | AssetsControllerGetExchangeRatesForBridgeAction\n | AssetsControllerGetStateForTransactionPayAction\n | AssetsControllerAddCustomAssetAction\n | AssetsControllerRemoveCustomAssetAction\n | AssetsControllerGetCustomAssetsAction\n | AssetsControllerHideAssetAction\n | AssetsControllerUnhideAssetAction\n | AssetsControllerSetSelectedCurrencyAction;\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.\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 * Returns exchange rates in the format expected by the bridge controller\n * (conversionRates, currencyRates, marketData, currentCurrency) so that\n * when useAssetsControllerForRates is true the bridge can use a single\n * action instead of MultichainAssetsRatesController, TokenRatesController,\n * and CurrencyRateController.\n *\n * @returns Bridge-compatible exchange rate state derived from assetsPrice and selectedCurrency.\n */\nexport type AssetsControllerGetExchangeRatesForBridgeAction = {\n type: `AssetsController:getExchangeRatesForBridge`;\n handler: AssetsController['getExchangeRatesForBridge'];\n};\n\n/**\n * Returns state in the legacy format expected by transaction-pay-controller\n * (TokenBalancesController, AccountTrackerController, TokensController,\n * TokenRatesController, CurrencyRateController shapes) so that when\n * useAssetsController is true the transaction-pay-controller can use a\n * single action instead of five separate getState calls.\n *\n * @returns Legacy-compatible state for transaction-pay-controller.\n */\nexport type AssetsControllerGetStateForTransactionPayAction = {\n type: `AssetsController:getStateForTransactionPay`;\n handler: AssetsController['getStateForTransactionPay'];\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 * When `pendingMetadata` is provided (e.g. from the extension's pending-tokens\n * flow), the token metadata is persisted immediately into `assetsInfo` so the\n * UI can render it without waiting for the next pipeline fetch.\n *\n * @param accountId - The account ID to add the custom asset for.\n * @param assetId - The CAIP-19 asset ID to add.\n * @param pendingMetadata - Optional token metadata from the UI (pendingTokens format).\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 * Fetches and merges snap account-asset enrichment for eligible assets.\n * Only Stellar classic `asset:` tokens on enrichment-enabled chains are processed.\n * No-ops when the keyring is locked or the snap request fails.\n *\n * @param accountId - Internal account UUID.\n * @param assetIds - CAIP-19 asset ids to enrich.\n */\nexport type AssetsControllerRefreshAccountAssetInfoAction = {\n type: `AssetsController:refreshAccountAssetInfo`;\n handler: AssetsController['refreshAccountAssetInfo'];\n};\n\n/**\n * Marks Stellar classic trustline enrichment as inactive for the given assets.\n * Sets `extra.limit` to `'0'` rather than deleting `extra`, so UI can distinguish\n * inactive trustlines from not-yet-enriched state.\n *\n * @param accountId - Internal account UUID.\n * @param assetIds - CAIP-19 asset ids to invalidate.\n */\nexport type AssetsControllerInvalidateAccountAssetExtrasAction = {\n type: `AssetsController:invalidateAccountAssetExtras`;\n handler: AssetsController['invalidateAccountAssetExtras'];\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 * Set the current currency.\n *\n * @param selectedCurrency - The ISO 4217 currency code to set.\n */\nexport type AssetsControllerSetSelectedCurrencyAction = {\n type: `AssetsController:setSelectedCurrency`;\n handler: AssetsController['setSelectedCurrency'];\n};\n\n/**\n * Union of all AssetsController action types.\n */\nexport type AssetsControllerMethodActions =\n | AssetsControllerGetAssetsAction\n | AssetsControllerGetAssetsBalanceAction\n | AssetsControllerGetAssetMetadataAction\n | AssetsControllerGetAssetsPriceAction\n | AssetsControllerGetExchangeRatesForBridgeAction\n | AssetsControllerGetStateForTransactionPayAction\n | AssetsControllerAddCustomAssetAction\n | AssetsControllerRemoveCustomAssetAction\n | AssetsControllerGetCustomAssetsAction\n | AssetsControllerRefreshAccountAssetInfoAction\n | AssetsControllerInvalidateAccountAssetExtrasAction\n | AssetsControllerHideAssetAction\n | AssetsControllerUnhideAssetAction\n | AssetsControllerSetSelectedCurrencyAction;\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_trace, _AssetsController_captureException, _AssetsController_firstInitFetchReported, _AssetsController_stateSizeReported, _AssetsController_emitTrace, _AssetsController_emitStateSizeTrace, _AssetsController_uiOpen, _AssetsController_keyringUnlocked, _AssetsController_controllerMutex, _AssetsController_activeSubscriptions, _AssetsController_enabledChains, _AssetsController_lastKnownAccountIds, _AssetsController_getSelectedAccounts, _AssetsController_backendWebsocketDataSource, _AssetsController_accountsApiDataSource, _AssetsController_snapDataSource, _AssetsController_rpcDataSource, _AssetsController_stakedBalanceDataSource, _AssetsController_allBalanceDataSources_get, _AssetsController_priceDataSource, _AssetsController_detectionMiddleware, _AssetsController_customAssetGraduationMiddleware, _AssetsController_rpcFallbackMiddleware, _AssetsController_tokenDataSource, _AssetsController_unsubscribeBasicFunctionality, _AssetsController_queryApiClient, _AssetsController_onActiveChainsUpdated, _AssetsController_initializeNativeAssetsMap, _AssetsController_initializeState, _AssetsController_extractEnabledChains, _AssetsController_normalizeChainReference, _AssetsController_subscribeToEvents, _AssetsController_onUnapprovedTransactionAdded, _AssetsController_updateActive, _AssetsController_handleAccountTreeStateChange, _AssetsController_registerActionHandlers, _AssetsController_handleActiveChainsUpdate, _AssetsController_executeMiddlewares, _AssetsController_getNativeAssetMap, _AssetsController_isNativeAsset, _AssetsController_getAssetType, _AssetsController_resolveNativeAssetIds, _AssetsController_getNativeAssetIdsForEnabledChains, _AssetsController_getNativeAssetIdsForAccount, _AssetsController_ensureNativeBalancesDefaultZero, _AssetsController_ensureDefaultTrackedAssetsSeeded, _AssetsController_updateState, _AssetsController_getAssetsFromState, _AssetsController_shouldHideNativeToken, _AssetsController_tokenStandardToAssetType, _AssetsController_start, _AssetsController_stop, _AssetsController_subscribeAssets, _AssetsController_subscribeAssetsBalance, _AssetsController_subscribeRpcCustomAssetsSupplement, _AssetsController_unsubscribeBySubscriptionKey, _AssetsController_subscribeStakedBalance, _AssetsController_buildChainToAccountsMap, _AssetsController_subscribeDataSource, _AssetsController_unsubscribeDataSource, _AssetsController_buildDataRequest, _AssetsController_getEnabledChainsForAccount, _AssetsController_handleAccountGroupChanged, _AssetsController_handleEnabledNetworksChanged, _AssetsController_handleNetworkAdded, _AssetsController_refreshAssetsAfterNetworkChange;
16
+ var _AssetsController_instances, _AssetsController_isEnabled, _AssetsController_isBasicFunctionality, _AssetsController_defaultUpdateInterval, _AssetsController_trace, _AssetsController_captureException, _AssetsController_firstInitFetchReported, _AssetsController_stateSizeReported, _AssetsController_emitTrace, _AssetsController_emitStateSizeTrace, _AssetsController_uiOpen, _AssetsController_keyringUnlocked, _AssetsController_controllerMutex, _AssetsController_activeSubscriptions, _AssetsController_enabledChains, _AssetsController_lastKnownAccountIds, _AssetsController_getSelectedAccounts, _AssetsController_backendWebsocketDataSource, _AssetsController_accountsApiDataSource, _AssetsController_snapDataSource, _AssetsController_rpcDataSource, _AssetsController_stakedBalanceDataSource, _AssetsController_allBalanceDataSources_get, _AssetsController_priceDataSource, _AssetsController_detectionMiddleware, _AssetsController_customAssetGraduationMiddleware, _AssetsController_rpcFallbackMiddleware, _AssetsController_tokenDataSource, _AssetsController_accountAssetEnrichmentService, _AssetsController_unsubscribeBasicFunctionality, _AssetsController_queryApiClient, _AssetsController_onActiveChainsUpdated, _AssetsController_initializeNativeAssetsMap, _AssetsController_initializeState, _AssetsController_extractEnabledChains, _AssetsController_normalizeChainReference, _AssetsController_subscribeToEvents, _AssetsController_onUnapprovedTransactionAdded, _AssetsController_updateActive, _AssetsController_handleAccountTreeStateChange, _AssetsController_registerActionHandlers, _AssetsController_handleActiveChainsUpdate, _AssetsController_executeMiddlewares, _AssetsController_applyAccountAssetExtras, _AssetsController_scheduleAccountAssetInfoRefresh, _AssetsController_scheduleStellarClassicAssetEnrichmentRefresh, _AssetsController_getNativeAssetMap, _AssetsController_isNativeAsset, _AssetsController_getAssetType, _AssetsController_resolveNativeAssetIds, _AssetsController_getNativeAssetIdsForEnabledChains, _AssetsController_getNativeAssetIdsForAccount, _AssetsController_ensureNativeBalancesDefaultZero, _AssetsController_ensureDefaultTrackedAssetsSeeded, _AssetsController_updateState, _AssetsController_getAssetsFromState, _AssetsController_shouldHideNativeToken, _AssetsController_tokenStandardToAssetType, _AssetsController_start, _AssetsController_stop, _AssetsController_subscribeAssets, _AssetsController_subscribeAssetsBalance, _AssetsController_subscribeRpcCustomAssetsSupplement, _AssetsController_unsubscribeBySubscriptionKey, _AssetsController_subscribeStakedBalance, _AssetsController_buildChainToAccountsMap, _AssetsController_subscribeDataSource, _AssetsController_unsubscribeDataSource, _AssetsController_buildDataRequest, _AssetsController_getEnabledChainsForAccount, _AssetsController_handleAccountGroupChanged, _AssetsController_handleEnabledNetworksChanged, _AssetsController_handleNetworkAdded, _AssetsController_refreshAssetsAfterNetworkChange;
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");
@@ -37,6 +37,8 @@ const CustomAssetGraduationMiddleware_1 = require("./middlewares/CustomAssetGrad
37
37
  const DetectionMiddleware_1 = require("./middlewares/DetectionMiddleware.cjs");
38
38
  const ParallelMiddleware_1 = require("./middlewares/ParallelMiddleware.cjs");
39
39
  const RpcFallbackMiddleware_1 = require("./middlewares/RpcFallbackMiddleware.cjs");
40
+ const AccountAssetEnrichmentService_1 = require("./services/AccountAssetEnrichmentService.cjs");
41
+ const account_asset_enrichment_1 = require("./utils/account-asset-enrichment.cjs");
40
42
  const utils_2 = require("./utils/index.cjs");
41
43
  const constants_1 = require("./utils/constants.cjs");
42
44
  const customAssetsRpcSupplement_1 = require("./utils/customAssetsRpcSupplement.cjs");
@@ -59,6 +61,8 @@ const MESSENGER_EXPOSED_METHODS = [
59
61
  'hideAsset',
60
62
  'unhideAsset',
61
63
  'setSelectedCurrency',
64
+ 'refreshAccountAssetInfo',
65
+ 'invalidateAccountAssetExtras',
62
66
  ];
63
67
  /** Default polling interval hint for data sources (30 seconds) */
64
68
  const DEFAULT_POLLING_INTERVAL_MS = 30000;
@@ -280,6 +284,7 @@ class AssetsController extends base_controller_1.BaseController {
280
284
  _AssetsController_customAssetGraduationMiddleware.set(this, void 0);
281
285
  _AssetsController_rpcFallbackMiddleware.set(this, void 0);
282
286
  _AssetsController_tokenDataSource.set(this, void 0);
287
+ _AssetsController_accountAssetEnrichmentService.set(this, void 0);
283
288
  _AssetsController_unsubscribeBasicFunctionality.set(this, null);
284
289
  _AssetsController_queryApiClient.set(this, void 0);
285
290
  _AssetsController_onActiveChainsUpdated.set(this, void 0);
@@ -317,6 +322,10 @@ class AssetsController extends base_controller_1.BaseController {
317
322
  messenger: this.messenger,
318
323
  onActiveChainsUpdated: __classPrivateFieldGet(this, _AssetsController_onActiveChainsUpdated, "f"),
319
324
  }), "f");
325
+ __classPrivateFieldSet(this, _AssetsController_accountAssetEnrichmentService, new AccountAssetEnrichmentService_1.AccountAssetEnrichmentService({
326
+ handleSnapRequest: async (params) => this.messenger.call('SnapController:handleRequest', params),
327
+ getSnapIdForChain: (chainId) => __classPrivateFieldGet(this, _AssetsController_snapDataSource, "f").getSnapIdForChain(chainId),
328
+ }), "f");
320
329
  __classPrivateFieldSet(this, _AssetsController_rpcDataSource, new RpcDataSource_1.RpcDataSource({
321
330
  messenger: this.messenger,
322
331
  onActiveChainsUpdated: __classPrivateFieldGet(this, _AssetsController_onActiveChainsUpdated, "f"),
@@ -655,6 +664,9 @@ class AssetsController extends base_controller_1.BaseController {
655
664
  // Re-evaluate subscriptions so the supplemental RPC poll picks up the
656
665
  // new customAsset on chains another data source already owns.
657
666
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeAssets).call(this);
667
+ if ((0, account_asset_enrichment_1.isStellarClassicAssetId)(normalizedAssetId)) {
668
+ __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_scheduleAccountAssetInfoRefresh).call(this, accountId, [normalizedAssetId]);
669
+ }
658
670
  }
659
671
  /**
660
672
  * Remove a custom asset from an account.
@@ -674,6 +686,7 @@ class AssetsController extends base_controller_1.BaseController {
674
686
  }
675
687
  }
676
688
  });
689
+ this.invalidateAccountAssetExtras(accountId, [normalizedAssetId]);
677
690
  // Re-evaluate subscriptions so the supplemental RPC poll for that chain
678
691
  // is torn down when no more customAssets remain there.
679
692
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeAssets).call(this);
@@ -688,6 +701,78 @@ class AssetsController extends base_controller_1.BaseController {
688
701
  return this.state.customAssets[accountId] ?? [];
689
702
  }
690
703
  // ============================================================================
704
+ // ACCOUNT-ASSET ENRICHMENT (Stellar classic trustline)
705
+ // ============================================================================
706
+ /**
707
+ * Fetches and merges snap account-asset enrichment for eligible assets.
708
+ * Only Stellar classic `asset:` tokens on enrichment-enabled chains are processed.
709
+ * No-ops when the keyring is locked or the snap request fails.
710
+ *
711
+ * @param accountId - Internal account UUID.
712
+ * @param assetIds - CAIP-19 asset ids to enrich.
713
+ */
714
+ async refreshAccountAssetInfo(accountId, assetIds) {
715
+ if (!__classPrivateFieldGet(this, _AssetsController_keyringUnlocked, "f") || assetIds.length === 0) {
716
+ return;
717
+ }
718
+ const assetsByChain = new Map();
719
+ for (const assetId of assetIds) {
720
+ const normalizedAssetId = (0, utils_2.normalizeAssetId)(assetId);
721
+ let chainId;
722
+ try {
723
+ chainId = extractChainId(normalizedAssetId);
724
+ }
725
+ catch {
726
+ continue;
727
+ }
728
+ const eligible = (0, account_asset_enrichment_1.filterStellarClassicAssetsForEnrichment)([normalizedAssetId], chainId);
729
+ if (eligible.length === 0) {
730
+ continue;
731
+ }
732
+ const chainAssets = assetsByChain.get(chainId) ?? [];
733
+ chainAssets.push(normalizedAssetId);
734
+ assetsByChain.set(chainId, chainAssets);
735
+ }
736
+ for (const [chainId, chainAssetIds] of assetsByChain) {
737
+ await __classPrivateFieldGet(this, _AssetsController_accountAssetEnrichmentService, "f").fetchExtras({
738
+ accountId,
739
+ chainId,
740
+ assetIds: chainAssetIds,
741
+ onBatchExtras: (batchExtras) => {
742
+ __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_applyAccountAssetExtras).call(this, accountId, batchExtras);
743
+ },
744
+ });
745
+ }
746
+ }
747
+ /**
748
+ * Marks Stellar classic trustline enrichment as inactive for the given assets.
749
+ * Sets `extra.limit` to `'0'` rather than deleting `extra`, so UI can distinguish
750
+ * inactive trustlines from not-yet-enriched state.
751
+ *
752
+ * @param accountId - Internal account UUID.
753
+ * @param assetIds - CAIP-19 asset ids to invalidate.
754
+ */
755
+ invalidateAccountAssetExtras(accountId, assetIds) {
756
+ if (assetIds.length === 0) {
757
+ return;
758
+ }
759
+ this.update((state) => {
760
+ const balances = state.assetsBalance;
761
+ balances[accountId] ?? (balances[accountId] = {});
762
+ for (const assetId of assetIds) {
763
+ const normalizedAssetId = (0, utils_2.normalizeAssetId)(assetId);
764
+ if (!(0, account_asset_enrichment_1.isStellarClassicAssetId)(normalizedAssetId)) {
765
+ continue;
766
+ }
767
+ const existing = balances[accountId][normalizedAssetId];
768
+ balances[accountId][normalizedAssetId] = {
769
+ amount: existing?.amount ?? '0',
770
+ extra: (0, account_asset_enrichment_1.createInvalidatedStellarClassicExtra)(existing?.extra),
771
+ };
772
+ }
773
+ });
774
+ }
775
+ // ============================================================================
691
776
  // HIDDEN ASSETS MANAGEMENT
692
777
  // ============================================================================
693
778
  /**
@@ -916,7 +1001,7 @@ class AssetsController extends base_controller_1.BaseController {
916
1001
  }
917
1002
  }
918
1003
  exports.AssetsController = AssetsController;
919
- _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctionality = new WeakMap(), _AssetsController_defaultUpdateInterval = new WeakMap(), _AssetsController_trace = new WeakMap(), _AssetsController_captureException = new WeakMap(), _AssetsController_firstInitFetchReported = new WeakMap(), _AssetsController_stateSizeReported = new WeakMap(), _AssetsController_uiOpen = new WeakMap(), _AssetsController_keyringUnlocked = new WeakMap(), _AssetsController_controllerMutex = new WeakMap(), _AssetsController_activeSubscriptions = new WeakMap(), _AssetsController_enabledChains = new WeakMap(), _AssetsController_lastKnownAccountIds = 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_customAssetGraduationMiddleware = new WeakMap(), _AssetsController_rpcFallbackMiddleware = new WeakMap(), _AssetsController_tokenDataSource = new WeakMap(), _AssetsController_unsubscribeBasicFunctionality = new WeakMap(), _AssetsController_queryApiClient = new WeakMap(), _AssetsController_onActiveChainsUpdated = new WeakMap(), _AssetsController_instances = new WeakSet(), _AssetsController_emitTrace = function _AssetsController_emitTrace(name, data, tags = {
1004
+ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctionality = new WeakMap(), _AssetsController_defaultUpdateInterval = new WeakMap(), _AssetsController_trace = new WeakMap(), _AssetsController_captureException = new WeakMap(), _AssetsController_firstInitFetchReported = new WeakMap(), _AssetsController_stateSizeReported = new WeakMap(), _AssetsController_uiOpen = new WeakMap(), _AssetsController_keyringUnlocked = new WeakMap(), _AssetsController_controllerMutex = new WeakMap(), _AssetsController_activeSubscriptions = new WeakMap(), _AssetsController_enabledChains = new WeakMap(), _AssetsController_lastKnownAccountIds = 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_customAssetGraduationMiddleware = new WeakMap(), _AssetsController_rpcFallbackMiddleware = new WeakMap(), _AssetsController_tokenDataSource = new WeakMap(), _AssetsController_accountAssetEnrichmentService = new WeakMap(), _AssetsController_unsubscribeBasicFunctionality = new WeakMap(), _AssetsController_queryApiClient = new WeakMap(), _AssetsController_onActiveChainsUpdated = new WeakMap(), _AssetsController_instances = new WeakSet(), _AssetsController_emitTrace = function _AssetsController_emitTrace(name, data, tags = {
920
1005
  controller: 'AssetsController',
921
1006
  }) {
922
1007
  if (!__classPrivateFieldGet(this, _AssetsController_trace, "f")) {
@@ -1070,6 +1155,7 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
1070
1155
  this.messenger.subscribe('KeyringController:unlock', () => {
1071
1156
  __classPrivateFieldSet(this, _AssetsController_keyringUnlocked, true, "f");
1072
1157
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
1158
+ __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_scheduleStellarClassicAssetEnrichmentRefresh).call(this);
1073
1159
  });
1074
1160
  this.messenger.subscribe('KeyringController:lock', () => {
1075
1161
  __classPrivateFieldSet(this, _AssetsController_keyringUnlocked, false, "f");
@@ -1080,6 +1166,16 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
1080
1166
  this.messenger.subscribe('TransactionController:unapprovedTransactionAdded', (transactionMeta) => {
1081
1167
  __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_onUnapprovedTransactionAdded).call(this, transactionMeta);
1082
1168
  });
1169
+ // Subscribe to account balances updated - Stellar classic asset balance updates
1170
+ // Ensures that Stellar classic asset balance updates are reflected in the assets controller
1171
+ this.messenger.subscribe('AccountsController:accountBalancesUpdated', ({ balances }) => {
1172
+ for (const [accountId, assets] of Object.entries(balances)) {
1173
+ const stellarClassicAssets = Object.keys(assets).filter((assetId) => (0, account_asset_enrichment_1.isStellarClassicAssetId)(assetId));
1174
+ if (stellarClassicAssets.length > 0) {
1175
+ __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_scheduleAccountAssetInfoRefresh).call(this, accountId, stellarClassicAssets);
1176
+ }
1177
+ }
1178
+ });
1083
1179
  }, _AssetsController_onUnapprovedTransactionAdded = function _AssetsController_onUnapprovedTransactionAdded(transactionMeta) {
1084
1180
  const hexChainId = transactionMeta.chainId;
1085
1181
  if (!hexChainId) {
@@ -1265,6 +1361,45 @@ async function _AssetsController_executeMiddlewares(sources, request, initialRes
1265
1361
  });
1266
1362
  }
1267
1363
  return { response: result.response, durationByDataSource };
1364
+ }, _AssetsController_applyAccountAssetExtras = function _AssetsController_applyAccountAssetExtras(accountId, extras) {
1365
+ this.update((state) => {
1366
+ const balances = state.assetsBalance;
1367
+ balances[accountId] ?? (balances[accountId] = {});
1368
+ for (const [assetId, extra] of Object.entries(extras)) {
1369
+ const normalizedAssetId = (0, utils_2.normalizeAssetId)(assetId);
1370
+ const existing = balances[accountId][normalizedAssetId] ?? {
1371
+ amount: '0',
1372
+ };
1373
+ balances[accountId][normalizedAssetId] = {
1374
+ ...existing,
1375
+ extra,
1376
+ };
1377
+ }
1378
+ });
1379
+ }, _AssetsController_scheduleAccountAssetInfoRefresh = function _AssetsController_scheduleAccountAssetInfoRefresh(accountId, assetIds) {
1380
+ this.refreshAccountAssetInfo(accountId, assetIds).catch((error) => {
1381
+ log('Failed to refresh account asset info', {
1382
+ accountId,
1383
+ assetIds,
1384
+ error,
1385
+ });
1386
+ });
1387
+ }, _AssetsController_scheduleStellarClassicAssetEnrichmentRefresh = function _AssetsController_scheduleStellarClassicAssetEnrichmentRefresh() {
1388
+ const accountIds = new Set([
1389
+ ...Object.keys(this.state.customAssets),
1390
+ ...Object.keys(this.state.assetsBalance),
1391
+ ]);
1392
+ for (const accountId of accountIds) {
1393
+ const fromCustom = this.state.customAssets[accountId] ?? [];
1394
+ const fromBalances = Object.keys(this.state.assetsBalance[accountId] ?? {});
1395
+ const stellarClassicAssetIds = [
1396
+ ...new Set([...fromCustom, ...fromBalances]),
1397
+ ].filter((assetId) => (0, account_asset_enrichment_1.isStellarClassicAssetId)(assetId));
1398
+ if (stellarClassicAssetIds.length === 0) {
1399
+ continue;
1400
+ }
1401
+ __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_scheduleAccountAssetInfoRefresh).call(this, accountId, stellarClassicAssetIds);
1402
+ }
1268
1403
  }, _AssetsController_getNativeAssetMap = function _AssetsController_getNativeAssetMap() {
1269
1404
  return (__classPrivateFieldGet(this, _AssetsController_queryApiClient, "f").getCachedData(NATIVE_ASSETS_QUERY_KEY) ?? {});
1270
1405
  }, _AssetsController_isNativeAsset = function _AssetsController_isNativeAsset(assetId) {
@@ -1445,31 +1580,9 @@ async function _AssetsController_executeMiddlewares(sources, request, initialRes
1445
1580
  // previous state so unsupported chains (e.g. Ink on AccountsAPI)
1446
1581
  // are never inadvertently reset to zero.
1447
1582
  // Merge: response overlays previous balances.
1448
- const effective = mode === 'merge'
1449
- ? { ...previousBalances, ...accountBalances }
1450
- : (() => {
1451
- // Determine which chain namespaces this response covers.
1452
- const coveredChains = new Set(Object.keys(accountBalances).map((assetId) => assetId.split('/')[0]));
1453
- // Start from previous balances, dropping only entries for
1454
- // chains this response is authoritative over.
1455
- const next = {};
1456
- for (const [assetId, balance] of Object.entries(previousBalances)) {
1457
- if (!coveredChains.has(assetId.split('/')[0])) {
1458
- next[assetId] = balance;
1459
- }
1460
- }
1461
- // Apply the response (authoritative for covered chains).
1462
- Object.assign(next, accountBalances);
1463
- // Preserve custom assets that the response omitted.
1464
- for (const customId of customAssetIds) {
1465
- if (!(customId in next)) {
1466
- const prev = previousBalances[customId];
1467
- next[customId] =
1468
- prev ?? { amount: '0' };
1469
- }
1470
- }
1471
- return next;
1472
- })();
1583
+ // Per-row merge preserves account-asset enrichment (e.g. Stellar
1584
+ // trustline extra) when balance sources send amount-only rows.
1585
+ const effective = (0, account_asset_enrichment_1.buildEffectiveAccountBalances)(previousBalances, accountBalances, mode, customAssetIds);
1473
1586
  // Ensure native tokens have an entry (0 if missing) for chains this account supports
1474
1587
  const account = __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_getSelectedAccounts).call(this).find((a) => a.id === accountId);
1475
1588
  const nativeAssetIdsForAccount = account
@@ -1675,7 +1788,12 @@ async function _AssetsController_executeMiddlewares(sources, request, initialRes
1675
1788
  this.getAssets(accounts, {
1676
1789
  chainIds,
1677
1790
  forceUpdate: true,
1678
- }).catch((error) => {
1791
+ })
1792
+ .then(() => {
1793
+ __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_scheduleStellarClassicAssetEnrichmentRefresh).call(this);
1794
+ return undefined;
1795
+ })
1796
+ .catch((error) => {
1679
1797
  log('Failed to fetch assets', error);
1680
1798
  });
1681
1799
  }, _AssetsController_stop = function _AssetsController_stop() {