1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
Commit Graph

558 Commits

Author SHA1 Message Date
David Walsh
6fa36cdf51
Provide New UI Components for EIP-1559 Designs (#11357) 2021-06-23 18:39:44 -05:00
Brad Decker
c30cb7d33a
Refactor send page state management (#10965) 2021-06-23 16:35:25 -05:00
Dan J Miller
be244f4908
Fix chromereload while on development (#11359) 2021-06-22 15:02:54 -02:30
Mark Stacey
cc90fca2f6
Add retries to the benchmark script (#11319)
The benchmark script can now be set to retry upon failure, like the E2E
tests do. The default is zero, just as with the E2E tests. A retry of 2
has been set in CI to match the E2E tests as well.

The `retry` module had to be adjusted to throw an error in the case of
failure. Previously it just set the exit code, but that only worked
because it was the last thing called before the process ended. That is
no longer the case.
2021-06-21 12:46:18 -02:30
Mark Stacey
7535d63466
Add run-e2e-test.js script (#11301)
This script makes it easier to run an individual E2E test. In the past
I've run individual scripts by editing `run-all.sh` manually, but now
that can be done more easily with this script. It also allows setting
the number of retries to use and the browser to use from the CLI.

This script has been added as an npm script as well, called
'test:e2e:single'.

The `run-all.sh` script was rewritten in JavaScript to make it easier
to pass through a `--retries` argument.

The default number of retries has been set to zero to make local
testing easier. It has been set to 2 on CI.

This was mainly done to consolidate the code used to run an E2E test in
one place, to make later improvements easier.
2021-06-15 15:21:25 -02:30
Mark Stacey
3540a5b4d4
Show Sentry CLI output when uploading artifacts (#11100)
The function we were using to run shell commands during the
`sentry:publish` script were swallowing the CLI output. We also weren't
correctly detecting the process exit in some cases.

The `run-command` module originally written for `auto-changelog`
(introduced in #10782 and replaced in #10993) has been resurrected for
running commands where we don't care about the output, or where we want
to use the output for something. A second function (`runInShell`) has
been added for running commands with the same STDOUT and STDERR
streams, so that the output is sent directly to the CLI. This ensures
that the console output from the shell script we run gets correctly
output to the CLI.
2021-05-19 14:54:45 -02:30
Mark Stacey
37dc19a352
Migrate Sentry settings to environment variables (#11085)
Sentry is now configured with environment variables, rather than with
hard-coded values. This makes it easier to test Sentry functionality
using a different Sentry account, as we did recently during QA of
v9.5.1.

The only change for the normal build process is the introduction of the
`SENTRY_DSN_DEV` variable, which can be set via `.metamaskrc` or via an
environment variable. This determines where error reports are sent. It
still defaults to our team Sentry account's `metamask-testing` project.

The `sentry:publish` script now requires SENTRY_ORG and SENTRY_PROJECT
to be set in order to publish release artifacts. The CircleCI
configuration has been updated with these values, so it should act the
same as it did before. Previously we had used a CLI flag to specify the
organization and project, but Sentry already natively supports these
environment variables [1].

[1]: https://docs.sentry.io/product/cli/configuration/#configuration-values
2021-05-18 13:56:22 -02:30
Mark Stacey
ff8c960ab6
Fix Sentry sourcemaps (#11051)
The method used for uploading release artifacts to Sentry has been
updated to allow `sentry-cli` to associate our minified bundles with
the corresponding source map file. This should help Sentry display rich
stack traces.

Previously Sentry had used the `sourceMappingURL` to associate source
maps with bundles, but we recently removed this in #10695. The hope is
that this change to the upload process will ensure the mapping works
correctly without the `sourceMappingURL` comment.

The `upload_bundles` function was removed because the later
`upload_sourcemaps` function actually uploaded both the bundles and
source maps.

The `--rewrite` flag was added to enable a newer "rewrite" feature of
the Sentry CLI that they recommend using [1]. This rewrite is where
they associate source maps with bundles.

The `url-prefix` has been updated to be `metamask` rather than
`sourcemaps`. I don't think `sourcemaps` was ever the correct prefix.
We normalize our errors to have the path `metamask/` before sending any
reports to Sentry.

[1]: https://docs.sentry.io/product/cli/releases/#sentry-cli-sourcemaps
2021-05-11 18:36:01 -02:30
Mark Stacey
36869a4350
Migrate version from _base manifest to package.json (#11029)
The version field is now stored in the main `package.json` file rather
than in the base manifest. It is built into the final manifest during
the build script.

This makes it easier to communicate what the current version should be
to our `auto-changelog` script. It's also generally a more conventional
place to keep track of the version, even considering that we're not
publishing to npm.
2021-05-10 14:16:03 -07:00
Mark Stacey
20b0346d8b
Replace auto-changelog script (#10993)
The `auto-changelog` script has been replaced with the package
`@metamask/auto-changelog`. This package includes a script that has
an `update` command that is roughly equivalent to the old
`auto-changelog.js` script, except better. The script also has a
`validate` command.

The `repository` field was added to `package.json` because it's
utilized by the `auto-changelog` script, and this was easier than
specifying the repository URL with a CLI argument.
2021-05-06 11:50:19 -02:30
Brad Decker
09d81ac5f2
remove the ui/app and ui/lib folders (#10911) 2021-04-28 14:53:59 -05:00
Mark Stacey
0dbd678f39
Fix crash when adding new changelog release header (#10870)
The `auto-changelog.js` script crashes when trying to add a new release
header. This bug was introduced in #10847. The cause was a simple
misnamed parameter.
2021-04-09 20:50:06 -02:30
Erik Marks
e18deda0da
@metamask/eslint-config*@6.0.0 (#10858)
* @metamask/eslint-config*@6.0.0

* Minor eslintrc reorg
2021-04-08 14:34:55 -07:00
Mark Stacey
e77aa0b7b5
Migrate unreleased changes in changelog (#10853)
When updating the changelog for a release candidate, any unreleased
changes are now migrated to the release header.

Generally we don't make a habit of adding changes to the changelog
prior to creating a release candidate, but if any are there we
certainly don't want them duplicated.
2021-04-08 17:53:00 -02:30
Mark Stacey
312f2afc41
Refactor changelog parsing and generation (#10847)
The `auto-changelog.js` script has been refactoring into various
different modules. This was done in preparation for migrating this to
a separate repository, where it can be used in our libraries as well.

Functionally this should act _mostly_ the same way, but there have been
some changes. It was difficult to make this a pure refactor because of
the strategy used to validate the changelog and ensure each addition
remained valid. Instead of being updated in-place, the changelog is now
parsed upfront and stored as a "Changelog" instance, which is a new
class that was written to allow only valid changes. The new changelog
is then stringified and completely overwrites the old one.

The parsing had to be much more strict, as any unanticipated content
would otherwise be erased unintentionally. This script now also
normalizes the formatting of the changelog (though the individual
change descriptions are still unformatted).

The changelog stringification now accommodates non-linear releases as
well. For example, you can now release v1.0.1 *after* v2.0.0, and it
will be listed in chronological order while also correctly constructing
the `compare` URLs for each release.
2021-04-08 16:14:30 -02:30
Mark Stacey
b65a94b7f3
Add --help flag to changelog script (#10846)
The changelog script now accepts a `--help` flag, which prints a help
text explaining how the script works and what each flag does.
2021-04-07 21:51:44 -02:30
Mark Stacey
482cbfe929
Add --rc flag to changelog script (#10839)
The changelog script now accepts an `--rc` flag to tell it whether to
add new changes to `Unreleased` or to the header for the current
version.

Previously this was inferred from whether the current version matched
the most recent tag. However this method only works for the first
update. Using a flag simplifies this logic, and makes it possible to
manually re-run this for further updates to a release candidate.
2021-04-07 16:47:41 -02:30
Mark Stacey
1c5dcd6efc
Add categories to each changelog release (#10837)
Each changelog release now has category headers. The standard "keep a
changelog" [1] categories are used, along with the addition of
"Uncategorized" for any changes that have not yet been categorized.

The changelog script has been updated to add this "Uncategorized"
header if it isn't already present, and to place any new commits under
this header.

The changelog has been updated to property categorize each change in
recent releases, and to place changes in older releases under the
header "Uncategorized".

[1]: https://keepachangelog.com/en/1.0.0/
2021-04-07 13:12:07 -02:30
Mark Stacey
7b44bb38eb
Add links to release headers (#10808)
Each release header now includes a link to the range of commits
included with that release. These links are at the end of the document,
in accordance with the "keep a changelog" [1] format.

For the purpose of this changelog, the "previous release" is the most
recent release mentioned in the changelogs. The diffs ignore any
releases that were omitted from the changelog. This is mainly an issue
with older releases, so it seemed acceptable. All releases have been
documented for a couple of years now, and will be going forward as
well.

The name of the "Current Develop Branch" section was changed to
"Unreleased" to confirm with "keep a changelog".

The `auto-changelog.js` script has been updated to update/add these
links whenever adding a new release header as well.

[1]: https://keepachangelog.com/en/1.0.0/
2021-04-06 16:47:41 -02:30
Mark Stacey
13862cbc1b
Update changelog headers and fix dates (#10805)
The changelog release header format has been updated to match the "keep
a changelog" [1] format. Each header is now the bracketed version
number followed by a dash, then the release date in ISO-8601 format.

The release dates in each header were also updated to match the date of
the corresponding GitHub Release [2]. Many of these dates were
incorrect because they were set on the day we created the release
candidate, rather than on the day of release.

Any changelog release entries without a corresponding GitHub release
was left with the date already specified.

The three oldest release headers were missing dates. For the first two,
I used the date of the version bump commit. For the third, I removed it
since no changes were listed anyway, and it represented a range of
releases rather than a single one.

The `auto-changelog.js` script has been updated to account for this new
format as well.

[1]: https://keepachangelog.com/en/1.0.0/
[2]: https://github.com/MetaMask/metamask-extension/releases
2021-04-02 18:17:04 -02:30
Brad Decker
f5c89843b1
remove node-sass dependency (#10797) 2021-04-02 11:57:05 -02:30
Mark Stacey
5b5a4f6fd9
Add release header when updating changelog (#10794)
The changelog update script now adds a release header if it doesn't
find one already that matches the current release candidate version.
2021-04-01 21:09:14 -02:30
Mark Stacey
1e562e9976
Prevent duplicate changelog entries (#10786)
The changelog update script now prevents duplicate entries from being
added. Specifically, it will ensure that if a PR has been referenced
already in an entry, it will not add it again.

This should prevent it from adding duplicate entries for changes that
were cherry-picked into hotfix releases.

Note that this duplication prevention only works for entries containing
a PR number. We don't have any way to prevent duplicate entries yet in
cases where we don't know the associated PR. We will be preventing this
possibility entirely pretty soon in some upcoming release automation
changes though, so I'm not concerned about this omission.
2021-04-01 12:54:06 -02:30
Mark Stacey
dc75c18bdf
Add changelog entries under release candidate header (#10784)
Instead of always placing new changelog entries under the "Current
Develop Branch" header, the changelog script now places them under the
header for the current release if that release has not yet been tagged.

This eliminates one manual step from the release process.

Relates to #10752
2021-04-01 12:28:50 -02:30
Mark Stacey
b1dcbcec2c
Rewrite changelog script from Bash to JavaScript (#10782)
The `auto-changelog` script has been rewritten from Bash to JavaScript.
Functionally it should behave identically.
2021-03-31 14:15:53 -02:30
Mark Stacey
b124ac29fc
Improve detection of task process exit (#10776)
Our build script waits for the `close` event to determine whether the
task has exited. The `exit` event is a better representation of this,
because if a stream is shared between multiple processes, the process
may exit without the `close` event being emitted.

We aren't sharing streams between processes, so this edge case doesn't
apply to us. This just seemed like a more suitable event to listen to,
since we care about the process exiting not the stream ending.

See this description of the `close` event from the Node.js
documentation [1]:

>The `'close'` event is emitted when the stdio streams of a child
>process have been closed. This is distinct from the `'exit'` event,
>since multiple processes might share the same stdio streams.

And see this description of the `exit` event:

>The `'exit'` event is emitted after the child process ends.

[1]: https://nodejs.org/docs/latest-v14.x/api/child_process.html#child_process_event_exit
2021-03-31 13:13:17 -02:30
kumavis
0040b66e5c
build - fix use of empty file to replace unused js files (#10780) 2021-03-31 16:13:37 +08:00
kumavis
952adbce44
Build - refactor background process to use html (#10769)
* build - declare background as html

* build - fill in empty file when a missing file is expected

* lint - fix

* Update development/build/manifest.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

* Update development/build/manifest.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-03-31 11:12:28 +08:00
kumavis
715f699ed9
build - refactor build system for easier configuration (#10718)
* build - refactor build system for easier configuration of before and after bundle

* build - fix dependenciesToBundle option

* build - fix bify external options and other config

* build - refactor for cleanliness

* build - fix minify argument

* build - fix sourcemaps setup

* scripts - refactor setupBundlerDefaults in anticipation of factor bundles

* build - scripts - remove unused pipeline label

* build - scripts - make filepath entry optional

* build - scripts - rename filepath and filename options to entryFilepath and destFilepath

* Update development/build/scripts.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-03-26 12:26:19 +08:00
ryanml
91e5b85955
Excluding sourcemaps comment in production builds (#10695)
* Excluding sourcemaps comment in production builds

Fixes MetaMask/metamask-extension#7077

* Fix source map explorer script

The source map explorer script now re-adds the source map comment to
each file to ensure the source map visualization still works. Each
module with a sourcemap is copied to a temporary directory along with
the module it corresponds to, and from there it's passed into
`source-map-explorer`. This should ensure the resulting visualization
matches what it was before.

Everything has been moved inside of functions to generally improve
readability, and to allow the use of local variables.

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-03-22 19:41:23 -07:00
ryanml
88ad383722
Fixing migration script generation paths (#10664) 2021-03-17 12:21:46 +08:00
Mark Stacey
eae04fc19e
Improve safety of source map explorer script (#10498)
The source map explorer script will now use `yarn` instead of `npx` to
create the visualizations, to ensure that it's using the exact version
of `source-map-explorer` that we have in our dependencies.

The standard set of Bash flags have been set as well, and the standard
Bash shebang we use. This ensures the script will fail if an error is
encountered.
2021-02-24 12:22:11 -03:30
Mark Stacey
23013b1ee9
Reduce build warnings related to Sass (#10494)
Build warnings related to Sass have been reduced by dynamically
importing `gulp-sass` and `sass-compiler` at the point where it's first
used. This ensures that the four Dart-related build warnings are only
emitted for the build process that is actually running Sass, rather
than by _every_ build process.
2021-02-23 13:04:14 -03:30
Mark Stacey
54c94e6b91
Fix library bundle visualizations (#10497)
The bundle visualizations for the library bundles has been fixed.
Previously it was trying to generate a visualization for the non-
existent 'libs.js' module. Now it correctly generates a visualization
for the 'ui-libs.js` and 'bg-libs.js' modules.
2021-02-23 12:59:07 -03:30
Mark Stacey
73e0fdddd0
Use .sh file extension for all Bash scripts (#10499)
The `.sh` file extension is now used for all Bash scripts. This ensures
the files are recognized as Bash scripts by the ShellCheck CI job, and
by editors/IDEs for improved syntax highlighting.
2021-02-23 12:56:41 -03:30
Brad Decker
aabe653240
Add Custom Network UI (#10310) 2021-02-22 10:20:42 -06:00
Etienne Dusseault
f196c9feb8
Add Lavamoat to build system (#9939)
* lavamoat - run build system in lavamoat

* lavamoat/allow-scripts - add missing policy entry

* update viz and lavvamoat

* trim policy file

* bump viz

* prue policy override

* regen policy file

* Update package.json

* Update package.json

* Apply suggestions from code review

Co-authored-by: kumavis <kumavis@users.noreply.github.com>

* update policy, remove redundant patches

* use yarn setup in CI

Co-authored-by: kumavis <aaron@kumavis.me>
Co-authored-by: kumavis <kumavis@users.noreply.github.com>
2021-02-22 22:43:29 +08:00
Mark Stacey
b885cd1b40
Ignore unit tests when verifying localized messages (#10449)
The `verify-locale-strings` script now ignores unit tests. This ensures
the use of a string literal in a unit test won't mistakenly make this
script believe that a message is used in the extension.

This came up recently in #10396, where the deletion of unit tests for
dead code triggered an unused message lint failure. This was then fixed
in #10395.
2021-02-15 11:57:28 -03:30
Brad Decker
8e2d4e6fdd
add MetaMaskTranslation component (#10405)
* add MetaMaskTranslation component

* add stories

* Update ui/app/components/app/metamask-translation/metamask-translation.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

* Update ui/app/components/app/metamask-translation/metamask-translation.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

* fix regex

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-02-12 11:24:50 -06:00
Erik Marks
76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00
kumavis
efd280172f
ci - run storybook and add to build-artifacts (#10360)
* ci - run storybook and add to build-artifacts

* ci/storybook - rename storybook build path and fix artifact upload

* ci/storybook - rename link text

* clean - remove accidently committed storybook build dir

* storybook - fix image path to relative (#10364)
2021-02-04 22:30:22 +08:00
Mark Stacey
181bd7bc16
Require English descriptions in locale files (#10260)
The `verify-locale-strings.js` script now validates that the
descriptions from the `en` locale are also present in all other
locales.

These descriptions are intended to help with translation, and are not
meant to be translated. This check will ensure that translators don't
accidentally translate these. It also ensures they're present alongside
each translated message, which might be helpful for understanding
context.
2021-02-03 15:19:41 +08:00
kumavis
b98cef16af
Update to Node v14 (#9514)
* manual rebase against develop

* Update .nvmrc
2021-02-03 13:45:38 +08:00
Mark Stacey
b441b7cfdc
Remove missing messages from verify locales script (#10259)
The report on missing messages has been removed from the verify
locales script. This report was making the console output of this
command unreasonably long, and would obscure the reports on any invalid
entries.

A new script was written to report on missing localized messages.
This can be run with the command `yarn locale-coverage`. This will
print a report to the console on the coverage for each locale.
2021-01-26 14:03:40 -03:30
Mark Stacey
5b1da2cd4b
Fix verification of single locale (#10262)
The `verify-locale-strings.js` script would blow up if you tried to
verify a single locale. It now works.
2021-01-26 13:29:14 -03:30
Mark Stacey
f6388f260b
Remove unused environment variables (#10234)
The environment variables `METAMETRICS_PROJECT_ID` and
`ETH_GAS_STATION_API_KEY` were still being injected into the JavaScript
build, despite being unused. The MetaMetrics project ID was made
obsolete in #9646, and the ETH Gas Station API key was made obsolete in
PR #9867
2021-01-21 17:04:10 -03:30
Brad Decker
acbe38c260
use dart sass, and update related modules (#10208) 2021-01-19 10:54:32 -06:00
Etienne Dusseault
69df19f195
Disable console in contentscript (#10040)
* Maintain console logging in dev mode

Co-authored-by: kumavis <aaron@kumavis.me>
Co-authored-by: Erik Marks <rekmarks@protonmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-12-14 11:17:13 -08:00
Mark Stacey
94f0588f0e
Add HTML coverage report to MetaMask bot comment (#10061)
The HTML code coverage report generated by `nyc` is now included in the
MetaMask bot comment. It has been saved as an artifact on CircleCI.
2020-12-11 16:21:00 -03:30
Mark Stacey
d8ec5f19f6
Use .zip for Firefox e2e tests (#10056)
The Firefox e2e tests now use the `.zip` file for testing the
extension. We've found this to produce more similar results to
production, compared to the old method of loading the unzipped
directory.

Passing in a `.zip` file to the Chrome driver didn't seem to work. I
didn't investigate this further to see if it was possible, but I'm not
sure it makes a difference on Chrome anyway.
2020-12-11 12:54:17 -03:30
Mark Stacey
f386e4ce4b
Rename lockdown.cjs to lockdown.js (#10026)
When you load an extension `.zip` file in Firefox, it fails to load
scripts with the `.cjs` file extension. However, it works if you load
the extension via the `manifest.json` file instead.

After renaming the `lockdown.cjs` file to `lockdown.js`, it works in
Firefox in all cases, regardless whether it's loaded by manifest or by
`.zip`.
2020-12-09 12:04:11 -03:30
Mark Stacey
d13aabde23
Fix SES lockdown on older browsers (#10014)
On older browsers that don't support `globalThis`[1], the SES lockdown
throws an error. The `globalthis` shim has been added to all pages, to
the background process, and to the `contentscript`. This should prevent
the error on older browsers.

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#Browser_compatibility
2020-12-08 15:08:31 -03:30
Etienne Dusseault
dd3f728e82
Remove redundant babelify (#9945) 2020-12-03 00:53:02 -03:30
Dan J Miller
97d268c8ee
Remove use of ethgasstation; use metaswap /gasPrices api for gas price estimates (#9867)
* Remove use of ethgassthat; use metaswap /gasPrices api for gas price estimates

* Remove references to ethgasstation

* Pass base to BigNumber constructor in fetchExternalBasicGasEstimates

* Update ui/app/hooks/useTokenTracker.js

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>

* Delete gas price chart

* Remove price chart css import

* Delete additional fee chart code

* Lint fix

* Delete more code no longer used after ethgasstation removal

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-12-02 19:55:19 -03:30
Erik Marks
9d4b8a4903
@metamask/contract-metadata (#9968) 2020-12-01 14:55:01 -08:00
Etienne Dusseault
9f6fa64d67
Add SES lockdown to extension webapp (#9729)
* Freezeglobals: remove Promise freezing, add lockdown

* background & UI: temp disable sentry

* add loose-envify, dedupe symbol-observable

* use loose envify

* add symbol-observable patch

* run freezeGlobals after sentry init

* use require instead of import

* add lockdown to contentscript

* add error code in message

* try increasing node env heap size to 2048

* change back circe CI option

* make freezeGlobals an exported function

* make freezeGlobals an exported function

* use freezeIntrinsics

* pass down env to child process

* fix unknown module

* fix tests

* change back to 2048

* fix import error

* attempt to fix memory error

* fix lint

* fix lint

* fix mem gain

* use lockdown in phishing detect

* fix lint

* move sentry init into freezeIntrinsics to run lockdown before other imports

* lint fix

* custom lockdown modules per context

* lint fix

* fix global test

* remove run in child process

* remove lavamoat-core, use ses, require lockdown directly

* revert childprocess

* patch package postinstall

* revert back child process

* add postinstall to ci

* revert node max space size to 1024

* put back loose-envify

* Disable sentry to see if e2e tetss pass

* use runLockdown, add as script in manifest

* remove global and require from runlockdown

* add more memory to tests

* upgrade resource class for prep-build & prep-build-test

* fix lint

* lint fix

* upgrade remote-redux-devtools

* skillfully re-add sentry

* lintfix

* fix lint

* put back beep

* remove envify, add loose-envify and patch-package in dev deps

* Replace patch with Yarn resolution (#9923)

Instead of patching `symbol-observable`, this ensures that all
versions of `symbol-observable` are resolved to the given range, even
if it contradicts the requested range.

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-24 11:26:43 +08:00
Etienne Dusseault
63f759e14e
build - catch build pipeline errors properly (#9840) 2020-11-20 11:56:40 -03:30
Mark Stacey
c4d71a3211
Exit sentry:publish with non-zero code upon failure (#9893)
The `sentry:publish` script now exits with an exit code of `1` upon
failure, indicating that something went wrong. Previously it would exit
with a code of `0`, indicating to CI that everything worked correctly.

The script will now also exit early if the authentication check fails.
2020-11-17 09:37:15 +08:00
Mark Stacey
4cdf251ea5
Add mock Segment server (#9783)
This mock Segment server can be used to test our extension metrics. It
will respond to all request with HTTP 200, and will print the requests
to the console. It also has parsing built-in for Segment request
payloads.

Right now only the event name is printed, but we can enhance this in
the future to print more event information. We can also enhance the
mock to be a more realistic representation of the API.

The extension has been modified to allow the Segment host to be
overwritten with the `SEGMENT_HOST` environment variable. This will
ensure that all Segment events are redirected to that host.

So for example, to create a dev build that uses this server, you could
set the `SEGMENT_WRITE_KEY` and `SEGMENT_LEGACY_WRITE_KEY` values to
any non-empty string, and set `SEGMENT_HOST` to
`http://localhost:9090`.

This was created originally to test PR #9768
2020-11-09 18:15:23 -03:30
Brad Decker
026a06b39d
add shared transaction constants (#9459)
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-11-03 16:57:51 -06:00
Mark Stacey
ba6509c7a3
Simplify handling of Segment keys (#9781)
It was getting rather complicated to keep track of which Segment keys
were set where, and under which name.

The build script now injects a key even in test environments, but it is
unused if `IN_TEST` is truthy. This should be functionally equivalent
to the old logic. I find this simpler mainly for two reasons: there is
one less intermediate variable to keep track of now, and the `IN_TEST`
check is now directly in the module where we're constructing the
`segment` instance, rather than being referenced at a distance in a
comment.

The old setup made it difficult to turn on metrics for specific e2e
tests as well, which will be done in a subsequent PR.
2020-11-03 17:11:24 -03:30
Brad Decker
2ebf8756a4
[RFC] add prettier to eslint (#8595) 2020-11-02 17:41:28 -06:00
Brad Decker
c130a7ae6c
prevent environment key from leaking into all builds (#9752) 2020-10-29 09:31:04 -05:00
Brad Decker
7d50357684
remove matomo and route to segment (#9646) 2020-10-26 14:05:57 -05:00
Mark Stacey
84bd2dcce7
Remove unused parameter in styles build script (#9710)
The `devMode` parameter being passed to the `buildScss` function was
not being used. The `buildScss` function was declared _inside_ the
function in which it is invoked, so the `devMode` variable is already
in scope - it doesn't need to be passed in.
2020-10-26 11:01:07 -02:30
Mark Stacey
ffb36f95ef
Fix yarn build styles:dev (#9709)
The `styles:dev` step of the development build was broken in #9568 when
the `lockdown()` function from SES was introduced. One of the effects
of `lockdown()` is preventing the use of `RegExp.lastMatch`, which is
relied upon by `postcss` for parsing inline sourcemaps.

This problem has been worked around by re-arranging the build pipeline
for styles.

Firstly, the `autoprefixer` stage was moved _before_ sourcemaps were
generated. Its placement _after_ sourcemaps was a mistake in the first
place - it should have always been before they were written, so that
the sourcemaps could keep track of the changes made by `autoprefixer`.

Second, the `-rtl` sourcemap generation was moved to a separate build
pipeline. The `rtl` stage also uses `postcss`, and it must come after
the sourcemaps are written for the non-RTL styles, so splitting it into
a separate build was the only way to avoid passing in inline
sourcemaps. This does make the build slightly slower, but it also
decreases the size of the RTL sourcemaps dramatically.
2020-10-25 16:25:24 -02:30
Etienne Dusseault
69d45ab46c
Add ses lockdown to build system (#9568)
* Add ses lockdown to build system using lavamoat-core

* use proper object.assign version

* disable lint rules for ses lockdown

* deps - update rtlcss

Co-authored-by: kumavis <aaron@kumavis.me>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-23 21:04:42 -02:30
Whymarrh Whitby
b704eaeb66
Fix node/no-path-concat issues (#9669)
Refs #9663

See [`node/no-path-concat`][1] for more information.

This change enables `node/no-path-concat` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-path-concat.md
2020-10-22 00:04:52 -02:30
Mark Stacey
7d0a7ab301
Update @metamask/eslint-config to v4.1.0 (#9663)
`@metamask/eslint-config` has been updated to v4.1.0. This update
requires that we update `eslint` to v7 as well, which in turn requires
updating most `eslint`-related packages.

Most notably, `babel-eslint` was replaced with `@babel/eslint-parser`,
and `babel-eslint-plugin` was replaced by `@babel/eslint-plugin`. This
required renaming all the `babel/*` rules to `@babel/*`.

Most new or updated rules that resulted in lint errors have been
temporarily disabled. They will be fixed and re-enabled in subsequent
PRs.
2020-10-21 14:01:03 -02:30
Ari Lotter
c3fafe311e
Spawn yarn processes in a cmd subshell on Windows (#9628)
On Windows, spawn fails if the exact filename
of a binary isn't passed. e.g. `spawn('yarn')` fails
because the binary is named `yarn.cmd`.
Instead, we depend on `cross-spawn` which handles differences
in `spawn` across platforms.
2020-10-20 01:37:23 -02:30
Erik Marks
5b8c07817a
Remove localhost provider type (#9551)
* Delete localhost provider type

* Use ganache-cli default chain ID for tests

* Delete unused test firstTimeState variable

* Migrate default ganache-cli network to frequentRpcListDetail

* Add default test provider state

* Add test functionality to createJsonRpcClient

* Lint locales

* Update test middleware creation

* fixup! Update test middleware creation
2020-10-12 12:05:40 -07:00
Brad Decker
8b24f624dd
add segment implementation of metametrics (#9382)
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-09-14 12:04:05 -05:00
Whymarrh Whitby
1757c63473
Always use null Infura project ID in testing (#9393) 2020-09-10 15:52:50 -02:30
Whymarrh Whitby
e2dedaacdb
Use Infura v3 API (#9368)
* Use eth-json-rpc-infura@5.0.0
* Use Infura v3 API
* Add example .metamaskrc file
2020-09-10 13:46:00 -02:30
Whymarrh Whitby
b6ccd22d6c
Update ESLint shared config to v3 (#9274)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-08-19 13:57:05 -02:30
Whymarrh Whitby
6ab12001e3
Fix prefer-destructuring issues (#9263)
See [`prefer-destructuring`](https://eslint.org/docs/rules/prefer-destructuring) for more information.

This change enables `prefer-destructuring` and fixes the issues raised by the rule.
2020-08-18 17:36:58 -02:30
Whymarrh Whitby
c1e3c229bc
Fix import/order issues (#9239)
See [`import/order`](https://eslint.org/docs/rules/import/order) for more information.

This change enables `import/order` and fixes the issues raised by the rule.
2020-08-18 16:48:25 -02:30
Whymarrh Whitby
4357cda7b8
Fix no-shadow issues (#9246)
See [`no-shadow`](https://eslint.org/docs/rules/no-shadow) for more information.

This change enables `no-shadow` and fixes the issues raised by the rule.
2020-08-18 14:06:45 -02:30
Whymarrh Whitby
5d42a9b773
Fix require-unicode-regexp issues (#9212)
* Fix require-unicode-regexp issues

See [`require-unicode-regexp`](https://eslint.org/docs/rules/require-unicode-regexp) for more information.

This change enables `require-unicode-regexp` and fixes the issues raised by the rule.

* Remove case-insensitive flag from regexps
2020-08-14 09:18:42 -02:30
Whymarrh Whitby
884775cf71
Fix no-negated-condition issues (#9222)
See [`no-negated-condition`](https://eslint.org/docs/rules/no-negated-condition) for more information.

This change enables `no-negated-condition` and fixes the issues raised by the rule.
2020-08-14 09:17:43 -02:30
Whymarrh Whitby
c11888f287
Fix no-empty-function issues (#9216)
See [`no-empty-function`](https://eslint.org/docs/rules/no-empty-function) for more information.

This change enables `no-empty-function` and fixes the issues raised by the rule.
2020-08-14 09:17:02 -02:30
Whymarrh Whitby
310b15ba4a
Fix no-plusplus issues (#9206)
See [`no-plusplus`](https://eslint.org/docs/rules/no-plusplus) for more information.

This change enables `no-plusplus` and fixes the issues raised by the rule.
2020-08-12 20:36:44 -02:30
Whymarrh Whitby
88f54e29fb
Fix no-empty issues (#9202)
See [`no-empty`](https://eslint.org/docs/rules/no-empty) for more information.

This change enables `no-empty` and fixes the issues raised by the rule.
2020-08-12 18:20:29 -02:30
Whymarrh Whitby
a8863a3446
Fix consistent-return issues (#9192)
See [`consistent-return`](https://eslint.org/docs/rules/consistent-return) for more information.

This change enables `consistent-return` and fixes the issues raised by the rule.
2020-08-12 16:36:57 -02:30
Mark Stacey
e1b9cfa5f8
Update source map validator target files (#9133)
All JavaScript files included in the final bundle are now listed as
target files. The `phishing-detect.js` file is the only new file to be
validated that was not validated before.

Any files that are expected to fail validation are commented out, with
a note explaining why they're expected to fail.
2020-08-04 13:45:03 -03:00
Mark Stacey
7f87bdb213
Improve sourcemap validator console report (#9131)
The report printed to the console for invalid source map samples has
been improved in a few ways:

* The entire message is now printed using `console.error`, so the
contents aren't split between STDERR and STDOUT
* The code fence is now guaranteed to be a set length, rather than it
varying depending on the filename
* The code fence is no longer padded on the inside with newlines, which
results in a more compact output that is (in my opinion) just as
readable.
2020-08-04 12:55:11 -03:00
Mark Stacey
5df42c09d6
Non-zero exit code upon failure to validate source maps (#9132)
The source map validator will now exit with a non-zero exit code when
an error occurs, or when the source maps cannot be validated.
2020-08-04 12:09:02 -03:00
Mark Stacey
9e12cdc01b
Factor out getEnvironment function in build script (#9114)
There are no functional changes. This was extracted from #8170
2020-07-30 16:19:42 -03:00
Mark Stacey
a69245d9ba
Improve source maps (#9101)
Our source maps were being corrupted during minification, because the
`gulp-terser-js` plugin we were using didn't account for the existence
of sourcemaps in the input. A configuration option to allow the input
of sourcemaps was added in v5.2.0. The plugin has been updated, and we
now use this option.

Previously the generated sourcemaps had an invalid entry in the
"sources" array, with the filename of the bundle itself. This was not a
real source. After this change, this invalid source is no longer
present.
2020-07-29 17:31:01 -03:00
Mark Stacey
d7a5319222
Use environment variable for production Sentry DSN (#9097)
The Sentry DSN is now expected to be provided via environment variable
for production builds. The build script will fail if it is missing, and
an error will be thrown at runtime if it is missing.

The `SENTRY_DSN` environment variable has been set in CI to the old
value for `SENTRY_PROD_DSN`. We can migrate to a new DSN at some point
in the future.
2020-07-29 13:14:08 -03:00
Mark Stacey
8a7c8e8aeb
Use environment variable for MetaMetrics project ID (#9094)
The MetaMetrics project ID can now be set via environment variable. It
has not been set yet in practice, so for now the old project IDs will
still be used. This is in preparation for migrating to a new project.
2020-07-28 16:59:27 -03:00
Whymarrh Whitby
2ae4720443
Fix words (#9038) 2020-07-20 14:32:49 -02:30
Whymarrh Whitby
983e32274c Fix array-callback-return issues
See [`array-callback-return`](https://eslint.org/docs/rules/array-callback-return) for more information.

This change enables `array-callback-return` and fixes the issues raised by the
rule.
2020-07-17 16:03:33 -02:30
Whymarrh Whitby
4f0a205369
Use eslint@6.8.0 (#8978)
* Use eslint@6.8.0
* yarn lint:fix
2020-07-14 12:50:41 -02:30
Mark Stacey
2856af2336
Remove integration tests (#8959)
The remaining integration tests are all covered by e2e tests, so
they're no longer needed.

All associated scripts, fixtures, and dependencies have also been
removed.
2020-07-10 12:22:36 -03:00
Mark Stacey
46675f78ae
Split createStaticServer from static-server.js (#8955)
The `createStaticServer` function was split from the `static-server.js`
script, so that the static server could be constructed
programmatically. `static-server.js` remains responsible for the CLI.

This was done to make it easier to programmatically start the test dapp
from e2e tests.
2020-07-10 00:15:29 -03:00
Mark Stacey
b10986ddaa
Exit with non-zero exit code upon failure (#8901)
The `static-server` script now exits with a code of `1` upon failure.
Previously it would print the error to the console but exit with a code
of `0`, indicating success.
2020-07-02 23:33:55 -03:00
Mark Stacey
f5d4ab1cc1
Include relative time polyfill locale data (#8896)
We were including the polyfill for the `Intl.RelativeTimeFormat` API,
but we weren't including any locale data. This polyfill doesn't work
without the locale data for whichever locale you're formatting.

The data for all locales we support is now included. The locale data
is loaded from disk as-needed (during app startup, and upon each change
in locale).
2020-07-02 21:34:48 -03:00
Whymarrh Whitby
80132f5580
Add envar for ETH Gas Station API key (#8870) 2020-06-29 14:56:21 -02:30
Erik Marks
4dfe4e7463
Consolidate connected account alerts (#8802)
* update connected accounts appearance

* consolidate account alerts

* UnconnectedAccountAlert: use ConnectedAccountsList

* move switch account action out of menu in all views

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-15 12:08:53 -07:00
Mark Stacey
df85ab6e10
Implement asset page (#8696)
A new page has been created for viewing assets. This replaces the old
`selectedToken` state, which previously would augment the home page
to show token-specific information.

The new asset page shows the standard token overview as seen previously
on the home page, plus a history filtered to show just transactions
relevant to that token.

The actions that were available in the old token list menu have been
moved to a "Token Options" menu that mirrors the "Account Options"
menu.

The `selectedTokenAddress` state has been removed, as it is no longer
being used for anything.

`getMetaMetricState` has been renamed to `getBackgroundMetaMetricState`
because its sole purpose is extracting data from the background state
to send metrics from the background. It's not really a selector, but
it was convenient for it to use the same selectors the UI uses to
extract background data, so I left it there for now.

A new Redux store has been added to track state related to browser history.
The most recent "overview" page (i.e. the home page or the asset page) is
currently being tracked, so that actions taken from the asset page can return
the user back to the asset page when the action has finished.
2020-06-01 14:54:32 -03:00
Dan J Miller
6074f43925
Use yarn instead of npm in development/run-ganache (#8674) 2020-05-28 09:05:00 -02:30
Brad Decker
706dc02cb4
Implement new transaction list design (#8564)
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-05-26 15:49:11 -05:00
ricky
c413d0905f
Add dev config to login automagically based on dot file (#8598)
* Add dev config to login automagically based on runtime config

Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-05-15 12:40:06 -07:00
Mark Stacey
53ec42d95f
Add switch to connected account alert (#8532)
Add alert suggesting that the user switch to a connected account. This
alert is displayed when the popup is opened over an active tab that is
connected to some account, but not the current selected account. The
user can choose to switch to a connected account, or dismiss the alert.

This alert is only shown once per account switch. So if the user
repeatedly opens the popup on a dapp without switching accounts, it'll
only be shown the first time. The alert also won't be shown if the user
has just dismissed an "Unconnected account" alert on this same dapp
and account, as that would be redundant.

The alert has a "Don't show me this again" checkbox that allows the
user to disable the alert. It can be re-enabled again on the Alerts
settings page.
2020-05-12 10:01:52 -03:00
Jenny Pollack
e00982aa58
add version dimension to metrics event (#8419)
* add version dimension to metrics event

* mock global.platform.getVersion

Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-05-05 15:40:36 +02:00
Mark Stacey
165666b315
Remove unnecessary tx meta properties (#8489)
* Remove `estimatedGas` property from `txMeta`

The `estimatedGas` property was a cache of the gas value estimated for
a transaction when the default gas limit was set. This property wasn't
used anywhere. It may have been useful for debugging purposes, but the
same gas estimate is already stored on the `history` property so it
should be present in state logs regardless.

* Remove `gasLimitSpecified` txMeta property

The `gasLimitSpecified` property of `txMeta` wasn't used for anything.
It might have been useful for debugging purposes, but whether or not
the gas limit was specified can also be determined from looking at the
transaction history, so it's not a huge loss.

* Remove `gasPriceSpecified` txMeta property

The `gasPriceSpecified` property of `txMeta` wasn't used for anything.
It might have been useful for debugging purposes, but whether or not
the gas price was specified can also be determined from looking at the
transaction history, so it's not a huge loss.

* Remove `simpleSend` txMeta property

The `simpleSend` property of `txMeta` was used to ensure a buffer was
not added to the gas limit during gas estimation for simple send
transactions. It was made redundant by #8484, which accomplishes this
without the use of this property.
2020-05-01 08:44:05 -03:00
Mark Stacey
53feb20803
Alert user upon switching to unconnected account (#8312)
An alert is now shown when the user switches from an account that is
connected to the active tab to an account that is not connected. The
alert prompts the user to dismiss the alert or connect the account
they're switching to.

The "loading" state is handled by disabling the buttons, and the error
state is handled by displaying a generic error message and disabling
the connect button.

The new reducer for this alert has been created with `createSlice` from
the Redux Toolkit. This utility is recommended by the Redux team, and
represents a new style of writing reducers that I hope we will use more
in the future (or at least something similar). `createSlice` constructs
a reducer, actions, and action creators automatically. The reducer is
constructed using their `createReducer` helper, which uses Immer to
allow directly mutating the state in the reducer but exposing these
changes as immutable.
2020-04-29 14:10:51 -03:00
Mark Stacey
1697bb30cd
Fix page benchmark result display (#8438)
The page tested by the benchmark was changed from `notification` to
`home` in #8358, but the announce script was still expecting the
`notification` page to be in the results. It does collect results for
all pages, but the `notification` page was hard-coded to be used for
the benchmark summary.

The announce script now correctly looks for the `home` page results for
the benchmark summary. Variable names have been updated to make it more
clear what's going on here as well.
2020-04-28 09:50:21 -03:00
Mark Stacey
bace02ad02
Remove unused ShapeShift components (#8402)
The `shift-list-item` component for displaying ShapeShift transactions
has been removed, along with three other components that were used
solely by that component (`copyButton`, `eth-balance`, and
`fiat-value`).

This component hasn't been used in some time, as ShapeShift
transactions no longer exist to display. The controller that ShapeShift
transactions originated from was removed in #8118, and it became
impossible to create new ShapeShift transactions from within MetaMask
in #6746
2020-04-24 12:33:24 -03:00
Mark Stacey
3620146e63
Remove unused transForward state and actions (#8401)
The `transForward` app state is no longer used, so it has been removed.
Associated actions have been removed as well.

This state dates back a few years, so I was unable to determine when it
was made obsolete.
2020-04-23 20:32:08 -03:00
Mark Stacey
c2e95d8672
Remove unused states (#8345)
These state files were snapshots of the Redux state used for
integration tests that have since been removed. Only three of these
states were still used - the three that correspond with the remaining
integration tests.

The default state used when the test environment is spun up was changed
to be the first of these three (`confirm sig requests`) so that the old
default state could safely be removed as well.
2020-04-16 12:27:25 -03:00
Mark Stacey
5ee1291662
Prevent accidental use of globals (#8340)
Previously all browser globals were allowed to be used anywhere by
ESLint because we had set the `env` property to `browser` in the ESLint
config. This has made it easy to accidentally use browser globals
(e.g. #8338), so it has been removed. Instead we now have a short list
of allowed globals.

All browser globals are now accessed as properties on `window`.

Unfortunately this change resulted in a few different confusing unit
test errors, as some of our unit tests setup assumed that a particular
global would be used via `window` or `global`. In particular,
`window.fetch` didn't work correctly because it wasn't patched by the
AbortController polyfill (only `global.fetch` was being patched).
The `jsdom-global` package we were using complicated matters by setting
all of the JSDOM `window` properties directly on `global`, overwriting
the `AbortController` for example.

The `helpers.js` test setup module has been simplified somewhat by
removing `jsdom-global` and constructing the JSDOM instance manually.
The JSDOM window is set on `window`, and a few properties are set on
`global` as well as needed by various dependencies. `node-fetch` and
the AbortController polyfill/patch now work as expected as well,
though `fetch` is only available on `window` now.
2020-04-15 14:23:27 -03:00
Mark Stacey
12536aa47f
Remove unused isPopup state (#8280)
This property was being set upon each change to background state.
2020-04-01 20:01:47 -03:00
Mark Stacey
b30a352acb
Use @fortawesome/fontawesome-free npm package (#8256)
The official npm package for Font Awesome Free is now used instead of
the vendored styles. Previously we had been using v4.4.0, now we're
using v5.13.0.

We're now importing the Font Awesome SCSS modules instead of using the
minified CSS bundle. This integrates more cleanly into our build
system, and it lets us use their mixins directly in the future if we
need to.

The variable `fa-font-path` has been set to reference our font
directory, as instructed here:
https://fontawesome.com/how-to-use/on-the-web/using-with/sass#compile
2020-03-30 20:05:51 -03:00
kumavis
7686edadb0
Build system refactor (#8140)
* build - start static asset task cleanup

* build - simplify manifest tasks

* build - refactor + rename some tasks

* build - various cleanups

* manifest - fix ref from controller

* build - drop gulp for simple async tasks

* build - breakout gulpfile into multiple files

* build - rename some tasks

* build - use task fn refs instead of string names

* build - bundle all scripts first, except for contentscript

* build - improve task timeline

* deps - update lock

* build - improve task time printout

* build/scripts - remove intermediate named task

* build - use 'yarn build' for task entry points

* build - properly run tasks via runTask for timeline display

* development/announcer - fix manifest path + clean

* build - lint fix

* build - make all defined tasks possible entry points

* build/task - properly report errors during task

* ci - fix sesify/lavamoat-viz build command

* build/scripts - run each bundle in separate processes

* lint fix

* build - forward childProcess logs to console

* build/task - fix parallel/series stream end event

* build/scripts refactor contentscript+inpage into a single task

* build/static - use the fs for 150x speedup zomg

* lint fix

* build/static - fix css copy

* Update development/build/scripts.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/scripts.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/index.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* deps - remove redundant mkdirp

* deps - remove unused pumpify

* deps - remove redundant merge-deep

* deps - prefer is-stream of isstream

* deps - remove clone for lodash.cloneDeep

* clean - remove commented code

* build/static - use fs.copy + fast-glob instead of linux cp for better platform support

* build/manifest - standardize task naming

* build/display - clean - remove unused code

* bugfix - fix fs.promises import

* build - create "clean" as named task for use as entrypoint

* build/static - fix for copying dirs

* Update development/build/task.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/display.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/display.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/display.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* build - use task refs, tasks only return promises not streams, etc

* lint fi bad merge + lint

* build - one last cleanup + refactor

* build - add comments introducing file

* build/manifest - fix bug + subtasks dont beed to be named

* Update package.json

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* build/task - remove unused fn

* Update package.json

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/styles.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Update development/build/styles.js

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-03-09 08:55:02 +08:00
Erik Marks
2df8b85c5f
LoginPerSite: Support multiple accounts without automatic switching (#8079)
* transaction editing: use txParams 'from' account

* signature-request: use txParams 'from' account

* signature-request-original: use txParams 'from' account

* encryption/decryption: use txParams 'from' account

* update tests

* set 'send' state 'from' address in confirm containers
2020-03-06 13:34:56 -08:00
Erik Marks
5d1f3c1436
Delete shapeshift functionality; retain state and display (#8118)
* delete shapeshift functionality; retain state and display
2020-02-26 09:34:46 -08:00
Whymarrh Whitby
a78cf0ef3a Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
Whymarrh Whitby
1d654d6c4e
Remove version bump scripts (#8006) 2020-02-06 18:56:31 -03:30
Whymarrh Whitby
dea8f0f24d
Use combineReducers for rootReducer (#7964) 2020-02-06 13:08:14 -03:30
Mark Stacey
398a45bfdd
Replace clone dependency with cloneDeep from lodash (#7926)
This was done to reduce the number of direct dependencies we have. It
should be functionally equivalent. The bundle size should not change,
as we use `clone` as a transitive dependency in a number of places.
2020-01-29 13:14:33 -04:00
Mark Stacey
ffd24a2854
Remove JSDoc tools (#7897)
Our JSDoc documentation has not been updated in a very long time, and
we don't use JSDoc in enough places for the docs to have been
especially useful. The tools and scripts  used to generate and publish
these docs have been removed.

References to this documentation have also been removed from the
README.

Hopefully once the TypeScript migration has made substantial progress,
we can generate more useful documentation using something like TypeDoc.
2020-01-28 13:02:49 -04:00
Mark Stacey
7908232719
Replace request-promise with node-fetch (#7899)
`node-fetch` is a smaller and simpler project than `request-promise`,
and we already have it as a transitive dependency.

`request-promise` was also incorrectly listed as a production
dependency. `node-fetch` has been added as a `devDependency` to replace
it, as it was only used in one CI script.
2020-01-26 12:43:50 -04:00
Mark Stacey
550fba2466
Add benchmark to CI (#7871)
* Add benchmark to CI

The page load benchmark for Chrome is now run during CI, and the
results are collected and summarized in the `metamaskbot` comment.

Closes #6881

* Double default number of samples

The number of default samples was changed from 10 to 20. The results
from 10 samples would show statistically significant changes in page
load times between builds, so weren't a sufficiently useful metric.
2020-01-23 16:55:17 -04:00
Whymarrh Whitby
92971d3c87
Migrate codebase to use ESM (#7730)
* Update eslint-plugin-import version

* Convert JS files to use ESM

* Update ESLint rules to check imports

* Fix test:unit:global command env

* Cleanup mock-dev script
2020-01-09 00:04:58 -03:30
Frankie
237d0b4d41 Add tests around migration files (#7016) 2019-12-12 20:44:29 -03:30
Mark Stacey
2e188ce4ef
Remove unused fromDropdownOpen state in send reducer (#7700)
The unused state has been removed along with associated actions and
action creators.
2019-12-12 19:26:18 -04:00
Erik Marks
f9eac81a85
Disallow template strings to t function in verify-locales script (#7694) 2019-12-12 08:49:52 -08:00
ricky
e5682eec38
Add lint:shellcheck:package (#7568)
* Add lint:shellcheck:package

* Add double quote as per jq suggestion

* Use single quotes

* Ignore SC2016

* Use shellcheck script

* Set some flags

* Put shellcheck --version on new line

* Disable SC2016 (singe quotes is actually what we want here)
2019-12-11 15:52:08 -05:00
Whymarrh Whitby
c8d8d8d93d
Remove link to missing Edge build from MMbot comment (#7682) 2019-12-10 16:33:58 -03:30
Mark Stacey
975419db54
Add ESLint rule no-async-promise-executor (#7659)
This rule prevents using an async function as a Promise executor (e.g.
as the argument to a `Promise` constructor). This pattern is usually a
mistake because it implies that the Promise constructor was not
necessary in the first place. It also makes error handling difficult,
as any errors thrown would be uncaught unless you wrap the body in a
try/catch block.
2019-12-06 11:32:36 -04:00
Mark Stacey
e060e4c71f
Improve Sentry publish script (#7417)
The script will now throw an error if it fails to upload build
artifacts, rather than failing silently.
2019-12-05 17:59:48 -04:00
Whymarrh Whitby
274a9ecf53 yarn lint --fix 2019-12-03 17:20:55 -03:30
Whymarrh Whitby
2e69f3233e
eslint: Enable more react/jsx-* rules (#7592) 2019-12-03 13:05:44 -03:30
Whymarrh Whitby
e61745a821
Enable no-var rule for ESLint (#7590)
* eslint: Enable no-var rule
* yarn lint --fix
2019-12-03 11:22:01 -03:30
Whymarrh Whitby
13a1de061d
Allow translation keys to be in single- or double-quotes (#7588) 2019-11-27 18:50:00 -03:30
Whymarrh Whitby
926c8848f1
Enable default-case rule for ESLint (#7572)
* eslint: Enable default-case rule

* Fix missing default cases

* Fix tests failing due to incorrect assumptions
2019-11-27 12:38:35 -03:30
Whymarrh Whitby
1501742d68
Convert dev scripts to use JSX (#7555) 2019-11-25 10:02:09 -03:30
Mark Stacey
f763979bed
Add support for one-click onboarding (#7017)
* Add support for one-click onboarding

MetaMask now allows sites to register as onboarding the user, so that
the user is redirected back to the initiating site after onboarding.
This is accomplished through the use of the `metamask-onboarding`
library and the MetaMask forwarder.

At the end of onboarding, a 'snackbar'-stype component will explain to the
user they are about to be moved back to the originating dapp, and it will
show the origin of that dapp. This is intended to help prevent phishing
attempts, as it highlights that a redirect is taking place to an untrusted
third party.

If the onboarding initiator tab is closed when onboarding is finished,
the user is redirected to the onboarding originator as a fallback.

Closes #6161

* Add onboarding button to contract test dapp

The `contract-test` dapp (run with `yarn dapp`, used in e2e tests) now
uses a `Connect` button instead of connecting automatically. This
button also serves as an onboarding button when a MetaMask installation
is not detected.

* Add new static server for test dapp

The `static-server` library we were using for the `contract-test` dapp
didn't allow referencing files outside the server root. This should
have been possible to work around using symlinks, but there was a bug
that resulted in symlinks crashing the server.

Instead it has been replaced with a simple static file server that
will serve paths starting with `node_modules` from the project root.
This will be useful in testing the onboarding library without vendoring
it.

* Add `@metamask/onboarding` and `@metamask/forwarder`

Both libraries used to test onboarding are now included as dev
dependencies, to help with testing. A few convenience scripts
were added to help with this (`yarn forwarder` and `yarn dapp-forwarder`)
2019-11-22 13:03:51 -04:00
Whymarrh Whitby
aa41057628
Update ESLint rules for curly braces style (#7477)
* eslint: Enable curly and brace-style

* yarn lint --fix
2019-11-19 20:33:20 -03:30
ricky
476274474f
Add shellcheck lint (#7392)
* Add shellcheck lint script

* Add to build

* Add shellcheck lint to main lint task

* Put shellcheck in the right place, hopefully?

* Fix declared multiple executor types

* Add sudo

* Address shellcheck warnings

* Add test-lint-shellcheck

* Add test-lint-shellcheck to workflow

* Use correct lint task

* output version which could be helpful for debugging

* Address PR feedback

* consistency++
2019-11-19 10:46:10 -05:00
Mark Stacey
9ca22d8fae Disable import/no-unresolved on lines that require build
Certain lines only work after a build stage has been completed, so
these failure can be ignored by the no-unresolved rule.
2019-11-14 09:17:55 -04:00
Dan J Miller
970e90ea70
Add migration on 3box imports and remove feature flag (#7209)
* Delete unused code

* Run threebox imports through migrations

* Remove 3box feature flag

* Remove unnecessary use of 'type' in threebox._updatePlugin

* Fix threebox controller getLastUpdated

* Turn off threebox by default

* Rename restoredFromThreeBox to showRestorePrompt

* Remove accientally added method from threebox controller

* Restore from threebox on import from unlock screen

* Throw on non 404 errors from Box.getconfig in new3Box
2019-09-26 03:24:52 -04:00
kumavis
e1efb4d7ac
ci - install deps - limit install scripts to whitelist (#7208)
* ci - install deps - limit install scripts to those needed for build

* Update .circleci/scripts/deps-install.sh

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* ci - install deps - expand install scripts needed for tests

* ci - install deps - expand install scripts needed for integration tests

* ci - install deps - fix node-sass script ref

* github - set codeowners for scripts/deps-install

* development - add utility to show deps with install scripts

* lint fix

* deps - move read-installed to devDeps
2019-09-25 20:01:10 +08:00
Dan J Miller
1bd22b58c0
Add a/b test for full screen transaction confirmations (#7162)
* Adds ab test controller with a fullScreenVsPopup test

* Add migration for fullScreenVsPopup state

* Move abtest state under an 'abtests' object.

* MetaMask shows fullScreen group of a/b test unapproved txs in a full browser tab

* Ensure cancel metrics event in confirm-transaction-base.component.js is sent in all cases

* Switch to existing tab for unapproved tx if it exists when opening in full screen

* Send metrics event for entering a/b test from confirm screen

* Fix lint, unit and integration tests related to a/b test code

* Remove unnecessary tabs.query call in triggerUiInNewTab
2019-09-24 17:08:38 -04:00
Mark Stacey
9f21317a30
Verify locales on CI (#7199)
* Add '--quiet' flag to verify locales script

The `--quiet` flag reduces the console output to just the essential
information for running in a CI environment. For each locale, it will
print the number of unused messages (if any).

* Add `verify-locales` script to lint CI job

The locales are now verified as part of the lint CI job. Any unused
messages detected will result in the job failing.
2019-09-21 13:31:33 -03:00
Mark Stacey
48bf2f8731
Remove unused locale messages (#7190)
* Switch to using string literals for locale keys

Various message keys were being specified with a string template
instead of a string literal. They have been switched to use string
literals so that the script for detecting unused messages can find
them.

* Remove unused locale messages

A number of unused locale messages have been removed - probably
leftover from old UI elements that have since been removed.

The `verify_locale_strings` script has been augmented to search the UI
for string literals, and match those against the locale message keys in
the `en` locale. Any messages without a corresponding string literal
are assumed to be unused.

The script has also been updated with an optional `--fix` parameter,
which will automatically delete any unused messages from locales.

148 unused messages were found in this case, out of a total of about
650 messages. Another 70 messages are _potentially_ unused and require
further investigation, but weren't as easy to rule out because they
were found in string literals.

* Remove additional unused locale messages

The following messages were more difficult to rule out because they
were present as string literals in the UI. They do appear to be
unused as locale keys though.
2019-09-18 20:29:46 -03:00
Dan J Miller
7985f4f4f8
3box integration 2.0 (#6972)
* Adds threebox controller

* Adds threebox approval modal

* Fix unit tests and lint after addition of threebox

* Correct threebox behaviour after rejecting request for backup; fixes e2e tests.

* Update threebox controller for automatic syncing

* Ensure frontend locale updates when preferences are changed via direct update within controller

* Add toggle in settings for 3box syncing

* Update threebox controller for latest 3box version

* Delete unnecessary frontend changes for threebox integration

* Backing up address book contacts with threebox

* Update unit tests for 3box-integration additions

* Only enable threebox by default for new wallets

* Mock globals for correct unit tests

* 3box '1.10.2' -> '^1.10.2'

* Correct capilalization on 3Box

* Use log.debug instead of console.log in threebox controller

* Update yarn.lock

* Remove edge build

* Split 3box module into background deps js file

* extra bundle opts for bg-libs

* sync yarn.lock

* new3Box logic

* Show confirm threebox restore after import

* Remove bg-libs.js from manifest file for dev builds

* Switch 3Box controller to using the spaces api (instead of the profile api)

* Finalize switching to spaces api and only restoring from 3box after import

* Update metamask-controller-test.js for threebox controller changes

* Make threebox modal style consistent with others and update success button wording

* Use mock 3box when in test

* Correct 3box modal header

* Remove unnecessary property of threebox controller provider

* Remove unnecessary method calls after restoration from 3box in the threebox-restore-confirm modal.

* Replace setThreeBoxSyncingPermission calls in routes/index.js with turnThreeBoxSyncingOn

* Replace erroneous use of  with

* Replace erroneous use of threeboxSyncing with threeBoxSyncingAllowed in advancted-tab directory

* Lint fixes for 3box changes

* Log errors encountered when updating 3Box

* Remove unnecessary parameter from state update

* Add timeout to initial 3Box sync

The initial 3Box sync will now timeout after 1 minute. If the timeout
is triggered, 3Box is disabled and cannot be re-enabled unless the
initial sync does finally finish. If it never finishes, 3Box cannot
be enabled unless the extension is reinstalled.

The Advanced Settings page was updated to show this option as disabled
in that circumstance, with a new discription explaining why it's
disabled. The UI here could certainly be improved.

Additionally, "on" and "off" labels were added to the toggle to match
the other toggles on the Advanced Settings page.

* Use non-minified 3Box module

We had previously used the minified 3Box module to avoid a build error
encountered when `envify` was processing the `libp2p` module (which is
used by 3Box). The build would fail because `esprima` (used by `envify`)
is incompatible with the object spread/rest operator (which is used in
`libp2p`).

That issue has been solved by adding a global Babelify transformation
specifically for transpiling out the object rest/spread operator from
dependencies. It has been targetted to only affect `libp2p` to avoid
extending the build time too much. This workaround can be used until
a new version of `esprima` is released that includes this bug fix.

* Use app key addresses for threebox

* Replace use of modal for confirming 3box restoration with a home notification

* Adds e2e tests for restoring from threebox

* Update eth-keyring-controller to 5.1.0

* Correct parameters passed to getAppKeyAddress in threebox.js

* Add prefix to origin passed to getAppKeyAddress in threebox.js

* Remove unused locale message.

* Prevent CORS errors in firefox e2e tests

* Ensure extraneous scripts are excluded from the local test dev build

* Move threeBoxLastUpdate state from home.component to redux

* Threebox PR code cleanup

* Always use first address when initializing threebox

* Replace setRestoredFromThreeBox api with setRestoredFromThreeBoxToFalse and setRestoredFromThreeBoxToTrue

* Update development/metamaskbot-build-announce.js to include ui-libs and bg-libs in hard coded bundle list

* Update test/e2e/threebox.spec.js to use new helpers added with pull #7144

* Make setFeatureFlag available on the ui window during testing

* Hide threebox feature behind a feature flag that can only be activated via dev console

* Remove unnecessary migration of threebox feature flag

* Prevent this.init() call in threebox constructor if feature flag is not turned on

* Prevent threebox notification from showing if feature flag is falsy

* http://localhost/8889 -> http://localhost/* in gulp manifest:testing tasks
2019-09-16 14:41:01 -02:30
kumavis
bf72f39ff1
ci - metamaskbot - include links to dep-viz and all artifacts (#7155) 2019-09-16 12:19:15 +08:00
kumavis
629f5ef221
ci - create source-map-explorer build-artifacts (#7141)
* ci - create source-map-explorer build-artifacts

* ci - add source-map-explorer builds to metamaskbot comment

* lint fix

* ci - source-map-explorer - include all bundles
2019-09-11 23:35:30 +08:00
kumavis
59f18e3207 dev - move gource instructions from docs to development script 2019-09-10 22:05:16 +08:00
Brian R. Bondy
93204a578b Update localization from Transifex Brave order (#7099)
* Add extra locales to index.json

* Fix verify locale script bugs

- All locales didn't work because it was putting an object inside of an object.
- Individual checks didn't work because of how the destructuring was done.
- Extra items were being printed as missing items.

* Sync up string changes w/ Brave wallet

* Add 33 new locales from Brave wallet

* Merge tml into ta code
2019-09-05 14:05:33 -03:00
Whymarrh Whitby
ecbde20949
Remove ComputedbalancesController (#7057) 2019-08-22 10:26:43 -02:30
Dan J Miller
821529622e Fetch & display received transactions (#6996) 2019-08-16 16:24:10 -02:30
Whymarrh Whitby
ceace71bf5
Remove unused lostAccounts state (#6979) 2019-08-08 17:03:10 -02:30
Thomas
bf00f42252 Merge branch 'master' into develop-master-parity 2019-08-05 12:21:41 -07:00
Whymarrh Whitby
4d88e1cf86 Enable indent linting via ESLint (#6936)
* Enable indent linting via ESLint

* yarn run lint:fix
2019-07-31 10:17:11 -10:00
Mark Stacey
1fd3dc9ecf
Switch from npm to yarn (#6843)
As a solution to the constant lockfile churn issues we've had with
`npm`, the project now uses `yarn` to manage dependencies.

The `package-lock.json` file has been replaced with `yarn.lock`, which
was created using `yarn import`. It should approximate the contents of
`package-lock.json` fairly well, though there may be some changes due to
deduplication. The codeowners file has been updated to reference this
new lockfile.

All documentation and npm scripts have been updated to reference `yarn`
rather than `npm`. Note that running scripts using `npm run` still works
fine, but it seemed better to switch those to `yarn` as well to avoid
confusion.

The `npm-audit` Bash script has been replaced with `yarn-audit`. The
output of `yarn audit` is a bit different than `npm audit` in that it
returns a bitmask to describe which severity issues were found. This
made it simpler to check the results directly from the Bash script, so
the associated `npm-audit-check.js` script was no longer required. The
output should be exactly the same, and the information is still sourced
from the same place (the npm registry).

The new `yarn-audit` script does have an external dependency: `jq`.
However, `jq` is already assumed to be present by another CI script, and
is present on all CI images we use. `jq` was not added to `package.json`
as a dependency because there is no official package on the npm
registry, just wrapper scripts. We don't need it anywhere exept on CI
anyway.

The section in `CONTRIBUTING` about how to develop inside the
`node_modules` folder was removed, as the advice was a bit dated, and
wasn't specific to this project anyway.
2019-07-30 15:36:23 -03:00
Mark Stacey
429030a00e
Remove unused unlockAccountMessage callback (#6905)
This callback has been unused for a long time. It was removed in #1076
2019-07-24 23:40:22 -03:00
Mark Stacey
0f8a9a5d49
Serve CSS as an external file (#6894)
The CSS is now served as an external file instead of being injected.
This was done to improve performance. Ideally we would come to a middle
ground between this and the former behaviour by injecting only the CSS
that was required for the initial page load, then lazily loading the
rest. However that change would be more complex. The hope was that
making all CSS external would at least be a slight improvement.

Performance metrics were collected before and after this change to
determine whether this change actually helped. The metrics collected
were the timing events provided by Chrome DevTools:

* DOM Content Loaded (DCL) [1]
* Load (L) [2]
* First Paint (FP) [3]
* First Contentful Paint (FCP) [3]
* First Meaningful Paint (FMP) [3]

Here are the results (units in milliseconds):

Injected CSS:

| Run | DCL | L | FP | FCP | FMP |
| :--- | ---: | ---: | ---: | ---: | ---: |
| 1 | 1569.45 | 1570.97 | 1700.36 | 1700.36 | 1700.36 |
| 2 | 1517.37 | 1518.84 | 1630.98 | 1630.98 | 1630.98 |
| 3 | 1603.71 | 1605.31 | 1712.56 | 1712.56 | 1712.56 |
| 4 | 1522.15 | 1523.72 | 1629.3 | 1629.3 | 1629.3 |
| **Min** | 1517.37 | 1518.84 | 1629.3 | 1629.3 | 1629.3 |
| **Max** | 1603.71 | 1605.31 | 1712.56 | 1712.56 | 1712.56 |
| **Mean** | 1553.17 | 1554.71 | 1668.3 | 1668.3 | 1668.3 |
| **Std. dev.** | 33.41 | 33.43 | 38.16 | 38.16 | 38.16 |

External CSS:

| Run | DCL | L | FP | FCP | FMP |
| :--- | ---: | ---: | ---: | ---: | ---: |
| 1 | 1595.4 | 1598.91 | 284.97 | 1712.86 | 1712.86 |
| 2 | 1537.55 | 1538.99 | 199.38 | 1633.5 | 1633.5 |
| 3 | 1571.28 | 1572.74 | 268.65 | 1677.03 | 1677.03 |
| 4 | 1510.98 | 1512.33 | 206.72 | 1607.03 | 1607.03 |
| **Min** | 1510.98 | 1512.33 | 199.38 | 1607.03 | 1607.03 |
| **Max** | 1595.4 | 1598.91 | 284.97 | 1712.86 | 1712.86 |
| **Mean** | 1553.8025 | 1555.7425 | 239.93 | 1657.605 | 1657.605 |
| **Std. dev.** | 29.5375 | 30.0825 | 36.88 | 37.34 | 37.34 |

Unfortunately, using an external CSS file made no discernible improvement
to the overall page load time. DCM and L were practically identical, and
FCP and FMP were marginally better (well within error margins).

However, the first paint time was _dramatically_ improved. This change
seems worthwhile for the first paint time improvement alone. It also
allows us to delete some code and remove a dependency.

The old `css.js` module included two third-party CSS files as well, so
those have been imported into the main Sass file. This was easier than
bundling them in the gulpfile.

The resulting CSS bundle needs to be served from the root because we're
using a few `@include` rules that make this assumption. We could move
this under `/css/` if desired, but we'd need to update each of these
`@include` rules.

Relates to #6646

[1]: https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded
[2]: https://developer.mozilla.org/en-US/docs/Web/Events/load
[3]: https://developers.google.com/web/fundamentals/performance/user-centric-performance-metrics
2019-07-23 14:10:13 -03:00
Mark Stacey
b316dd1c40
Remove outdated development tools and documentation (#6845)
These files were referencing npm scripts that no longer existed. Notices
appear to no longer exist, and the `ui-dev.js` module is no longer
actively used.

The `mock-dev.js` module is still used for certain integration tests, so
I've just removed the reference to the non-existent script.
2019-07-15 14:24:37 -03:00
Mark Stacey
04ae92a2c0
Lint .json files (#6852)
We've been using the `eslint-plugin-json` plugin for some time, but we
haven't been visiting `.json` files in the lint script. The lint script
has now been updated to incude `.json` files, which means any invalid
JSON will result in a lint error.

Unfortunately this JSON plugin doesn't seem to apply the other eslint
rules (such as `key-spacing`) to the JSON files. I wasn't able to find a
way to get that to work. Instead I manually auto-formatted each of the
locale `message.json` files, which fixed many whitespace
inconsistencies.

The `states.json` file was deleted completely, as it appears to be
unused. It wasn't a valid JSON file anyway, it was JavaScript. It looks
like a `states.js` file is automatically generated, but an old copy was
accidentally saved as `states.json` and included in the repo.

Many duplicate key errors were found and fixed in the
`development/states/` JSON files.

`package-lock.json` was added to `.eslintignore` because it was very
slow to lint, and linting it doesn't provide much value.
2019-07-15 11:03:22 -03:00
Thomas Huang
96a12a627e
Merge pull request #6832 from MetaMask/master-rebased
Master rebased
2019-07-12 10:58:19 -07:00
Mark Stacey
ea7ba5dd5f
Remove unused AppVeyor configuration (#6840)
The AppVeyor configuration appears to be unused - this project is not
connected to AppVeyor.

After deleting the AppVeyor config, the JSDoc config was the last thing
in the `development/tools` directory. That felt a little silly, so I
moved it up to `development`.
2019-07-12 12:42:36 -03:00
Whymarrh Whitby
830c801ec3
Add React and Redux DevTools (#6793)
* Add React and Redux DevTools

* Conditionally load react-devtools

* Add start:dev npm script to run the app with devtools

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>
2019-07-11 12:27:06 -02:30
Mark Stacey
09eca3cc60
Improve auto changelog script (#6753)
* Improve auto changelog script

The auto changelog script was creating empty or invalid entries in a
number of different cases, such as when the body of a commit spanned
multiple lines. This has been fixed, and the following additional
improvements have been made:

- Error handling (it will now crash upon encountering an error)
- Commits without a PR number in the subject are listed without the PR
prefix
- Invalid shellcheck warnings ignored
- Only the first line of the commit body is shown
- Carriage returns are stripped (some commits contain them)

This script should be more reliable for helping to manually update the
changelog. It's still not sufficiently robust to use as part of an
automated process - I don't think that's feasible without maintaining
stricter control over commit messages conventions and/or merge
strategies.
2019-07-11 11:08:23 -03:00
Whymarrh Whitby
caa40912ac
Replace deprecated shell-parallel with concurrently (#6807)
* Replace shell-parallel with concurrently

* Update ganache-cli
2019-07-09 14:09:31 -02:30
Mark Stacey
ec40b2a325
Check for invalid gas estimates from local storage (#6800)
* Remove unused state 'gas.basicPriceAndTimeEstimates'

* Check for invalid estimates from local storage

Gas estimates were being cached in local storage then later retrieved,
but the retrieved values were not being checked. If the data failed to
save, failed to load, or was cleared since being saved, it would result
in the gas estimates being set to undefined.

The estimates retrieved from local storage are now checked before they
are used. If they are falsy, the estimates are retrieved from the
network instead.

This should fix this Sentry issue:
[METAMASK-6W0T](https://sentry.io/share/issue/cfe470314a5741768b19050815322aa4/)

A few additional changes were made to the gas-duck tests to accommodate
the use of `sinon.restore`. `restore` is strongly recommended by the
`sinon` team, as neglecting to use it can result in memory leaks. It has
the additional benefit of ensuring you create fresh stubs/spies for each
test, which means they no longer need to be reset between tests.
2019-07-04 16:18:12 -03:00
Dan J Miller
05e2120814 Version 6.7.2 gas limit fix (#6786)
* Introduce delay for eth_estimateGas calls with in test

* Add test that fails when gas estimates of contract method calls without gas are too high.

* Get transaction gas data from unApprovedTxs instead of confirmTransaction

* Fix selection of gas data in gas-modal-page-container.container

* Lint changes related to Version-6.7.2-gasLimitFix

* Fix e2e tests on Version-6.7.2-gasLimitFix

* Fix unit and integration tests for changes from Version-6.7.2-gasLimitFix

* more e2e fixes

* Add assertions for transaction values on confirm screen

* Fix display of transaction amount on confirm screen.
2019-07-04 14:14:03 -02:30
Whymarrh Whitby
df17853502
Remove UiMigrationAnnouncement and associated state (#6794) 2019-07-04 12:21:21 -02:30
Dan J Miller
632c9b21e2 Version 6.7.2 gas limit fix (#6786)
* Introduce delay for eth_estimateGas calls with in test

* Add test that fails when gas estimates of contract method calls without gas are too high.

* Get transaction gas data from unApprovedTxs instead of confirmTransaction

* Fix selection of gas data in gas-modal-page-container.container

* Lint changes related to Version-6.7.2-gasLimitFix

* Fix e2e tests on Version-6.7.2-gasLimitFix

* Fix unit and integration tests for changes from Version-6.7.2-gasLimitFix

* more e2e fixes

* Add assertions for transaction values on confirm screen

* Fix display of transaction amount on confirm screen.
2019-07-03 13:33:44 -07:00
Dan J Miller
13be683701
New settings custom rpc form (#6490)
* Add networks tab to settings, with header.

* Adds network list to settings network tab.

* Adds form to settings networks tab and connects it to network list.

* Network tab: form adding and editing working

* Settings network form properly handles input errors

* Add translations for settings network form

* Clean up styles of settings network tab.

* Add popup-view styles and behaviour to settings network tab.

* Fix save button on settings network form

* Adds 'Add Network' button and addMode to settings networks tab

* Lint fix for settings networks tab addition

* Fix navigation in settings networks tab.

* Editing an rpcurl in networks tab does not create new network, just changes rpc of old

* Fix layout of settings tabs other than network

* Networks dropdown 'Custom Rpc' item links to networks tab in settings.

* Update settings sidebar networks subheader.

* Make networks tab buttons width consistent with input widths in extension view.

* Fix settings screen subheader height in popup view

* Fix height of add networks button in popup view

* Add optional label to chainId and symbol form labels in networks setting tab

* Style fixes for networks tab headers

* Add ability to customize block explorer used by custom rpc

* Stylistic improvements+fixes to custom rpc form.

* Hide cancel button.

* Highlight and show network form of provider by default.

* Standardize network subheader name to 'Networks'

* Update e2e tests for new settings network form

* Update unit tests for new rpcPrefs prop

* Extract blockexplorer url construction into method.

* Fix broken styles on non-network tabs in popup mode

* Fix block explorer url links for cases when provider in state has not been updated.

* Fix vertical spacing of network form

* Don't allow click of save button on network form if nothing has changed

* Ensure add network button is shown in popup view

* Lint fix for networks tab

* Fix block explorer url preference setting.

* Fix e2e tests for custom blockexplorer in account details modal changes.

* Update integration test states to include frequentRpcList property

* Fix some capitalizations in en/messages.json

* Remove some console.logs added during custom rpc form work

* Fix external account link text and url for modal and dropdown.

* Documentation, url validation, proptype required additions and lint fixes on network tab and form.
2019-05-09 14:57:14 -02:30
Whymarrh Whitby
094e4cf555 Check for unused function arguments (#6583)
* eslint: Check for unused function arguments

* eslint: Ignore unused '_' in argument list

Also allow any number of '_' e.g., '__' or '___' which is to be used sparingly

* Remove and rename unused arguments
2019-05-08 15:51:33 -04:00
Dan Miller
936cbd7ec0 Prevent completedUiMigration popup from appearing in integration tests. 2019-05-07 15:29:59 -02:30
Paul Bouchon
0db0a187c8 feature: add Goerli support (#6459) 2019-04-17 15:04:49 -02:30
Whymarrh Whitby
0762aaa5da Remove broken image walkthrough from metamaskbot comment 2019-03-29 12:39:43 -02:30
Chi Kei Chan
31175625b4 Folder restructure (#6304)
* Remove ui/app/keychains/

* Remove ui/app/img/ (unused images)

* Move conversion-util to helpers/utils/

* Move token-util to helpers/utils/

* Move /helpers/*.js inside /helpers/utils/

* Move util tests inside /helpers/utils/

* Renameand move confirm-transaction/util.js to helpers/utils/

* Move higher-order-components to helpers/higher-order-components/

* Move infura-conversion.json to helpers/constants/

* Move all utility functions to helpers/utils/

* Move pages directory to top-level

* Move all constants to helpers/constants/

* Move metametrics inside helpers/

* Move app and root inside pages/

* Move routes inside helpers/

* Re-organize ducks/

* Move reducers to ducks/

* Move selectors inside selectors/

* Move test out of test folder

* Move action, reducer, store inside store/

* Move ui components inside ui/

* Move UI components inside ui/

* Move connected components inside components/app/

* Move i18n-helper inside helpers/

* Fix unit tests

* Fix unit test

* Move pages components

* Rename routes component

* Move reducers to ducks/index

* Fix bad path in unit test
2019-03-21 20:33:30 -02:30
Dan Finlay
823007121d Add rollback script, move auto-changelog script (#6252) 2019-03-20 09:48:50 -02:30
kumavis
48047f8194 mascara - remove from project (#6283) 2019-03-12 11:17:21 -02:30
kumavis
82959b6b0e development - enhancement for sourcemap validator tool (#6277) 2019-03-11 09:55:43 -07:00
Dan J Miller
c757366355
Metametrics (#6171)
* Add metametrics provider and util.

* Add backend api and state for participating in metametrics.

* Add frontend action for participating in metametrics.

* Add metametrics opt-in screen.

* Add metametrics events to first time flow.

* Add metametrics events for route changes

* Add metametrics events for send and confirm screens

* Add metametrics events to dropdowns, transactions, log in and out, settings, sig requests and main screen

* Ensures each log in is measured as a new visit by metametrics.

* Ensure metametrics is called with an empty string for dimensions params if specified

* Adds opt in metametrics modal after unlock for existing users

* Adds settings page toggle for opting in and out of MetaMetrics

* Switch metametrics dimensions to page level scope

* Lint, test and translation fixes for metametrics.

* Update design for metametrics opt-in screen

* Complete responsive styling of metametrics-opt-in modal

* Use new chart image on metrics opt in screens

* Incorporate the metametrics opt-in screen into the new onboarding flow

* Update e2e tests to accomodate metametrics changes

* Mock out metametrics network requests in integration tests

* Fix tx-list integration test to support metametrics provider.

* Send number of tokens and accounts data with every metametrics event.

* Update metametrics event descriptor schema and add new events.

* Fix import tos bug and send gas button bug due to metametrics changes.

* Various small fixes on the metametrics branch.

* Add origin custom variable type to metametrics.util

* Fix names of onboarding complete actions (metametrics).

* Fix names of Metrics Options actions (metametrics).

* Clean up code related to metametrics.

* Fix bad merge conflict resolution and improve promise handling in sendMetaMetrics event and confrim tx base

* Don't send a second metrics event if user has gone back during first time flow.

* Collect metametrics on going back from onboarding create/import.

* Add missing custom variable constants for metametrics

* Fix metametrics provider

* Make height of opt-in modal responsive.

* Adjust text content for opt-in modal.

* Update metametrics event names and clean up code in opt-in-modal

* Put phishing warning step next to last in onboarding flow

* Link terms of service on create and import screens of first time flow

* Add subtext to options on the onboarding select action screen.

* Fix styling of bullet points on end of onboarding screen.

* Combine phishing warning and congratulations screens.

* Fix placement of users if unlocking after an incomplete onboarding import flow.

* Fix capitalization in opt-in screen

* Fix last onboarding screen translations

* Add link to 'Learn More' on the last screen of onboarding

* Code clean up: metametrics branch

* Update e2e tests for phishing warning step removal

* e2e tests passing on metametrics branch

* Different tracking urls for metametrics on development and prod
2019-03-05 12:15:01 -03:30
Chi Kei Chan
a2320c76fe Show/Hide Fiat on Testnets based on User Preference (#6153) 2019-02-26 15:00:41 -03:30
Dan J Miller
02bdbbbc3e Add visual indicator when displaying a cached balance (#5854) 2019-01-30 08:46:12 -03:30
Dan Miller
76f9bdec63 Add integration test for ordering of shapeshift txs in history list. 2019-01-24 19:31:30 -03:30
Alexander Tseung
7d18a47c22 Fix integration tests 2019-01-24 19:31:30 -03:30
Esteban Miño
2d7c9b3dac Prevent send to token warning (#6058) 2019-01-23 14:39:56 -03:30
Alexander Tseung
fba17d77de Refactor first time flow, remove seed phrase from state (#5994)
* Refactor and fix styling for first time flow. Remove seed phrase from persisted metamask state

* Fix linting and tests

* Fix translations, initialization notice routing

* Fix drizzle tests

* Fix e2e tests

* Fix integration tests

* Fix styling

* Fix migration naming from 030 to 031

* Open extension in browser when user has not completed onboarding
2019-01-23 11:55:34 -03:30
Alexander Tseung
30a2be85ee
Prevent users from changing the From field in the send screen (#5922)
* Prevent users from changing the From field in the send screen

* Fix integration tests
2018-12-13 18:19:36 -08:00
Dan J Miller
1fbdce8916 Improve ux for low gas price set (#5862)
* Show user warning if they set gas price below safelow minimum, error if 0.

* Properly cache basic price estimate data.

* Default retry price to recommended price if original price was 0x0

* Use mock fetch in send-new-ui integration tests.
2018-12-10 13:51:00 -08:00
Whymarrh Whitby
b6789a6e2f Remove beefy dependency and its usages
Refs #4768
Refs #5389

This changeset removes the beefy package that:

1. Was last published 2 yrs ago
2. Brought with it 1 moderate and 1 critical vulnerability
3. Was only used in scripts that no longer work
2018-12-06 12:40:57 -03:30
Dan Miller
b7f873b96e Add gas data to integration test json data set. 2018-12-04 00:06:22 -03:30
Dan Miller
8c8359ca14 Remove gas customization integration tests (in favour of e2e tests) 2018-12-04 00:06:22 -03:30
Whymarrh Whitby
66e0de73c5
Merge pull request #5334 from whymarrh/ui-switch
Default to the new UI for first time users
2018-11-21 15:21:04 -03:30
Dan Finlay
5956f8d260 Version 5.0.3 (#5785)
* Version 5.0.3

Includes a fix to the `version:bump` script that now correctly updates
the changelog header.

* Include inpage provider events
2018-11-20 08:34:14 -10:00
Whymarrh Whitby
e68008edf4 Remove first-time and navigate-txs integration tests 2018-11-20 14:04:50 -03:30
Whymarrh Whitby
5dc87b6835 Speed up genStates script by using built-in require fn 2018-11-20 14:04:50 -03:30
PaddyMc
7ce2cf4572 Fixes #3425: Better support for batch transactions (#5437) 2018-11-13 13:49:12 -03:30
kumavis
338c826961 development tools - fix i18n verify tool 2018-11-04 22:18:30 -05:00
HackyMiner
54a8ade266 Add support for RPC endpoints with custom chain IDs (#5134) 2018-10-26 10:26:43 +02:00
Alexander Tseung
badebe017f
Adds toggle for primary currency (#5421)
* Add UnitInput component

* Add CurrencyInput component

* Add UserPreferencedCurrencyInput component

* Add UserPreferencedCurrencyDisplay component

* Add updatePreferences action

* Add styles for CurrencyInput, CurrencyDisplay, and UnitInput

* Update SettingsTab page with Primary Currency toggle

* Refactor currency displays and inputs to use UserPreferenced displays and inputs

* Add TokenInput component

* Add UserPreferencedTokenInput component

* Use TokenInput in the send screen

* Fix unit tests

* Fix e2e and integration tests

* Remove send/CurrencyDisplay component

* Replace diamond unicode character with Eth logo. Fix typos
2018-10-17 07:03:29 +08:00
Bruno Barbieri
fb6eca3f65 CI - Allow sourcemap uploads to sentry for empty version (#5403)
* Allow sourcemap uploads to sentry for empty version

* Fix comments

* fix console log msgs

* fix console log msgs

* clean up

* fix linter errors
2018-10-10 10:24:25 -04:00
Vincent
cd91b45686 100% French locale, reordering of English locale, fixes #5457 (#5470)
* french locales: fix typos and improve wording

* french locales: more fixes and rewording

* fixed typo

* fixed typo

* added missing translations

* fixed alphabetical order

* fixed alphabetical order

* added missing translations for FR

* fixed verify-locale-strings.js

* fixed indentation

* fixed indentation

* updated french locale

* updated changelog with changes logs

* a few fixes after receiving comments, mostly Caps removing and adding
2018-10-09 12:17:38 -02:30
Dan Finlay
5043451356
Merge pull request #5167 from MetaMask/fix-watcAsset-images
Fix images for watched tokens
2018-09-04 12:56:56 -07:00
Esteban MIno
879e10d44a add assetImages to development states 2018-08-30 17:25:13 -03:00
Esteban MIno
165a966a2a balance components using selectors 2018-08-30 17:19:10 -03:00
Esteban MIno
63397047cf fix integration test for asset images selectors 2018-08-30 15:09:59 -03:00
Dan Miller
40e0d92f57 Adds sidebar component and refactors slide in wallet view sidebar to use it. 2018-08-28 22:08:15 -02:30
Bobby Dresser
eb2b36b3cb fix tos link; 2018-07-12 16:24:13 -04:00
Dan
e91d87efd9 Fix bug in test mock signature request methods. 2018-07-11 13:37:26 -02:30
Dan
91eca558f0 Fix send integration tests for compatability with confirm refactor. 2018-07-11 08:35:15 -02:30
Dan
a7a66171c2 Fix signature request tests for compatability with confirm refactor. 2018-07-11 08:35:15 -02:30
brunobar79
73b6d5ff95 fix version-bump.js 2018-07-02 18:59:02 -04:00
brunobar79
26e4f87ce4 fix verify-locale-strings.js 2018-07-02 18:58:31 -04:00
brunobar79
3c1471d6c6 fix ui-dev.js warnings 2018-07-02 18:57:25 -04:00
brunobar79
42feca1f27 fix sourcemap-validator.js warnings 2018-07-02 18:56:51 -04:00
brunobar79
ffaca7971a fix mock-dev.js warnings 2018-07-02 18:50:47 -04:00
brunobar79
8fbcd95d53 fix beefy.js warnings 2018-07-02 18:50:07 -04:00
brunobar79
a8f745f9fe eslint --fix . 2018-07-02 18:49:33 -04:00
kumavis
44a8e48a04 notices - replace getLatestNotice with getNextNotice 2018-06-13 23:30:31 -07:00
Dan
ae55e8a3c1 Merge branch 'develop' into i3725-refactor-send-component- 2018-06-06 16:40:43 -02:30
Whymarrh Whitby
6ee9685490 Fix mock addresses used for integration tests 2018-06-05 19:48:42 -07:00
Dan
6bc8cc819a Merge branch 'develop' into i3725-refactor-send-component- 2018-05-14 11:44:50 -02:30
kumavis
f4fe3e81c1 development - add sourcemap debug tool 2018-04-27 18:17:21 -07:00
Dan
33c16d1bf6 Fixes to get tests passing. 2018-04-27 08:11:18 -02:30
Dan Finlay
6ee57dcad7
Merge branch 'master' into i3580-InternationalizeCurrency 2018-04-17 13:36:21 -07:00
Dan Finlay
136caa2034 Add JSDocs Page and Script
Includes new script `npm run doc` for generating docs page.
2018-04-12 14:46:05 -07:00
Dan
285265ce8a Add basic currency localization test. 2018-04-09 21:31:27 -02:30
Alexander Tseung
1e6f062bb6 Fix integration tests 2018-04-06 11:25:05 -07:00
Alexander Tseung
037d6e6624 Fix integration tests 2018-04-04 18:21:30 -07:00
kumavis
502a203218 ci - metamaskbot-announce - gracefully handle missing PR 2018-04-03 12:51:18 -07:00
kumavis
92dd2b3218 ci - job-publish - publish source+sourcemaps to sentry if new release 2018-04-03 12:36:46 -07:00
kumavis
6029ebf0ed ci - metamaskbot announce - js style change 2018-04-03 12:33:40 -07:00
kumavis
8d577a923b
ci - dont log unneeded env var 2018-04-02 16:25:07 -07:00
kumavis
98e0fc1ab9 Merge branch 'master' of github.com:MetaMask/metamask-extension into ci-screens 2018-04-02 14:13:45 -07:00
kumavis
6d5f1392a5
Merge branch 'master' into i18n-helper 2018-04-02 10:47:24 -07:00
kumavis
bc1a456264 ci - build:announce - replace bash qith js because of string escaping nightmare 2018-03-30 17:20:48 -07:00
kumavis
662b1957f4 ci - build:announce - fix json escaping 2018-03-30 16:25:22 -07:00
kumavis
f5cf39b940 ci - build:announce - fix json escaping 2018-03-30 16:12:13 -07:00
kumavis
213496f190 ci - build:announce - break out into shell script 2018-03-30 15:53:45 -07:00
Dan
2979de2e6b Adds integration tests for rendering of tx list items. 2018-03-30 02:08:29 -02:30
kumavis
812a06ffcd i18n - further improve locale verifier 2018-03-27 20:29:29 -07:00
kumavis
3e7d7205b8 i18n - cleanup verify locales util 2018-03-27 20:09:15 -07:00
kumavis
5c521775f6 development - genStates - simplify locale importing 2018-03-27 18:02:25 -07:00
Dan
cd204ee803 Add currentLocale to test states. 2018-03-23 15:42:54 -02:30
Dan
edf63f8b51 Add en localeMessages to test states. 2018-03-22 01:09:21 -02:30
kumavis
1a60094d50
Merge pull request #3504 from lazaridiscom/laz/i3427
adds READMEs to folders, re #3427
2018-03-20 16:28:47 -07:00
Thomas Huang
a3c1a92513
Merge pull request #3612 from hermanjunge/locale-verification
Add script to verify locale strings
2018-03-20 10:59:42 -07:00
Herman Junge
03587c96d8 Move file to development, fix JS 2018-03-20 14:53:29 -03:00
frankiebee
cd721f52cb Merge branch 'master' into retry-tx-refractor 2018-03-15 08:07:16 -07:00