diff --git a/.yarn/patches/@metamask-assets-controllers-npm-45.0.0-31810ece32.patch b/.yarn/patches/@metamask-assets-controllers-npm-45.1.0-d914c453f0.patch similarity index 51% rename from .yarn/patches/@metamask-assets-controllers-npm-45.0.0-31810ece32.patch rename to .yarn/patches/@metamask-assets-controllers-npm-45.1.0-d914c453f0.patch index 77a2e7f21cfb..ca412ba89489 100644 --- a/.yarn/patches/@metamask-assets-controllers-npm-45.0.0-31810ece32.patch +++ b/.yarn/patches/@metamask-assets-controllers-npm-45.1.0-d914c453f0.patch @@ -1,39 +1,3 @@ -diff --git a/dist/TokenDetectionController.cjs b/dist/TokenDetectionController.cjs -index 8fd5efde7a3c24080f8a43f79d10300e8c271245..66f656d9a55f1154024a8c18a9fe27b4ed39a21d 100644 ---- a/dist/TokenDetectionController.cjs -+++ b/dist/TokenDetectionController.cjs -@@ -250,17 +250,20 @@ _TokenDetectionController_intervalId = new WeakMap(), _TokenDetectionController_ - } - }); - this.messagingSystem.subscribe('AccountsController:selectedEvmAccountChange', -- // TODO: Either fix this lint violation or explain why it's necessary to ignore. -- // eslint-disable-next-line @typescript-eslint/no-misused-promises -- async (selectedAccount) => { -- const isSelectedAccountIdChanged = __classPrivateFieldGet(this, _TokenDetectionController_selectedAccountId, "f") !== selectedAccount.id; -- if (isSelectedAccountIdChanged) { -- __classPrivateFieldSet(this, _TokenDetectionController_selectedAccountId, selectedAccount.id, "f"); -- await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_restartTokenDetection).call(this, { -- selectedAddress: selectedAccount.address, -- }); -- } -- }); -+ // TODO: Either fix this lint violation or explain why it's necessary to ignore. -+ // eslint-disable-next-line @typescript-eslint/no-misused-promises -+ async (selectedAccount) => { -+ const { networkConfigurationsByChainId } = this.messagingSystem.call('NetworkController:getState'); -+ const chainIds = Object.keys(networkConfigurationsByChainId); -+ const isSelectedAccountIdChanged = __classPrivateFieldGet(this, _TokenDetectionController_selectedAccountId, "f") !== selectedAccount.id; -+ if (isSelectedAccountIdChanged) { -+ __classPrivateFieldSet(this, _TokenDetectionController_selectedAccountId, selectedAccount.id, "f"); -+ await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_restartTokenDetection).call(this, { -+ selectedAddress: selectedAccount.address, -+ chainIds, -+ }); -+ } -+ }); - }, _TokenDetectionController_stopPolling = function _TokenDetectionController_stopPolling() { - if (__classPrivateFieldGet(this, _TokenDetectionController_intervalId, "f")) { - clearInterval(__classPrivateFieldGet(this, _TokenDetectionController_intervalId, "f")); diff --git a/dist/assetsUtil.cjs b/dist/assetsUtil.cjs index 48571b8c1b78e94d88e1837e986b5f8735ac651b..61246f51500c8cab48f18296a73629fb73454caa 100644 --- a/dist/assetsUtil.cjs @@ -56,7 +20,7 @@ index 48571b8c1b78e94d88e1837e986b5f8735ac651b..61246f51500c8cab48f18296a73629fb // because most cid v0s appear to be incompatible with IPFS subdomains return { diff --git a/dist/token-prices-service/codefi-v2.mjs b/dist/token-prices-service/codefi-v2.mjs -index e7eaad2cfa8b233c4fd42a51f745233a1cc5c387..bf8ec7819f678c2f185d6a85d7e3ea81f055a309 100644 +index a13403446a2376d4d905a9ef733941798da89c88..3c8229f9ea40f4c1ee760a22884e1066dac82ec7 100644 --- a/dist/token-prices-service/codefi-v2.mjs +++ b/dist/token-prices-service/codefi-v2.mjs @@ -12,8 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function ( @@ -65,7 +29,7 @@ index e7eaad2cfa8b233c4fd42a51f745233a1cc5c387..bf8ec7819f678c2f185d6a85d7e3ea81 import { hexToNumber } from "@metamask/utils"; -import $cockatiel from "cockatiel"; -const { circuitBreaker, ConsecutiveBreaker, ExponentialBackoff, handleAll, retry, wrap, CircuitState } = $cockatiel; -+import { circuitBreaker, ConsecutiveBreaker, ExponentialBackoff, handleAll, retry, wrap, CircuitState } from "cockatiel" ++import { circuitBreaker, ConsecutiveBreaker, ExponentialBackoff, handleAll, retry, wrap, CircuitState } from "cockatiel"; /** * The list of currencies that can be supplied as the `vsCurrency` parameter to * the `/spot-prices` endpoint, in lowercase form. diff --git a/.yarn/patches/@metamask-assets-controllers-patch-9e00573eb4.patch b/.yarn/patches/@metamask-assets-controllers-patch-9e00573eb4.patch deleted file mode 100644 index 1b9e5a4ba848..000000000000 --- a/.yarn/patches/@metamask-assets-controllers-patch-9e00573eb4.patch +++ /dev/null @@ -1,62 +0,0 @@ -diff --git a/dist/TokenDetectionController.cjs b/dist/TokenDetectionController.cjs -index ab23c95d667357db365f925c4c4acce4736797f8..8fd5efde7a3c24080f8a43f79d10300e8c271245 100644 ---- a/dist/TokenDetectionController.cjs -+++ b/dist/TokenDetectionController.cjs -@@ -204,13 +204,10 @@ class TokenDetectionController extends (0, polling_controller_1.StaticIntervalPo - // Try detecting tokens via Account API first if conditions allow - if (supportedNetworks && chainsToDetectUsingAccountAPI.length > 0) { - const apiResult = await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_attemptAccountAPIDetection).call(this, chainsToDetectUsingAccountAPI, addressToDetect, supportedNetworks); -- // If API succeeds and no chains are left for RPC detection, we can return early -- if (apiResult?.result === 'success' && -- chainsToDetectUsingRpc.length === 0) { -- return; -+ // If the account API call failed, have those chains fall back to RPC detection -+ if (apiResult?.result === 'failed') { -+ __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks); - } -- // If API fails or chainsToDetectUsingRpc still has items, add chains to RPC detection -- __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks); - } - // Proceed with RPC detection if there are chains remaining in chainsToDetectUsingRpc - if (chainsToDetectUsingRpc.length > 0) { -@@ -446,8 +443,7 @@ async function _TokenDetectionController_addDetectedTokensViaAPI({ selectedAddre - const tokenBalancesByChain = await __classPrivateFieldGet(this, _TokenDetectionController_accountsAPI, "f") - .getMultiNetworksBalances(selectedAddress, chainIds, supportedNetworks) - .catch(() => null); -- if (!tokenBalancesByChain || -- Object.keys(tokenBalancesByChain).length === 0) { -+ if (tokenBalancesByChain === null) { - return { result: 'failed' }; - } - // Process each chain ID individually -diff --git a/dist/TokenDetectionController.mjs b/dist/TokenDetectionController.mjs -index f75eb5c2c74f2a9d15a79760985111171dc938e1..ebc30bb915cc39dabf49f9e0da84a7948ae1ed48 100644 ---- a/dist/TokenDetectionController.mjs -+++ b/dist/TokenDetectionController.mjs -@@ -205,13 +205,10 @@ export class TokenDetectionController extends StaticIntervalPollingController() - // Try detecting tokens via Account API first if conditions allow - if (supportedNetworks && chainsToDetectUsingAccountAPI.length > 0) { - const apiResult = await __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_attemptAccountAPIDetection).call(this, chainsToDetectUsingAccountAPI, addressToDetect, supportedNetworks); -- // If API succeeds and no chains are left for RPC detection, we can return early -- if (apiResult?.result === 'success' && -- chainsToDetectUsingRpc.length === 0) { -- return; -+ // If the account API call failed, have those chains fall back to RPC detection -+ if (apiResult?.result === 'failed') { -+ __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks); - } -- // If API fails or chainsToDetectUsingRpc still has items, add chains to RPC detection -- __classPrivateFieldGet(this, _TokenDetectionController_instances, "m", _TokenDetectionController_addChainsToRpcDetection).call(this, chainsToDetectUsingRpc, chainsToDetectUsingAccountAPI, clientNetworks); - } - // Proceed with RPC detection if there are chains remaining in chainsToDetectUsingRpc - if (chainsToDetectUsingRpc.length > 0) { -@@ -446,8 +443,7 @@ async function _TokenDetectionController_addDetectedTokensViaAPI({ selectedAddre - const tokenBalancesByChain = await __classPrivateFieldGet(this, _TokenDetectionController_accountsAPI, "f") - .getMultiNetworksBalances(selectedAddress, chainIds, supportedNetworks) - .catch(() => null); -- if (!tokenBalancesByChain || -- Object.keys(tokenBalancesByChain).length === 0) { -+ if (tokenBalancesByChain === null) { - return { result: 'failed' }; - } - // Process each chain ID individually diff --git a/package.json b/package.json index 0f963c3aab2b..45896fdabd1f 100644 --- a/package.json +++ b/package.json @@ -294,7 +294,7 @@ "@metamask/address-book-controller": "^6.0.0", "@metamask/announcement-controller": "^7.0.0", "@metamask/approval-controller": "^7.0.0", - "@metamask/assets-controllers": "patch:@metamask/assets-controllers@npm%3A45.0.0#~/.yarn/patches/@metamask-assets-controllers-npm-45.0.0-31810ece32.patch", + "@metamask/assets-controllers": "patch:@metamask/assets-controllers@npm%3A45.1.0#~/.yarn/patches/@metamask-assets-controllers-npm-45.1.0-d914c453f0.patch", "@metamask/base-controller": "^7.0.0", "@metamask/bitcoin-wallet-snap": "^0.8.2", "@metamask/browser-passworder": "^4.3.0", diff --git a/ui/components/app/wallet-overview/aggregated-percentage-overview-cross-chains.tsx b/ui/components/app/wallet-overview/aggregated-percentage-overview-cross-chains.tsx index fe3698e2fc2f..6f7de0c95c7c 100644 --- a/ui/components/app/wallet-overview/aggregated-percentage-overview-cross-chains.tsx +++ b/ui/components/app/wallet-overview/aggregated-percentage-overview-cross-chains.tsx @@ -1,7 +1,9 @@ import React, { useMemo } from 'react'; import { useSelector } from 'react-redux'; -import { zeroAddress, toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from 'ethereumjs-util'; +import { getNativeTokenAddress } from '@metamask/assets-controllers'; +import { Hex } from '@metamask/utils'; import { getCurrentCurrency, getSelectedAccount, @@ -89,8 +91,9 @@ export const AggregatedPercentageOverviewCrossChains = () => { item.tokensWithBalances, ); const nativePricePercentChange1d = - crossChainMarketData?.[item.chainId]?.[zeroAddress()] - ?.pricePercentChange1d; + crossChainMarketData?.[item.chainId]?.[ + getNativeTokenAddress(item.chainId as Hex) + ]?.pricePercentChange1d; const nativeFiat1dAgo = getCalculatedTokenAmount1dAgo( item.nativeFiatValue, diff --git a/ui/components/app/wallet-overview/aggregated-percentage-overview.test.tsx b/ui/components/app/wallet-overview/aggregated-percentage-overview.test.tsx index 8da096151908..7610890d48da 100644 --- a/ui/components/app/wallet-overview/aggregated-percentage-overview.test.tsx +++ b/ui/components/app/wallet-overview/aggregated-percentage-overview.test.tsx @@ -8,6 +8,7 @@ import { getShouldHideZeroBalanceTokens, getTokensMarketData, getPreferences, + getCurrentChainId, } from '../../../selectors'; import { useAccountTotalFiatBalance } from '../../../hooks/useAccountTotalFiatBalance'; import { AggregatedPercentageOverview } from './aggregated-percentage-overview'; @@ -26,20 +27,22 @@ jest.mock('../../../selectors', () => ({ getPreferences: jest.fn(), getShouldHideZeroBalanceTokens: jest.fn(), getTokensMarketData: jest.fn(), + getCurrentChainId: jest.fn(), })); jest.mock('../../../hooks/useAccountTotalFiatBalance', () => ({ useAccountTotalFiatBalance: jest.fn(), })); -const mockGetIntlLocale = getIntlLocale as unknown as jest.Mock; -const mockGetCurrentCurrency = getCurrentCurrency as jest.Mock; -const mockGetPreferences = getPreferences as jest.Mock; -const mockGetSelectedAccount = getSelectedAccount as unknown as jest.Mock; -const mockGetShouldHideZeroBalanceTokens = - getShouldHideZeroBalanceTokens as jest.Mock; - +const mockGetIntlLocale = jest.mocked(getIntlLocale); +const mockGetCurrentCurrency = jest.mocked(getCurrentCurrency); +const mockGetPreferences = jest.mocked(getPreferences); +const mockGetSelectedAccount = jest.mocked(getSelectedAccount); +const mockGetShouldHideZeroBalanceTokens = jest.mocked( + getShouldHideZeroBalanceTokens, +); const mockGetTokensMarketData = getTokensMarketData as jest.Mock; +const mockGetCurrentChainId = jest.mocked(getCurrentChainId); const selectedAccountMock = { id: 'd51c0116-de36-4e77-b35b-408d4ea82d01', @@ -166,7 +169,7 @@ describe('AggregatedPercentageOverview', () => { mockGetSelectedAccount.mockReturnValue(selectedAccountMock); mockGetShouldHideZeroBalanceTokens.mockReturnValue(false); mockGetTokensMarketData.mockReturnValue(marketDataMock); - + mockGetCurrentChainId.mockReturnValue('0x1'); jest.clearAllMocks(); }); diff --git a/ui/components/app/wallet-overview/aggregated-percentage-overview.tsx b/ui/components/app/wallet-overview/aggregated-percentage-overview.tsx index 8c609610daa1..89bc94dab774 100644 --- a/ui/components/app/wallet-overview/aggregated-percentage-overview.tsx +++ b/ui/components/app/wallet-overview/aggregated-percentage-overview.tsx @@ -1,13 +1,15 @@ import React, { useMemo } from 'react'; import { useSelector } from 'react-redux'; -import { zeroAddress, toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from 'ethereumjs-util'; +import { getNativeTokenAddress } from '@metamask/assets-controllers'; import { getCurrentCurrency, getSelectedAccount, getShouldHideZeroBalanceTokens, getTokensMarketData, getPreferences, + getCurrentChainId, } from '../../../selectors'; import { useAccountTotalFiatBalance } from '../../../hooks/useAccountTotalFiatBalance'; @@ -37,6 +39,7 @@ export const AggregatedPercentageOverview = () => { const fiatCurrency = useSelector(getCurrentCurrency); const { privacyMode } = useSelector(getPreferences); const selectedAccount = useSelector(getSelectedAccount); + const currentChainId = useSelector(getCurrentChainId); const shouldHideZeroBalanceTokens = useSelector( getShouldHideZeroBalanceTokens, ); @@ -63,7 +66,8 @@ export const AggregatedPercentageOverview = () => { } // native token const nativePricePercentChange1d = - tokensMarketData?.[zeroAddress()]?.pricePercentChange1d; + tokensMarketData?.[getNativeTokenAddress(currentChainId)] + ?.pricePercentChange1d; const nativeFiat1dAgo = getCalculatedTokenAmount1dAgo( item.fiatBalance, nativePricePercentChange1d, diff --git a/ui/components/app/wallet-overview/coin-overview.tsx b/ui/components/app/wallet-overview/coin-overview.tsx index bf054d993e74..3be53776581d 100644 --- a/ui/components/app/wallet-overview/coin-overview.tsx +++ b/ui/components/app/wallet-overview/coin-overview.tsx @@ -7,11 +7,11 @@ import React, { } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import classnames from 'classnames'; -import { zeroAddress } from 'ethereumjs-util'; import { CaipChainId } from '@metamask/utils'; import type { Hex } from '@metamask/utils'; import { InternalAccount } from '@metamask/keyring-api'; +import { getNativeTokenAddress } from '@metamask/assets-controllers'; import { Box, ButtonIcon, @@ -231,7 +231,10 @@ export const CoinOverview = ({ return ( { ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) diff --git a/ui/components/multichain/token-list-item/price/percentage-and-amount-change/percentage-and-amount-change.test.tsx b/ui/components/multichain/token-list-item/price/percentage-and-amount-change/percentage-and-amount-change.test.tsx index abff9f40da8d..439c030a59cd 100644 --- a/ui/components/multichain/token-list-item/price/percentage-and-amount-change/percentage-and-amount-change.test.tsx +++ b/ui/components/multichain/token-list-item/price/percentage-and-amount-change/percentage-and-amount-change.test.tsx @@ -2,11 +2,13 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; import { zeroAddress } from 'ethereumjs-util'; +import { MarketDataDetails } from '@metamask/assets-controllers'; import { getIntlLocale } from '../../../../../ducks/locale/locale'; import { getCurrentCurrency, getSelectedAccountCachedBalance, getTokensMarketData, + getCurrentChainId, } from '../../../../../selectors'; import { getConversionRate, @@ -26,6 +28,7 @@ jest.mock('../../../../../selectors', () => ({ getCurrentCurrency: jest.fn(), getSelectedAccountCachedBalance: jest.fn(), getTokensMarketData: jest.fn(), + getCurrentChainId: jest.fn(), })); jest.mock('../../../../../ducks/metamask/metamask', () => ({ @@ -33,13 +36,15 @@ jest.mock('../../../../../ducks/metamask/metamask', () => ({ getNativeCurrency: jest.fn(), })); -const mockGetIntlLocale = getIntlLocale as unknown as jest.Mock; -const mockGetCurrentCurrency = getCurrentCurrency as jest.Mock; -const mockGetSelectedAccountCachedBalance = - getSelectedAccountCachedBalance as jest.Mock; -const mockGetConversionRate = getConversionRate as jest.Mock; -const mockGetNativeCurrency = getNativeCurrency as jest.Mock; -const mockGetTokensMarketData = getTokensMarketData as jest.Mock; +const mockGetIntlLocale = jest.mocked(getIntlLocale); +const mockGetCurrentCurrency = jest.mocked(getCurrentCurrency); +const mockGetSelectedAccountCachedBalance = jest.mocked( + getSelectedAccountCachedBalance, +); +const mockGetConversionRate = jest.mocked(getConversionRate); +const mockGetNativeCurrency = jest.mocked(getNativeCurrency); +const mockGetTokensMarketData = jest.mocked(getTokensMarketData); +const mockGetCurrentChainId = jest.mocked(getCurrentChainId); describe('PercentageChange Component', () => { beforeEach(() => { @@ -51,9 +56,9 @@ describe('PercentageChange Component', () => { mockGetTokensMarketData.mockReturnValue({ [zeroAddress()]: { pricePercentChange1d: 2, - }, + } as MarketDataDetails, }); - + mockGetCurrentChainId.mockReturnValue('0x1'); jest.clearAllMocks(); }); @@ -108,4 +113,19 @@ describe('PercentageChange Component', () => { expect(percentageElement).toBeInTheDocument(); expect(numberElement).toBeInTheDocument(); }); + + it('should display percentage for non-zero native tokens (MATIC)', () => { + mockGetTokensMarketData.mockReturnValue({ + '0x0000000000000000000000000000000000001010': { + pricePercentChange1d: 2, + } as MarketDataDetails, + }); + mockGetCurrentCurrency.mockReturnValue('POL'); + mockGetCurrentChainId.mockReturnValue('0x89'); + render(); + const percentageElement = screen.getByText('(+1.00%)'); + const numberElement = screen.getByText('+POL 12.21'); + expect(percentageElement).toBeInTheDocument(); + expect(numberElement).toBeInTheDocument(); + }); }); diff --git a/ui/components/multichain/token-list-item/price/percentage-and-amount-change/percentage-and-amount-change.tsx b/ui/components/multichain/token-list-item/price/percentage-and-amount-change/percentage-and-amount-change.tsx index be9921e88793..f1ba436ef47f 100644 --- a/ui/components/multichain/token-list-item/price/percentage-and-amount-change/percentage-and-amount-change.tsx +++ b/ui/components/multichain/token-list-item/price/percentage-and-amount-change/percentage-and-amount-change.tsx @@ -1,7 +1,8 @@ import React, { useMemo } from 'react'; import { useSelector } from 'react-redux'; import { BigNumber } from 'bignumber.js'; -import { isHexString, zeroAddress } from 'ethereumjs-util'; +import { isHexString } from 'ethereumjs-util'; +import { getNativeTokenAddress } from '@metamask/assets-controllers'; import { Text, Box } from '../../../../component-library'; import { Display, @@ -9,6 +10,7 @@ import { TextVariant, } from '../../../../../helpers/constants/design-system'; import { + getCurrentChainId, getCurrentCurrency, getSelectedAccountCachedBalance, getTokensMarketData, @@ -66,10 +68,12 @@ export const PercentageAndAmountChange = ({ const conversionRate = useSelector(getConversionRate); const nativeCurrency = useSelector(getNativeCurrency); const marketData = useSelector(getTokensMarketData); + const currentChainId = useSelector(getCurrentChainId); const balanceChange = useMemo(() => { // Extracts the 1-day percentage change in price from marketData using the zero address as a key. - const percentage1d = marketData?.[zeroAddress()]?.pricePercentChange1d; + const percentage1d = + marketData?.[getNativeTokenAddress(currentChainId)]?.pricePercentChange1d; // Checks if the balanceValue is in hex format. This is important for cryptocurrency balances which are often represented in hex. if (isHexString(balanceValue)) { diff --git a/ui/components/multichain/token-list-item/token-list-item.tsx b/ui/components/multichain/token-list-item/token-list-item.tsx index 540d2d8be98a..ef49ec3126cb 100644 --- a/ui/components/multichain/token-list-item/token-list-item.tsx +++ b/ui/components/multichain/token-list-item/token-list-item.tsx @@ -2,7 +2,8 @@ import React, { useContext, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; import classnames from 'classnames'; -import { zeroAddress } from 'ethereumjs-util'; +import { getNativeTokenAddress } from '@metamask/assets-controllers'; +import { Hex } from '@metamask/utils'; import { AlignItems, BackgroundColor, @@ -336,13 +337,14 @@ export const TokenListItem = ({ diff --git a/ui/pages/asset/components/asset-page.tsx b/ui/pages/asset/components/asset-page.tsx index 19ce592f0071..0f4529861dbc 100644 --- a/ui/pages/asset/components/asset-page.tsx +++ b/ui/pages/asset/components/asset-page.tsx @@ -3,8 +3,8 @@ import { useHistory } from 'react-router-dom'; import { useSelector } from 'react-redux'; import { EthMethod } from '@metamask/keyring-api'; import { isEqual } from 'lodash'; +import { getNativeTokenAddress } from '@metamask/assets-controllers'; import { Hex } from '@metamask/utils'; -import { zeroAddress } from 'ethereumjs-util'; import { getCurrentCurrency, getDataCollectionForMarketing, @@ -140,7 +140,7 @@ const AssetPage = ({ const address = type === AssetType.token ? toChecksumHexAddress(asset.address) - : zeroAddress(); + : getNativeTokenAddress(chainId); const balance = calculateTokenBalance({ isNative: type === AssetType.native, diff --git a/yarn.lock b/yarn.lock index bc208e1a8f92..db952a4b1e70 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4934,9 +4934,9 @@ __metadata: languageName: node linkType: hard -"@metamask/assets-controllers@npm:45.0.0": - version: 45.0.0 - resolution: "@metamask/assets-controllers@npm:45.0.0" +"@metamask/assets-controllers@npm:45.1.0": + version: 45.1.0 + resolution: "@metamask/assets-controllers@npm:45.1.0" dependencies: "@ethereumjs/util": "npm:^8.1.0" "@ethersproject/abi": "npm:^5.7.0" @@ -4969,13 +4969,13 @@ __metadata: "@metamask/keyring-controller": ^19.0.0 "@metamask/network-controller": ^22.0.0 "@metamask/preferences-controller": ^15.0.0 - checksum: 10/0ad51464cf060f1c2cab56c2c8d9daa5f29987e8ead69c0e029fb8357fa5c629434116de5663dc38a57c11b3736b6c7d9b1db9b6892a453fbc3f9c6965d42295 + checksum: 10/7e366739c2b3fc8000aaa8cd302d3e2c3958e29e7c88f3e7e188c4ec46454cf9e894c1e230a84092bba8e6c5274b301dfdb4e55a0ba4322bdcb9e7325ad5a5e5 languageName: node linkType: hard -"@metamask/assets-controllers@patch:@metamask/assets-controllers@npm%3A45.0.0#~/.yarn/patches/@metamask-assets-controllers-npm-45.0.0-31810ece32.patch": - version: 45.0.0 - resolution: "@metamask/assets-controllers@patch:@metamask/assets-controllers@npm%3A45.0.0#~/.yarn/patches/@metamask-assets-controllers-npm-45.0.0-31810ece32.patch::version=45.0.0&hash=8e5354" +"@metamask/assets-controllers@patch:@metamask/assets-controllers@npm%3A45.1.0#~/.yarn/patches/@metamask-assets-controllers-npm-45.1.0-d914c453f0.patch": + version: 45.1.0 + resolution: "@metamask/assets-controllers@patch:@metamask/assets-controllers@npm%3A45.1.0#~/.yarn/patches/@metamask-assets-controllers-npm-45.1.0-d914c453f0.patch::version=45.1.0&hash=86167d" dependencies: "@ethereumjs/util": "npm:^8.1.0" "@ethersproject/abi": "npm:^5.7.0" @@ -5008,7 +5008,7 @@ __metadata: "@metamask/keyring-controller": ^19.0.0 "@metamask/network-controller": ^22.0.0 "@metamask/preferences-controller": ^15.0.0 - checksum: 10/823627b5bd23829d81a54291f74c4ddf52d0732a840c121c4ae7f1fc468dd98f3fc1e64b7f8a9bbaaa76cd6670082f2976e5e6ecf872e04c212a5c8ec5fe4916 + checksum: 10/985ec7dffb75aaff8eea00f556157e42cd5db063cbfa94dfd4f070c5b9d98b1315f3680fa7370f4c734a1688598bbda9c44a7c33c342e1d123d6ee2edd6120fc languageName: node linkType: hard @@ -26816,7 +26816,7 @@ __metadata: "@metamask/announcement-controller": "npm:^7.0.0" "@metamask/api-specs": "npm:^0.9.3" "@metamask/approval-controller": "npm:^7.0.0" - "@metamask/assets-controllers": "patch:@metamask/assets-controllers@npm%3A45.0.0#~/.yarn/patches/@metamask-assets-controllers-npm-45.0.0-31810ece32.patch" + "@metamask/assets-controllers": "patch:@metamask/assets-controllers@npm%3A45.1.0#~/.yarn/patches/@metamask-assets-controllers-npm-45.1.0-d914c453f0.patch" "@metamask/auto-changelog": "npm:^2.1.0" "@metamask/base-controller": "npm:^7.0.0" "@metamask/bitcoin-wallet-snap": "npm:^0.8.2"