diff --git a/packages/assets-controllers/CHANGELOG.md b/packages/assets-controllers/CHANGELOG.md index bc8cda2d5f3..5e0dbcfb2fa 100644 --- a/packages/assets-controllers/CHANGELOG.md +++ b/packages/assets-controllers/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix duplicate native token address in `CurrencyRateController` spot price fallback API requests ([#7181](https://github.com/MetaMask/core/pull/7181)) + ## [89.0.0] ### Changed diff --git a/packages/assets-controllers/src/CurrencyRateController.test.ts b/packages/assets-controllers/src/CurrencyRateController.test.ts index 8af5b63fd8f..ed84bdd47dd 100644 --- a/packages/assets-controllers/src/CurrencyRateController.test.ts +++ b/packages/assets-controllers/src/CurrencyRateController.test.ts @@ -1297,7 +1297,7 @@ describe('CurrencyRateController', () => { expect(fetchTokenPricesSpy).toHaveBeenCalledTimes(1); expect(fetchTokenPricesSpy).toHaveBeenCalledWith({ chainId: '0x1', // First chainId with ETH as native currency - tokenAddresses: ['0x0000000000000000000000000000000000000000'], + tokenAddresses: [], currency: 'usd', }); @@ -1518,7 +1518,7 @@ describe('CurrencyRateController', () => { expect(fetchTokenPricesSpy).toHaveBeenCalledTimes(1); expect(fetchTokenPricesSpy).toHaveBeenCalledWith({ chainId: '0x1', - tokenAddresses: ['0x0000000000000000000000000000000000000000'], + tokenAddresses: [], currency: 'usd', }); @@ -1598,7 +1598,7 @@ describe('CurrencyRateController', () => { // Should use Polygon's native token address (line 269) expect(fetchTokenPricesSpy).toHaveBeenCalledWith({ chainId: '0x89', - tokenAddresses: ['0x0000000000000000000000000000000000001010'], + tokenAddresses: [], currency: 'usd', }); diff --git a/packages/assets-controllers/src/CurrencyRateController.ts b/packages/assets-controllers/src/CurrencyRateController.ts index 01155aa117b..ef8a43d9598 100644 --- a/packages/assets-controllers/src/CurrencyRateController.ts +++ b/packages/assets-controllers/src/CurrencyRateController.ts @@ -257,9 +257,10 @@ export class CurrencyRateController extends StaticIntervalPollingController { const nativeTokenAddress = getNativeTokenAddress(chainId); + // Pass empty array as fetchTokenPrices automatically includes the native token address const tokenPrices = await this.#tokenPricesService.fetchTokenPrices({ chainId, - tokenAddresses: [nativeTokenAddress], + tokenAddresses: [], currency: currentCurrency, });