Skip to content

Commit

Permalink
Merge branch 'develop' into jongsun/perf/trace/241009-account-watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorLift committed Nov 4, 2024
2 parents e289bef + 49e5e78 commit 80bdaed
Show file tree
Hide file tree
Showing 68 changed files with 930 additions and 694 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ jobs:
- gh/install
- run:
name: Install dependencies
command: .circleci/scripts/install-dependencies.sh
command: yarn --immutable
- save_cache:
key: dependency-cache-{{ checksum "/tmp/YARN_VERSION" }}-{{ checksum "yarn.lock" }}
paths:
Expand Down
42 changes: 0 additions & 42 deletions .circleci/scripts/install-dependencies.sh

This file was deleted.

8 changes: 0 additions & 8 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,6 @@ npmAuditIgnoreAdvisories:
- 'react-beautiful-dnd (deprecation)'
# New package name format for new versions: @ethereumjs/wallet.
- 'ethereumjs-wallet (deprecation)'
npmRegistries:
'https://npm.pkg.github.com':
npmAlwaysAuth: true
npmAuthToken: '${GITHUB_PACKAGE_READ_TOKEN-}'

npmScopes:
metamask:
npmRegistryServer: '${METAMASK_NPM_REGISTRY:-https://registry.yarnpkg.com}'

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
Expand Down
7 changes: 7 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions app/scripts/lib/setupSentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,17 @@ export function rewriteReport(report) {
if (!report.extra) {
report.extra = {};
}

report.extra.appState = appState;
if (browser.runtime && browser.runtime.id) {
report.extra.extensionId = browser.runtime.id;
if (!report.tags) {
report.tags = {};
}
report.extra.installType = installType;

Object.assign(report.extra, {
appState,
installType,
extensionId: browser.runtime?.id,
});

report.tags.installType = installType;
} catch (err) {
log('Error rewriting report', err);
}
Expand Down
54 changes: 54 additions & 0 deletions shared/constants/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
import { CHAIN_IDS } from './network';

export enum EtherDenomination {
ETH = 'ETH',
GWEI = 'GWEI',
WEI = 'WEI',
}

const BSC_DEFAULT_BLOCK_EXPLORER_URL = 'https://bscscan.com/';
const BSC_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL = 'BscScan';
const MAINNET_DEFAULT_BLOCK_EXPLORER_URL = 'https://etherscan.io/';
const MAINNET_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL = 'Etherscan';
const GOERLI_DEFAULT_BLOCK_EXPLORER_URL = 'https://goerli.etherscan.io/';
const GOERLI_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL = 'Goerli Etherscan';
const POLYGON_DEFAULT_BLOCK_EXPLORER_URL = 'https://polygonscan.com/';
const POLYGON_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL = 'PolygonScan';
const AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL = 'https://snowtrace.io/';
const AVALANCHE_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL = 'Snowtrace';
const OPTIMISM_DEFAULT_BLOCK_EXPLORER_URL = 'https://optimistic.etherscan.io/';
const OPTIMISM_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL = 'Optimism Explorer';
const ARBITRUM_DEFAULT_BLOCK_EXPLORER_URL = 'https://arbiscan.io/';
const ARBITRUM_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL = 'ArbiScan';
const ZKSYNC_DEFAULT_BLOCK_EXPLORER_URL = 'https://explorer.zksync.io/';
const ZKSYNC_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL = 'Zksync Explorer';
const LINEA_DEFAULT_BLOCK_EXPLORER_URL = 'https://lineascan.build/';
const LINEA_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL = 'LineaScan';
const BASE_DEFAULT_BLOCK_EXPLORER_URL = 'https://basescan.org/';
const BASE_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL = 'BaseScan';

type BlockExplorerUrlMap = {
[key: string]: string;
};

export const CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP: BlockExplorerUrlMap = {
[CHAIN_IDS.BSC]: BSC_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.MAINNET]: MAINNET_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.POLYGON]: POLYGON_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.GOERLI]: GOERLI_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.AVALANCHE]: AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.OPTIMISM]: OPTIMISM_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.ARBITRUM]: ARBITRUM_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.ZKSYNC_ERA]: ZKSYNC_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.LINEA_MAINNET]: LINEA_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.BASE]: BASE_DEFAULT_BLOCK_EXPLORER_URL,
} as const;

export const CHAINID_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL_MAP: BlockExplorerUrlMap =
{
[CHAIN_IDS.BSC]: BSC_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL,
[CHAIN_IDS.MAINNET]: MAINNET_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL,
[CHAIN_IDS.POLYGON]: POLYGON_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL,
[CHAIN_IDS.GOERLI]: GOERLI_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL,
[CHAIN_IDS.AVALANCHE]: AVALANCHE_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL,
[CHAIN_IDS.OPTIMISM]: OPTIMISM_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL,
[CHAIN_IDS.ARBITRUM]: ARBITRUM_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL,
[CHAIN_IDS.ZKSYNC_ERA]: ZKSYNC_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL,
[CHAIN_IDS.LINEA_MAINNET]: LINEA_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL,
[CHAIN_IDS.BASE]: BASE_DEFAULT_BLOCK_EXPLORER_HUMAN_READABLE_URL,
} as const;
29 changes: 0 additions & 29 deletions shared/constants/swaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ export type SwapsTokenObject = {
iconUrl: string;
};

type BlockExplorerUrlMap = {
[key: string]: string;
};

export const ETH_SWAPS_TOKEN_OBJECT: SwapsTokenObject = {
symbol: CURRENCY_SYMBOLS.ETH,
name: 'Ether',
Expand Down Expand Up @@ -174,17 +170,6 @@ export const TOKEN_API_BASE_URL = 'https://tokens.api.cx.metamask.io';
export const GAS_API_BASE_URL = 'https://gas.api.cx.metamask.io';
export const GAS_DEV_API_BASE_URL = 'https://gas.uat-api.cx.metamask.io';

const BSC_DEFAULT_BLOCK_EXPLORER_URL = 'https://bscscan.com/';
export const MAINNET_DEFAULT_BLOCK_EXPLORER_URL = 'https://etherscan.io/';
const GOERLI_DEFAULT_BLOCK_EXPLORER_URL = 'https://goerli.etherscan.io/';
const POLYGON_DEFAULT_BLOCK_EXPLORER_URL = 'https://polygonscan.com/';
const AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL = 'https://snowtrace.io/';
const OPTIMISM_DEFAULT_BLOCK_EXPLORER_URL = 'https://optimistic.etherscan.io/';
const ARBITRUM_DEFAULT_BLOCK_EXPLORER_URL = 'https://arbiscan.io/';
const ZKSYNC_DEFAULT_BLOCK_EXPLORER_URL = 'https://explorer.zksync.io/';
export const LINEA_DEFAULT_BLOCK_EXPLORER_URL = 'https://lineascan.build/';
const BASE_DEFAULT_BLOCK_EXPLORER_URL = 'https://basescan.org/';

export const ALLOWED_PROD_SWAPS_CHAIN_IDS = [
CHAIN_IDS.MAINNET,
SWAPS_TESTNET_CHAIN_ID,
Expand Down Expand Up @@ -298,20 +283,6 @@ export const SWAPS_CHAINID_DEFAULT_TOKEN_MAP = {
[CHAIN_IDS.BASE]: BASE_SWAPS_TOKEN_OBJECT,
} as const;

export const SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP: BlockExplorerUrlMap =
{
[CHAIN_IDS.BSC]: BSC_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.MAINNET]: MAINNET_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.POLYGON]: POLYGON_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.GOERLI]: GOERLI_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.AVALANCHE]: AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.OPTIMISM]: OPTIMISM_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.ARBITRUM]: ARBITRUM_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.ZKSYNC_ERA]: ZKSYNC_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.LINEA_MAINNET]: LINEA_DEFAULT_BLOCK_EXPLORER_URL,
[CHAIN_IDS.BASE]: BASE_DEFAULT_BLOCK_EXPLORER_URL,
} as const;

export const ETHEREUM = 'ethereum';
export const POLYGON = 'polygon';
export const BSC = 'bsc';
Expand Down
4 changes: 4 additions & 0 deletions test/data/confirmations/personal_sign.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { CHAIN_IDS } from '@metamask/transaction-controller';
import { SignatureRequestType } from '../../../ui/pages/confirmations/types/confirm';

export const PERSONAL_SIGN_SENDER_ADDRESS =
'0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc';

export const unapprovedPersonalSignMsg = {
id: '0050d5b0-c023-11ee-a0cb-3390a510a0ab',
chainId: CHAIN_IDS.GOERLI,
status: 'unapproved',
time: new Date().getTime(),
type: 'personal_sign',
Expand All @@ -20,6 +22,7 @@ export const unapprovedPersonalSignMsg = {

export const signatureRequestSIWE = {
id: '210ca3b0-1ccb-11ef-b096-89c4d726ebb5',
chainId: CHAIN_IDS.GOERLI,
securityAlertResponse: {
reason: 'loading',
result_type: 'validation_in_progress',
Expand Down Expand Up @@ -57,6 +60,7 @@ export const signatureRequestSIWE = {

export const SignatureRequestSIWEWithResources = {
id: '210ca3b0-1ccb-11ef-b096-89c4d726ebb5',
chainId: CHAIN_IDS.GOERLI,
securityAlertResponse: {
reason: 'loading',
result_type: 'validation_in_progress',
Expand Down
11 changes: 10 additions & 1 deletion test/data/confirmations/typed_sign.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { TransactionType } from '@metamask/transaction-controller';
import { CHAIN_IDS, TransactionType } from '@metamask/transaction-controller';
import { MESSAGE_TYPE } from '../../../shared/constants/app';
import { SignatureRequestType } from '../../../ui/pages/confirmations/types/confirm';

export const unapprovedTypedSignMsgV1 = {
id: '82ab2400-e2c6-11ee-9627-73cc88f00492',
chainId: CHAIN_IDS.GOERLI,
securityAlertResponse: {
reason: 'loading',
result_type: 'validation_in_progress',
Expand Down Expand Up @@ -60,6 +61,7 @@ const rawMessageV3 = {

export const unapprovedTypedSignMsgV3 = {
id: '17e41af0-e073-11ee-9eec-5fd284826685',
chainId: CHAIN_IDS.GOERLI,
securityAlertResponse: {
reason: 'loading',
result_type: 'validation_in_progress',
Expand Down Expand Up @@ -129,6 +131,7 @@ export const rawMessageV4 = {

export const unapprovedTypedSignMsgV4 = {
id: '0050d5b0-c023-11ee-a0cb-3390a510a0ab',
chainId: CHAIN_IDS.GOERLI,
status: 'unapproved',
time: new Date().getTime(),
chainid: '0x5',
Expand All @@ -145,6 +148,7 @@ export const unapprovedTypedSignMsgV4 = {

export const orderSignatureMsg = {
id: 'e5249ae0-4b6b-11ef-831f-65b48eb489ec',
chainId: CHAIN_IDS.GOERLI,
securityAlertResponse: {
result_type: 'loading',
reason: 'validation_in_progress',
Expand All @@ -165,6 +169,7 @@ export const orderSignatureMsg = {

export const permitSignatureMsg = {
id: '0b1787a0-1c44-11ef-b70d-e7064bd7b659',
chainId: CHAIN_IDS.GOERLI,
securityAlertResponse: {
reason: 'loading',
result_type: 'validation_in_progress',
Expand All @@ -185,6 +190,7 @@ export const permitSignatureMsg = {

export const permitNFTSignatureMsg = {
id: 'c5067710-87cf-11ef-916c-71f266571322',
chainId: CHAIN_IDS.GOERLI,
status: 'unapproved',
time: 1728651190529,
type: 'eth_signTypedData',
Expand All @@ -200,6 +206,7 @@ export const permitNFTSignatureMsg = {

export const permitSignatureMsgWithNoDeadline = {
id: '0b1787a0-1c44-11ef-b70d-e7064bd7b659',
chainId: CHAIN_IDS.GOERLI,
securityAlertResponse: {
reason: 'loading',
result_type: 'validation_in_progress',
Expand All @@ -219,6 +226,7 @@ export const permitSignatureMsgWithNoDeadline = {

export const permitBatchSignatureMsg = {
id: '0b1787a0-1c44-11ef-b70d-e7064bd7b659',
chainId: CHAIN_IDS.GOERLI,
securityAlertResponse: {
reason: 'loading',
result_type: 'validation_in_progress',
Expand All @@ -239,6 +247,7 @@ export const permitBatchSignatureMsg = {

export const permitSingleSignatureMsg = {
id: '0b1787a0-1c44-11ef-b70d-e7064bd7b659',
chainId: CHAIN_IDS.GOERLI,
securityAlertResponse: {
reason: 'loading',
result_type: 'validation_in_progress',
Expand Down
54 changes: 54 additions & 0 deletions test/e2e/page-objects/pages/dialog/edit-network.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Driver } from '../../../webdriver/driver';

class EditNetworkModal {
private driver: Driver;

private readonly editModalNetworkNameInput =
'[data-testid="network-form-network-name"]';

private readonly editModalRpcDropDownButton =
'[data-testid="test-add-rpc-drop-down"]';

private readonly editModalSaveButton = {
text: 'Save',
tag: 'button',
};

constructor(driver: Driver) {
this.driver = driver;
}

async check_pageIsLoaded(): Promise<void> {
try {
await this.driver.waitForMultipleSelectors([
this.editModalNetworkNameInput,
this.editModalRpcDropDownButton,
this.editModalSaveButton,
]);
} catch (e) {
console.log(
'Timeout while waiting for select network dialog to be loaded',
e,
);
throw e;
}
console.log('Edit network dialog is loaded');
}

/**
* Selects an RPC from the dropdown in the edit network modal.
*
* @param rpcName - The name of the RPC to select.
*/
async selectRPCInEditNetworkModal(rpcName: string): Promise<void> {
console.log(`Select RPC ${rpcName} in edit network modal`);
await this.driver.clickElement(this.editModalRpcDropDownButton);
await this.driver.clickElement({
text: rpcName,
tag: 'button',
});
await this.driver.clickElementAndWaitToDisappear(this.editModalSaveButton);
}
}

export default EditNetworkModal;
Loading

0 comments on commit 80bdaed

Please sign in to comment.