Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});

Expand Down Expand Up @@ -1518,7 +1518,7 @@ describe('CurrencyRateController', () => {
expect(fetchTokenPricesSpy).toHaveBeenCalledTimes(1);
expect(fetchTokenPricesSpy).toHaveBeenCalledWith({
chainId: '0x1',
tokenAddresses: ['0x0000000000000000000000000000000000000000'],
tokenAddresses: [],
currency: 'usd',
});

Expand Down Expand Up @@ -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',
});

Expand Down
3 changes: 2 additions & 1 deletion packages/assets-controllers/src/CurrencyRateController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,10 @@ export class CurrencyRateController extends StaticIntervalPollingController<Curr
const ratesResults = await Promise.allSettled(
currencyToChainIdsEntries.map(async ([nativeCurrency, { chainId }]) => {
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,
});

Expand Down
Loading