diff --git a/.circleci/config.yml b/.circleci/config.yml index 3178a687a617..ff058a08f8f1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,11 +45,11 @@ rc_branch_only: &rc_branch_only only: - /^Version-v(\d+)[.](\d+)[.](\d+)/ -develop_master_rc_only: &develop_master_rc_only +main_master_rc_only: &main_master_rc_only filters: branches: only: - - develop + - main - master - /^Version-v(\d+)[.](\d+)[.](\d+)/ @@ -172,7 +172,7 @@ workflows: requires: - prep-deps - prep-build-test-flask-mv2: - <<: *develop_master_rc_only + <<: *main_master_rc_only requires: - prep-deps - prep-build-test-mmi: @@ -200,7 +200,7 @@ workflows: requires: - prep-deps - test-e2e-chrome-webpack: - <<: *develop_master_rc_only + <<: *main_master_rc_only requires: - prep-build-test-webpack - get-changed-files-with-git-diff @@ -209,7 +209,7 @@ workflows: - prep-build-test - get-changed-files-with-git-diff - test-e2e-firefox: - <<: *develop_master_rc_only + <<: *main_master_rc_only requires: - prep-build-test-mv2 - get-changed-files-with-git-diff @@ -229,7 +229,7 @@ workflows: - prep-build-test-flask - get-changed-files-with-git-diff - test-e2e-firefox-flask: - <<: *develop_master_rc_only + <<: *main_master_rc_only requires: - prep-build-test-flask-mv2 - test-e2e-chrome-mmi: @@ -250,7 +250,7 @@ workflows: filters: branches: only: - - develop + - main - /^Version-v(\d+)[.](\d+)[.](\d+)/ requires: - prep-build @@ -349,13 +349,13 @@ workflows: - job-publish-storybook: filters: branches: - only: develop + only: main requires: - prep-build-storybook - job-publish-ts-migration-dashboard: filters: branches: - only: develop + only: main requires: - prep-build-ts-migration-dashboard @@ -367,7 +367,7 @@ workflows: - rerun-workflows-from-failed: filters: branches: - only: develop + only: main requires: - prep-deps @@ -477,7 +477,7 @@ jobs: # This job is used for the e2e quality gate. # It must be run before any job which uses the run-all.js script. - # The job is skipped in develop, master or RC branches. + # The job is skipped in main, master or RC branches. get-changed-files-with-git-diff: executor: node-browsers-small steps: @@ -1335,7 +1335,7 @@ jobs: template: basic_fail_1 channel: C01LUJL3T98 - slack/notify: - branch_pattern: develop + branch_pattern: main event: fail mentions: <@antonio.regadas>, @ramon.acitores134 template: basic_fail_1 diff --git a/.circleci/scripts/bundle-stats-commit.sh b/.circleci/scripts/bundle-stats-commit.sh index 14b3604d82ec..1c9f4380f694 100755 --- a/.circleci/scripts/bundle-stats-commit.sh +++ b/.circleci/scripts/bundle-stats-commit.sh @@ -16,9 +16,9 @@ then exit 1 fi -if [[ "${CIRCLE_BRANCH}" != "develop" ]] +if [[ "${CIRCLE_BRANCH}" != "main" ]] then - printf 'This is not develop branch' + printf 'This is not main branch' exit 0 fi diff --git a/.circleci/scripts/check_mmi_trigger.sh b/.circleci/scripts/check_mmi_trigger.sh index c8d6fc44523b..b2a5ca13734d 100755 --- a/.circleci/scripts/check_mmi_trigger.sh +++ b/.circleci/scripts/check_mmi_trigger.sh @@ -9,7 +9,7 @@ if [ -z "$CIRCLE_PULL_REQUEST" ] || [ -z "$GITHUB_TOKEN" ]; then exit 0 fi -if [[ $CIRCLE_BRANCH = 'develop' || $CIRCLE_BRANCH = 'master' || $CIRCLE_BRANCH =~ ^Version-v[0-9.]* ]]; then +if [[ $CIRCLE_BRANCH = 'main' || $CIRCLE_BRANCH = 'master' || $CIRCLE_BRANCH =~ ^Version-v[0-9.]* ]]; then echo "Long-running branch detected, running MMI tests." echo "run_mmi_tests=true" > mmi_trigger.env exit 0 diff --git a/.circleci/scripts/git-diff-develop.ts b/.circleci/scripts/git-diff-develop.ts index f4437d6154db..3800c03d3254 100644 --- a/.circleci/scripts/git-diff-develop.ts +++ b/.circleci/scripts/git-diff-develop.ts @@ -10,7 +10,7 @@ const PR_NUMBER = process.env.CIRCLE_PR_NUMBER || process.env.CIRCLE_PULL_REQUEST?.split('/').pop(); -const MAIN_BRANCH = 'develop'; +const MAIN_BRANCH = 'main'; const SOURCE_BRANCH = `refs/pull/${PR_NUMBER}/head`; const CHANGED_FILES_DIR = 'changed-files'; diff --git a/.circleci/scripts/rerun-ci-workflow-from-failed.ts b/.circleci/scripts/rerun-ci-workflow-from-failed.ts index 84827f11fd13..2863ca5bcda0 100644 --- a/.circleci/scripts/rerun-ci-workflow-from-failed.ts +++ b/.circleci/scripts/rerun-ci-workflow-from-failed.ts @@ -59,7 +59,7 @@ interface WorkflowStatusResponse { * Note: the API returns the first 20 workflows by default. * If we wanted to get older workflows, we would need to use the 'page-token' we would get in the first response * and perform a subsequent request with the 'page-token' parameter. - * This seems unnecessary as of today, as the amount of daily PRs merged to develop is not that high. + * This seems unnecessary as of today, as the amount of daily PRs merged to main is not that high. * * @returns {Promise} A promise that resolves to an array of workflow items. * @throws Will throw an error if the CircleCI token is not defined or if the HTTP request fails. @@ -177,7 +177,7 @@ async function rerunWorkflowById(workflowId: string) { } /** - * Re-runs failed CircleCI workflows from develop branch. + * Re-runs failed CircleCI workflows from main branch. * The workflow will only be re-runed if: * 1. It has the status of 'failed' * 2. It has only been run once @@ -187,8 +187,8 @@ async function rerunWorkflowById(workflowId: string) { * @throws Will throw an error if fetching the workflows or re-running a workflow fails. */ async function rerunFailedWorkflowsFromDevelop() { - console.log('Getting Circle Ci workflows from develop branch...'); - const workflows = await getCircleCiWorkflowsByBranch('develop'); + console.log('Getting Circle Ci workflows from main branch...'); + const workflows = await getCircleCiWorkflowsByBranch('main'); console.log('Assessing if any of the workflows needs to be rerun...'); for (const item of workflows) { diff --git a/.devcontainer/download-builds.ts b/.devcontainer/download-builds.ts index 83e1822379a1..5408bba8d69f 100644 --- a/.devcontainer/download-builds.ts +++ b/.devcontainer/download-builds.ts @@ -7,7 +7,7 @@ function getGitBranch() { const gitOutput = execSync('git status').toString(); const branchRegex = /On branch (?.*)\n/; - return gitOutput.match(branchRegex)?.groups?.branch || 'develop'; + return gitOutput.match(branchRegex)?.groups?.branch || 'main'; } async function getCircleJobs(branch: string) { diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 894c13b90238..41d6433db7d7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -13,14 +13,14 @@ If you're picking up a bounty or an existing issue, feel free to ask clarifying ### Submitting a pull request When you're done with your project / bugfix / feature and ready to submit a PR, there are a couple guidelines we ask you to follow: -- [ ] **Make sure you followed our [`coding guidelines`](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md)**: These guidelines aim to maintain consistency and readability across the codebase. They help ensure that the code is easy to understand, maintain, and modify, which is particularly important when working with multiple contributors. +- [ ] **Make sure you followed our [`coding guidelines`](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md)**: These guidelines aim to maintain consistency and readability across the codebase. They help ensure that the code is easy to understand, maintain, and modify, which is particularly important when working with multiple contributors. - [ ] **Test it**: For any new programmatic functionality, we like unit tests when possible, so if you can keep your code cleanly isolated, please do add a test file to the `tests` folder. - [ ] **Meet the spec**: Make sure the PR adds functionality that matches the issue you're closing. This is especially important for bounties: sometimes design or implementation details are included in the conversation, so read carefully! - [ ] **Close the issue**: If this PR closes an open issue, fill out the "Related issues" section with `Fixes: #$ISSUE_NUMBER`. Ex. For closing issue 418, include the line `Fixes: #418`. If it doesn't close the issue but addresses it partially, just include a reference to the issue number, like `#418`. - [ ] **Keep it simple**: Try not to include multiple features in a single PR, and don't make extraneous changes outside the scope of your contribution. All those touched files make things harder to review ;) -- [ ] **PR against `develop`**: Submit your PR against the `develop` branch. This is where we merge new features so they get some time to receive extra testing before being pushed to `master` for production. If your PR is a hot-fix that needs to be published urgently, you may submit a PR against the `master` branch, but this PR will receive tighter scrutiny before merging. +- [ ] **PR against `main`**: Submit your PR against the `main` branch. This is where we merge new features so they get some time to receive extra testing before being pushed to `master` for production. If your PR is a hot-fix that needs to be published urgently, you may submit a PR against the `master` branch, but this PR will receive tighter scrutiny before merging. - [ ] **Get reviewed by MetaMask Internal Developers**: All PRs require 2 approvals from MetaMask Internal Developers before merging. -- [ ] **Ensure the PR is correctly labeled.**: More detail about PR labels can be found [here](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md). +- [ ] **Ensure the PR is correctly labeled.**: More detail about PR labels can be found [here](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md). - [ ] **PR Titles**: Must adhere to the [Conventional Commits specification](https://www.conventionalcommits.org) - `[optional scope]: ` - Example: `feat(parser): add ability to parse arrays` diff --git a/.github/guidelines/LABELING_GUIDELINES.md b/.github/guidelines/LABELING_GUIDELINES.md index 02081367bb5e..ea37c2e5f03d 100644 --- a/.github/guidelines/LABELING_GUIDELINES.md +++ b/.github/guidelines/LABELING_GUIDELINES.md @@ -14,7 +14,7 @@ It's essential to ensure that PRs have the appropriate labels before they are co - **regression-RC-x.y.z**: This label is manually added to a bug report issue by release engineers when a bug is found during release regerssion testing phase. The `x.y.z` in the label represents the release candidate (RC) version in which the bug's been discovered. ### Optional labels: -- **regression-develop**: This label can manually be added to a bug report issue at the time of its creation if the bug is present on the development branch, i.e., `develop`, but is not yet released in production. +- **regression-main**: This label can manually be added to a bug report issue at the time of its creation if the bug is present on the development branch, i.e., `main`, but is not yet released in production. - **needs-qa**: If the PR includes a new features, complex testing steps, or large refactors, this label must be added to indicated PR requires a full manual QA prior being merged and added to a release. ### Labels prohibited when PR needs to be merged: diff --git a/.github/pull-request-template.md b/.github/pull-request-template.md index 59232248ef51..044f83571fc6 100644 --- a/.github/pull-request-template.md +++ b/.github/pull-request-template.md @@ -38,11 +38,11 @@ Fixes: ## **Pre-merge author checklist** -- [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). +- [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable -- [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. +- [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** diff --git a/.github/scripts/check-pr-has-required-labels.ts b/.github/scripts/check-pr-has-required-labels.ts index 354dc2c2aa7d..fcce4dd23a82 100644 --- a/.github/scripts/check-pr-has-required-labels.ts +++ b/.github/scripts/check-pr-has-required-labels.ts @@ -73,7 +73,7 @@ async function main(): Promise { if (!hasTeamLabel) { errorMessage += 'No team labels found on the PR. '; } - errorMessage += `Please make sure the PR is appropriately labeled before merging it.\n\nSee labeling guidelines for more detail: https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md`; + errorMessage += `Please make sure the PR is appropriately labeled before merging it.\n\nSee labeling guidelines for more detail: https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md`; core.setFailed(errorMessage); process.exit(1); } diff --git a/.github/scripts/check-template-and-add-labels.ts b/.github/scripts/check-template-and-add-labels.ts index ed22e98dc9a1..418174df2a90 100644 --- a/.github/scripts/check-template-and-add-labels.ts +++ b/.github/scripts/check-template-and-add-labels.ts @@ -132,7 +132,7 @@ async function main(): Promise { } else { const errorMessage = - "Issue body does not match any of expected templates ('general-issue.yml' or 'bug-report.yml').\n\nMake sure issue's body includes all section titles.\n\nSections titles are listed here: https://github.com/MetaMask/metamask-extension/blob/develop/.github/scripts/shared/template.ts#L14-L37"; + "Issue body does not match any of expected templates ('general-issue.yml' or 'bug-report.yml').\n\nMake sure issue's body includes all section titles.\n\nSections titles are listed here: https://github.com/MetaMask/metamask-extension/blob/main/.github/scripts/shared/template.ts#L14-L37"; console.log(errorMessage); // Add label to indicate issue doesn't match any template @@ -152,7 +152,7 @@ async function main(): Promise { ); } else { const errorMessage = - `PR body does not match template ('pull-request-template.md').\n\nMake sure PR's body includes all section titles.\n\nSections titles are listed here: https://github.com/MetaMask/metamask-extension/blob/develop/.github/scripts/shared/template.ts#L40-L47`; + `PR body does not match template ('pull-request-template.md').\n\nMake sure PR's body includes all section titles.\n\nSections titles are listed here: https://github.com/MetaMask/metamask-extension/blob/main/.github/scripts/shared/template.ts#L40-L47`; console.log(errorMessage); // Add label to indicate PR body doesn't match template @@ -334,7 +334,7 @@ function craftRegressionLabel(regressionStage: RegressionStage | undefined, rele switch (regressionStage) { case RegressionStage.Development: return { - name: `regression-develop`, + name: `regression-main`, color: '5319E7', // violet description: `Regression bug that was found on development branch, but not yet present in production`, }; @@ -364,7 +364,7 @@ function craftRegressionLabel(regressionStage: RegressionStage | undefined, rele return { name: `regression-*`, color: 'EDEDED', // grey - description: `TODO: Unknown regression stage. Please replace with correct regression label: 'regression-develop', 'regression-RC-x.y.z', or 'regression-prod-x.y.z' label, where 'x.y.z' is the number of the release where bug was found.`, + description: `TODO: Unknown regression stage. Please replace with correct regression label: 'regression-main', 'regression-RC-x.y.z', or 'regression-prod-x.y.z' label, where 'x.y.z' is the number of the release where bug was found.`, }; } } diff --git a/.github/workflows/add-mmi-reviewer-and-notify.yml b/.github/workflows/add-mmi-reviewer-and-notify.yml index 8821ccbd36e9..8372217bce70 100644 --- a/.github/workflows/add-mmi-reviewer-and-notify.yml +++ b/.github/workflows/add-mmi-reviewer-and-notify.yml @@ -3,7 +3,7 @@ name: Notify MMI team via Slack on: pull_request_target: branches: - - develop + - main types: - opened - reopened @@ -45,4 +45,4 @@ jobs: ] } env: - SLACK_WEBHOOK_URL: ${{ secrets.MMI_LABEL_SLACK_WEBHOOK_URL }} \ No newline at end of file + SLACK_WEBHOOK_URL: ${{ secrets.MMI_LABEL_SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/add-release-label.yml b/.github/workflows/add-release-label.yml index 94ba76fcefa0..2e34ad491b44 100644 --- a/.github/workflows/add-release-label.yml +++ b/.github/workflows/add-release-label.yml @@ -3,7 +3,7 @@ name: Add release label to PR and linked issues when PR gets merged on: pull_request: branches: - - develop + - main types: - closed diff --git a/.github/workflows/check-pr-labels.yml b/.github/workflows/check-pr-labels.yml index 19c0576feaae..cc492c09319e 100644 --- a/.github/workflows/check-pr-labels.yml +++ b/.github/workflows/check-pr-labels.yml @@ -2,7 +2,7 @@ name: Check PR has required labels on: pull_request: branches: - - develop + - main types: - opened - reopened diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 73670c46d75d..a4b5bef7c9e7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [ develop, Version-v*, cla-signatures, master, snaps ] + branches: [ main, Version-v*, cla-signatures, master, snaps ] pull_request: # The branches below must be a subset of the branches above - branches: [ develop ] + branches: [ main ] schedule: - cron: '28 12 * * 0' diff --git a/.github/workflows/codespaces.yml b/.github/workflows/codespaces.yml index 3455e2db54d4..5d37ba2d3dc3 100644 --- a/.github/workflows/codespaces.yml +++ b/.github/workflows/codespaces.yml @@ -4,7 +4,7 @@ on: push: branches: - 'codespaces**' - - 'develop' + - 'main' paths: - '**/yarn.lock' diff --git a/.github/workflows/crowdin-action.yml b/.github/workflows/crowdin-action.yml index 94bd8016cd4f..1a902087ad61 100644 --- a/.github/workflows/crowdin-action.yml +++ b/.github/workflows/crowdin-action.yml @@ -7,7 +7,7 @@ permissions: on: push: branches: - - develop + - main schedule: - cron: "0 */12 * * *" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3cc68bebcec..2554557b9c35 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Main on: push: branches: - - develop + - main - master pull_request: types: diff --git a/.github/workflows/security-code-scanner.yml b/.github/workflows/security-code-scanner.yml index 7da1773d666c..cf0b60cf84ac 100644 --- a/.github/workflows/security-code-scanner.yml +++ b/.github/workflows/security-code-scanner.yml @@ -2,9 +2,9 @@ name: "MetaMask Security Code Scanner" on: push: - branches: [ 'develop' ] + branches: [ 'main' ] pull_request: - branches: [ 'develop' ] + branches: [ 'main' ] jobs: run-security-scan: diff --git a/.github/workflows/update-coverage.yml b/.github/workflows/update-coverage.yml index fd1b0d5134e3..e65cdcbe978b 100644 --- a/.github/workflows/update-coverage.yml +++ b/.github/workflows/update-coverage.yml @@ -43,4 +43,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.LAVAMOAT_UPDATE_TOKEN }} run: | - gh pr create --title "chore: Update coverage.json" --body "This PR is automatically opened to update the coverage.json file when test coverage increases. Coverage increased from $STORED_COVERAGE% to $CURRENT_COVERAGE%." --base develop --head metamaskbot/update-coverage || gh pr edit --body "This PR is automatically opened to update the coverage.json file when test coverage increases. Coverage increased from $STORED_COVERAGE% to $CURRENT_COVERAGE%." + gh pr create --title "chore: Update coverage.json" --body "This PR is automatically opened to update the coverage.json file when test coverage increases. Coverage increased from $STORED_COVERAGE% to $CURRENT_COVERAGE%." --base main --head metamaskbot/update-coverage || gh pr edit --body "This PR is automatically opened to update the coverage.json file when test coverage increases. Coverage increased from $STORED_COVERAGE% to $CURRENT_COVERAGE%." diff --git a/.github/workflows/validate-conventional-commits.yml b/.github/workflows/validate-conventional-commits.yml index 8cb416844339..b8b5c56eabb6 100644 --- a/.github/workflows/validate-conventional-commits.yml +++ b/.github/workflows/validate-conventional-commits.yml @@ -2,7 +2,7 @@ name: Validate Conventional Commit Title on: pull_request: branches: - - develop + - main types: [opened, edited, reopened, synchronize] jobs: diff --git a/README.md b/README.md index f3e738a40abc..85d1b3f91ba3 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ To learn how to develop MetaMask-compatible applications, visit our [Developer D To learn how to contribute to the MetaMask codebase, visit our [Contributor Docs](https://github.com/MetaMask/contributor-docs). -To learn how to contribute to the MetaMask Extension project itself, visit our [Extension Docs](https://github.com/MetaMask/metamask-extension/tree/develop/docs). +To learn how to contribute to the MetaMask Extension project itself, visit our [Extension Docs](https://github.com/MetaMask/metamask-extension/tree/main/docs). ## GitHub Codespaces quickstart diff --git a/app/scripts/lib/setupSentry.js b/app/scripts/lib/setupSentry.js index 72c246826ab5..76d66eba88d2 100644 --- a/app/scripts/lib/setupSentry.js +++ b/app/scripts/lib/setupSentry.js @@ -127,9 +127,9 @@ function getTracesSampleRate(sentryTarget) { } if (flags.circleci) { - // Report very frequently on develop branch, and never on other branches + // Report very frequently on main branch, and never on other branches // (Unless you use a `flags = {"sentry": {"tracesSampleRate": x.xx}}` override) - if (flags.circleci.branch === 'develop') { + if (flags.circleci.branch === 'main') { return 0.015; } return 0; diff --git a/development/build/README.md b/development/build/README.md index 9d5df1e149fc..3aecead0cb25 100644 --- a/development/build/README.md +++ b/development/build/README.md @@ -4,7 +4,7 @@ > Add `--build-type flask` to build Flask, our canary distribution with more experimental features. This directory contains the MetaMask build system, which is used to build the MetaMask Extension such that it can be used in a supported browser. -From the repository root, the build system entry file is located at [`./development/build/index.js`](https://github.com/MetaMask/metamask-extension/blob/develop/development/build/index.js). +From the repository root, the build system entry file is located at [`./development/build/index.js`](https://github.com/MetaMask/metamask-extension/blob/main/development/build/index.js). Several package scripts invoke the build system. For example, `yarn start` creates a watched development build, and `yarn dist` creates a production build. @@ -20,7 +20,7 @@ are written to the `./dist` directory. Our JavaScript source files are transformed using [Babel](https://babeljs.io/), specifically using the [`babelify`](https://npmjs.com/package/babelify) Browserify transform. -Source file bundling tasks are implemented in the [`./development/build/scripts.js`](https://github.com/MetaMask/metamask-extension/blob/develop/development/build/scripts.js). +Source file bundling tasks are implemented in the [`./development/build/scripts.js`](https://github.com/MetaMask/metamask-extension/blob/main/development/build/scripts.js). > Locally implemented Browserify transforms, _some of which affect how we write JavaScript_, are listed and documented [here](./transforms/README.md). diff --git a/development/build/utils.js b/development/build/utils.js index 626aacd588c7..301c998534ad 100644 --- a/development/build/utils.js +++ b/development/build/utils.js @@ -130,7 +130,7 @@ function getEnvironment({ buildTarget }) { /^Version-v(\d+)[.](\d+)[.](\d+)/u.test(process.env.CIRCLE_BRANCH) ) { return ENVIRONMENT.RELEASE_CANDIDATE; - } else if (process.env.CIRCLE_BRANCH === 'develop') { + } else if (process.env.CIRCLE_BRANCH === 'main') { return ENVIRONMENT.STAGING; } else if (process.env.CIRCLE_PULL_REQUEST) { return ENVIRONMENT.PULL_REQUEST; diff --git a/development/fitness-functions/rules/index.ts b/development/fitness-functions/rules/index.ts index 6ba0f1198684..5afb72fa5343 100644 --- a/development/fitness-functions/rules/index.ts +++ b/development/fitness-functions/rules/index.ts @@ -6,7 +6,7 @@ const RULES: IRule[] = [ name: "Don't use `sinon` or `assert` in unit tests", fn: preventSinonAssertSyntax, errorMessage: - '`sinon` or `assert` was detected in the diff. Please use Jest instead. For more info: https://github.com/MetaMask/metamask-extension/blob/develop/docs/testing.md#favor-jest-instead-of-mocha', + '`sinon` or `assert` was detected in the diff. Please use Jest instead. For more info: https://github.com/MetaMask/metamask-extension/blob/main/docs/testing.md#favor-jest-instead-of-mocha', }, { name: "Don't add JS or JSX files", diff --git a/development/highlights/index.js b/development/highlights/index.js index 2b263005fb96..2616d602633e 100644 --- a/development/highlights/index.js +++ b/development/highlights/index.js @@ -6,11 +6,11 @@ module.exports = { getHighlights }; async function getHighlights({ artifactBase }) { let highlights = ''; - // here we assume the PR base branch ("target") is `develop` in lieu of doing + // here we assume the PR base branch ("target") is `main` in lieu of doing // a query against the github api which requires an access token // see https://discuss.circleci.com/t/how-to-retrieve-a-pull-requests-base-branch-name-github/36911 - const changedFiles = await getChangedFiles({ target: 'develop' }); - console.log(`detected changed files vs develop:`); + const changedFiles = await getChangedFiles({ target: 'main' }); + console.log(`detected changed files vs main:`); for (const filename of changedFiles) { console.log(` ${filename}`); } diff --git a/development/master-sync.js b/development/master-sync.js index 548ae6611c2f..dc1d474eaebe 100644 --- a/development/master-sync.js +++ b/development/master-sync.js @@ -51,8 +51,8 @@ async function runGitCommands() { console.log('Executed: git reset --hard origin/master'); try { - await exec('git merge origin/develop'); - console.log('Executed: git merge origin/develop'); + await exec('git merge origin/main'); + console.log('Executed: git merge origin/main'); } catch (error) { // Handle the error but continue script execution if ( @@ -70,11 +70,11 @@ async function runGitCommands() { } await exec('git add .'); - await exec('git restore --source origin/develop .'); - console.log('Executed: it restore --source origin/develop .'); + await exec('git restore --source origin/main .'); + console.log('Executed: it restore --source origin/main .'); - await exec('git checkout origin/develop -- .'); - console.log('Executed: git checkout origin/develop -- .'); + await exec('git checkout origin/main -- .'); + console.log('Executed: git checkout origin/main -- .'); await exec('git checkout origin/master -- CHANGELOG.md'); console.log('Executed: git checkout origin/master -- CHANGELOG.md'); @@ -91,7 +91,7 @@ async function runGitCommands() { await exec('git add .'); console.log('Executed: git add .'); - await exec('git commit -m "Merge origin/develop into master-sync"'); + await exec('git commit -m "Merge origin/main into master-sync"'); console.log('Executed: git commit'); console.log('Your local master-sync branch is now ready to become a PR.'); diff --git a/docs/QA_MIGRATIONS_GUIDE.md b/docs/QA_MIGRATIONS_GUIDE.md index fbd2c38a182a..beb3a239dea8 100644 --- a/docs/QA_MIGRATIONS_GUIDE.md +++ b/docs/QA_MIGRATIONS_GUIDE.md @@ -2,7 +2,7 @@ Migrations are needed to change top-level state data, this can be found in the browser's storage. This can look like removing specific keys/value pairs from state, changing objects to an array of objects, changing the name of a controller, etc. Steps - 1. Create a new MetaMask directory\* folder locally with the source files before the migration, and load it as an unpacked extension in Chrome\*. If the migration is in a pull request, then build the `develop` branch to load. If the migration is already in `develop`, get a commit before the migration was added to build. + 1. Create a new MetaMask directory\* folder locally with the source files before the migration, and load it as an unpacked extension in Chrome\*. If the migration is in a pull request, then build the `main` branch to load. If the migration is already in `main`, get a commit before the migration was added to build. ![Load unpacked extension to chrome](./assets/load-build-chrome.gif) diff --git a/docs/confirmation-refactoring/confirmation-backend-architecture/README.md b/docs/confirmation-refactoring/confirmation-backend-architecture/README.md index a3f30eb88a56..b927b5789801 100644 --- a/docs/confirmation-refactoring/confirmation-backend-architecture/README.md +++ b/docs/confirmation-refactoring/confirmation-backend-architecture/README.md @@ -5,13 +5,13 @@ Current confirmation implementation in the background consists of following pieces: 1. `TransactionController` and utility, helper classes used by it: - `TransactionController` is very important piece in transaction processing. It is described [here](https://github.com/MetaMask/metamask-extension/tree/develop/app/scripts/controllers/transactions#transaction-controller). It consists of 4 important parts: + `TransactionController` is very important piece in transaction processing. It is described [here](https://github.com/MetaMask/metamask-extension/tree/main/app/scripts/controllers/transactions#transaction-controller). It consists of 4 important parts: - `txStateManager`: responsible for the state of a transaction and storing the transaction - `pendingTxTracker`: watching blocks for transactions to be include and emitting confirmed events - `txGasUtil`: gas calculations and safety buffering - `nonceTracker`: calculating nonces 2. `MessageManagers`: - There are 3 different message managers responsible for processing signature requests. These are detailed [here](https://github.com/MetaMask/metamask-extension/tree/develop/docs/refactoring/signature-request#proposed-refactoring). + There are 3 different message managers responsible for processing signature requests. These are detailed [here](https://github.com/MetaMask/metamask-extension/tree/main/docs/refactoring/signature-request#proposed-refactoring). 3. `MetamaskController `: `MetamaskController ` is responsible for gluing together the different pieces in transaction processing. It is responsible to inject dependencies in `TransactionController`, `MessageManagers`, handling different events, responses to DAPP requests, etc. @@ -19,8 +19,8 @@ Current confirmation implementation in the background consists of following piec 1. Migrating to `@metamask/transaction-controller`. `TransactionController` in extension repo should eventually get replaced by core repo [TransactionController](https://github.com/MetaMask/core/tree/main/packages/transaction-controller). This controller is maintained by core team and also used in Metamask Mobile App. 2. Migrating to `@metamask/message-manager`. Message Managers in extension repo should be deprecated in favor of core repo [MessageManagers](https://github.com/MetaMask/core/tree/main/packages/message-manager). -3. Cleanup Code in `MetamaskController`. [Metamaskcontroller](https://github.com/MetaMask/metamask-extension/blob/develop/app/scripts/metamask-controller.js) is where `TransactionController` and different `MessageManagers` are initialized. It is responsible for injecting required dependencies. Also, it is responsible for handling incoming DAPP requests and invoking appropriate methods in these background classes. Over the period of time lot of code that should have been part of `TransactionController` and `MessageManagers` has ended up in `MetamaskController`. We need to cleanup this code and move to the appropriate classes. - - Code [here](https://github.com/MetaMask/metamask-extension/blob/bc19856d5d9ad1831e1722c84fe6161bed7a0a5a/app/scripts/metamask-controller.js#L3097) to check if `eth_sign` is enabled in preferences and perform other validation on the incoming request should be part of [MessageManager](https://github.com/MetaMask/metamask-extension/blob/develop/app/scripts/lib/message-manager.js) +3. Cleanup Code in `MetamaskController`. [Metamaskcontroller](https://github.com/MetaMask/metamask-extension/blob/main/app/scripts/metamask-controller.js) is where `TransactionController` and different `MessageManagers` are initialized. It is responsible for injecting required dependencies. Also, it is responsible for handling incoming DAPP requests and invoking appropriate methods in these background classes. Over the period of time lot of code that should have been part of `TransactionController` and `MessageManagers` has ended up in `MetamaskController`. We need to cleanup this code and move to the appropriate classes. + - Code [here](https://github.com/MetaMask/metamask-extension/blob/bc19856d5d9ad1831e1722c84fe6161bed7a0a5a/app/scripts/metamask-controller.js#L3097) to check if `eth_sign` is enabled in preferences and perform other validation on the incoming request should be part of [MessageManager](https://github.com/MetaMask/metamask-extension/blob/main/app/scripts/lib/message-manager.js) - Method to sign messages [signMessage](https://github.com/MetaMask/metamask-extension/blob/bc19856d5d9ad1831e1722c84fe6161bed7a0a5a/app/scripts/metamask-controller.js#L3158), [signPersonalMessage](https://github.com/MetaMask/metamask-extension/blob/bc19856d5d9ad1831e1722c84fe6161bed7a0a5a/app/scripts/metamask-controller.js#L3217), [signTypedMessage](https://github.com/MetaMask/metamask-extension/blob/bc19856d5d9ad1831e1722c84fe6161bed7a0a5a/app/scripts/metamask-controller.js#L3470) can be simplified by injecting `KeyringController` into `MessageManagers`. - There are about 11 different methods to `add`, `approve`, `reject` different types of signature requests. These can probably be moved to a helper class, thus reducing lines of code from `MetamaskController `. - This [code](https://github.com/MetaMask/metamask-extension/blob/bc19856d5d9ad1831e1722c84fe6161bed7a0a5a/app/scripts/metamask-controller.js#L959) can better be placed in `TransactionController`. diff --git a/docs/confirmation-refactoring/confirmation-page-structure/README.md b/docs/confirmation-refactoring/confirmation-page-structure/README.md index a0ecc658836d..3ef31d0e0607 100644 --- a/docs/confirmation-refactoring/confirmation-page-structure/README.md +++ b/docs/confirmation-refactoring/confirmation-page-structure/README.md @@ -11,7 +11,7 @@ Currently we have following confirmation pages mapping to confirmation routes: 5. `pages/confirm-token-transaction-base` 6. `pages/confirm-contract-interaction` -![Confirmation Pages structure](https://raw.githubusercontent.com/MetaMask/metamask-extension/develop/docs/confirmation-refactoring/confirmation-page-structure/current.png) +![Confirmation Pages structure](https://raw.githubusercontent.com/MetaMask/metamask-extension/main/docs/confirmation-refactoring/confirmation-page-structure/current.png) `confirm-page-container` component helps to define a structure for confirmation pages it includes: @@ -26,7 +26,7 @@ Other confirmation components listed above map to different types of transaction ## Areas of Refactoring: -1. ### [confirm-transaction-base](https://github.com/MetaMask/metamask-extension/tree/develop/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js) cleanup: +1. ### [confirm-transaction-base](https://github.com/MetaMask/metamask-extension/tree/main/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js) cleanup: The `confirm-transaction-base` component is huge 1200 lines component taking care of lot of complexity. We need to break it down into smaller components and move logic to hooks or utility classes. Layout related part can be moved to `confirm-page-container`. - Extract out code to render data into separate component from [here](https://github.com/MetaMask/metamask-extension/blob/e07ec9dcf3d3f341f83e6b29a29d30edaf7f5b5b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js#L641). - Extract out component to render hex data from [here](https://github.com/MetaMask/metamask-extension/blob/e07ec9dcf3d3f341f83e6b29a29d30edaf7f5b5b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js#L675). @@ -37,11 +37,11 @@ Other confirmation components listed above map to different types of transaction - Code to get error key [getErrorKey](https://github.com/MetaMask/metamask-extension/blob/e07ec9dcf3d3f341f83e6b29a29d30edaf7f5b5b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js#L230) can be moved to a util function. - As new component for gas selection popups is created this code [handleEditGas, handleCloseEditGas](https://github.com/MetaMask/metamask-extension/blob/e07ec9dcf3d3f341f83e6b29a29d30edaf7f5b5b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js#L276) can be moved to it. - Convert `confirm-transaction-base` into a functional components and extract out all of these functions into a hook - `handleEdit`, `handleCancelAll`, `handleCancel`, `handleSubmit`, `handleSetApprovalForAll`, etc. -2. ### [confirm-transaction-base-container](https://github.com/MetaMask/metamask-extension/tree/develop/ui/pages/confirm-transaction-base/confirm-transaction-base.container.js) cleanup: +2. ### [confirm-transaction-base-container](https://github.com/MetaMask/metamask-extension/tree/main/ui/pages/confirm-transaction-base/confirm-transaction-base.container.js) cleanup: This container is doing much work to query and get required transaction related values from state and pass over to `confirm-transaction-base` component. As we refactor state we should get rid of this component. - remove the use of `state.confirmTransaction` from the component - create hook to get values derived from metamask state and active transaction. - State cleanup is detailed more in a separate document [here](https://github.com/MetaMask/metamask-extension/tree/develop/docs/confirmation-refactoring/confirmation-state-management). + State cleanup is detailed more in a separate document [here](https://github.com/MetaMask/metamask-extension/tree/main/docs/confirmation-refactoring/confirmation-state-management). 3. ### [confirm-page-container](https://github.com/MetaMask/metamask-extension/tree/03ccc5366cf31c9fa0fedc2fac533ebc64e6f2b4/ui/components/app/confirm-page-container) cleanup: As described we should continue to have `confirm-page-container` components taking care of layout. Also wherever possible more re-usable smaller layout components for different part of confirmation page like gas details, gas selection popover, etc should be added. `confirm-page-container` defines a layout which is used by most comfirmation pages, but some pages like new token allowance implementation for `ERC20` differ from this layout. We will be able to use more and more of these re-usable components for other confirmation pages layouts also. @@ -53,9 +53,9 @@ Other confirmation components listed above map to different types of transaction There are 2 different versions popovers for gas editing: - - Legacy gas popover - [component](https://github.com/MetaMask/metamask-extension/tree/develop/ui/components/app/edit-gas-popover) - - EIP-1559 V2 gas popover - [component1](https://github.com/MetaMask/metamask-extension/tree/develop/ui/components/app/edit-gas-fee-popover), [component2](https://github.com/MetaMask/metamask-extension/tree/develop/ui/components/app/advanced-gas-fee-popover). - Context [transaction-modal-context](https://github.com/MetaMask/metamask-extension/blob/develop/ui/contexts/transaction-modal.js) is used to show hide EIP-1559 gas popovers. + - Legacy gas popover - [component](https://github.com/MetaMask/metamask-extension/tree/main/ui/components/app/edit-gas-popover) + - EIP-1559 V2 gas popover - [component1](https://github.com/MetaMask/metamask-extension/tree/main/ui/components/app/edit-gas-fee-popover), [component2](https://github.com/MetaMask/metamask-extension/tree/main/ui/components/app/advanced-gas-fee-popover). + Context [transaction-modal-context](https://github.com/MetaMask/metamask-extension/blob/main/ui/contexts/transaction-modal.js) is used to show hide EIP-1559 gas popovers. A parent component can be created for gas editing popover which will wrap both the legacy and EIP-1559 gas popover. Depending on the type of transaction appropriate gas popover can be shown. `transaction-modal-context` can be used to take care to open/close both popovers. This parent component can be added to `confirm-transaction-base` and `token-allowance` components and thus will be available on all confirmation pages using gas editing. diff --git a/docs/confirmation-refactoring/confirmation-pages-routing/README.md b/docs/confirmation-refactoring/confirmation-pages-routing/README.md index ed4d7aef0788..a6abfcaf31ca 100644 --- a/docs/confirmation-refactoring/confirmation-pages-routing/README.md +++ b/docs/confirmation-refactoring/confirmation-pages-routing/README.md @@ -6,7 +6,7 @@ This document details how routing to confirmation pages is currently done and th The current flow of routing to confirmation pages is un-necessarily complicated and have issues. -![Confirmation Pages Routing - Current](https://raw.githubusercontent.com/MetaMask/metamask-extension/develop/docs/confirmation-refactoring/confirmation-pages-routing/current.png) +![Confirmation Pages Routing - Current](https://raw.githubusercontent.com/MetaMask/metamask-extension/main/docs/confirmation-refactoring/confirmation-pages-routing/current.png) - There are 2 ways in which confirmation pages can be opened: 1. User triggers send flow from within Metamask @@ -24,7 +24,7 @@ The current flow of routing to confirmation pages is un-necessarily complicated The proposed routing of confirmation pages looks like. -![Confirmation Pages Routing - Proposed](https://raw.githubusercontent.com/MetaMask/metamask-extension/develop/docs/confirmation-refactoring/confirmation-pages-routing/proposed.png) +![Confirmation Pages Routing - Proposed](https://raw.githubusercontent.com/MetaMask/metamask-extension/main/docs/confirmation-refactoring/confirmation-pages-routing/proposed.png) - There are 2 ways in which confirmation pages can be opened: 1. User triggers send flow from within Metamask @@ -52,14 +52,14 @@ The proposed routing of confirmation pages looks like. ## Areas of code refactoring -Current routing code is complicated, it is also currently tied to state change in confirmation pages that makes it more complicated. State refactoring as discussed in this [document](https://github.com/MetaMask/metamask-extension/tree/develop/docs/confirmation-refactoring/confirmation-state-management) will also help simplify it. +Current routing code is complicated, it is also currently tied to state change in confirmation pages that makes it more complicated. State refactoring as discussed in this [document](https://github.com/MetaMask/metamask-extension/tree/main/docs/confirmation-refactoring/confirmation-state-management) will also help simplify it. -- Any re-usable routing related code should be moved to [useRouting](https://github.com/MetaMask/metamask-extension/blob/develop/ui/hooks/useRouting.js) hook. +- Any re-usable routing related code should be moved to [useRouting](https://github.com/MetaMask/metamask-extension/blob/main/ui/hooks/useRouting.js) hook. - Logic to initially check state and redirect to `/pages/confirm-transaction` can be moved from `/pages/home` to `pages/routes` - All the route mapping code should be moved to `/pages/confirm-transaction`, this will require getting rid of route mappings in `/pages/confirm-transaction/confirm-token-transaction-switch`, `/pages/confirm-transaction-switch`. - `/pages/confirm-transaction-switch` has the code that checks the un-approved transaction / message in the state, and based on its type and asset redirect to a specific route, a utility method can be created to do this mapping and can be included in `/pages/confirm-transaction` component. - During the send flow initiated within metamask user can be redirected to specific confirmations route **`/confirm-transaction/${id}/XXXX`** -- Confirmation components have lot of props passing which needs to be reduced. Values can be obtained from redux state or other contexts directly using hooks. Component [confirm-token-transaction-switch](https://github.com/MetaMask/metamask-extension/blob/develop/ui/pages/confirm-transaction/confirm-token-transaction-switch.js) has a lot of un-necessary props passing which should be removed and will help to further refactor routing. +- Confirmation components have lot of props passing which needs to be reduced. Values can be obtained from redux state or other contexts directly using hooks. Component [confirm-token-transaction-switch](https://github.com/MetaMask/metamask-extension/blob/main/ui/pages/confirm-transaction/confirm-token-transaction-switch.js) has a lot of un-necessary props passing which should be removed and will help to further refactor routing. - **Routing to mostRecentOverviewPage** Across confirmation pages there is code to re-direct to `mostRecentOverviewPage`. `mostRecentOverviewPage` is equal to default route `/` or `/asset` whichever was last opened. diff --git a/docs/confirmation-refactoring/confirmation-state-management/README.md b/docs/confirmation-refactoring/confirmation-state-management/README.md index a24184154e5a..da9cf143a754 100644 --- a/docs/confirmation-refactoring/confirmation-state-management/README.md +++ b/docs/confirmation-refactoring/confirmation-state-management/README.md @@ -12,11 +12,11 @@ State Management is very important piece to keep frontend confirmation code simp Refactorings: -- There are confirmations related ducks [here](https://github.com/MetaMask/metamask-extension/tree/develop/ui/ducks): - - [confirm-transaction](https://github.com/MetaMask/metamask-extension/tree/develop/ui/ducks/confirm-transaction): this is redundant and we should be able to get rid of it. - - [gas](https://github.com/MetaMask/metamask-extension/tree/develop/ui/ducks/gas): this is not used anywhere and can be removed. - - [send](https://github.com/MetaMask/metamask-extension/tree/develop/ui/ducks/send): this duck is important state machine for send flow and we should continue to maintain. -- [gasFeeContext](https://github.com/MetaMask/metamask-extension/blob/develop/ui/contexts/gasFee.js) is huge context written on top of [gasFeeInput](https://github.com/MetaMask/metamask-extension/tree/develop/ui/hooks/gasFeeInput) hook. The context / hook provides about 20 different values used in different places in confirmation pages. We need to break this down: +- There are confirmations related ducks [here](https://github.com/MetaMask/metamask-extension/tree/main/ui/ducks): + - [confirm-transaction](https://github.com/MetaMask/metamask-extension/tree/main/ui/ducks/confirm-transaction): this is redundant and we should be able to get rid of it. + - [gas](https://github.com/MetaMask/metamask-extension/tree/main/ui/ducks/gas): this is not used anywhere and can be removed. + - [send](https://github.com/MetaMask/metamask-extension/tree/main/ui/ducks/send): this duck is important state machine for send flow and we should continue to maintain. +- [gasFeeContext](https://github.com/MetaMask/metamask-extension/blob/main/ui/contexts/gasFee.js) is huge context written on top of [gasFeeInput](https://github.com/MetaMask/metamask-extension/tree/main/ui/hooks/gasFeeInput) hook. The context / hook provides about 20 different values used in different places in confirmation pages. We need to break this down: - Context is required only to provide temporary UI state for confirmation pages which includes: @@ -38,10 +38,10 @@ Refactorings: - `gasFeeEstimates` - `isNetworkBusy` - `minimumGasLimitDec` is a constant value 21000 should be removed from the context, this can be moved to constants file. - - Create separate hook for transaction functions [here](https://github.com/MetaMask/metamask-extension/blob/develop/ui/hooks/gasFeeInput/useTransactionFunctions.js), this hook can consume GasFeeContext. - - Setters and manual update functions are only used by legacy gas component [edit-gas-fee-popover](https://github.com/MetaMask/metamask-extension/tree/develop/ui/components/app/edit-gas-popover). This component uses useGasFeeInputs hook. We need to create a smaller hook just for this component using the above context and hooks. + - Create separate hook for transaction functions [here](https://github.com/MetaMask/metamask-extension/blob/main/ui/hooks/gasFeeInput/useTransactionFunctions.js), this hook can consume GasFeeContext. + - Setters and manual update functions are only used by legacy gas component [edit-gas-fee-popover](https://github.com/MetaMask/metamask-extension/tree/main/ui/components/app/edit-gas-popover). This component uses useGasFeeInputs hook. We need to create a smaller hook just for this component using the above context and hooks. -* [confirm-transaction-base.container.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/pages/confirm-transaction-base/confirm-transaction-base.container.js) and [confirm-transaction-base.component.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js) has a lot of code to derive values from state and selected transactions. This can be simplified by using hooks that will he created. +* [confirm-transaction-base.container.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/pages/confirm-transaction-base/confirm-transaction-base.container.js) and [confirm-transaction-base.component.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js) has a lot of code to derive values from state and selected transactions. This can be simplified by using hooks that will he created. * We will have a lot of hooks for transaction related fields, these can be grouped into same file / folder. As we work on the components we will be able to identify more areas of improvement. diff --git a/docs/confirmation-refactoring/signature-request/README.md b/docs/confirmation-refactoring/signature-request/README.md index a80cc046ca6c..3585ef4a9c4e 100644 --- a/docs/confirmation-refactoring/signature-request/README.md +++ b/docs/confirmation-refactoring/signature-request/README.md @@ -6,35 +6,35 @@ This document details the plan to refactor and cleanup Signature Request pages i 1. Simple ETH Signature - + 1. Personal Signature - + 1. Typed Data - V1 - + 1. Typed Data - V3 - + 1. Typed Data - V4 - + 1. SIWE Signature - + ## The current flow of control for Signature Request looks like: -![Signature Request Flow - Current](https://raw.githubusercontent.com/MetaMask/metamask-extension/develop/docs/confirmation-refactoring/signature-request/signature_request_old.png) +![Signature Request Flow - Current](https://raw.githubusercontent.com/MetaMask/metamask-extension/main/docs/confirmation-refactoring/signature-request/signature_request_old.png) ## The proposed flow of control: -![Signature Request Flow - Proposed](https://raw.githubusercontent.com/MetaMask/metamask-extension/develop/docs/confirmation-refactoring/signature-request/signature_request_proposed.png) +![Signature Request Flow - Proposed](https://raw.githubusercontent.com/MetaMask/metamask-extension/main/docs/confirmation-refactoring/signature-request/signature_request_proposed.png) ## Proposed Refactoring: @@ -44,9 +44,9 @@ There are many areas in above flow where the code can be improved upon to cleanu Currently we have 3 different message managers: - - [MessageManager](https://github.com/MetaMask/metamask-extension/blob/develop/app/scripts/lib/message-manager.js) - - [PersonalMessageManager](https://github.com/MetaMask/metamask-extension/blob/develop/app/scripts/lib/personal-message-manager.js) - - [TypedMessageManager](https://github.com/MetaMask/metamask-extension/blob/develop/app/scripts/lib/typed-message-manager.js) + - [MessageManager](https://github.com/MetaMask/metamask-extension/blob/main/app/scripts/lib/message-manager.js) + - [PersonalMessageManager](https://github.com/MetaMask/metamask-extension/blob/main/app/scripts/lib/personal-message-manager.js) + - [TypedMessageManager](https://github.com/MetaMask/metamask-extension/blob/main/app/scripts/lib/typed-message-manager.js) Above message managers handle different types of message requests sent by DAPP. There is a lot of code duplication between the 3 classes. @@ -56,14 +56,14 @@ There are many areas in above flow where the code can be improved upon to cleanu Current navigation to Signature Request pages is un-necessarily complicated. It can be simplified to great extent. - - To the navigation code in [Home](https://github.com/MetaMask/metamask-extension/blob/develop/ui/pages/home/home.component.js#L181) component add condition to check if there are unapproved messages and route to path `/singature-request`. - - In [Routes](https://github.com/MetaMask/metamask-extension/blob/develop/ui/pages/routes/routes.component.js) component render pages/confirm-signature-request for path `/singature-request`. - - Refactor out [conf-tx.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/pages/confirm-transaction/conf-tx.js) into pages/confirm-signature-request component. [#17240](https://github.com/MetaMask/metamask-extension/issues/17240) + - To the navigation code in [Home](https://github.com/MetaMask/metamask-extension/blob/main/ui/pages/home/home.component.js#L181) component add condition to check if there are unapproved messages and route to path `/singature-request`. + - In [Routes](https://github.com/MetaMask/metamask-extension/blob/main/ui/pages/routes/routes.component.js) component render pages/confirm-signature-request for path `/singature-request`. + - Refactor out [conf-tx.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/pages/confirm-transaction/conf-tx.js) into pages/confirm-signature-request component. [#17240](https://github.com/MetaMask/metamask-extension/issues/17240) -3. ### Refactoring in [conf-tx.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/pages/confirm-transaction/conf-tx.js) +3. ### Refactoring in [conf-tx.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/pages/confirm-transaction/conf-tx.js) - - [conf-tx.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/pages/confirm-transaction/conf-tx.js) to be renamed to `pages/confirm-signature-request component` - - Get rid of [confirm-transaction](https://github.com/MetaMask/metamask-extension/blob/develop/ui/pages/confirm-transaction/confirm-transaction.component.js) component from signature request routing. Thus, we need to ensure that any required logic from the component is extracted into a reusable hook and included in pages/confirm-signature-request. + - [conf-tx.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/pages/confirm-transaction/conf-tx.js) to be renamed to `pages/confirm-signature-request component` + - Get rid of [confirm-transaction](https://github.com/MetaMask/metamask-extension/blob/main/ui/pages/confirm-transaction/confirm-transaction.component.js) component from signature request routing. Thus, we need to ensure that any required logic from the component is extracted into a reusable hook and included in pages/confirm-signature-request. - Convert to functional react component and use selectors to get state and get rid of `mapStateToProps`. [#17239](https://github.com/MetaMask/metamask-extension/issues/17239) - Various callbacks to `sign message`, `cancel request`, etc for different types of messages can be moved to respective child components. - On component `mount/update` if there are no unapproved messages redirect to `mostRecentlyOverviewedPage` as [here](https://github.com/MetaMask/metamask-extension/blob/76a2a9bb8b6ea04025328d36404ac3b59121dfc8/ui/app/pages/confirm-transaction/conf-tx.js#L187). @@ -74,12 +74,12 @@ There are many areas in above flow where the code can be improved upon to cleanu There are 3 different signature request components responsible to render different signature request pages: - 1. [signature-request-original](https://github.com/MetaMask/metamask-extension/tree/develop/ui/components/app/signature-request-original) - ETH sign, personal sign, sign typed data V1 - 2. [signature-request](https://github.com/MetaMask/metamask-extension/tree/develop/ui/components/app/signature-request) - Sign typed data V3, V4 - 3. [signature-request-siwe](https://github.com/MetaMask/metamask-extension/tree/develop/ui/components/app/signature-request-siwe) - SignatureRequestSIWE (Sign-In with Ethereum) + 1. [signature-request-original](https://github.com/MetaMask/metamask-extension/tree/main/ui/components/app/signature-request-original) - ETH sign, personal sign, sign typed data V1 + 2. [signature-request](https://github.com/MetaMask/metamask-extension/tree/main/ui/components/app/signature-request) - Sign typed data V3, V4 + 3. [signature-request-siwe](https://github.com/MetaMask/metamask-extension/tree/main/ui/components/app/signature-request-siwe) - SignatureRequestSIWE (Sign-In with Ethereum) All, the signature request pages (except SIWE) are very similar, the differing part in these pages is the message section. - And there is a lot of code duplication between components - [signature-request-original](https://github.com/MetaMask/metamask-extension/tree/develop/ui/components/app/signature-request-original) and [signature-request](https://github.com/MetaMask/metamask-extension/tree/develop/ui/components/app/signature-request). + And there is a lot of code duplication between components - [signature-request-original](https://github.com/MetaMask/metamask-extension/tree/main/ui/components/app/signature-request-original) and [signature-request](https://github.com/MetaMask/metamask-extension/tree/main/ui/components/app/signature-request). 5. ### Refactoring in signature-request-original @@ -89,12 +89,12 @@ There are many areas in above flow where the code can be improved upon to cleanu - Move this [metrics event](https://github.com/MetaMask/metamask-extension/blob/71a0bc8b3ff94478e61294c815770e6bc12a72f5/ui/app/components/app/signature-request-original/signature-request-original.component.js#L50) to pages/confirm-signature-request as it is applicable to all the signature requests types. - Header or we can say upper half of the page of all signature request pages (except SIWE) are very similar, this can be extracted into a reusable component used across both signature-request-original and signature-request: - + - [LedgerInstructions](https://github.com/MetaMask/metamask-extension/blob/e07ec9dcf3d3f341f83e6b29a29d30edaf7f5b5b/ui/components/app/signature-request-original/signature-request-original.component.js#L312) can also be moved to the header. - Create a reuable footer component and use it across all confirmation pages. [#17237](https://github.com/MetaMask/metamask-extension/issues/17237) - + - Create a reusable component for Cancel All requests for use across signature request pages [Code](https://github.com/MetaMask/metamask-extension/blob/e07ec9dcf3d3f341f83e6b29a29d30edaf7f5b5b/ui/components/app/signature-request-original/signature-request-original.component.js#L326). - Extract [getNetrowkName](https://github.com/MetaMask/metamask-extension/blob/e07ec9dcf3d3f341f83e6b29a29d30edaf7f5b5b/ui/components/app/signature-request-original/signature-request-original.component.js#L60) into a reusable hook / utility method. diff --git a/docs/publishing.md b/docs/publishing.md index fdf1ab1850a7..5915f1873a88 100644 --- a/docs/publishing.md +++ b/docs/publishing.md @@ -30,9 +30,9 @@ In the case that a new release has sensitive changes that cannot be fully verifi ## Building -While we develop on the main `develop` branch, our production version is maintained on the `master` branch. +While we develop on the `main` branch, our production version is maintained on the `master` branch. -With each pull request, the @MetaMaskBot will comment with a build of that new pull request, so after bumping the version on `develop`, open a pull request against `master`, and once the pull request is reviewed and merged, you can download those builds for publication. +With each pull request, the @MetaMaskBot will comment with a build of that new pull request, so after bumping the version on `main`, open a pull request against `master`, and once the pull request is reviewed and merged, you can download those builds for publication. ## Publishing @@ -45,7 +45,7 @@ With each pull request, the @MetaMaskBot will comment with a build of that new p ## Hotfix Differences -Our `develop` branch is usually not yet fully tested for quality assurance, and so should be treated as if it is in an unstable state. +Our `main` branch is usually not yet fully tested for quality assurance, and so should be treated as if it is in an unstable state. For this reason, when an urgent change is needed in production, its pull request should: @@ -53,4 +53,4 @@ For this reason, when an urgent change is needed in production, its pull request - Use a hotfix tag. - Should be proposed against the `master` branch. -The version and changelog bump should then be made off the `master` branch, and then merged to `develop` to bring the two branches back into sync. Further time can be saved by incorporating the version/changelog bump into the PR against `master`, since we rely on @MetaMaskBot to run tests before merging. +The version and changelog bump should then be made off the `master` branch, and then merged to `main` to bring the two branches back into sync. Further time can be saved by incorporating the version/changelog bump into the PR against `master`, since we rely on @MetaMaskBot to run tests before merging. diff --git a/test/e2e/flask/README.md b/test/e2e/flask/README.md index abb07a11e910..42d0e6a28236 100644 --- a/test/e2e/flask/README.md +++ b/test/e2e/flask/README.md @@ -3,4 +3,4 @@ Add `.spec.js` or `.spec.ts` files to run only in flask here. > [!IMPORTANT] > Ensure to update your files in `FLASK_ONLY_TESTS` in -> [`run-all.js`](https://github.com/MetaMask/metamask-extension/blob/develop/test/e2e/run-all.js) \ No newline at end of file +> [`run-all.js`](https://github.com/MetaMask/metamask-extension/blob/main/test/e2e/run-all.js) diff --git a/test/manual-scenarios/upgrade-testing/upgrade-testing.md b/test/manual-scenarios/upgrade-testing/upgrade-testing.md index df5ca3d1fc50..13880f13694b 100644 --- a/test/manual-scenarios/upgrade-testing/upgrade-testing.md +++ b/test/manual-scenarios/upgrade-testing/upgrade-testing.md @@ -8,7 +8,7 @@ To ensure MetaMask extension's upgrade process is seamless and retains user data ### Pre-Upgrade Actions on Master Branch -- **Given** the user checks out the master branch, runs `yarn` and `yarn start` to build locally, and has loaded the MetaMask extension. For instructions on how to load extension on Chrome and Firefox, check the guidelines [here for Chrome](https://github.com/MetaMask/metamask-extension/blob/develop/docs/add-to-chrome.md) and [here for Firefox](https://github.com/MetaMask/metamask-extension/blob/develop/docs/add-to-firefox.md). +- **Given** the user checks out the master branch, runs `yarn` and `yarn start` to build locally, and has loaded the MetaMask extension. For instructions on how to load extension on Chrome and Firefox, check the guidelines [here for Chrome](https://github.com/MetaMask/metamask-extension/blob/main/docs/add-to-chrome.md) and [here for Firefox](https://github.com/MetaMask/metamask-extension/blob/main/docs/add-to-firefox.md). - **And** the user has successfully onboarded. - **And** the user creates two accounts. - **And** the user sends a transaction between these accounts. diff --git a/ui/components/ui/box/README.mdx b/ui/components/ui/box/README.mdx index a70ac7e291fb..08d308db11d5 100644 --- a/ui/components/ui/box/README.mdx +++ b/ui/components/ui/box/README.mdx @@ -49,21 +49,21 @@ Box is a utility component that can be used for layout or as a base for other UI | paddingInline | 0, 1, 2, 4, 6, 8, 9, 10, 12 or array of numbers [1, 2] for responsive props | - | | paddingInlineStart | 0, 1, 2, 4, 6, 8, 9, 10, 12 or array of numbers [1, 2] for responsive props | - | | paddingInlineEnd | 0, 1, 2, 4, 6, 8, 9, 10, 12 or array of numbers [1, 2] for responsive props | - | -| display | Display values or array of Display values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | -| flexDirection | FlexDirection values or array of FlexDirection values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | FlexDirection.Row | -| flexWrap | FlexWrap values or array of FlexWrap values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | -| alignItems | AlignItems values or array of AlignItems values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | -| justifyContent | JustifyContent values or array of JustifyContent values from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | +| display | Display values or array of Display values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | +| flexDirection | FlexDirection values or array of FlexDirection values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | FlexDirection.Row | +| flexWrap | FlexWrap values or array of FlexWrap values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | +| alignItems | AlignItems values or array of AlignItems values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | +| justifyContent | JustifyContent values or array of JustifyContent values from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | | gap | 0, 1, 2, 4, 6, 8, 9, 10, 12 or array of numbers [1, 2] for responsive props | - | -| textAlign | TextAlign values or array of TextAlign values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | -| width | BlockSize values or array of BlockSize values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | -| height | BlockSize values or array of BlockSize values for responsive props [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | -| color | Color values or array of Color values for responsive props [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | -| backgroundColor | BackgroundColor values or array of BackgroundColor values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | -| borderColor | BorderColor values or array of BorderColor values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | +| textAlign | TextAlign values or array of TextAlign values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | +| width | BlockSize values or array of BlockSize values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | +| height | BlockSize values or array of BlockSize values for responsive props [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | +| color | Color values or array of Color values for responsive props [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | +| backgroundColor | BackgroundColor values or array of BackgroundColor values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | +| borderColor | BorderColor values or array of BorderColor values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | | borderWidth | 0, 1, 2, 4, 6, 8, 9, 10, 12 or array of numbers [1, 2] for responsive props | - | -| borderRadius | BorderRadius values or array of BorderRadius values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | -| borderStyle | BORDER_STYLE values or array of BORDER_STYLE values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/develop/ui/helpers/constants/design-system.js) | - | +| borderRadius | BorderRadius values or array of BorderRadius values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | +| borderStyle | BORDER_STYLE values or array of BORDER_STYLE values for responsive props from [../ui/helpers/constants/design-system.js](https://github.com/MetaMask/metamask-extension/blob/main/ui/helpers/constants/design-system.js) | - | | as | The polymorphic `as` prop allows you to change the root HTML element of the Box component. Defaults to 'div' | 'div' | ## Usage diff --git a/ui/hooks/useTransactionInsights.js b/ui/hooks/useTransactionInsights.js index 997f74061194..13829f17f42e 100644 --- a/ui/hooks/useTransactionInsights.js +++ b/ui/hooks/useTransactionInsights.js @@ -22,7 +22,7 @@ const isAllowedTransactionTypes = (transactionType) => transactionType === TransactionType.tokenMethodTransfer; // A hook was needed to return JSX here as the way Tabs work JSX has to be included in -// https://github.com/MetaMask/metamask-extension/blob/develop/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js#L129 +// https://github.com/MetaMask/metamask-extension/blob/main/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js#L129 // Thus it is not possible to use React Component here const useTransactionInsights = ({ txData }) => { const dispatch = useDispatch();