When a lot of transactions are occurring on the network, such as during
an NFT drop, it drives gas fees up. When this happens, we want to not
only inform the user about this, but also dissuade them from using a
higher gas fee (as we have proved in testing that high gas fees can
cause bidding wars and exacerbate the situation).
The method for determining whether the network is "busy" is already
handled by GasFeeController, which exposes a `networkCongestion`
property within the gas fee estimate data. If this number exceeds 0.66 —
meaning that the current base fee is above the 66th percentile among the
base fees over the last several days — then we determine that the
network is "busy".
Sass has changed the syntax for dividing two numbers. Previously you
would use `/`, but because this causes some ambiguity with color
functions (`rgb()`, `rgba()`, and the like), where `/` is regularly used
to separate color channel information from an alpha value, Sass has
deprecate the use of `/` for division. [1]
This commit converts all such usages to use `math.div()` instead. This
is a little bit difficult because there are a few places in
`@fortawesome/fontawesome-free` which use the old syntax. There is an
issue open here about it [2] but that has not been fixed yet. So we have
to patch this package to make the deprecation warnings go away.
[1]: https://sass-lang.com/documentation/breaking-changes/slash-div
[2]: https://github.com/FortAwesome/Font-Awesome/issues/18371
ESLint rules have been added to enforce our JSDoc conventions. These
rules were introduced by updating `@metamask/eslint-config` to v9.
Some of the rules have been disabled because the effort to fix all lint
errors was too high. It might be easiest to enable these rules one
directory at a time, or one rule at a time.
Most of the changes in this PR were a result of running
`yarn lint:fix`. There were a handful of manual changes that seemed
obvious and simple to make. Anything beyond that and the rule was left
disabled.
The ESLint config for the extension explicitly includes support for
Prettier. However, this is already being provided by our global ESLint
config (`@metamask/eslint-config`). Therefore there is no need to
include it here. In fact, this is causing weird issues where the `curly`
option is getting overridden somehow. After this change, these syntaxes
are invalid:
``` javascript
if (foo) return;
```
``` javascript
if (foo) return 'bar';
```
* Update support links for Flask
* Disable 'prefer-const' in code fence linting
* Add bespoke home footer for Flask and update logic
* fixup! Add bespoke home footer for Flask and update logic
* Fix code fence lint failure
* Fix support request link in account menu
* Fix unit test failure
There was a propType error shown on the snap install screen about the
`name` property of `targetSubjectMetadata` being missing despite it
being marked as required. This property should not have been required,
it does not always exist.
* Prevent automatic rejection of confirmations
Confirmations are now only automatically rejected if a user explicitly
closes the notification window. If we close the window programmatically
because there are no notifications left to show, nothing gets rejected.
This partially avoids a race condition where a confirmation gets
rejected automatically without the user having seen the confirmation
first. This could happen if the confirmation was processed just as the
notification window was being closed.
It's still possible for a confirmation that the user has never seen to
get rejected as a result of the user closing the window. But at least
now it's no longer possible for a confirmation to get rejected in this
manner after the user resolves the last confirmation in the queue.
* Fix bug that prevented automatic closure detection
All windows were being detected as explicit window closures,
essentially just as they were previously, because this variable was
cleared too soon.
* Re-open popup when necessary
After the window is automatically closed, a confirmation may have been
queued up while the window was closing. If so, the popup is now re-
opened.
The `lint:fix` script now also calls `yarn stylelint --fix`. This step
was omitted previously, despite `stylelint` being part of the `lint`
npm script.
This error was introduced with #13100, which was merged without CI
checks because CircleCI was not running on that branch for some reason.
This error was fixed with `yarn lint:styles --fix`.
The `mounted` state was used to derive state from props before the
first render of the Home component. Instead this state is now derived
in the constructor, which is also run before the first render. This
should behave exactly the same, except now we don't need the `mounted`
state or the `deriveStateFromProps` function anymore.
The call to `closeCurrentWindow` that was made in `componentDidUpdate`
has been moved to the constructor as well. There is no need to delay
that call, and this saves us from having to compare current with
previous state in that lifecycle function.
Adds a missing middleware hook for `wallet_requestPermissions` that we failed to add in #12243. Also adds a runtime check that throws an error if any expected hooks are not provided to `createMethodMiddleware`.
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
The 4Byte API can sometimes fail during e2e tests with a 502 error.
Ideally we would avoid calling it at all during e2e tests, but in the
meantime we shouldn't treat this as a reason to fail the e2e test.
We have multiple fallbacks for 4Byte, it isn't relied upon by any
tests.
The Firefox extension version format does not support the version
format we use (SemVer), so we have to specially format the extension
version to be compatible. The format we chose was
`[major].[minor].[patch].[buildType][buildVersion]`. But when we tried
to submit a build with a version in that format, it was rejected as
invalid for unknown reasons.
The Firefox extension format has been updated to
`[major].[minor].[patch][buildType][buildVersion]`. This seems to pass
validation.
The confirmation page template system allows templates to have alerts,
but it throws an uncaught Promise rejection if a template has no
alerts. This is the unintended side-effect of input validation.
The `getTemplateAlerts` function was updated to always return an array.
The one callsite was updated to expect an empty array if there were no
alerts to render, rather than expecting `undefined`.
The `version_name` manifest field was being used on Chrome to store the
build type. However, Chrome intended this field to be a full
representation of the version, for display purposes. This was evident
when uploading this version to the Chrome Web Store, because it used
`flask` as the entire version.
Instead the `version_name` field now includes the full SemVer version
string. The version parsing code within the build script and in the
wallet itself have been updated accordingly.
The build script only allowed prerelease versions for the "beta" build
type (e.g. `X.Y.Z-beta.0`). Now it allows Flask prerelease versions as
well.
This is required for the Flask release, where the prerelease version
helps distinguish the Flask error reports and metrics.
The `environment` field we use for Sentry includes the build type for
all build types except `main`, but the log message indicating that
Sentry did not include this. This log message is useful for ensuring
that Sentry is setup correctly, so it should display the same
environment that Sentry is using. It has been updated to do just that.
This selector is a duplicate of the `getSubjectMetadata` selector,
which does the same thing except that there is no fallback for the case
where the `subjectMetadata` is falsy. This is OK because that state can
never be falsy.
This change was extracted from the `snaps` branch.
The Chrome Web Store has spam policies that prevent uploading
extensions that are too similar to each other. There are exceptions for
test and development versions of extensions, but these exceptions are
required to be clearly identified in the name and description of the
extension.
The name and description of both the Flask and beta distributions have
been updated to include explicit all-caps declarations that identify
them as development and beta distributions respectively, in-line with
the examples shown in the Chrome Web Store spam FAQ.
For more information, see: https://developer.chrome.com/docs/webstore/spam-faq/#test-version
* origin/develop: (106 commits)
Add more missing `appName` messages (#13140)
Add missing `appName` localized messages for Flask and Beta (#13138)
EIP-1559 V2: Adding default settings to advanced gas modal (#12911)
EIP-1559 V2: Advanced gas fee modal - base fee and priority fee trends (#13025)
Wire up priority fee range in new gas modal (#13044)
EIP-1559 V2: Advanced gas fee modal - getting 12 hour ranges of base fee and priority fee (#12996)
Switch Flask horizontal logos (#13113)
Update `@babel/runtime` patch to fix lockdown error (#13109)
Use promisified background in setUseNonceField (#13107)
Fix account name duplicates (#12867)
Choose accounts refactor (#13039)
Fix permissions-connect-footer "learn more" link (#13092)
Feat/collectibles the return (#12970)
Subject metadata cleanup (#13090)
Fix merge conflict typo
Bump just-safe-set from 2.1.0 to 2.2.3 (#13049)
Fix typo in German translation (#13040)
Using EIP-1559 V2 for swaps (#12966)
Make restore vault a form so an user can submit via keyboard (#12989)
Remove legacy node parent detection (#12814)
...
The `appNameFlask` and `appNameBeta` are mandatory because they are
used by the Chrome Web Store, but they are missing from some locales.
This will prevent submitting either of these build types.
These two messages have been added to all locales. The English name has
been used everywhere, since this is a brand name and brands are often
not translated. We can update this to something more appropriate for
other locales in the future if necessary.
The `appNameFlask` and `appNameBeta` are mandatory because they are
used by the Chrome Web Store, but they are missing from some locales.
This will prevent submitting either of these build types.
These two messages have been added to all locales. The English name has
been used everywhere, since this is a brand name and brands are often
not translated. We can update this to something more appropriate for
other locales in the future if necessary.