@metamask-previews/assets-controller 14.0.2-preview-4f4c98e → 14.0.2-preview-eb263b0ee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -5
- package/dist/AssetsController-method-action-types.cjs +7 -0
- package/dist/AssetsController-method-action-types.cjs.map +1 -0
- package/dist/{AssetsController-method-action-types.d.ts → AssetsController-method-action-types.d.cts} +2 -2
- package/dist/AssetsController-method-action-types.d.cts.map +1 -0
- package/dist/AssetsController-method-action-types.d.mts +181 -0
- package/dist/AssetsController-method-action-types.d.mts.map +1 -0
- package/dist/{AssetsController-method-action-types.js → AssetsController-method-action-types.mjs} +1 -1
- package/dist/AssetsController-method-action-types.mjs.map +1 -0
- package/dist/AssetsController.cjs +2559 -0
- package/dist/AssetsController.cjs.map +1 -0
- package/dist/{AssetsController.d.ts → AssetsController.d.cts} +30 -30
- package/dist/AssetsController.d.cts.map +1 -0
- package/dist/AssetsController.d.mts +395 -0
- package/dist/AssetsController.d.mts.map +1 -0
- package/dist/{AssetsController.js → AssetsController.mjs} +29 -28
- package/dist/AssetsController.mjs.map +1 -0
- package/dist/data-sources/AbstractDataSource.cjs +111 -0
- package/dist/data-sources/AbstractDataSource.cjs.map +1 -0
- package/dist/data-sources/{AbstractDataSource.d.ts → AbstractDataSource.d.cts} +2 -2
- package/dist/data-sources/AbstractDataSource.d.cts.map +1 -0
- package/dist/data-sources/AbstractDataSource.d.mts +113 -0
- package/dist/data-sources/AbstractDataSource.d.mts.map +1 -0
- package/dist/data-sources/{AbstractDataSource.js → AbstractDataSource.mjs} +1 -1
- package/dist/data-sources/AbstractDataSource.mjs.map +1 -0
- package/dist/data-sources/AccountActivityDataSource.cjs +267 -0
- package/dist/data-sources/AccountActivityDataSource.cjs.map +1 -0
- package/dist/data-sources/{AccountActivityDataSource.d.ts → AccountActivityDataSource.d.cts} +6 -6
- package/dist/data-sources/AccountActivityDataSource.d.cts.map +1 -0
- package/dist/data-sources/AccountActivityDataSource.d.mts +80 -0
- package/dist/data-sources/AccountActivityDataSource.d.mts.map +1 -0
- package/dist/data-sources/{AccountActivityDataSource.js → AccountActivityDataSource.mjs} +11 -11
- package/dist/data-sources/AccountActivityDataSource.mjs.map +1 -0
- package/dist/data-sources/AccountsApiDataSource.cjs +586 -0
- package/dist/data-sources/AccountsApiDataSource.cjs.map +1 -0
- package/dist/data-sources/{AccountsApiDataSource.d.ts → AccountsApiDataSource.d.cts} +7 -7
- package/dist/data-sources/AccountsApiDataSource.d.cts.map +1 -0
- package/dist/data-sources/AccountsApiDataSource.d.mts +82 -0
- package/dist/data-sources/AccountsApiDataSource.d.mts.map +1 -0
- package/dist/data-sources/{AccountsApiDataSource.js → AccountsApiDataSource.mjs} +8 -7
- package/dist/data-sources/AccountsApiDataSource.mjs.map +1 -0
- package/dist/data-sources/PriceDataSource.cjs +466 -0
- package/dist/data-sources/PriceDataSource.cjs.map +1 -0
- package/dist/data-sources/{PriceDataSource.d.ts → PriceDataSource.d.cts} +5 -5
- package/dist/data-sources/PriceDataSource.d.cts.map +1 -0
- package/dist/data-sources/PriceDataSource.d.mts +100 -0
- package/dist/data-sources/PriceDataSource.d.mts.map +1 -0
- package/dist/data-sources/{PriceDataSource.js → PriceDataSource.mjs} +8 -7
- package/dist/data-sources/PriceDataSource.mjs.map +1 -0
- package/dist/data-sources/RpcDataSource.cjs +1021 -0
- package/dist/data-sources/RpcDataSource.cjs.map +1 -0
- package/dist/data-sources/{RpcDataSource.d.ts → RpcDataSource.d.cts} +10 -10
- package/dist/data-sources/RpcDataSource.d.cts.map +1 -0
- package/dist/data-sources/RpcDataSource.d.mts +174 -0
- package/dist/data-sources/RpcDataSource.d.mts.map +1 -0
- package/dist/data-sources/{RpcDataSource.js → RpcDataSource.mjs} +11 -11
- package/dist/data-sources/RpcDataSource.mjs.map +1 -0
- package/dist/data-sources/SnapDataSource.cjs +443 -0
- package/dist/data-sources/SnapDataSource.cjs.map +1 -0
- package/dist/data-sources/{SnapDataSource.d.ts → SnapDataSource.d.cts} +8 -8
- package/dist/data-sources/SnapDataSource.d.cts.map +1 -0
- package/dist/data-sources/SnapDataSource.d.mts +127 -0
- package/dist/data-sources/SnapDataSource.d.mts.map +1 -0
- package/dist/data-sources/{SnapDataSource.js → SnapDataSource.mjs} +6 -6
- package/dist/data-sources/SnapDataSource.mjs.map +1 -0
- package/dist/data-sources/StakedBalanceDataSource.cjs +616 -0
- package/dist/data-sources/StakedBalanceDataSource.cjs.map +1 -0
- package/dist/data-sources/{StakedBalanceDataSource.d.ts → StakedBalanceDataSource.d.cts} +5 -5
- package/dist/data-sources/StakedBalanceDataSource.d.cts.map +1 -0
- package/dist/data-sources/StakedBalanceDataSource.d.mts +72 -0
- package/dist/data-sources/StakedBalanceDataSource.d.mts.map +1 -0
- package/dist/data-sources/{StakedBalanceDataSource.js → StakedBalanceDataSource.mjs} +7 -7
- package/dist/data-sources/StakedBalanceDataSource.mjs.map +1 -0
- package/dist/data-sources/TokenDataSource.cjs +583 -0
- package/dist/data-sources/TokenDataSource.cjs.map +1 -0
- package/dist/data-sources/{TokenDataSource.d.ts → TokenDataSource.d.cts} +5 -5
- package/dist/data-sources/TokenDataSource.d.cts.map +1 -0
- package/dist/data-sources/TokenDataSource.d.mts +81 -0
- package/dist/data-sources/TokenDataSource.d.mts.map +1 -0
- package/dist/data-sources/{TokenDataSource.js → TokenDataSource.mjs} +8 -7
- package/dist/data-sources/TokenDataSource.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs +705 -0
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/{MulticallClient.d.ts → MulticallClient.d.cts} +3 -3
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.d.mts +65 -0
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/{MulticallClient.js → MulticallClient.mjs} +5 -5
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/TokensApiClient.cjs +312 -0
- package/dist/data-sources/evm-rpc-services/clients/TokensApiClient.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/{TokensApiClient.d.ts → TokensApiClient.d.cts} +2 -2
- package/dist/data-sources/evm-rpc-services/clients/TokensApiClient.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/TokensApiClient.d.mts +61 -0
- package/dist/data-sources/evm-rpc-services/clients/TokensApiClient.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/{TokensApiClient.js → TokensApiClient.mjs} +2 -2
- package/dist/data-sources/evm-rpc-services/clients/TokensApiClient.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/index.cjs +10 -0
- package/dist/data-sources/evm-rpc-services/clients/index.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/index.d.cts +4 -0
- package/dist/data-sources/evm-rpc-services/clients/index.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/index.d.mts +4 -0
- package/dist/data-sources/evm-rpc-services/clients/index.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/clients/index.mjs +3 -0
- package/dist/data-sources/evm-rpc-services/clients/index.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/index.cjs +17 -0
- package/dist/data-sources/evm-rpc-services/index.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/{index.d.ts → index.d.cts} +5 -5
- package/dist/data-sources/evm-rpc-services/index.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/index.d.mts +5 -0
- package/dist/data-sources/evm-rpc-services/index.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/index.mjs +4 -0
- package/dist/data-sources/evm-rpc-services/index.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.cjs +247 -0
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/{BalanceFetcher.d.ts → BalanceFetcher.d.cts} +11 -11
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.d.mts +96 -0
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/{BalanceFetcher.js → BalanceFetcher.mjs} +5 -5
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.cjs +132 -0
- package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/{StakedBalanceFetcher.d.ts → StakedBalanceFetcher.d.cts} +14 -13
- package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.d.mts +81 -0
- package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/{StakedBalanceFetcher.js → StakedBalanceFetcher.mjs} +6 -5
- package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.cjs +230 -0
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/{TokenDetector.d.ts → TokenDetector.d.cts} +12 -12
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.d.mts +78 -0
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/{TokenDetector.js → TokenDetector.mjs} +4 -4
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/index.cjs +13 -0
- package/dist/data-sources/evm-rpc-services/services/index.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/{index.d.ts → index.d.cts} +4 -4
- package/dist/data-sources/evm-rpc-services/services/index.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/index.d.mts +4 -0
- package/dist/data-sources/evm-rpc-services/services/index.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/services/index.mjs +4 -0
- package/dist/data-sources/evm-rpc-services/services/index.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/assets.cjs +3 -0
- package/dist/data-sources/evm-rpc-services/types/assets.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/{assets.d.ts → assets.d.cts} +3 -3
- package/dist/data-sources/evm-rpc-services/types/assets.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/assets.d.mts +53 -0
- package/dist/data-sources/evm-rpc-services/types/assets.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/assets.mjs +2 -0
- package/dist/data-sources/evm-rpc-services/types/assets.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/config.cjs +3 -0
- package/dist/data-sources/evm-rpc-services/types/config.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/{config.d.ts → config.d.cts} +2 -2
- package/dist/data-sources/evm-rpc-services/types/config.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/config.d.mts +18 -0
- package/dist/data-sources/evm-rpc-services/types/config.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/config.mjs +2 -0
- package/dist/data-sources/evm-rpc-services/types/config.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/core.cjs +3 -0
- package/dist/data-sources/evm-rpc-services/types/core.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/{core.d.ts → core.d.cts} +2 -2
- package/dist/data-sources/evm-rpc-services/types/core.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/core.d.mts +19 -0
- package/dist/data-sources/evm-rpc-services/types/core.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/core.mjs +2 -0
- package/dist/data-sources/evm-rpc-services/types/core.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/index.cjs +3 -0
- package/dist/data-sources/evm-rpc-services/types/index.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/index.d.cts +7 -0
- package/dist/data-sources/evm-rpc-services/types/index.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/index.d.mts +7 -0
- package/dist/data-sources/evm-rpc-services/types/index.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/index.mjs +2 -0
- package/dist/data-sources/evm-rpc-services/types/index.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/multicall.cjs +3 -0
- package/dist/data-sources/evm-rpc-services/types/multicall.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/{multicall.d.ts → multicall.d.cts} +2 -2
- package/dist/data-sources/evm-rpc-services/types/multicall.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/multicall.d.mts +24 -0
- package/dist/data-sources/evm-rpc-services/types/multicall.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/multicall.mjs +2 -0
- package/dist/data-sources/evm-rpc-services/types/multicall.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/services.cjs +3 -0
- package/dist/data-sources/evm-rpc-services/types/services.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/{services.d.ts → services.d.cts} +3 -3
- package/dist/data-sources/evm-rpc-services/types/services.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/services.d.mts +70 -0
- package/dist/data-sources/evm-rpc-services/types/services.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/services.mjs +2 -0
- package/dist/data-sources/evm-rpc-services/types/services.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/state.cjs +3 -0
- package/dist/data-sources/evm-rpc-services/types/state.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/{state.d.ts → state.d.cts} +2 -2
- package/dist/data-sources/evm-rpc-services/types/state.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/state.d.mts +58 -0
- package/dist/data-sources/evm-rpc-services/types/state.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/types/state.mjs +2 -0
- package/dist/data-sources/evm-rpc-services/types/state.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/assets.cjs +9 -0
- package/dist/data-sources/evm-rpc-services/utils/assets.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/{assets.d.ts → assets.d.cts} +2 -2
- package/dist/data-sources/evm-rpc-services/utils/assets.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/assets.d.mts +3 -0
- package/dist/data-sources/evm-rpc-services/utils/assets.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/{assets.js → assets.mjs} +2 -2
- package/dist/data-sources/evm-rpc-services/utils/assets.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/batch.cjs +45 -0
- package/dist/data-sources/evm-rpc-services/utils/batch.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/{batch.d.ts → batch.d.cts} +1 -1
- package/dist/data-sources/evm-rpc-services/utils/batch.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/batch.d.mts +28 -0
- package/dist/data-sources/evm-rpc-services/utils/batch.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/{batch.js → batch.mjs} +1 -1
- package/dist/data-sources/evm-rpc-services/utils/batch.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/index.cjs +15 -0
- package/dist/data-sources/evm-rpc-services/utils/index.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/index.d.cts +4 -0
- package/dist/data-sources/evm-rpc-services/utils/index.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/index.d.mts +4 -0
- package/dist/data-sources/evm-rpc-services/utils/index.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/index.mjs +4 -0
- package/dist/data-sources/evm-rpc-services/utils/index.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/parsing.cjs +47 -0
- package/dist/data-sources/evm-rpc-services/utils/parsing.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/{parsing.d.ts → parsing.d.cts} +3 -3
- package/dist/data-sources/evm-rpc-services/utils/parsing.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/parsing.d.mts +25 -0
- package/dist/data-sources/evm-rpc-services/utils/parsing.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/{parsing.js → parsing.mjs} +3 -3
- package/dist/data-sources/evm-rpc-services/utils/parsing.mjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/staking-contracts.cjs +68 -0
- package/dist/data-sources/evm-rpc-services/utils/staking-contracts.cjs.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/{staking-contracts.d.ts → staking-contracts.d.cts} +1 -1
- package/dist/data-sources/evm-rpc-services/utils/staking-contracts.d.cts.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/staking-contracts.d.mts +25 -0
- package/dist/data-sources/evm-rpc-services/utils/staking-contracts.d.mts.map +1 -0
- package/dist/data-sources/evm-rpc-services/utils/{staking-contracts.js → staking-contracts.mjs} +3 -3
- package/dist/data-sources/evm-rpc-services/utils/staking-contracts.mjs.map +1 -0
- package/dist/data-sources/index.cjs +30 -0
- package/dist/data-sources/index.cjs.map +1 -0
- package/dist/data-sources/{index.d.ts → index.d.cts} +9 -9
- package/dist/data-sources/index.d.cts.map +1 -0
- package/dist/data-sources/index.d.mts +9 -0
- package/dist/data-sources/index.d.mts.map +1 -0
- package/dist/data-sources/index.mjs +14 -0
- package/dist/data-sources/index.mjs.map +1 -0
- package/dist/defaults.cjs +125 -0
- package/dist/defaults.cjs.map +1 -0
- package/dist/{defaults.d.ts → defaults.d.cts} +2 -2
- package/dist/defaults.d.cts.map +1 -0
- package/dist/defaults.d.mts +50 -0
- package/dist/defaults.d.mts.map +1 -0
- package/dist/{defaults.js → defaults.mjs} +1 -1
- package/dist/defaults.mjs.map +1 -0
- package/dist/errors.cjs +25 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/{errors.d.ts → errors.d.cts} +1 -1
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +25 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/{errors.js → errors.mjs} +1 -1
- package/dist/errors.mjs.map +1 -0
- package/dist/index.cjs +67 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +26 -26
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +26 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/{index.js → index.mjs} +13 -13
- package/dist/index.mjs.map +1 -0
- package/dist/logger.cjs +7 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/logger.d.cts +5 -0
- package/dist/logger.d.cts.map +1 -0
- package/dist/logger.d.mts +5 -0
- package/dist/logger.d.mts.map +1 -0
- package/dist/logger.mjs +4 -0
- package/dist/logger.mjs.map +1 -0
- package/dist/middlewares/CustomAssetGraduationMiddleware.cjs +132 -0
- package/dist/middlewares/CustomAssetGraduationMiddleware.cjs.map +1 -0
- package/dist/middlewares/{CustomAssetGraduationMiddleware.d.ts → CustomAssetGraduationMiddleware.d.cts} +2 -2
- package/dist/middlewares/CustomAssetGraduationMiddleware.d.cts.map +1 -0
- package/dist/middlewares/CustomAssetGraduationMiddleware.d.mts +32 -0
- package/dist/middlewares/CustomAssetGraduationMiddleware.d.mts.map +1 -0
- package/dist/middlewares/{CustomAssetGraduationMiddleware.js → CustomAssetGraduationMiddleware.mjs} +5 -5
- package/dist/middlewares/CustomAssetGraduationMiddleware.mjs.map +1 -0
- package/dist/middlewares/DetectionMiddleware.cjs +154 -0
- package/dist/middlewares/DetectionMiddleware.cjs.map +1 -0
- package/dist/middlewares/{DetectionMiddleware.d.ts → DetectionMiddleware.d.cts} +2 -2
- package/dist/middlewares/DetectionMiddleware.d.cts.map +1 -0
- package/dist/middlewares/DetectionMiddleware.d.mts +40 -0
- package/dist/middlewares/DetectionMiddleware.d.mts.map +1 -0
- package/dist/middlewares/{DetectionMiddleware.js → DetectionMiddleware.mjs} +4 -4
- package/dist/middlewares/DetectionMiddleware.mjs.map +1 -0
- package/dist/middlewares/ParallelMiddleware.cjs +263 -0
- package/dist/middlewares/ParallelMiddleware.cjs.map +1 -0
- package/dist/middlewares/{ParallelMiddleware.d.ts → ParallelMiddleware.d.cts} +2 -2
- package/dist/middlewares/ParallelMiddleware.d.cts.map +1 -0
- package/dist/middlewares/ParallelMiddleware.d.mts +41 -0
- package/dist/middlewares/ParallelMiddleware.d.mts.map +1 -0
- package/dist/middlewares/{ParallelMiddleware.js → ParallelMiddleware.mjs} +9 -2
- package/dist/middlewares/{ParallelMiddleware.js.map → ParallelMiddleware.mjs.map} +1 -1
- package/dist/middlewares/RpcFallbackMiddleware.cjs +90 -0
- package/dist/middlewares/RpcFallbackMiddleware.cjs.map +1 -0
- package/dist/middlewares/{RpcFallbackMiddleware.d.ts → RpcFallbackMiddleware.d.cts} +2 -2
- package/dist/middlewares/RpcFallbackMiddleware.d.cts.map +1 -0
- package/dist/middlewares/RpcFallbackMiddleware.d.mts +23 -0
- package/dist/middlewares/RpcFallbackMiddleware.d.mts.map +1 -0
- package/dist/middlewares/{RpcFallbackMiddleware.js → RpcFallbackMiddleware.mjs} +4 -4
- package/dist/middlewares/RpcFallbackMiddleware.mjs.map +1 -0
- package/dist/middlewares/index.cjs +14 -0
- package/dist/middlewares/index.cjs.map +1 -0
- package/dist/middlewares/index.d.cts +9 -0
- package/dist/middlewares/index.d.cts.map +1 -0
- package/dist/middlewares/index.d.mts +9 -0
- package/dist/middlewares/index.d.mts.map +1 -0
- package/dist/middlewares/index.mjs +5 -0
- package/dist/middlewares/index.mjs.map +1 -0
- package/dist/migrations/healAssetsInfoMetadata.cjs +385 -0
- package/dist/migrations/healAssetsInfoMetadata.cjs.map +1 -0
- package/dist/migrations/{healAssetsInfoMetadata.d.ts → healAssetsInfoMetadata.d.cts} +4 -4
- package/dist/migrations/healAssetsInfoMetadata.d.cts.map +1 -0
- package/dist/migrations/healAssetsInfoMetadata.d.mts +106 -0
- package/dist/migrations/healAssetsInfoMetadata.d.mts.map +1 -0
- package/dist/migrations/{healAssetsInfoMetadata.js → healAssetsInfoMetadata.mjs} +5 -4
- package/dist/migrations/healAssetsInfoMetadata.mjs.map +1 -0
- package/dist/selectors/balance.cjs +532 -0
- package/dist/selectors/balance.cjs.map +1 -0
- package/dist/selectors/{balance.d.ts → balance.d.cts} +6 -6
- package/dist/selectors/balance.d.cts.map +1 -0
- package/dist/selectors/balance.d.mts +103 -0
- package/dist/selectors/balance.d.mts.map +1 -0
- package/dist/selectors/{balance.js → balance.mjs} +5 -5
- package/dist/selectors/balance.mjs.map +1 -0
- package/dist/types.cjs +39 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types.d.ts → types.d.cts} +4 -4
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +533 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/{types.js → types.mjs} +1 -1
- package/dist/types.mjs.map +1 -0
- package/dist/utils/constants.cjs +5 -0
- package/dist/utils/constants.cjs.map +1 -0
- package/dist/utils/constants.d.cts +2 -0
- package/dist/utils/constants.d.cts.map +1 -0
- package/dist/utils/constants.d.mts +2 -0
- package/dist/utils/constants.d.mts.map +1 -0
- package/dist/utils/{constants.js → constants.mjs} +1 -1
- package/dist/utils/constants.mjs.map +1 -0
- package/dist/utils/customAssetsRpcSupplement.cjs +72 -0
- package/dist/utils/customAssetsRpcSupplement.cjs.map +1 -0
- package/dist/utils/{customAssetsRpcSupplement.d.ts → customAssetsRpcSupplement.d.cts} +2 -2
- package/dist/utils/customAssetsRpcSupplement.d.cts.map +1 -0
- package/dist/utils/customAssetsRpcSupplement.d.mts +60 -0
- package/dist/utils/customAssetsRpcSupplement.d.mts.map +1 -0
- package/dist/utils/{customAssetsRpcSupplement.js → customAssetsRpcSupplement.mjs} +2 -2
- package/dist/utils/customAssetsRpcSupplement.mjs.map +1 -0
- package/dist/utils/dedupingBatchFetcher.cjs +168 -0
- package/dist/utils/dedupingBatchFetcher.cjs.map +1 -0
- package/dist/utils/{dedupingBatchFetcher.d.ts → dedupingBatchFetcher.d.cts} +1 -1
- package/dist/utils/dedupingBatchFetcher.d.cts.map +1 -0
- package/dist/utils/dedupingBatchFetcher.d.mts +72 -0
- package/dist/utils/dedupingBatchFetcher.d.mts.map +1 -0
- package/dist/utils/{dedupingBatchFetcher.js → dedupingBatchFetcher.mjs} +1 -1
- package/dist/utils/dedupingBatchFetcher.mjs.map +1 -0
- package/dist/utils/fetchWithTimeout.cjs +30 -0
- package/dist/utils/fetchWithTimeout.cjs.map +1 -0
- package/dist/utils/{fetchWithTimeout.d.ts → fetchWithTimeout.d.cts} +1 -1
- package/dist/utils/fetchWithTimeout.d.cts.map +1 -0
- package/dist/utils/fetchWithTimeout.d.mts +11 -0
- package/dist/utils/fetchWithTimeout.d.mts.map +1 -0
- package/dist/utils/{fetchWithTimeout.js → fetchWithTimeout.mjs} +1 -1
- package/dist/utils/fetchWithTimeout.mjs.map +1 -0
- package/dist/utils/formatExchangeRatesForBridge.cjs +161 -0
- package/dist/utils/formatExchangeRatesForBridge.cjs.map +1 -0
- package/dist/utils/{formatExchangeRatesForBridge.d.ts → formatExchangeRatesForBridge.d.cts} +3 -3
- package/dist/utils/formatExchangeRatesForBridge.d.cts.map +1 -0
- package/dist/utils/formatExchangeRatesForBridge.d.mts +43 -0
- package/dist/utils/formatExchangeRatesForBridge.d.mts.map +1 -0
- package/dist/utils/{formatExchangeRatesForBridge.js → formatExchangeRatesForBridge.mjs} +7 -6
- package/dist/utils/formatExchangeRatesForBridge.mjs.map +1 -0
- package/dist/utils/formatStateForTransactionPay.cjs +174 -0
- package/dist/utils/formatStateForTransactionPay.cjs.map +1 -0
- package/dist/utils/{formatStateForTransactionPay.d.ts → formatStateForTransactionPay.d.cts} +3 -3
- package/dist/utils/formatStateForTransactionPay.d.cts.map +1 -0
- package/dist/utils/formatStateForTransactionPay.d.mts +72 -0
- package/dist/utils/formatStateForTransactionPay.d.mts.map +1 -0
- package/dist/utils/{formatStateForTransactionPay.js → formatStateForTransactionPay.mjs} +8 -7
- package/dist/utils/formatStateForTransactionPay.mjs.map +1 -0
- package/dist/utils/index.cjs +21 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +9 -0
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +9 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +7 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/native-assets.cjs +64 -0
- package/dist/utils/native-assets.cjs.map +1 -0
- package/dist/utils/{native-assets.d.ts → native-assets.d.cts} +2 -2
- package/dist/utils/native-assets.d.cts.map +1 -0
- package/dist/utils/native-assets.d.mts +19 -0
- package/dist/utils/native-assets.d.mts.map +1 -0
- package/dist/utils/{native-assets.js → native-assets.mjs} +5 -5
- package/dist/utils/native-assets.mjs.map +1 -0
- package/dist/utils/normalizeAmountString.cjs +64 -0
- package/dist/utils/normalizeAmountString.cjs.map +1 -0
- package/dist/utils/{normalizeAmountString.d.ts → normalizeAmountString.d.cts} +1 -1
- package/dist/utils/normalizeAmountString.d.cts.map +1 -0
- package/dist/utils/normalizeAmountString.d.mts +35 -0
- package/dist/utils/normalizeAmountString.d.mts.map +1 -0
- package/dist/utils/{normalizeAmountString.js → normalizeAmountString.mjs} +2 -2
- package/dist/utils/normalizeAmountString.mjs.map +1 -0
- package/dist/utils/normalizeAssetId.cjs +60 -0
- package/dist/utils/normalizeAssetId.cjs.map +1 -0
- package/dist/utils/{normalizeAssetId.d.ts → normalizeAssetId.d.cts} +3 -3
- package/dist/utils/normalizeAssetId.d.cts.map +1 -0
- package/dist/utils/normalizeAssetId.d.mts +32 -0
- package/dist/utils/normalizeAssetId.d.mts.map +1 -0
- package/dist/utils/{normalizeAssetId.js → normalizeAssetId.mjs} +11 -4
- package/dist/utils/normalizeAssetId.mjs.map +1 -0
- package/dist/utils/snaps-assets-migration.cjs +171 -0
- package/dist/utils/snaps-assets-migration.cjs.map +1 -0
- package/dist/utils/{snaps-assets-migration.d.ts → snaps-assets-migration.d.cts} +5 -5
- package/dist/utils/snaps-assets-migration.d.cts.map +1 -0
- package/dist/utils/snaps-assets-migration.d.mts +113 -0
- package/dist/utils/snaps-assets-migration.d.mts.map +1 -0
- package/dist/utils/{snaps-assets-migration.js → snaps-assets-migration.mjs} +2 -2
- package/dist/utils/snaps-assets-migration.mjs.map +1 -0
- package/dist/utils/trace.cjs +120 -0
- package/dist/utils/trace.cjs.map +1 -0
- package/dist/utils/{trace.d.ts → trace.d.cts} +2 -2
- package/dist/utils/trace.d.cts.map +1 -0
- package/dist/utils/trace.d.mts +52 -0
- package/dist/utils/trace.d.mts.map +1 -0
- package/dist/utils/{trace.js → trace.mjs} +1 -1
- package/dist/utils/trace.mjs.map +1 -0
- package/package.json +18 -15
- package/dist/AssetsController-method-action-types.d.ts.map +0 -1
- package/dist/AssetsController-method-action-types.js.map +0 -1
- package/dist/AssetsController.d.ts.map +0 -1
- package/dist/AssetsController.js.map +0 -1
- package/dist/data-sources/AbstractDataSource.d.ts.map +0 -1
- package/dist/data-sources/AbstractDataSource.js.map +0 -1
- package/dist/data-sources/AccountActivityDataSource.d.ts.map +0 -1
- package/dist/data-sources/AccountActivityDataSource.js.map +0 -1
- package/dist/data-sources/AccountsApiDataSource.d.ts.map +0 -1
- package/dist/data-sources/AccountsApiDataSource.js.map +0 -1
- package/dist/data-sources/PriceDataSource.d.ts.map +0 -1
- package/dist/data-sources/PriceDataSource.js.map +0 -1
- package/dist/data-sources/RpcDataSource.d.ts.map +0 -1
- package/dist/data-sources/RpcDataSource.js.map +0 -1
- package/dist/data-sources/SnapDataSource.d.ts.map +0 -1
- package/dist/data-sources/SnapDataSource.js.map +0 -1
- package/dist/data-sources/StakedBalanceDataSource.d.ts.map +0 -1
- package/dist/data-sources/StakedBalanceDataSource.js.map +0 -1
- package/dist/data-sources/TokenDataSource.d.ts.map +0 -1
- package/dist/data-sources/TokenDataSource.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/clients/TokensApiClient.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/clients/TokensApiClient.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/clients/index.d.ts +0 -4
- package/dist/data-sources/evm-rpc-services/clients/index.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/clients/index.js +0 -3
- package/dist/data-sources/evm-rpc-services/clients/index.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/index.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/index.js +0 -4
- package/dist/data-sources/evm-rpc-services/index.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/services/StakedBalanceFetcher.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/services/index.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/services/index.js +0 -4
- package/dist/data-sources/evm-rpc-services/services/index.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/assets.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/assets.js +0 -2
- package/dist/data-sources/evm-rpc-services/types/assets.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/config.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/config.js +0 -2
- package/dist/data-sources/evm-rpc-services/types/config.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/core.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/core.js +0 -2
- package/dist/data-sources/evm-rpc-services/types/core.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/index.d.ts +0 -7
- package/dist/data-sources/evm-rpc-services/types/index.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/index.js +0 -2
- package/dist/data-sources/evm-rpc-services/types/index.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/multicall.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/multicall.js +0 -2
- package/dist/data-sources/evm-rpc-services/types/multicall.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/services.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/services.js +0 -2
- package/dist/data-sources/evm-rpc-services/types/services.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/state.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/types/state.js +0 -2
- package/dist/data-sources/evm-rpc-services/types/state.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/utils/assets.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/utils/assets.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/utils/batch.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/utils/batch.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/utils/index.d.ts +0 -4
- package/dist/data-sources/evm-rpc-services/utils/index.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/utils/index.js +0 -4
- package/dist/data-sources/evm-rpc-services/utils/index.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/utils/parsing.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/utils/parsing.js.map +0 -1
- package/dist/data-sources/evm-rpc-services/utils/staking-contracts.d.ts.map +0 -1
- package/dist/data-sources/evm-rpc-services/utils/staking-contracts.js.map +0 -1
- package/dist/data-sources/index.d.ts.map +0 -1
- package/dist/data-sources/index.js +0 -14
- package/dist/data-sources/index.js.map +0 -1
- package/dist/defaults.d.ts.map +0 -1
- package/dist/defaults.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts +0 -4
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -4
- package/dist/logger.js.map +0 -1
- package/dist/middlewares/CustomAssetGraduationMiddleware.d.ts.map +0 -1
- package/dist/middlewares/CustomAssetGraduationMiddleware.js.map +0 -1
- package/dist/middlewares/DetectionMiddleware.d.ts.map +0 -1
- package/dist/middlewares/DetectionMiddleware.js.map +0 -1
- package/dist/middlewares/ParallelMiddleware.d.ts.map +0 -1
- package/dist/middlewares/RpcFallbackMiddleware.d.ts.map +0 -1
- package/dist/middlewares/RpcFallbackMiddleware.js.map +0 -1
- package/dist/middlewares/index.d.ts +0 -9
- package/dist/middlewares/index.d.ts.map +0 -1
- package/dist/middlewares/index.js +0 -5
- package/dist/middlewares/index.js.map +0 -1
- package/dist/migrations/healAssetsInfoMetadata.d.ts.map +0 -1
- package/dist/migrations/healAssetsInfoMetadata.js.map +0 -1
- package/dist/selectors/balance.d.ts.map +0 -1
- package/dist/selectors/balance.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/constants.d.ts +0 -2
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/constants.js.map +0 -1
- package/dist/utils/customAssetsRpcSupplement.d.ts.map +0 -1
- package/dist/utils/customAssetsRpcSupplement.js.map +0 -1
- package/dist/utils/dedupingBatchFetcher.d.ts.map +0 -1
- package/dist/utils/dedupingBatchFetcher.js.map +0 -1
- package/dist/utils/fetchWithTimeout.d.ts.map +0 -1
- package/dist/utils/fetchWithTimeout.js.map +0 -1
- package/dist/utils/formatExchangeRatesForBridge.d.ts.map +0 -1
- package/dist/utils/formatExchangeRatesForBridge.js.map +0 -1
- package/dist/utils/formatStateForTransactionPay.d.ts.map +0 -1
- package/dist/utils/formatStateForTransactionPay.js.map +0 -1
- package/dist/utils/index.d.ts +0 -9
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -7
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/native-assets.d.ts.map +0 -1
- package/dist/utils/native-assets.js.map +0 -1
- package/dist/utils/normalizeAmountString.d.ts.map +0 -1
- package/dist/utils/normalizeAmountString.js.map +0 -1
- package/dist/utils/normalizeAssetId.d.ts.map +0 -1
- package/dist/utils/normalizeAssetId.js.map +0 -1
- package/dist/utils/snaps-assets-migration.d.ts.map +0 -1
- package/dist/utils/snaps-assets-migration.js.map +0 -1
- package/dist/utils/trace.d.ts.map +0 -1
- package/dist/utils/trace.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TokenDetector.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/services/TokenDetector.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,8BAA8B,CAAC;AAGnF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAevE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AAE/D,MAAM,0BAA0B,GAAG,MAAO,CAAC,CAAC,YAAY;AA8BxD;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,mCAAmC,EAAyB;IAW7F,YACE,eAAgC,EAChC,eAAg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,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,CAAC;AAC5E,CAAC,mEAGC,OAAgB,EAChB,YAAqB,EACrB,QAAoC;IAEpC,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAE7C,MAAM,OAAO,GACX,UAAU,cAAc,UAAU,YAAY,CAAC,WAAW,EAAE,EAAmB,CAAC;IAElF,OAAO;QACL,OAAO;QACP,OAAO;QACP,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,QAAQ,EAAE,MAAM;QACxB,IAAI,EAAE,QAAQ,EAAE,IAAI;QACpB,QAAQ,EAAE,QAAQ,EAAE,QAAQ;QAC5B,KAAK,EAAE,QAAQ,EAAE,OAAO;QACxB,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,QAAQ,EAAE,WAAW;KACnC,CAAC;AACJ,CAAC","sourcesContent":["import { StaticIntervalPollingControllerOnly } from '@metamask/polling-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport { projectLogger, createModuleLogger } from '../../../logger.js';\nimport type { MulticallClient } from '../clients/index.js';\nimport type { TokensApiClient } from '../clients/TokensApiClient.js';\nimport type {\n AccountId,\n Address,\n Asset,\n AssetBalance,\n BalanceOfRequest,\n BalanceOfResponse,\n ChainId,\n TokenDetectionOptions,\n TokenDetectionResult,\n TokenListEntry,\n} from '../types/index.js';\nimport { reduceInBatchesSerially } from '../utils/index.js';\n\nconst log = createModuleLogger(projectLogger, 'TokenDetector');\n\nconst DEFAULT_DETECTION_INTERVAL = 180_000; // 3 minutes\n\nexport type TokenDetectorConfig = {\n /** Function returning whether token detection is enabled (avoids stale value) */\n tokenDetectionEnabled?: () => boolean;\n /** Function returning whether external services are allowed (avoids stale value; default: () => true) */\n useExternalService?: () => boolean;\n defaultBatchSize?: number;\n defaultTimeoutMs?: number;\n /** Polling interval in ms (default: 3 minutes) */\n pollingInterval?: number;\n};\n\n/**\n * Polling input for TokenDetector - identifies what to poll for.\n */\nexport type DetectionPollingInput = {\n /** Chain ID (hex format) */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address */\n accountAddress: Address;\n};\n\n/**\n * Callback type for token detection updates.\n */\nexport type OnDetectionUpdateCallback = (result: TokenDetectionResult) => void;\n\n/**\n * TokenDetector - Detects tokens with non-zero balances via multicall.\n * Fetches the token list from the Tokens API and uses multicall to check balances.\n * Extends StaticIntervalPollingControllerOnly for built-in polling support.\n */\nexport class TokenDetector extends StaticIntervalPollingControllerOnly<DetectionPollingInput>() {\n readonly #multicallClient: MulticallClient;\n\n readonly #tokensApiClient: TokensApiClient;\n\n readonly #config: Required<Omit<TokenDetectorConfig, 'pollingInterval'>>;\n\n readonly #tokenListCache: Map<ChainId, TokenListEntry[]> = new Map();\n\n #onDetectionUpdate: OnDetectionUpdateCallback | undefined;\n\n constructor(\n multicallClient: MulticallClient,\n tokensApiClient: TokensApiClient,\n config?: TokenDetectorConfig,\n ) {\n super();\n this.#multicallClient = multicallClient;\n this.#tokensApiClient = tokensApiClient;\n this.#config = {\n tokenDetectionEnabled:\n config?.tokenDetectionEnabled ?? ((): boolean => true),\n useExternalService: config?.useExternalService ?? ((): boolean => true),\n defaultBatchSize: config?.defaultBatchSize ?? 300,\n defaultTimeoutMs: config?.defaultTimeoutMs ?? 30000,\n };\n\n this.setIntervalLength(\n config?.pollingInterval ?? DEFAULT_DETECTION_INTERVAL,\n );\n }\n\n /**\n * Set the callback to receive detection updates during polling.\n *\n * @param callback - Function to call with detection results.\n */\n setOnDetectionUpdate(callback: OnDetectionUpdateCallback): void {\n this.#onDetectionUpdate = callback;\n }\n\n /**\n * Execute a poll cycle (required by base class).\n * Detects tokens and calls the update callback.\n *\n * @param input - The polling input.\n */\n async _executePoll(input: DetectionPollingInput): Promise<void> {\n try {\n const result = await this.detectTokens(\n input.chainId,\n input.accountId,\n input.accountAddress,\n );\n\n if (this.#onDetectionUpdate && result.detectedAssets.length > 0) {\n this.#onDetectionUpdate(result);\n }\n } catch (error) {\n log('Token detection poll failed', { chainId: input.chainId, error });\n }\n }\n\n /**\n * Fetch the list of token addresses to check for the given chain.\n * Calls the Tokens API and caches the result for metadata lookups.\n *\n * @param chainId - Chain ID in hex format.\n * @returns Array of token contract addresses.\n */\n async getTokensToCheck(chainId: ChainId): Promise<Address[]> {\n const tokenList = await this.#fetchAndCacheTokenList(chainId);\n return tokenList.map((entry) => entry.address as Address);\n }\n\n async detectTokens(\n chainId: ChainId,\n accountId: AccountId,\n accountAddress: Address,\n options?: TokenDetectionOptions,\n ): Promise<TokenDetectionResult> {\n const tokenDetectionEnabled =\n options?.tokenDetectionEnabled ?? this.#config.tokenDetectionEnabled();\n const useExternalService =\n options?.useExternalService ?? this.#config.useExternalService();\n if (!tokenDetectionEnabled || !useExternalService) {\n return {\n chainId,\n accountId,\n accountAddress,\n detectedAssets: [],\n detectedBalances: [],\n zeroBalanceAddresses: [],\n failedAddresses: [],\n timestamp: Date.now(),\n };\n }\n const batchSize = options?.batchSize ?? this.#config.defaultBatchSize;\n const timestamp = Date.now();\n\n const tokensToCheck = await this.getTokensToCheck(chainId);\n\n if (tokensToCheck.length === 0) {\n return {\n chainId,\n accountId,\n accountAddress,\n detectedAssets: [],\n detectedBalances: [],\n zeroBalanceAddresses: [],\n failedAddresses: [],\n timestamp,\n };\n }\n\n const balanceRequests: BalanceOfRequest[] = tokensToCheck.map(\n (tokenAddress) => ({\n tokenAddress,\n accountAddress,\n }),\n );\n\n type DetectionAccumulator = {\n detectedAssets: Asset[];\n detectedBalances: AssetBalance[];\n zeroBalanceAddresses: Address[];\n failedAddresses: Address[];\n };\n\n const result = await reduceInBatchesSerially<\n BalanceOfRequest,\n DetectionAccumulator\n >({\n values: balanceRequests,\n batchSize,\n initialResult: {\n detectedAssets: [],\n detectedBalances: [],\n zeroBalanceAddresses: [],\n failedAddresses: [],\n },\n eachBatch: async (workingResult, batch) => {\n const responses = await this.#multicallClient.batchBalanceOf(\n chainId,\n batch,\n );\n\n return this.#processBalanceResponses(\n responses,\n workingResult as DetectionAccumulator,\n chainId,\n accountId,\n timestamp,\n );\n },\n });\n\n return {\n chainId,\n accountId,\n accountAddress,\n ...result,\n timestamp,\n };\n }\n\n async #fetchAndCacheTokenList(chainId: ChainId): Promise<TokenListEntry[]> {\n try {\n const list = await this.#tokensApiClient.fetchTokenList(chainId);\n this.#tokenListCache.set(chainId, list);\n return list;\n } catch (error) {\n const cached = this.#tokenListCache.get(chainId);\n log('Failed to fetch token list; using stale cache', {\n chainId,\n cachedCount: cached?.length ?? 0,\n error,\n });\n return cached ?? [];\n }\n }\n\n #processBalanceResponses(\n responses: BalanceOfResponse[],\n accumulator: {\n detectedAssets: Asset[];\n detectedBalances: AssetBalance[];\n zeroBalanceAddresses: Address[];\n failedAddresses: Address[];\n },\n chainId: ChainId,\n accountId: AccountId,\n timestamp: number,\n ): {\n detectedAssets: Asset[];\n detectedBalances: AssetBalance[];\n zeroBalanceAddresses: Address[];\n failedAddresses: Address[];\n } {\n const {\n detectedAssets,\n detectedBalances,\n zeroBalanceAddresses,\n failedAddresses,\n } = accumulator;\n\n for (const response of responses) {\n if (!response.success) {\n failedAddresses.push(response.tokenAddress);\n continue;\n }\n\n const balance = response.balance ?? '0';\n\n if (balance === '0' || balance === '') {\n zeroBalanceAddresses.push(response.tokenAddress);\n continue;\n }\n\n const tokenMetadata = this.#getTokenMetadata(\n chainId,\n response.tokenAddress,\n );\n\n const asset = this.#createAsset(\n chainId,\n response.tokenAddress,\n tokenMetadata,\n );\n detectedAssets.push(asset);\n\n if (tokenMetadata?.decimals === undefined) {\n continue;\n }\n\n const { decimals } = tokenMetadata;\n const formattedBalance = this.#formatBalance(balance, decimals);\n detectedBalances.push({\n assetId: asset.assetId,\n accountId,\n chainId,\n balance,\n formattedBalance,\n decimals,\n timestamp,\n });\n }\n\n return {\n detectedAssets,\n detectedBalances,\n zeroBalanceAddresses,\n failedAddresses,\n };\n }\n\n #formatBalance(rawBalance: string, decimals: number): string {\n try {\n const balanceBigInt = BigInt(rawBalance);\n const divisor = BigInt(10 ** decimals);\n\n const integerPart = balanceBigInt / divisor;\n const remainder = balanceBigInt % divisor;\n const fractionalStr = remainder.toString().padStart(decimals, '0');\n const trimmedFractional = fractionalStr.replace(/0+$/u, '');\n\n if (trimmedFractional === '') {\n return integerPart.toString();\n }\n\n return `${integerPart}.${trimmedFractional}`;\n } catch {\n return rawBalance;\n }\n }\n\n #getTokenMetadata(\n chainId: ChainId,\n tokenAddress: Address,\n ): TokenListEntry | undefined {\n const list = this.#tokenListCache.get(chainId) ?? [];\n const lowerAddress = tokenAddress.toLowerCase();\n\n const exact = list.find((entry) => entry.address === tokenAddress);\n if (exact) {\n return exact;\n }\n\n return list.find((entry) => entry.address.toLowerCase() === lowerAddress);\n }\n\n #createAsset(\n chainId: ChainId,\n tokenAddress: Address,\n metadata: TokenListEntry | undefined,\n ): Asset {\n const chainIdDecimal = parseInt(chainId, 16);\n\n const assetId =\n `eip155:${chainIdDecimal}/erc20:${tokenAddress.toLowerCase()}` as CaipAssetType;\n\n return {\n assetId,\n chainId,\n address: tokenAddress,\n type: 'erc20',\n symbol: metadata?.symbol,\n name: metadata?.name,\n decimals: metadata?.decimals,\n image: metadata?.iconUrl,\n isNative: false,\n aggregators: metadata?.aggregators,\n };\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,GACnC,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { TokenDetector, } from './TokenDetector.js';
|
|
2
|
-
export { BalanceFetcher, } from './BalanceFetcher.js';
|
|
3
|
-
export { StakedBalanceFetcher, getSupportedStakingChainIds, getStakingContractAddress, isStakingContractAssetId, } from './StakedBalanceFetcher.js';
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAId,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,cAAc,GAKf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,GAKzB,MAAM,2BAA2B,CAAC","sourcesContent":["export {\n TokenDetector,\n type TokenDetectorConfig,\n type DetectionPollingInput,\n type OnDetectionUpdateCallback,\n} from './TokenDetector.js';\nexport {\n BalanceFetcher,\n type BalanceFetcherConfig,\n type BalanceFetcherMessenger,\n type BalancePollingInput,\n type OnBalanceUpdateCallback,\n} from './BalanceFetcher.js';\nexport {\n StakedBalanceFetcher,\n getSupportedStakingChainIds,\n getStakingContractAddress,\n isStakingContractAssetId,\n type StakedBalanceFetcherConfig,\n type StakedBalancePollingInput,\n type StakedBalanceFetchResult,\n type OnStakedBalanceUpdateCallback,\n} from './StakedBalanceFetcher.js';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources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zC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/assets.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType } from '@metamask/utils';\n\nimport type { AccountId, Address, AssetType, ChainId } from './core.js';\n\n/**\n * Core asset definition.\n */\nexport type Asset = {\n /** CAIP-19 asset identifier */\n assetId: CaipAssetType;\n /** Chain ID in hex format */\n chainId: ChainId;\n /** Contract address (zero address for native) */\n address: Address;\n /** Asset type */\n type: AssetType;\n /** Token symbol (e.g., \"ETH\", \"USDC\") */\n symbol?: string;\n /** Token name (e.g., \"Ethereum\", \"USD Coin\") */\n name?: string;\n /** Token decimals */\n decimals?: number;\n /** Logo image URL */\n image?: string;\n /** Whether this is the chain's native token */\n isNative: boolean;\n /** Spam detection flag */\n isSpam?: boolean;\n /** Verification status */\n verified?: boolean;\n /** Token list sources */\n aggregators?: string[];\n};\n\n/**\n * Asset balance for a specific account.\n */\nexport type AssetBalance = {\n /** CAIP-19 asset identifier */\n assetId: CaipAssetType;\n /** Account ID (UUID) */\n accountId: AccountId;\n /** Chain ID in hex format */\n chainId: ChainId;\n /** Raw balance as string (wei/smallest unit) */\n balance: string;\n /** Human-readable balance (balance / 10^decimals) */\n formattedBalance: string;\n /** Token decimals used for formatting; omitted when unknown (raw `balance` only; resolved downstream). */\n decimals?: number;\n /** Block number when balance was fetched */\n blockNumber?: number;\n /** Timestamp when balance was fetched */\n timestamp: number;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,CAAC,WAAW,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,IAAI,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/config.ts"],"names":[],"mappings":"","sourcesContent":["import type { ChainId } from './core.js';\n\n/**\n * Minimal provider interface for RPC calls.\n */\nexport type Provider = {\n call(transaction: { to: string; data: string }): Promise<string>;\n getBalance(address: string): Promise<{ toString(): string }>;\n};\n\n/**\n * Function to get provider for a specific chain.\n */\nexport type GetProviderFunction = (chainId: ChainId) => Provider;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG1D,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC;AAE1B;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC;AAE1B;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/core.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType, Hex } from '@metamask/utils';\n\n// Re-export for convenience\nexport type { CaipAssetType };\n\n/**\n * Account ID - UUID from InternalAccount.id\n */\nexport type AccountId = string;\n\n/**\n * Chain ID in hex format (e.g., \"0x1\" for Ethereum mainnet)\n */\nexport type ChainId = Hex;\n\n/**\n * Token/Contract address in hex format\n */\nexport type Address = Hex;\n\n/**\n * Asset type identifier for categorization.\n */\nexport type AssetType = 'native' | 'erc20' | 'erc721' | 'erc1155';\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type { AccountId, Address, AssetType, CaipAssetType, ChainId, } from './core.js';
|
|
2
|
-
export type { Asset, AssetBalance } from './assets.js';
|
|
3
|
-
export type { AssetsBalanceState, TokenChainsCacheEntry, TokenListEntry, TokenListState, } from './state.js';
|
|
4
|
-
export type { GetProviderFunction, Provider } from './config.js';
|
|
5
|
-
export type { BalanceOfRequest, BalanceOfResponse } from './multicall.js';
|
|
6
|
-
export type { AssetFetchEntry, BalanceFetchResult, TokenDetectionOptions, TokenDetectionResult, } from './services.js';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,OAAO,GACR,MAAM,WAAW,CAAC;AAGnB,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGvD,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGjE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAG1E,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/index.ts"],"names":[],"mappings":"","sourcesContent":["// Core types\nexport type {\n AccountId,\n Address,\n AssetType,\n CaipAssetType,\n ChainId,\n} from './core.js';\n\n// Asset types\nexport type { Asset, AssetBalance } from './assets.js';\n\n// State types\nexport type {\n AssetsBalanceState,\n TokenChainsCacheEntry,\n TokenListEntry,\n TokenListState,\n} from './state.js';\n\n// Config types\nexport type { GetProviderFunction, Provider } from './config.js';\n\n// Multicall types\nexport type { BalanceOfRequest, BalanceOfResponse } from './multicall.js';\n\n// Service types\nexport type {\n AssetFetchEntry,\n BalanceFetchResult,\n TokenDetectionOptions,\n TokenDetectionResult,\n} from './services.js';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/multicall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,uDAAuD;IACvD,YAAY,EAAE,OAAO,CAAC;IACtB,2CAA2C;IAC3C,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,6BAA6B;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,sBAAsB;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multicall.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/multicall.ts"],"names":[],"mappings":"","sourcesContent":["import type { Address } from './core.js';\n\n/**\n * Balance request for batch balance fetching.\n */\nexport type BalanceOfRequest = {\n /** Token contract address (zero address for native) */\n tokenAddress: Address;\n /** Account address to check balance for */\n accountAddress: Address;\n};\n\n/**\n * Balance response from batch balance fetching.\n */\nexport type BalanceOfResponse = {\n /** Token contract address */\n tokenAddress: Address;\n /** Account address */\n accountAddress: Address;\n /** Whether the call succeeded */\n success: boolean;\n /** Balance as string (raw value) */\n balance?: string;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,eAAe;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,yCAAyC;IACzC,cAAc,EAAE,OAAO,CAAC;IACxB,mDAAmD;IACnD,cAAc,EAAE,KAAK,EAAE,CAAC;IACxB,yCAAyC;IACzC,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,oDAAoD;IACpD,oBAAoB,EAAE,OAAO,EAAE,CAAC;IAChC,uCAAuC;IACvC,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,yCAAyC;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,sBAAsB;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB;IACvB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,2CAA2C;IAC3C,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,oCAAoC;IACpC,OAAO,EAAE,aAAa,CAAC;IACvB,gHAAgH;IAChH,OAAO,EAAE,OAAO,CAAC;IACjB,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/services.ts"],"names":[],"mappings":"","sourcesContent":["import type { Asset, AssetBalance } from './assets.js';\nimport type { AccountId, Address, CaipAssetType, ChainId } from './core.js';\n\n/**\n * Token detection result.\n */\nexport type TokenDetectionResult = {\n /** Chain ID */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address used for detection */\n accountAddress: Address;\n /** Newly detected tokens with non-zero balances */\n detectedAssets: Asset[];\n /** Balances for newly detected tokens */\n detectedBalances: AssetBalance[];\n /** Tokens that were checked but had zero balance */\n zeroBalanceAddresses: Address[];\n /** Tokens that failed to be checked */\n failedAddresses: Address[];\n /** Timestamp of detection */\n timestamp: number;\n};\n\n/**\n * Token detection options.\n */\nexport type TokenDetectionOptions = {\n /** Whether token detection is enabled */\n tokenDetectionEnabled?: boolean;\n /** Whether external services (e.g. token list API) are allowed; detection stops when false */\n useExternalService?: boolean;\n /** Maximum number of tokens to check per batch */\n batchSize?: number;\n /** Timeout for detection in milliseconds */\n timeout?: number;\n};\n\n/**\n * Balance fetch result.\n */\nexport type BalanceFetchResult = {\n /** Chain ID */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address */\n accountAddress: Address;\n /** Fetched balances */\n balances: AssetBalance[];\n /** Token addresses that failed to fetch */\n failedAddresses: Address[];\n /** Block number when balances were fetched */\n blockNumber?: number;\n /** Timestamp of fetch */\n timestamp: number;\n};\n\n/**\n * Entry describing a single asset to fetch a balance for.\n * Bundles the CAIP-19 asset ID with the on-chain address (zero address for\n * native assets even when the chain has a native asset with a non-zero address)\n * and optional metadata\n */\nexport type AssetFetchEntry = {\n /** CAIP-19 asset type identifier */\n assetId: CaipAssetType;\n /** On-chain contract address (zero address for native assets regardless of the chain's native asset address) */\n address: Address;\n /** Token decimals (omit when unknown — balance fetcher returns raw balance for RpcDataSource to resolve). */\n decimals?: number;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,gDAAgD;IAChD,iBAAiB,EAAE,MAAM,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;CAC3D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gEAAgE;IAChE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACjE;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACzC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/state.ts"],"names":[],"mappings":"","sourcesContent":["import type { ChainId } from './core.js';\n\n/**\n * Single token entry from token list.\n */\nexport type TokenListEntry = {\n /** Contract address */\n address: string;\n /** Token symbol */\n symbol: string;\n /** Token name */\n name: string;\n /** Token decimals */\n decimals: number;\n /** Logo URL */\n iconUrl?: string;\n /** Aggregator sources */\n aggregators?: string[];\n /** Occurrence count in lists */\n occurrences?: number;\n};\n\n/**\n * Cache entry for a chain's token list.\n */\nexport type TokenChainsCacheEntry = {\n /** Timestamp when the cache was last updated */\n timestamp: number;\n /** Token list data: address -> TokenListEntry */\n data: Record<string, TokenListEntry>;\n};\n\n/**\n * Token list state shape (from TokenListController).\n */\nexport type TokenListState = {\n /** Map of chain ID to token list cache entry */\n tokensChainsCache: Record<ChainId, TokenChainsCacheEntry>;\n};\n\n/**\n * Single asset balance entry.\n */\nexport type AssetBalanceEntry = {\n /** Human-readable balance amount */\n amount: string;\n};\n\n/**\n * Assets balance state shape (from AssetsController).\n * Maps accountId -> assetId (CAIP-19) -> balance entry.\n */\nexport type AssetsBalanceState = {\n /** Balance data per account: accountId -> assetId -> balance */\n assetsBalance: Record<string, Record<string, AssetBalanceEntry>>;\n /**\n * User-added custom assets per account: accountId -> CAIP-19 asset IDs.\n * Used to ensure RPC polling refreshes custom assets even when they have\n * no entry in `assetsBalance` yet (e.g. zero balance, first fetch failed).\n */\n customAssets?: Record<string, string[]>;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/utils/assets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,WAAW,GACvB,OAAO,CAIT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/utils/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAG5E,MAAM,UAAU,8BAA8B,CAC5C,WAAwB;IAExB,OAAQ,8BAAoD,CAAC,QAAQ,CACnE,WAAW,CACZ,CAAC;AACJ,CAAC","sourcesContent":["import { CHAIN_IDS_WITH_NO_NATIVE_TOKEN } from '@metamask/controller-utils';\nimport { CaipChainId } from '@metamask/utils';\n\nexport function shouldSkipNativeForCaipChainId(\n caipChainId: CaipChainId,\n): boolean {\n return (CHAIN_IDS_WITH_NO_NATIVE_TOKEN as readonly string[]).includes(\n caipChainId,\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/utils/batch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAC5C,MAAM,EAAE,YAAY,EAAE,EACtB,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACnC,YAAY,EAAE,EAAE,CAUlB;AAED;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,EAC3D,MAAM,EACN,SAAS,EACT,SAAS,EACT,aAAa,GACd,EAAE;IACD,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,CACT,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,EAC9B,KAAK,EAAE,KAAK,EAAE,EACd,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC,MAAM,CAAC,CAUlB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/utils/batch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAsB,EACtB,EAAE,SAAS,EAAyB;IAEpC,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,OAAO,GAAqB,EAAE,CAAC;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;QAClD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAgB,EAC3D,MAAM,EACN,SAAS,EACT,SAAS,EACT,aAAa,GAUd;IACC,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IACzD,IAAI,aAAa,GAAG,aAAa,CAAC;IAClC,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QAC/C,aAAa,GAAG,MAAM,SAAS,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;IACD,6EAA6E;IAC7E,6BAA6B;IAC7B,MAAM,WAAW,GAAG,aAAuB,CAAC;IAC5C,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Divides an array into batches of specified size.\n *\n * @param values - Array of values to divide.\n * @param options - Options containing batchSize.\n * @param options.batchSize - The size of each batch.\n * @returns Array of batches.\n */\nexport function divideIntoBatches<ArrayElement>(\n values: ArrayElement[],\n { batchSize }: { batchSize: number },\n): ArrayElement[][] {\n if (batchSize <= 0) {\n throw new Error('batchSize must be greater than 0');\n }\n\n const batches: ArrayElement[][] = [];\n for (let i = 0; i < values.length; i += batchSize) {\n batches.push(values.slice(i, i + batchSize));\n }\n return batches;\n}\n\n/**\n * Reduces an array in serial batches, applying an async function to each batch.\n *\n * @param options - The options for batch reduction.\n * @param options.values - Array of values to process.\n * @param options.batchSize - Size of each batch.\n * @param options.eachBatch - Async function to apply to each batch.\n * @param options.initialResult - Initial result value.\n * @returns The final reduced result.\n */\nexport async function reduceInBatchesSerially<Value, Result>({\n values,\n batchSize,\n eachBatch,\n initialResult,\n}: {\n values: Value[];\n batchSize: number;\n eachBatch: (\n workingResult: Partial<Result>,\n batch: Value[],\n index: number,\n ) => Partial<Result> | Promise<Partial<Result>>;\n initialResult: Partial<Result>;\n}): Promise<Result> {\n const batches = divideIntoBatches(values, { batchSize });\n let workingResult = initialResult;\n for (const [index, batch] of batches.entries()) {\n workingResult = await eachBatch(workingResult, batch, index);\n }\n // There's no way around this — we have to assume that in the end, the result\n // matches the intended type.\n const finalResult = workingResult as Result;\n return finalResult;\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { divideIntoBatches, reduceInBatchesSerially } from './batch.js';
|
|
2
|
-
export { chainIdToHex, weiToHumanReadable } from './parsing.js';
|
|
3
|
-
export { getStakingContractAddress, getSupportedStakingChainIds, isStakingContractAssetId, STAKING_CONTRACT_ADDRESS_BY_CHAINID, } from './staking-contracts.js';
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,mCAAmC,GACpC,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { divideIntoBatches, reduceInBatchesSerially } from './batch.js';
|
|
2
|
-
export { chainIdToHex, weiToHumanReadable } from './parsing.js';
|
|
3
|
-
export { getStakingContractAddress, getSupportedStakingChainIds, isStakingContractAssetId, STAKING_CONTRACT_ADDRESS_BY_CHAINID, } from './staking-contracts.js';
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,mCAAmC,GACpC,MAAM,wBAAwB,CAAC","sourcesContent":["export { divideIntoBatches, reduceInBatchesSerially } from './batch.js';\nexport { chainIdToHex, weiToHumanReadable } from './parsing.js';\nexport {\n getStakingContractAddress,\n getSupportedStakingChainIds,\n isStakingContractAssetId,\n STAKING_CONTRACT_ADDRESS_BY_CHAINID,\n} from './staking-contracts.js';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parsing.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/utils/parsing.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,MAAM,CAKR;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG,GAAG,CAShE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parsing.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/utils/parsing.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAIxD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAChC,GAAoB,EACpB,QAAgB;IAEhB,MAAM,MAAM,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9D,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC7C,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC;AACxC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,OAA8B;IACzD,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,EAAE,SAAS,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,WAAW,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import {\n isCaipChainId,\n isStrictHexString,\n numberToHex,\n parseCaipChainId,\n} from '@metamask/utils';\nimport type { CaipChainId, Hex } from '@metamask/utils';\nimport { BigNumber as BigNumberJS } from 'bignumber.js';\n\nimport type { ChainId } from '../types/index.js';\n\n/**\n * Convert wei to human-readable amount with decimals, trim trailing zeros.\n * Uses BigNumber for precision.\n *\n * Note: `.shiftedBy(-decimals).toFixed()` (no args) rounds to DECIMAL_PLACES (0\n * by default in bignumber.js), producing integers (e.g. 1.5 ETH → \"2\").\n * We use `.toFixed(decimals)` to preserve fractional precision, then trim\n * trailing zeros so the result is e.g. \"1.5\" instead of \"1.500000000000000000\".\n *\n * @param wei - Balance in wei as bigint or decimal string.\n * @param decimals - Token decimals (e.g. 18).\n * @returns Human-readable amount string (e.g. \"1.5\").\n */\nexport function weiToHumanReadable(\n wei: string | bigint,\n decimals: number,\n): string {\n const weiStr = typeof wei === 'bigint' ? wei.toString() : wei;\n const fixed = new BigNumberJS(weiStr).shiftedBy(-decimals).toFixed(decimals);\n const trimmed = fixed.replace(/\\.?0+$/u, '');\n return trimmed === '' ? '0' : trimmed;\n}\n\n/**\n * Normalize chain ID to hex for contract lookup (e.g. eip155:1 -> 0x1).\n * Uses @metamask/utils for CAIP parsing.\n *\n * @param chainId - CAIP-2 or hex chain ID.\n * @returns Hex chain ID for contract map lookup.\n */\nexport function chainIdToHex(chainId: ChainId | CaipChainId): Hex {\n if (isStrictHexString(chainId)) {\n return chainId;\n }\n if (isCaipChainId(chainId)) {\n const { reference } = parseCaipChainId(chainId);\n return numberToHex(parseInt(reference, 10));\n }\n return chainId;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staking-contracts.d.ts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/utils/staking-contracts.ts"],"names":[],"mappings":"AAUA,uEAAuE;AACvE,eAAO,MAAM,mCAAmC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGtE,CAAC;AAmBF;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,EAAE,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG7E;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAajE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staking-contracts.js","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/utils/staking-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE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,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;IACpD,MAAM,cAAc,GAAG,yBAAyB,CAC9C,MAAM,CAAC,OAAO,CACf,EAAE,WAAW,EAAE,CAAC;IACjB,OAAO,cAAc,KAAK,SAAS,IAAI,OAAO,KAAK,cAAc,CAAC;AACpE,CAAC","sourcesContent":["import { convertHexToDecimal } from '@metamask/controller-utils';\nimport {\n isCaipAssetType,\n isCaipChainId,\n isStrictHexString,\n KnownCaipNamespace,\n parseCaipAssetType,\n toCaipChainId,\n} from '@metamask/utils';\n\n/** Staking contract addresses by CAIP-2 chain ID (e.g. \"eip155:1\"). */\nexport const STAKING_CONTRACT_ADDRESS_BY_CHAINID: Record<string, string> = {\n 'eip155:1': '0x4fef9d741011476750a243ac70b9789a63dd47df', // Mainnet\n 'eip155:560048': '0xe96ac18cfe5a7af8fe1fe7bc37ff110d88bc67ff', // Hoodi (0x88bb0)\n};\n\n/**\n * Normalize chain ID to CAIP-2 for lookup (e.g. \"0x1\" -> \"eip155:1\").\n * Uses @metamask/utils for CAIP parsing.\n *\n * @param chainId - Hex chain ID (e.g. \"0x1\") or CAIP-2 (e.g. \"eip155:1\").\n * @returns CAIP-2 chain ID.\n */\nfunction toCaip2ChainId(chainId: string): string {\n if (isCaipChainId(chainId)) {\n return chainId;\n }\n const reference = isStrictHexString(chainId)\n ? convertHexToDecimal(chainId).toString()\n : chainId;\n return toCaipChainId(KnownCaipNamespace.Eip155, reference);\n}\n\n/**\n * Returns the set of CAIP-2 chain IDs that have a known staking contract.\n *\n * @returns Array of CAIP-2 chain IDs.\n */\nexport function getSupportedStakingChainIds(): string[] {\n return Object.keys(STAKING_CONTRACT_ADDRESS_BY_CHAINID);\n}\n\n/**\n * Returns the staking contract address for a chain, or undefined if not supported.\n *\n * @param chainId - Hex chain ID (e.g. \"0x1\") or CAIP-2 (e.g. \"eip155:1\").\n * @returns Contract address (checksummed as stored) or undefined.\n */\nexport function getStakingContractAddress(chainId: string): string | undefined {\n const caip2 = toCaip2ChainId(chainId);\n return STAKING_CONTRACT_ADDRESS_BY_CHAINID[caip2];\n}\n\n/**\n * Returns true if the CAIP-19 asset ID is for a known staking contract.\n * Used to skip fetching metadata for staking contracts from the tokens API.\n * Uses @metamask/utils parseCaipAssetType for CAIP-19 parsing.\n *\n * @param assetId - CAIP-19 asset ID (e.g. \"eip155:1/erc20:0x4fef9d741011476750a243ac70b9789a63dd47df\").\n * @returns True if the asset is a staking contract.\n */\nexport function isStakingContractAssetId(assetId: string): boolean {\n if (!isCaipAssetType(assetId)) {\n return false;\n }\n const parsed = parseCaipAssetType(assetId);\n if (parsed.assetNamespace !== 'erc20') {\n return false;\n }\n const address = parsed.assetReference.toLowerCase();\n const stakingAddress = getStakingContractAddress(\n parsed.chainId,\n )?.toLowerCase();\n return stakingAddress !== undefined && address === stakingAddress;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data-sources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,qBAAqB,EACrB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,mCAAmC,GACzC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACnC,KAAK,sCAAsC,GAC5C,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,GACnC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EAErB,kBAAkB,EAElB,iBAAiB,EACjB,uBAAuB,EAEvB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,GACjC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,uBAAuB,EACvB,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,GACpC,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { AbstractDataSource, } from './AbstractDataSource.js';
|
|
2
|
-
export { AccountsApiDataSource, } from './AccountsApiDataSource.js';
|
|
3
|
-
export { AccountActivityDataSource, createAccountActivityDataSource, } from './AccountActivityDataSource.js';
|
|
4
|
-
export { RpcDataSource, createRpcDataSource, } from './RpcDataSource.js';
|
|
5
|
-
export { TokenDataSource, } from './TokenDataSource.js';
|
|
6
|
-
export { PriceDataSource, } from './PriceDataSource.js';
|
|
7
|
-
// Unified Snap Data Source (dynamically discovers keyring snaps via PermissionController)
|
|
8
|
-
export { SnapDataSource, createSnapDataSource, SNAP_DATA_SOURCE_NAME,
|
|
9
|
-
// Constants
|
|
10
|
-
KEYRING_PERMISSION,
|
|
11
|
-
// Utility functions
|
|
12
|
-
getChainIdsCaveat, extractChainFromAssetId, } from './SnapDataSource.js';
|
|
13
|
-
export { StakedBalanceDataSource, } from './StakedBalanceDataSource.js';
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-sources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,GAGnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,qBAAqB,GAKtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,yBAAyB,EACzB,+BAA+B,GAIhC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,aAAa,EACb,mBAAmB,GAOpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,eAAe,GAGhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,eAAe,GAGhB,MAAM,sBAAsB,CAAC;AAE9B,0FAA0F;AAC1F,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB;AACrB,YAAY;AACZ,kBAAkB;AAClB,oBAAoB;AACpB,iBAAiB,EACjB,uBAAuB,GAMxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,uBAAuB,GAGxB,MAAM,8BAA8B,CAAC","sourcesContent":["export {\n AbstractDataSource,\n type DataSourceState,\n type SubscriptionRequest,\n} from './AbstractDataSource.js';\n\nexport {\n AccountsApiDataSource,\n type AccountsApiDataSourceConfig,\n type AccountsApiDataSourceOptions,\n type AccountsApiDataSourceState,\n type AccountsApiDataSourceAllowedActions,\n} from './AccountsApiDataSource.js';\n\nexport {\n AccountActivityDataSource,\n createAccountActivityDataSource,\n type AccountActivityDataSourceOptions,\n type AccountActivityDataSourceState,\n type AccountActivityDataSourceAllowedEvents,\n} from './AccountActivityDataSource.js';\n\nexport {\n RpcDataSource,\n createRpcDataSource,\n type RpcDataSourceConfig,\n type RpcDataSourceOptions,\n type RpcDataSourceState,\n type RpcDataSourceAllowedActions,\n type RpcDataSourceAllowedEvents,\n type ChainStatus,\n} from './RpcDataSource.js';\n\nexport {\n TokenDataSource,\n type TokenDataSourceOptions,\n type TokenDataSourceAllowedActions,\n} from './TokenDataSource.js';\n\nexport {\n PriceDataSource,\n type PriceDataSourceConfig,\n type PriceDataSourceOptions,\n} from './PriceDataSource.js';\n\n// Unified Snap Data Source (dynamically discovers keyring snaps via PermissionController)\nexport {\n SnapDataSource,\n createSnapDataSource,\n SNAP_DATA_SOURCE_NAME,\n // Constants\n KEYRING_PERMISSION,\n // Utility functions\n getChainIdsCaveat,\n extractChainFromAssetId,\n // Types\n type SnapDataSourceState,\n type SnapDataSourceOptions,\n type SnapDataSourceAllowedActions,\n type SnapDataSourceAllowedEvents,\n} from './SnapDataSource.js';\n\nexport {\n StakedBalanceDataSource,\n type StakedBalanceDataSourceConfig,\n type StakedBalanceDataSourceOptions,\n} from './StakedBalanceDataSource.js';\n"]}
|
package/dist/defaults.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,OAAO,EAER,MAAM,YAAY,CAAC;AAoDpB;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B,EAAE,WAAW,CACvD,OAAO,EACP,SAAS,aAAa,EAAE,CAMxB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kCAAkC,EAAE,WAAW,CAAC,OAAO,CAEnE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAMlE,CAAC;AAEL;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,OAAO,GACf,SAAS,aAAa,EAAE,CAE1B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,aAAa,GACrB,aAAa,GAAG,SAAS,CAE3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,CAW7E"}
|
package/dist/defaults.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,MAAM,YAAY,GAAG,4CAA4C,CAAC;AAElE;;;;GAIG;AACH,MAA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,CAC7C,OAAgB;IAEhB,OAAO,+BAA+B,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAsB;IAEtB,OAAO,sBAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,IAAI,GAAyC,EAAE,CAAC;IACtD,KAAK,MAAM,QAAQ,IAAI,+BAA+B,CAAC,MAAM,EAAE,EAAE,CAAC;QAChE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,QAAQ,GAAG,sBAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrD,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type {\n AssetMetadata,\n Caip19AssetId,\n ChainId,\n FungibleAssetMetadata,\n} from './types.js';\n\n/**\n * EIP-55 checksummed address of MetaMask USD (mUSD) — same canonical contract\n * address across every chain we deploy it to.\n *\n * Must be checksummed so that the CAIP-19 asset IDs produced by\n * `musdAssetId()` (and therefore the keys seeded into `assetsInfo` by\n * `buildDefaultAssetsInfo()`) match the keys written by data sources, which\n * always pass IDs through `normalizeAssetId` → `toChecksumAddress` before\n * emitting a `DataResponse`. Using a lowercase address would cause the\n * pre-seeded keys to diverge from the data-source keys, leaving a duplicate\n * entry in `assetsInfo` after the first balance or token-data poll.\n */\nconst MUSD_ADDRESS = '0xacA92E438df0B2401fF60dA7E4337B687a2435DA';\n\n/**\n * Hardcoded metadata for MetaMask USD. Pre-seeding this in default\n * state makes the token immediately renderable in the UI before any\n * on-chain balance has been fetched.\n */\nconst MUSD_METADATA: FungibleAssetMetadata = {\n type: 'erc20',\n symbol: 'mUSD',\n name: 'MetaMask USD',\n decimals: 6,\n};\n\n/**\n * Arc's native USDC also exists as its own ERC20 (`0x3600...`); Accounts API\n * resolves that identity without ever seeding native `assetsInfo` metadata.\n */\nconst ARC_NATIVE_ASSET_ID = 'eip155:5042/slip44:5042';\n\nconst ARC_NATIVE_METADATA: FungibleAssetMetadata = {\n type: 'native',\n symbol: 'USDC',\n name: 'USDC',\n decimals: 18,\n};\n\n/**\n * Build the CAIP-19 asset ID for the mUSD ERC-20 token on a given EVM\n * chain.\n *\n * @param chainId - The CAIP-2 chain identifier (e.g. `eip155:1`).\n * @returns The CAIP-19 asset ID for mUSD on that chain.\n */\nfunction musdAssetId(chainId: ChainId): Caip19AssetId {\n return `${chainId}/erc20:${MUSD_ADDRESS}` as Caip19AssetId;\n}\n\n/**\n * Default tracked tokens — assets the controller surfaces in state for\n * every account on the listed chain even when the on-chain balance is\n * still zero. Keyed by CAIP-2 chain id.\n *\n * To extend mUSD coverage to a new chain, add an entry here. To add a\n * different default token, append its CAIP-19 asset id to the\n * appropriate chain entry and provide its metadata in\n * {@link DEFAULT_ASSET_METADATA}.\n */\nexport const DEFAULT_TRACKED_ASSETS_BY_CHAIN: ReadonlyMap<\n ChainId,\n readonly Caip19AssetId[]\n> = new Map<ChainId, readonly Caip19AssetId[]>([\n ['eip155:1' as ChainId, [musdAssetId('eip155:1' as ChainId)]],\n ['eip155:59144' as ChainId, [musdAssetId('eip155:59144' as ChainId)]],\n ['eip155:143' as ChainId, [musdAssetId('eip155:143' as ChainId)]],\n ['eip155:5042' as ChainId, [ARC_NATIVE_ASSET_ID]],\n]);\n\n/**\n * Chains that have at least one default tracked asset. Useful for\n * quickly answering \"should we seed defaults for this chain?\".\n */\nexport const CHAINS_WITH_DEFAULT_TRACKED_ASSETS: ReadonlySet<ChainId> = new Set(\n DEFAULT_TRACKED_ASSETS_BY_CHAIN.keys(),\n);\n\n/**\n * Pre-seeded metadata for every default tracked asset, keyed by the\n * checksummed CAIP-19 id. All callers must pass a checksummed asset ID;\n * use `normalizeAssetId` to ensure the correct format before looking up.\n */\nexport const DEFAULT_ASSET_METADATA: ReadonlyMap<string, AssetMetadata> =\n new Map<string, AssetMetadata>([\n [musdAssetId('eip155:1' as ChainId), MUSD_METADATA],\n [musdAssetId('eip155:59144' as ChainId), MUSD_METADATA],\n [musdAssetId('eip155:143' as ChainId), MUSD_METADATA],\n [ARC_NATIVE_ASSET_ID, ARC_NATIVE_METADATA],\n ]);\n\n/**\n * Return the default tracked assets for a CAIP-2 chain id. Empty when\n * the chain has no defaults.\n *\n * @param chainId - CAIP-2 chain id to look up.\n * @returns The default asset ids for that chain.\n */\nexport function getDefaultTrackedAssetsForChain(\n chainId: ChainId,\n): readonly Caip19AssetId[] {\n return DEFAULT_TRACKED_ASSETS_BY_CHAIN.get(chainId) ?? [];\n}\n\n/**\n * Look up pre-seeded metadata for a default tracked asset.\n *\n * @param assetId - CAIP-19 asset id (must be EIP-55 checksummed for EVM tokens).\n * @returns The metadata if the asset is a default tracked asset,\n * otherwise `undefined`.\n */\nexport function getDefaultAssetMetadata(\n assetId: Caip19AssetId,\n): AssetMetadata | undefined {\n return DEFAULT_ASSET_METADATA.get(assetId);\n}\n\n/**\n * Build the `assetsInfo` map to use in default controller state —\n * pre-populated with metadata for every default tracked asset across\n * every default tracked chain. This is what makes `assetsInfo[mUSD]`\n * exist from the very first render, before any RPC poll completes.\n *\n * @returns A new map keyed by CAIP-19 id (canonical case from the\n * defaults registry) with the corresponding metadata.\n */\nexport function buildDefaultAssetsInfo(): Record<Caip19AssetId, AssetMetadata> {\n const info: Record<Caip19AssetId, AssetMetadata> = {};\n for (const assetIds of DEFAULT_TRACKED_ASSETS_BY_CHAIN.values()) {\n for (const assetId of assetIds) {\n const metadata = DEFAULT_ASSET_METADATA.get(assetId);\n if (metadata) {\n info[assetId] = metadata;\n }\n }\n }\n return info;\n}\n"]}
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,qDAAqD;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B,mDAAmD;IACnD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B;;;;;OAKG;IACH,YAAY,OAAO,EAAE;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,EAQA;CACF"}
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAU9C;;;;;OAKG;IACH,YAAY,OAIX;QACC,KAAK,CACH,2CAA2C,OAAO,CAAC,UAAU,MAAM,OAAO,CAAC,aAAa,EAAE,CAC3F,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,CAAC;CACF","sourcesContent":["/**\n * Thrown and/or passed to `captureException` when one or more assets data\n * source middlewares fail during a fetch. Use Sentry's \"error type\" / title\n * filter on `AssetsDataSourceError` to build issue alerts.\n */\nexport class AssetsDataSourceError extends Error {\n /** Comma-separated data source names that failed. */\n readonly failedSources: string;\n\n /** Number of failed middlewares in the request. */\n readonly errorCount: number;\n\n /** Chains included in the request (for context). */\n readonly chainCount: number;\n\n /**\n * @param details - Which sources failed and request size hints.\n * @param details.failedSources - Comma-separated data source names that failed.\n * @param details.errorCount - Number of failed middlewares in the request.\n * @param details.chainCount - Chains included in the request (for context).\n */\n constructor(details: {\n failedSources: string;\n errorCount: number;\n chainCount: number;\n }) {\n super(\n `Assets data source middleware failures (${details.errorCount}): ${details.failedSources}`,\n );\n this.name = 'AssetsDataSourceError';\n this.failedSources = details.failedSources;\n this.errorCount = details.errorCount;\n this.chainCount = details.chainCount;\n }\n}\n"]}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,sBAAsB,EACtB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EACL,gCAAgC,EAChC,iCAAiC,EACjC,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EACtB,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAGvF,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,mCAAmC,EACnC,iCAAiC,EACjC,mCAAmC,EACnC,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,+BAA+B,EAC/B,sCAAsC,EACtC,sCAAsC,EACtC,yCAAyC,EACzC,2CAA2C,EAC3C,6CAA6C,EAC7C,oCAAoC,EACpC,oCAAoC,EACpC,uCAAuC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BAAmB,EACnB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE3E,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,sCAAsC,EACtC,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,sBAAsB,EACtB,yBAAyB,EACzB,kCAAkC,EAClC,kCAAkC,EAClC,WAAW,EACX,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,6BAA6B,EAC7B,qCAAqC,EACrC,8BAA8B,EAC9B,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,EACtB,2BAA2B,EAC3B,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GACd,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,sBAAsB,EACtB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,eAAe,CAAC;AAGvB,4CAA4C;AAC5C,OAAO,EACL,gCAAgC,EAChC,iCAAiC,EACjC,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EACtB,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,mCAAmC,CAAC;AAwF3C,sCAAsC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAO7D,6BAA6B;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAQhE,qBAAqB;AACrB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAS7E,gFAAgF;AAChF,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB;AACrB,YAAY;AACZ,kBAAkB;AAClB,oBAAoB;AACpB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAOjC,0BAA0B;AAC1B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAQ3E,cAAc;AACd,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAMhC,YAAY;AACZ,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAU1B,YAAY;AACZ,OAAO,EACL,6BAA6B,EAC7B,qCAAqC,EACrC,8BAA8B,EAC9B,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC","sourcesContent":["// Main controller export\nexport {\n AssetsController,\n getDefaultAssetsControllerState,\n} from './AssetsController.js';\nexport { AssetsDataSourceError } from './errors.js';\nexport {\n DEFAULT_TRACKED_ASSETS_BY_CHAIN,\n CHAINS_WITH_DEFAULT_TRACKED_ASSETS,\n DEFAULT_ASSET_METADATA,\n buildDefaultAssetsInfo,\n getDefaultTrackedAssetsForChain,\n getDefaultAssetMetadata,\n} from './defaults.js';\nexport type { PendingTokenMetadata } from './AssetsController.js';\n\n// Snaps → AssetsController assets migration\nexport {\n SNAPS_ASSETS_MIGRATION_FLAG_KEYS,\n SNAPS_ASSETS_MIGRATION_NAMESPACES,\n SnapsAssetsMigrationStage,\n getSnapsAssetsMigrationNamespace,\n isMigrationStageActive,\n isSnapsAssetsMigrationNamespace,\n parseSnapsAssetsMigrationStage,\n} from './utils/snaps-assets-migration.js';\nexport type { SnapsAssetsMigrationNamespace } from './utils/snaps-assets-migration.js';\n\n// State and messenger types\nexport type {\n AssetsControllerState,\n AssetsControllerMessenger,\n AssetsControllerOptions,\n AssetsControllerGetStateAction,\n AssetsControllerActions,\n AssetsControllerStateChangeEvent,\n AssetsControllerBalanceChangedEvent,\n AssetsControllerPriceChangedEvent,\n AssetsControllerAssetsDetectedEvent,\n AssetsControllerEvents,\n} from './AssetsController.js';\nexport type {\n AssetsControllerGetAssetsAction,\n AssetsControllerGetAssetsBalanceAction,\n AssetsControllerGetAssetMetadataAction,\n AssetsControllerGetAccountAssetByIDAction,\n AssetsControllerGetAccountAssetsByIDsAction,\n AssetsControllerGetAccountAssetsByScopeAction,\n AssetsControllerGetAssetsPriceAction,\n AssetsControllerAddCustomAssetAction,\n AssetsControllerRemoveCustomAssetAction,\n AssetsControllerGetCustomAssetsAction,\n AssetsControllerHideAssetAction,\n AssetsControllerUnhideAssetAction,\n AssetsControllerGetExchangeRatesForBridgeAction,\n AssetsControllerGetStateForTransactionPayAction,\n AssetsControllerSetSelectedCurrencyAction,\n} from './AssetsController-method-action-types.js';\n\n// Core types\nexport type {\n // CAIP types\n Caip19AssetId,\n AccountId,\n ChainId,\n // Asset types\n AssetType,\n TokenStandard,\n // Contract data types\n TokenFees,\n HoneypotStatus,\n StorageSlots,\n LocalizedDescription,\n // Metadata types\n BaseAssetMetadata,\n FungibleAssetMetadata,\n ERC721AssetMetadata,\n ERC1155AssetMetadata,\n AssetMetadata,\n // Price types\n BaseAssetPrice,\n FungibleAssetPrice,\n NFTAssetPrice,\n AssetPrice,\n // Balance types\n FungibleAssetBalance,\n ERC721AssetBalance,\n ERC1155AssetBalance,\n AssetBalance,\n // Data source types\n AccountWithSupportedChains,\n DataType,\n DataRequest,\n DataResponse,\n AssetsUpdateMode,\n // Middleware types\n Context,\n NextFunction,\n Middleware,\n AssetsDataSource,\n FetchContext,\n FetchNextFunction,\n FetchMiddleware,\n SubscriptionResponse,\n // Combined asset type\n Asset,\n // Event types\n BalanceChangeEvent,\n PriceChangeEvent,\n MetadataChangeEvent,\n AssetsDetectedEvent,\n} from './types.js';\n\n// Data sources - base class and types\nexport { AbstractDataSource } from './data-sources/index.js';\n\nexport type {\n DataSourceState,\n SubscriptionRequest,\n} from './data-sources/index.js';\n\n// Data sources - AccountsApi\nexport { AccountsApiDataSource } from './data-sources/index.js';\n\nexport type {\n AccountsApiDataSourceConfig,\n AccountsApiDataSourceOptions,\n AccountsApiDataSourceState,\n} from './data-sources/index.js';\n\n// Data sources - RPC\nexport { RpcDataSource, createRpcDataSource } from './data-sources/index.js';\n\nexport type {\n RpcDataSourceConfig,\n RpcDataSourceOptions,\n RpcDataSourceState,\n ChainStatus,\n} from './data-sources/index.js';\n\n// Data sources - Unified Snap Data Source (dynamically discovers keyring snaps)\nexport {\n SnapDataSource,\n createSnapDataSource,\n SNAP_DATA_SOURCE_NAME,\n // Constants\n KEYRING_PERMISSION,\n // Utility functions\n getChainIdsCaveat,\n extractChainFromAssetId,\n} from './data-sources/index.js';\n\nexport type {\n SnapDataSourceState,\n SnapDataSourceOptions,\n} from './data-sources/index.js';\n\n// Enrichment data sources\nexport { TokenDataSource, PriceDataSource } from './data-sources/index.js';\n\nexport type {\n TokenDataSourceOptions,\n PriceDataSourceConfig,\n PriceDataSourceOptions,\n} from './data-sources/index.js';\n\n// Middlewares\nexport {\n CustomAssetGraduationMiddleware,\n DetectionMiddleware,\n RpcFallbackMiddleware,\n} from './middlewares/index.js';\nexport type {\n CustomAssetGraduationMiddlewareOptions,\n RpcFallbackMiddlewareOptions,\n} from './middlewares/index.js';\n\n// Utilities\nexport {\n normalizeAssetId,\n formatExchangeRatesForBridge,\n formatStateForTransactionPay,\n} from './utils/index.js';\nexport type {\n AccountForLegacyFormat,\n BridgeExchangeRatesFormat,\n FormatExchangeRatesForBridgeParams,\n FormatStateForTransactionPayParams,\n LegacyToken,\n TransactionPayLegacyFormat,\n} from './utils/index.js';\n\n// Selectors\nexport {\n calculateBalanceForAllWallets,\n calculateBalanceChangeForAccountGroup,\n getAggregatedBalanceForAccount,\n getGroupIdForAccount,\n getInternalAccountsForGroup,\n} from './selectors/balance.js';\n\nexport type {\n AccountGroupBalance,\n AccountsById,\n AggregatedBalanceEntry,\n AggregatedBalanceForAccount,\n AllWalletsBalance,\n BalanceChangePeriod,\n BalanceChangeResult,\n EnabledNetworkMap,\n WalletBalance,\n} from './selectors/balance.js';\n"]}
|
package/dist/logger.d.ts
DELETED
package/dist/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,eAAO,MAAM,aAAa,0BAA2C,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/logger.js
DELETED
package/dist/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { createProjectLogger, createModuleLogger } from '@metamask/utils';\n\nexport const projectLogger = createProjectLogger('assets-controller');\n\nexport { createModuleLogger };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomAssetGraduationMiddleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/CustomAssetGraduationMiddleware.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EAET,aAAa,EACb,UAAU,EACX,MAAM,aAAa,CAAC;AAOrB,MAAM,MAAM,sCAAsC,GAAG;IACnD,oBAAoB,EAAE,MAAM,SAAS,GAAG,SAAS,CAAC;IAClD,iBAAiB,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3E,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,+BAA+B;;IAC1C,QAAQ,CAAC,IAAI,qCAAmB;IAShC,YAAY,OAAO,EAAE,sCAAsC,EAG1D;IAED,OAAO,IAAI,MAAM,CAEhB;IAED,IAAI,gBAAgB,IAAI,UAAU,CAkDjC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomAssetGraduationMiddleware.js","sourceRoot":"","sources":["../../src/middlewares/CustomAssetGraduationMiddleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,eAAe,GAAG,iCAAiC,CAAC;AAE1D,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AAO/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,+BAA+B;IAU1C,YAAY,OAA+C;QATlD,SAAI,GAAG,eAAe,CAAC;QAEvB,wEAAmD;QAEnD,qEAGC;QAGR,uBAAA,IAAI,yDAAyB,OAAO,CAAC,oBAAoB,MAAA,CAAC;QAC1D,uBA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,EAAE,CAAC;oBAC9B,SAAS;gBACX,CAAC;gBACD,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;oBACtD,SAAS;gBACX,CAAC;gBACD,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;gBAC3D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC;oBACtC,SAAS;gBACX,CAAC;gBACD,GAAG,CAAC,yBAAyB,EAAE;oBAC7B,SAAS;oBACT,OAAO,EAAE,iBAAiB;iBAC3B,CAAC,CAAC;gBACH,uBAAA,IAAI,0DAAmB,MAAvB,IAAI,EAAoB,SAAS,EAAE,iBAAiB,CAAC,CAAC;YACxD,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;;AAED;;;;;GAKG;AACH,SAAS,YAAY,CAAC,OAAsB;IAC1C,qEAAqE;IACrE,oEAAoE;IACpE,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,SAAS,KAAK,kBAAkB,CAAC,MAAM,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,kBAAkB,CAAC,OAAiC;IAC3D,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import { KnownCaipNamespace } from '@metamask/utils';\n\nimport { projectLogger, createModuleLogger } from '../logger.js';\nimport { forDataTypes } from '../types.js';\nimport type {\n AccountId,\n AssetBalance,\n Caip19AssetId,\n Middleware,\n} from '../types.js';\nimport { safeNormalizeAssetId } from '../utils/index.js';\n\nconst CONTROLLER_NAME = 'CustomAssetGraduationMiddleware';\n\nconst log = createModuleLogger(projectLogger, CONTROLLER_NAME);\n\nexport type CustomAssetGraduationMiddlewareOptions = {\n getSelectedAccountId: () => AccountId | undefined;\n removeCustomAsset: (accountId: AccountId, assetId: Caip19AssetId) => void;\n};\n\n/**\n * CustomAssetGraduationMiddleware removes EVM assets from `customAssets` when\n * an upstream balance source (AccountsAPI / Websocket) reports a non-zero\n * balance for them. Once a detector sees the asset with a real balance, it\n * no longer needs to be tracked as \"custom\" — the regular detection flow\n * will keep it fresh.\n *\n * Rules:\n * - Only the selected account's custom assets are considered. Switching the\n * selected account triggers a fresh fetch, which re-runs graduation\n * against the new account's balances.\n * - Only EVM (CAIP-2 namespace `eip155`) assets graduate. Non-EVM custom\n * assets (Solana, BTC, Tron, etc. — served by Snap data sources) are left\n * alone.\n * - Only positive balances graduate. A zero balance from AccountsAPI means\n * the API knows about the token but the user does not currently hold it;\n * keeping it in `customAssets` ensures RPC keeps polling so a future\n * incoming transfer is reflected promptly.\n */\nexport class CustomAssetGraduationMiddleware {\n readonly name = CONTROLLER_NAME;\n\n readonly #getSelectedAccountId: () => AccountId | undefined;\n\n readonly #removeCustomAsset: (\n accountId: AccountId,\n assetId: Caip19AssetId,\n ) => void;\n\n constructor(options: CustomAssetGraduationMiddlewareOptions) {\n this.#getSelectedAccountId = options.getSelectedAccountId;\n this.#removeCustomAsset = options.removeCustomAsset;\n }\n\n getName(): string {\n return this.name;\n }\n\n get assetsMiddleware(): Middleware {\n return forDataTypes(['balance'], async (ctx, next) => {\n // Inspect the response BEFORE calling next() so we only consider\n // balances populated by upstream middleware (AccountsApi / Websocket /\n // Staked). This middleware is positioned in the pipeline before the\n // RPC fallback — RPC intentionally carries custom assets and must\n // never trigger graduation.\n const accountId = this.#getSelectedAccountId();\n if (!accountId) {\n return next(ctx);\n }\n\n const state = ctx.getAssetsState();\n const customForAccount = state.customAssets?.[accountId] ?? [];\n if (customForAccount.length === 0) {\n return next(ctx);\n }\n\n const returnedBalances = ctx.response.assetsBalance?.[accountId] ?? {};\n const returnedAssetIds = Object.keys(returnedBalances) as Caip19AssetId[];\n if (returnedAssetIds.length === 0) {\n return next(ctx);\n }\n\n // customAssets state is stored with checksummed/normalized asset IDs.\n // AccountsApiDataSource normalizes its response IDs, but\n // AccountActivityDataSource does not — so we normalize the response\n // side here to make the comparison robust to lower-case addresses\n // delivered over the websocket.\n const customSet = new Set(customForAccount);\n for (const rawAssetId of returnedAssetIds) {\n if (!isEvmAssetId(rawAssetId)) {\n continue;\n }\n if (!hasPositiveBalance(returnedBalances[rawAssetId])) {\n continue;\n }\n const normalizedAssetId = safeNormalizeAssetId(rawAssetId);\n if (!customSet.has(normalizedAssetId)) {\n continue;\n }\n log('Graduating custom asset', {\n accountId,\n assetId: normalizedAssetId,\n });\n this.#removeCustomAsset(accountId, normalizedAssetId);\n }\n\n return next(ctx);\n });\n }\n}\n\n/**\n * Check whether a CAIP-19 asset ID belongs to an EVM chain.\n *\n * @param assetId - The CAIP-19 asset ID to inspect.\n * @returns `true` when the asset's chain namespace is `eip155`.\n */\nfunction isEvmAssetId(assetId: Caip19AssetId): boolean {\n // CAIP-19 format: <namespace>:<chainRef>/<assetNamespace>:<assetRef>\n // The chain namespace is always the segment before the first colon.\n const namespace = assetId.split(':')[0];\n return namespace === KnownCaipNamespace.Eip155;\n}\n\n/**\n * Whether a balance entry reports a strictly positive amount. AccountsAPI\n * may return zero for tokens it indexes but the user no longer holds; we\n * treat those as non-graduating so RPC keeps polling and surfaces any\n * future incoming transfer immediately.\n *\n * `AssetBalance.amount` is already a human-readable decimal string from\n * both AccountsApi (e.g. \"0.283549083429656057\") and the websocket data\n * source (which divides by `decimals` before emitting), so a `Number()`\n * sign check is safe: `NaN`, `undefined`, empty strings, and zero all\n * fail the comparison.\n *\n * @param balance - The balance entry from the response.\n * @returns `true` when the balance amount represents a value greater than 0.\n */\nfunction hasPositiveBalance(balance: AssetBalance | undefined): boolean {\n return Number(balance?.amount) > 0;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DetectionMiddleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/DetectionMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA4B,UAAU,EAAE,MAAM,aAAa,CAAC;AAgBxE;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,mBAAmB;IAC9B,QAAQ,CAAC,IAAI,yBAAmB;IAEhC,OAAO,IAAI,MAAM,CAEhB;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,gBAAgB,IAAI,UAAU,CA+HjC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DetectionMiddleware.js","sourceRoot":"","sources":["../../src/middlewares/DetectionMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAE9C,uBAAuB;AACvB,kBAAkB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AAEnD,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,mBAAmB;IAAhC;QACW,SAAI,GAAG,eAAe,CAAC;IAoJlC,CAAC;IAlJC,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,gBAAgB;QAClB,OAAO,YAAY,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YACnD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;YAElC,wEAAwE;YACxE,MAAM,KAAK,GAAG,GAAG,CAAC,cAAc,EAAE,CAAC;YACnC,MAAM,EACJ,YAAY,EAAE,iBAAi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AAiB,CAAC;YAEpD,MAAM,UAAU,GAAG,CAAC,OAAsB,EAAQ,EAAE;gBAClD,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;gBACpD,IACE,MAAM,CAAC,iBAAiB,CAAC,KAAK,SAAS;oBACvC,MAAM,CAAC,OAAO,CAAC,KAAK,SAAS,EAC7B,CAAC;oBACD,kBAAkB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC,CAAC;YAEF,KAAK,MAAM,eAAe,IAAI,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;gBAC5D,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;oBACtC,UAAU,CAAC,OAAO,CAAC,CAAC;gBACtB,CAAC;YACH,CAAC;YAED,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;gBAC3B,KAAK,MAAM,eAAe,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;oBACpE,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAC/B,eAA0C,CAC3C,EAAE,CAAC;wBACF,UAAU,CAAC,OAAwB,CAAC,CAAC;oBACvC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,IAAI,kBAAkB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBAChC,OAAO,CAAC,oBAAoB,GAAG;oBAC7B,GAAG,CAAC,OAAO,CAAC,oBAAoB,IAAI,EAAE,CAAC;oBACvC,GAAG,kBAAkB;iBACtB,CAAC;YACJ,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { projectLogger, createModuleLogger } from '../logger.js';\nimport { forDataTypes } from '../types.js';\nimport type { AccountId, Caip19AssetId, Middleware } from '../types.js';\nimport { normalizeAssetId } from '../utils/index.js';\n\n// ============================================================================\n// CONSTANTS\n// ============================================================================\n\nconst CONTROLLER_NAME = 'DetectionMiddleware';\n\n// Logger for debugging\ncreateModuleLogger(projectLogger, CONTROLLER_NAME);\n\n// ============================================================================\n// DETECTION MIDDLEWARE\n// ============================================================================\n\n/**\n * DetectionMiddleware builds the set of assets that downstream sources use for\n * metadata and price fetching.\n *\n * An asset is included in `detectedAssets` only when it is genuinely new:\n * - Assets from `response.assetsBalance` are included only if they are absent\n * from BOTH `state.assetsBalance` (never tracked before) AND `state.assetsInfo`\n * (no metadata yet). Assets already present in either collection are considered\n * known and are intentionally excluded — PriceDataSource's own subscription\n * handles periodic refreshes for those.\n * - Each account's custom assets from state are always included because they\n * may have no balance yet and are explicitly managed by the user.\n *\n * Usage:\n * ```typescript\n * const detectionMiddleware = new DetectionMiddleware();\n * const middleware = detectionMiddleware.assetsMiddleware;\n * ```\n */\nexport class DetectionMiddleware {\n readonly name = CONTROLLER_NAME;\n\n getName(): string {\n return this.name;\n }\n\n /**\n * Get the middleware that builds detectedAssets for metadata and price fetching.\n *\n * This middleware:\n * 1. Includes assets from response.assetsBalance that are absent from both\n * state.assetsBalance and state.assetsInfo (brand-new assets only)\n * 2. Always includes each account's custom assets from state\n * 3. Fills response.detectedAssets with the resulting asset IDs per account\n * 4. Queues detected assets that lack a price in state on\n * request.assetsForPriceUpdate so PriceDataSource fetches them in the same\n * pipeline pass (including the background RPC detection path)\n *\n * @returns The middleware function for the assets pipeline.\n */\n get assetsMiddleware(): Middleware {\n return forDataTypes(['balance'], async (ctx, next) => {\n const { request, response } = ctx;\n\n // Get state for custom assets, existing balances, and existing metadata\n const state = ctx.getAssetsState();\n const {\n customAssets: stateCustomAssets,\n assetsBalance: stateAssetsBalance,\n assetsInfo: stateAssetsInfo,\n assetsPrice: stateAssetsPrice,\n } = state;\n\n const detectedAssets: Record<AccountId, Caip19AssetId[]> = {};\n\n // 1. From balance response: only include assets that are genuinely new —\n // not already present in state.assetsBalance or state.assetsInfo.\n if (response.assetsBalance) {\n for (const [accountId, accountBalances] of Object.entries(\n response.assetsBalance,\n )) {\n const detected: Caip19AssetId[] = [];\n\n const stateAccountBalances = stateAssetsBalance[accountId] ?? {};\n\n for (const assetId of Object.keys(\n accountBalances as Record<string, unknown>,\n )) {\n const caipAssetId = assetId as Caip19AssetId;\n // Skip if already tracked in state balances or already has metadata\n if (\n stateAccountBalances[caipAssetId] !== undefined ||\n stateAssetsInfo[caipAssetId] !== undefined\n ) {\n continue;\n }\n detected.push(caipAssetId);\n }\n\n // Merge custom assets for this account, applying the same filter:\n // skip if already in state balance or already has metadata.\n const customForAccount = stateCustomAssets?.[accountId] ?? [];\n for (const assetId of customForAccount) {\n if (detected.includes(assetId)) {\n continue;\n }\n if (\n stateAccountBalances[assetId] !== undefined ||\n stateAssetsInfo[assetId] !== undefined\n ) {\n continue;\n }\n detected.push(assetId);\n }\n\n if (detected.length > 0) {\n detectedAssets[accountId] = detected;\n }\n }\n }\n\n // 2. Accounts in request that weren't in balance response: include their\n // custom assets that are not yet in state.\n for (const { account } of request.accountsWithSupportedChains) {\n const accountId = account.id;\n if (detectedAssets[accountId]) {\n continue;\n }\n const stateAccountBalances = stateAssetsBalance[accountId] ?? {};\n const customForAccount = stateCustomAssets?.[accountId] ?? [];\n const newCustomAssets = customForAccount.filter((assetId) => {\n const inBalance = stateAccountBalances[assetId] !== undefined;\n const inInfo = stateAssetsInfo[assetId] !== undefined;\n return !inBalance && !inInfo;\n });\n if (newCustomAssets.length > 0) {\n detectedAssets[accountId] = newCustomAssets;\n }\n }\n\n if (Object.keys(detectedAssets).length > 0) {\n response.detectedAssets = detectedAssets;\n }\n\n // Queue prices for:\n // 1) newly detected assets missing a price, and\n // 2) assets in this balance response that already exist in state but still\n // lack a price (e.g. natives seeded before the first price poll).\n // PriceDataSource filters non-priceable IDs before calling the API.\n const prices = stateAssetsPrice as Record<string, unknown>;\n const missingPriceAssets = new Set<Caip19AssetId>();\n\n const maybeQueue = (assetId: Caip19AssetId): void => {\n const normalizedAssetId = normalizeAssetId(assetId);\n if (\n prices[normalizedAssetId] === undefined &&\n prices[assetId] === undefined\n ) {\n missingPriceAssets.add(normalizedAssetId);\n }\n };\n\n for (const accountAssetIds of Object.values(detectedAssets)) {\n for (const assetId of accountAssetIds) {\n maybeQueue(assetId);\n }\n }\n\n if (response.assetsBalance) {\n for (const accountBalances of Object.values(response.assetsBalance)) {\n for (const assetId of Object.keys(\n accountBalances as Record<string, unknown>,\n )) {\n maybeQueue(assetId as Caip19AssetId);\n }\n }\n }\n\n if (missingPriceAssets.size > 0) {\n request.assetsForPriceUpdate = [\n ...(request.assetsForPriceUpdate ?? []),\n ...missingPriceAssets,\n ];\n }\n\n return next(ctx);\n });\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ParallelMiddleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/ParallelMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,OAAO,EAGP,YAAY,EACZ,UAAU,EACV,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAMrB;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,YAAY,CAsD1E;AAWD,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,IAAI,MAAM,CAAC;IAClB,gHAAgH;IAChH,mBAAmB,IAAI,OAAO,EAAE,CAAC;IACjC,gBAAgB,EAAE,UAAU,CAAC;CAC9B,CAAC;AAwDF;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG;IACzE,OAAO,IAAI,MAAM,CAAC;IAClB,gBAAgB,EAAE,UAAU,CAAC;CAC9B,CAiHA;AAWD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG;IACrE,OAAO,IAAI,MAAM,CAAC;IAClB,gBAAgB,EAAE,UAAU,CAAC;CAC9B,CAqDA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RpcFallbackMiddleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/RpcFallbackMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAGhB,UAAU,EACX,MAAM,aAAa,CAAC;AAOrB,MAAM,MAAM,4BAA4B,GAAG;IACzC,gDAAgD;IAChD,aAAa,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF;;;;;;;;;GASG;AACH,qBAAa,qBAAqB;;IAChC,QAAQ,CAAC,IAAI,2BAAmB;IAIhC,YAAY,OAAO,EAAE,4BAA4B,EAEhD;IAED,OAAO,IAAI,MAAM,CAEhB;IAED,IAAI,gBAAgB,IAAI,UAAU,CAyDjC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RpcFallbackMiddleware.js","sourceRoot":"","sources":["../../src/middlewares/RpcFallbackMiddleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEhD,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AAO/D;;;;;;;;;GASG;AACH,MAAM,OAAO,qBAAqB;IAKhC,YAAY,OAAqC;QAJxC,SAAI,GAAG,eAAe,CAAC;QAEvB,uDAAiC;QAGxC,uBAAA,IAAI,wCAAkB,OAAO,CAAC,aAAa,MAAA,CAAC;IAC9C,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,YAAY,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;Y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B,CAAC,EAAE,CAAC;oBAC9D,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;wBACnD,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAClD,CAAC;gBACH,CAAC;gBACD,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE,CAAC;oBACpC,IAAI,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;wBACtC,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;oBAChC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { projectLogger, createModuleLogger } from '../logger.js';\nimport { forDataTypes } from '../types.js';\nimport type {\n AssetsDataSource,\n ChainId,\n DataResponse,\n Middleware,\n} from '../types.js';\nimport { mergeDataResponses } from './ParallelMiddleware.js';\n\nconst CONTROLLER_NAME = 'RpcFallbackMiddleware';\n\nconst log = createModuleLogger(projectLogger, CONTROLLER_NAME);\n\nexport type RpcFallbackMiddlewareOptions = {\n /** The RPC data source to use as a fallback. */\n rpcDataSource: AssetsDataSource;\n};\n\n/**\n * RpcFallbackMiddleware retries chains that failed upstream on the RPC data\n * source. Any chain present in `response.errors` (network error,\n * unprocessedNetworks, timeout, …) is handed off to RPC with the request\n * filtered to just those chains. Successful RPC results are merged into the\n * response and their entries are cleared from `response.errors`.\n *\n * Place this immediately after `createParallelBalanceMiddleware` in the fast\n * pipeline.\n */\nexport class RpcFallbackMiddleware {\n readonly name = CONTROLLER_NAME;\n\n readonly #rpcDataSource: AssetsDataSource;\n\n constructor(options: RpcFallbackMiddlewareOptions) {\n this.#rpcDataSource = options.rpcDataSource;\n }\n\n getName(): string {\n return this.name;\n }\n\n get assetsMiddleware(): Middleware {\n return forDataTypes(['balance'], async (ctx, next) => {\n const erroredChains = new Set<ChainId>(\n Object.keys(ctx.response.errors ?? {}) as ChainId[],\n );\n if (erroredChains.size === 0) {\n return next(ctx);\n }\n\n log('Retrying failed chains on RPC', {\n chains: [...erroredChains],\n });\n\n const filteredRequest = {\n ...ctx.request,\n chainIds: ctx.request.chainIds.filter((id) => erroredChains.has(id)),\n };\n\n const noopNext = async (inner: typeof ctx): Promise<typeof ctx> => inner;\n const rpcResult = await this.#rpcDataSource.assetsMiddleware(\n {\n ...ctx,\n request: filteredRequest,\n response: {},\n },\n noopNext,\n );\n\n const merged: DataResponse = mergeDataResponses([\n ctx.response,\n rpcResult.response,\n ]);\n\n // Clear errors only for chains RPC actually recovered a balance for.\n // We must inspect rpcResult.response — NOT merged — because merged\n // also contains balances from the upstream sources (AccountsApi /\n // Websocket / Staked). If those sources returned partial data for\n // a chain that they also flagged as errored (e.g. via\n // unprocessedNetworks), and RPC then failed for that same chain,\n // looking at merged would incorrectly mark the error as recovered.\n const rpcAssetsBalance = rpcResult.response.assetsBalance;\n if (merged.errors && rpcAssetsBalance) {\n const chainsRecoveredByRpc = new Set<string>();\n for (const accountBalances of Object.values(rpcAssetsBalance)) {\n for (const assetId of Object.keys(accountBalances)) {\n chainsRecoveredByRpc.add(assetId.split('/')[0]);\n }\n }\n for (const chainId of erroredChains) {\n if (chainsRecoveredByRpc.has(chainId)) {\n delete merged.errors[chainId];\n }\n }\n }\n\n return next({ ...ctx, response: merged });\n });\n }\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { CustomAssetGraduationMiddleware } from './CustomAssetGraduationMiddleware.js';
|
|
2
|
-
export type { CustomAssetGraduationMiddlewareOptions } from './CustomAssetGraduationMiddleware.js';
|
|
3
|
-
export { DetectionMiddleware } from './DetectionMiddleware.js';
|
|
4
|
-
export { RpcFallbackMiddleware } from './RpcFallbackMiddleware.js';
|
|
5
|
-
export type { RpcFallbackMiddlewareOptions } from './RpcFallbackMiddleware.js';
|
|
6
|
-
export { createParallelBalanceMiddleware, createParallelMiddleware, mergeDataResponses, } from './ParallelMiddleware.js';
|
|
7
|
-
export type { BalanceSource } from './ParallelMiddleware.js';
|
|
8
|
-
export type { AssetsDataSource } from '../types.js';
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middlewares/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,YAAY,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { CustomAssetGraduationMiddleware } from './CustomAssetGraduationMiddleware.js';
|
|
2
|
-
export { DetectionMiddleware } from './DetectionMiddleware.js';
|
|
3
|
-
export { RpcFallbackMiddleware } from './RpcFallbackMiddleware.js';
|
|
4
|
-
export { createParallelBalanceMiddleware, createParallelMiddleware, mergeDataResponses, } from './ParallelMiddleware.js';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/middlewares/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC","sourcesContent":["export { CustomAssetGraduationMiddleware } from './CustomAssetGraduationMiddleware.js';\nexport type { CustomAssetGraduationMiddlewareOptions } from './CustomAssetGraduationMiddleware.js';\nexport { DetectionMiddleware } from './DetectionMiddleware.js';\nexport { RpcFallbackMiddleware } from './RpcFallbackMiddleware.js';\nexport type { RpcFallbackMiddlewareOptions } from './RpcFallbackMiddleware.js';\nexport {\n createParallelBalanceMiddleware,\n createParallelMiddleware,\n mergeDataResponses,\n} from './ParallelMiddleware.js';\nexport type { BalanceSource } from './ParallelMiddleware.js';\nexport type { AssetsDataSource } from '../types.js';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"healAssetsInfoMetadata.d.ts","sourceRoot":"","sources":["../../src/migrations/healAssetsInfoMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAW1E,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,6BAA6B,EAC7B,YAAY,GAAG,eAAe,GAAG,cAAc,GAAG,kBAAkB,CACrE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,wBAAwB,GAAG;IAErC,gBAAgB,CAAC,EAAE,OAAO,CACxB,IAAI,CAAC,qBAAqB,EAAE,WAAW,GAAG,kBAAkB,CAAC,CAC9D,CAAC;IAEF,kBAAkB,CAAC,EAAE;QACnB,gBAAgB,CAAC,EAAE;YACjB,QAAQ,CAAC,EAAE,MAAM,CACf,MAAM,EACN,IAAI,CACF,uBAAuB,CAAC,kBAAkB,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,EAC/D,SAAS,CACV,CACF,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;IACzD,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;CAClD,CAAC;AAIF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,8EAA8E;IAC9E,KAAK,EAAE,6BAA6B,CAAC;IACrC;;;OAGG;IACH,iBAAiB,EAAE,MAAM,OAAO,CAAC;IACjC,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,KAAK,EACL,iBAAiB,EACjB,gBAAgB,GACjB,EAAE,iCAAiC,GAAG,6BAA6B,CAqCnE;AAmDD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,kBAAkB,GAC/B,sBAAsB,GAAG,IAAI,CAmF/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"healAssetsInfoMetadata.js","sourceRoot":"","sources":["../../src/migrations/healAssetsInfoMetadata.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,aAAa,E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,EAC7C,SAAoB,EACpB,OAAsB;IAEtB,IAAI,YAAY,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;QACrD,OAAO;IACT,CAAC;IACD,IAAI,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5D,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IACD,SAAS,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;AAChC,CAAC","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\nimport type { TokensControllerState } from '@metamask/assets-controllers';\nimport type { Hex } from '@metamask/utils';\nimport {\n getChecksumAddress,\n getErrorMessage,\n hasProperty,\n isObject,\n} from '@metamask/utils';\nimport { cloneDeep } from 'lodash-es';\n\nimport { createModuleLogger, projectLogger } from '../logger.js';\nimport type {\n AccountId,\n Caip19AssetId,\n FungibleAssetMetadata,\n AssetsControllerStateInternal,\n} from '../types.js';\n\n/**\n * TEMPORARY MODULE — remove in a future release.\n *\n * Port of extension migration #215 (Assets Controller Metadata Healing).\n * Issue: https://consensyssoftware.atlassian.net/browse/ASSETS-3346\n * Incident: #incident-metamask-1731\n *\n * Background: after a prior defect in AssetsController, metadata for custom\n * tokens was wiped. Most popular chains support auto-detection and can\n * self-heal, however not all.\n *\n * This module computes the state additions needed to restore metadata for\n * custom tokens on niche EVM chains (chains that cannot auto-detect and\n * self-heal), using the legacy `TokensController.allTokens` state as the\n * source of truth. It is a pure function so it can be tested in isolation;\n * the controller applies the returned patch in its constructor.\n *\n * The legacy state is treated as fully untrusted (`unknown`): every shape is\n * validated before use, and any unexpected input results in that entry being\n * skipped (or `null` being returned when nothing is restorable).\n */\n\n/**\n * The slices of current `AssetsController` state the healing computation\n * reads. Never mutated.\n */\nexport type CurrentAssetsState = Pick<\n AssetsControllerStateInternal,\n 'assetsInfo' | 'assetsBalance' | 'customAssets' | 'assetPreferences'\n>;\n\n/**\n * TEMPORARY — will be removed in a future release.\n *\n * Shape of the legacy persisted state the ASSETS-3346 healing reads, derived\n * from the real `TokensControllerState` and `AccountsControllerState` types.\n * Use it to type the `tempMigrateAssetsInfoMetadataAssets3346` getter when\n * integrating in a client.\n *\n * Everything is optional and only the listed slices are read:\n *\n * - `TokensController.allTokens` — required for any healing to happen.\n * - `TokensController.allIgnoredTokens` — tokens the user hid/removed\n * (skipped during healing).\n * - `AccountsController.internalAccounts.accounts` — maps addresses to\n * account IDs so healed tokens are also tracked in `customAssets`\n * (without it only `assetsInfo` is healed).\n *\n * At runtime the value still crosses the boundary as `unknown`: every shape\n * is re-validated by the migration, so a partial or malformed object is safe\n * and simply skipped.\n */\nexport type Assets3346MigrationState = {\n // eslint-disable-next-line @typescript-eslint/naming-convention -- must match the persisted controller state key\n TokensController?: Partial<\n Pick<TokensControllerState, 'allTokens' | 'allIgnoredTokens'>\n >;\n // eslint-disable-next-line @typescript-eslint/naming-convention -- must match the persisted controller state key\n AccountsController?: {\n internalAccounts?: {\n accounts?: Record<\n string,\n Pick<\n AccountsControllerState['internalAccounts']['accounts'][string],\n 'address'\n >\n >;\n };\n };\n};\n\nexport type AssetsInfoHealingPatch = {\n assetsInfo: Record<Caip19AssetId, FungibleAssetMetadata>;\n customAssets: Record<AccountId, Caip19AssetId[]>;\n};\n\nconst log = createModuleLogger(projectLogger, 'tempHealAssetsInfoMetadata');\n\nexport type TempHealAssetsInfoMetadataOptions = {\n /** Current `AssetsController` state the healing patch is computed against. */\n state: AssetsControllerStateInternal;\n /**\n * Host-provided getter for the untrusted legacy state root (see\n * `AssetsControllerOptions.tempMigrateAssetsInfoMetadataAssets3346`).\n */\n getMigrationState: () => unknown;\n /** Optional Sentry-compatible reporter for healing failures. */\n captureException?: (error: Error) => void;\n};\n\n/**\n * TEMPORARY — will be removed in a future release.\n *\n * @param options - The options bag.\n * @param options.state - Current controller state to compute the patch against.\n * @param options.getMigrationState - Getter for the untrusted legacy state root.\n * @param options.captureException - Optional reporter for healing failures.\n * @returns Updated controller state with the healing patch applied, or the\n * original state when there is nothing to heal or healing fails.\n */\nexport function tempHealAssetsInfoMetadata({\n state,\n getMigrationState,\n captureException,\n}: TempHealAssetsInfoMetadataOptions): AssetsControllerStateInternal {\n const reportError = (error: unknown): void => {\n log('Failed to heal assetsInfo metadata', error);\n captureException?.(\n new Error(\n `AssetsController: temporary assetsInfo metadata healing failed: ${getErrorMessage(\n error,\n )}`,\n ),\n );\n };\n\n let patch: AssetsInfoHealingPatch | null = null;\n try {\n patch = healAssetsInfoMetadata(getMigrationState(), state);\n } catch (error) {\n reportError(error);\n }\n\n if (!patch) {\n return state;\n }\n\n try {\n const nextState = cloneDeep(state);\n applyHealingPatch(nextState, patch);\n\n log('Healed wiped assetsInfo metadata for niche-chain tokens', {\n healedAssetsInfoCount: Object.keys(patch.assetsInfo).length,\n healedCustomAssetsAccounts: Object.keys(patch.customAssets).length,\n });\n\n return nextState;\n } catch (error) {\n reportError(error);\n return state;\n }\n}\n\n/**\n * Apply a healing patch to (draft) controller state. Defensive against\n * concurrent writes: fills `assetsInfo` gaps only and dedupes `customAssets`\n * against the current draft rather than trusting the patch blindly.\n *\n * @param state - Mutable controller state copy.\n * @param patch - The additions computed by {@link healAssetsInfoMetadata}.\n */\nfunction applyHealingPatch(\n state: CurrentAssetsState,\n patch: AssetsInfoHealingPatch,\n): void {\n for (const [assetId, metadata] of Object.entries(patch.assetsInfo)) {\n state.assetsInfo[assetId as Caip19AssetId] ??= metadata;\n }\n\n for (const [accountId, assetIds] of Object.entries(patch.customAssets)) {\n const existing = state.customAssets[accountId] ?? [];\n state.customAssets[accountId] = [\n ...existing,\n ...assetIds.filter((assetId) => !existing.includes(assetId)),\n ];\n }\n}\n\nconst EVM_CHAIN_NAMESPACE = 'eip155';\n\nconst EVM_ADDRESS_REGEX = /^0x[0-9a-fA-F]{40}$/u;\n\n/**\n * Popular networks (covered by the Accounts API) can self-heal through\n * auto-detection, so their tokens must not be touched. Frozen snapshot from\n * extension migration #215.\n */\nconst ACCOUNT_API_SUPPORTED_CHAIN_IDS: ReadonlySet<string> = new Set([\n 'eip155:1', // Ethereum Mainnet\n 'eip155:10', // Optimism\n 'eip155:56', // BNB Smart Chain\n 'eip155:137', // Polygon\n 'eip155:143', // Monad\n 'eip155:999', // HyperEVM\n 'eip155:1329', // Sei\n 'eip155:5042', // Arc\n 'eip155:8453', // Base\n 'eip155:42161', // Arbitrum One\n 'eip155:43114', // Avalanche\n 'eip155:59144', // Linea\n]);\n\n/**\n * Compute the additions required to heal `assetsInfo` metadata (and custom\n * asset tracking) for tokens on niche EVM chains, based on the legacy\n * `TokensController` state.\n *\n * What it deliberately skips:\n *\n * - Accounts-API-supported chains — see `ACCOUNT_API_SUPPORTED_CHAIN_IDS`.\n * - Tokens the user hid/removed, detected via either the legacy\n * `TokensController.allIgnoredTokens` or the current\n * `assetPreferences` (`hidden: true`).\n * - Non-EVM assets, ERC-721s, and tokens with invalid addresses or metadata.\n *\n * @param legacyState - Untrusted legacy state root. Expected (but not\n * required) to contain `TokensController.allTokens`,\n * `TokensController.allIgnoredTokens`, and\n * `AccountsController.internalAccounts.accounts`.\n * @param currentState - Current `AssetsController` state slices (read-only).\n * @returns The additions to apply, or `null` when there is nothing to heal.\n */\nexport function healAssetsInfoMetadata(\n legacyState: unknown,\n currentState: CurrentAssetsState,\n): AssetsInfoHealingPatch | null {\n const allTokens = readPath(legacyState, ['TokensController', 'allTokens']);\n if (!isObject(allTokens)) {\n return null;\n }\n\n const addressToAccountId = buildAddressToAccountIdMap(legacyState);\n const hiddenAssetIds = collectHiddenAssetIds(currentState);\n const allIgnoredTokens = readPath(legacyState, [\n 'TokensController',\n 'allIgnoredTokens',\n ]);\n\n const assetsInfoAdditions: Record<Caip19AssetId, FungibleAssetMetadata> = {};\n const customAssetAdditions: Record<AccountId, Caip19AssetId[]> = {};\n\n for (const [hexChainId, accountTokens] of Object.entries(allTokens)) {\n if (!isObject(accountTokens)) {\n continue;\n }\n\n const caip2 = hexChainIdToCaip2(hexChainId);\n // Skip chains we can't parse or that self-heal via the accounts API.\n if (!caip2 || ACCOUNT_API_SUPPORTED_CHAIN_IDS.has(caip2)) {\n continue;\n }\n\n for (const [rawAddress, tokens] of Object.entries(accountTokens)) {\n if (!Array.isArray(tokens) || tokens.length === 0) {\n continue;\n }\n\n const accountId = addressToAccountId[rawAddress.toLowerCase()];\n const ignoredAddresses = collectIgnoredAddresses(\n allIgnoredTokens,\n hexChainId,\n rawAddress,\n );\n\n for (const token of tokens) {\n const restorable = getRestorableAsset(\n token,\n caip2,\n ignoredAddresses,\n hiddenAssetIds,\n );\n if (!restorable) {\n continue;\n }\n const { assetId, info } = restorable;\n\n // `assetsInfo` is a global registry; fill gaps only, never overwrite.\n if (\n currentState.assetsInfo[assetId] === undefined &&\n assetsInfoAdditions[assetId] === undefined\n ) {\n assetsInfoAdditions[assetId] = info;\n }\n\n // Ensure the asset is tracked for its account.\n if (accountId) {\n addCustomAssetAddition(\n currentState,\n customAssetAdditions,\n accountId,\n assetId,\n );\n }\n }\n }\n }\n\n if (\n Object.keys(assetsInfoAdditions).length === 0 &&\n Object.keys(customAssetAdditions).length === 0\n ) {\n return null;\n }\n\n return {\n assetsInfo: assetsInfoAdditions,\n customAssets: customAssetAdditions,\n };\n}\n\n/**\n * Resolve a raw `TokensController` token entry to the CAIP-19 asset ID and\n * metadata that should be healed, or `null` when the token must be skipped\n * (not an object, missing/invalid address or symbol, an ERC-721, or hidden\n * in either the legacy or the current controller).\n *\n * @param token - Raw token entry from `allTokens`.\n * @param caip2 - The CAIP-2 chain ID of the token's chain (e.g. 'eip155:14').\n * @param ignoredAddresses - Lowercase addresses hidden via legacy `allIgnoredTokens`.\n * @param hiddenAssetIds - Lowercase asset IDs hidden via current `assetPreferences`.\n * @returns The restorable asset, or `null` to skip.\n */\nfunction getRestorableAsset(\n token: unknown,\n caip2: string,\n ignoredAddresses: Set<string>,\n hiddenAssetIds: Set<string>,\n): { assetId: Caip19AssetId; info: FungibleAssetMetadata } | null {\n if (!isObject(token)) {\n return null;\n }\n // Skip NFTs — AssetsController tracks them separately.\n if (token.isERC721 === true) {\n return null;\n }\n if (\n typeof token.address !== 'string' ||\n !EVM_ADDRESS_REGEX.test(token.address)\n ) {\n return null;\n }\n // Healed metadata with no symbol would be unusable in the UI; skip it.\n if (typeof token.symbol !== 'string' || token.symbol.length === 0) {\n return null;\n }\n\n const assetId = buildErc20AssetId(caip2, token.address as Hex);\n if (!assetId) {\n return null;\n }\n\n // Skip tokens the user hid/removed — in the legacy controller…\n if (ignoredAddresses.has(token.address.toLowerCase())) {\n return null;\n }\n // …or in the current controller.\n if (hiddenAssetIds.has(assetId.toLowerCase())) {\n return null;\n }\n\n return { assetId, info: buildEvmAssetInfo(token) };\n}\n\n/**\n * Build a `FungibleAssetMetadata` from a raw `TokensController` token entry.\n * The caller has already validated `symbol` as a non-empty string.\n *\n * @param token - Raw token object.\n * @returns The metadata to write into `assetsInfo`.\n */\nfunction buildEvmAssetInfo(\n token: Record<string, unknown>,\n): FungibleAssetMetadata {\n const symbol = token.symbol as string;\n const name =\n typeof token.name === 'string' && token.name.length > 0\n ? token.name\n : symbol;\n const decimals =\n typeof token.decimals === 'number' && Number.isFinite(token.decimals)\n ? token.decimals\n : 0;\n\n const image =\n typeof token.image === 'string' && token.image.length > 0\n ? token.image\n : undefined;\n const aggregators = Array.isArray(token.aggregators)\n ? token.aggregators.filter(\n (aggregator): aggregator is string => typeof aggregator === 'string',\n )\n : undefined;\n\n return {\n type: 'erc20',\n symbol,\n name,\n decimals,\n ...(image ? { image } : {}),\n ...(aggregators ? { aggregators } : {}),\n };\n}\n\n/**\n * Build a map from lowercase account address to account UUID using the\n * legacy `AccountsController.internalAccounts.accounts`.\n *\n * @param legacyState - Untrusted legacy state root.\n * @returns Map of lowercase address to account ID (empty on invalid input).\n */\nfunction buildAddressToAccountIdMap(\n legacyState: unknown,\n): Record<string, AccountId> {\n const accounts = readPath(legacyState, [\n 'AccountsController',\n 'internalAccounts',\n 'accounts',\n ]);\n if (!isObject(accounts)) {\n return {};\n }\n\n const map: Record<string, AccountId> = {};\n for (const [id, account] of Object.entries(accounts)) {\n if (\n isObject(account) &&\n typeof account.address === 'string' &&\n account.address.length > 0\n ) {\n map[account.address.toLowerCase()] = id;\n }\n }\n return map;\n}\n\n/**\n * Collect the set of CAIP-19 asset IDs (lowercased) marked `hidden: true` in\n * the current `assetPreferences`. Lowercasing lets callers compare against\n * checksummed asset IDs case-insensitively.\n *\n * @param currentState - Current `AssetsController` state slices.\n * @returns Set of lowercase hidden asset IDs.\n */\nfunction collectHiddenAssetIds(currentState: CurrentAssetsState): Set<string> {\n const hidden = new Set<string>();\n for (const [assetId, preference] of Object.entries(\n currentState.assetPreferences,\n )) {\n if (isObject(preference) && preference.hidden === true) {\n hidden.add(assetId.toLowerCase());\n }\n }\n return hidden;\n}\n\n/**\n * Collect the lowercase token addresses ignored (hidden) in the legacy\n * `TokensController.allIgnoredTokens` for a given chain and account. The\n * account key is matched case-insensitively.\n *\n * @param allIgnoredTokens - The legacy `allIgnoredTokens` map (possibly missing).\n * @param hexChainId - The hex chain ID being processed.\n * @param accountAddress - The account address whose ignored list to read.\n * @returns Set of lowercase ignored token addresses.\n */\nfunction collectIgnoredAddresses(\n allIgnoredTokens: unknown,\n hexChainId: string,\n accountAddress: string,\n): Set<string> {\n const result = new Set<string>();\n if (!isObject(allIgnoredTokens)) {\n return result;\n }\n\n const chainEntry = allIgnoredTokens[hexChainId];\n if (!isObject(chainEntry)) {\n return result;\n }\n\n const lowerAccount = accountAddress.toLowerCase();\n for (const [address, list] of Object.entries(chainEntry)) {\n if (address.toLowerCase() !== lowerAccount || !Array.isArray(list)) {\n continue;\n }\n for (const ignored of list) {\n if (typeof ignored === 'string') {\n result.add(ignored.toLowerCase());\n }\n }\n }\n return result;\n}\n\n/**\n * Convert a hex chain ID (e.g. '0x1') to a CAIP-2 chain ID (e.g. 'eip155:1').\n *\n * @param hexChainId - The hex-encoded EVM chain ID.\n * @returns The CAIP-2 chain ID, or `null` when the input cannot be parsed.\n */\nfunction hexChainIdToCaip2(hexChainId: string): string | null {\n if (!/^0x[0-9a-fA-F]+$/u.test(hexChainId)) {\n return null;\n }\n const decimal = Number.parseInt(hexChainId, 16);\n if (!Number.isFinite(decimal)) {\n return null;\n }\n return `${EVM_CHAIN_NAMESPACE}:${decimal}`;\n}\n\n/**\n * Build the checksummed CAIP-19 asset ID for an ERC-20 token.\n *\n * @param caip2 - The CAIP-2 chain ID (e.g. 'eip155:14').\n * @param tokenAddress - The ERC-20 contract address.\n * @returns The asset ID, or `null` when the address cannot be checksummed.\n */\nfunction buildErc20AssetId(\n caip2: string,\n tokenAddress: Hex,\n): Caip19AssetId | null {\n let checksummed: string;\n try {\n checksummed = getChecksumAddress(tokenAddress);\n } catch {\n return null;\n }\n return `${caip2}/erc20:${checksummed}` as Caip19AssetId;\n}\n\n/**\n * Read a nested path on an unknown value, returning `undefined` if any\n * intermediate key is missing or not an object.\n *\n * @param root - The value to read from.\n * @param path - Sequence of keys to traverse.\n * @returns The value at the path, or `undefined`.\n */\nfunction readPath(root: unknown, path: string[]): unknown {\n return path.reduce<unknown>((cursor, key) => {\n if (!isObject(cursor) || !hasProperty(cursor, key)) {\n return undefined;\n }\n return cursor[key];\n }, root);\n}\n\n/**\n * Record `assetId` as a custom-asset addition for `accountId` unless it is\n * already tracked in the current `assetsBalance` (mutual exclusion), already\n * present in the current `customAssets`, or already queued as an addition.\n *\n * @param currentState - Current `AssetsController` state slices.\n * @param additions - The custom-asset additions accumulated so far (mutated).\n * @param accountId - The account UUID.\n * @param assetId - CAIP-19 asset identifier.\n */\nfunction addCustomAssetAddition(\n currentState: CurrentAssetsState,\n additions: Record<AccountId, Caip19AssetId[]>,\n accountId: AccountId,\n assetId: Caip19AssetId,\n): void {\n if (currentState.assetsBalance[accountId]?.[assetId]) {\n return;\n }\n if (currentState.customAssets[accountId]?.includes(assetId)) {\n return;\n }\n\n const queued = additions[accountId] ?? [];\n if (!queued.includes(assetId)) {\n queued.push(assetId);\n }\n additions[accountId] = queued;\n}\n"]}
|