From 1b4417d8a57ced140e0ea31aed08758f74002faa Mon Sep 17 00:00:00 2001 From: Nick Gambino <35090461+gambinish@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:39:37 -0700 Subject: [PATCH] feat: Update Polygon from `MATIC` to `POL` (#26671) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** Add `POL` token image, and maps it to Polygon Network config. See [blog post](https://polygon.technology/blog/save-the-date-matic-pol-migration-coming-september-4th-everything-you-need-to-know) for more context. Adds chain collision check to not flag `POL` as scam token Adds migration to overwrite `MATIC` ticker to `POL` [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26671?quickstart=1) ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/MMASSETS-362 ## **Manual testing steps** 1. When adding Polygon as a network from `FEATURED_RPCS`, ticker symbol should be POL 2. When switching to Polygon Mainnet, ticker should be POL (not MATIC) 2. Can import `Polygon Network Token` on Ethereum Mainnet 3. Can import `Matic Network Token` on Ethereum Mainnet (backward compatibility) > Note, that both `MATIC` and `POL` erc20 tokens can already be imported on Ethereum Mainnet, so this behavior should remain unchanged. Additionally, when a user upgrades to this build, migration should run and overwrite ticker from MATIC to POL: 1. Install a previous build (checkout `develop` and `yarn && yarn start` should be fine here) -> Polygon Network should show `MATIC` as ticker. You may need to remove and re-add Polygon Network, as migrations are incremental. 2. checkout to this branch, `yarn && yarn start`, migration 128 should run (Running migration 128... in console) -> Polygon Network should show `POL` as ticker ## **Screenshots/Recordings** Before: Screenshot 2024-08-27 at 2 39 15 PM Screenshot 2024-08-27 at 2 39 36 PM After: Screenshot 2024-08-27 at 1 47 40 PM Screenshot 2024-08-27 at 1 48 11 PM ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- app/images/matic-token.png | Bin 16286 -> 0 bytes app/images/{matic-token.svg => pol-token.svg} | 0 app/scripts/migrations/121.2.test.ts | 274 ++++++++++++++++++ app/scripts/migrations/121.2.ts | 93 ++++++ app/scripts/migrations/index.js | 1 + shared/constants/network.ts | 14 +- shared/constants/swaps.ts | 4 +- .../app/add-network/add-network.stories.js | 4 +- .../avatar-network/README.mdx | 2 +- .../avatar-network/avatar-network.stories.tsx | 2 +- .../picker-network/README.mdx | 2 +- .../picker-network/picker-network.stories.tsx | 2 +- .../picker-network/picker-network.test.tsx | 4 +- .../__snapshots__/avatar-group.test.tsx.snap | 2 +- .../avatar-group/avatar-group.stories.tsx | 4 +- .../avatar-group/avatar-group.test.tsx | 2 +- .../network-list-item.test.js.snap | 2 +- .../network-list-item.stories.js | 2 +- .../network-list-item.test.js | 4 +- .../token-input/token-input.component.test.js | 4 +- .../simulation-details/asset-pill.test.tsx | 4 +- .../networks-form/networks-form.js | 6 + 22 files changed, 404 insertions(+), 28 deletions(-) delete mode 100644 app/images/matic-token.png rename app/images/{matic-token.svg => pol-token.svg} (100%) create mode 100644 app/scripts/migrations/121.2.test.ts create mode 100644 app/scripts/migrations/121.2.ts diff --git a/app/images/matic-token.png b/app/images/matic-token.png deleted file mode 100644 index b154c46ea54324347bedc0b9f71ad5acb18b97d6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16286 zcmZ|019UCHvp$;S#I|kQc1~>T#I|kQww;{Vw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M;`ZFy)e%4BvBAlpGVDvP%=sYvf*7a?a{l#0PFR<>92g1smMLGEuWQ|ZK11R5 zR{cqAijk~okF$VP!esQsS#q*GT^xL=YgzvF7O@V_Y>?2104W!fLHV{3&w^y`ukRU8 zfzOgh=64ZubcwTtO8JtAJTxg-Rw3}B)G>=r>ZgYp6aQTexM8uIcnjw?`}DZ2!_`O| z^$<~%Zgh4^W1y9CHf^D;`+%e)9FA?<%TjqB6%ag(*g^^kA- zFzCMR(!$&fQm^q7F;<)frk4k5Ig}pL*s9GBJEHzrE}r2q1hx- z`-GM+Ci|(TpxISDB7Qn@Z@>=ee_{j78%)VA2AX=zZR_LntcVN^Cbw%cMe~E>mA zRzp`NELraK-}6Nt#fW65ET0{rfOI&dPjJuwNFIN^rRUpbU{VO0XPRLu1~QlUnvxcj zBhBg=z{~$Bj73E9rR?KLUomzk%tcW{4%`6x^b_^W1`xm->iqTcL$tc`J39>_B!v@! zIC6MU94fmT70EblHVrmyMra+N}k^c_1^6E33|CYFO0tmqM@2fdB~ zzK!W23-UJn#g2gN%R=5W;0pnG{OyX4hSao#NLff3zFoUkuCh_^ZExLt{*&BGF~}gr zEfz!pyPsxWHlbnJ3HN_w_bN*c`X$57eS`7enz(6{!H53KY8Mxg5v~^e { + it('updates the version metadata', async () => { + const oldStorage = { + meta: { version: oldVersion }, + data: {}, + }; + + const newStorage = await migrate(oldStorage); + + expect(newStorage.meta).toStrictEqual({ version }); + }); + + it('Does nothing if `networkConfigurations` or `providerConfig` are not in the network controller state', async () => { + const oldState = { + NetworkController: { + selectedNetworkClientId: 'mainnet', + }, + }; + + const transformedState = await migrate({ + meta: { version: oldVersion }, + data: cloneDeep(oldState), + }); + + expect(transformedState.data).toStrictEqual(oldState); + }); + + it('Updates MATIC ticker to POL and updates imageURL in networkConfigurations', async () => { + const oldState = { + NetworkController: { + networkConfigurations: { + '0x89': { + chainId: '0x89', + ticker: 'MATIC', + rpcPrefs: { + imageUrl: './images/matic-token.svg', + }, + }, + }, + }, + }; + + const expectedState = { + NetworkController: { + networkConfigurations: { + '0x89': { + chainId: '0x89', + ticker: 'POL', + rpcPrefs: { + imageUrl: './images/pol-token.svg', + }, + }, + }, + }, + }; + + const transformedState = await migrate({ + meta: { version: oldVersion }, + data: cloneDeep(oldState), + }); + + expect(transformedState.data).toStrictEqual(expectedState); + }); + + it('Does not update ticker to POL if ticker is not MATIC, but still updates imageURL in networkConfigurations', async () => { + const oldState = { + NetworkController: { + networkConfigurations: { + '0x89': { + chainId: '0x89', + ticker: 'NOT_MATIC', + rpcPrefs: { + imageUrl: './images/matic-token.svg', + }, + }, + }, + }, + }; + + const expectedState = { + NetworkController: { + networkConfigurations: { + '0x89': { + chainId: '0x89', + ticker: 'NOT_MATIC', + rpcPrefs: { + imageUrl: './images/pol-token.svg', + }, + }, + }, + }, + }; + + const transformedState = await migrate({ + meta: { version: oldVersion }, + data: cloneDeep(oldState), + }); + + expect(transformedState.data).toStrictEqual(expectedState); + }); + + it('Does not update tickers for other network configurations, updates only ticker and imageURL for chain 0x89', async () => { + const oldState = { + NetworkController: { + networkConfigurations: { + '0x89': { + chainId: '0x89', + ticker: 'MATIC', + rpcPrefs: { + imageUrl: './images/matic-token.svg', + }, + }, + '0x1': { + chainId: '0x1', + ticker: 'ETH', + rpcPrefs: { + imageUrl: './images/eth-token.svg', + }, + }, + }, + }, + }; + + const expectedState = { + NetworkController: { + networkConfigurations: { + '0x89': { + chainId: '0x89', + ticker: 'POL', + rpcPrefs: { + imageUrl: './images/pol-token.svg', + }, + }, + '0x1': { + chainId: '0x1', + ticker: 'ETH', + rpcPrefs: { + imageUrl: './images/eth-token.svg', + }, + }, + }, + }, + }; + + const transformedState = await migrate({ + meta: { version: oldVersion }, + data: cloneDeep(oldState), + }); + + expect(transformedState.data).toStrictEqual(expectedState); + }); + + it('Does nothing if Polygon ChainId (0x89) is not in networkConfigurations', async () => { + const oldState = { + NetworkController: { + networkConfigurations: { + '0x1': { + chainId: '0x1', + ticker: 'ETH', + rpcPrefs: { + imageUrl: './images/eth-token.svg', + }, + }, + '0x2a': { + chainId: '0x2a', + ticker: 'KOVAN', + rpcPrefs: { + imageUrl: './images/kovan-token.svg', + }, + }, + }, + }, + }; + + const transformedState = await migrate({ + meta: { version: oldVersion }, + data: cloneDeep(oldState), + }); + + expect(transformedState.data).toStrictEqual(oldState); + }); + + it('Updates Polygon ChainId (0x89) in ProviderConfig if exists, and ticker is set to MATIC, and updates imageUrl', async () => { + const oldState = { + NetworkController: { + providerConfig: { + chainId: '0x89', + ticker: 'MATIC', + rpcPrefs: { + imageUrl: './images/matic-token.svg', + }, + }, + }, + }; + + const expectedState = { + NetworkController: { + providerConfig: { + chainId: '0x89', + ticker: 'POL', + rpcPrefs: { + imageUrl: './images/pol-token.svg', + }, + }, + }, + }; + + const transformedState = await migrate({ + meta: { version: oldVersion }, + data: cloneDeep(oldState), + }); + + expect(transformedState.data).toStrictEqual(expectedState); + }); + + it('Does nothing if Polygon ChainId (0x89) is not in providerConfig', async () => { + const oldState = { + NetworkController: { + providerConfig: { + chainId: '0x1', + ticker: 'ETH', + rpcPrefs: { + imageUrl: './images/eth-token.svg', + }, + }, + }, + }; + + const transformedState = await migrate({ + meta: { version: oldVersion }, + data: cloneDeep(oldState), + }); + + expect(transformedState.data).toStrictEqual(oldState); + }); + + it('Does not update ticker if Polygon ChainId (0x89) is in providerConfig, but ticker is not MATIC, but still updates imageUrl', async () => { + const oldState = { + NetworkController: { + providerConfig: { + chainId: '0x89', + ticker: 'NOT_MATIC', + rpcPrefs: { + imageUrl: './images/matic-token.svg', + }, + }, + }, + }; + + const expectedState = { + NetworkController: { + providerConfig: { + chainId: '0x89', + ticker: 'NOT_MATIC', + rpcPrefs: { + imageUrl: './images/pol-token.svg', + }, + }, + }, + }; + + const transformedState = await migrate({ + meta: { version: oldVersion }, + data: cloneDeep(oldState), + }); + + expect(transformedState.data).toStrictEqual(expectedState); + }); +}); diff --git a/app/scripts/migrations/121.2.ts b/app/scripts/migrations/121.2.ts new file mode 100644 index 000000000000..8cd84d3e10ab --- /dev/null +++ b/app/scripts/migrations/121.2.ts @@ -0,0 +1,93 @@ +import { hasProperty, isObject } from '@metamask/utils'; +import { cloneDeep } from 'lodash'; +import { CHAIN_IDS } from '../../../shared/constants/network'; + +export const version = 121.2; + +type VersionedData = { + meta: { version: number }; + data: Record; +}; + +/** + * Migrates MATIC ticker in Network Configuration to POL ticker as per the direction in https://polygon.technology/blog/save-the-date-matic-pol-migration-coming-september-4th-everything-you-need-to-know + * + * @param originalVersionedData - Versioned MetaMask extension state, exactly what we persist to dist. + * @param originalVersionedData.meta - State metadata. + * @param originalVersionedData.meta.version - The current state version. + * @param originalVersionedData.data - The persisted MetaMask state, keyed by controller. + * @returns Updated versioned MetaMask extension state. + */ +export async function migrate( + originalVersionedData: VersionedData, +): Promise { + const versionedData = cloneDeep(originalVersionedData); + versionedData.meta.version = version; + transformState(versionedData.data); + return versionedData; +} + +function transformState(state: Record): void { + const networkControllerState = state.NetworkController; + if ( + hasProperty(state, 'NetworkController') && + isObject(networkControllerState) && + hasProperty(networkControllerState, 'networkConfigurations') && + isObject(networkControllerState.networkConfigurations) + ) { + for (const networkConfiguration of Object.values( + networkControllerState.networkConfigurations, + )) { + if ( + isObject(networkConfiguration) && + networkConfiguration.chainId === CHAIN_IDS.POLYGON + ) { + // update image path regardless of ticker + if ( + hasProperty(networkConfiguration, 'rpcPrefs') && + isObject(networkConfiguration.rpcPrefs) && + hasProperty(networkConfiguration.rpcPrefs, 'imageUrl') && + networkConfiguration.rpcPrefs.imageUrl === './images/matic-token.svg' + ) { + networkConfiguration.rpcPrefs.imageUrl = './images/pol-token.svg'; + } + // update ticker only if MATIC + if ( + hasProperty(networkConfiguration, 'ticker') && + networkConfiguration.ticker === 'MATIC' + ) { + networkConfiguration.ticker = 'POL'; + } + } + } + } + + // handle legacy NetworkController versions (with providerConfig) + if ( + hasProperty(state, 'NetworkController') && + isObject(networkControllerState) && + hasProperty(networkControllerState, 'providerConfig') && + isObject(networkControllerState.providerConfig) && + hasProperty(networkControllerState.providerConfig, 'chainId') && + networkControllerState.providerConfig.chainId === CHAIN_IDS.POLYGON + ) { + // update image path regardless of ticker + if ( + hasProperty(networkControllerState.providerConfig, 'rpcPrefs') && + isObject(networkControllerState.providerConfig.rpcPrefs) && + hasProperty(networkControllerState.providerConfig.rpcPrefs, 'imageUrl') && + networkControllerState.providerConfig.rpcPrefs.imageUrl === + './images/matic-token.svg' + ) { + networkControllerState.providerConfig.rpcPrefs.imageUrl = + './images/pol-token.svg'; + } + // update ticker only if MATIC + if ( + hasProperty(networkControllerState.providerConfig, 'ticker') && + networkControllerState.providerConfig.ticker === 'MATIC' + ) { + networkControllerState.providerConfig.ticker = 'POL'; + } + } +} diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js index a8b28531e334..7e800337da3b 100644 --- a/app/scripts/migrations/index.js +++ b/app/scripts/migrations/index.js @@ -139,6 +139,7 @@ const migrations = [ require('./120.6'), require('./121'), require('./121.1'), + require('./121.2'), require('./122'), require('./123'), require('./124'), diff --git a/shared/constants/network.ts b/shared/constants/network.ts index c22baaa922e3..de8429d8ba6d 100644 --- a/shared/constants/network.ts +++ b/shared/constants/network.ts @@ -295,6 +295,7 @@ export const CURRENCY_SYMBOLS = { HARMONY: 'ONE', PALM: 'PALM', MATIC: 'MATIC', + POL: 'POL', TEST_ETH: 'TESTETH', USDC: 'USDC', USDT: 'USDT', @@ -368,6 +369,7 @@ const CHAINLIST_CURRENCY_SYMBOLS_MAP = { export const CHAINLIST_CURRENCY_SYMBOLS_MAP_NETWORK_COLLISION = { WETHIO: 'ZYN', CHZ: 'CHZ', + MATIC: 'POL', }; export const ETH_TOKEN_IMAGE_URL = './images/eth_logo.svg'; @@ -376,7 +378,7 @@ export const LINEA_SEPOLIA_TOKEN_IMAGE_URL = './images/linea-logo-testnet.png'; export const LINEA_MAINNET_TOKEN_IMAGE_URL = './images/linea-logo-mainnet.svg'; export const TEST_ETH_TOKEN_IMAGE_URL = './images/black-eth-logo.svg'; export const BNB_TOKEN_IMAGE_URL = './images/bnb.svg'; -export const MATIC_TOKEN_IMAGE_URL = './images/matic-token.svg'; +export const POL_TOKEN_IMAGE_URL = './images/pol-token.svg'; export const AVAX_TOKEN_IMAGE_URL = './images/avax-token.svg'; export const AETH_TOKEN_IMAGE_URL = './images/arbitrum.svg'; export const FTM_TOKEN_IMAGE_URL = './images/fantom-opera.svg'; @@ -563,7 +565,7 @@ export const CHAIN_ID_TO_CURRENCY_SYMBOL_MAP = { [CHAINLIST_CHAIN_IDS_MAP.MAINNET]: CHAINLIST_CURRENCY_SYMBOLS_MAP.ETH, [CHAINLIST_CHAIN_IDS_MAP.OPBNB]: CHAINLIST_CURRENCY_SYMBOLS_MAP.OPBNB, [CHAINLIST_CHAIN_IDS_MAP.OPTIMISM]: CHAINLIST_CURRENCY_SYMBOLS_MAP.OPTIMISM, - [CHAINLIST_CHAIN_IDS_MAP.POLYGON]: CHAINLIST_CURRENCY_SYMBOLS_MAP.MATIC, + [CHAINLIST_CHAIN_IDS_MAP.POLYGON]: CHAINLIST_CURRENCY_SYMBOLS_MAP.POL, [CHAINLIST_CHAIN_IDS_MAP.ZKSYNC_ERA]: CHAINLIST_CURRENCY_SYMBOLS_MAP.ZKSYNC_ERA, [CHAINLIST_CHAIN_IDS_MAP.GOERLI]: @@ -713,7 +715,7 @@ export const CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP = { [CHAIN_IDS.LINEA_MAINNET]: LINEA_MAINNET_TOKEN_IMAGE_URL, [CHAIN_IDS.AVALANCHE]: AVAX_TOKEN_IMAGE_URL, [CHAIN_IDS.BSC]: BNB_TOKEN_IMAGE_URL, - [CHAIN_IDS.POLYGON]: MATIC_TOKEN_IMAGE_URL, + [CHAIN_IDS.POLYGON]: POL_TOKEN_IMAGE_URL, [CHAIN_IDS.ARBITRUM]: AETH_TOKEN_IMAGE_URL, [CHAIN_IDS.FANTOM]: FTM_TOKEN_IMAGE_URL, [CHAIN_IDS.HARMONY]: HARMONY_ONE_TOKEN_IMAGE_URL, @@ -790,7 +792,7 @@ export const CHAIN_ID_TOKEN_IMAGE_MAP = { [CHAIN_IDS.MAINNET]: ETH_TOKEN_IMAGE_URL, [CHAIN_IDS.TEST_ETH]: TEST_ETH_TOKEN_IMAGE_URL, [CHAIN_IDS.BSC]: BNB_TOKEN_IMAGE_URL, - [CHAIN_IDS.POLYGON]: MATIC_TOKEN_IMAGE_URL, + [CHAIN_IDS.POLYGON]: POL_TOKEN_IMAGE_URL, [CHAIN_IDS.AVALANCHE]: AVAX_TOKEN_IMAGE_URL, [CHAIN_IDS.OPTIMISM]: ETH_TOKEN_IMAGE_URL, [CHAIN_IDS.CELO]: CELO_TOKEN_IMAGE_URL, @@ -965,10 +967,10 @@ export const FEATURED_RPCS: RPCDefinition[] = [ chainId: CHAIN_IDS.POLYGON, nickname: `${POLYGON_DISPLAY_NAME} ${capitalize(NETWORK_TYPES.MAINNET)}`, rpcUrl: `https://polygon-mainnet.infura.io/v3/${infuraProjectId}`, - ticker: CURRENCY_SYMBOLS.MATIC, + ticker: CURRENCY_SYMBOLS.POL, rpcPrefs: { blockExplorerUrl: 'https://polygonscan.com/', - imageUrl: MATIC_TOKEN_IMAGE_URL, + imageUrl: POL_TOKEN_IMAGE_URL, }, }, { diff --git a/shared/constants/swaps.ts b/shared/constants/swaps.ts index bd3db9d94a2f..53e1243acaa0 100644 --- a/shared/constants/swaps.ts +++ b/shared/constants/swaps.ts @@ -2,7 +2,7 @@ import { ETH_TOKEN_IMAGE_URL, TEST_ETH_TOKEN_IMAGE_URL, BNB_TOKEN_IMAGE_URL, - MATIC_TOKEN_IMAGE_URL, + POL_TOKEN_IMAGE_URL, AVAX_TOKEN_IMAGE_URL, CURRENCY_SYMBOLS, CHAIN_IDS, @@ -74,7 +74,7 @@ export const MATIC_SWAPS_TOKEN_OBJECT: SwapsTokenObject = { name: 'Matic', address: DEFAULT_TOKEN_ADDRESS, decimals: 18, - iconUrl: MATIC_TOKEN_IMAGE_URL, + iconUrl: POL_TOKEN_IMAGE_URL, } as const; export const AVAX_SWAPS_TOKEN_OBJECT: SwapsTokenObject = { diff --git a/ui/components/app/add-network/add-network.stories.js b/ui/components/app/add-network/add-network.stories.js index 88de1480c782..76d10b569d23 100644 --- a/ui/components/app/add-network/add-network.stories.js +++ b/ui/components/app/add-network/add-network.stories.js @@ -1,7 +1,7 @@ import React from 'react'; import AddNetwork from './add-network'; -const MATIC_TOKEN_IMAGE_URL = './images/matic-token.svg'; +const POL_TOKEN_IMAGE_URL = './images/pol-token.svg'; const ARBITRUM_IMAGE_URL = './images/arbitrum.svg'; const OPTIMISM_IMAGE_URL = './images/optimism.svg'; const AVALANCHE_IMAGE_URL = './images/avax-token.svg'; @@ -93,7 +93,7 @@ export default { ticker: 'MATIC', rpcPrefs: { blockExplorerUrl: 'https://polygonscan.com/', - imageUrl: MATIC_TOKEN_IMAGE_URL, + imageUrl: POL_TOKEN_IMAGE_URL, }, }, { diff --git a/ui/components/component-library/avatar-network/README.mdx b/ui/components/component-library/avatar-network/README.mdx index f2db6d4ad227..8022bbbba6e7 100644 --- a/ui/components/component-library/avatar-network/README.mdx +++ b/ui/components/component-library/avatar-network/README.mdx @@ -71,7 +71,7 @@ Use the `src` prop to set the image to be rendered of the `AvatarNetwork`. ```jsx import { AvatarNetwork } from '../../component-library'; - + diff --git a/ui/components/component-library/avatar-network/avatar-network.stories.tsx b/ui/components/component-library/avatar-network/avatar-network.stories.tsx index 04265930331f..390ddc3e87cc 100644 --- a/ui/components/component-library/avatar-network/avatar-network.stories.tsx +++ b/ui/components/component-library/avatar-network/avatar-network.stories.tsx @@ -95,7 +95,7 @@ Name.args = { export const Src: StoryFn = (args) => ( - + diff --git a/ui/components/component-library/picker-network/README.mdx b/ui/components/component-library/picker-network/README.mdx index 96377c2ddac3..19a0f1381d54 100644 --- a/ui/components/component-library/picker-network/README.mdx +++ b/ui/components/component-library/picker-network/README.mdx @@ -44,7 +44,7 @@ Use the `src` prop with an image url to render the `AvatarNetwork`. Use the `ava ```jsx import { PickerNetwork } from '../../ui/component-library'; - + ``` diff --git a/ui/components/component-library/picker-network/picker-network.stories.tsx b/ui/components/component-library/picker-network/picker-network.stories.tsx index b426b5a28a1b..9960058e873e 100644 --- a/ui/components/component-library/picker-network/picker-network.stories.tsx +++ b/ui/components/component-library/picker-network/picker-network.stories.tsx @@ -66,7 +66,7 @@ export const Src: StoryFn = (args) => ( diff --git a/ui/components/component-library/picker-network/picker-network.test.tsx b/ui/components/component-library/picker-network/picker-network.test.tsx index 8701efc2388f..ac7ee292b55c 100644 --- a/ui/components/component-library/picker-network/picker-network.test.tsx +++ b/ui/components/component-library/picker-network/picker-network.test.tsx @@ -18,12 +18,12 @@ describe('PickerNetwork', () => { , ); const image = screen.getByRole('img'); expect(image).toBeDefined(); - expect(image).toHaveAttribute('src', './images/matic-token.svg'); + expect(image).toHaveAttribute('src', './images/pol-token.svg'); }); it('should render avatar network inside the PickerNetwork with custom props', () => { const container = ( diff --git a/ui/components/multichain/avatar-group/__snapshots__/avatar-group.test.tsx.snap b/ui/components/multichain/avatar-group/__snapshots__/avatar-group.test.tsx.snap index 526fb9b58498..ff4c6a297c38 100644 --- a/ui/components/multichain/avatar-group/__snapshots__/avatar-group.test.tsx.snap +++ b/ui/components/multichain/avatar-group/__snapshots__/avatar-group.test.tsx.snap @@ -47,7 +47,7 @@ exports[`AvatarGroup should render AvatarGroup component 1`] = ` MATIC logo diff --git a/ui/components/multichain/avatar-group/avatar-group.stories.tsx b/ui/components/multichain/avatar-group/avatar-group.stories.tsx index ec2a97dfdfbc..b0b9bbc7601e 100644 --- a/ui/components/multichain/avatar-group/avatar-group.stories.tsx +++ b/ui/components/multichain/avatar-group/avatar-group.stories.tsx @@ -16,7 +16,7 @@ export default { args: { members: [ { symbol: 'ETH', avatarValue: './images/eth_logo.svg' }, - { symbol: 'MATIC', avatarValue: './images/matic-token.svg' }, + { symbol: 'MATIC', avatarValue: './images/pol-token.svg' }, { symbol: 'OP', avatarValue: './images/optimism.svg' }, { symbol: 'AVAX', avatarValue: './images/avax-token.svg' }, ], @@ -35,7 +35,7 @@ export const WithTag: StoryFn = (args) => ( WithTag.args = { members: [ { symbol: 'ETH', avatarValue: './images/eth_logo.svg' }, - { symbol: 'MATIC', avatarValue: './images/matic-token.svg' }, + { symbol: 'MATIC', avatarValue: './images/pol-token.svg' }, { symbol: 'OP', avatarValue: './images/optimism.svg' }, { symbol: 'AVAX', avatarValue: './images/avax-token.svg' }, { symbol: 'PALM', avatarValue: './images/palm.svg' }, diff --git a/ui/components/multichain/avatar-group/avatar-group.test.tsx b/ui/components/multichain/avatar-group/avatar-group.test.tsx index 836c4d3b341f..22feec62d524 100644 --- a/ui/components/multichain/avatar-group/avatar-group.test.tsx +++ b/ui/components/multichain/avatar-group/avatar-group.test.tsx @@ -9,7 +9,7 @@ import { AvatarGroup } from './avatar-group'; const members = [ { symbol: 'ETH', avatarValue: './images/eth_logo.svg' }, - { symbol: 'MATIC', avatarValue: './images/matic-token.svg' }, + { symbol: 'MATIC', avatarValue: './images/pol-token.svg' }, { symbol: 'OP', avatarValue: './images/optimism.svg' }, { symbol: 'AVAX', avatarValue: './images/avax-token.svg' }, { symbol: 'PALM', avatarValue: './images/palm.svg' }, diff --git a/ui/components/multichain/network-list-item/__snapshots__/network-list-item.test.js.snap b/ui/components/multichain/network-list-item/__snapshots__/network-list-item.test.js.snap index ede77cf934c3..755b6b7fad80 100644 --- a/ui/components/multichain/network-list-item/__snapshots__/network-list-item.test.js.snap +++ b/ui/components/multichain/network-list-item/__snapshots__/network-list-item.test.js.snap @@ -11,7 +11,7 @@ exports[`NetworkListItem renders properly 1`] = ` Polygon logo
(
); -IconStory.args = { iconSrc: './images/matic-token.svg', name: 'Polygon' }; +IconStory.args = { iconSrc: './images/pol-token.svg', name: 'Polygon' }; export const SelectedStory = (args) => (
undefined, onDeleteClick: () => undefined, diff --git a/ui/components/ui/token-input/token-input.component.test.js b/ui/components/ui/token-input/token-input.component.test.js index 1e53fbaf7e64..8a91d5301b3c 100644 --- a/ui/components/ui/token-input/token-input.component.test.js +++ b/ui/components/ui/token-input/token-input.component.test.js @@ -66,7 +66,7 @@ describe('TokenInput Component', () => { metamask: { ...mockState.metamask, currencyRates: { - [CURRENCY_SYMBOLS.MATIC]: { + [CURRENCY_SYMBOLS.POL]: { conversionRate: 1, }, }, @@ -84,7 +84,7 @@ describe('TokenInput Component', () => { mockStore, ); - expect(queryByTitle('0 MATIC')).toBeInTheDocument(); + expect(queryByTitle('0 POL')).toBeInTheDocument(); }); it('should render showFiat', () => { diff --git a/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx b/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx index 0b83b08fb784..77d49ac6c561 100644 --- a/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx +++ b/ui/pages/confirmations/components/simulation-details/asset-pill.test.tsx @@ -38,8 +38,8 @@ describe('AssetPill', () => { { chainId: CHAIN_IDS.POLYGON, expected: { - ticker: 'MATIC', - imgSrc: './images/matic-token.svg', + ticker: 'POL', + imgSrc: './images/pol-token.svg', }, }, ]; diff --git a/ui/pages/settings/networks-tab/networks-form/networks-form.js b/ui/pages/settings/networks-tab/networks-form/networks-form.js index 8dd420cbb1f0..487bf56f8378 100644 --- a/ui/pages/settings/networks-tab/networks-form/networks-form.js +++ b/ui/pages/settings/networks-tab/networks-form/networks-form.js @@ -210,6 +210,12 @@ const NetworksForm = ({ }); safeChainsList.current = [ ...safeChains, + { + chainId: 137, + nativeCurrency: { + symbol: CHAINLIST_CURRENCY_SYMBOLS_MAP_NETWORK_COLLISION.MATIC, + }, + }, { chainId: 78, nativeCurrency: {