@metamask/assets-controllers 38.0.0 → 38.1.0
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 +37 -1
- package/dist/AccountTrackerController.cjs +245 -0
- package/dist/AccountTrackerController.cjs.map +1 -0
- package/dist/{types/AccountTrackerController.d.ts → AccountTrackerController.d.cts} +6 -6
- package/dist/AccountTrackerController.d.cts.map +1 -0
- package/dist/AccountTrackerController.d.mts +112 -0
- package/dist/AccountTrackerController.d.mts.map +1 -0
- package/dist/AccountTrackerController.mjs +244 -8
- package/dist/AccountTrackerController.mjs.map +1 -1
- package/dist/AssetsContractController.cjs +389 -0
- package/dist/AssetsContractController.cjs.map +1 -0
- package/dist/{types/AssetsContractController.d.ts → AssetsContractController.d.cts} +9 -9
- package/dist/AssetsContractController.d.cts.map +1 -0
- package/dist/AssetsContractController.d.mts +277 -0
- package/dist/AssetsContractController.d.mts.map +1 -0
- package/dist/AssetsContractController.mjs +387 -16
- package/dist/AssetsContractController.mjs.map +1 -1
- package/dist/CurrencyRateController.cjs +156 -0
- package/dist/CurrencyRateController.cjs.map +1 -0
- package/dist/{types/CurrencyRateController.d.ts → CurrencyRateController.d.cts} +5 -5
- package/dist/CurrencyRateController.d.cts.map +1 -0
- package/dist/CurrencyRateController.d.mts +80 -0
- package/dist/CurrencyRateController.d.mts.map +1 -0
- package/dist/CurrencyRateController.mjs +150 -10
- package/dist/CurrencyRateController.mjs.map +1 -1
- package/dist/NftController.cjs +1159 -0
- package/dist/NftController.cjs.map +1 -0
- package/dist/{types/NftController.d.ts → NftController.d.cts} +11 -11
- package/dist/NftController.d.cts.map +1 -0
- package/dist/NftController.d.mts +424 -0
- package/dist/NftController.d.mts.map +1 -0
- package/dist/NftController.mjs +1156 -12
- package/dist/NftController.mjs.map +1 -1
- package/dist/NftDetectionController.cjs +237 -0
- package/dist/NftDetectionController.cjs.map +1 -0
- package/dist/{types/NftDetectionController.d.ts → NftDetectionController.d.cts} +9 -9
- package/dist/NftDetectionController.d.cts.map +1 -0
- package/dist/NftDetectionController.d.mts +368 -0
- package/dist/NftDetectionController.d.mts.map +1 -0
- package/dist/NftDetectionController.mjs +231 -14
- package/dist/NftDetectionController.mjs.map +1 -1
- package/dist/RatesController/RatesController.cjs +189 -0
- package/dist/RatesController/RatesController.cjs.map +1 -0
- package/dist/{types/RatesController/RatesController.d.ts → RatesController/RatesController.d.cts} +3 -3
- package/dist/RatesController/RatesController.d.cts.map +1 -0
- package/dist/RatesController/RatesController.d.mts +44 -0
- package/dist/RatesController/RatesController.d.mts.map +1 -0
- package/dist/RatesController/RatesController.mjs +183 -12
- package/dist/RatesController/RatesController.mjs.map +1 -1
- package/dist/RatesController/index.cjs +7 -0
- package/dist/RatesController/index.cjs.map +1 -0
- package/dist/{types/RatesController/index.d.ts → RatesController/index.d.cts} +3 -3
- package/dist/RatesController/index.d.cts.map +1 -0
- package/dist/RatesController/index.d.mts +3 -0
- package/dist/RatesController/index.d.mts.map +1 -0
- package/dist/RatesController/index.mjs +1 -12
- package/dist/RatesController/index.mjs.map +1 -1
- package/dist/RatesController/types.cjs +3 -0
- package/dist/RatesController/types.cjs.map +1 -0
- package/dist/{types/RatesController/types.d.ts → RatesController/types.d.cts} +4 -4
- package/dist/RatesController/types.d.cts.map +1 -0
- package/dist/RatesController/types.d.mts +100 -0
- package/dist/RatesController/types.d.mts.map +1 -0
- package/dist/RatesController/types.mjs +1 -0
- package/dist/RatesController/types.mjs.map +1 -1
- package/dist/Standards/ERC20Standard.cjs +124 -0
- package/dist/Standards/ERC20Standard.cjs.map +1 -0
- package/dist/{types/Standards/ERC20Standard.d.ts → Standards/ERC20Standard.d.cts} +3 -3
- package/dist/Standards/ERC20Standard.d.cts.map +1 -0
- package/dist/Standards/ERC20Standard.d.mts +49 -0
- package/dist/Standards/ERC20Standard.d.mts.map +1 -0
- package/dist/Standards/ERC20Standard.mjs +121 -8
- package/dist/Standards/ERC20Standard.mjs.map +1 -1
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.cjs +189 -0
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.cjs.map +1 -0
- package/dist/{types/Standards/NftStandards/ERC1155/ERC1155Standard.d.ts → Standards/NftStandards/ERC1155/ERC1155Standard.d.cts} +3 -3
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.d.cts.map +1 -0
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.d.mts +95 -0
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.d.mts.map +1 -0
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.mjs +184 -8
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.mjs.map +1 -1
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.cjs +167 -0
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.cjs.map +1 -0
- package/dist/{types/Standards/NftStandards/ERC721/ERC721Standard.d.ts → Standards/NftStandards/ERC721/ERC721Standard.d.cts} +2 -2
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.d.cts.map +1 -0
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.d.mts +89 -0
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.d.mts.map +1 -0
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.mjs +162 -8
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.mjs.map +1 -1
- package/dist/TokenBalancesController.cjs +136 -0
- package/dist/TokenBalancesController.cjs.map +1 -0
- package/dist/{types/TokenBalancesController.d.ts → TokenBalancesController.d.cts} +7 -7
- package/dist/TokenBalancesController.d.cts.map +1 -0
- package/dist/TokenBalancesController.d.mts +82 -0
- package/dist/TokenBalancesController.d.mts.map +1 -0
- package/dist/TokenBalancesController.mjs +129 -10
- package/dist/TokenBalancesController.mjs.map +1 -1
- package/dist/TokenDetectionController.cjs +368 -0
- package/dist/TokenDetectionController.cjs.map +1 -0
- package/dist/{types/TokenDetectionController.d.ts → TokenDetectionController.d.cts} +10 -10
- package/dist/TokenDetectionController.d.cts.map +1 -0
- package/dist/TokenDetectionController.d.mts +109 -0
- package/dist/TokenDetectionController.d.mts.map +1 -0
- package/dist/TokenDetectionController.mjs +365 -15
- package/dist/TokenDetectionController.mjs.map +1 -1
- package/dist/TokenListController.cjs +274 -0
- package/dist/TokenListController.cjs.map +1 -0
- package/dist/{types/TokenListController.d.ts → TokenListController.d.cts} +5 -5
- package/dist/TokenListController.d.cts.map +1 -0
- package/dist/TokenListController.d.mts +117 -0
- package/dist/TokenListController.d.mts.map +1 -0
- package/dist/TokenListController.mjs +267 -12
- package/dist/TokenListController.mjs.map +1 -1
- package/dist/TokenRatesController.cjs +452 -0
- package/dist/TokenRatesController.cjs.map +1 -0
- package/dist/{types/TokenRatesController.d.ts → TokenRatesController.d.cts} +8 -8
- package/dist/TokenRatesController.d.cts.map +1 -0
- package/dist/TokenRatesController.d.mts +170 -0
- package/dist/TokenRatesController.d.mts.map +1 -0
- package/dist/TokenRatesController.mjs +446 -16
- package/dist/TokenRatesController.mjs.map +1 -1
- package/dist/TokensController.cjs +678 -0
- package/dist/TokensController.cjs.map +1 -0
- package/dist/{types/TokensController.d.ts → TokensController.d.cts} +9 -9
- package/dist/TokensController.d.cts.map +1 -0
- package/dist/TokensController.d.mts +165 -0
- package/dist/TokensController.d.mts.map +1 -0
- package/dist/TokensController.mjs +675 -14
- package/dist/TokensController.mjs.map +1 -1
- package/dist/assetsUtil.cjs +358 -0
- package/dist/assetsUtil.cjs.map +1 -0
- package/dist/{types/assetsUtil.d.ts → assetsUtil.d.cts} +7 -7
- package/dist/assetsUtil.d.cts.map +1 -0
- package/dist/assetsUtil.d.mts +177 -0
- package/dist/assetsUtil.d.mts.map +1 -0
- package/dist/assetsUtil.mjs +343 -36
- package/dist/assetsUtil.mjs.map +1 -1
- package/dist/constants.cjs +10 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/{types/constants.d.ts → constants.d.cts} +1 -1
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.mts +6 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +6 -7
- package/dist/constants.mjs.map +1 -1
- package/dist/crypto-compare-service/crypto-compare.cjs +119 -0
- package/dist/crypto-compare-service/crypto-compare.cjs.map +1 -0
- package/dist/{types/crypto-compare-service/crypto-compare.d.ts → crypto-compare-service/crypto-compare.d.cts} +1 -1
- package/dist/crypto-compare-service/crypto-compare.d.cts.map +1 -0
- package/dist/crypto-compare-service/crypto-compare.d.mts +22 -0
- package/dist/crypto-compare-service/crypto-compare.d.mts.map +1 -0
- package/dist/crypto-compare-service/crypto-compare.mjs +113 -9
- package/dist/crypto-compare-service/crypto-compare.mjs.map +1 -1
- package/dist/crypto-compare-service/index.cjs +7 -0
- package/dist/crypto-compare-service/index.cjs.map +1 -0
- package/dist/crypto-compare-service/index.d.cts +2 -0
- package/dist/crypto-compare-service/index.d.cts.map +1 -0
- package/dist/crypto-compare-service/index.d.mts +2 -0
- package/dist/crypto-compare-service/index.d.mts.map +1 -0
- package/dist/crypto-compare-service/index.mjs +1 -10
- package/dist/crypto-compare-service/index.mjs.map +1 -1
- package/dist/index.cjs +51 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{types/index.d.ts → index.d.cts} +24 -24
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +24 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +13 -80
- package/dist/index.mjs.map +1 -1
- package/dist/token-prices-service/abstract-token-prices-service.cjs +3 -0
- package/dist/token-prices-service/abstract-token-prices-service.cjs.map +1 -0
- package/dist/{types/token-prices-service/abstract-token-prices-service.d.ts → token-prices-service/abstract-token-prices-service.d.cts} +2 -2
- package/dist/token-prices-service/abstract-token-prices-service.d.cts.map +1 -0
- package/dist/token-prices-service/abstract-token-prices-service.d.mts +79 -0
- package/dist/token-prices-service/abstract-token-prices-service.d.mts.map +1 -0
- package/dist/token-prices-service/abstract-token-prices-service.mjs +1 -0
- package/dist/token-prices-service/abstract-token-prices-service.mjs.map +1 -1
- package/dist/token-prices-service/codefi-v2.cjs +352 -0
- package/dist/token-prices-service/codefi-v2.cjs.map +1 -0
- package/dist/{types/token-prices-service/codefi-v2.d.ts → token-prices-service/codefi-v2.d.cts} +3 -3
- package/dist/token-prices-service/codefi-v2.d.cts.map +1 -0
- package/dist/token-prices-service/codefi-v2.d.mts +97 -0
- package/dist/token-prices-service/codefi-v2.d.mts.map +1 -0
- package/dist/token-prices-service/codefi-v2.mjs +347 -12
- package/dist/token-prices-service/codefi-v2.mjs.map +1 -1
- package/dist/token-prices-service/index.cjs +7 -0
- package/dist/token-prices-service/index.cjs.map +1 -0
- package/dist/token-prices-service/index.d.cts +3 -0
- package/dist/token-prices-service/index.d.cts.map +1 -0
- package/dist/token-prices-service/index.d.mts +3 -0
- package/dist/token-prices-service/index.d.mts.map +1 -0
- package/dist/token-prices-service/index.mjs +1 -10
- package/dist/token-prices-service/index.mjs.map +1 -1
- package/dist/token-service.cjs +130 -0
- package/dist/token-service.cjs.map +1 -0
- package/dist/{types/token-service.d.ts → token-service.d.cts} +2 -2
- package/dist/token-service.d.cts.map +1 -0
- package/dist/token-service.d.mts +31 -0
- package/dist/token-service.d.mts.map +1 -0
- package/dist/token-service.mjs +124 -14
- package/dist/token-service.mjs.map +1 -1
- package/package.json +21 -16
- package/dist/AccountTrackerController.js +0 -10
- package/dist/AccountTrackerController.js.map +0 -1
- package/dist/AssetsContractController.js +0 -18
- package/dist/AssetsContractController.js.map +0 -1
- package/dist/CurrencyRateController.js +0 -12
- package/dist/CurrencyRateController.js.map +0 -1
- package/dist/NftController.js +0 -14
- package/dist/NftController.js.map +0 -1
- package/dist/NftDetectionController.js +0 -16
- package/dist/NftDetectionController.js.map +0 -1
- package/dist/RatesController/RatesController.js +0 -14
- package/dist/RatesController/RatesController.js.map +0 -1
- package/dist/RatesController/index.js +0 -13
- package/dist/RatesController/index.js.map +0 -1
- package/dist/RatesController/types.js +0 -1
- package/dist/RatesController/types.js.map +0 -1
- package/dist/Standards/ERC20Standard.js +0 -9
- package/dist/Standards/ERC20Standard.js.map +0 -1
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.js +0 -9
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.js.map +0 -1
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.js +0 -9
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.js.map +0 -1
- package/dist/TokenBalancesController.js +0 -12
- package/dist/TokenBalancesController.js.map +0 -1
- package/dist/TokenDetectionController.js +0 -17
- package/dist/TokenDetectionController.js.map +0 -1
- package/dist/TokenListController.js +0 -14
- package/dist/TokenListController.js.map +0 -1
- package/dist/TokenRatesController.js +0 -18
- package/dist/TokenRatesController.js.map +0 -1
- package/dist/TokensController.js +0 -16
- package/dist/TokensController.js.map +0 -1
- package/dist/assetsUtil.js +0 -38
- package/dist/assetsUtil.js.map +0 -1
- package/dist/chunk-27KOXCQK.mjs +0 -1
- package/dist/chunk-27KOXCQK.mjs.map +0 -1
- package/dist/chunk-2TZK6YZA.js +0 -1405
- package/dist/chunk-2TZK6YZA.js.map +0 -1
- package/dist/chunk-3LPQTUGG.js +0 -434
- package/dist/chunk-3LPQTUGG.js.map +0 -1
- package/dist/chunk-3QDXAE2D.mjs +0 -178
- package/dist/chunk-3QDXAE2D.mjs.map +0 -1
- package/dist/chunk-46KUC5FH.mjs +0 -434
- package/dist/chunk-46KUC5FH.mjs.map +0 -1
- package/dist/chunk-4QZESU46.mjs +0 -530
- package/dist/chunk-4QZESU46.mjs.map +0 -1
- package/dist/chunk-5QLC2MHV.js +0 -215
- package/dist/chunk-5QLC2MHV.js.map +0 -1
- package/dist/chunk-7K6PSEAA.js +0 -1
- package/dist/chunk-7K6PSEAA.js.map +0 -1
- package/dist/chunk-AX522TDL.mjs +0 -85
- package/dist/chunk-AX522TDL.mjs.map +0 -1
- package/dist/chunk-AZSIKIMK.mjs +0 -429
- package/dist/chunk-AZSIKIMK.mjs.map +0 -1
- package/dist/chunk-BBCZM5P4.js +0 -300
- package/dist/chunk-BBCZM5P4.js.map +0 -1
- package/dist/chunk-BZEAPSD5.mjs +0 -215
- package/dist/chunk-BZEAPSD5.mjs.map +0 -1
- package/dist/chunk-C7LNCQXM.mjs +0 -300
- package/dist/chunk-C7LNCQXM.mjs.map +0 -1
- package/dist/chunk-CP3HC7AQ.mjs +0 -12
- package/dist/chunk-CP3HC7AQ.mjs.map +0 -1
- package/dist/chunk-FWKV5FGP.mjs +0 -71
- package/dist/chunk-FWKV5FGP.mjs.map +0 -1
- package/dist/chunk-GDFLKKDY.js +0 -71
- package/dist/chunk-GDFLKKDY.js.map +0 -1
- package/dist/chunk-GW6RE66P.mjs +0 -210
- package/dist/chunk-GW6RE66P.mjs.map +0 -1
- package/dist/chunk-HVOIBGYN.js +0 -282
- package/dist/chunk-HVOIBGYN.js.map +0 -1
- package/dist/chunk-ISK2VSBB.js +0 -178
- package/dist/chunk-ISK2VSBB.js.map +0 -1
- package/dist/chunk-JCR4H6YL.js +0 -115
- package/dist/chunk-JCR4H6YL.js.map +0 -1
- package/dist/chunk-JJX7TMH5.mjs +0 -135
- package/dist/chunk-JJX7TMH5.mjs.map +0 -1
- package/dist/chunk-JMZ7KWJS.js +0 -157
- package/dist/chunk-JMZ7KWJS.js.map +0 -1
- package/dist/chunk-JYHAAA6W.mjs +0 -1
- package/dist/chunk-JYHAAA6W.mjs.map +0 -1
- package/dist/chunk-K7A3EOIM.js +0 -85
- package/dist/chunk-K7A3EOIM.js.map +0 -1
- package/dist/chunk-KPBNX6GP.mjs +0 -215
- package/dist/chunk-KPBNX6GP.mjs.map +0 -1
- package/dist/chunk-LKVWPNXY.js +0 -429
- package/dist/chunk-LKVWPNXY.js.map +0 -1
- package/dist/chunk-MZI3SDQN.js +0 -215
- package/dist/chunk-MZI3SDQN.js.map +0 -1
- package/dist/chunk-NDUMUEE6.js +0 -812
- package/dist/chunk-NDUMUEE6.js.map +0 -1
- package/dist/chunk-OBUR4TXH.js +0 -1
- package/dist/chunk-OBUR4TXH.js.map +0 -1
- package/dist/chunk-RGHTNZQ6.js +0 -12
- package/dist/chunk-RGHTNZQ6.js.map +0 -1
- package/dist/chunk-S5CFNNOM.mjs +0 -115
- package/dist/chunk-S5CFNNOM.mjs.map +0 -1
- package/dist/chunk-SK2B36Q4.mjs +0 -1405
- package/dist/chunk-SK2B36Q4.mjs.map +0 -1
- package/dist/chunk-TFLYM4PY.mjs +0 -291
- package/dist/chunk-TFLYM4PY.mjs.map +0 -1
- package/dist/chunk-TIFLP53R.js +0 -210
- package/dist/chunk-TIFLP53R.js.map +0 -1
- package/dist/chunk-TTH3ES66.mjs +0 -1
- package/dist/chunk-TTH3ES66.mjs.map +0 -1
- package/dist/chunk-UKXD6WUT.mjs +0 -157
- package/dist/chunk-UKXD6WUT.mjs.map +0 -1
- package/dist/chunk-UUF4E7OG.js +0 -530
- package/dist/chunk-UUF4E7OG.js.map +0 -1
- package/dist/chunk-V6DNVROD.js +0 -348
- package/dist/chunk-V6DNVROD.js.map +0 -1
- package/dist/chunk-XC3SOOGC.js +0 -1
- package/dist/chunk-XC3SOOGC.js.map +0 -1
- package/dist/chunk-XMQA5NLX.mjs +0 -812
- package/dist/chunk-XMQA5NLX.mjs.map +0 -1
- package/dist/chunk-XQO3EG4J.mjs +0 -348
- package/dist/chunk-XQO3EG4J.mjs.map +0 -1
- package/dist/chunk-XUI43LEZ.mjs +0 -30
- package/dist/chunk-XUI43LEZ.mjs.map +0 -1
- package/dist/chunk-YGGUAMHV.js +0 -135
- package/dist/chunk-YGGUAMHV.js.map +0 -1
- package/dist/chunk-Z4BLTVTB.js +0 -30
- package/dist/chunk-Z4BLTVTB.js.map +0 -1
- package/dist/chunk-Z7RMCHD4.mjs +0 -282
- package/dist/chunk-Z7RMCHD4.mjs.map +0 -1
- package/dist/chunk-ZAR4BIOC.js +0 -291
- package/dist/chunk-ZAR4BIOC.js.map +0 -1
- package/dist/constants.js +0 -8
- package/dist/constants.js.map +0 -1
- package/dist/crypto-compare-service/crypto-compare.js +0 -10
- package/dist/crypto-compare-service/crypto-compare.js.map +0 -1
- package/dist/crypto-compare-service/index.js +0 -11
- package/dist/crypto-compare-service/index.js.map +0 -1
- package/dist/index.js +0 -81
- package/dist/index.js.map +0 -1
- package/dist/token-prices-service/abstract-token-prices-service.js +0 -1
- package/dist/token-prices-service/abstract-token-prices-service.js.map +0 -1
- package/dist/token-prices-service/codefi-v2.js +0 -14
- package/dist/token-prices-service/codefi-v2.js.map +0 -1
- package/dist/token-prices-service/index.js +0 -11
- package/dist/token-prices-service/index.js.map +0 -1
- package/dist/token-service.js +0 -15
- package/dist/token-service.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/AccountTrackerController.d.ts.map +0 -1
- package/dist/types/AssetsContractController.d.ts.map +0 -1
- package/dist/types/CurrencyRateController.d.ts.map +0 -1
- package/dist/types/NftController.d.ts.map +0 -1
- package/dist/types/NftDetectionController.d.ts.map +0 -1
- package/dist/types/RatesController/RatesController.d.ts.map +0 -1
- package/dist/types/RatesController/index.d.ts.map +0 -1
- package/dist/types/RatesController/types.d.ts.map +0 -1
- package/dist/types/Standards/ERC20Standard.d.ts.map +0 -1
- package/dist/types/Standards/NftStandards/ERC1155/ERC1155Standard.d.ts.map +0 -1
- package/dist/types/Standards/NftStandards/ERC721/ERC721Standard.d.ts.map +0 -1
- package/dist/types/TokenBalancesController.d.ts.map +0 -1
- package/dist/types/TokenDetectionController.d.ts.map +0 -1
- package/dist/types/TokenListController.d.ts.map +0 -1
- package/dist/types/TokenRatesController.d.ts.map +0 -1
- package/dist/types/TokensController.d.ts.map +0 -1
- package/dist/types/assetsUtil.d.ts.map +0 -1
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/crypto-compare-service/crypto-compare.d.ts.map +0 -1
- package/dist/types/crypto-compare-service/index.d.ts +0 -2
- package/dist/types/crypto-compare-service/index.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/token-prices-service/abstract-token-prices-service.d.ts.map +0 -1
- package/dist/types/token-prices-service/codefi-v2.d.ts.map +0 -1
- package/dist/types/token-prices-service/index.d.ts +0 -3
- package/dist/types/token-prices-service/index.d.ts.map +0 -1
- package/dist/types/token-service.d.ts.map +0 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchTokenMetadata = exports.fetchTokenListByChainId = exports.TOKEN_METADATA_NO_SUPPORT_ERROR = exports.TOKEN_END_POINT_API = void 0;
|
|
4
|
+
const controller_utils_1 = require("@metamask/controller-utils");
|
|
5
|
+
const assetsUtil_1 = require("./assetsUtil.cjs");
|
|
6
|
+
exports.TOKEN_END_POINT_API = 'https://token.api.cx.metamask.io';
|
|
7
|
+
exports.TOKEN_METADATA_NO_SUPPORT_ERROR = 'TokenService Error: Network does not support fetchTokenMetadata';
|
|
8
|
+
/**
|
|
9
|
+
* Get the tokens URL for a specific network.
|
|
10
|
+
*
|
|
11
|
+
* @param chainId - The chain ID of the network the tokens requested are on.
|
|
12
|
+
* @returns The tokens URL.
|
|
13
|
+
*/
|
|
14
|
+
function getTokensURL(chainId) {
|
|
15
|
+
const occurrenceFloor = chainId === controller_utils_1.ChainId['linea-mainnet'] ? 1 : 3;
|
|
16
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
18
|
+
return `${exports.TOKEN_END_POINT_API}/tokens/${(0, controller_utils_1.convertHexToDecimal)(chainId)}?occurrenceFloor=${occurrenceFloor}&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the token metadata URL for the given network and token.
|
|
22
|
+
*
|
|
23
|
+
* @param chainId - The chain ID of the network the token is on.
|
|
24
|
+
* @param tokenAddress - The token address.
|
|
25
|
+
* @returns The token metadata URL.
|
|
26
|
+
*/
|
|
27
|
+
function getTokenMetadataURL(chainId, tokenAddress) {
|
|
28
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
30
|
+
return `${exports.TOKEN_END_POINT_API}/token/${(0, controller_utils_1.convertHexToDecimal)(chainId)}?address=${tokenAddress}`;
|
|
31
|
+
}
|
|
32
|
+
const tenSecondsInMilliseconds = 10000;
|
|
33
|
+
// Token list averages 1.6 MB in size
|
|
34
|
+
// timeoutFetch by default has a 500ms timeout, which will almost always timeout given the response size.
|
|
35
|
+
const defaultTimeout = tenSecondsInMilliseconds;
|
|
36
|
+
/**
|
|
37
|
+
* Fetch the list of token metadata for a given network. This request is cancellable using the
|
|
38
|
+
* abort signal passed in.
|
|
39
|
+
*
|
|
40
|
+
* @param chainId - The chain ID of the network the requested tokens are on.
|
|
41
|
+
* @param abortSignal - The abort signal used to cancel the request if necessary.
|
|
42
|
+
* @param options - Additional fetch options.
|
|
43
|
+
* @param options.timeout - The fetch timeout.
|
|
44
|
+
* @returns The token list, or `undefined` if the request was cancelled.
|
|
45
|
+
*/
|
|
46
|
+
async function fetchTokenListByChainId(chainId, abortSignal, { timeout = defaultTimeout } = {}) {
|
|
47
|
+
const tokenURL = getTokensURL(chainId);
|
|
48
|
+
const response = await queryApi(tokenURL, abortSignal, timeout);
|
|
49
|
+
if (response) {
|
|
50
|
+
const result = await parseJsonResponse(response);
|
|
51
|
+
if (Array.isArray(result) && chainId === controller_utils_1.ChainId['linea-mainnet']) {
|
|
52
|
+
return result.filter((elm) => elm.aggregators.includes('lineaTeam') || elm.aggregators.length >= 3);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
exports.fetchTokenListByChainId = fetchTokenListByChainId;
|
|
59
|
+
/**
|
|
60
|
+
* Fetch metadata for the token address provided for a given network. This request is cancellable
|
|
61
|
+
* using the abort signal passed in.
|
|
62
|
+
*
|
|
63
|
+
* @param chainId - The chain ID of the network the token is on.
|
|
64
|
+
* @param tokenAddress - The address of the token to fetch metadata for.
|
|
65
|
+
* @param abortSignal - The abort signal used to cancel the request if necessary.
|
|
66
|
+
* @param options - Additional fetch options.
|
|
67
|
+
* @param options.timeout - The fetch timeout.
|
|
68
|
+
* @returns The token metadata, or `undefined` if the request was either aborted or failed.
|
|
69
|
+
*/
|
|
70
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
72
|
+
async function fetchTokenMetadata(chainId, tokenAddress, abortSignal, { timeout = defaultTimeout } = {}) {
|
|
73
|
+
if (!(0, assetsUtil_1.isTokenListSupportedForNetwork)(chainId)) {
|
|
74
|
+
throw new Error(exports.TOKEN_METADATA_NO_SUPPORT_ERROR);
|
|
75
|
+
}
|
|
76
|
+
const tokenMetadataURL = getTokenMetadataURL(chainId, tokenAddress);
|
|
77
|
+
const response = await queryApi(tokenMetadataURL, abortSignal, timeout);
|
|
78
|
+
if (response) {
|
|
79
|
+
return parseJsonResponse(response);
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
exports.fetchTokenMetadata = fetchTokenMetadata;
|
|
84
|
+
/**
|
|
85
|
+
* Perform fetch request against the api.
|
|
86
|
+
*
|
|
87
|
+
* @param apiURL - The URL of the API to fetch.
|
|
88
|
+
* @param abortSignal - The abort signal used to cancel the request if necessary.
|
|
89
|
+
* @param timeout - The fetch timeout.
|
|
90
|
+
* @returns Promise resolving request response.
|
|
91
|
+
*/
|
|
92
|
+
async function queryApi(apiURL, abortSignal, timeout) {
|
|
93
|
+
const fetchOptions = {
|
|
94
|
+
referrer: apiURL,
|
|
95
|
+
referrerPolicy: 'no-referrer-when-downgrade',
|
|
96
|
+
method: 'GET',
|
|
97
|
+
mode: 'cors',
|
|
98
|
+
signal: abortSignal,
|
|
99
|
+
cache: 'default',
|
|
100
|
+
};
|
|
101
|
+
fetchOptions.headers = new window.Headers();
|
|
102
|
+
fetchOptions.headers.set('Content-Type', 'application/json');
|
|
103
|
+
try {
|
|
104
|
+
return await (0, controller_utils_1.timeoutFetch)(apiURL, fetchOptions, timeout);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
108
|
+
console.log('Request is aborted');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Parse an API response and return the response JSON data.
|
|
115
|
+
*
|
|
116
|
+
* @param apiResponse - The API response to parse.
|
|
117
|
+
* @returns The response JSON data.
|
|
118
|
+
* @throws Will throw if the response includes an error.
|
|
119
|
+
*/
|
|
120
|
+
async function parseJsonResponse(apiResponse) {
|
|
121
|
+
const responseObj = await apiResponse.json();
|
|
122
|
+
// api may return errors as json without setting an error http status code
|
|
123
|
+
if (responseObj?.error) {
|
|
124
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
126
|
+
throw new Error(`TokenService Error: ${responseObj.error}`);
|
|
127
|
+
}
|
|
128
|
+
return responseObj;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=token-service.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-service.cjs","sourceRoot":"","sources":["../src/token-service.ts"],"names":[],"mappings":";;;AAAA,iEAIoC;AAGpC,iDAA8D;AAEjD,QAAA,mBAAmB,GAAG,kCAAkC,CAAC;AACzD,QAAA,+BAA+B,GAC1C,iEAAiE,CAAC;AAEpE;;;;;GAKG;AACH,SAAS,YAAY,CAAC,OAAY;IAChC,MAAM,eAAe,GAAG,OAAO,KAAK,0BAAO,CAAC,eAAe,CAAC,C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AMG;AACH,KAAK,UAAU,iBAAiB,CAAC,WAAqB;IACpD,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;IAC7C,0EAA0E;IAC1E,IAAI,WAAW,EAAE,KAAK,EAAE;QACtB,gFAAgF;QAChF,4EAA4E;QAC5E,MAAM,IAAI,KAAK,CAAC,uBAAuB,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;KAC7D;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import {\n ChainId,\n convertHexToDecimal,\n timeoutFetch,\n} from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { isTokenListSupportedForNetwork } from './assetsUtil';\n\nexport const TOKEN_END_POINT_API = 'https://token.api.cx.metamask.io';\nexport const TOKEN_METADATA_NO_SUPPORT_ERROR =\n 'TokenService Error: Network does not support fetchTokenMetadata';\n\n/**\n * Get the tokens URL for a specific network.\n *\n * @param chainId - The chain ID of the network the tokens requested are on.\n * @returns The tokens URL.\n */\nfunction getTokensURL(chainId: Hex) {\n const occurrenceFloor = chainId === ChainId['linea-mainnet'] ? 1 : 3;\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n return `${TOKEN_END_POINT_API}/tokens/${convertHexToDecimal(\n chainId,\n )}?occurrenceFloor=${occurrenceFloor}&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`;\n}\n\n/**\n * Get the token metadata URL for the given network and token.\n *\n * @param chainId - The chain ID of the network the token is on.\n * @param tokenAddress - The token address.\n * @returns The token metadata URL.\n */\nfunction getTokenMetadataURL(chainId: Hex, tokenAddress: string) {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n return `${TOKEN_END_POINT_API}/token/${convertHexToDecimal(\n chainId,\n )}?address=${tokenAddress}`;\n}\n\nconst tenSecondsInMilliseconds = 10_000;\n\n// Token list averages 1.6 MB in size\n// timeoutFetch by default has a 500ms timeout, which will almost always timeout given the response size.\nconst defaultTimeout = tenSecondsInMilliseconds;\n\n/**\n * Fetch the list of token metadata for a given network. This request is cancellable using the\n * abort signal passed in.\n *\n * @param chainId - The chain ID of the network the requested tokens are on.\n * @param abortSignal - The abort signal used to cancel the request if necessary.\n * @param options - Additional fetch options.\n * @param options.timeout - The fetch timeout.\n * @returns The token list, or `undefined` if the request was cancelled.\n */\nexport async function fetchTokenListByChainId(\n chainId: Hex,\n abortSignal: AbortSignal,\n { timeout = defaultTimeout } = {},\n): Promise<unknown> {\n const tokenURL = getTokensURL(chainId);\n const response = await queryApi(tokenURL, abortSignal, timeout);\n if (response) {\n const result = await parseJsonResponse(response);\n if (Array.isArray(result) && chainId === ChainId['linea-mainnet']) {\n return result.filter(\n (elm) =>\n elm.aggregators.includes('lineaTeam') || elm.aggregators.length >= 3,\n );\n }\n return result;\n }\n return undefined;\n}\n\n/**\n * Fetch metadata for the token address provided for a given network. This request is cancellable\n * using the abort signal passed in.\n *\n * @param chainId - The chain ID of the network the token is on.\n * @param tokenAddress - The address of the token to fetch metadata for.\n * @param abortSignal - The abort signal used to cancel the request if necessary.\n * @param options - Additional fetch options.\n * @param options.timeout - The fetch timeout.\n * @returns The token metadata, or `undefined` if the request was either aborted or failed.\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport async function fetchTokenMetadata<T>(\n chainId: Hex,\n tokenAddress: string,\n abortSignal: AbortSignal,\n { timeout = defaultTimeout } = {},\n): Promise<T | undefined> {\n if (!isTokenListSupportedForNetwork(chainId)) {\n throw new Error(TOKEN_METADATA_NO_SUPPORT_ERROR);\n }\n const tokenMetadataURL = getTokenMetadataURL(chainId, tokenAddress);\n const response = await queryApi(tokenMetadataURL, abortSignal, timeout);\n if (response) {\n return parseJsonResponse(response) as Promise<T>;\n }\n return undefined;\n}\n\n/**\n * Perform fetch request against the api.\n *\n * @param apiURL - The URL of the API to fetch.\n * @param abortSignal - The abort signal used to cancel the request if necessary.\n * @param timeout - The fetch timeout.\n * @returns Promise resolving request response.\n */\nasync function queryApi(\n apiURL: string,\n abortSignal: AbortSignal,\n timeout: number,\n): Promise<Response | undefined> {\n const fetchOptions: RequestInit = {\n referrer: apiURL,\n referrerPolicy: 'no-referrer-when-downgrade',\n method: 'GET',\n mode: 'cors',\n signal: abortSignal,\n cache: 'default',\n };\n fetchOptions.headers = new window.Headers();\n fetchOptions.headers.set('Content-Type', 'application/json');\n try {\n return await timeoutFetch(apiURL, fetchOptions, timeout);\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n console.log('Request is aborted');\n }\n }\n return undefined;\n}\n\n/**\n * Parse an API response and return the response JSON data.\n *\n * @param apiResponse - The API response to parse.\n * @returns The response JSON data.\n * @throws Will throw if the response includes an error.\n */\nasync function parseJsonResponse(apiResponse: Response): Promise<unknown> {\n const responseObj = await apiResponse.json();\n // api may return errors as json without setting an error http status code\n if (responseObj?.error) {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n throw new Error(`TokenService Error: ${responseObj.error}`);\n }\n return responseObj;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Hex } from
|
|
1
|
+
import type { Hex } from "@metamask/utils";
|
|
2
2
|
export declare const TOKEN_END_POINT_API = "https://token.api.cx.metamask.io";
|
|
3
3
|
export declare const TOKEN_METADATA_NO_SUPPORT_ERROR = "TokenService Error: Network does not support fetchTokenMetadata";
|
|
4
4
|
/**
|
|
@@ -28,4 +28,4 @@ export declare function fetchTokenListByChainId(chainId: Hex, abortSignal: Abort
|
|
|
28
28
|
export declare function fetchTokenMetadata<T>(chainId: Hex, tokenAddress: string, abortSignal: AbortSignal, { timeout }?: {
|
|
29
29
|
timeout?: number | undefined;
|
|
30
30
|
}): Promise<T | undefined>;
|
|
31
|
-
//# sourceMappingURL=token-service.d.
|
|
31
|
+
//# sourceMappingURL=token-service.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-service.d.cts","sourceRoot":"","sources":["../src/token-service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,eAAO,MAAM,mBAAmB,qCAAqC,CAAC;AACtE,eAAO,MAAM,+BAA+B,oEACuB,CAAC;AAsCpE;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,GAAG,EACZ,WAAW,EAAE,WAAW,EACxB,EAAE,OAAwB,EAAE;;CAAK,GAChC,OAAO,CAAC,OAAO,CAAC,CAclB;AAED;;;;;;;;;;GAUG;AAGH,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,OAAO,EAAE,GAAG,EACZ,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW,EACxB,EAAE,OAAwB,EAAE;;CAAK,GAChC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAUxB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Hex } from "@metamask/utils";
|
|
2
|
+
export declare const TOKEN_END_POINT_API = "https://token.api.cx.metamask.io";
|
|
3
|
+
export declare const TOKEN_METADATA_NO_SUPPORT_ERROR = "TokenService Error: Network does not support fetchTokenMetadata";
|
|
4
|
+
/**
|
|
5
|
+
* Fetch the list of token metadata for a given network. This request is cancellable using the
|
|
6
|
+
* abort signal passed in.
|
|
7
|
+
*
|
|
8
|
+
* @param chainId - The chain ID of the network the requested tokens are on.
|
|
9
|
+
* @param abortSignal - The abort signal used to cancel the request if necessary.
|
|
10
|
+
* @param options - Additional fetch options.
|
|
11
|
+
* @param options.timeout - The fetch timeout.
|
|
12
|
+
* @returns The token list, or `undefined` if the request was cancelled.
|
|
13
|
+
*/
|
|
14
|
+
export declare function fetchTokenListByChainId(chainId: Hex, abortSignal: AbortSignal, { timeout }?: {
|
|
15
|
+
timeout?: number | undefined;
|
|
16
|
+
}): Promise<unknown>;
|
|
17
|
+
/**
|
|
18
|
+
* Fetch metadata for the token address provided for a given network. This request is cancellable
|
|
19
|
+
* using the abort signal passed in.
|
|
20
|
+
*
|
|
21
|
+
* @param chainId - The chain ID of the network the token is on.
|
|
22
|
+
* @param tokenAddress - The address of the token to fetch metadata for.
|
|
23
|
+
* @param abortSignal - The abort signal used to cancel the request if necessary.
|
|
24
|
+
* @param options - Additional fetch options.
|
|
25
|
+
* @param options.timeout - The fetch timeout.
|
|
26
|
+
* @returns The token metadata, or `undefined` if the request was either aborted or failed.
|
|
27
|
+
*/
|
|
28
|
+
export declare function fetchTokenMetadata<T>(chainId: Hex, tokenAddress: string, abortSignal: AbortSignal, { timeout }?: {
|
|
29
|
+
timeout?: number | undefined;
|
|
30
|
+
}): Promise<T | undefined>;
|
|
31
|
+
//# sourceMappingURL=token-service.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-service.d.mts","sourceRoot":"","sources":["../src/token-service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,eAAO,MAAM,mBAAmB,qCAAqC,CAAC;AACtE,eAAO,MAAM,+BAA+B,oEACuB,CAAC;AAsCpE;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,GAAG,EACZ,WAAW,EAAE,WAAW,EACxB,EAAE,OAAwB,EAAE;;CAAK,GAChC,OAAO,CAAC,OAAO,CAAC,CAclB;AAED;;;;;;;;;;GAUG;AAGH,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,OAAO,EAAE,GAAG,EACZ,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW,EACxB,EAAE,OAAwB,EAAE;;CAAK,GAChC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAUxB"}
|
package/dist/token-service.mjs
CHANGED
|
@@ -1,15 +1,125 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { ChainId, convertHexToDecimal, timeoutFetch } from "@metamask/controller-utils";
|
|
2
|
+
import { isTokenListSupportedForNetwork } from "./assetsUtil.mjs";
|
|
3
|
+
export const TOKEN_END_POINT_API = 'https://token.api.cx.metamask.io';
|
|
4
|
+
export const TOKEN_METADATA_NO_SUPPORT_ERROR = 'TokenService Error: Network does not support fetchTokenMetadata';
|
|
5
|
+
/**
|
|
6
|
+
* Get the tokens URL for a specific network.
|
|
7
|
+
*
|
|
8
|
+
* @param chainId - The chain ID of the network the tokens requested are on.
|
|
9
|
+
* @returns The tokens URL.
|
|
10
|
+
*/
|
|
11
|
+
function getTokensURL(chainId) {
|
|
12
|
+
const occurrenceFloor = chainId === ChainId['linea-mainnet'] ? 1 : 3;
|
|
13
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
15
|
+
return `${TOKEN_END_POINT_API}/tokens/${convertHexToDecimal(chainId)}?occurrenceFloor=${occurrenceFloor}&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get the token metadata URL for the given network and token.
|
|
19
|
+
*
|
|
20
|
+
* @param chainId - The chain ID of the network the token is on.
|
|
21
|
+
* @param tokenAddress - The token address.
|
|
22
|
+
* @returns The token metadata URL.
|
|
23
|
+
*/
|
|
24
|
+
function getTokenMetadataURL(chainId, tokenAddress) {
|
|
25
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
27
|
+
return `${TOKEN_END_POINT_API}/token/${convertHexToDecimal(chainId)}?address=${tokenAddress}`;
|
|
28
|
+
}
|
|
29
|
+
const tenSecondsInMilliseconds = 10000;
|
|
30
|
+
// Token list averages 1.6 MB in size
|
|
31
|
+
// timeoutFetch by default has a 500ms timeout, which will almost always timeout given the response size.
|
|
32
|
+
const defaultTimeout = tenSecondsInMilliseconds;
|
|
33
|
+
/**
|
|
34
|
+
* Fetch the list of token metadata for a given network. This request is cancellable using the
|
|
35
|
+
* abort signal passed in.
|
|
36
|
+
*
|
|
37
|
+
* @param chainId - The chain ID of the network the requested tokens are on.
|
|
38
|
+
* @param abortSignal - The abort signal used to cancel the request if necessary.
|
|
39
|
+
* @param options - Additional fetch options.
|
|
40
|
+
* @param options.timeout - The fetch timeout.
|
|
41
|
+
* @returns The token list, or `undefined` if the request was cancelled.
|
|
42
|
+
*/
|
|
43
|
+
export async function fetchTokenListByChainId(chainId, abortSignal, { timeout = defaultTimeout } = {}) {
|
|
44
|
+
const tokenURL = getTokensURL(chainId);
|
|
45
|
+
const response = await queryApi(tokenURL, abortSignal, timeout);
|
|
46
|
+
if (response) {
|
|
47
|
+
const result = await parseJsonResponse(response);
|
|
48
|
+
if (Array.isArray(result) && chainId === ChainId['linea-mainnet']) {
|
|
49
|
+
return result.filter((elm) => elm.aggregators.includes('lineaTeam') || elm.aggregators.length >= 3);
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Fetch metadata for the token address provided for a given network. This request is cancellable
|
|
57
|
+
* using the abort signal passed in.
|
|
58
|
+
*
|
|
59
|
+
* @param chainId - The chain ID of the network the token is on.
|
|
60
|
+
* @param tokenAddress - The address of the token to fetch metadata for.
|
|
61
|
+
* @param abortSignal - The abort signal used to cancel the request if necessary.
|
|
62
|
+
* @param options - Additional fetch options.
|
|
63
|
+
* @param options.timeout - The fetch timeout.
|
|
64
|
+
* @returns The token metadata, or `undefined` if the request was either aborted or failed.
|
|
65
|
+
*/
|
|
66
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
68
|
+
export async function fetchTokenMetadata(chainId, tokenAddress, abortSignal, { timeout = defaultTimeout } = {}) {
|
|
69
|
+
if (!isTokenListSupportedForNetwork(chainId)) {
|
|
70
|
+
throw new Error(TOKEN_METADATA_NO_SUPPORT_ERROR);
|
|
71
|
+
}
|
|
72
|
+
const tokenMetadataURL = getTokenMetadataURL(chainId, tokenAddress);
|
|
73
|
+
const response = await queryApi(tokenMetadataURL, abortSignal, timeout);
|
|
74
|
+
if (response) {
|
|
75
|
+
return parseJsonResponse(response);
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Perform fetch request against the api.
|
|
81
|
+
*
|
|
82
|
+
* @param apiURL - The URL of the API to fetch.
|
|
83
|
+
* @param abortSignal - The abort signal used to cancel the request if necessary.
|
|
84
|
+
* @param timeout - The fetch timeout.
|
|
85
|
+
* @returns Promise resolving request response.
|
|
86
|
+
*/
|
|
87
|
+
async function queryApi(apiURL, abortSignal, timeout) {
|
|
88
|
+
const fetchOptions = {
|
|
89
|
+
referrer: apiURL,
|
|
90
|
+
referrerPolicy: 'no-referrer-when-downgrade',
|
|
91
|
+
method: 'GET',
|
|
92
|
+
mode: 'cors',
|
|
93
|
+
signal: abortSignal,
|
|
94
|
+
cache: 'default',
|
|
95
|
+
};
|
|
96
|
+
fetchOptions.headers = new window.Headers();
|
|
97
|
+
fetchOptions.headers.set('Content-Type', 'application/json');
|
|
98
|
+
try {
|
|
99
|
+
return await timeoutFetch(apiURL, fetchOptions, timeout);
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
103
|
+
console.log('Request is aborted');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Parse an API response and return the response JSON data.
|
|
110
|
+
*
|
|
111
|
+
* @param apiResponse - The API response to parse.
|
|
112
|
+
* @returns The response JSON data.
|
|
113
|
+
* @throws Will throw if the response includes an error.
|
|
114
|
+
*/
|
|
115
|
+
async function parseJsonResponse(apiResponse) {
|
|
116
|
+
const responseObj = await apiResponse.json();
|
|
117
|
+
// api may return errors as json without setting an error http status code
|
|
118
|
+
if (responseObj?.error) {
|
|
119
|
+
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
121
|
+
throw new Error(`TokenService Error: ${responseObj.error}`);
|
|
122
|
+
}
|
|
123
|
+
return responseObj;
|
|
124
|
+
}
|
|
15
125
|
//# sourceMappingURL=token-service.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"token-service.mjs","sourceRoot":"","sources":["../src/token-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,YAAY,EACb,mCAAmC;AAGpC,OAAO,EAAE,8BAA8B,EAAE,yBAAqB;AAE9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,kCAAkC,CAAC;AACtE,MAAM,CAAC,MAAM,+BAA+B,GAC1C,iEAAiE,CAAC;AAEpE;;;;;GAKG;AACH,SAAS,YAAY,CAAC,OAAY;IAChC,MAAM,eAAe,GAAG,OAAO,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,gFAAgF;IAChF,4EAA4E;IAC5E,OAAO,GAAG,mBAAmB,WAAW,mBAAmB,CACzD,OAAO,CACR,oBAAoB,eAAe,2JAA2J,CAAC;AAClM,CAAC;AAED;;;;;;GAMG;AACH,SAAS,mBAAmB,CAA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C,CAAC;KAC7D;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import {\n ChainId,\n convertHexToDecimal,\n timeoutFetch,\n} from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { isTokenListSupportedForNetwork } from './assetsUtil';\n\nexport const TOKEN_END_POINT_API = 'https://token.api.cx.metamask.io';\nexport const TOKEN_METADATA_NO_SUPPORT_ERROR =\n 'TokenService Error: Network does not support fetchTokenMetadata';\n\n/**\n * Get the tokens URL for a specific network.\n *\n * @param chainId - The chain ID of the network the tokens requested are on.\n * @returns The tokens URL.\n */\nfunction getTokensURL(chainId: Hex) {\n const occurrenceFloor = chainId === ChainId['linea-mainnet'] ? 1 : 3;\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n return `${TOKEN_END_POINT_API}/tokens/${convertHexToDecimal(\n chainId,\n )}?occurrenceFloor=${occurrenceFloor}&includeNativeAssets=false&includeDuplicateSymbolAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false`;\n}\n\n/**\n * Get the token metadata URL for the given network and token.\n *\n * @param chainId - The chain ID of the network the token is on.\n * @param tokenAddress - The token address.\n * @returns The token metadata URL.\n */\nfunction getTokenMetadataURL(chainId: Hex, tokenAddress: string) {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n return `${TOKEN_END_POINT_API}/token/${convertHexToDecimal(\n chainId,\n )}?address=${tokenAddress}`;\n}\n\nconst tenSecondsInMilliseconds = 10_000;\n\n// Token list averages 1.6 MB in size\n// timeoutFetch by default has a 500ms timeout, which will almost always timeout given the response size.\nconst defaultTimeout = tenSecondsInMilliseconds;\n\n/**\n * Fetch the list of token metadata for a given network. This request is cancellable using the\n * abort signal passed in.\n *\n * @param chainId - The chain ID of the network the requested tokens are on.\n * @param abortSignal - The abort signal used to cancel the request if necessary.\n * @param options - Additional fetch options.\n * @param options.timeout - The fetch timeout.\n * @returns The token list, or `undefined` if the request was cancelled.\n */\nexport async function fetchTokenListByChainId(\n chainId: Hex,\n abortSignal: AbortSignal,\n { timeout = defaultTimeout } = {},\n): Promise<unknown> {\n const tokenURL = getTokensURL(chainId);\n const response = await queryApi(tokenURL, abortSignal, timeout);\n if (response) {\n const result = await parseJsonResponse(response);\n if (Array.isArray(result) && chainId === ChainId['linea-mainnet']) {\n return result.filter(\n (elm) =>\n elm.aggregators.includes('lineaTeam') || elm.aggregators.length >= 3,\n );\n }\n return result;\n }\n return undefined;\n}\n\n/**\n * Fetch metadata for the token address provided for a given network. This request is cancellable\n * using the abort signal passed in.\n *\n * @param chainId - The chain ID of the network the token is on.\n * @param tokenAddress - The address of the token to fetch metadata for.\n * @param abortSignal - The abort signal used to cancel the request if necessary.\n * @param options - Additional fetch options.\n * @param options.timeout - The fetch timeout.\n * @returns The token metadata, or `undefined` if the request was either aborted or failed.\n */\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport async function fetchTokenMetadata<T>(\n chainId: Hex,\n tokenAddress: string,\n abortSignal: AbortSignal,\n { timeout = defaultTimeout } = {},\n): Promise<T | undefined> {\n if (!isTokenListSupportedForNetwork(chainId)) {\n throw new Error(TOKEN_METADATA_NO_SUPPORT_ERROR);\n }\n const tokenMetadataURL = getTokenMetadataURL(chainId, tokenAddress);\n const response = await queryApi(tokenMetadataURL, abortSignal, timeout);\n if (response) {\n return parseJsonResponse(response) as Promise<T>;\n }\n return undefined;\n}\n\n/**\n * Perform fetch request against the api.\n *\n * @param apiURL - The URL of the API to fetch.\n * @param abortSignal - The abort signal used to cancel the request if necessary.\n * @param timeout - The fetch timeout.\n * @returns Promise resolving request response.\n */\nasync function queryApi(\n apiURL: string,\n abortSignal: AbortSignal,\n timeout: number,\n): Promise<Response | undefined> {\n const fetchOptions: RequestInit = {\n referrer: apiURL,\n referrerPolicy: 'no-referrer-when-downgrade',\n method: 'GET',\n mode: 'cors',\n signal: abortSignal,\n cache: 'default',\n };\n fetchOptions.headers = new window.Headers();\n fetchOptions.headers.set('Content-Type', 'application/json');\n try {\n return await timeoutFetch(apiURL, fetchOptions, timeout);\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n console.log('Request is aborted');\n }\n }\n return undefined;\n}\n\n/**\n * Parse an API response and return the response JSON data.\n *\n * @param apiResponse - The API response to parse.\n * @returns The response JSON data.\n * @throws Will throw if the response includes an error.\n */\nasync function parseJsonResponse(apiResponse: Response): Promise<unknown> {\n const responseObj = await apiResponse.json();\n // api may return errors as json without setting an error http status code\n if (responseObj?.error) {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n throw new Error(`TokenService Error: ${responseObj.error}`);\n }\n return responseObj;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/assets-controllers",
|
|
3
|
-
"version": "38.
|
|
3
|
+
"version": "38.1.0",
|
|
4
4
|
"description": "Controllers which manage interactions involving ERC-20, ERC-721, and ERC-1155 tokens (including NFTs)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -18,19 +18,24 @@
|
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
|
-
"import":
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/index.d.mts",
|
|
23
|
+
"default": "./dist/index.mjs"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/index.d.cts",
|
|
27
|
+
"default": "./dist/index.cjs"
|
|
28
|
+
}
|
|
24
29
|
},
|
|
25
30
|
"./package.json": "./package.json"
|
|
26
31
|
},
|
|
27
|
-
"main": "./dist/index.
|
|
28
|
-
"types": "./dist/
|
|
32
|
+
"main": "./dist/index.cjs",
|
|
33
|
+
"types": "./dist/index.d.cts",
|
|
29
34
|
"files": [
|
|
30
35
|
"dist/"
|
|
31
36
|
],
|
|
32
37
|
"scripts": {
|
|
33
|
-
"build": "
|
|
38
|
+
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
|
|
34
39
|
"build:docs": "typedoc",
|
|
35
40
|
"changelog:update": "../../scripts/update-changelog.sh @metamask/assets-controllers",
|
|
36
41
|
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/assets-controllers",
|
|
@@ -48,12 +53,12 @@
|
|
|
48
53
|
"@ethersproject/contracts": "^5.7.0",
|
|
49
54
|
"@ethersproject/providers": "^5.7.0",
|
|
50
55
|
"@metamask/abi-utils": "^2.0.3",
|
|
51
|
-
"@metamask/base-controller": "^7.0.
|
|
56
|
+
"@metamask/base-controller": "^7.0.1",
|
|
52
57
|
"@metamask/contract-metadata": "^2.4.0",
|
|
53
|
-
"@metamask/controller-utils": "^11.
|
|
58
|
+
"@metamask/controller-utils": "^11.3.0",
|
|
54
59
|
"@metamask/eth-query": "^4.0.0",
|
|
55
60
|
"@metamask/metamask-eth-abis": "^3.1.1",
|
|
56
|
-
"@metamask/polling-controller": "^10.0.
|
|
61
|
+
"@metamask/polling-controller": "^10.0.1",
|
|
57
62
|
"@metamask/rpc-errors": "^6.3.1",
|
|
58
63
|
"@metamask/utils": "^9.1.0",
|
|
59
64
|
"@types/bn.js": "^5.1.5",
|
|
@@ -68,14 +73,14 @@
|
|
|
68
73
|
"uuid": "^8.3.2"
|
|
69
74
|
},
|
|
70
75
|
"devDependencies": {
|
|
71
|
-
"@metamask/accounts-controller": "^18.
|
|
72
|
-
"@metamask/approval-controller": "^7.0
|
|
76
|
+
"@metamask/accounts-controller": "^18.2.2",
|
|
77
|
+
"@metamask/approval-controller": "^7.1.0",
|
|
73
78
|
"@metamask/auto-changelog": "^3.4.4",
|
|
74
79
|
"@metamask/ethjs-provider-http": "^0.3.0",
|
|
75
|
-
"@metamask/keyring-api": "^8.1.
|
|
76
|
-
"@metamask/keyring-controller": "^17.2.
|
|
77
|
-
"@metamask/network-controller": "^21.0.
|
|
78
|
-
"@metamask/preferences-controller": "^13.0.
|
|
80
|
+
"@metamask/keyring-api": "^8.1.3",
|
|
81
|
+
"@metamask/keyring-controller": "^17.2.2",
|
|
82
|
+
"@metamask/network-controller": "^21.0.1",
|
|
83
|
+
"@metamask/preferences-controller": "^13.0.3",
|
|
79
84
|
"@types/jest": "^27.4.1",
|
|
80
85
|
"@types/lodash": "^4.14.191",
|
|
81
86
|
"@types/node": "^16.18.54",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkHVOIBGYNjs = require('./chunk-HVOIBGYN.js');
|
|
5
|
-
require('./chunk-Z4BLTVTB.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.AccountTrackerController = _chunkHVOIBGYNjs.AccountTrackerController; exports.default = _chunkHVOIBGYNjs.AccountTrackerController_default;
|
|
10
|
-
//# sourceMappingURL=AccountTrackerController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkLKVWPNXYjs = require('./chunk-LKVWPNXY.js');
|
|
7
|
-
require('./chunk-ISK2VSBB.js');
|
|
8
|
-
require('./chunk-JCR4H6YL.js');
|
|
9
|
-
require('./chunk-5QLC2MHV.js');
|
|
10
|
-
require('./chunk-MZI3SDQN.js');
|
|
11
|
-
require('./chunk-Z4BLTVTB.js');
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
exports.AssetsContractController = _chunkLKVWPNXYjs.AssetsContractController; exports.MISSING_PROVIDER_ERROR = _chunkLKVWPNXYjs.MISSING_PROVIDER_ERROR; exports.SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID = _chunkLKVWPNXYjs.SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID; exports.default = _chunkLKVWPNXYjs.AssetsContractController_default;
|
|
18
|
-
//# sourceMappingURL=AssetsContractController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkJMZ7KWJSjs = require('./chunk-JMZ7KWJS.js');
|
|
5
|
-
require('./chunk-7K6PSEAA.js');
|
|
6
|
-
require('./chunk-GDFLKKDY.js');
|
|
7
|
-
require('./chunk-Z4BLTVTB.js');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.CurrencyRateController = _chunkJMZ7KWJSjs.CurrencyRateController; exports.default = _chunkJMZ7KWJSjs.CurrencyRateController_default;
|
|
12
|
-
//# sourceMappingURL=CurrencyRateController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/NftController.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunk2TZK6YZAjs = require('./chunk-2TZK6YZA.js');
|
|
6
|
-
require('./chunk-RGHTNZQ6.js');
|
|
7
|
-
require('./chunk-MZI3SDQN.js');
|
|
8
|
-
require('./chunk-Z4BLTVTB.js');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.NftController = _chunk2TZK6YZAjs.NftController; exports.default = _chunk2TZK6YZAjs.NftController_default; exports.getDefaultNftControllerState = _chunk2TZK6YZAjs.getDefaultNftControllerState;
|
|
14
|
-
//# sourceMappingURL=NftController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunkBBCZM5P4js = require('./chunk-BBCZM5P4.js');
|
|
7
|
-
require('./chunk-RGHTNZQ6.js');
|
|
8
|
-
require('./chunk-MZI3SDQN.js');
|
|
9
|
-
require('./chunk-Z4BLTVTB.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.BlockaidResultType = _chunkBBCZM5P4js.BlockaidResultType; exports.MAX_GET_COLLECTION_BATCH_SIZE = _chunkBBCZM5P4js.MAX_GET_COLLECTION_BATCH_SIZE; exports.NftDetectionController = _chunkBBCZM5P4js.NftDetectionController; exports.default = _chunkBBCZM5P4js.NftDetectionController_default;
|
|
16
|
-
//# sourceMappingURL=NftDetectionController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkTIFLP53Rjs = require('../chunk-TIFLP53R.js');
|
|
6
|
-
require('../chunk-7K6PSEAA.js');
|
|
7
|
-
require('../chunk-GDFLKKDY.js');
|
|
8
|
-
require('../chunk-Z4BLTVTB.js');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.Cryptocurrency = _chunkTIFLP53Rjs.Cryptocurrency; exports.RatesController = _chunkTIFLP53Rjs.RatesController; exports.name = _chunkTIFLP53Rjs.name;
|
|
14
|
-
//# sourceMappingURL=RatesController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-XC3SOOGC.js');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkTIFLP53Rjs = require('../chunk-TIFLP53R.js');
|
|
6
|
-
require('../chunk-7K6PSEAA.js');
|
|
7
|
-
require('../chunk-GDFLKKDY.js');
|
|
8
|
-
require('../chunk-Z4BLTVTB.js');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.Cryptocurrency = _chunkTIFLP53Rjs.Cryptocurrency; exports.RatesController = _chunkTIFLP53Rjs.RatesController;
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkJCR4H6YLjs = require('../chunk-JCR4H6YL.js');
|
|
4
|
-
require('../chunk-MZI3SDQN.js');
|
|
5
|
-
require('../chunk-Z4BLTVTB.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.ERC20Standard = _chunkJCR4H6YLjs.ERC20Standard;
|
|
9
|
-
//# sourceMappingURL=ERC20Standard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunk5QLC2MHVjs = require('../../../chunk-5QLC2MHV.js');
|
|
4
|
-
require('../../../chunk-MZI3SDQN.js');
|
|
5
|
-
require('../../../chunk-Z4BLTVTB.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.ERC1155Standard = _chunk5QLC2MHVjs.ERC1155Standard;
|
|
9
|
-
//# sourceMappingURL=ERC1155Standard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkISK2VSBBjs = require('../../../chunk-ISK2VSBB.js');
|
|
4
|
-
require('../../../chunk-MZI3SDQN.js');
|
|
5
|
-
require('../../../chunk-Z4BLTVTB.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.ERC721Standard = _chunkISK2VSBBjs.ERC721Standard;
|
|
9
|
-
//# sourceMappingURL=ERC721Standard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkYGGUAMHVjs = require('./chunk-YGGUAMHV.js');
|
|
6
|
-
require('./chunk-Z4BLTVTB.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.TokenBalancesController = _chunkYGGUAMHVjs.TokenBalancesController; exports.default = _chunkYGGUAMHVjs.TokenBalancesController_default; exports.getDefaultTokenBalancesState = _chunkYGGUAMHVjs.getDefaultTokenBalancesState;
|
|
12
|
-
//# sourceMappingURL=TokenBalancesController.js.map
|