1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 03:12:42 +02:00
metamask-extension/development
Howard Braham 9acd4b4ea1
feat(srp): add a quiz to the SRP reveal (#19283)
* feat(srp): add a quiz to the SRP reveal

* fixed the popover header centering

* lint fixes

* converted from `ui/components/ui/popover` to `ui/components/component-library/modal`

* responded to @darkwing review

* added unit tests

* renamed the folder to 'srp-quiz-modal'

* responded to Monte's review

* using i18n-helper in the test suite

* small improvement to JSXDict comments

* wrote a new webdriver.holdMouseDownOnElement() to assist with testing the "Hold to reveal SRP" button

* Updating layout and some storybook naming and migrating to tsx

* Apply suggestions from @georgewrmarshall

Co-authored-by: George Marshall <george.marshall@consensys.net>

* Unit test searches by data-testid instead of by text

* new layout and copy for the Settings->Security page

* now with 100% test coverage for /ui/pages/settings/security-tab
fixes #16871
fixes #18140

* e2e tests to reveal SRP after quiz

* e2e- Fix lint, remove unneeded extras

* @coreyjanssen and @georgewrmarshall compromise

Co-authored-by: George Marshall <george.marshall@consensys.net>
Co-authored-by: Corey Janssen <corey.janssen@consensys.net>

* trying isRequired again

* transparent background on PNG

* [e2e] moving functions to helpers and adding testid for SRP reveal quiz (#19481)

* moving functions to helpers and adding testid

* fix lint error

* took out the IPFS gateway fixes

* lint fix

* translations of SRP Reveal Quiz

* new Spanish translation from Guto

* Update describe for e2e tests

* Apply suggestion from @georgewrmarshall

Co-authored-by: George Marshall <george.marshall@consensys.net>

* fixed the Tab key problem

---------

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
Co-authored-by: Plasma Corral <32695229+plasmacorral@users.noreply.github.com>
Co-authored-by: Corey Janssen <corey.janssen@consensys.net>
2023-06-20 14:27:10 -04:00
..
build Implement tests for multiple service worker restarts on the mv3 build (#19293) 2023-06-20 11:17:08 +01:00
charts Adding artifacts (#15145) 2022-07-20 19:33:16 +04:00
fitness-functions Prevent new JS files in shared folder (#17737) 2023-04-24 15:44:42 +01:00
highlights Nit fixes for story-test integration (#17344) 2023-01-25 09:24:13 +05:30
lib Made builds.yml variable errors more helpful (#19066) 2023-05-09 21:47:42 +02:00
ts-migration-dashboard Release MultiChain 0.5 (#18903) 2023-06-01 16:14:38 -05:00
announcer.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
chromereload.js Build - refactor background process to use html (#10769) 2021-03-31 11:12:28 +08:00
create-static-server.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
empty.js Build - refactor background process to use html (#10769) 2021-03-31 11:12:28 +08:00
generate-beta-commit.js feat(17494): add generate-beta-commit (#17684) 2023-02-10 20:02:52 +00:00
generate-lavamoat-policies.js Have mmi build being generated (#19441) 2023-06-06 16:43:31 +01:00
generate-migration.sh Fix script to build migrations by having it use the .ts template (#18878) 2023-05-10 14:45:19 -04:00
get-changed-file-names.sh fix script for linting changed files (#17028) 2023-01-20 09:16:58 -06:00
get-next-semver-version.sh feat(action): github action to automatically add label "release-x.y.z" when PRs get merged (#19061) 2023-06-20 09:29:35 -03:00
gource-viz.sh chore: Adjust trailing whitespace (#15636) 2022-08-24 14:11:49 -05:00
jest.config.js split unit tests (#16455) 2023-01-11 12:23:38 -06:00
metamaskbot-build-announce.js fix: remove firefox build for beta (#18874) 2023-04-28 11:24:47 +01:00
missing-locale-strings.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
mock-segment.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
README.md [skip e2e] debug using source maps (#16933) 2022-12-13 14:29:38 +00:00
run-ganache.sh Fix the ganache:start command by making the 'yarn bin' usage compatible with yarn3 (#16983) 2022-12-16 11:43:06 -03:30
sentry-publish.js feat: add yaml feature management (#18125) 2023-04-25 16:32:51 +02:00
sentry-upload-artifacts.sh Automate the Flask release process (#13898) 2022-03-22 19:55:51 -07:00
shellcheck.sh Add lint:shellcheck:package (#7568) 2019-12-11 15:52:08 -05:00
show-deps-install-scripts.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
source-map-explorer.sh Excluding sourcemaps comment in production builds (#10695) 2021-03-22 19:41:23 -07:00
sourcemap-validator.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
static-server.js Remove use of pify from the static-server script (#18239) 2023-03-21 15:07:22 -02:30
stream-flat-map.js Build - refactor for bundle factoring and swappable runtime (#11080) 2021-07-15 10:59:34 -07:00
verify-locale-strings.js feat(srp): add a quiz to the SRP reveal (#19283) 2023-06-20 14:27:10 -04:00

Development

Several files which are needed for developing on MetaMask.

Usually each file or directory contains information about its scope / usage.

Segment

Debugging with the Mock Segment API

To start the Mock Segment API:

  • Add/replace the SEGMENT_HOST and SEGMENT_WRITE_KEY variables in .metamaskrc
    SEGMENT_HOST='http://localhost:9090'
    SEGMENT_WRITE_KEY='FAKE'
    
  • Build the project to the ./dist/ folder with yarn dist
  • Run the Mock Segment API from the command line
    node development/mock-segment.js
    

Events triggered whilst using the extension will be logged to the console of the Mock Segment API.

More information on the API and its usage can be found here.

Debugging in Segment

To debug in a production Segment environment:

  • Create a free account on Segment
  • Create a New Workspace
  • Add a Source (Node.js)
  • Copy the Write Key from the API Keys section under Settings
  • Add/replace the SEGMENT_HOST and SEGMENT_WRITE_KEY variables in .metamaskrc
    SEGMENT_HOST='https://api.segment.io'
    SEGMENT_WRITE_KEY='COPIED_WRITE_KEY'
    
  • Build the project to the ./dist/ folder with yarn dist

Events triggered whilst using the extension will be displayed in Segment's Debugger.

Debugging Segment requests in MetaMask

To opt in to MetaMetrics;

  • Unlock the extension
  • Open the Account menu
  • Click the Settings menu item
  • Click the Security & Privacy menu item
  • Toggle the Participate in MetaMetrics menu option to the ON position

You can inspect the requests in the Network tab of your browser's Developer Tools (background.html) by filtering for POST requests to /v1/batch. The full url will be http://localhost:9090/v1/batch or https://api.segment.io/v1/batch respectively.

Sentry

Debugging in Sentry

To debug in a production Sentry environment:

  • If you have not already got a Sentry account, you can create a free account on Sentry
  • Create a New Sentry Organization
    • If you already have an existing Sentry account and workspace, open the sidebar drop down menu, then click Switch organization followed by Create a new organization
  • Create a New Project
  • Copy the Public Key and Project ID from the Client Keys section under your projects Settings
    • Select Settings in the sidebar menu, then select Projects in the secondary menu. Click your project then select Client Keys (DSN) from the secondary menu. Click the Configure button on the Client Keys page and copy your Project Id and Public Key
  • Add/replace the SENTRY_DSN and SENTRY_DSN_DEV variables in .metamaskrc
    SENTRY_DSN_DEV=https://{SENTRY_PUBLIC_KEY}@sentry.io/{SENTRY_PROJECT_ID}
    SENTRY_DSN=https://{SENTRY_PUBLIC_KEY}@sentry.io/{SENTRY_PROJECT_ID}
    
  • Build the project to the ./dist/ folder with yarn dist

Errors reported whilst using the extension will be displayed in Sentry's Issues page.

Source Maps

Debugging production builds using Source Maps

To unbundle the extensions compiled and minified JavaScript using Source Maps:

  • Open Chrome DevTools to inspect the background.html or home.html view
  • Click on the Sources tab in Chrome DevTools
  • In the Sources tab, click on the Page panel
  • Expand the file directory in the Page panel until you see the source files you're after
  • Select a source file in the Page panel
chrome-extension://{EXTENSION_ID}/common-0.js
  • Double click the source file to open it in the Workspace
  • Right click in the body of the source file and select Add source map...
  • Enter the path to the corresponding source map file, and Click Add
file:///{LOCAL_FILE_SYSTEM}/metamask-extension/dist/sourcemaps/common-0.js.map
  • Repeat the steps above as necessary adding all the relevant source map files
  • Your source maps should now be added to the DevTools Console, and you should be able to see your original source files when you debug your code