From a854cfdb930f2f6bf850371383f6880f22b76b3a Mon Sep 17 00:00:00 2001 From: aleksandar-mihajlovic <120601632+aleksandar-mihajlovic@users.noreply.github.com> Date: Tue, 21 Mar 2023 12:39:36 +0100 Subject: [PATCH 1/7] Changed text for review spending cap copy (#18214) --- app/_locales/en/messages.json | 2 +- test/e2e/tests/custom-token-add-approve.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 7b45679ff7b7..9d3aaeb94db0 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -3215,7 +3215,7 @@ "message": "Reveal seed phrase" }, "reviewSpendingCap": { - "message": "Review your spending cap" + "message": "Review the spending cap for your" }, "revokeAllTokensTitle": { "message": "Revoke permission to access and transfer all of your $1?", diff --git a/test/e2e/tests/custom-token-add-approve.spec.js b/test/e2e/tests/custom-token-add-approve.spec.js index 62700d389016..b520f1bcf73d 100644 --- a/test/e2e/tests/custom-token-add-approve.spec.js +++ b/test/e2e/tests/custom-token-add-approve.spec.js @@ -162,7 +162,7 @@ describe('Create token, approve token and approve token without gas', function ( await driver.clickElement({ text: 'Next', tag: 'button' }); await driver.findElement({ - text: 'Review your spending cap', + text: 'Review the spending cap for your', tag: 'div', }); From d6b49ae3835d13a094cbcca90562ed86fd5256fc Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Tue, 21 Mar 2023 12:13:22 -0230 Subject: [PATCH 2/7] Refactor KeyringTypes constant (#17490) The `HardwareKeyringTypes` constant has been renamed to `KeyringTypes` and moved to a separate constants module, to reflect that it contains more than just hardware wallet keyring types. This corrects a mistake made recently during a TypeScript conversion. --- .storybook/test-data.js | 12 ++--- app/scripts/lib/seed-phrase-verifier.js | 4 +- app/scripts/lib/seed-phrase-verifier.test.js | 4 +- app/scripts/metamask-controller.js | 50 +++++++++---------- app/scripts/metamask-controller.test.js | 20 ++++---- shared/constants/hardware-wallets.ts | 8 +-- shared/constants/keyring.ts | 17 +++++++ test/jest/mock-store.js | 11 ++-- .../app/account-menu/account-menu.test.js | 6 +-- .../app/account-menu/keyring-label.js | 16 +++--- .../unconnected-account-alert.test.js | 4 +- .../app/menu-bar/account-options-menu.js | 4 +- ui/components/app/menu-bar/menu-bar.test.js | 4 +- .../app/wallet-overview/eth-overview.test.js | 6 +-- .../wallet-overview/token-overview.test.js | 6 +-- ui/ducks/metamask/metamask.js | 6 +-- ui/ducks/send/send.test.js | 4 +- .../confirm-transaction-base.test.js | 4 +- ui/pages/mobile-sync/mobile-sync.component.js | 4 +- ui/pages/send/send.test.js | 4 +- .../token-allowance/token-allowance.test.js | 6 +-- ui/selectors/selectors.js | 17 +++---- ui/selectors/selectors.test.js | 20 ++++---- 23 files changed, 120 insertions(+), 117 deletions(-) create mode 100644 shared/constants/keyring.ts diff --git a/.storybook/test-data.js b/.storybook/test-data.js index c85ab72596cd..65bb7fb4c39a 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -1,5 +1,5 @@ import { draftTransactionInitialState } from '../ui/ducks/send'; -import { HardwareKeyringTypes } from '../shared/constants/hardware-wallets'; +import { KeyringType } from '../shared/constants/keyring'; const state = { invalidCustomNetwork: { @@ -1168,14 +1168,14 @@ const state = { unapprovedTypedMessages: {}, unapprovedTypedMessagesCount: 0, keyringTypes: [ - HardwareKeyringTypes.imported, - HardwareKeyringTypes.hdKeyTree, - HardwareKeyringTypes.trezor, - HardwareKeyringTypes.ledger, + KeyringType.imported, + KeyringType.hdKeyTree, + KeyringType.trezor, + KeyringType.ledger, ], keyrings: [ { - type: HardwareKeyringTypes.hdKeyTree, + type: KeyringType.hdKeyTree, accounts: [ '0x64a845a5b02460acf8a3d84503b0d68d028b4bb4', '0xb19ac54efa18cc3a14a5b821bfec73d284bf0c5e', diff --git a/app/scripts/lib/seed-phrase-verifier.js b/app/scripts/lib/seed-phrase-verifier.js index 5fcaf4481627..28c0b856dbd5 100644 --- a/app/scripts/lib/seed-phrase-verifier.js +++ b/app/scripts/lib/seed-phrase-verifier.js @@ -1,7 +1,7 @@ import { KeyringController } from '@metamask/eth-keyring-controller'; import log from 'loglevel'; -import { HardwareKeyringTypes } from '../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../shared/constants/keyring'; const seedPhraseVerifier = { /** @@ -23,7 +23,7 @@ const seedPhraseVerifier = { const keyringController = new KeyringController({}); const keyringBuilder = keyringController.getKeyringBuilderForType( - HardwareKeyringTypes.hdKeyTree, + KeyringType.hdKeyTree, ); const keyring = keyringBuilder(); const opts = { diff --git a/app/scripts/lib/seed-phrase-verifier.test.js b/app/scripts/lib/seed-phrase-verifier.test.js index bf888f79b8e9..be549034c354 100644 --- a/app/scripts/lib/seed-phrase-verifier.test.js +++ b/app/scripts/lib/seed-phrase-verifier.test.js @@ -6,13 +6,13 @@ import { cloneDeep } from 'lodash'; import { KeyringController } from '@metamask/eth-keyring-controller'; import firstTimeState from '../first-time-state'; import mockEncryptor from '../../../test/lib/mock-encryptor'; -import { HardwareKeyringTypes } from '../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../shared/constants/keyring'; import seedPhraseVerifier from './seed-phrase-verifier'; describe('SeedPhraseVerifier', () => { describe('verifyAccounts', () => { const password = 'passw0rd1'; - const { hdKeyTree } = HardwareKeyringTypes; + const { hdKeyTree } = KeyringType; let keyringController; let primaryKeyring; diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 3e567c5d69c6..0a395106a9d2 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -74,10 +74,8 @@ import { SWAPS_CLIENT_ID, } from '../../shared/constants/swaps'; import { CHAIN_IDS, NETWORK_TYPES } from '../../shared/constants/network'; -import { - HardwareDeviceNames, - HardwareKeyringTypes, -} from '../../shared/constants/hardware-wallets'; +import { HardwareDeviceNames } from '../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../shared/constants/keyring'; import { CaveatTypes, RestrictedMethods, @@ -2372,7 +2370,7 @@ export default class MetamaskController extends EventEmitter { ); const [primaryKeyring] = keyringController.getKeyringsByType( - HardwareKeyringTypes.hdKeyTree, + KeyringType.hdKeyTree, ); if (!primaryKeyring) { throw new Error('MetamaskController - No HD Key Tree found'); @@ -2496,10 +2494,10 @@ export default class MetamaskController extends EventEmitter { // Accounts const [hdKeyring] = this.keyringController.getKeyringsByType( - HardwareKeyringTypes.hdKeyTree, + KeyringType.hdKeyTree, ); const simpleKeyPairKeyrings = this.keyringController.getKeyringsByType( - HardwareKeyringTypes.hdKeyTree, + KeyringType.hdKeyTree, ); const hdAccounts = await hdKeyring.getAccounts(); const simpleKeyPairKeyringAccounts = await Promise.all( @@ -2663,7 +2661,7 @@ export default class MetamaskController extends EventEmitter { */ getPrimaryKeyringMnemonic() { const [keyring] = this.keyringController.getKeyringsByType( - HardwareKeyringTypes.hdKeyTree, + KeyringType.hdKeyTree, ); if (!keyring.mnemonic) { throw new Error('Primary keyring mnemonic unavailable.'); @@ -2803,12 +2801,12 @@ export default class MetamaskController extends EventEmitter { async getAccountType(address) { const keyring = await this.keyringController.getKeyringForAccount(address); switch (keyring.type) { - case HardwareKeyringTypes.trezor: - case HardwareKeyringTypes.lattice: - case HardwareKeyringTypes.qr: - case HardwareKeyringTypes.ledger: + case KeyringType.trezor: + case KeyringType.lattice: + case KeyringType.qr: + case KeyringType.ledger: return 'hardware'; - case HardwareKeyringTypes.imported: + case KeyringType.imported: return 'imported'; default: return 'MetaMask'; @@ -2826,14 +2824,14 @@ export default class MetamaskController extends EventEmitter { async getDeviceModel(address) { const keyring = await this.keyringController.getKeyringForAccount(address); switch (keyring.type) { - case HardwareKeyringTypes.trezor: + case KeyringType.trezor: return keyring.getModel(); - case HardwareKeyringTypes.qr: + case KeyringType.qr: return keyring.getName(); - case HardwareKeyringTypes.ledger: + case KeyringType.ledger: // TODO: get model after ledger keyring exposes method return HardwareDeviceNames.ledger; - case HardwareKeyringTypes.lattice: + case KeyringType.lattice: // TODO: get model after lattice keyring exposes method return HardwareDeviceNames.lattice; default: @@ -2907,7 +2905,7 @@ export default class MetamaskController extends EventEmitter { */ async addNewAccount(accountCount) { const [primaryKeyring] = this.keyringController.getKeyringsByType( - HardwareKeyringTypes.hdKeyTree, + KeyringType.hdKeyTree, ); if (!primaryKeyring) { throw new Error('MetamaskController - No HD Key Tree found'); @@ -2952,7 +2950,7 @@ export default class MetamaskController extends EventEmitter { */ async verifySeedPhrase() { const [primaryKeyring] = this.keyringController.getKeyringsByType( - HardwareKeyringTypes.hdKeyTree, + KeyringType.hdKeyTree, ); if (!primaryKeyring) { throw new Error('MetamaskController - No HD Key Tree found'); @@ -3074,7 +3072,7 @@ export default class MetamaskController extends EventEmitter { async importAccountWithStrategy(strategy, args) { const privateKey = await accountImporter.importAccount(strategy, args); const keyring = await this.keyringController.addNewKeyring( - HardwareKeyringTypes.imported, + KeyringType.imported, [privateKey], ); const [firstAccount] = await keyring.getAccounts(); @@ -3229,7 +3227,7 @@ export default class MetamaskController extends EventEmitter { const keyring = await this.keyringController.getKeyringForAccount(address); switch (keyring.type) { - case HardwareKeyringTypes.ledger: { + case KeyringType.ledger: { return new Promise((_, reject) => { reject( new Error('Ledger does not support eth_getEncryptionPublicKey.'), @@ -3237,7 +3235,7 @@ export default class MetamaskController extends EventEmitter { }); } - case HardwareKeyringTypes.trezor: { + case KeyringType.trezor: { return new Promise((_, reject) => { reject( new Error('Trezor does not support eth_getEncryptionPublicKey.'), @@ -3245,7 +3243,7 @@ export default class MetamaskController extends EventEmitter { }); } - case HardwareKeyringTypes.lattice: { + case KeyringType.lattice: { return new Promise((_, reject) => { reject( new Error('Lattice does not support eth_getEncryptionPublicKey.'), @@ -3253,7 +3251,7 @@ export default class MetamaskController extends EventEmitter { }); } - case HardwareKeyringTypes.qr: { + case KeyringType.qr: { return Promise.reject( new Error('QR hardware does not support eth_getEncryptionPublicKey.'), ); @@ -4296,14 +4294,14 @@ export default class MetamaskController extends EventEmitter { */ setLocked() { const [trezorKeyring] = this.keyringController.getKeyringsByType( - HardwareKeyringTypes.trezor, + KeyringType.trezor, ); if (trezorKeyring) { trezorKeyring.dispose(); } const [ledgerKeyring] = this.keyringController.getKeyringsByType( - HardwareKeyringTypes.ledger, + KeyringType.ledger, ); ledgerKeyring?.destroy?.(); diff --git a/app/scripts/metamask-controller.test.js b/app/scripts/metamask-controller.test.js index 03e335a26c94..7506c17cb9ea 100644 --- a/app/scripts/metamask-controller.test.js +++ b/app/scripts/metamask-controller.test.js @@ -11,10 +11,8 @@ import { TransactionStatus } from '../../shared/constants/transaction'; import createTxMeta from '../../test/lib/createTxMeta'; import { NETWORK_TYPES } from '../../shared/constants/network'; import { createTestProviderTools } from '../../test/stub/provider'; -import { - HardwareDeviceNames, - HardwareKeyringTypes, -} from '../../shared/constants/hardware-wallets'; +import { HardwareDeviceNames } from '../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../shared/constants/keyring'; import { deferredPromise } from './lib/util'; const Ganache = require('../../test/e2e/ganache'); @@ -275,7 +273,7 @@ describe('MetaMaskController', function () { it('adds private key to keyrings in KeyringController', async function () { const simpleKeyrings = metamaskController.keyringController.getKeyringsByType( - HardwareKeyringTypes.imported, + KeyringType.imported, ); const pubAddressHexArr = await simpleKeyrings[0].getAccounts(); const privKeyHex = await simpleKeyrings[0].exportAccount( @@ -555,11 +553,11 @@ describe('MetaMaskController', function () { .catch(() => null); const keyrings = await metamaskController.keyringController.getKeyringsByType( - HardwareKeyringTypes.trezor, + KeyringType.trezor, ); assert.deepEqual( metamaskController.keyringController.addNewKeyring.getCall(0).args, - [HardwareKeyringTypes.trezor], + [KeyringType.trezor], ); assert.equal(keyrings.length, 1); }); @@ -571,11 +569,11 @@ describe('MetaMaskController', function () { .catch(() => null); const keyrings = await metamaskController.keyringController.getKeyringsByType( - HardwareKeyringTypes.ledger, + KeyringType.ledger, ); assert.deepEqual( metamaskController.keyringController.addNewKeyring.getCall(0).args, - [HardwareKeyringTypes.ledger], + [KeyringType.ledger], ); assert.equal(keyrings.length, 1); }); @@ -651,7 +649,7 @@ describe('MetaMaskController', function () { await metamaskController.forgetDevice(HardwareDeviceNames.trezor); const keyrings = await metamaskController.keyringController.getKeyringsByType( - HardwareKeyringTypes.trezor, + KeyringType.trezor, ); assert.deepEqual(keyrings[0].accounts, []); @@ -711,7 +709,7 @@ describe('MetaMaskController', function () { it('should set unlockedAccount in the keyring', async function () { const keyrings = await metamaskController.keyringController.getKeyringsByType( - HardwareKeyringTypes.trezor, + KeyringType.trezor, ); assert.equal(keyrings[0].unlockedAccount, accountToUnlock); }); diff --git a/shared/constants/hardware-wallets.ts b/shared/constants/hardware-wallets.ts index 71cdeb0384ff..4f549aa2fb9d 100644 --- a/shared/constants/hardware-wallets.ts +++ b/shared/constants/hardware-wallets.ts @@ -1,15 +1,11 @@ /** - * Accounts can be instantiated from simple, HD or the multiple hardware wallet - * keyring types. Both simple and HD are treated as default but we do special - * case accounts managed by a hardware wallet. + * Hardware wallets supported by MetaMask. */ -export enum HardwareKeyringTypes { +export enum HardwareKeyringType { ledger = 'Ledger Hardware', trezor = 'Trezor Hardware', lattice = 'Lattice Hardware', qr = 'QR Hardware Wallet Device', - hdKeyTree = 'HD Key Tree', - imported = 'Simple Key Pair', } export enum HardwareKeyringNames { diff --git a/shared/constants/keyring.ts b/shared/constants/keyring.ts new file mode 100644 index 000000000000..f285fa468f9c --- /dev/null +++ b/shared/constants/keyring.ts @@ -0,0 +1,17 @@ +import { HardwareKeyringType } from './hardware-wallets'; + +/** + * These are the keyrings that are managed entirely by MetaMask. + */ +export enum InternalKeyringType { + hdKeyTree = 'HD Key Tree', + imported = 'Simple Key Pair', +} + +/** + * All keyrings supported by MetaMask. + */ +export const KeyringType = { + ...HardwareKeyringType, + ...InternalKeyringType, +}; diff --git a/test/jest/mock-store.js b/test/jest/mock-store.js index b0dd8eaee13c..80c477a10db2 100644 --- a/test/jest/mock-store.js +++ b/test/jest/mock-store.js @@ -1,5 +1,5 @@ import { CHAIN_IDS } from '../../shared/constants/network'; -import { HardwareKeyringTypes } from '../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../shared/constants/keyring'; const createGetSmartTransactionFeesApiResponse = () => { return { @@ -252,13 +252,10 @@ export const createSwapsMockStore = () => { }, }, selectedAddress: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', - keyringTypes: [ - HardwareKeyringTypes.imported, - HardwareKeyringTypes.hdKeyTree, - ], + keyringTypes: [KeyringType.imported, KeyringType.hdKeyTree], keyrings: [ { - type: HardwareKeyringTypes.hdKeyTree, + type: KeyringType.hdKeyTree, accounts: [ '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', 'c5b8dbac4c1d3f152cdeb400e2313f309c410acb', @@ -266,7 +263,7 @@ export const createSwapsMockStore = () => { ], }, { - type: HardwareKeyringTypes.imported, + type: KeyringType.imported, accounts: ['0xd85a4b6a394794842887b8284293d69163007bbb'], }, ], diff --git a/ui/components/app/account-menu/account-menu.test.js b/ui/components/app/account-menu/account-menu.test.js index 494171fa0b40..f7ded9a92c76 100644 --- a/ui/components/app/account-menu/account-menu.test.js +++ b/ui/components/app/account-menu/account-menu.test.js @@ -3,7 +3,7 @@ import sinon from 'sinon'; import configureMockStore from 'redux-mock-store'; import { fireEvent, screen } from '@testing-library/react'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; -import { HardwareKeyringTypes } from '../../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../../shared/constants/keyring'; import AccountMenu from '.'; describe('Account Menu', () => { @@ -37,11 +37,11 @@ describe('Account Menu', () => { ], keyrings: [ { - type: HardwareKeyringTypes.hdKeyTree, + type: KeyringType.hdKeyTree, accounts: ['0xAdress'], }, { - type: HardwareKeyringTypes.imported, + type: KeyringType.imported, accounts: ['0x1'], }, ], diff --git a/ui/components/app/account-menu/keyring-label.js b/ui/components/app/account-menu/keyring-label.js index 985c54ae583a..c4cf8b85c8c5 100644 --- a/ui/components/app/account-menu/keyring-label.js +++ b/ui/components/app/account-menu/keyring-label.js @@ -2,10 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { useI18nContext } from '../../../hooks/useI18nContext'; -import { - HardwareKeyringNames, - HardwareKeyringTypes, -} from '../../../../shared/constants/hardware-wallets'; +import { HardwareKeyringNames } from '../../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../../shared/constants/keyring'; export default function KeyRingLabel({ keyring }) { const t = useI18nContext(); @@ -19,19 +17,19 @@ export default function KeyRingLabel({ keyring }) { const { type } = keyring; switch (type) { - case HardwareKeyringTypes.qr: + case KeyringType.qr: label = HardwareKeyringNames.qr; break; - case HardwareKeyringTypes.imported: + case KeyringType.imported: label = t('imported'); break; - case HardwareKeyringTypes.trezor: + case KeyringType.trezor: label = HardwareKeyringNames.trezor; break; - case HardwareKeyringTypes.ledger: + case KeyringType.ledger: label = HardwareKeyringNames.ledger; break; - case HardwareKeyringTypes.lattice: + case KeyringType.lattice: label = HardwareKeyringNames.lattice; break; default: diff --git a/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.test.js b/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.test.js index 42fe9d67e752..c710da525f63 100644 --- a/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.test.js +++ b/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.test.js @@ -11,7 +11,7 @@ import { renderWithProvider } from '../../../../../test/lib/render-helpers'; import * as actions from '../../../../store/actions'; import { CHAIN_IDS } from '../../../../../shared/constants/network'; -import { HardwareKeyringTypes } from '../../../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../../../shared/constants/keyring'; import UnconnectedAccountAlert from '.'; @@ -49,7 +49,7 @@ describe('Unconnected Account Alert', () => { const keyrings = [ { - type: HardwareKeyringTypes.hdKeyTree, + type: KeyringType.hdKeyTree, accounts: [ '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', '0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b', diff --git a/ui/components/app/menu-bar/account-options-menu.js b/ui/components/app/menu-bar/account-options-menu.js index 554304795dd0..deeb4e0a3473 100644 --- a/ui/components/app/menu-bar/account-options-menu.js +++ b/ui/components/app/menu-bar/account-options-menu.js @@ -21,7 +21,7 @@ import { import { useI18nContext } from '../../../hooks/useI18nContext'; import { getEnvironmentType } from '../../../../app/scripts/lib/util'; import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../shared/constants/app'; -import { HardwareKeyringTypes } from '../../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../../shared/constants/keyring'; import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics'; import { MetaMetricsContext } from '../../../contexts/metametrics'; import { ICON_NAMES } from '../../component-library'; @@ -42,7 +42,7 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) { const trackEvent = useContext(MetaMetricsContext); const blockExplorerLinkText = useSelector(getBlockExplorerLinkText); - const isRemovable = keyring.type !== HardwareKeyringTypes.hdKeyTree; + const isRemovable = keyring.type !== KeyringType.hdKeyTree; const routeToAddBlockExplorerUrl = () => { history.push(`${NETWORKS_ROUTE}#blockExplorerUrl`); diff --git a/ui/components/app/menu-bar/menu-bar.test.js b/ui/components/app/menu-bar/menu-bar.test.js index c834c6076ffb..2a148a54a570 100644 --- a/ui/components/app/menu-bar/menu-bar.test.js +++ b/ui/components/app/menu-bar/menu-bar.test.js @@ -3,7 +3,7 @@ import configureStore from 'redux-mock-store'; import { fireEvent, screen, waitFor } from '@testing-library/react'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; import { CHAIN_IDS } from '../../../../shared/constants/network'; -import { HardwareKeyringTypes } from '../../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../../shared/constants/keyring'; import MenuBar from './menu-bar'; const initState = { @@ -21,7 +21,7 @@ const initState = { }, keyrings: [ { - type: HardwareKeyringTypes.hdKeyTree, + type: KeyringType.hdKeyTree, accounts: ['0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'], }, ], diff --git a/ui/components/app/wallet-overview/eth-overview.test.js b/ui/components/app/wallet-overview/eth-overview.test.js index 0d309076284a..c7337719940c 100644 --- a/ui/components/app/wallet-overview/eth-overview.test.js +++ b/ui/components/app/wallet-overview/eth-overview.test.js @@ -4,7 +4,7 @@ import thunk from 'redux-thunk'; import { fireEvent, waitFor } from '@testing-library/react'; import { CHAIN_IDS } from '../../../../shared/constants/network'; import { renderWithProvider } from '../../../../test/jest/rendering'; -import { HardwareKeyringTypes } from '../../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../../shared/constants/keyring'; import EthOverview from './eth-overview'; // Mock BUYABLE_CHAINS_MAP @@ -56,11 +56,11 @@ describe('EthOverview', () => { selectedAddress: '0x1', keyrings: [ { - type: HardwareKeyringTypes.imported, + type: KeyringType.imported, accounts: ['0x1', '0x2'], }, { - type: HardwareKeyringTypes.ledger, + type: KeyringType.ledger, accounts: [], }, ], diff --git a/ui/components/app/wallet-overview/token-overview.test.js b/ui/components/app/wallet-overview/token-overview.test.js index c46e31f3b731..9b2769181f5c 100644 --- a/ui/components/app/wallet-overview/token-overview.test.js +++ b/ui/components/app/wallet-overview/token-overview.test.js @@ -4,7 +4,7 @@ import thunk from 'redux-thunk'; import { fireEvent, waitFor } from '@testing-library/react'; import { CHAIN_IDS } from '../../../../shared/constants/network'; import { renderWithProvider } from '../../../../test/jest/rendering'; -import { HardwareKeyringTypes } from '../../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../../shared/constants/keyring'; import TokenOverview from './token-overview'; // Mock BUYABLE_CHAINS_MAP @@ -42,11 +42,11 @@ describe('TokenOverview', () => { selectedAddress: '0x1', keyrings: [ { - type: HardwareKeyringTypes.hdKeyTree, + type: KeyringType.hdKeyTree, accounts: ['0x1', '0x2'], }, { - type: HardwareKeyringTypes.ledger, + type: KeyringType.ledger, accounts: [], }, ], diff --git a/ui/ducks/metamask/metamask.js b/ui/ducks/metamask/metamask.js index 2fa9a3ca42fe..cd3adaca8db0 100644 --- a/ui/ducks/metamask/metamask.js +++ b/ui/ducks/metamask/metamask.js @@ -14,7 +14,7 @@ import { import { updateTransactionGasFees } from '../../store/actions'; import { setCustomGasLimit, setCustomGasPrice } from '../gas/gas.duck'; -import { HardwareKeyringTypes } from '../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../shared/constants/keyring'; import { isEqualCaseInsensitive } from '../../../shared/modules/string-utils'; import { stripHexPrefix } from '../../../shared/modules/hexstring-utils'; import { @@ -407,7 +407,7 @@ export function getLedgerTransportType(state) { export function isAddressLedger(state, address) { const keyring = findKeyringForAddress(state, address); - return keyring?.type === HardwareKeyringTypes.ledger; + return keyring?.type === KeyringType.ledger; } /** @@ -419,6 +419,6 @@ export function isAddressLedger(state, address) { */ export function doesUserHaveALedgerAccount(state) { return state.metamask.keyrings.some((kr) => { - return kr.type === HardwareKeyringTypes.ledger; + return kr.type === KeyringType.ledger; }); } diff --git a/ui/ducks/send/send.test.js b/ui/ducks/send/send.test.js index 549bf4225051..7a3a789a74b7 100644 --- a/ui/ducks/send/send.test.js +++ b/ui/ducks/send/send.test.js @@ -13,7 +13,7 @@ import { } from '../../pages/send/send.constants'; import { CHAIN_IDS } from '../../../shared/constants/network'; import { GasEstimateTypes, GAS_LIMITS } from '../../../shared/constants/gas'; -import { HardwareKeyringTypes } from '../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../shared/constants/keyring'; import { AssetType, TokenStandard, @@ -1278,7 +1278,7 @@ describe('Send Slice', () => { identities: { '0xAddress': { address: '0xAddress' } }, keyrings: [ { - type: HardwareKeyringTypes.hdKeyTree, + type: KeyringType.hdKeyTree, accounts: ['0xAddress'], }, ], diff --git a/ui/pages/confirm-transaction-base/confirm-transaction-base.test.js b/ui/pages/confirm-transaction-base/confirm-transaction-base.test.js index 5029bd814ad1..326af8c73dbc 100644 --- a/ui/pages/confirm-transaction-base/confirm-transaction-base.test.js +++ b/ui/pages/confirm-transaction-base/confirm-transaction-base.test.js @@ -6,7 +6,7 @@ import { renderWithProvider } from '../../../test/lib/render-helpers'; import { setBackgroundConnection } from '../../../test/jest'; import { INITIAL_SEND_STATE_FOR_EXISTING_DRAFT } from '../../../test/jest/mocks'; import { GasEstimateTypes } from '../../../shared/constants/gas'; -import { HardwareKeyringTypes } from '../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../shared/constants/keyring'; import { CHAIN_IDS } from '../../../shared/constants/network'; import { domainInitialState } from '../../ducks/domains'; @@ -54,7 +54,7 @@ const baseStore = { selectedAddress: '0x0', keyrings: [ { - type: HardwareKeyringTypes.hdKeyTree, + type: KeyringType.hdKeyTree, accounts: ['0x0'], }, ], diff --git a/ui/pages/mobile-sync/mobile-sync.component.js b/ui/pages/mobile-sync/mobile-sync.component.js index b46a5a7b9289..3c1996e73899 100644 --- a/ui/pages/mobile-sync/mobile-sync.component.js +++ b/ui/pages/mobile-sync/mobile-sync.component.js @@ -8,7 +8,7 @@ import qrCode from 'qrcode-generator'; import Button from '../../components/ui/button'; import LoadingScreen from '../../components/ui/loading-screen'; import { MINUTE, SECOND } from '../../../shared/constants/time'; -import { HardwareKeyringTypes } from '../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../shared/constants/keyring'; const PASSWORD_PROMPT_SCREEN = 'PASSWORD_PROMPT_SCREEN'; const REVEAL_SEED_SCREEN = 'REVEAL_SEED_SCREEN'; @@ -82,7 +82,7 @@ export default class MobileSyncPage extends Component { async exportAccounts() { const addresses = []; this.props.keyrings.forEach((keyring) => { - if (keyring.type === HardwareKeyringTypes.imported) { + if (keyring.type === KeyringType.imported) { addresses.push(keyring.accounts[0]); } }); diff --git a/ui/pages/send/send.test.js b/ui/pages/send/send.test.js index 70a6031aa37e..ffe97670f160 100644 --- a/ui/pages/send/send.test.js +++ b/ui/pages/send/send.test.js @@ -10,7 +10,7 @@ import { setBackgroundConnection, } from '../../../test/jest'; import { GasEstimateTypes } from '../../../shared/constants/gas'; -import { HardwareKeyringTypes } from '../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../shared/constants/keyring'; import { INITIAL_SEND_STATE_FOR_EXISTING_DRAFT } from '../../../test/jest/mocks'; import Send from './send'; @@ -81,7 +81,7 @@ const baseStore = { selectedAddress: '0x0', keyrings: [ { - type: HardwareKeyringTypes.hdKeyTree, + type: KeyringType.hdKeyTree, accounts: ['0x0'], }, ], diff --git a/ui/pages/token-allowance/token-allowance.test.js b/ui/pages/token-allowance/token-allowance.test.js index 1601d76a7598..a438caabbebd 100644 --- a/ui/pages/token-allowance/token-allowance.test.js +++ b/ui/pages/token-allowance/token-allowance.test.js @@ -2,7 +2,7 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; import { fireEvent } from '@testing-library/react'; import { renderWithProvider } from '../../../test/lib/render-helpers'; -import { HardwareKeyringTypes } from '../../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../../shared/constants/keyring'; import TokenAllowance from './token-allowance'; const testTokenAddress = '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F'; @@ -65,10 +65,10 @@ const state = { }, ], unapprovedTxs: {}, - keyringTypes: [HardwareKeyringTypes.ledger], + keyringTypes: [KeyringType.ledger], keyrings: [ { - type: HardwareKeyringTypes.ledger, + type: KeyringType.ledger, accounts: ['0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'], }, ], diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 467a3d3579c1..4fc7ba94870d 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -26,11 +26,11 @@ import { NETWORK_TYPES, } from '../../shared/constants/network'; import { - HardwareKeyringTypes, WebHIDConnectedStatuses, LedgerTransportTypes, HardwareTransportStates, } from '../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../shared/constants/keyring'; import { MESSAGE_TYPE } from '../../shared/constants/app'; import { TRUNCATED_NAME_CHAR_LIMIT } from '../../shared/constants/labels'; @@ -127,7 +127,7 @@ export function hasUnsignedQRHardwareTransaction(state) { } const { from } = txParams; const { keyrings } = state.metamask; - const qrKeyring = keyrings.find((kr) => kr.type === HardwareKeyringTypes.qr); + const qrKeyring = keyrings.find((kr) => kr.type === KeyringType.qr); if (!qrKeyring) { return false; } @@ -145,7 +145,7 @@ export function hasUnsignedQRHardwareMessage(state) { } const { from } = msgParams; const { keyrings } = state.metamask; - const qrKeyring = keyrings.find((kr) => kr.type === HardwareKeyringTypes.qr); + const qrKeyring = keyrings.find((kr) => kr.type === KeyringType.qr); if (!qrKeyring) { return false; } @@ -232,11 +232,11 @@ export function getAccountType(state) { const type = currentKeyring && currentKeyring.type; switch (type) { - case HardwareKeyringTypes.trezor: - case HardwareKeyringTypes.ledger: - case HardwareKeyringTypes.lattice: + case KeyringType.trezor: + case KeyringType.ledger: + case KeyringType.lattice: return 'hardware'; - case HardwareKeyringTypes.imported: + case KeyringType.imported: return 'imported'; default: return 'default'; @@ -934,8 +934,7 @@ export const getUnreadNotificationsCount = createSelector( */ function getAllowedAnnouncementIds(state) { const currentKeyring = getCurrentKeyring(state); - const currentKeyringIsLedger = - currentKeyring?.type === HardwareKeyringTypes.ledger; + const currentKeyringIsLedger = currentKeyring?.type === KeyringType.ledger; const supportsWebHid = window.navigator.hid !== undefined; const currentlyUsingLedgerLive = getLedgerTransportType(state) === LedgerTransportTypes.live; diff --git a/ui/selectors/selectors.test.js b/ui/selectors/selectors.test.js index ffa5311ad846..f3593f93739a 100644 --- a/ui/selectors/selectors.test.js +++ b/ui/selectors/selectors.test.js @@ -1,5 +1,5 @@ import mockState from '../../test/data/mock-state.json'; -import { HardwareKeyringTypes } from '../../shared/constants/hardware-wallets'; +import { KeyringType } from '../../shared/constants/keyring'; import * as selectors from './selectors'; describe('Selectors', () => { @@ -105,38 +105,38 @@ describe('Selectors', () => { describe('#isHardwareWallet', () => { it('returns false if it is not a HW wallet', () => { - mockState.metamask.keyrings[0].type = HardwareKeyringTypes.imported; + mockState.metamask.keyrings[0].type = KeyringType.imported; expect(selectors.isHardwareWallet(mockState)).toBe(false); }); it('returns true if it is a Ledger HW wallet', () => { - mockState.metamask.keyrings[0].type = HardwareKeyringTypes.ledger; + mockState.metamask.keyrings[0].type = KeyringType.ledger; expect(selectors.isHardwareWallet(mockState)).toBe(true); }); it('returns true if it is a Trezor HW wallet', () => { - mockState.metamask.keyrings[0].type = HardwareKeyringTypes.trezor; + mockState.metamask.keyrings[0].type = KeyringType.trezor; expect(selectors.isHardwareWallet(mockState)).toBe(true); }); }); describe('#getHardwareWalletType', () => { it('returns undefined if it is not a HW wallet', () => { - mockState.metamask.keyrings[0].type = HardwareKeyringTypes.imported; + mockState.metamask.keyrings[0].type = KeyringType.imported; expect(selectors.getHardwareWalletType(mockState)).toBeUndefined(); }); it('returns "Ledger Hardware" if it is a Ledger HW wallet', () => { - mockState.metamask.keyrings[0].type = HardwareKeyringTypes.ledger; + mockState.metamask.keyrings[0].type = KeyringType.ledger; expect(selectors.getHardwareWalletType(mockState)).toBe( - HardwareKeyringTypes.ledger, + KeyringType.ledger, ); }); it('returns "Trezor Hardware" if it is a Trezor HW wallet', () => { - mockState.metamask.keyrings[0].type = HardwareKeyringTypes.trezor; + mockState.metamask.keyrings[0].type = KeyringType.trezor; expect(selectors.getHardwareWalletType(mockState)).toBe( - HardwareKeyringTypes.trezor, + KeyringType.trezor, ); }); }); @@ -174,7 +174,7 @@ describe('Selectors', () => { ...mockState.metamask, keyrings: [ { - type: HardwareKeyringTypes.ledger, + type: KeyringType.ledger, accounts: ['0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'], }, ], From 0847917df43c2401faa091b89964ff2eb1a51165 Mon Sep 17 00:00:00 2001 From: David Drazic Date: Tue, 21 Mar 2023 16:52:13 +0100 Subject: [PATCH 3/7] [FLASK] Update UI related to MetaMask Snaps Platform trademark (#18172) * Update UI related to MetaMask Snaps Platform trademark * Remove redundant UI text according to new designs * Fix lint errors * Fix e2e test expectation * Fix lint in test * Fix e2e test expectation * Fix some UI parts * Update CSS for noSnaps message * Add next design iteration * Add minor fix * Update locale message * Fix learn more text size * Refactor usage of design system components --------- Co-authored-by: Erik Marks --- app/_locales/de/messages.json | 6 -- app/_locales/el/messages.json | 6 -- app/_locales/en/messages.json | 14 ++-- app/_locales/es/messages.json | 6 -- app/_locales/fr/messages.json | 6 -- app/_locales/hi/messages.json | 6 -- app/_locales/id/messages.json | 6 -- app/_locales/ja/messages.json | 6 -- app/_locales/ko/messages.json | 6 -- app/_locales/pt/messages.json | 6 -- app/_locales/ru/messages.json | 6 -- app/_locales/tl/messages.json | 6 -- app/_locales/tr/messages.json | 6 -- app/_locales/vi/messages.json | 6 -- app/_locales/zh_CN/messages.json | 6 -- test/e2e/snaps/test-snap-management.spec.js | 7 +- .../settings/flask/snaps-list-tab/index.scss | 8 ++ .../flask/snaps-list-tab/snap-list-tab.js | 80 ++++++++++++++----- 18 files changed, 78 insertions(+), 115 deletions(-) diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index 3923e2b5e5c9..5840f9916674 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Auf Etherscan anzeigen" }, - "expandExperience": { - "message": "Erweitern Sie Ihre Web3-Erfahrung" - }, "expandView": { "message": "Ansicht erweitern" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "Fehlerhafte Daten" }, - "manageSnaps": { - "message": "Verwalten Sie Ihre installierten Snaps" - }, "max": { "message": "Max." }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index 19f736c5fdc0..6abefcb9f578 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Προβολή στην Etherscan" }, - "expandExperience": { - "message": "Επεκτείνετε την εμπειρία σας στο web3 με τα Snap του MetaMask" - }, "expandView": { "message": "Ανάπτυξη Προβολής" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "Παραμορφωμένα δεδομένα" }, - "manageSnaps": { - "message": "Διαχειριστείτε τα εγκατεστημένα Snap σας" - }, "max": { "message": "Μέγ." }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 9d3aaeb94db0..cf38aa3a2fc9 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -1344,18 +1344,21 @@ "etherscanViewOn": { "message": "View on Etherscan" }, - "expandExperience": { - "message": "Expand your web3 experience with MetaMask Snaps" - }, "expandView": { "message": "Expand view" }, "experimental": { "message": "Experimental" }, + "exploreMetaMaskSnaps": { + "message": "Explore MetaMask Snaps" + }, "exportPrivateKey": { "message": "Export private key" }, + "extendWalletWithSnaps": { + "message": "Extend the wallet experience." + }, "externalExtension": { "message": "External extension" }, @@ -1997,9 +2000,6 @@ "malformedData": { "message": "Malformed data" }, - "manageSnaps": { - "message": "Manage your installed snaps" - }, "max": { "message": "Max" }, @@ -2285,7 +2285,7 @@ "message": "No NFTs yet" }, "noSnaps": { - "message": "No Snaps installed" + "message": "You don't have any snaps installed." }, "noThanksVariant2": { "message": "No, thanks." diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index 94b2d78dac63..441bc9198d69 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Ver en Etherscan" }, - "expandExperience": { - "message": "Amplíe su experiencia web3 con complementos de MetaMask" - }, "expandView": { "message": "Expandir vista" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "Datos con formato incorrecto" }, - "manageSnaps": { - "message": "Administre sus complementos instalados" - }, "max": { "message": "Máx." }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 34849859e4bc..18ac12f3cad3 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Afficher sur Etherscan" }, - "expandExperience": { - "message": "Développez votre expérience web3 avec les Snaps MetaMask" - }, "expandView": { "message": "Agrandir la vue" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "Données malformées" }, - "manageSnaps": { - "message": "Gérez vos Snaps installés" - }, "max": { "message": "Max." }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index b57d88ae82e2..ff8eaa61ed4b 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Etherscan पर देखें" }, - "expandExperience": { - "message": "MetaMask स्नैप्स के साथ अपने web3 अनुभव का विस्तार करें" - }, "expandView": { "message": "दृश्य का विस्तार करें" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "विकृत डेटा" }, - "manageSnaps": { - "message": "अपने इंस्टाल किए गए स्नैप्स मैनेज करें" - }, "max": { "message": "अधिकतम" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index a5c4bd5e2c26..51ce82d388c8 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Lihat di Etherscan" }, - "expandExperience": { - "message": "Perluas pengalaman web3 Anda dengan MetaMask Snaps" - }, "expandView": { "message": "Perluas tampilan" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "Format data salah" }, - "manageSnaps": { - "message": "Kelola Snap yang Anda instal" - }, "max": { "message": "Maks" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 04461f0f604b..945fbf1a720e 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Etherscanで表示" }, - "expandExperience": { - "message": "MetaMask Snaps で web3 エクスペリエンスを拡張" - }, "expandView": { "message": "ビューを展開" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "不正な形式のデータ" }, - "manageSnaps": { - "message": "インストールされたスナップの管理" - }, "max": { "message": "最大" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index b321862ab0cf..61c23b3acbf0 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Etherscan에서 보기" }, - "expandExperience": { - "message": "MetaMask 스냅으로 web3 경험을 확대하세요" - }, "expandView": { "message": "보기 확장" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "잘못된 데이터" }, - "manageSnaps": { - "message": "설치된 스냅을 관리하세요" - }, "max": { "message": "최대" }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index 86f69b1c0ba8..f58d4221a9e0 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Ver no Etherscan" }, - "expandExperience": { - "message": "Expanda sua experiência web3 com os snaps da MetaMask" - }, "expandView": { "message": "Expandir exibição" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "Dados inválidos" }, - "manageSnaps": { - "message": "Gerencie seus snaps instalados" - }, "max": { "message": "Máximo" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index dd8db16a5db0..06f9a8f405d7 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Посмотреть на Etherscan" }, - "expandExperience": { - "message": "Расширьте свои возможности web3 с помощью MetaMask Snaps" - }, "expandView": { "message": "Развернуть представление" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "Искаженные данные" }, - "manageSnaps": { - "message": "Управляйте установленными снапами" - }, "max": { "message": "Макс." }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index d7e0c937ddd4..345c258cb824 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Tingnan sa Etherscan" }, - "expandExperience": { - "message": "Palawakin ang iyong karanasan sa web3 gamit ang MetaMask Snaps" - }, "expandView": { "message": "I-expand ang view" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "Pangit na datos" }, - "manageSnaps": { - "message": "Pamahalaan ang iyong mga naka-install na snap" - }, "max": { "message": "Max" }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 5887a63d5615..19cbbec967a1 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Etherscan'de görüntüle" }, - "expandExperience": { - "message": "MetaMask Snap'leri ile web3 deneyimini genişlet" - }, "expandView": { "message": "Görünümü genişlet" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "Hatalı biçimlendirilmiş veri" }, - "manageSnaps": { - "message": "Yüklü snap'lerini yönet" - }, "max": { "message": "Maksimum" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 9a19d71b3da3..2f2035b36f33 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "Xem trên Etherscan" }, - "expandExperience": { - "message": "Mở rộng trải nghiệm web3 của bạn với MetaMask Snap" - }, "expandView": { "message": "Mở rộng cửa sổ xem" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "Dữ liệu không đúng định dạng" }, - "manageSnaps": { - "message": "Quản lý các Snap đã cài đặt" - }, "max": { "message": "Tối đa" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index 49b04ecd2435..3fed40c8c6c2 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -1320,9 +1320,6 @@ "etherscanViewOn": { "message": "在 Etherscan 上查看" }, - "expandExperience": { - "message": "扩展MetaMask Snap的web3体验" - }, "expandView": { "message": "展开视图" }, @@ -1955,9 +1952,6 @@ "malformedData": { "message": "格式错误的数据" }, - "manageSnaps": { - "message": "管理已安装的Snap" - }, "max": { "message": "最大" }, diff --git a/test/e2e/snaps/test-snap-management.spec.js b/test/e2e/snaps/test-snap-management.spec.js index b8eab6b0b390..cb44e7d57e4a 100644 --- a/test/e2e/snaps/test-snap-management.spec.js +++ b/test/e2e/snaps/test-snap-management.spec.js @@ -145,9 +145,12 @@ describe('Test Snap Management', function () { // check the results of the removal await driver.delay(2000); const removeResult = await driver.findElement( - '.snap-list-tab__container--no-snaps', + '.snap-list-tab__container--no-snaps_inner', + ); + assert.equal( + await removeResult.getText(), + "You don't have any snaps installed.", ); - assert.equal(await removeResult.getText(), 'No Snaps installed'); }, ); }); diff --git a/ui/pages/settings/flask/snaps-list-tab/index.scss b/ui/pages/settings/flask/snaps-list-tab/index.scss index 927849aecf28..abf10efd2300 100644 --- a/ui/pages/settings/flask/snaps-list-tab/index.scss +++ b/ui/pages/settings/flask/snaps-list-tab/index.scss @@ -18,4 +18,12 @@ margin: 8px 0; max-width: 344px; } + + .snap-list-tab__container--no-snaps_inner { + max-width: 164px; + } + + .snap-list-tab__no-snaps_icon { + font-size: 48px; + } } diff --git a/ui/pages/settings/flask/snaps-list-tab/snap-list-tab.js b/ui/pages/settings/flask/snaps-list-tab/snap-list-tab.js index ae3aa291847b..c920985e47ed 100644 --- a/ui/pages/settings/flask/snaps-list-tab/snap-list-tab.js +++ b/ui/pages/settings/flask/snaps-list-tab/snap-list-tab.js @@ -3,19 +3,28 @@ import { useDispatch, useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; import SnapSettingsCard from '../../../../components/app/flask/snap-settings-card'; import { useI18nContext } from '../../../../hooks/useI18nContext'; -import Typography from '../../../../components/ui/typography/typography'; import { - TypographyVariant, - FLEX_DIRECTION, JustifyContent, AlignItems, - TextColor, + Color, + TEXT_ALIGN, + FLEX_DIRECTION, + Size, } from '../../../../helpers/constants/design-system'; import Box from '../../../../components/ui/box'; import { SNAPS_VIEW_ROUTE } from '../../../../helpers/constants/routes'; import { disableSnap, enableSnap } from '../../../../store/actions'; import { getSnaps } from '../../../../selectors'; import { handleSettingsRefs } from '../../../../helpers/utils/settings-search'; +import { + BannerTip, + BannerTipLogoType, + ButtonLink, + Icon, + ICON_NAMES, + ICON_SIZES, + Text, +} from '../../../../components/component-library'; const SnapListTab = () => { const t = useI18nContext(); @@ -42,18 +51,6 @@ const SnapListTab = () => {
{Object.entries(snaps).length ? (
- - - {t('expandExperience')} - - - {t('manageSnaps')} - -
{Object.entries(snaps).map(([key, snap]) => { return ( @@ -82,15 +79,54 @@ const SnapListTab = () => { className="snap-list-tab__container--no-snaps" width="full" height="full" - justifyContent={JustifyContent.center} alignItems={AlignItems.center} + flexDirection={FLEX_DIRECTION.COLUMN} > - - {t('noSnaps')} - + + + {t('noSnaps')} + + + + + + {`${t('learnMoreUpperCase')}`} + + + )}
From a04fa20f96a09461abfcb9a3b8b4db1f20cca2b8 Mon Sep 17 00:00:00 2001 From: Victorien Gauch <85494462+VGau@users.noreply.github.com> Date: Tue, 21 Mar 2023 17:28:38 +0100 Subject: [PATCH 4/7] feat: add the ConsenSys zkEVM (Linea) as a default network (#17875) * feat: add the consensys zkEVM as a default network * fix: change infuraNetworkStatus in navigate-txs file * fix: remove account tracker for zkEVM + remove zkEVM from infura list * fix: change consensys zkevm name to linea + change rpc url for linea network * fix: rebase conflicts * feat: add new colors for linea goerli network * feat: add new function inside network dropdown to render non infura networks * feat: add feature toggle for linea network * fix: add new unit test --------- Co-authored-by: Dan J Miller --- app/_locales/am/messages.json | 6 ++ app/_locales/ar/messages.json | 6 ++ app/_locales/bg/messages.json | 6 ++ app/_locales/ca/messages.json | 6 ++ app/_locales/da/messages.json | 6 ++ app/_locales/de/messages.json | 6 ++ app/_locales/el/messages.json | 6 ++ app/_locales/en/messages.json | 6 ++ app/_locales/es/messages.json | 6 ++ app/_locales/es_419/messages.json | 6 ++ app/_locales/et/messages.json | 6 ++ app/_locales/fa/messages.json | 6 ++ app/_locales/fi/messages.json | 6 ++ app/_locales/fil/messages.json | 3 + app/_locales/fr/messages.json | 6 ++ app/_locales/he/messages.json | 6 ++ app/_locales/hi/messages.json | 6 ++ app/_locales/hr/messages.json | 6 ++ app/_locales/hu/messages.json | 6 ++ app/_locales/id/messages.json | 6 ++ app/_locales/it/messages.json | 6 ++ app/_locales/ja/messages.json | 6 ++ app/_locales/kn/messages.json | 6 ++ app/_locales/ko/messages.json | 6 ++ app/_locales/lt/messages.json | 6 ++ app/_locales/lv/messages.json | 6 ++ app/_locales/ms/messages.json | 6 ++ app/_locales/no/messages.json | 3 + app/_locales/ph/messages.json | 6 ++ app/_locales/pl/messages.json | 6 ++ app/_locales/pt/messages.json | 6 ++ app/_locales/pt_BR/messages.json | 6 ++ app/_locales/ro/messages.json | 6 ++ app/_locales/ru/messages.json | 6 ++ app/_locales/sk/messages.json | 6 ++ app/_locales/sl/messages.json | 6 ++ app/_locales/sr/messages.json | 6 ++ app/_locales/sv/messages.json | 6 ++ app/_locales/sw/messages.json | 6 ++ app/_locales/tl/messages.json | 6 ++ app/_locales/tr/messages.json | 6 ++ app/_locales/uk/messages.json | 6 ++ app/_locales/vi/messages.json | 6 ++ app/_locales/zh_CN/messages.json | 6 ++ app/_locales/zh_TW/messages.json | 6 ++ .../handlers/switch-ethereum-chain.js | 3 +- development/states/navigate-txs.json | 3 +- shared/constants/network.ts | 32 ++++++ .../app/dropdowns/network-dropdown.js | 98 ++++++++++++++++++- .../app/dropdowns/network-dropdown.test.js | 19 +++- .../loading-network-screen.component.js | 2 + .../signature-request-original.component.js | 2 + .../signature-request.component.js | 2 + ui/components/ui/typography/typography.js | 2 + ui/css/design-system/colors.scss | 2 + ui/css/itcss/components/network.scss | 4 + ui/css/utilities/colors.scss | 2 + ui/helpers/constants/design-system.ts | 8 ++ ui/helpers/constants/settings.js | 7 ++ ui/helpers/utils/settings-search.test.js | 2 +- ui/helpers/utils/util.js | 1 + ui/helpers/utils/util.test.js | 11 +++ ui/pages/routes/routes.component.js | 2 + .../networks-tab/networks-tab.constants.js | 10 ++ .../settings/networks-tab/networks-tab.js | 17 +++- 65 files changed, 480 insertions(+), 13 deletions(-) diff --git a/app/_locales/am/messages.json b/app/_locales/am/messages.json index d6b92d26f7ac..1d11f9a3572f 100644 --- a/app/_locales/am/messages.json +++ b/app/_locales/am/messages.json @@ -157,6 +157,9 @@ "connectingToGoerli": { "message": "ከ Goerli የሙከራ አውታረ መረብ ጋር መገናኘት" }, + "connectingToLineaTestnet": { + "message": "ከ Linea Goerli የሙከራ አውታረ መረብ ጋር መገናኘት" + }, "connectingToMainnet": { "message": "ከዋናው የ Ethereum አውታረ መረብ ጋር መገናኘት" }, @@ -400,6 +403,9 @@ "likeToImportTokens": { "message": "እነዚህን ተለዋጭ ስሞች ለማከል ይፈልጋሉ?" }, + "lineatestnet": { + "message": "የ Linea Goerli የሙከራ አውታረ መረብ" + }, "links": { "message": "ማስፈንጠሪያዎች" }, diff --git a/app/_locales/ar/messages.json b/app/_locales/ar/messages.json index 4fcdad96044a..aac31f24665e 100644 --- a/app/_locales/ar/messages.json +++ b/app/_locales/ar/messages.json @@ -167,6 +167,9 @@ "connectingToGoerli": { "message": "الاتصال بشبكة اختبار Goerli" }, + "connectingToLineaTestnet": { + "message": "الاتصال بشبكة اختبار Linea Goerli" + }, "connectingToMainnet": { "message": "جارِ الاتصال بشبكة إيثيريوم الرئيسية" }, @@ -412,6 +415,9 @@ "likeToImportTokens": { "message": "هل ترغب في إضافة هذه الرموز؟" }, + "lineatestnet": { + "message": "شبكة اختبار Linea Goerli" + }, "links": { "message": "الروابط" }, diff --git a/app/_locales/bg/messages.json b/app/_locales/bg/messages.json index dcd59943183e..eea674ea692a 100644 --- a/app/_locales/bg/messages.json +++ b/app/_locales/bg/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Свързване с тестова мрежа на Goerli" }, + "connectingToLineaTestnet": { + "message": "Свързване с тестова мрежа на Linea Goerli" + }, "connectingToMainnet": { "message": "Свързване с главната мрежа Ethereum" }, @@ -408,6 +411,9 @@ "likeToImportTokens": { "message": "Искате ли да добавите тези жетони?" }, + "lineatestnet": { + "message": "Тестова мрежа на Linea Goerli" + }, "links": { "message": "Връзки" }, diff --git a/app/_locales/ca/messages.json b/app/_locales/ca/messages.json index 14c6c1a62456..c382f3619b1e 100644 --- a/app/_locales/ca/messages.json +++ b/app/_locales/ca/messages.json @@ -160,6 +160,9 @@ "connectingToGoerli": { "message": "Connectant a Xarxa de Prova Goerli" }, + "connectingToLineaTestnet": { + "message": "Connectant a Xarxa de Prova Linea Goerli" + }, "connectingToMainnet": { "message": "Connectant a Xarxa Principal Ethereum" }, @@ -399,6 +402,9 @@ "likeToImportTokens": { "message": "T'agradaria afegir aquestes fitxes?" }, + "lineatestnet": { + "message": "Xarxa de test Linea Goerli" + }, "links": { "message": "Enllaços" }, diff --git a/app/_locales/da/messages.json b/app/_locales/da/messages.json index 8826e12633a5..68974f4e7966 100644 --- a/app/_locales/da/messages.json +++ b/app/_locales/da/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Opretter forbindelse til Goerli Testnetværk" }, + "connectingToLineaTestnet": { + "message": "Opretter forbindelse til Linea Goerli Testnetværk" + }, "connectingToMainnet": { "message": "Forbinder til dit Primære Ethereum Netværk" }, @@ -405,6 +408,9 @@ "likeToImportTokens": { "message": "Ønsker du at tilføje disse tokens?" }, + "lineatestnet": { + "message": "Linea-testnetværk" + }, "loadMore": { "message": "Indlæs Mere" }, diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index 5840f9916674..a92a7de6aee1 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Verbindungsaufbau zum Goerli-Testnetzwerk" }, + "connectingToLineaTestnet": { + "message": "Verbindungsaufbau zum Linea-Testnetzwerk" + }, "connectingToMainnet": { "message": "Verbinde zum Ethereum Mainnet" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "Möchtest du diese Token hinzufügen?" }, + "lineatestnet": { + "message": "Linea-Testnetzwerk" + }, "link": { "message": "Link" }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index 6abefcb9f578..bb17e4e33696 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Σύνδεση στο Δίκτυο Δοκιμής Goerli" }, + "connectingToLineaTestnet": { + "message": "Σύνδεση στο δίκτυο δοκιμών Linea Goerli" + }, "connectingToMainnet": { "message": "Σύνδεση στο Κύριο Δίκτυο Ethereum" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "Θέλετε να προσθέσετε αυτά τα token;" }, + "lineatestnet": { + "message": "Δίκτυο δοκιμών Linea Goerli" + }, "link": { "message": "Σύνδεσμος" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index cf38aa3a2fc9..1dfc9ec31738 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -732,6 +732,9 @@ "connectingToGoerli": { "message": "Connecting to Goerli test network" }, + "connectingToLineaTestnet": { + "message": "Connecting to Linea Goerli test network" + }, "connectingToMainnet": { "message": "Connecting to Ethereum Mainnet" }, @@ -1940,6 +1943,9 @@ "likeToImportTokens": { "message": "Would you like to import these tokens?" }, + "lineatestnet": { + "message": "Linea Goerli test network" + }, "link": { "message": "Link" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index 441bc9198d69..e987868a466d 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Estableciendo conexión a la red de prueba Goerli" }, + "connectingToLineaTestnet": { + "message": "Conectando a la red de prueba Linea Goerli" + }, "connectingToMainnet": { "message": "Estableciendo conexión a la red principal de Ethereum" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "¿Le gustaría agregar estos tokens?" }, + "lineatestnet": { + "message": "Red de prueba Linea Goerli" + }, "link": { "message": "Vínculo" }, diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json index 2a4ffbb8ebcb..5e90a0c91aa7 100644 --- a/app/_locales/es_419/messages.json +++ b/app/_locales/es_419/messages.json @@ -451,6 +451,9 @@ "connectingToGoerli": { "message": "Estableciendo conexión a la red de prueba Goerli" }, + "connectingToLineaTestnet": { + "message": "Estableciendo conexión a la red de prueba Linea Goerli" + }, "connectingToMainnet": { "message": "Estableciendo conexión a la red principal de Ethereum" }, @@ -1269,6 +1272,9 @@ "likeToImportTokens": { "message": "¿Quiere agregar estos tokens?" }, + "lineatestnet": { + "message": "Red de prueba Linea Goerli" + }, "link": { "message": "Enlace" }, diff --git a/app/_locales/et/messages.json b/app/_locales/et/messages.json index 59aefc86c175..1efe138a8db1 100644 --- a/app/_locales/et/messages.json +++ b/app/_locales/et/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Ühendamine Goerli testvõrguga" }, + "connectingToLineaTestnet": { + "message": "Ühendamine Linea Goerli testvõrguga" + }, "connectingToMainnet": { "message": "Ühenduse loomine peamise Etherumi võrguga" }, @@ -408,6 +411,9 @@ "likeToImportTokens": { "message": "Kas soovite need load lisada?" }, + "lineatestnet": { + "message": "Linea Goerli testvõrk" + }, "links": { "message": "Lingid" }, diff --git a/app/_locales/fa/messages.json b/app/_locales/fa/messages.json index 9603c04f370e..ccf627d31540 100644 --- a/app/_locales/fa/messages.json +++ b/app/_locales/fa/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "در حال اتصال به شبکه آزمایشی Goerli " }, + "connectingToLineaTestnet": { + "message": "در حال اتصال به شبکه آزمایشی Linea Goerli" + }, "connectingToMainnet": { "message": "در حال اتصال به شبکه اصلی ایتریم" }, @@ -412,6 +415,9 @@ "likeToImportTokens": { "message": "آیا میخواهید این رمزیاب ها را اضافه نمایید؟" }, + "lineatestnet": { + "message": "شبکه آزمایشی Linea Goerli" + }, "links": { "message": "لینک ها" }, diff --git a/app/_locales/fi/messages.json b/app/_locales/fi/messages.json index 2ba49aee4b6e..b43b0bc46caa 100644 --- a/app/_locales/fi/messages.json +++ b/app/_locales/fi/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Yhdistetään Goerlin testiverkostoon" }, + "connectingToLineaTestnet": { + "message": "Yhdistetään Linea Goerli testiverkostoon" + }, "connectingToMainnet": { "message": "Yhdistetään Ethereumin pääverkkoon" }, @@ -412,6 +415,9 @@ "likeToImportTokens": { "message": "Haluaisitko lisätä nämä poletit?" }, + "lineatestnet": { + "message": "Linea-testiverkko" + }, "links": { "message": "Linkit" }, diff --git a/app/_locales/fil/messages.json b/app/_locales/fil/messages.json index a8262f9aee17..158a9b6dc5a7 100644 --- a/app/_locales/fil/messages.json +++ b/app/_locales/fil/messages.json @@ -142,6 +142,9 @@ "connectingToGoerli": { "message": "Kumokonekta sa Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "Kumokonekta sa Linea Goerli Test Network" + }, "connectingToMainnet": { "message": "Kumokonekta sa Ethereum Mainnet" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 18ac12f3cad3..e2f21611a001 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Connexion au testnet Goerli" }, + "connectingToLineaTestnet": { + "message": "Connexion au réseau de test Linea Goerli" + }, "connectingToMainnet": { "message": "Connexion au réseau principal Ethereum" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "Souhaitez-vous ajouter ces jetons ?" }, + "lineatestnet": { + "message": "Réseau de test Linea Goerli" + }, "link": { "message": "Associer" }, diff --git a/app/_locales/he/messages.json b/app/_locales/he/messages.json index 646efc5b6fcf..ac025101079d 100644 --- a/app/_locales/he/messages.json +++ b/app/_locales/he/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "מתחבר ל-Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "מתחבר ל-Linea Goerli Test Network" + }, "connectingToMainnet": { "message": "מתחבר לרשת אתריום הראשית" }, @@ -412,6 +415,9 @@ "likeToImportTokens": { "message": "האם ברצונך להוסיף טוקנים אלה?" }, + "lineatestnet": { + "message": "רשת בדיקה Linea Goerli" + }, "links": { "message": "קישורים" }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index ff8eaa61ed4b..2c2da2a6ebf0 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Goerli टेस्ट नेटवर्क से कनेक्ट हो रहा है" }, + "connectingToLineaTestnet": { + "message": "Linea Goerli टेस्ट नेटवर्क से कनेक्ट हो रहा है" + }, "connectingToMainnet": { "message": "Ethereum Mainnet से कनेक्ट हो रहा है" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "क्या आप इन टोकन को इंपोर्ट करना चाहते हैं?" }, + "lineatestnet": { + "message": "Linea Goerli टेस्ट नेटवर्क" + }, "link": { "message": "लिंक" }, diff --git a/app/_locales/hr/messages.json b/app/_locales/hr/messages.json index 9aed6392c2a7..decdfbb9cb94 100644 --- a/app/_locales/hr/messages.json +++ b/app/_locales/hr/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Povezivanje na testnu mrežu Goerli" }, + "connectingToLineaTestnet": { + "message": "Povezivanje na testnu mrežu Linea Goerli" + }, "connectingToMainnet": { "message": "Povezivanje na glavnu mrežu Ethereum" }, @@ -408,6 +411,9 @@ "likeToImportTokens": { "message": "Želite li dodati ove tokene?" }, + "lineatestnet": { + "message": "Testna mreža Linea Goerli" + }, "links": { "message": "Poveznice" }, diff --git a/app/_locales/hu/messages.json b/app/_locales/hu/messages.json index 7a48cf68ace3..340e7e7c1f02 100644 --- a/app/_locales/hu/messages.json +++ b/app/_locales/hu/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Csatlakozás a Goerli teszthálózathoz" }, + "connectingToLineaTestnet": { + "message": "Csatlakozás a Linea Goerli teszthálózathoz" + }, "connectingToMainnet": { "message": "Csatlakozás a fő Ethereum hálózathoz" }, @@ -408,6 +411,9 @@ "likeToImportTokens": { "message": "Hozzá szeretné adni ezeket az érméket?" }, + "lineatestnet": { + "message": "Linea Goerli teszthálózat" + }, "links": { "message": "Linkek" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 51ce82d388c8..370ffdf72441 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Menghubungkan ke jaringan uji Goerli" }, + "connectingToLineaTestnet": { + "message": "Menghubungkan ke jaringan uji Linea Goerli" + }, "connectingToMainnet": { "message": "Menghubungkan ke Ethereum Mainnet" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "Apakah Anda ingin menambahkan token ini?" }, + "lineatestnet": { + "message": "Jaringan uji Linea Goerli" + }, "link": { "message": "Tautan" }, diff --git a/app/_locales/it/messages.json b/app/_locales/it/messages.json index 4e5fe8a4aea2..8e6e396831c3 100644 --- a/app/_locales/it/messages.json +++ b/app/_locales/it/messages.json @@ -551,6 +551,9 @@ "connectingToGoerli": { "message": "Connessione alla Rete di Test Goerli" }, + "connectingToLineaTestnet": { + "message": "Connessione alla Rete di test Linea Goerli" + }, "connectingToMainnet": { "message": "Connessione alla Rete Ethereum Principale" }, @@ -1125,6 +1128,9 @@ "likeToImportTokens": { "message": "Vorresti aggiungere questi token?" }, + "lineatestnet": { + "message": "Rete di test Linea Goerli" + }, "links": { "message": "Collegamenti" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 945fbf1a720e..57d53796f4ca 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Goerliテストネットワークに接続中" }, + "connectingToLineaTestnet": { + "message": "Linea Goerli テストネットワークに接続中" + }, "connectingToMainnet": { "message": "イーサリアムメインネットに接続中" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "これらのトークンを追加しますか?" }, + "lineatestnet": { + "message": "Linea Goerli テストネットワーク" + }, "link": { "message": "リンク" }, diff --git a/app/_locales/kn/messages.json b/app/_locales/kn/messages.json index 42de7215fa94..b1ab67888b3a 100644 --- a/app/_locales/kn/messages.json +++ b/app/_locales/kn/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Goerli ಪರೀಕ್ಷಾ ನೆಟ್‌ವರ್ಕ್‌ಗೆ ಸಂಪರ್ಕಿಸಲಾಗುತ್ತಿದೆ" }, + "connectingToLineaTestnet": { + "message": "Linea Goerli ಪರೀಕ್ಷಾ ನೆಟ್‌ವರ್ಕ್‌ಗೆ ಸಂಪರ್ಕಿಸಲಾಗುತ್ತಿದೆ" + }, "connectingToMainnet": { "message": "ಮುಖ್ಯ ಎಥೆರಿಯಮ್ ನೆಟ್‌ವರ್ಕ್‌ಗೆ ಸಂಪರ್ಕಿಸಲಾಗುತ್ತಿದೆ" }, @@ -412,6 +415,9 @@ "likeToImportTokens": { "message": "ನೀವು ಈ ಟೋಕನ್‌ಗಳನ್ನು ಸೇರಿಸಲು ಬಯಸುತ್ತೀರಾ?" }, + "lineatestnet": { + "message": "Linea Goerli ಪರೀಕ್ಷೆ ನೆಟ್‌ವರ್ಕ್" + }, "links": { "message": "ಲಿಂಕ್‌ಗಳು" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index 61c23b3acbf0..2826089ef4ab 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Goerli 테스트 네트워크에 연결 중" }, + "connectingToLineaTestnet": { + "message": "Linea Goerli 테스트 네트워크에 연결 중" + }, "connectingToMainnet": { "message": "이더리움 메인넷에 연결 중" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "이 토큰을 추가할까요?" }, + "lineatestnet": { + "message": "Linea Goerli 테스트 네트워크" + }, "link": { "message": "링크" }, diff --git a/app/_locales/lt/messages.json b/app/_locales/lt/messages.json index f703eb3b50ff..d39141facc2d 100644 --- a/app/_locales/lt/messages.json +++ b/app/_locales/lt/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Jungiamasi prie „Goerli“ bandomojo tinklo" }, + "connectingToLineaTestnet": { + "message": "Jungiamasi prie „Linea“ bandomojo tinklo" + }, "connectingToMainnet": { "message": "Jungiamasi prie pagrindinio „Ethereum“ tinklo" }, @@ -412,6 +415,9 @@ "likeToImportTokens": { "message": "Ar norėtumėte pridėti šiuos žetonus?" }, + "lineatestnet": { + "message": "„Linea“ bandomasis tinklas" + }, "links": { "message": "Nuorodos" }, diff --git a/app/_locales/lv/messages.json b/app/_locales/lv/messages.json index 46d4b0a7b8f9..d174f8442d1e 100644 --- a/app/_locales/lv/messages.json +++ b/app/_locales/lv/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Pieslēdzas Goerli testa tīklam" }, + "connectingToLineaTestnet": { + "message": "Pieslēdzas Linea Goerli testa tīklam" + }, "connectingToMainnet": { "message": "Savienojas ar galveno Ethereum tīklu" }, @@ -408,6 +411,9 @@ "likeToImportTokens": { "message": "Vai vēlaties pievienot šos marķierus?" }, + "lineatestnet": { + "message": "Linea Goerli testa tīkls" + }, "links": { "message": "Saites" }, diff --git a/app/_locales/ms/messages.json b/app/_locales/ms/messages.json index fbc374dbbf21..5dd5a821699e 100644 --- a/app/_locales/ms/messages.json +++ b/app/_locales/ms/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Menyambung kepada Rangkaian Ujian Goerli" }, + "connectingToLineaTestnet": { + "message": "Menyambung kepada Rangkaian Ujian Linea Goerli" + }, "connectingToMainnet": { "message": "Menyambung kepada Rangkaian Ethereum Utama" }, @@ -401,6 +404,9 @@ "likeToImportTokens": { "message": "Adakah anda ingin menambah token ini?" }, + "lineatestnet": { + "message": "Rangkaian Ujian Linea Goerli" + }, "links": { "message": "Pautan" }, diff --git a/app/_locales/no/messages.json b/app/_locales/no/messages.json index 8f9639b6e7ee..5e904cf861f2 100644 --- a/app/_locales/no/messages.json +++ b/app/_locales/no/messages.json @@ -160,6 +160,9 @@ "connectingToGoerli": { "message": "Oppretter forbindelse med Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "Oppretter forbindelse med Linea Goerli Test Network" + }, "connectingToMainnet": { "message": "Forbinder med hoved-Ethereumnettverk " }, diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json index 59e85e10487a..48f21c3c4baf 100644 --- a/app/_locales/ph/messages.json +++ b/app/_locales/ph/messages.json @@ -314,6 +314,9 @@ "connectingToGoerli": { "message": "Kumokonekta sa Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "Kumokonekta sa Linea Goerli Test Network" + }, "connectingToMainnet": { "message": "Kumokonekta sa Ethereum Mainnet" }, @@ -804,6 +807,9 @@ "likeToImportTokens": { "message": "Gusto mo bang idagdag ang mga token na ito?" }, + "lineatestnet": { + "message": "Linea Goerli Test Network" + }, "links": { "message": "Mga Link" }, diff --git a/app/_locales/pl/messages.json b/app/_locales/pl/messages.json index aaf196fa7868..531164a020e8 100644 --- a/app/_locales/pl/messages.json +++ b/app/_locales/pl/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Łączenie z siecią testową Goerli" }, + "connectingToLineaTestnet": { + "message": "Łączenie z siecią testową Linea Goerli" + }, "connectingToMainnet": { "message": "Łączenie z główną siecią Ethereum" }, @@ -412,6 +415,9 @@ "likeToImportTokens": { "message": "Czy chcesz dodać te tokeny?" }, + "lineatestnet": { + "message": "Sieć testowa Linea Goerli" + }, "links": { "message": "Łącza" }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index f58d4221a9e0..46fc9910facf 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Conectando à rede de testes Goerli" }, + "connectingToLineaTestnet": { + "message": "Conectando à rede de teste Linea Goerli" + }, "connectingToMainnet": { "message": "Conectando à mainnet do Ethereum" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "Gostaria de adicionar estes tokens?" }, + "lineatestnet": { + "message": "Rede de teste Linea Goerli" + }, "link": { "message": "Link" }, diff --git a/app/_locales/pt_BR/messages.json b/app/_locales/pt_BR/messages.json index a2a6580cc4f2..e051519b879b 100644 --- a/app/_locales/pt_BR/messages.json +++ b/app/_locales/pt_BR/messages.json @@ -451,6 +451,9 @@ "connectingToGoerli": { "message": "Conectando à rede de testes Goerli" }, + "connectingToLineaTestnet": { + "message": "Conectando à rede de testes Linea Goerli" + }, "connectingToMainnet": { "message": "Conectando à mainnet do Ethereum" }, @@ -1269,6 +1272,9 @@ "likeToImportTokens": { "message": "Você gostaria de importar esses tokens?" }, + "lineatestnet": { + "message": "Rede de testes Linea Goerli" + }, "link": { "message": "Link" }, diff --git a/app/_locales/ro/messages.json b/app/_locales/ro/messages.json index 37e59a3456b8..4fc35628625c 100644 --- a/app/_locales/ro/messages.json +++ b/app/_locales/ro/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Se conectează la rețeaua de test Goerli" }, + "connectingToLineaTestnet": { + "message": "Se conectează la rețeaua de test Linea Goerli" + }, "connectingToMainnet": { "message": "Se conectează la rețeaua Ethereum principală" }, @@ -402,6 +405,9 @@ "likeToImportTokens": { "message": "Adăugați aceste indicative?" }, + "lineatestnet": { + "message": "Rețea de test Linea Goerli" + }, "links": { "message": "Link-uri" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index 06f9a8f405d7..d906e91fec79 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Подключение к тестовой сети Goerli..." }, + "connectingToLineaTestnet": { + "message": "Подключение к тестовой сети Linea..." + }, "connectingToMainnet": { "message": "Подключение к сети Ethereum Mainnet..." }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "Вы хотели бы импортировать эти токены?" }, + "lineatestnet": { + "message": "Тестовая сеть Linea Goerli" + }, "link": { "message": "Привязать" }, diff --git a/app/_locales/sk/messages.json b/app/_locales/sk/messages.json index b98b4022f943..7ab10cf1e29e 100644 --- a/app/_locales/sk/messages.json +++ b/app/_locales/sk/messages.json @@ -157,6 +157,9 @@ "connectingToGoerli": { "message": "Pripája sa k testovacej sieti Goerli" }, + "connectingToLineaTestnet": { + "message": "Pripája sa k testovacej sieti Linea Goerli" + }, "connectingToMainnet": { "message": "Připojuji se k Ethereum Mainnet" }, @@ -399,6 +402,9 @@ "likeToImportTokens": { "message": "Chcete přidat tyto tokeny?" }, + "lineatestnet": { + "message": "Testovacia sieť Linea Goerli" + }, "links": { "message": "Odkazy" }, diff --git a/app/_locales/sl/messages.json b/app/_locales/sl/messages.json index 247fc2eb3a8a..2c774019e850 100644 --- a/app/_locales/sl/messages.json +++ b/app/_locales/sl/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Povezovanje na testno omrežje Goerli" }, + "connectingToLineaTestnet": { + "message": "Povezovanje na testno omrežje Linea Goerli" + }, "connectingToMainnet": { "message": "Povezovanje na glavno omrežje" }, @@ -406,6 +409,9 @@ "likeToImportTokens": { "message": "Želite dodati te žetone?" }, + "lineatestnet": { + "message": "Testno omrežje Linea Goerli" + }, "links": { "message": "Povezave" }, diff --git a/app/_locales/sr/messages.json b/app/_locales/sr/messages.json index 875be6323bce..c87c6972c1f0 100644 --- a/app/_locales/sr/messages.json +++ b/app/_locales/sr/messages.json @@ -160,6 +160,9 @@ "connectingToGoerli": { "message": "Povezuje se sa test mrežom Goerli " }, + "connectingToLineaTestnet": { + "message": "Povezuje se sa test mrežom Linea Goerli" + }, "connectingToMainnet": { "message": "Povezuje se na glavnu Ethereum mrežu" }, @@ -409,6 +412,9 @@ "likeToImportTokens": { "message": "Želite li da dodate ove tokene?" }, + "lineatestnet": { + "message": "Test mreža Linea Goerli" + }, "links": { "message": "Veze" }, diff --git a/app/_locales/sv/messages.json b/app/_locales/sv/messages.json index 2b4eb8734cb1..f8912daa6e42 100644 --- a/app/_locales/sv/messages.json +++ b/app/_locales/sv/messages.json @@ -157,6 +157,9 @@ "connectingToGoerli": { "message": "Ansluter till Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "Ansluter till Linea Goerli Test Network" + }, "connectingToMainnet": { "message": "Koppla till Ethereums huvudnätverk" }, @@ -402,6 +405,9 @@ "likeToImportTokens": { "message": "Vill du lägga till dessa tokens?" }, + "lineatestnet": { + "message": "Linea Goerli testnätverk" + }, "links": { "message": "Länkar" }, diff --git a/app/_locales/sw/messages.json b/app/_locales/sw/messages.json index 161b59ee6d20..c50e6e0bc774 100644 --- a/app/_locales/sw/messages.json +++ b/app/_locales/sw/messages.json @@ -157,6 +157,9 @@ "connectingToGoerli": { "message": "Inaunganisha kwenye Mtandao wa Majaribio wa Goerli" }, + "connectingToLineaTestnet": { + "message": "Inaunganisha kwenye Mtandao wa Majaribio wa Linea Goerli" + }, "connectingToMainnet": { "message": "Inaunganisha kwenye Mtandao Mkuu wa Ethereum" }, @@ -399,6 +402,9 @@ "likeToImportTokens": { "message": "Je, ungependa kuongeza vianzio hivi?" }, + "lineatestnet": { + "message": "Mtandao wa Majaribio wa Linea Goerli" + }, "links": { "message": "Viungo" }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index 345c258cb824..334c05393a01 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Kumokonekta sa Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "Kumokonekta sa Linea Goerli test network" + }, "connectingToMainnet": { "message": "Kumokonekta sa Ethereum Mainnet" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "Gusto mo bang idagdag ang mga token na ito?" }, + "lineatestnet": { + "message": "Linea Goerli test network" + }, "link": { "message": "Link" }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 19cbbec967a1..3b85a7dc8da7 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Goerli Test Ağına Bağlanıyor" }, + "connectingToLineaTestnet": { + "message": "Linea Goerli test ağına bağlanılıyor" + }, "connectingToMainnet": { "message": "Ethereum Mainnet ağına bağlanıyor" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "Bu tokenleri içe aktarmak ister misiniz?" }, + "lineatestnet": { + "message": "Linea Goerli test ağı" + }, "link": { "message": "Bağlantı" }, diff --git a/app/_locales/uk/messages.json b/app/_locales/uk/messages.json index 6609fec2f0f1..83f6857dee85 100644 --- a/app/_locales/uk/messages.json +++ b/app/_locales/uk/messages.json @@ -163,6 +163,9 @@ "connectingToGoerli": { "message": "Підключення до тестової мережі Goerli" }, + "connectingToLineaTestnet": { + "message": "Підключення до тестової мережі Linea Goerli" + }, "connectingToMainnet": { "message": "З'єднуємось з Головною мережею Ethereum" }, @@ -412,6 +415,9 @@ "likeToImportTokens": { "message": "Ви б хотіли додати ці токени?" }, + "lineatestnet": { + "message": "Тестова мережа Linea Goerli" + }, "links": { "message": "Посилання" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 2f2035b36f33..00897f945df9 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "Đang kết nối với mạng thử nghiệm Goerli" }, + "connectingToLineaTestnet": { + "message": "Đang kết nối với mạng thử nghiệm Linea Goerli" + }, "connectingToMainnet": { "message": "Đang kết nối với mạng chính thức của Ethereum" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "Bạn có muốn nhập những token này không?" }, + "lineatestnet": { + "message": "Mạng thử nghiệm Linea Goerli" + }, "link": { "message": "Liên kết" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index 3fed40c8c6c2..096dcd1e4c29 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -711,6 +711,9 @@ "connectingToGoerli": { "message": "正在连接 Goerli 测试网络" }, + "connectingToLineaTestnet": { + "message": "正在连接Linea测试网络" + }, "connectingToMainnet": { "message": "正在连接到以太坊主网" }, @@ -1892,6 +1895,9 @@ "likeToImportTokens": { "message": "您想导入这些代币吗?" }, + "lineatestnet": { + "message": "Linea测试网络" + }, "link": { "message": "链接" }, diff --git a/app/_locales/zh_TW/messages.json b/app/_locales/zh_TW/messages.json index 6fb45813b863..ccb72664bb66 100644 --- a/app/_locales/zh_TW/messages.json +++ b/app/_locales/zh_TW/messages.json @@ -313,6 +313,9 @@ "connectingToGoerli": { "message": "連線到 Goerli 測試網路" }, + "connectingToLineaTestnet": { + "message": "連線到 Linea Goerli 測試網路" + }, "connectingToMainnet": { "message": "連線到 Ethereum 主網路" }, @@ -812,6 +815,9 @@ "likeToImportTokens": { "message": "確定要加入代幣?" }, + "lineatestnet": { + "message": "Linea Goerli 測試網路" + }, "links": { "message": "連結" }, diff --git a/app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js b/app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js index 65ba5a2b1024..935b9ec60111 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js @@ -110,7 +110,8 @@ async function switchEthereumChainHandler( }); if ( chainId in CHAIN_ID_TO_TYPE_MAP && - approvedRequestData.type !== NETWORK_TYPES.LOCALHOST + approvedRequestData.type !== NETWORK_TYPES.LOCALHOST && + approvedRequestData.type !== NETWORK_TYPES.LINEA_TESTNET ) { setProviderType(approvedRequestData.type); } else { diff --git a/development/states/navigate-txs.json b/development/states/navigate-txs.json index 68d2535a2d13..6a4605e9afa1 100644 --- a/development/states/navigate-txs.json +++ b/development/states/navigate-txs.json @@ -304,7 +304,8 @@ "infuraNetworkStatus": { "mainnet": "ok", "goerli": "ok", - "sepolia": "ok" + "sepolia": "ok", + "lineatestnet": "ok" } }, "send": { diff --git a/shared/constants/network.ts b/shared/constants/network.ts index 58ca0ce1c464..16bafb208dda 100644 --- a/shared/constants/network.ts +++ b/shared/constants/network.ts @@ -95,6 +95,7 @@ export const NETWORK_TYPES = { MAINNET: 'mainnet', RPC: 'rpc', SEPOLIA: 'sepolia', + LINEA_TESTNET: 'lineatestnet', } as const; /** @@ -120,6 +121,7 @@ export const NETWORK_IDS = { GOERLI: '5', LOCALHOST: '1337', SEPOLIA: '11155111', + LINEA_TESTNET: '59140', } as const; /** @@ -145,6 +147,7 @@ export const CHAIN_IDS = { HARMONY: '0x63564c40', PALM: '0x2a15c308d', SEPOLIA: '0xaa36a7', + LINEA_TESTNET: '0xe704', AURORA: '0x4e454152', MOONBEAM: '0x504', MOONBEAM_TESTNET: '0x507', @@ -160,6 +163,7 @@ export const MAX_SAFE_CHAIN_ID = 4503599627370476; export const MAINNET_DISPLAY_NAME = 'Ethereum Mainnet'; export const GOERLI_DISPLAY_NAME = 'Goerli'; export const SEPOLIA_DISPLAY_NAME = 'Sepolia'; +export const LINEA_TESTNET_DISPLAY_NAME = 'Linea Goerli test network'; export const LOCALHOST_DISPLAY_NAME = 'Localhost 8545'; export const BSC_DISPLAY_NAME = 'Binance Smart Chain'; export const POLYGON_DISPLAY_NAME = 'Polygon'; @@ -189,6 +193,7 @@ export const MAINNET_RPC_URL = getRpcUrl({ }); export const GOERLI_RPC_URL = getRpcUrl({ network: NETWORK_TYPES.GOERLI }); export const SEPOLIA_RPC_URL = getRpcUrl({ network: NETWORK_TYPES.SEPOLIA }); +export const LINEA_TESTNET_RPC_URL = 'https://rpc.goerli.linea.build'; export const LOCALHOST_RPC_URL = 'http://localhost:8545'; /** @@ -238,6 +243,7 @@ export const INFURA_PROVIDER_TYPES = [ export const TEST_CHAINS = [ CHAIN_IDS.GOERLI, CHAIN_IDS.SEPOLIA, + CHAIN_IDS.LINEA_TESTNET, CHAIN_IDS.LOCALHOST, ]; @@ -256,6 +262,10 @@ export const TEST_NETWORK_TICKER_MAP: { [NETWORK_TYPES.SEPOLIA]: `${typedCapitalize(NETWORK_TYPES.SEPOLIA)}${ CURRENCY_SYMBOLS.ETH }`, + [NETWORK_TYPES.LINEA_TESTNET]: + `Linea${CURRENCY_SYMBOLS.ETH}` as `${Capitalize< + typeof NETWORK_TYPES.LINEA_TESTNET + >}${typeof CURRENCY_SYMBOLS.ETH}`, }; /** @@ -274,6 +284,12 @@ export const BUILT_IN_NETWORKS = { ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.SEPOLIA], blockExplorerUrl: `https://${NETWORK_TYPES.SEPOLIA}.etherscan.io`, }, + [NETWORK_TYPES.LINEA_TESTNET]: { + networkId: NETWORK_IDS.LINEA_TESTNET, + chainId: CHAIN_IDS.LINEA_TESTNET, + ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.LINEA_TESTNET], + blockExplorerUrl: 'https://explorer.goerli.linea.build', + }, [NETWORK_TYPES.MAINNET]: { networkId: NETWORK_IDS.MAINNET, chainId: CHAIN_IDS.MAINNET, @@ -289,15 +305,18 @@ export const NETWORK_TO_NAME_MAP = { [NETWORK_TYPES.MAINNET]: MAINNET_DISPLAY_NAME, [NETWORK_TYPES.GOERLI]: GOERLI_DISPLAY_NAME, [NETWORK_TYPES.SEPOLIA]: SEPOLIA_DISPLAY_NAME, + [NETWORK_TYPES.LINEA_TESTNET]: LINEA_TESTNET_DISPLAY_NAME, [NETWORK_TYPES.LOCALHOST]: LOCALHOST_DISPLAY_NAME, [NETWORK_IDS.GOERLI]: GOERLI_DISPLAY_NAME, [NETWORK_IDS.SEPOLIA]: SEPOLIA_DISPLAY_NAME, + [NETWORK_IDS.LINEA_TESTNET]: LINEA_TESTNET_DISPLAY_NAME, [NETWORK_IDS.MAINNET]: MAINNET_DISPLAY_NAME, [NETWORK_IDS.LOCALHOST]: LOCALHOST_DISPLAY_NAME, [CHAIN_IDS.GOERLI]: GOERLI_DISPLAY_NAME, [CHAIN_IDS.SEPOLIA]: SEPOLIA_DISPLAY_NAME, + [CHAIN_IDS.LINEA_TESTNET]: LINEA_TESTNET_DISPLAY_NAME, [CHAIN_IDS.MAINNET]: MAINNET_DISPLAY_NAME, [CHAIN_IDS.LOCALHOST]: LOCALHOST_DISPLAY_NAME, } as const; @@ -306,12 +325,14 @@ export const CHAIN_ID_TO_TYPE_MAP = { [CHAIN_IDS.MAINNET]: NETWORK_TYPES.MAINNET, [CHAIN_IDS.GOERLI]: NETWORK_TYPES.GOERLI, [CHAIN_IDS.SEPOLIA]: NETWORK_TYPES.SEPOLIA, + [CHAIN_IDS.LINEA_TESTNET]: NETWORK_TYPES.LINEA_TESTNET, [CHAIN_IDS.LOCALHOST]: NETWORK_TYPES.LOCALHOST, } as const; export const CHAIN_ID_TO_RPC_URL_MAP = { [CHAIN_IDS.GOERLI]: GOERLI_RPC_URL, [CHAIN_IDS.SEPOLIA]: SEPOLIA_RPC_URL, + [CHAIN_IDS.LINEA_TESTNET]: LINEA_TESTNET_RPC_URL, [CHAIN_IDS.MAINNET]: MAINNET_RPC_URL, [CHAIN_IDS.LOCALHOST]: LOCALHOST_RPC_URL, } as const; @@ -333,6 +354,7 @@ export const CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP = { export const NETWORK_ID_TO_ETHERS_NETWORK_NAME_MAP = { [NETWORK_IDS.GOERLI]: NETWORK_TYPES.GOERLI, [NETWORK_IDS.SEPOLIA]: NETWORK_TYPES.SEPOLIA, + [NETWORK_IDS.LINEA_TESTNET]: NETWORK_TYPES.LINEA_TESTNET, [NETWORK_IDS.MAINNET]: NETWORK_NAMES.HOMESTEAD, } as const; @@ -340,6 +362,7 @@ export const CHAIN_ID_TO_NETWORK_ID_MAP = { [CHAIN_IDS.MAINNET]: NETWORK_IDS.MAINNET, [CHAIN_IDS.GOERLI]: NETWORK_IDS.GOERLI, [CHAIN_IDS.SEPOLIA]: NETWORK_IDS.SEPOLIA, + [CHAIN_IDS.LINEA_TESTNET]: NETWORK_IDS.LINEA_TESTNET, [CHAIN_IDS.LOCALHOST]: NETWORK_IDS.LOCALHOST, } as const; @@ -380,6 +403,11 @@ export const ETHERSCAN_SUPPORTED_NETWORKS = { }`, networkId: CHAIN_ID_TO_NETWORK_ID_MAP[CHAIN_IDS.SEPOLIA], }, + [CHAIN_IDS.LINEA_TESTNET]: { + domain: 'linea.build', + subdomain: 'explorer.goerli', + networkId: CHAIN_ID_TO_NETWORK_ID_MAP[CHAIN_IDS.LINEA_TESTNET], + }, [CHAIN_IDS.BSC]: { domain: 'bscscan.com', subdomain: defaultEtherscanSubdomainPrefix, @@ -504,6 +532,7 @@ export const BUYABLE_CHAINS_MAP: { | typeof CHAIN_IDS.MOONBEAM_TESTNET | typeof CHAIN_IDS.MOONRIVER | typeof CHAIN_IDS.AURORA + | typeof CHAIN_IDS.LINEA_TESTNET >]: BuyableChainSettings; } = { [CHAIN_IDS.MAINNET]: { @@ -650,3 +679,6 @@ export const FEATURED_RPCS: RPCDefinition[] = [ }, }, ]; + +export const SHOULD_SHOW_LINEA_TESTNET_NETWORK = + new Date().getTime() > Date.UTC(2023, 2, 28); diff --git a/ui/components/app/dropdowns/network-dropdown.js b/ui/components/app/dropdowns/network-dropdown.js index f8c7e6e971b9..09e94c4981d7 100644 --- a/ui/components/app/dropdowns/network-dropdown.js +++ b/ui/components/app/dropdowns/network-dropdown.js @@ -8,8 +8,13 @@ import Button from '../../ui/button'; import * as actions from '../../../store/actions'; import { openAlert as displayInvalidCustomNetworkAlert } from '../../../ducks/alerts/invalid-custom-network'; import { + BUILT_IN_NETWORKS, + CHAIN_ID_TO_RPC_URL_MAP, + LINEA_TESTNET_RPC_URL, LOCALHOST_RPC_URL, + NETWORK_TO_NAME_MAP, NETWORK_TYPES, + SHOULD_SHOW_LINEA_TESTNET_NETWORK, } from '../../../../shared/constants/network'; import { isPrefixedFormattedHexString } from '../../../../shared/modules/network.utils'; @@ -65,6 +70,8 @@ function mapDispatchToProps(dispatch) { setActiveNetwork: (networkConfigurationId) => { dispatch(actions.setActiveNetwork(networkConfigurationId)); }, + upsertNetworkConfiguration: (...args) => + dispatch(actions.upsertNetworkConfiguration(...args)), hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()), displayInvalidCustomNetworkAlert: (networkName) => { dispatch(displayInvalidCustomNetworkAlert(networkName)); @@ -109,6 +116,7 @@ class NetworkDropdown extends Component { dropdownStyles: PropTypes.object, hideElementsForOnboarding: PropTypes.bool, onAddClick: PropTypes.func, + upsertNetworkConfiguration: PropTypes.func.isRequired, }; handleClick(newProviderType) { @@ -231,6 +239,8 @@ class NetworkDropdown extends Component { return t('goerli'); case NETWORK_TYPES.SEPOLIA: return t('sepolia'); + case NETWORK_TYPES.LINEA_TESTNET: + return t('lineatestnet'); case NETWORK_TYPES.LOCALHOST: return t('localhost'); default: @@ -275,6 +285,78 @@ class NetworkDropdown extends Component { ); } + renderNonInfuraDefaultNetwork(networkConfigurations, network) { + const { + provider: { type: providerType }, + setActiveNetwork, + upsertNetworkConfiguration, + } = this.props; + + const isCurrentRpcTarget = providerType === NETWORK_TYPES.RPC; + return ( + { + const { chainId, ticker, blockExplorerUrl } = + BUILT_IN_NETWORKS[network]; + const networkName = NETWORK_TO_NAME_MAP[network]; + + const networkConfiguration = pickBy( + networkConfigurations, + (config) => config.rpcUrl === CHAIN_ID_TO_RPC_URL_MAP[chainId], + ); + + let configurationId = null; + // eslint-disable-next-line no-extra-boolean-cast, no-implicit-coercion + if (!!networkConfiguration) { + const rpcUrl = CHAIN_ID_TO_RPC_URL_MAP[chainId]; + configurationId = await upsertNetworkConfiguration( + { + rpcUrl, + ticker, + chainId, + nickname: networkName, + rpcPrefs: { + blockExplorerUrl, + }, + }, + { + setActive: true, + source: EVENT.SOURCE.NETWORK.CUSTOM_NETWORK_FORM, + }, + ); + } + setActiveNetwork(configurationId); + }} + style={DROP_DOWN_MENU_ITEM_STYLE} + > + {isCurrentRpcTarget ? ( + + ) : ( +
+ )} + + + {this.context.t(network)} + +
+ ); + } + render() { const { history, @@ -286,9 +368,11 @@ class NetworkDropdown extends Component { networkConfigurations, } = this.props; - const rpcListDetailWithoutLocalHost = pickBy( + const rpcListDetailWithoutLocalHostAndLinea = pickBy( networkConfigurations, - (config) => config.rpcUrl !== LOCALHOST_RPC_URL, + (config) => + config.rpcUrl !== LOCALHOST_RPC_URL && + config.rpcUrl !== LINEA_TESTNET_RPC_URL, ); const rpcListDetailForLocalHost = pickBy( networkConfigurations, @@ -363,7 +447,7 @@ class NetworkDropdown extends Component { {this.renderNetworkEntry(NETWORK_TYPES.MAINNET)} {this.renderCustomRpcList( - rpcListDetailWithoutLocalHost, + rpcListDetailWithoutLocalHostAndLinea, this.props.provider, )} @@ -371,6 +455,14 @@ class NetworkDropdown extends Component { <> {this.renderNetworkEntry(NETWORK_TYPES.GOERLI)} {this.renderNetworkEntry(NETWORK_TYPES.SEPOLIA)} + {SHOULD_SHOW_LINEA_TESTNET_NETWORK && ( + <> + {this.renderNonInfuraDefaultNetwork( + networkConfigurations, + NETWORK_TYPES.LINEA_TESTNET, + )} + + )} {this.renderCustomRpcList( rpcListDetailForLocalHost, this.props.provider, diff --git a/ui/components/app/dropdowns/network-dropdown.test.js b/ui/components/app/dropdowns/network-dropdown.test.js index 6fc126da0e01..6e8ee65a6764 100644 --- a/ui/components/app/dropdowns/network-dropdown.test.js +++ b/ui/components/app/dropdowns/network-dropdown.test.js @@ -6,6 +6,15 @@ import { renderWithProvider } from '../../../../test/lib/render-helpers'; import { LOCALHOST_RPC_URL } from '../../../../shared/constants/network'; import NetworkDropdown from './network-dropdown'; +// Mock linea test network feature toggle +jest.mock('../../../../shared/constants/network', () => { + const constants = jest.requireActual('../../../../shared/constants/network'); + return { + ...constants, + SHOULD_SHOW_LINEA_TESTNET_NETWORK: true, + }; +}); + describe('Network Dropdown', () => { const createMockStore = configureMockStore([thunk]); @@ -103,6 +112,13 @@ describe('Network Dropdown', () => { expect(localhostColorIndicator).toBeInTheDocument(); }); + it('checks background color for seventh ColorIndicator', () => { + const lineaColorIndicator = screen.queryByTestId( + 'color-icon-lineatestnet', + ); + expect(lineaColorIndicator).toBeInTheDocument(); + }); + it('checks that Add Network button is rendered', () => { const addNetworkButton = screen.queryByText('Add network'); expect(addNetworkButton).toBeInTheDocument(); @@ -110,8 +126,7 @@ describe('Network Dropdown', () => { it('shows test networks in the dropdown', () => { const networkItems = screen.queryAllByTestId(/network-item/u); - - expect(networkItems).toHaveLength(6); + expect(networkItems).toHaveLength(7); }); }); diff --git a/ui/components/app/loading-network-screen/loading-network-screen.component.js b/ui/components/app/loading-network-screen/loading-network-screen.component.js index bf241cfcea4f..9a258557da25 100644 --- a/ui/components/app/loading-network-screen/loading-network-screen.component.js +++ b/ui/components/app/loading-network-screen/loading-network-screen.component.js @@ -49,6 +49,8 @@ export default class LoadingNetworkScreen extends PureComponent { return t('connectingToGoerli'); case NETWORK_TYPES.SEPOLIA: return t('connectingToSepolia'); + case NETWORK_TYPES.LINEA_TESTNET: + return t('connectingToLineaTestnet'); default: return t('connectingTo', [providerId]); } diff --git a/ui/components/app/signature-request-original/signature-request-original.component.js b/ui/components/app/signature-request-original/signature-request-original.component.js index de68e4773922..662f665d3689 100644 --- a/ui/components/app/signature-request-original/signature-request-original.component.js +++ b/ui/components/app/signature-request-original/signature-request-original.component.js @@ -73,6 +73,8 @@ export default class SignatureRequestOriginal extends Component { return t('goerli'); case NETWORK_TYPES.SEPOLIA: return t('sepolia'); + case NETWORK_TYPES.LINEA_TESTNET: + return t('lineatestnet'); case NETWORK_TYPES.LOCALHOST: return t('localhost'); default: diff --git a/ui/components/app/signature-request/signature-request.component.js b/ui/components/app/signature-request/signature-request.component.js index 3670730be825..b1b40b283a5d 100644 --- a/ui/components/app/signature-request/signature-request.component.js +++ b/ui/components/app/signature-request/signature-request.component.js @@ -110,6 +110,8 @@ export default class SignatureRequest extends PureComponent { return t('goerli'); case NETWORK_TYPES.SEPOLIA: return t('sepolia'); + case NETWORK_TYPES.LINEA_TESTNET: + return t('lineatestnet'); case NETWORK_TYPES.LOCALHOST: return t('localhost'); default: diff --git a/ui/components/ui/typography/typography.js b/ui/components/ui/typography/typography.js index dd395a5c98f7..a0eb4dd29afc 100644 --- a/ui/components/ui/typography/typography.js +++ b/ui/components/ui/typography/typography.js @@ -33,6 +33,8 @@ export const ValidColors = [ Color.sepolia, Color.goerliInverse, Color.sepoliaInverse, + Color.lineaTestnet, + Color.lineaTestnetInverse, ]; export const ValidTags = [ diff --git a/ui/css/design-system/colors.scss b/ui/css/design-system/colors.scss index 55c3a681188c..0b3e330bf371 100644 --- a/ui/css/design-system/colors.scss +++ b/ui/css/design-system/colors.scss @@ -41,6 +41,8 @@ $color-map: ( 'sepolia': --color-network-sepolia-default, 'goerli-inverse':--color-network-goerli-inverse, 'sepolia-inverse': --color-network-sepolia-inverse, + 'lineatestnet': --color-network-linea-testnet-default, + 'lineatestnet-inverse': --color-network-linea-testnet-inverse, 'localhost': --color-network-localhost-default, 'transparent': --transparent, 'flask-purple': --color-flask-default, diff --git a/ui/css/itcss/components/network.scss b/ui/css/itcss/components/network.scss index c89f93d55f89..f7baf1a07a7c 100644 --- a/ui/css/itcss/components/network.scss +++ b/ui/css/itcss/components/network.scss @@ -25,6 +25,10 @@ background-color: rgba(207, 181, 240, 0.7) !important; } + &.linea-test-network .menu-icon-circle div { + background-color: rgba(0, 0, 0, 0.7) !important; + } + &.localhost-network .menu-icon-circle div { background-color: rgba(3, 135, 137, 0.7) !important; } diff --git a/ui/css/utilities/colors.scss b/ui/css/utilities/colors.scss index 221786dcf672..7d2e8e7c88cd 100644 --- a/ui/css/utilities/colors.scss +++ b/ui/css/utilities/colors.scss @@ -4,6 +4,8 @@ --mainnet: #29b6af; --inherit: inherit; --transparent: transparent; + --color-network-linea-testnet-default: #000; + --color-network-linea-testnet-inverse: #fcfcfc; // DO NOT CHANGE // Required for the QR reader to work properly --qr-code-white-background: #fff; diff --git a/ui/helpers/constants/design-system.ts b/ui/helpers/constants/design-system.ts index 3ac409fef065..c39e95f51378 100644 --- a/ui/helpers/constants/design-system.ts +++ b/ui/helpers/constants/design-system.ts @@ -46,6 +46,8 @@ export enum Color { mainnet = 'mainnet', goerli = 'goerli', sepolia = 'sepolia', + lineaTestnet = 'lineatestnet', + lineaTestnetInverse = 'lineatestnet-inverse', transparent = 'transparent', localhost = 'localhost', inherit = 'inherit', @@ -75,6 +77,7 @@ export enum BackgroundColor { mainnet = 'mainnet', goerli = 'goerli', sepolia = 'sepolia', + lineaTestnet = 'lineatestnet', transparent = 'transparent', localhost = 'localhost', } @@ -100,6 +103,7 @@ export enum BorderColor { mainnet = 'mainnet', goerli = 'goerli', sepolia = 'sepolia', + lineaTestnet = 'lineatestnet', transparent = 'transparent', localhost = 'localhost', } @@ -122,6 +126,8 @@ export enum TextColor { inherit = 'inherit', goerli = 'goerli', sepolia = 'sepolia', + lineaTestnet = 'lineatestnet', + lineaTestnetInverse = 'lineatestnet-inverse', goerliInverse = 'goerli-inverse', sepoliaInverse = 'sepolia-inverse', } @@ -144,6 +150,8 @@ export enum IconColor { inherit = 'inherit', goerli = 'goerli', sepolia = 'sepolia', + lineaTestnet = 'lineatestnet', + lineaTestnetInverse = 'lineatestnet-inverse', goerliInverse = 'goerli-inverse', sepoliaInverse = 'sepolia-inverse', } diff --git a/ui/helpers/constants/settings.js b/ui/helpers/constants/settings.js index 477fccab236e..75cdab2decd1 100644 --- a/ui/helpers/constants/settings.js +++ b/ui/helpers/constants/settings.js @@ -254,6 +254,13 @@ export const SETTINGS_CONSTANTS = [ route: `${NETWORKS_ROUTE}#networks-sepolia`, icon: 'fa fa-plug', }, + { + tabMessage: (t) => t('networks'), + sectionMessage: (t) => t('lineatestnet'), + descriptionMessage: (t) => t('lineatestnet'), + route: `${NETWORKS_ROUTE}#networks-lineatestnet`, + icon: 'fa fa-plug', + }, { tabMessage: (t) => t('networks'), sectionMessage: (t) => t('localhost'), diff --git a/ui/helpers/utils/settings-search.test.js b/ui/helpers/utils/settings-search.test.js index 76cc601f7821..ec4839b0754e 100644 --- a/ui/helpers/utils/settings-search.test.js +++ b/ui/helpers/utils/settings-search.test.js @@ -177,7 +177,7 @@ describe('Settings Search Utils', () => { }); it('should get good network section number', () => { - expect(getNumberOfSettingsInSection(t, t('networks'))).toStrictEqual(4); + expect(getNumberOfSettingsInSection(t, t('networks'))).toStrictEqual(5); }); it('should get good experimental section number', () => { diff --git a/ui/helpers/utils/util.js b/ui/helpers/utils/util.js index 52e306da5d5c..8598260d487a 100644 --- a/ui/helpers/utils/util.js +++ b/ui/helpers/utils/util.js @@ -62,6 +62,7 @@ export function isDefaultMetaMaskChain(chainId) { chainId === CHAIN_IDS.MAINNET || chainId === CHAIN_IDS.GOERLI || chainId === CHAIN_IDS.SEPOLIA || + chainId === CHAIN_IDS.LINEA_TESTNET || chainId === CHAIN_IDS.LOCALHOST ) { return true; diff --git a/ui/helpers/utils/util.test.js b/ui/helpers/utils/util.test.js index 88184b9b6039..535c4e84394a 100644 --- a/ui/helpers/utils/util.test.js +++ b/ui/helpers/utils/util.test.js @@ -1,5 +1,6 @@ import Bowser from 'bowser'; import { BN } from 'ethereumjs-util'; +import { CHAIN_IDS } from '../../../shared/constants/network'; import { addHexPrefixToObjectValues } from '../../../shared/lib/swaps-utils'; import { toPrecisionWithoutTrailingZeros } from '../../../shared/lib/transactions-controller-utils'; import * as util from './util'; @@ -907,4 +908,14 @@ describe('util', () => { ).toStrictEqual('The Quick Brown \\u202EFox Jumps Over The Lazy Dog'); }); }); + + describe('isDefaultMetaMaskChain()', () => { + it('should return true if the provided chainId is a default MetaMask chain', () => { + expect(util.isDefaultMetaMaskChain(CHAIN_IDS.GOERLI)).toBeTruthy(); + }); + + it('should return false if the provided chainId is a not default MetaMask chain', () => { + expect(util.isDefaultMetaMaskChain(CHAIN_IDS.CELO)).toBeFalsy(); + }); + }); }); diff --git a/ui/pages/routes/routes.component.js b/ui/pages/routes/routes.component.js index 8bf4d80af638..c6cb8d89bf08 100644 --- a/ui/pages/routes/routes.component.js +++ b/ui/pages/routes/routes.component.js @@ -522,6 +522,8 @@ export default class Routes extends Component { return t('connectingToGoerli'); case NETWORK_TYPES.SEPOLIA: return t('connectingToSepolia'); + case NETWORK_TYPES.LINEA_TESTNET: + return t('connectingToLineaTestnet'); default: return t('connectingTo', [providerId]); } diff --git a/ui/pages/settings/networks-tab/networks-tab.constants.js b/ui/pages/settings/networks-tab/networks-tab.constants.js index 088d8a991677..ef34723b99b7 100644 --- a/ui/pages/settings/networks-tab/networks-tab.constants.js +++ b/ui/pages/settings/networks-tab/networks-tab.constants.js @@ -4,6 +4,7 @@ import { CURRENCY_SYMBOLS, CHAIN_IDS, NETWORK_TYPES, + LINEA_TESTNET_RPC_URL, } from '../../../../shared/constants/network'; const defaultNetworksData = [ @@ -43,6 +44,15 @@ const defaultNetworksData = [ ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.SEPOLIA], blockExplorerUrl: 'https://sepolia.etherscan.io', }, + { + labelKey: NETWORK_TYPES.LINEA_TESTNET, + iconColor: '#234FD5', + providerType: NETWORK_TYPES.LINEA_TESTNET, + rpcUrl: LINEA_TESTNET_RPC_URL, + chainId: CHAIN_IDS.LINEA_TESTNET, + ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.LINEA_TESTNET], + blockExplorerUrl: 'https://explorer.goerli.linea.build', + }, ]; export { defaultNetworksData }; diff --git a/ui/pages/settings/networks-tab/networks-tab.js b/ui/pages/settings/networks-tab/networks-tab.js index 00d6b2024e2c..bbc0443cd105 100644 --- a/ui/pages/settings/networks-tab/networks-tab.js +++ b/ui/pages/settings/networks-tab/networks-tab.js @@ -20,7 +20,9 @@ import { getProvider, } from '../../../selectors'; import { + CHAIN_IDS, NETWORK_TYPES, + SHOULD_SHOW_LINEA_TESTNET_NETWORK, TEST_CHAINS, } from '../../../../shared/constants/network'; import { defaultNetworksData } from './networks-tab.constants'; @@ -53,8 +55,8 @@ const NetworksTab = ({ addNewNetwork }) => { getNetworksTabSelectedNetworkConfigurationId, ); - const networkConfigurationsList = Object.entries(networkConfigurations).map( - ([networkConfigurationId, networkConfiguration]) => { + const networkConfigurationsList = Object.entries(networkConfigurations) + .map(([networkConfigurationId, networkConfiguration]) => { return { label: networkConfiguration.nickname, iconColor: 'var(--color-icon-alternative)', @@ -66,10 +68,15 @@ const NetworksTab = ({ addNewNetwork }) => { isATestNetwork: TEST_CHAINS.includes(networkConfiguration.chainId), networkConfigurationId, }; - }, - ); + }) + .filter((network) => network.chainId !== CHAIN_IDS.LINEA_TESTNET); - const networksToRender = [...defaultNetworks, ...networkConfigurationsList]; + let networksToRender = [...defaultNetworks, ...networkConfigurationsList]; + if (!SHOULD_SHOW_LINEA_TESTNET_NETWORK) { + networksToRender = networksToRender.filter( + (network) => network.chainId !== CHAIN_IDS.LINEA_TESTNET, + ); + } let selectedNetwork = networksToRender.find( (network) => From 5e3770eb13b3d071863d5d6e8bd7bbe5e1004e8b Mon Sep 17 00:00:00 2001 From: Ariella Vu <20778143+digiwand@users.noreply.github.com> Date: Tue, 21 Mar 2023 09:49:04 -0700 Subject: [PATCH 5/7] Replace ActionableMessage components with BannerAlerts in SIWE Sign-in with Ethereum page (#18207) * siwe: re-enable warning UI for mismatched domains - unblocks mismatched domain support - we may re-add error handling here #18184 - reverts logic from #16616 * siwe: fix mismatch domain warning msg UI * lint: rm whitespace EOL * siwe: rm unit test * lint: fix whitespace * Icon: support .mm-icon - apply to SIWE actionable-message - .mm-icon is a * lint: fix newline * Revert "siwe: rm unit test" This reverts commit c80a4a2e661609c46c76d1e43e05909b6db3f0f5. * ActionableMessage: add deprecation * siwe: replace actionable-msg w/ banner-alert * ActionableMessage: add param for lint * revert .mm_icon ActionableMessage support * siwe: create tests * siwe: fix typo in tests * siwe: fix - do not allow nested

elements * Update ui/components/app/signature-request-siwe/signature-request-siwe.js Co-authored-by: George Marshall * Update ui/components/app/signature-request-siwe/signature-request-siwe.js Co-authored-by: George Marshall * eslint fix --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: George Marshall --- .../signature-request-siwe.test.js.snap | 245 ++++++++++++++++++ .../app/signature-request-siwe/index.scss | 21 -- .../signature-request-siwe.js | 54 ++-- .../signature-request-siwe.test.js | 113 ++++++++ .../actionable-message/actionable-message.js | 24 ++ 5 files changed, 406 insertions(+), 51 deletions(-) create mode 100644 ui/components/app/signature-request-siwe/__snapshots__/signature-request-siwe.test.js.snap create mode 100644 ui/components/app/signature-request-siwe/signature-request-siwe.test.js diff --git a/ui/components/app/signature-request-siwe/__snapshots__/signature-request-siwe.test.js.snap b/ui/components/app/signature-request-siwe/__snapshots__/signature-request-siwe.test.js.snap new file mode 100644 index 000000000000..345cfdef7c26 --- /dev/null +++ b/ui/components/app/signature-request-siwe/__snapshots__/signature-request-siwe.test.js.snap @@ -0,0 +1,245 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`SignatureRequestSIWE (Sign in with Ethereum) should match snapshot 1`] = ` +

+
+
+
+
+
+
+
+
+ icon +
+
+ + https://example-dapp.website + +
+
+
+
+ Sign-in request +
+
+ This site is requesting to sign in with +
+
+ +
+
+
+
+

+ Message: +

+
+ Click to sign in and accept the Terms of Service: https://community.metamask.io/tos +
+
+
+

+ URI: +

+
+ http://localhost:8080 +
+
+
+

+ Version: +

+
+ 1 +
+
+
+

+ Chain ID: +

+
+ 1 +
+
+
+

+ Nonce: +

+
+ STMt6KQMwwdOXE306 +
+
+
+

+ Issued At: +

+
+ 2023-03-18T21:40:40.823Z +
+
+
+

+ Resources: 2 +

+
+ ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu +https://example.com/my-web2-claim.json +
+
+
+
+ +
+
+`; diff --git a/ui/components/app/signature-request-siwe/index.scss b/ui/components/app/signature-request-siwe/index.scss index 2dedc438ace4..a68b93148107 100644 --- a/ui/components/app/signature-request-siwe/index.scss +++ b/ui/components/app/signature-request-siwe/index.scss @@ -20,27 +20,6 @@ border-radius: 8px; box-shadow: 0 0 7px 0 rgba(0, 0, 0, 0.08); } - - /** @todo replace ActionableMessage or remove overwritten code. */ - .signature-request-siwe__actionable-message { - margin: 0 16px; - flex-direction: row; - align-items: initial; - - .icon { - position: absolute; - left: 17px; - top: 13px; - } - - .actionable-message__message { - padding-left: 16px; - } - - &.actionable-message--with-icon { - padding-left: 16px; - } - } } .signature-request-siwe__warning-popover { diff --git a/ui/components/app/signature-request-siwe/signature-request-siwe.js b/ui/components/app/signature-request-siwe/signature-request-siwe.js index 4ae5533eb887..11e515eeecd8 100644 --- a/ui/components/app/signature-request-siwe/signature-request-siwe.js +++ b/ui/components/app/signature-request-siwe/signature-request-siwe.js @@ -2,7 +2,7 @@ import React, { useCallback, useContext, useState } from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import log from 'loglevel'; -import ActionableMessage from '../../ui/actionable-message'; +import { BannerAlert, Text } from '../../component-library'; import Popover from '../../ui/popover'; import Checkbox from '../../ui/check-box'; import { I18nContext } from '../../../contexts/i18n'; @@ -13,8 +13,10 @@ import { } from '../../../selectors'; import { getAccountByAddress } from '../../../helpers/utils/util'; import { formatMessageParams } from '../../../../shared/modules/siwe'; -import { Icon } from '../../component-library/icon/icon'; -import { IconColor } from '../../../helpers/constants/design-system'; +import { + SEVERITIES, + TextVariant, +} from '../../../helpers/constants/design-system'; import SecurityProviderBannerMessage from '../security-provider-banner-message/security-provider-banner-message'; import { SECURITY_PROVIDER_MESSAGE_SEVERITIES } from '../security-provider-banner-message/security-provider-banner-message.constants'; @@ -101,38 +103,30 @@ export default function SignatureRequestSIWE({ ) : null} {!isMatchingAddress && ( - + {t('SIWEAddressInvalid', [ parsedMessage.address, fromAccount.address, ])} - iconFillColor="var(--color-warning-default)" - useIcon - withRightButton - icon={} - /> + )} {!isSIWEDomainValid && ( - -

- {t('SIWEDomainInvalidTitle')} -

{' '} - {t('SIWEDomainInvalidText')} - - } - iconFillColor="var(--color-error-default)" - useIcon - icon={} - /> + + + {t('SIWEDomainInvalidTitle')} + {' '} + {t('SIWEDomainInvalidText')} + )} { + const store = configureStore(mockStoreInitialState); + + return renderWithProvider( + , + store, + ); +}; + +describe('SignatureRequestSIWE (Sign in with Ethereum)', () => { + it('should match snapshot', () => { + const { container } = render(); + expect(container).toMatchSnapshot(); + }); + + it('should render', async () => { + const { container, findByText } = render(); + const bannerAlert = container.querySelector('.mm-banner-alert'); + + expect(bannerAlert).not.toBeTruthy(); + expect(await findByText('Sign-in request')).toBeInTheDocument(); + }); + + it('should render SiteOrigin', () => { + const { container } = render(); + const siteOriginElem = container.querySelector('.site-origin'); + expect(siteOriginElem).toHaveTextContent(MOCK_ORIGIN); + }); + + it('should render BannerAlert when addresses do not match', () => { + const store = configureStore(mockStoreInitialState); + const txData = cloneDeep(mockProps.txData); + txData.msgParams.siwe.parsedMessage.address = '0x12345'; + + const { container } = renderWithProvider( + , + store, + ); + const bannerAlert = container.querySelector('.mm-banner-alert'); + + expect(bannerAlert).toBeTruthy(); + expect(bannerAlert).toHaveTextContent('does not match the address'); + }); + + it('should render BannerAlert when domains do not match', () => { + const store = configureStore(mockStoreInitialState); + const txData = cloneDeep(mockProps.txData); + txData.msgParams.siwe.parsedMessage.domain = 'potentially-malicious.com'; + + const { container } = renderWithProvider( + , + store, + ); + const bannerAlert = container.querySelector('.mm-banner-alert'); + + expect(bannerAlert).toBeTruthy(); + expect(bannerAlert).toHaveTextContent('Deceptive site request.'); + }); +}); diff --git a/ui/components/ui/actionable-message/actionable-message.js b/ui/components/ui/actionable-message/actionable-message.js index 4bf5e1698865..cb87c946e8ca 100644 --- a/ui/components/ui/actionable-message/actionable-message.js +++ b/ui/components/ui/actionable-message/actionable-message.js @@ -16,6 +16,30 @@ export const typeHash = { default: '', }; +/** + * @deprecated `` has been deprecated in favour of the `` + * component in ./ui/components/component-library/banner-alert/banner-alert.js. + * See storybook documentation for Text here: + * {@see {@link https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-banneralert--default-story#banneralert}} + * + * Help to replace `ActionableMessage` with `BannerAlert` by submitting a PR + * @param options + * @param options.message + * @param options.primaryAction + * @param options.primaryActionV2 + * @param options.secondaryAction + * @param options.className + * @param options.infoTooltipText + * @param options.withRightButton + * @param options.type + * @param options.useIcon + * @param options.icon + * @param options.iconFillColor + * @param options.roundedButtons + * @param options.dataTestId + * @param options.autoHideTime + * @param options.onAutoHide + */ export default function ActionableMessage({ message = '', primaryAction = null, From be63190b97894e9f4b1f4d6529435f513dfb4fdf Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Tue, 21 Mar 2023 15:07:22 -0230 Subject: [PATCH 6/7] Remove use of `pify` from the static-server script (#18239) The static server script no longer uses `pify`. `pify` was being used to promisify the `fs.stat` function, but that function has a built-in Promise-supporting API that is now used instead. --- development/static-server.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/development/static-server.js b/development/static-server.js index facdc915bf2f..bb15133d6fdd 100755 --- a/development/static-server.js +++ b/development/static-server.js @@ -1,14 +1,13 @@ #!/usr/bin/env node -const fs = require('fs'); +const fs = require('fs').promises; const path = require('path'); const chalk = require('chalk'); -const pify = require('pify'); const createStaticServer = require('./create-static-server'); const { parsePort } = require('./lib/parse-port'); -const fsStat = pify(fs.stat); +const fsStat = fs.stat; const DEFAULT_PORT = 9080; const onResponse = (request, response) => { From b9f00ba5365cf92429c45f4ad05ced7373f726f5 Mon Sep 17 00:00:00 2001 From: Suryansh Anand Date: Tue, 21 Mar 2023 23:47:59 +0530 Subject: [PATCH 7/7] Changed all Typography to Text component in welcome.js and edit-gas-display.component.js (#18116) Co-authored-by: George Marshall --- .../edit-gas-display.component.js | 20 +++++---- ui/pages/onboarding-flow/welcome/welcome.js | 43 ++++++++++--------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/ui/components/app/edit-gas-display/edit-gas-display.component.js b/ui/components/app/edit-gas-display/edit-gas-display.component.js index 34a1893029bf..b33bd65c21e8 100644 --- a/ui/components/app/edit-gas-display/edit-gas-display.component.js +++ b/ui/components/app/edit-gas-display/edit-gas-display.component.js @@ -5,14 +5,14 @@ import BigNumber from 'bignumber.js'; import { EditGasModes } from '../../../../shared/constants/gas'; import Button from '../../ui/button'; -import Typography from '../../ui/typography/typography'; import { TEXT_ALIGN, - TypographyVariant, FONT_WEIGHT, TextColor, + TextVariant, } from '../../../helpers/constants/design-system'; +import { Text } from '../../component-library'; import { areDappSuggestedAndTxParamGasFeesTheSame } from '../../../helpers/utils/confirm-tx.util'; import InfoTooltip from '../../ui/info-tooltip'; @@ -97,9 +97,10 @@ export default function EditGasDisplay({ )} {mode === EditGasModes.speedUp && (
- {t('speedUpTooltipText')}{' '} @@ -107,16 +108,17 @@ export default function EditGasDisplay({ position="top" contentText={t('speedUpExplanation')} /> - +
)} - {estimatedMinimumNative} - + {requireDappAcknowledgement && (