@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
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _TokensApiClient_instances, _TokensApiClient_fetch, _TokensApiClient_queryClient, _TokensApiClient_supportedChainIds, _TokensApiClient_supportedChainIdsCachedAt, _TokensApiClient_supportedChainIdsRefreshPromise, _TokensApiClient_suggestedOccurrenceFloors, _TokensApiClient_suggestedOccurrenceFloorsCachedAt, _TokensApiClient_suggestedOccurrenceFloorsRefreshPromise, _TokensApiClient_isSupportedChain, _TokensApiClient_refreshSupportedChainIds, _TokensApiClient_getOccurrenceFloor, _TokensApiClient_refreshSuggestedOccurrenceFloors, _TokensApiClient_fetchTokenListUncached;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.TokensApiClient = void 0;
|
|
16
|
+
const controller_utils_1 = require("@metamask/controller-utils");
|
|
17
|
+
/**
|
|
18
|
+
* Same host + path that `TokenListController` (assets-controllers) uses
|
|
19
|
+
* (`token-service.ts` → `getTokensURL`). Sharing this endpoint keeps the
|
|
20
|
+
* RPC token detector aligned with the rest of the wallet's token listing
|
|
21
|
+
* (occurrence floors, aggregator filters, icon URLs, etc.).
|
|
22
|
+
*/
|
|
23
|
+
const TOKEN_END_POINT_API = 'https://token.api.cx.metamask.io';
|
|
24
|
+
/**
|
|
25
|
+
* Endpoint that returns which CAIP chain IDs the Tokens API supports.
|
|
26
|
+
* Used to skip detection (and avoid unnecessary network requests) for chains
|
|
27
|
+
* that are not in the supported-networks list.
|
|
28
|
+
*/
|
|
29
|
+
const SUPPORTED_NETWORKS_URL = `${TOKEN_END_POINT_API}/v2/supportedNetworks`;
|
|
30
|
+
/**
|
|
31
|
+
* Per-chain suggested occurrence floors used as the `occurrenceFloor` query
|
|
32
|
+
* param when fetching token lists (and aligned with TokenDataSource spam
|
|
33
|
+
* filtering). Keys are decimal chain IDs.
|
|
34
|
+
*/
|
|
35
|
+
const SUGGESTED_OCCURRENCE_FLOORS_URL = `${TOKEN_END_POINT_API}/v1/suggestedOccurrenceFloors`;
|
|
36
|
+
/**
|
|
37
|
+
* Fallback `occurrenceFloor` when `/v1/suggestedOccurrenceFloors` has no entry
|
|
38
|
+
* for the chain, or the floors request fails.
|
|
39
|
+
*/
|
|
40
|
+
const DEFAULT_OCCURRENCE_FLOOR = 3;
|
|
41
|
+
/**
|
|
42
|
+
* How long to keep the supported-networks response in the instance-level
|
|
43
|
+
* cache before refreshing it. One hour is sufficient — the list rarely
|
|
44
|
+
* changes and a stale cache just means we may do an unnecessary token-list
|
|
45
|
+
* fetch for a newly-unsupported chain (harmless).
|
|
46
|
+
*/
|
|
47
|
+
const SUPPORTED_NETWORKS_CACHE_TTL_MS = 60 * 60000;
|
|
48
|
+
/**
|
|
49
|
+
* How long to keep suggested occurrence floors cached. Same TTL as supported
|
|
50
|
+
* networks — floors change infrequently.
|
|
51
|
+
*/
|
|
52
|
+
const SUGGESTED_OCCURRENCE_FLOORS_CACHE_TTL_MS = 60 * 60000;
|
|
53
|
+
/**
|
|
54
|
+
* TanStack-Query cache config for the cached `fetchTokenList` path.
|
|
55
|
+
*
|
|
56
|
+
* The Tokens API per-chain list barely changes between polls, so we keep
|
|
57
|
+
* results fresh for a few minutes (`staleTime`) and retain them in cache for
|
|
58
|
+
* an hour (`gcTime`) so re-detections across accounts/chains hit the cache.
|
|
59
|
+
* These tunings only apply when a `queryClient` is provided to the client;
|
|
60
|
+
* the uncached fallback path (used in standalone tests) is unaffected.
|
|
61
|
+
*/
|
|
62
|
+
const TOKEN_LIST_STALE_TIME_MS = 5 * 60000;
|
|
63
|
+
const TOKEN_LIST_GC_TIME_MS = 60 * 60000;
|
|
64
|
+
/**
|
|
65
|
+
* Client for the MetaMask Tokens API.
|
|
66
|
+
*
|
|
67
|
+
* Fetches the per-chain ERC-20 token list from the same endpoint that
|
|
68
|
+
* `TokenListController` uses (`token.api.cx.metamask.io/tokens/{chainId}`),
|
|
69
|
+
* with the same query parameters. The `occurrenceFloor` query param comes from
|
|
70
|
+
* Token API `/v1/suggestedOccurrenceFloors` (fallback {@link DEFAULT_OCCURRENCE_FLOOR}),
|
|
71
|
+
* matching `TokenDataSource` spam filtering. Linea's post-response aggregator
|
|
72
|
+
* filter is still applied client-side.
|
|
73
|
+
*
|
|
74
|
+
* Before fetching a chain's token list, the client checks
|
|
75
|
+
* `/v2/supportedNetworks` and returns `[]` immediately for chains that are
|
|
76
|
+
* not in the supported list, avoiding unnecessary API calls. The supported-
|
|
77
|
+
* networks response is cached in-memory for one hour.
|
|
78
|
+
*
|
|
79
|
+
* When constructed with a `queryClient`, token-list results are cached and
|
|
80
|
+
* deduped via TanStack Query (5 min staleTime, 1 h gcTime), so concurrent
|
|
81
|
+
* detection cycles for the same chain coalesce into a single network request.
|
|
82
|
+
*/
|
|
83
|
+
class TokensApiClient {
|
|
84
|
+
constructor(config) {
|
|
85
|
+
_TokensApiClient_instances.add(this);
|
|
86
|
+
_TokensApiClient_fetch.set(this, void 0);
|
|
87
|
+
_TokensApiClient_queryClient.set(this, void 0);
|
|
88
|
+
/** CAIP chain IDs returned by `/v2/supportedNetworks` (both tiers). */
|
|
89
|
+
_TokensApiClient_supportedChainIds.set(this, void 0);
|
|
90
|
+
/** Timestamp of the last successful `/v2/supportedNetworks` fetch. */
|
|
91
|
+
_TokensApiClient_supportedChainIdsCachedAt.set(this, 0);
|
|
92
|
+
/**
|
|
93
|
+
* In-flight `/v2/supportedNetworks` request shared across concurrent callers
|
|
94
|
+
* so only one network request is made even when multiple `fetchTokenList`
|
|
95
|
+
* calls arrive before the first one resolves.
|
|
96
|
+
*/
|
|
97
|
+
_TokensApiClient_supportedChainIdsRefreshPromise.set(this, void 0);
|
|
98
|
+
/** Decimal chain ID → suggested occurrence floor from Token API. */
|
|
99
|
+
_TokensApiClient_suggestedOccurrenceFloors.set(this, void 0);
|
|
100
|
+
/** Timestamp of the last successful floors fetch. */
|
|
101
|
+
_TokensApiClient_suggestedOccurrenceFloorsCachedAt.set(this, 0);
|
|
102
|
+
/** In-flight floors request shared across concurrent callers. */
|
|
103
|
+
_TokensApiClient_suggestedOccurrenceFloorsRefreshPromise.set(this, void 0);
|
|
104
|
+
__classPrivateFieldSet(this, _TokensApiClient_fetch, config?.fetch ?? globalThis.fetch.bind(globalThis), "f");
|
|
105
|
+
__classPrivateFieldSet(this, _TokensApiClient_queryClient, config?.queryClient, "f");
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Fetch the list of ERC-20 tokens for a chain from the Tokens API.
|
|
109
|
+
*
|
|
110
|
+
* Returns `[]` immediately (without hitting the token-list endpoint) when
|
|
111
|
+
* the chain is not in the `/v2/supportedNetworks` response, or when the
|
|
112
|
+
* supported-networks check fails for any reason.
|
|
113
|
+
*
|
|
114
|
+
* @param hexChainId - Chain ID in hex format (e.g. `'0x1'` for Ethereum mainnet).
|
|
115
|
+
* @returns Array of token list entries with address and metadata, or an empty
|
|
116
|
+
* array if the chain is unsupported or the request fails.
|
|
117
|
+
*/
|
|
118
|
+
async fetchTokenList(hexChainId) {
|
|
119
|
+
// Treat any error from the supported-networks check as "not supported":
|
|
120
|
+
// the token-list endpoint is only contacted for known-supported chains.
|
|
121
|
+
if (!(await __classPrivateFieldGet(this, _TokensApiClient_instances, "m", _TokensApiClient_isSupportedChain).call(this, hexChainId).catch(() => false))) {
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
124
|
+
const queryClient = __classPrivateFieldGet(this, _TokensApiClient_queryClient, "f");
|
|
125
|
+
if (queryClient === undefined) {
|
|
126
|
+
return __classPrivateFieldGet(this, _TokensApiClient_instances, "m", _TokensApiClient_fetchTokenListUncached).call(this, hexChainId);
|
|
127
|
+
}
|
|
128
|
+
return queryClient.fetchQuery({
|
|
129
|
+
// Namespacing keeps this key from colliding with other clients that
|
|
130
|
+
// share the same QueryClient (e.g. core-backend's ApiPlatformClient).
|
|
131
|
+
queryKey: [
|
|
132
|
+
'assets-controller',
|
|
133
|
+
'rpc-detection',
|
|
134
|
+
'token-list',
|
|
135
|
+
{ chainId: hexChainId },
|
|
136
|
+
],
|
|
137
|
+
queryFn: () => __classPrivateFieldGet(this, _TokensApiClient_instances, "m", _TokensApiClient_fetchTokenListUncached).call(this, hexChainId),
|
|
138
|
+
staleTime: TOKEN_LIST_STALE_TIME_MS,
|
|
139
|
+
gcTime: TOKEN_LIST_GC_TIME_MS,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.TokensApiClient = TokensApiClient;
|
|
144
|
+
_TokensApiClient_fetch = new WeakMap(), _TokensApiClient_queryClient = new WeakMap(), _TokensApiClient_supportedChainIds = new WeakMap(), _TokensApiClient_supportedChainIdsCachedAt = new WeakMap(), _TokensApiClient_supportedChainIdsRefreshPromise = new WeakMap(), _TokensApiClient_suggestedOccurrenceFloors = new WeakMap(), _TokensApiClient_suggestedOccurrenceFloorsCachedAt = new WeakMap(), _TokensApiClient_suggestedOccurrenceFloorsRefreshPromise = new WeakMap(), _TokensApiClient_instances = new WeakSet(), _TokensApiClient_isSupportedChain =
|
|
145
|
+
/**
|
|
146
|
+
* Check whether the given chain is present in the supported-networks list.
|
|
147
|
+
*
|
|
148
|
+
* Uses an instance-level cache (1 h TTL). Throws if the network request
|
|
149
|
+
* fails — callers should handle this (e.g. via `.catch(() => false)`).
|
|
150
|
+
*
|
|
151
|
+
* @param hexChainId - Hex chain ID to check.
|
|
152
|
+
* @returns `true` when the chain is in the supported-networks list.
|
|
153
|
+
*/
|
|
154
|
+
async function _TokensApiClient_isSupportedChain(hexChainId) {
|
|
155
|
+
const now = Date.now();
|
|
156
|
+
if (__classPrivateFieldGet(this, _TokensApiClient_supportedChainIds, "f") === undefined ||
|
|
157
|
+
now - __classPrivateFieldGet(this, _TokensApiClient_supportedChainIdsCachedAt, "f") >= SUPPORTED_NETWORKS_CACHE_TTL_MS) {
|
|
158
|
+
await __classPrivateFieldGet(this, _TokensApiClient_instances, "m", _TokensApiClient_refreshSupportedChainIds).call(this, now);
|
|
159
|
+
}
|
|
160
|
+
const caipChainId = `eip155:${(0, controller_utils_1.convertHexToDecimal)(hexChainId)}`;
|
|
161
|
+
return __classPrivateFieldGet(this, _TokensApiClient_supportedChainIds, "f")?.has(caipChainId) ?? false;
|
|
162
|
+
}, _TokensApiClient_refreshSupportedChainIds =
|
|
163
|
+
/**
|
|
164
|
+
* Fetch `/v2/supportedNetworks` and update the instance cache.
|
|
165
|
+
* Concurrent callers share the same in-flight Promise so only one network
|
|
166
|
+
* request is made. If the response is not 2xx the cache is left unchanged
|
|
167
|
+
* (the chain will be treated as unsupported this cycle).
|
|
168
|
+
*
|
|
169
|
+
* @param now - Current timestamp used to stamp the cache entry.
|
|
170
|
+
* @returns A promise that resolves once the cache has been refreshed.
|
|
171
|
+
*/
|
|
172
|
+
async function _TokensApiClient_refreshSupportedChainIds(now) {
|
|
173
|
+
if (__classPrivateFieldGet(this, _TokensApiClient_supportedChainIdsRefreshPromise, "f") !== undefined) {
|
|
174
|
+
return __classPrivateFieldGet(this, _TokensApiClient_supportedChainIdsRefreshPromise, "f");
|
|
175
|
+
}
|
|
176
|
+
__classPrivateFieldSet(this, _TokensApiClient_supportedChainIdsRefreshPromise, (async () => {
|
|
177
|
+
try {
|
|
178
|
+
const response = await __classPrivateFieldGet(this, _TokensApiClient_fetch, "f").call(this, SUPPORTED_NETWORKS_URL);
|
|
179
|
+
if (response.ok) {
|
|
180
|
+
const data = (await response.json());
|
|
181
|
+
__classPrivateFieldSet(this, _TokensApiClient_supportedChainIds, new Set([
|
|
182
|
+
...(data.fullSupport ?? []),
|
|
183
|
+
...(data.partialSupport ?? []),
|
|
184
|
+
]), "f");
|
|
185
|
+
__classPrivateFieldSet(this, _TokensApiClient_supportedChainIdsCachedAt, now, "f");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
__classPrivateFieldSet(this, _TokensApiClient_supportedChainIdsRefreshPromise, undefined, "f");
|
|
190
|
+
}
|
|
191
|
+
})(), "f");
|
|
192
|
+
return __classPrivateFieldGet(this, _TokensApiClient_supportedChainIdsRefreshPromise, "f");
|
|
193
|
+
}, _TokensApiClient_getOccurrenceFloor =
|
|
194
|
+
/**
|
|
195
|
+
* Resolve the `occurrenceFloor` query param for a chain from Token API
|
|
196
|
+
* `/v1/suggestedOccurrenceFloors`. Falls back to
|
|
197
|
+
* {@link DEFAULT_OCCURRENCE_FLOOR} when the chain is missing or the request
|
|
198
|
+
* fails.
|
|
199
|
+
*
|
|
200
|
+
* @param hexChainId - Hex chain ID.
|
|
201
|
+
* @returns Occurrence floor to send to `/tokens/{chainId}`.
|
|
202
|
+
*/
|
|
203
|
+
async function _TokensApiClient_getOccurrenceFloor(hexChainId) {
|
|
204
|
+
const now = Date.now();
|
|
205
|
+
if (__classPrivateFieldGet(this, _TokensApiClient_suggestedOccurrenceFloors, "f") === undefined ||
|
|
206
|
+
now - __classPrivateFieldGet(this, _TokensApiClient_suggestedOccurrenceFloorsCachedAt, "f") >=
|
|
207
|
+
SUGGESTED_OCCURRENCE_FLOORS_CACHE_TTL_MS) {
|
|
208
|
+
await __classPrivateFieldGet(this, _TokensApiClient_instances, "m", _TokensApiClient_refreshSuggestedOccurrenceFloors).call(this, now);
|
|
209
|
+
}
|
|
210
|
+
const decimalChainId = String((0, controller_utils_1.convertHexToDecimal)(hexChainId));
|
|
211
|
+
return (__classPrivateFieldGet(this, _TokensApiClient_suggestedOccurrenceFloors, "f")?.[decimalChainId] ??
|
|
212
|
+
DEFAULT_OCCURRENCE_FLOOR);
|
|
213
|
+
}, _TokensApiClient_refreshSuggestedOccurrenceFloors =
|
|
214
|
+
/**
|
|
215
|
+
* Fetch `/v1/suggestedOccurrenceFloors` and update the instance cache.
|
|
216
|
+
* Concurrent callers share the in-flight Promise. Failures leave the cache
|
|
217
|
+
* empty so {@link #getOccurrenceFloor} falls back to the default.
|
|
218
|
+
*
|
|
219
|
+
* @param now - Current timestamp used to stamp the cache entry.
|
|
220
|
+
* @returns A promise that resolves once the cache has been refreshed.
|
|
221
|
+
*/
|
|
222
|
+
async function _TokensApiClient_refreshSuggestedOccurrenceFloors(now) {
|
|
223
|
+
if (__classPrivateFieldGet(this, _TokensApiClient_suggestedOccurrenceFloorsRefreshPromise, "f") !== undefined) {
|
|
224
|
+
return __classPrivateFieldGet(this, _TokensApiClient_suggestedOccurrenceFloorsRefreshPromise, "f");
|
|
225
|
+
}
|
|
226
|
+
__classPrivateFieldSet(this, _TokensApiClient_suggestedOccurrenceFloorsRefreshPromise, (async () => {
|
|
227
|
+
try {
|
|
228
|
+
const response = await __classPrivateFieldGet(this, _TokensApiClient_fetch, "f").call(this, SUGGESTED_OCCURRENCE_FLOORS_URL);
|
|
229
|
+
if (response.ok) {
|
|
230
|
+
const data = (await response.json());
|
|
231
|
+
__classPrivateFieldSet(this, _TokensApiClient_suggestedOccurrenceFloors, data && typeof data === 'object' && !Array.isArray(data)
|
|
232
|
+
? data
|
|
233
|
+
: {}, "f");
|
|
234
|
+
__classPrivateFieldSet(this, _TokensApiClient_suggestedOccurrenceFloorsCachedAt, now, "f");
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
__classPrivateFieldSet(this, _TokensApiClient_suggestedOccurrenceFloors, {}, "f");
|
|
238
|
+
__classPrivateFieldSet(this, _TokensApiClient_suggestedOccurrenceFloorsCachedAt, now, "f");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
__classPrivateFieldSet(this, _TokensApiClient_suggestedOccurrenceFloors, {}, "f");
|
|
243
|
+
__classPrivateFieldSet(this, _TokensApiClient_suggestedOccurrenceFloorsCachedAt, now, "f");
|
|
244
|
+
}
|
|
245
|
+
finally {
|
|
246
|
+
__classPrivateFieldSet(this, _TokensApiClient_suggestedOccurrenceFloorsRefreshPromise, undefined, "f");
|
|
247
|
+
}
|
|
248
|
+
})(), "f");
|
|
249
|
+
return __classPrivateFieldGet(this, _TokensApiClient_suggestedOccurrenceFloorsRefreshPromise, "f");
|
|
250
|
+
}, _TokensApiClient_fetchTokenListUncached = async function _TokensApiClient_fetchTokenListUncached(hexChainId) {
|
|
251
|
+
const decimalChainId = (0, controller_utils_1.convertHexToDecimal)(hexChainId);
|
|
252
|
+
const occurrenceFloor = await __classPrivateFieldGet(this, _TokensApiClient_instances, "m", _TokensApiClient_getOccurrenceFloor).call(this, hexChainId);
|
|
253
|
+
// Same query shape as `TokenListController.getTokensURL` (token-service.ts),
|
|
254
|
+
// but `occurrenceFloor` comes from `/v1/suggestedOccurrenceFloors`.
|
|
255
|
+
// No `first=...` cap — the API returns the full per-chain list bounded
|
|
256
|
+
// server-side by `occurrenceFloor`.
|
|
257
|
+
const url = `${TOKEN_END_POINT_API}/tokens/${decimalChainId}` +
|
|
258
|
+
`?occurrenceFloor=${occurrenceFloor}` +
|
|
259
|
+
`&includeNativeAssets=false` +
|
|
260
|
+
`&includeTokenFees=false` +
|
|
261
|
+
`&includeAssetType=false` +
|
|
262
|
+
`&includeERC20Permit=false` +
|
|
263
|
+
`&includeStorage=false` +
|
|
264
|
+
`&includeRwaData=true`;
|
|
265
|
+
let response;
|
|
266
|
+
try {
|
|
267
|
+
response = await __classPrivateFieldGet(this, _TokensApiClient_fetch, "f").call(this, url);
|
|
268
|
+
}
|
|
269
|
+
catch (error) {
|
|
270
|
+
console.error(`Tokens API request failed for chain ${hexChainId}:`, error);
|
|
271
|
+
return [];
|
|
272
|
+
}
|
|
273
|
+
if (!response.ok) {
|
|
274
|
+
console.error(`Tokens API responded with ${response.status} for chain ${hexChainId}`);
|
|
275
|
+
return [];
|
|
276
|
+
}
|
|
277
|
+
const raw = (await response.json());
|
|
278
|
+
const items = Array.isArray(raw)
|
|
279
|
+
? raw
|
|
280
|
+
: [];
|
|
281
|
+
const filtered = applyChainSpecificFilters(hexChainId, items);
|
|
282
|
+
return filtered.map((item) => ({
|
|
283
|
+
address: item.address,
|
|
284
|
+
symbol: item.symbol ?? '',
|
|
285
|
+
name: item.name ?? '',
|
|
286
|
+
decimals: item.decimals ?? 18,
|
|
287
|
+
iconUrl: item.iconUrl,
|
|
288
|
+
aggregators: item.aggregators,
|
|
289
|
+
occurrences: item.occurrences,
|
|
290
|
+
}));
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Apply chain-specific filters to a raw token list response, mirroring
|
|
294
|
+
* `fetchTokenListByChainId` in `assets-controllers/src/token-service.ts`.
|
|
295
|
+
*
|
|
296
|
+
* For Linea mainnet, the API returns extras with low aggregator coverage, so
|
|
297
|
+
* we keep only entries flagged by Linea's own team or seen by ≥3 aggregators.
|
|
298
|
+
*
|
|
299
|
+
* @param hexChainId - Hex chain ID.
|
|
300
|
+
* @param items - Raw items from the API response.
|
|
301
|
+
* @returns Items after chain-specific filtering.
|
|
302
|
+
*/
|
|
303
|
+
function applyChainSpecificFilters(hexChainId, items) {
|
|
304
|
+
if (hexChainId === controller_utils_1.ChainId['linea-mainnet']) {
|
|
305
|
+
return items.filter((item) => {
|
|
306
|
+
const aggregators = item.aggregators ?? [];
|
|
307
|
+
return aggregators.includes('lineaTeam') || aggregators.length >= 3;
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
return items;
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=TokensApiClient.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokensApiClient.cjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/clients/TokensApiClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iEAGoC;AAIpC;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,kCAAkC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,GAAG,mBAAmB,uBAAuB,CAAC;AAE7E;;;;GAIG;AACH,MAAM,+BAA+B,GAAG,GAAG,mBAAmB,+BAA+B,CAAC;AAE9F;;;GAGG;AACH,MAAM,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E,EAAE;YAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC;YAC3C,OAAO,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,MAAM,IAAI,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import {\n ChainId as ControllerChainId,\n convertHexToDecimal,\n} from '@metamask/controller-utils';\n\nimport type { ChainId, TokenListEntry } from '../types/index.js';\n\n/**\n * Same host + path that `TokenListController` (assets-controllers) uses\n * (`token-service.ts` → `getTokensURL`). Sharing this endpoint keeps the\n * RPC token detector aligned with the rest of the wallet's token listing\n * (occurrence floors, aggregator filters, icon URLs, etc.).\n */\nconst TOKEN_END_POINT_API = 'https://token.api.cx.metamask.io';\n\n/**\n * Endpoint that returns which CAIP chain IDs the Tokens API supports.\n * Used to skip detection (and avoid unnecessary network requests) for chains\n * that are not in the supported-networks list.\n */\nconst SUPPORTED_NETWORKS_URL = `${TOKEN_END_POINT_API}/v2/supportedNetworks`;\n\n/**\n * Per-chain suggested occurrence floors used as the `occurrenceFloor` query\n * param when fetching token lists (and aligned with TokenDataSource spam\n * filtering). Keys are decimal chain IDs.\n */\nconst SUGGESTED_OCCURRENCE_FLOORS_URL = `${TOKEN_END_POINT_API}/v1/suggestedOccurrenceFloors`;\n\n/**\n * Fallback `occurrenceFloor` when `/v1/suggestedOccurrenceFloors` has no entry\n * for the chain, or the floors request fails.\n */\nconst DEFAULT_OCCURRENCE_FLOOR = 3;\n\n/**\n * How long to keep the supported-networks response in the instance-level\n * cache before refreshing it. One hour is sufficient — the list rarely\n * changes and a stale cache just means we may do an unnecessary token-list\n * fetch for a newly-unsupported chain (harmless).\n */\nconst SUPPORTED_NETWORKS_CACHE_TTL_MS = 60 * 60_000;\n\n/**\n * How long to keep suggested occurrence floors cached. Same TTL as supported\n * networks — floors change infrequently.\n */\nconst SUGGESTED_OCCURRENCE_FLOORS_CACHE_TTL_MS = 60 * 60_000;\n\n/**\n * TanStack-Query cache config for the cached `fetchTokenList` path.\n *\n * The Tokens API per-chain list barely changes between polls, so we keep\n * results fresh for a few minutes (`staleTime`) and retain them in cache for\n * an hour (`gcTime`) so re-detections across accounts/chains hit the cache.\n * These tunings only apply when a `queryClient` is provided to the client;\n * the uncached fallback path (used in standalone tests) is unaffected.\n */\nconst TOKEN_LIST_STALE_TIME_MS = 5 * 60_000;\nconst TOKEN_LIST_GC_TIME_MS = 60 * 60_000;\n\n/**\n * Shape of the `/v2/supportedNetworks` response.\n */\ntype SupportedNetworksResponse = {\n fullSupport?: string[];\n partialSupport?: string[];\n};\n\n/**\n * Shape of a single item returned by the Tokens API `/tokens/{chainId}`\n * endpoint. Mirrors `TokenListToken` in\n * `packages/assets-controllers/src/TokenListController.ts` and the response\n * parsed by `fetchTokenListByChainId` in `token-service.ts`.\n */\ntype ApiTokenListItem = {\n address: string;\n symbol?: string;\n name?: string;\n decimals?: number;\n occurrences?: number;\n aggregators?: string[];\n iconUrl?: string;\n};\n\n/**\n * Minimal structural type for the TanStack Query client method we use.\n * Avoids a direct dependency on `@tanstack/query-core` while still being\n * fully compatible with the shared `QueryClient` exposed by\n * `ApiPlatformClient.queryClient` (`@metamask/core-backend`).\n */\nexport type TokenListQueryClient = {\n fetchQuery<TData>(options: {\n queryKey: readonly unknown[];\n queryFn: () => Promise<TData>;\n staleTime?: number;\n gcTime?: number;\n }): Promise<TData>;\n};\n\nexport type TokensApiClientConfig = {\n /** Fetch function (defaults to globalThis.fetch). */\n fetch?: typeof globalThis.fetch;\n /**\n * Optional TanStack-Query client used to cache token-list responses across\n * detector polls / accounts / instances. When omitted, every call hits the\n * network directly (preserves prior behaviour for tests and standalone use).\n */\n queryClient?: TokenListQueryClient;\n};\n\n/**\n * Client for the MetaMask Tokens API.\n *\n * Fetches the per-chain ERC-20 token list from the same endpoint that\n * `TokenListController` uses (`token.api.cx.metamask.io/tokens/{chainId}`),\n * with the same query parameters. The `occurrenceFloor` query param comes from\n * Token API `/v1/suggestedOccurrenceFloors` (fallback {@link DEFAULT_OCCURRENCE_FLOOR}),\n * matching `TokenDataSource` spam filtering. Linea's post-response aggregator\n * filter is still applied client-side.\n *\n * Before fetching a chain's token list, the client checks\n * `/v2/supportedNetworks` and returns `[]` immediately for chains that are\n * not in the supported list, avoiding unnecessary API calls. The supported-\n * networks response is cached in-memory for one hour.\n *\n * When constructed with a `queryClient`, token-list results are cached and\n * deduped via TanStack Query (5 min staleTime, 1 h gcTime), so concurrent\n * detection cycles for the same chain coalesce into a single network request.\n */\nexport class TokensApiClient {\n readonly #fetch: typeof globalThis.fetch;\n\n readonly #queryClient: TokenListQueryClient | undefined;\n\n /** CAIP chain IDs returned by `/v2/supportedNetworks` (both tiers). */\n #supportedChainIds: Set<string> | undefined;\n\n /** Timestamp of the last successful `/v2/supportedNetworks` fetch. */\n #supportedChainIdsCachedAt = 0;\n\n /**\n * In-flight `/v2/supportedNetworks` request shared across concurrent callers\n * so only one network request is made even when multiple `fetchTokenList`\n * calls arrive before the first one resolves.\n */\n #supportedChainIdsRefreshPromise: Promise<void> | undefined;\n\n /** Decimal chain ID → suggested occurrence floor from Token API. */\n #suggestedOccurrenceFloors: Record<string, number> | undefined;\n\n /** Timestamp of the last successful floors fetch. */\n #suggestedOccurrenceFloorsCachedAt = 0;\n\n /** In-flight floors request shared across concurrent callers. */\n #suggestedOccurrenceFloorsRefreshPromise: Promise<void> | undefined;\n\n constructor(config?: TokensApiClientConfig) {\n this.#fetch = config?.fetch ?? globalThis.fetch.bind(globalThis);\n this.#queryClient = config?.queryClient;\n }\n\n /**\n * Fetch the list of ERC-20 tokens for a chain from the Tokens API.\n *\n * Returns `[]` immediately (without hitting the token-list endpoint) when\n * the chain is not in the `/v2/supportedNetworks` response, or when the\n * supported-networks check fails for any reason.\n *\n * @param hexChainId - Chain ID in hex format (e.g. `'0x1'` for Ethereum mainnet).\n * @returns Array of token list entries with address and metadata, or an empty\n * array if the chain is unsupported or the request fails.\n */\n async fetchTokenList(hexChainId: ChainId): Promise<TokenListEntry[]> {\n // Treat any error from the supported-networks check as \"not supported\":\n // the token-list endpoint is only contacted for known-supported chains.\n if (!(await this.#isSupportedChain(hexChainId).catch(() => false))) {\n return [];\n }\n\n const queryClient = this.#queryClient;\n if (queryClient === undefined) {\n return this.#fetchTokenListUncached(hexChainId);\n }\n\n return queryClient.fetchQuery({\n // Namespacing keeps this key from colliding with other clients that\n // share the same QueryClient (e.g. core-backend's ApiPlatformClient).\n queryKey: [\n 'assets-controller',\n 'rpc-detection',\n 'token-list',\n { chainId: hexChainId },\n ],\n queryFn: () => this.#fetchTokenListUncached(hexChainId),\n staleTime: TOKEN_LIST_STALE_TIME_MS,\n gcTime: TOKEN_LIST_GC_TIME_MS,\n });\n }\n\n /**\n * Check whether the given chain is present in the supported-networks list.\n *\n * Uses an instance-level cache (1 h TTL). Throws if the network request\n * fails — callers should handle this (e.g. via `.catch(() => false)`).\n *\n * @param hexChainId - Hex chain ID to check.\n * @returns `true` when the chain is in the supported-networks list.\n */\n async #isSupportedChain(hexChainId: ChainId): Promise<boolean> {\n const now = Date.now();\n if (\n this.#supportedChainIds === undefined ||\n now - this.#supportedChainIdsCachedAt >= SUPPORTED_NETWORKS_CACHE_TTL_MS\n ) {\n await this.#refreshSupportedChainIds(now);\n }\n\n const caipChainId = `eip155:${convertHexToDecimal(hexChainId)}`;\n return this.#supportedChainIds?.has(caipChainId) ?? false;\n }\n\n /**\n * Fetch `/v2/supportedNetworks` and update the instance cache.\n * Concurrent callers share the same in-flight Promise so only one network\n * request is made. If the response is not 2xx the cache is left unchanged\n * (the chain will be treated as unsupported this cycle).\n *\n * @param now - Current timestamp used to stamp the cache entry.\n * @returns A promise that resolves once the cache has been refreshed.\n */\n async #refreshSupportedChainIds(now: number): Promise<void> {\n if (this.#supportedChainIdsRefreshPromise !== undefined) {\n return this.#supportedChainIdsRefreshPromise;\n }\n\n this.#supportedChainIdsRefreshPromise = (async (): Promise<void> => {\n try {\n const response = await this.#fetch(SUPPORTED_NETWORKS_URL);\n if (response.ok) {\n const data = (await response.json()) as SupportedNetworksResponse;\n this.#supportedChainIds = new Set([\n ...(data.fullSupport ?? []),\n ...(data.partialSupport ?? []),\n ]);\n this.#supportedChainIdsCachedAt = now;\n }\n } finally {\n this.#supportedChainIdsRefreshPromise = undefined;\n }\n })();\n\n return this.#supportedChainIdsRefreshPromise;\n }\n\n /**\n * Resolve the `occurrenceFloor` query param for a chain from Token API\n * `/v1/suggestedOccurrenceFloors`. Falls back to\n * {@link DEFAULT_OCCURRENCE_FLOOR} when the chain is missing or the request\n * fails.\n *\n * @param hexChainId - Hex chain ID.\n * @returns Occurrence floor to send to `/tokens/{chainId}`.\n */\n async #getOccurrenceFloor(hexChainId: ChainId): Promise<number> {\n const now = Date.now();\n if (\n this.#suggestedOccurrenceFloors === undefined ||\n now - this.#suggestedOccurrenceFloorsCachedAt >=\n SUGGESTED_OCCURRENCE_FLOORS_CACHE_TTL_MS\n ) {\n await this.#refreshSuggestedOccurrenceFloors(now);\n }\n\n const decimalChainId = String(convertHexToDecimal(hexChainId));\n return (\n this.#suggestedOccurrenceFloors?.[decimalChainId] ??\n DEFAULT_OCCURRENCE_FLOOR\n );\n }\n\n /**\n * Fetch `/v1/suggestedOccurrenceFloors` and update the instance cache.\n * Concurrent callers share the in-flight Promise. Failures leave the cache\n * empty so {@link #getOccurrenceFloor} falls back to the default.\n *\n * @param now - Current timestamp used to stamp the cache entry.\n * @returns A promise that resolves once the cache has been refreshed.\n */\n async #refreshSuggestedOccurrenceFloors(now: number): Promise<void> {\n if (this.#suggestedOccurrenceFloorsRefreshPromise !== undefined) {\n return this.#suggestedOccurrenceFloorsRefreshPromise;\n }\n\n this.#suggestedOccurrenceFloorsRefreshPromise =\n (async (): Promise<void> => {\n try {\n const response = await this.#fetch(SUGGESTED_OCCURRENCE_FLOORS_URL);\n if (response.ok) {\n const data = (await response.json()) as Record<string, number>;\n this.#suggestedOccurrenceFloors =\n data && typeof data === 'object' && !Array.isArray(data)\n ? data\n : {};\n this.#suggestedOccurrenceFloorsCachedAt = now;\n } else {\n this.#suggestedOccurrenceFloors = {};\n this.#suggestedOccurrenceFloorsCachedAt = now;\n }\n } catch {\n this.#suggestedOccurrenceFloors = {};\n this.#suggestedOccurrenceFloorsCachedAt = now;\n } finally {\n this.#suggestedOccurrenceFloorsRefreshPromise = undefined;\n }\n })();\n\n return this.#suggestedOccurrenceFloorsRefreshPromise;\n }\n\n async #fetchTokenListUncached(\n hexChainId: ChainId,\n ): Promise<TokenListEntry[]> {\n const decimalChainId = convertHexToDecimal(hexChainId);\n const occurrenceFloor = await this.#getOccurrenceFloor(hexChainId);\n\n // Same query shape as `TokenListController.getTokensURL` (token-service.ts),\n // but `occurrenceFloor` comes from `/v1/suggestedOccurrenceFloors`.\n // No `first=...` cap — the API returns the full per-chain list bounded\n // server-side by `occurrenceFloor`.\n const url =\n `${TOKEN_END_POINT_API}/tokens/${decimalChainId}` +\n `?occurrenceFloor=${occurrenceFloor}` +\n `&includeNativeAssets=false` +\n `&includeTokenFees=false` +\n `&includeAssetType=false` +\n `&includeERC20Permit=false` +\n `&includeStorage=false` +\n `&includeRwaData=true`;\n\n let response: Response;\n try {\n response = await this.#fetch(url);\n } catch (error) {\n console.error(\n `Tokens API request failed for chain ${hexChainId}:`,\n error,\n );\n return [];\n }\n\n if (!response.ok) {\n console.error(\n `Tokens API responded with ${response.status} for chain ${hexChainId}`,\n );\n return [];\n }\n\n const raw = (await response.json()) as unknown;\n const items: ApiTokenListItem[] = Array.isArray(raw)\n ? (raw as ApiTokenListItem[])\n : [];\n\n const filtered = applyChainSpecificFilters(hexChainId, items);\n\n return filtered.map((item) => ({\n address: item.address,\n symbol: item.symbol ?? '',\n name: item.name ?? '',\n decimals: item.decimals ?? 18,\n iconUrl: item.iconUrl,\n aggregators: item.aggregators,\n occurrences: item.occurrences,\n }));\n }\n}\n\n/**\n * Apply chain-specific filters to a raw token list response, mirroring\n * `fetchTokenListByChainId` in `assets-controllers/src/token-service.ts`.\n *\n * For Linea mainnet, the API returns extras with low aggregator coverage, so\n * we keep only entries flagged by Linea's own team or seen by ≥3 aggregators.\n *\n * @param hexChainId - Hex chain ID.\n * @param items - Raw items from the API response.\n * @returns Items after chain-specific filtering.\n */\nfunction applyChainSpecificFilters(\n hexChainId: ChainId,\n items: ApiTokenListItem[],\n): ApiTokenListItem[] {\n if (hexChainId === ControllerChainId['linea-mainnet']) {\n return items.filter((item) => {\n const aggregators = item.aggregators ?? [];\n return aggregators.includes('lineaTeam') || aggregators.length >= 3;\n });\n }\n return items;\n}\n"]}
|
package/dist/data-sources/evm-rpc-services/clients/{TokensApiClient.d.ts → TokensApiClient.d.cts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChainId, TokenListEntry } from
|
|
1
|
+
import type { ChainId, TokenListEntry } from "../types/index.cjs";
|
|
2
2
|
/**
|
|
3
3
|
* Minimal structural type for the TanStack Query client method we use.
|
|
4
4
|
* Avoids a direct dependency on `@tanstack/query-core` while still being
|
|
@@ -58,4 +58,4 @@ export declare class TokensApiClient {
|
|
|
58
58
|
*/
|
|
59
59
|
fetchTokenList(hexChainId: ChainId): Promise<TokenListEntry[]>;
|
|
60
60
|
}
|
|
61
|
-
//# sourceMappingURL=TokensApiClient.d.
|
|
61
|
+
//# sourceMappingURL=TokensApiClient.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokensApiClient.d.cts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/clients/TokensApiClient.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,2BAA0B;AAgFjE;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE;QACzB,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;QAC7B,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC;;;;OAIG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,eAAe;;gBA2Bd,MAAM,CAAC,EAAE,qBAAqB;IAK1C;;;;;;;;;;OAUG;IACG,cAAc,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CA0MrE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ChainId, TokenListEntry } from "../types/index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal structural type for the TanStack Query client method we use.
|
|
4
|
+
* Avoids a direct dependency on `@tanstack/query-core` while still being
|
|
5
|
+
* fully compatible with the shared `QueryClient` exposed by
|
|
6
|
+
* `ApiPlatformClient.queryClient` (`@metamask/core-backend`).
|
|
7
|
+
*/
|
|
8
|
+
export type TokenListQueryClient = {
|
|
9
|
+
fetchQuery<TData>(options: {
|
|
10
|
+
queryKey: readonly unknown[];
|
|
11
|
+
queryFn: () => Promise<TData>;
|
|
12
|
+
staleTime?: number;
|
|
13
|
+
gcTime?: number;
|
|
14
|
+
}): Promise<TData>;
|
|
15
|
+
};
|
|
16
|
+
export type TokensApiClientConfig = {
|
|
17
|
+
/** Fetch function (defaults to globalThis.fetch). */
|
|
18
|
+
fetch?: typeof globalThis.fetch;
|
|
19
|
+
/**
|
|
20
|
+
* Optional TanStack-Query client used to cache token-list responses across
|
|
21
|
+
* detector polls / accounts / instances. When omitted, every call hits the
|
|
22
|
+
* network directly (preserves prior behaviour for tests and standalone use).
|
|
23
|
+
*/
|
|
24
|
+
queryClient?: TokenListQueryClient;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Client for the MetaMask Tokens API.
|
|
28
|
+
*
|
|
29
|
+
* Fetches the per-chain ERC-20 token list from the same endpoint that
|
|
30
|
+
* `TokenListController` uses (`token.api.cx.metamask.io/tokens/{chainId}`),
|
|
31
|
+
* with the same query parameters. The `occurrenceFloor` query param comes from
|
|
32
|
+
* Token API `/v1/suggestedOccurrenceFloors` (fallback {@link DEFAULT_OCCURRENCE_FLOOR}),
|
|
33
|
+
* matching `TokenDataSource` spam filtering. Linea's post-response aggregator
|
|
34
|
+
* filter is still applied client-side.
|
|
35
|
+
*
|
|
36
|
+
* Before fetching a chain's token list, the client checks
|
|
37
|
+
* `/v2/supportedNetworks` and returns `[]` immediately for chains that are
|
|
38
|
+
* not in the supported list, avoiding unnecessary API calls. The supported-
|
|
39
|
+
* networks response is cached in-memory for one hour.
|
|
40
|
+
*
|
|
41
|
+
* When constructed with a `queryClient`, token-list results are cached and
|
|
42
|
+
* deduped via TanStack Query (5 min staleTime, 1 h gcTime), so concurrent
|
|
43
|
+
* detection cycles for the same chain coalesce into a single network request.
|
|
44
|
+
*/
|
|
45
|
+
export declare class TokensApiClient {
|
|
46
|
+
#private;
|
|
47
|
+
constructor(config?: TokensApiClientConfig);
|
|
48
|
+
/**
|
|
49
|
+
* Fetch the list of ERC-20 tokens for a chain from the Tokens API.
|
|
50
|
+
*
|
|
51
|
+
* Returns `[]` immediately (without hitting the token-list endpoint) when
|
|
52
|
+
* the chain is not in the `/v2/supportedNetworks` response, or when the
|
|
53
|
+
* supported-networks check fails for any reason.
|
|
54
|
+
*
|
|
55
|
+
* @param hexChainId - Chain ID in hex format (e.g. `'0x1'` for Ethereum mainnet).
|
|
56
|
+
* @returns Array of token list entries with address and metadata, or an empty
|
|
57
|
+
* array if the chain is unsupported or the request fails.
|
|
58
|
+
*/
|
|
59
|
+
fetchTokenList(hexChainId: ChainId): Promise<TokenListEntry[]>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=TokensApiClient.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokensApiClient.d.mts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/clients/TokensApiClient.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,2BAA0B;AAgFjE;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE;QACzB,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;QAC7B,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC;;;;OAIG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,eAAe;;gBA2Bd,MAAM,CAAC,EAAE,qBAAqB;IAK1C;;;;;;;;;;OAUG;IACG,cAAc,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;CA0MrE"}
|
package/dist/data-sources/evm-rpc-services/clients/{TokensApiClient.js → TokensApiClient.mjs}
RENAMED
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _TokensApiClient_instances, _TokensApiClient_fetch, _TokensApiClient_queryClient, _TokensApiClient_supportedChainIds, _TokensApiClient_supportedChainIdsCachedAt, _TokensApiClient_supportedChainIdsRefreshPromise, _TokensApiClient_suggestedOccurrenceFloors, _TokensApiClient_suggestedOccurrenceFloorsCachedAt, _TokensApiClient_suggestedOccurrenceFloorsRefreshPromise, _TokensApiClient_isSupportedChain, _TokensApiClient_refreshSupportedChainIds, _TokensApiClient_getOccurrenceFloor, _TokensApiClient_refreshSuggestedOccurrenceFloors, _TokensApiClient_fetchTokenListUncached;
|
|
13
|
-
import { ChainId as ControllerChainId, convertHexToDecimal
|
|
13
|
+
import { ChainId as ControllerChainId, convertHexToDecimal } from "@metamask/controller-utils";
|
|
14
14
|
/**
|
|
15
15
|
* Same host + path that `TokenListController` (assets-controllers) uses
|
|
16
16
|
* (`token-service.ts` → `getTokensURL`). Sharing this endpoint keeps the
|
|
@@ -305,4 +305,4 @@ function applyChainSpecificFilters(hexChainId, items) {
|
|
|
305
305
|
}
|
|
306
306
|
return items;
|
|
307
307
|
}
|
|
308
|
-
//# sourceMappingURL=TokensApiClient.
|
|
308
|
+
//# sourceMappingURL=TokensApiClient.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokensApiClient.mjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/clients/TokensApiClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,OAAO,IAAI,iBAAiB,EAC5B,mBAAmB,EACpB,mCAAmC;AAIpC;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,kCAAkC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,GAAG,mBAAmB,uBAAuB,CAAC;AAE7E;;;;GAIG;AACH,MAAM,+BAA+B,GAAG,GAAG,mBAAmB,+BAA+B,CAAC;AAE9F;;;GAGG;AACH,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,+BAA+B,GAAG,EAAE,GAAG,KAAM,CAAC;AAEpD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WAAW,CAAC,MAAM,IAAI,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import {\n ChainId as ControllerChainId,\n convertHexToDecimal,\n} from '@metamask/controller-utils';\n\nimport type { ChainId, TokenListEntry } from '../types/index.js';\n\n/**\n * Same host + path that `TokenListController` (assets-controllers) uses\n * (`token-service.ts` → `getTokensURL`). Sharing this endpoint keeps the\n * RPC token detector aligned with the rest of the wallet's token listing\n * (occurrence floors, aggregator filters, icon URLs, etc.).\n */\nconst TOKEN_END_POINT_API = 'https://token.api.cx.metamask.io';\n\n/**\n * Endpoint that returns which CAIP chain IDs the Tokens API supports.\n * Used to skip detection (and avoid unnecessary network requests) for chains\n * that are not in the supported-networks list.\n */\nconst SUPPORTED_NETWORKS_URL = `${TOKEN_END_POINT_API}/v2/supportedNetworks`;\n\n/**\n * Per-chain suggested occurrence floors used as the `occurrenceFloor` query\n * param when fetching token lists (and aligned with TokenDataSource spam\n * filtering). Keys are decimal chain IDs.\n */\nconst SUGGESTED_OCCURRENCE_FLOORS_URL = `${TOKEN_END_POINT_API}/v1/suggestedOccurrenceFloors`;\n\n/**\n * Fallback `occurrenceFloor` when `/v1/suggestedOccurrenceFloors` has no entry\n * for the chain, or the floors request fails.\n */\nconst DEFAULT_OCCURRENCE_FLOOR = 3;\n\n/**\n * How long to keep the supported-networks response in the instance-level\n * cache before refreshing it. One hour is sufficient — the list rarely\n * changes and a stale cache just means we may do an unnecessary token-list\n * fetch for a newly-unsupported chain (harmless).\n */\nconst SUPPORTED_NETWORKS_CACHE_TTL_MS = 60 * 60_000;\n\n/**\n * How long to keep suggested occurrence floors cached. Same TTL as supported\n * networks — floors change infrequently.\n */\nconst SUGGESTED_OCCURRENCE_FLOORS_CACHE_TTL_MS = 60 * 60_000;\n\n/**\n * TanStack-Query cache config for the cached `fetchTokenList` path.\n *\n * The Tokens API per-chain list barely changes between polls, so we keep\n * results fresh for a few minutes (`staleTime`) and retain them in cache for\n * an hour (`gcTime`) so re-detections across accounts/chains hit the cache.\n * These tunings only apply when a `queryClient` is provided to the client;\n * the uncached fallback path (used in standalone tests) is unaffected.\n */\nconst TOKEN_LIST_STALE_TIME_MS = 5 * 60_000;\nconst TOKEN_LIST_GC_TIME_MS = 60 * 60_000;\n\n/**\n * Shape of the `/v2/supportedNetworks` response.\n */\ntype SupportedNetworksResponse = {\n fullSupport?: string[];\n partialSupport?: string[];\n};\n\n/**\n * Shape of a single item returned by the Tokens API `/tokens/{chainId}`\n * endpoint. Mirrors `TokenListToken` in\n * `packages/assets-controllers/src/TokenListController.ts` and the response\n * parsed by `fetchTokenListByChainId` in `token-service.ts`.\n */\ntype ApiTokenListItem = {\n address: string;\n symbol?: string;\n name?: string;\n decimals?: number;\n occurrences?: number;\n aggregators?: string[];\n iconUrl?: string;\n};\n\n/**\n * Minimal structural type for the TanStack Query client method we use.\n * Avoids a direct dependency on `@tanstack/query-core` while still being\n * fully compatible with the shared `QueryClient` exposed by\n * `ApiPlatformClient.queryClient` (`@metamask/core-backend`).\n */\nexport type TokenListQueryClient = {\n fetchQuery<TData>(options: {\n queryKey: readonly unknown[];\n queryFn: () => Promise<TData>;\n staleTime?: number;\n gcTime?: number;\n }): Promise<TData>;\n};\n\nexport type TokensApiClientConfig = {\n /** Fetch function (defaults to globalThis.fetch). */\n fetch?: typeof globalThis.fetch;\n /**\n * Optional TanStack-Query client used to cache token-list responses across\n * detector polls / accounts / instances. When omitted, every call hits the\n * network directly (preserves prior behaviour for tests and standalone use).\n */\n queryClient?: TokenListQueryClient;\n};\n\n/**\n * Client for the MetaMask Tokens API.\n *\n * Fetches the per-chain ERC-20 token list from the same endpoint that\n * `TokenListController` uses (`token.api.cx.metamask.io/tokens/{chainId}`),\n * with the same query parameters. The `occurrenceFloor` query param comes from\n * Token API `/v1/suggestedOccurrenceFloors` (fallback {@link DEFAULT_OCCURRENCE_FLOOR}),\n * matching `TokenDataSource` spam filtering. Linea's post-response aggregator\n * filter is still applied client-side.\n *\n * Before fetching a chain's token list, the client checks\n * `/v2/supportedNetworks` and returns `[]` immediately for chains that are\n * not in the supported list, avoiding unnecessary API calls. The supported-\n * networks response is cached in-memory for one hour.\n *\n * When constructed with a `queryClient`, token-list results are cached and\n * deduped via TanStack Query (5 min staleTime, 1 h gcTime), so concurrent\n * detection cycles for the same chain coalesce into a single network request.\n */\nexport class TokensApiClient {\n readonly #fetch: typeof globalThis.fetch;\n\n readonly #queryClient: TokenListQueryClient | undefined;\n\n /** CAIP chain IDs returned by `/v2/supportedNetworks` (both tiers). */\n #supportedChainIds: Set<string> | undefined;\n\n /** Timestamp of the last successful `/v2/supportedNetworks` fetch. */\n #supportedChainIdsCachedAt = 0;\n\n /**\n * In-flight `/v2/supportedNetworks` request shared across concurrent callers\n * so only one network request is made even when multiple `fetchTokenList`\n * calls arrive before the first one resolves.\n */\n #supportedChainIdsRefreshPromise: Promise<void> | undefined;\n\n /** Decimal chain ID → suggested occurrence floor from Token API. */\n #suggestedOccurrenceFloors: Record<string, number> | undefined;\n\n /** Timestamp of the last successful floors fetch. */\n #suggestedOccurrenceFloorsCachedAt = 0;\n\n /** In-flight floors request shared across concurrent callers. */\n #suggestedOccurrenceFloorsRefreshPromise: Promise<void> | undefined;\n\n constructor(config?: TokensApiClientConfig) {\n this.#fetch = config?.fetch ?? globalThis.fetch.bind(globalThis);\n this.#queryClient = config?.queryClient;\n }\n\n /**\n * Fetch the list of ERC-20 tokens for a chain from the Tokens API.\n *\n * Returns `[]` immediately (without hitting the token-list endpoint) when\n * the chain is not in the `/v2/supportedNetworks` response, or when the\n * supported-networks check fails for any reason.\n *\n * @param hexChainId - Chain ID in hex format (e.g. `'0x1'` for Ethereum mainnet).\n * @returns Array of token list entries with address and metadata, or an empty\n * array if the chain is unsupported or the request fails.\n */\n async fetchTokenList(hexChainId: ChainId): Promise<TokenListEntry[]> {\n // Treat any error from the supported-networks check as \"not supported\":\n // the token-list endpoint is only contacted for known-supported chains.\n if (!(await this.#isSupportedChain(hexChainId).catch(() => false))) {\n return [];\n }\n\n const queryClient = this.#queryClient;\n if (queryClient === undefined) {\n return this.#fetchTokenListUncached(hexChainId);\n }\n\n return queryClient.fetchQuery({\n // Namespacing keeps this key from colliding with other clients that\n // share the same QueryClient (e.g. core-backend's ApiPlatformClient).\n queryKey: [\n 'assets-controller',\n 'rpc-detection',\n 'token-list',\n { chainId: hexChainId },\n ],\n queryFn: () => this.#fetchTokenListUncached(hexChainId),\n staleTime: TOKEN_LIST_STALE_TIME_MS,\n gcTime: TOKEN_LIST_GC_TIME_MS,\n });\n }\n\n /**\n * Check whether the given chain is present in the supported-networks list.\n *\n * Uses an instance-level cache (1 h TTL). Throws if the network request\n * fails — callers should handle this (e.g. via `.catch(() => false)`).\n *\n * @param hexChainId - Hex chain ID to check.\n * @returns `true` when the chain is in the supported-networks list.\n */\n async #isSupportedChain(hexChainId: ChainId): Promise<boolean> {\n const now = Date.now();\n if (\n this.#supportedChainIds === undefined ||\n now - this.#supportedChainIdsCachedAt >= SUPPORTED_NETWORKS_CACHE_TTL_MS\n ) {\n await this.#refreshSupportedChainIds(now);\n }\n\n const caipChainId = `eip155:${convertHexToDecimal(hexChainId)}`;\n return this.#supportedChainIds?.has(caipChainId) ?? false;\n }\n\n /**\n * Fetch `/v2/supportedNetworks` and update the instance cache.\n * Concurrent callers share the same in-flight Promise so only one network\n * request is made. If the response is not 2xx the cache is left unchanged\n * (the chain will be treated as unsupported this cycle).\n *\n * @param now - Current timestamp used to stamp the cache entry.\n * @returns A promise that resolves once the cache has been refreshed.\n */\n async #refreshSupportedChainIds(now: number): Promise<void> {\n if (this.#supportedChainIdsRefreshPromise !== undefined) {\n return this.#supportedChainIdsRefreshPromise;\n }\n\n this.#supportedChainIdsRefreshPromise = (async (): Promise<void> => {\n try {\n const response = await this.#fetch(SUPPORTED_NETWORKS_URL);\n if (response.ok) {\n const data = (await response.json()) as SupportedNetworksResponse;\n this.#supportedChainIds = new Set([\n ...(data.fullSupport ?? []),\n ...(data.partialSupport ?? []),\n ]);\n this.#supportedChainIdsCachedAt = now;\n }\n } finally {\n this.#supportedChainIdsRefreshPromise = undefined;\n }\n })();\n\n return this.#supportedChainIdsRefreshPromise;\n }\n\n /**\n * Resolve the `occurrenceFloor` query param for a chain from Token API\n * `/v1/suggestedOccurrenceFloors`. Falls back to\n * {@link DEFAULT_OCCURRENCE_FLOOR} when the chain is missing or the request\n * fails.\n *\n * @param hexChainId - Hex chain ID.\n * @returns Occurrence floor to send to `/tokens/{chainId}`.\n */\n async #getOccurrenceFloor(hexChainId: ChainId): Promise<number> {\n const now = Date.now();\n if (\n this.#suggestedOccurrenceFloors === undefined ||\n now - this.#suggestedOccurrenceFloorsCachedAt >=\n SUGGESTED_OCCURRENCE_FLOORS_CACHE_TTL_MS\n ) {\n await this.#refreshSuggestedOccurrenceFloors(now);\n }\n\n const decimalChainId = String(convertHexToDecimal(hexChainId));\n return (\n this.#suggestedOccurrenceFloors?.[decimalChainId] ??\n DEFAULT_OCCURRENCE_FLOOR\n );\n }\n\n /**\n * Fetch `/v1/suggestedOccurrenceFloors` and update the instance cache.\n * Concurrent callers share the in-flight Promise. Failures leave the cache\n * empty so {@link #getOccurrenceFloor} falls back to the default.\n *\n * @param now - Current timestamp used to stamp the cache entry.\n * @returns A promise that resolves once the cache has been refreshed.\n */\n async #refreshSuggestedOccurrenceFloors(now: number): Promise<void> {\n if (this.#suggestedOccurrenceFloorsRefreshPromise !== undefined) {\n return this.#suggestedOccurrenceFloorsRefreshPromise;\n }\n\n this.#suggestedOccurrenceFloorsRefreshPromise =\n (async (): Promise<void> => {\n try {\n const response = await this.#fetch(SUGGESTED_OCCURRENCE_FLOORS_URL);\n if (response.ok) {\n const data = (await response.json()) as Record<string, number>;\n this.#suggestedOccurrenceFloors =\n data && typeof data === 'object' && !Array.isArray(data)\n ? data\n : {};\n this.#suggestedOccurrenceFloorsCachedAt = now;\n } else {\n this.#suggestedOccurrenceFloors = {};\n this.#suggestedOccurrenceFloorsCachedAt = now;\n }\n } catch {\n this.#suggestedOccurrenceFloors = {};\n this.#suggestedOccurrenceFloorsCachedAt = now;\n } finally {\n this.#suggestedOccurrenceFloorsRefreshPromise = undefined;\n }\n })();\n\n return this.#suggestedOccurrenceFloorsRefreshPromise;\n }\n\n async #fetchTokenListUncached(\n hexChainId: ChainId,\n ): Promise<TokenListEntry[]> {\n const decimalChainId = convertHexToDecimal(hexChainId);\n const occurrenceFloor = await this.#getOccurrenceFloor(hexChainId);\n\n // Same query shape as `TokenListController.getTokensURL` (token-service.ts),\n // but `occurrenceFloor` comes from `/v1/suggestedOccurrenceFloors`.\n // No `first=...` cap — the API returns the full per-chain list bounded\n // server-side by `occurrenceFloor`.\n const url =\n `${TOKEN_END_POINT_API}/tokens/${decimalChainId}` +\n `?occurrenceFloor=${occurrenceFloor}` +\n `&includeNativeAssets=false` +\n `&includeTokenFees=false` +\n `&includeAssetType=false` +\n `&includeERC20Permit=false` +\n `&includeStorage=false` +\n `&includeRwaData=true`;\n\n let response: Response;\n try {\n response = await this.#fetch(url);\n } catch (error) {\n console.error(\n `Tokens API request failed for chain ${hexChainId}:`,\n error,\n );\n return [];\n }\n\n if (!response.ok) {\n console.error(\n `Tokens API responded with ${response.status} for chain ${hexChainId}`,\n );\n return [];\n }\n\n const raw = (await response.json()) as unknown;\n const items: ApiTokenListItem[] = Array.isArray(raw)\n ? (raw as ApiTokenListItem[])\n : [];\n\n const filtered = applyChainSpecificFilters(hexChainId, items);\n\n return filtered.map((item) => ({\n address: item.address,\n symbol: item.symbol ?? '',\n name: item.name ?? '',\n decimals: item.decimals ?? 18,\n iconUrl: item.iconUrl,\n aggregators: item.aggregators,\n occurrences: item.occurrences,\n }));\n }\n}\n\n/**\n * Apply chain-specific filters to a raw token list response, mirroring\n * `fetchTokenListByChainId` in `assets-controllers/src/token-service.ts`.\n *\n * For Linea mainnet, the API returns extras with low aggregator coverage, so\n * we keep only entries flagged by Linea's own team or seen by ≥3 aggregators.\n *\n * @param hexChainId - Hex chain ID.\n * @param items - Raw items from the API response.\n * @returns Items after chain-specific filtering.\n */\nfunction applyChainSpecificFilters(\n hexChainId: ChainId,\n items: ApiTokenListItem[],\n): ApiTokenListItem[] {\n if (hexChainId === ControllerChainId['linea-mainnet']) {\n return items.filter((item) => {\n const aggregators = item.aggregators ?? [];\n return aggregators.includes('lineaTeam') || aggregators.length >= 3;\n });\n }\n return items;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokensApiClient = exports.MulticallClient = exports.encodeAggregate3 = exports.decodeAggregate3Response = void 0;
|
|
4
|
+
var MulticallClient_js_1 = require("./MulticallClient.cjs");
|
|
5
|
+
Object.defineProperty(exports, "decodeAggregate3Response", { enumerable: true, get: function () { return MulticallClient_js_1.decodeAggregate3Response; } });
|
|
6
|
+
Object.defineProperty(exports, "encodeAggregate3", { enumerable: true, get: function () { return MulticallClient_js_1.encodeAggregate3; } });
|
|
7
|
+
Object.defineProperty(exports, "MulticallClient", { enumerable: true, get: function () { return MulticallClient_js_1.MulticallClient; } });
|
|
8
|
+
var TokensApiClient_js_1 = require("./TokensApiClient.cjs");
|
|
9
|
+
Object.defineProperty(exports, "TokensApiClient", { enumerable: true, get: function () { return TokensApiClient_js_1.TokensApiClient; } });
|
|
10
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/clients/index.ts"],"names":[],"mappings":";;;AAAA,4DAK8B;AAJ5B,8HAAA,wBAAwB,OAAA;AACxB,sHAAA,gBAAgB,OAAA;AAChB,qHAAA,eAAe,OAAA;AAIjB,4DAI8B;AAH5B,qHAAA,eAAe,OAAA","sourcesContent":["export {\n decodeAggregate3Response,\n encodeAggregate3,\n MulticallClient,\n type MulticallClientConfig,\n} from './MulticallClient.js';\n\nexport {\n TokensApiClient,\n type TokensApiClientConfig,\n type TokenListQueryClient,\n} from './TokensApiClient.js';\n\n// Re-export provider types from types module\nexport type { GetProviderFunction, Provider } from '../types/index.js';\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { decodeAggregate3Response, encodeAggregate3, MulticallClient, type MulticallClientConfig, } from "./MulticallClient.cjs";
|
|
2
|
+
export { TokensApiClient, type TokensApiClientConfig, type TokenListQueryClient, } from "./TokensApiClient.cjs";
|
|
3
|
+
export type { GetProviderFunction, Provider } from "../types/index.cjs";
|
|
4
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/clients/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,KAAK,qBAAqB,GAC3B,8BAA6B;AAE9B,OAAO,EACL,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,8BAA6B;AAG9B,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,2BAA0B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { decodeAggregate3Response, encodeAggregate3, MulticallClient, type MulticallClientConfig, } from "./MulticallClient.mjs";
|
|
2
|
+
export { TokensApiClient, type TokensApiClientConfig, type TokenListQueryClient, } from "./TokensApiClient.mjs";
|
|
3
|
+
export type { GetProviderFunction, Provider } from "../types/index.mjs";
|
|
4
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/clients/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,KAAK,qBAAqB,GAC3B,8BAA6B;AAE9B,OAAO,EACL,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,8BAA6B;AAG9B,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,2BAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/clients/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EAEhB,8BAA6B;AAE9B,OAAO,EACL,eAAe,EAGhB,8BAA6B","sourcesContent":["export {\n decodeAggregate3Response,\n encodeAggregate3,\n MulticallClient,\n type MulticallClientConfig,\n} from './MulticallClient.js';\n\nexport {\n TokensApiClient,\n type TokensApiClientConfig,\n type TokenListQueryClient,\n} from './TokensApiClient.js';\n\n// Re-export provider types from types module\nexport type { GetProviderFunction, Provider } from '../types/index.js';\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reduceInBatchesSerially = exports.divideIntoBatches = exports.isStakingContractAssetId = exports.getStakingContractAddress = exports.getSupportedStakingChainIds = exports.StakedBalanceFetcher = exports.TokenDetector = exports.BalanceFetcher = exports.TokensApiClient = exports.MulticallClient = void 0;
|
|
4
|
+
var index_js_1 = require("./clients/index.cjs");
|
|
5
|
+
Object.defineProperty(exports, "MulticallClient", { enumerable: true, get: function () { return index_js_1.MulticallClient; } });
|
|
6
|
+
Object.defineProperty(exports, "TokensApiClient", { enumerable: true, get: function () { return index_js_1.TokensApiClient; } });
|
|
7
|
+
var index_js_2 = require("./services/index.cjs");
|
|
8
|
+
Object.defineProperty(exports, "BalanceFetcher", { enumerable: true, get: function () { return index_js_2.BalanceFetcher; } });
|
|
9
|
+
Object.defineProperty(exports, "TokenDetector", { enumerable: true, get: function () { return index_js_2.TokenDetector; } });
|
|
10
|
+
Object.defineProperty(exports, "StakedBalanceFetcher", { enumerable: true, get: function () { return index_js_2.StakedBalanceFetcher; } });
|
|
11
|
+
Object.defineProperty(exports, "getSupportedStakingChainIds", { enumerable: true, get: function () { return index_js_2.getSupportedStakingChainIds; } });
|
|
12
|
+
Object.defineProperty(exports, "getStakingContractAddress", { enumerable: true, get: function () { return index_js_2.getStakingContractAddress; } });
|
|
13
|
+
Object.defineProperty(exports, "isStakingContractAssetId", { enumerable: true, get: function () { return index_js_2.isStakingContractAssetId; } });
|
|
14
|
+
var index_js_3 = require("./utils/index.cjs");
|
|
15
|
+
Object.defineProperty(exports, "divideIntoBatches", { enumerable: true, get: function () { return index_js_3.divideIntoBatches; } });
|
|
16
|
+
Object.defineProperty(exports, "reduceInBatchesSerially", { enumerable: true, get: function () { return index_js_3.reduceInBatchesSerially; } });
|
|
17
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/data-sources/evm-rpc-services/index.ts"],"names":[],"mappings":";;;AAaA,gDAM4B;AAL1B,2GAAA,eAAe,OAAA;AAEf,2GAAA,eAAe,OAAA;AAIjB,iDAc6B;AAb3B,0GAAA,cAAc,OAAA;AACd,yGAAA,aAAa,OAAA;AACb,gHAAA,oBAAoB,OAAA;AACpB,uHAAA,2BAA2B,OAAA;AAC3B,qHAAA,yBAAyB,OAAA;AACzB,oHAAA,wBAAwB,OAAA;AAS1B,8CAA8E;AAArE,6GAAA,iBAAiB,OAAA;AAAE,mHAAA,uBAAuB,OAAA","sourcesContent":["export type {\n Address,\n AssetFetchEntry,\n AssetsBalanceState,\n ChainId,\n GetProviderFunction,\n Provider,\n BalanceOfRequest,\n BalanceOfResponse,\n TokenListState,\n BalanceFetchResult,\n TokenDetectionResult,\n} from './types/index.js';\nexport {\n MulticallClient,\n type MulticallClientConfig,\n TokensApiClient,\n type TokensApiClientConfig,\n type TokenListQueryClient,\n} from './clients/index.js';\nexport {\n BalanceFetcher,\n TokenDetector,\n StakedBalanceFetcher,\n getSupportedStakingChainIds,\n getStakingContractAddress,\n isStakingContractAssetId,\n type BalancePollingInput,\n type DetectionPollingInput,\n type StakedBalancePollingInput,\n type StakedBalanceFetchResult,\n type OnBalanceUpdateCallback,\n type OnDetectionUpdateCallback,\n type OnStakedBalanceUpdateCallback,\n} from './services/index.js';\nexport { divideIntoBatches, reduceInBatchesSerially } from './utils/index.js';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { Address, AssetFetchEntry, AssetsBalanceState, ChainId, GetProviderFunction, Provider, BalanceOfRequest, BalanceOfResponse, TokenListState, BalanceFetchResult, TokenDetectionResult, } from
|
|
2
|
-
export { MulticallClient, type MulticallClientConfig, TokensApiClient, type TokensApiClientConfig, type TokenListQueryClient, } from
|
|
3
|
-
export { BalanceFetcher, TokenDetector, StakedBalanceFetcher, getSupportedStakingChainIds, getStakingContractAddress, isStakingContractAssetId, type BalancePollingInput, type DetectionPollingInput, type StakedBalancePollingInput, type StakedBalanceFetchResult, type OnBalanceUpdateCallback, type OnDetectionUpdateCallback, type OnStakedBalanceUpdateCallback, } from
|
|
4
|
-
export { divideIntoBatches, reduceInBatchesSerially } from
|
|
5
|
-
//# sourceMappingURL=index.d.
|
|
1
|
+
export type { Address, AssetFetchEntry, AssetsBalanceState, ChainId, GetProviderFunction, Provider, BalanceOfRequest, BalanceOfResponse, TokenListState, BalanceFetchResult, TokenDetectionResult, } from "./types/index.cjs";
|
|
2
|
+
export { MulticallClient, type MulticallClientConfig, TokensApiClient, type TokensApiClientConfig, type TokenListQueryClient, } from "./clients/index.cjs";
|
|
3
|
+
export { BalanceFetcher, TokenDetector, StakedBalanceFetcher, getSupportedStakingChainIds, getStakingContractAddress, isStakingContractAssetId, type BalancePollingInput, type DetectionPollingInput, type StakedBalancePollingInput, type StakedBalanceFetchResult, type OnBalanceUpdateCallback, type OnDetectionUpdateCallback, type OnStakedBalanceUpdateCallback, } from "./services/index.cjs";
|
|
4
|
+
export { divideIntoBatches, reduceInBatchesSerially } from "./utils/index.cjs";
|
|
5
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/data-sources/evm-rpc-services/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,mBAAmB,EACnB,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,GACrB,0BAAyB;AAC1B,OAAO,EACL,eAAe,EACf,KAAK,qBAAqB,EAC1B,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,4BAA2B;AAC5B,OAAO,EACL,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,GACnC,6BAA4B;AAC7B,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,0BAAyB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { Address, AssetFetchEntry, AssetsBalanceState, ChainId, GetProviderFunction, Provider, BalanceOfRequest, BalanceOfResponse, TokenListState, BalanceFetchResult, TokenDetectionResult, } from "./types/index.mjs";
|
|
2
|
+
export { MulticallClient, type MulticallClientConfig, TokensApiClient, type TokensApiClientConfig, type TokenListQueryClient, } from "./clients/index.mjs";
|
|
3
|
+
export { BalanceFetcher, TokenDetector, StakedBalanceFetcher, getSupportedStakingChainIds, getStakingContractAddress, isStakingContractAssetId, type BalancePollingInput, type DetectionPollingInput, type StakedBalancePollingInput, type StakedBalanceFetchResult, type OnBalanceUpdateCallback, type OnDetectionUpdateCallback, type OnStakedBalanceUpdateCallback, } from "./services/index.mjs";
|
|
4
|
+
export { divideIntoBatches, reduceInBatchesSerially } from "./utils/index.mjs";
|
|
5
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/data-sources/evm-rpc-services/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,mBAAmB,EACnB,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,GACrB,0BAAyB;AAC1B,OAAO,EACL,eAAe,EACf,KAAK,qBAAqB,EAC1B,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,4BAA2B;AAC5B,OAAO,EACL,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,GACnC,6BAA4B;AAC7B,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,0BAAyB"}
|