Merge pull request #9021 from MetaMask/Version-v8.0.5

Version v8.0.5 RC
feature/default_network_editable
Whymarrh Whitby 4 years ago committed by GitHub
commit 15a7855aca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 59
      .circleci/config.yml
  2. 7
      .eslintignore
  3. 7
      .gitignore
  4. 18
      .stylelintignore
  5. 50
      .stylelintrc
  6. 12
      CHANGELOG.md
  7. 2
      README.md
  8. BIN
      app/fonts/DIN Next/DIN Next W01 Bold.otf
  9. BIN
      app/fonts/DIN Next/DIN Next W01 Regular.otf
  10. BIN
      app/fonts/DIN Next/DIN Next W10 Black.otf
  11. BIN
      app/fonts/DIN Next/DIN Next W10 Italic.otf
  12. BIN
      app/fonts/DIN Next/DIN Next W10 Light.otf
  13. BIN
      app/fonts/DIN Next/DIN Next W10 Medium.otf
  14. BIN
      app/fonts/DIN_OT/DINOT-2.otf
  15. BIN
      app/fonts/DIN_OT/DINOT-Bold 2.otf
  16. BIN
      app/fonts/DIN_OT/DINOT-BoldItalic.otf
  17. BIN
      app/fonts/DIN_OT/DINOT-Italic 2.otf
  18. BIN
      app/fonts/DIN_OT/DINOT-Medium 2.otf
  19. BIN
      app/fonts/DIN_OT/DINOT-MediumItalic 2.otf
  20. BIN
      app/fonts/Lato/Lato-Black.ttf
  21. BIN
      app/fonts/Lato/Lato-BlackItalic.ttf
  22. BIN
      app/fonts/Lato/Lato-Bold.ttf
  23. BIN
      app/fonts/Lato/Lato-BoldItalic.ttf
  24. BIN
      app/fonts/Lato/Lato-Hairline.ttf
  25. BIN
      app/fonts/Lato/Lato-HairlineItalic.ttf
  26. BIN
      app/fonts/Lato/Lato-Italic.ttf
  27. BIN
      app/fonts/Lato/Lato-Light.ttf
  28. BIN
      app/fonts/Lato/Lato-LightItalic.ttf
  29. BIN
      app/fonts/Lato/Lato-Regular.ttf
  30. 93
      app/fonts/Lato/OFL.txt
  31. BIN
      app/fonts/Montserrat/Montserrat-Bold.ttf
  32. BIN
      app/fonts/Montserrat/Montserrat-Bold.woff
  33. BIN
      app/fonts/Montserrat/Montserrat-Light.ttf
  34. BIN
      app/fonts/Montserrat/Montserrat-Light.woff
  35. BIN
      app/fonts/Montserrat/Montserrat-Regular.ttf
  36. BIN
      app/fonts/Montserrat/Montserrat-Regular.woff
  37. BIN
      app/fonts/Montserrat/Montserrat-UltraLight.ttf
  38. BIN
      app/fonts/Montserrat/Montserrat-UltraLight.woff
  39. 92
      app/fonts/Montserrat/OFL.txt
  40. BIN
      app/images/404.png
  41. BIN
      app/images/cancel.png
  42. BIN
      app/images/coinbase logo.png
  43. BIN
      app/images/deadface.png
  44. BIN
      app/images/ethereum-metamask-chrome.png
  45. BIN
      app/images/key-32.png
  46. BIN
      app/images/logo.png
  47. BIN
      app/images/pw-128x128.png
  48. BIN
      app/images/pw-48x48.png
  49. BIN
      app/images/pw128x128.png
  50. BIN
      app/images/shapeshift logo.png
  51. 2
      app/manifest/_base.json
  52. 4
      app/scripts/background.js
  53. 6
      app/scripts/contentscript.js
  54. 4
      app/scripts/controllers/alert.js
  55. 8
      app/scripts/controllers/cached-balances.js
  56. 10
      app/scripts/controllers/network/createInfuraClient.js
  57. 10
      app/scripts/controllers/network/enums.js
  58. 4
      app/scripts/controllers/network/network.js
  59. 1
      app/scripts/controllers/permissions/enums.js
  60. 22
      app/scripts/controllers/permissions/index.js
  61. 4
      app/scripts/controllers/permissions/methodMiddleware.js
  62. 4
      app/scripts/controllers/permissions/permissionsLog.js
  63. 2
      app/scripts/controllers/permissions/restrictedMethods.js
  64. 4
      app/scripts/controllers/preferences.js
  65. 21
      app/scripts/controllers/transactions/index.js
  66. 19
      app/scripts/controllers/transactions/lib/recipient-blocklist-checker.js
  67. 17
      app/scripts/controllers/transactions/lib/recipient-blocklist.js
  68. 2
      app/scripts/controllers/transactions/pending-tx-tracker.js
  69. 45
      app/scripts/controllers/transactions/tx-state-manager.js
  70. 8
      app/scripts/lib/account-tracker.js
  71. 3
      app/scripts/lib/ens-ipfs/resolver.js
  72. 2
      app/scripts/lib/get-first-preferred-lang-code.js
  73. 74
      app/scripts/lib/setupSentry.js
  74. 2
      app/scripts/lib/stream-utils.js
  75. 2
      app/scripts/lib/typed-message-manager.js
  76. 32
      app/scripts/metamask-controller.js
  77. 28
      app/scripts/migrations/047.js
  78. 1
      app/scripts/migrations/index.js
  79. 5
      app/scripts/ui.js
  80. 59
      app/unsupport.html
  81. 26
      development/backGroundConnectionModifiers.js
  82. 2
      development/build/display.js
  83. 2
      development/build/etc.js
  84. 16
      development/build/index.js
  85. 6
      development/build/scripts.js
  86. 22
      development/create-static-server.js
  87. 27
      development/genStates.js
  88. 60
      development/index.html
  89. 156
      development/mock-dev.js
  90. 49
      development/selector.js
  91. 531
      development/states/confirm-sig-requests.json
  92. 482
      development/states/currency-localization.json
  93. 1301
      development/states/tx-list-items.json
  94. 18
      development/static-server.js
  95. 32
      development/test.html
  96. 50
      package.json
  97. 122
      stylelint.config.js
  98. 68
      test/base.conf.js
  99. 2
      test/e2e/address-book.spec.js
  100. 2
      test/e2e/ethereum-on.spec.js
  101. Some files were not shown because too many files have changed in this diff Show More

@ -19,9 +19,6 @@ workflows:
- prep-build-storybook:
requires:
- prep-deps
- prep-scss:
requires:
- prep-deps
- test-lint:
requires:
- prep-deps
@ -45,14 +42,6 @@ workflows:
requires:
- prep-deps
- prep-build
- test-integration-flat-chrome:
requires:
- prep-deps
- prep-scss
- test-integration-flat-firefox:
requires:
- prep-deps
- prep-scss
- all-tests-pass:
requires:
- test-lint
@ -63,8 +52,6 @@ workflows:
- test-mozilla-lint
- test-e2e-chrome
- test-e2e-firefox
- test-integration-flat-chrome
- test-integration-flat-firefox
- benchmark:
requires:
- prep-build-test
@ -176,25 +163,6 @@ jobs:
paths:
- .out
prep-scss:
docker:
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Get Scss Cache key
# this allows us to checksum against a whole directory
command: find ui/app/css -type f -exec md5sum {} \; | sort -k 2 > scss_checksum
- run:
name: Build for integration tests
command: yarn test:integration:build
- persist_to_workspace:
root: .
paths:
- ui/app/css/output
test-lint:
docker:
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
@ -401,33 +369,6 @@ jobs:
name: test:mozilla-lint
command: NODE_OPTIONS=--max_old_space_size=3072 yarn mozilla-lint
test-integration-flat-firefox:
docker:
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Install Firefox
command: ./.circleci/scripts/firefox-install
- run:
name: test:integration:flat
command: yarn test:flat
test-integration-flat-chrome:
environment:
browsers: '["Chrome"]'
docker:
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88
steps:
- checkout
- attach_workspace:
at: .
- run:
name: test:integration:flat
command: yarn test:flat
all-tests-pass:
docker:
- image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88

@ -7,17 +7,10 @@ test-builds/**
docs/**
coverage/
development/bundle.js
development/states.js
app/scripts/lib/extension-instance.js
app/scripts/chromereload.js
app/vendor/**
ui/lib/blockies.js
test/integration/bundle.js
test/integration/jquery-3.1.0.min.js
test/integration/helpers.js
package-lock.json

7
.gitignore vendored

@ -32,13 +32,6 @@ dist
builds/
builds.zip
development/bundle.js
development/states.js
test/integration/bundle.js
test/background.js
test/bundle.js
test/test-bundle.js
test-artifacts
test-builds

@ -1,9 +1,9 @@
app/
development/
dist/
docs/
fonts/
images/
node_modules/
notices/
test/
/app
/development
/dist
/docs
/fonts
/images
/node_modules
/notices
/test

@ -1,50 +0,0 @@
{
"extends": "stylelint-config-standard",
"rules": {
"color-named": "never",
"font-family-name-quotes": "always-where-recommended",
"font-weight-notation": "numeric",
"function-url-quotes": "always",
"number-leading-zero": "never",
"value-no-vendor-prefix": true,
"value-list-comma-newline-before": "never-multi-line",
"custom-property-empty-line-before": "never",
"property-no-unknown": [
true,
{
"ignoreProperties": [
"composes",
"all",
"-webkit-appearance"
]
}
],
"declaration-block-semicolon-newline-after": "always",
"block-opening-brace-newline-after": "always",
"selector-attribute-quotes": "always",
"selector-max-specificity": "0,5,2",
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": ["local", "global"]
}
],
"at-rule-empty-line-before": [
"always",
{
"ignore": [
"after-comment"
]
}
],
"indentation": [
2,
{
"indentInsideParens": "once-at-root-twice-in-block"
}
],
"max-nesting-depth": 3,
"no-duplicate-selectors": true,
"no-unknown-animations": true
}
}

@ -2,6 +2,18 @@
## Current Develop Branch
## 8.0.5 Thu Jul 16 2020
- [#8942](https://github.com/MetaMask/metamask-extension/pull/8942): Fix display of incoming transactions (#8942)
- [#8998](https://github.com/MetaMask/metamask-extension/pull/8998): Fix `web3_clientVersion` method (#8998)
- [#9003](https://github.com/MetaMask/metamask-extension/pull/9003): @metamask/inpage-provider@6.0.1 (#9003)
- [#9006](https://github.com/MetaMask/metamask-extension/pull/9006): Hide loading indication after `personal_sign` (#9006)
- [#9011](https://github.com/MetaMask/metamask-extension/pull/9011): Display pending notifications after connect flow (#9011)
- [#9012](https://github.com/MetaMask/metamask-extension/pull/9012): Skip render when home page is closing or redirecting (#9012)
- [#9010](https://github.com/MetaMask/metamask-extension/pull/9010): Limit number of transactions passed outside of TransactionController (#9010)
- [#9023](https://github.com/MetaMask/metamask-extension/pull/9023): Clear AccountTracker accounts and CachedBalances on createNewVaultAndRestore (#9023)
- [#9025](https://github.com/MetaMask/metamask-extension/pull/9025): Catch gas estimate errors (#9025)
- [#9026](https://github.com/MetaMask/metamask-extension/pull/9026): Clear transactions on createNewVaultAndRestore (#9026)
## 8.0.4 Tue Jul 07 2020
- [#8934](https://github.com/MetaMask/metamask-extension/pull/8934): Fix transaction activity on custom networks
- [#8936](https://github.com/MetaMask/metamask-extension/pull/8936): Fix account tracker optimization

@ -1,7 +1,5 @@
# MetaMask Browser Extension
[![Build Status](https://circleci.com/gh/MetaMask/metamask-extension.svg?style=shield&circle-token=a1ddcf3cd38e29267f254c9c59d556d513e3a1fd)](https://circleci.com/gh/MetaMask/metamask-extension) [![Coverage Status](https://coveralls.io/repos/github/MetaMask/metamask-extension/badge.svg?branch=master)](https://coveralls.io/github/MetaMask/metamask-extension?branch=master)
You can find the latest version of MetaMask on [our official website](https://metamask.io/). For help using MetaMask, visit our [User Support Site](https://metamask.zendesk.com/hc/en-us).
MetaMask supports Firefox, Google Chrome, and Chromium-based browsers. We recommend using the latest available browser version.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,93 +0,0 @@
Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato"
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

@ -1,92 +0,0 @@
Copyright (c) 2011-2012, Julieta Ulanovsky (julieta.ulanovsky@gmail.com), with Reserved Font Names 'Montserrat'
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "__MSG_appName__",
"version": "8.0.4",
"version": "8.0.5",
"manifest_version": 2,
"author": "https://metamask.io",
"description": "__MSG_appDescription__",

@ -260,7 +260,7 @@ function setupController (initState, initLangCode) {
createStreamSink(persistData),
(error) => {
log.error('MetaMask - Persistence pipeline failed', error)
}
},
)
/**
@ -454,7 +454,7 @@ async function openPopup () {
resolve()
}
}, 1000)
}
},
)
}

@ -77,13 +77,13 @@ async function setupStreams () {
pageMux,
pageStream,
pageMux,
(err) => logStreamDisconnectWarning('MetaMask Inpage Multiplex', err)
(err) => logStreamDisconnectWarning('MetaMask Inpage Multiplex', err),
)
pump(
extensionMux,
extensionStream,
extensionMux,
(err) => logStreamDisconnectWarning('MetaMask Background Multiplex', err)
(err) => logStreamDisconnectWarning('MetaMask Background Multiplex', err),
)
// forward communication across inpage-background for these channels only
@ -102,7 +102,7 @@ function forwardTrafficBetweenMuxers (channelName, muxA, muxB) {
channelA,
channelB,
channelA,
(err) => logStreamDisconnectWarning(`MetaMask muxed traffic for channel "${channelName}" failed.`, err)
(err) => logStreamDisconnectWarning(`MetaMask muxed traffic for channel "${channelName}" failed.`, err),
)
}

@ -22,7 +22,7 @@ const defaultState = {
alertEnabledness[alertType] = true
return alertEnabledness
},
{}
{},
),
unconnectedAccountAlertShownOrigins: {},
}
@ -44,7 +44,7 @@ export default class AlertController {
initState,
{
unconnectedAccountAlertShownOrigins: {},
}
},
)
this.store = new ObservableStore(state)

@ -65,6 +65,14 @@ export default class CachedBalancesController {
return balancesToCache
}
/**
* Removes cachedBalances
*/
clearCachedBalances () {
this.store.updateState({ cachedBalances: {} })
}
/**
* Sets up listeners and subscriptions which should trigger an update of cached balances. These updates will
* happen when the current account changes. Which happens on block updates, as well as on network and account

@ -33,23 +33,23 @@ function createNetworkAndChainIdMiddleware ({ network }) {
switch (network) {
case 'mainnet':
netId = networkEnums.MAINNET_NETWORK_ID.toString()
netId = networkEnums.MAINNET_NETWORK_ID
chainId = '0x01'
break
case 'ropsten':
netId = networkEnums.ROPSTEN_NETWORK_ID.toString()
netId = networkEnums.ROPSTEN_NETWORK_ID
chainId = '0x03'
break
case 'rinkeby':
netId = networkEnums.RINKEBY_NETWORK_ID.toString()
netId = networkEnums.RINKEBY_NETWORK_ID
chainId = '0x04'
break
case 'kovan':
netId = networkEnums.KOVAN_NETWORK_ID.toString()
netId = networkEnums.KOVAN_NETWORK_ID
chainId = networkEnums.KOVAN_CHAIN_ID
break
case 'goerli':
netId = networkEnums.GOERLI_NETWORK_ID.toString()
netId = networkEnums.GOERLI_NETWORK_ID
chainId = '0x05'
break
default:

@ -5,11 +5,11 @@ export const MAINNET = 'mainnet'
export const GOERLI = 'goerli'
export const LOCALHOST = 'localhost'
export const MAINNET_NETWORK_ID = 1
export const ROPSTEN_NETWORK_ID = 3
export const RINKEBY_NETWORK_ID = 4
export const GOERLI_NETWORK_ID = 5
export const KOVAN_NETWORK_ID = 42
export const MAINNET_NETWORK_ID = '1'
export const ROPSTEN_NETWORK_ID = '3'
export const RINKEBY_NETWORK_ID = '4'
export const GOERLI_NETWORK_ID = '5'
export const KOVAN_NETWORK_ID = '42'
export const MAINNET_CHAIN_ID = '0x1'
export const ROPSTEN_CHAIN_ID = '0x3'

@ -100,7 +100,7 @@ export default class NetworkController extends EventEmitter {
if (!type) {
return
}
network = networks.networkList[type] && networks.networkList[type].chainId ? networks.networkList[type].chainId : network
network = networks.networkList[type]?.chainId || network
return this.networkStore.putState(network)
}
@ -211,7 +211,7 @@ export default class NetworkController extends EventEmitter {
const networkClient = createJsonRpcClient({ rpcUrl })
// hack to add a 'rpc' network with chainId
networks.networkList['rpc'] = {
chainId: chainId,
chainId,
rpcUrl,
ticker: ticker || 'ETH',
nickname,

@ -36,6 +36,7 @@ export const LOG_LIMIT = 100
export const SAFE_METHODS = [
'web3_sha3',
'web3_clientVersion',
'net_listening',
'net_peerCount',
'net_version',

@ -102,7 +102,7 @@ export class PermissionsController {
}))
engine.push(this.permissions.providerMiddlewareFunction.bind(
this.permissions, { origin }
this.permissions, { origin },
))
return asMiddleware(engine)
@ -132,7 +132,7 @@ export class PermissionsController {
const req = { method: 'eth_accounts' }
const res = {}
this.permissions.providerMiddlewareFunction(
{ origin }, req, res, () => {}, _end
{ origin }, req, res, () => {}, _end,
)
function _end () {
@ -187,7 +187,7 @@ export class PermissionsController {
const res = {}
this.permissions.providerMiddlewareFunction(
domain, req, res, () => {}, _end
domain, req, res, () => {}, _end,
)
function _end (_err) {
@ -233,7 +233,7 @@ export class PermissionsController {
// attempt to finalize the request and resolve it,
// settings caveats as necessary
approved.permissions = await this.finalizePermissionsRequest(
approved.permissions, accounts
approved.permissions, accounts,
)
approval.resolve(approved.permissions)
}
@ -295,7 +295,7 @@ export class PermissionsController {
this.permissions.updateCaveatFor(
origin, 'eth_accounts',
CAVEAT_NAMES.exposedAccounts,
[...oldPermittedAccounts, account]
[...oldPermittedAccounts, account],
)
const permittedAccounts = await this.getAccounts(origin)
@ -459,7 +459,7 @@ export class PermissionsController {
// update "last seen" time for the origin and account(s)
// exception: no accounts -> no times to update
this.permissionsLog.updateAccountsHistory(
origin, newAccounts
origin, newAccounts,
)
// NOTE:
@ -490,7 +490,7 @@ export class PermissionsController {
}
return { parentCapability: methodName }
})
}),
)
})
}
@ -642,8 +642,8 @@ export class PermissionsController {
await Promise.all(
connectedDomains
.map(
(origin) => this._handleConnectedAccountSelected(origin)
)
(origin) => this._handleConnectedAccountSelected(origin),
),
)
}
@ -675,7 +675,7 @@ export class PermissionsController {
this.pendingApprovals.has(id)
) {
throw new Error(
`Pending approval with id '${id}' or origin '${origin}' already exists.`
`Pending approval with id '${id}' or origin '${origin}' already exists.`,
)
}
@ -728,7 +728,7 @@ export class PermissionsController {
if (this.pendingApprovalOrigins.has(origin)) {
throw ethErrors.rpc.resourceUnavailable(
'Permissions request already pending; please wait.'
'Permissions request already pending; please wait.',
)
}

@ -33,7 +33,7 @@ export default function createMethodMiddleware ({
if (isProcessingRequestAccounts) {
res.error = ethErrors.rpc.resourceUnavailable(
'Already processing eth_requestAccounts. Please wait.'
'Already processing eth_requestAccounts. Please wait.',
)
return
}
@ -68,7 +68,7 @@ export default function createMethodMiddleware ({
// this should never happen, because it should be caught in the
// above catch clause
res.error = ethErrors.rpc.internal(
'Accounts unexpectedly unavailable. Please report this bug.'
'Accounts unexpectedly unavailable. Please report this bug.',
)
}

@ -213,7 +213,7 @@ export default class PermissionsLogController {
*/
logPermissionsHistory (
requestedMethods, origin, result,
time, isEthRequestAccounts
time, isEthRequestAccounts,
) {
let accounts, newEntries
@ -378,6 +378,6 @@ export default class PermissionsLogController {
*/
function getAccountToTimeMap (accounts, time) {
return accounts.reduce(
(acc, account) => ({ ...acc, [account]: time }), {}
(acc, account) => ({ ...acc, [account]: time }), {},
)
}

@ -27,7 +27,7 @@ export default function getRestrictedMethods ({ getIdentities, getKeyringAccount
(err) => {
res.error = err
end(err)
}
},
)
},
},

@ -482,7 +482,7 @@ export default class PreferencesController {
* updates custom RPC details
*
* @param {string} url - The RPC url to add to frequentRpcList.
* @param {number} chainId - Optional chainId of the selected network.
* @param {string} chainId - Optional chainId of the selected network.
* @param {string} ticker - Optional ticker symbol of the selected network.
* @param {string} nickname - Optional nickname of the selected network.
* @returns {Promise<array>} - Promise resolving to updated frequentRpcList.
@ -510,7 +510,7 @@ export default class PreferencesController {
* Adds custom RPC url to state.
*
* @param {string} url - The RPC url to add to frequentRpcList.
* @param {number} chainId - Optional chainId of the selected network.
* @param {string} chainId - Optional chainId of the selected network.
* @param {string} ticker - Optional ticker symbol of the selected network.
* @param {string} nickname - Optional nickname of the selected network.
* @returns {Promise<array>} - Promise resolving to updated frequentRpcList.

@ -25,7 +25,6 @@ import NonceTracker from 'nonce-tracker'
import * as txUtils from './lib/util'
import cleanErrorStack from '../../lib/cleanErrorStack'
import log from 'loglevel'
import { throwIfAccountIsBlocked } from './lib/recipient-blocklist-checker'
import {
TRANSACTION_TYPE_CANCEL,
@ -38,6 +37,7 @@ import { hexToBn, bnToHex, BnMultiplyByFraction } from '../../lib/util'
import { TRANSACTION_NO_CONTRACT_ERROR_KEY } from '../../../../ui/app/helpers/constants/error-keys'
const SIMPLE_GAS_COST = '0x5208' // Hex for 21000, cost of a simple send.
const MAX_MEMSTORE_TX_LIST_SIZE = 100 // Number of transactions (by unique nonces) to keep in memory
/**
Transaction Controller is an aggregate of sub-controllers and trackers
@ -125,14 +125,19 @@ export default class TransactionController extends EventEmitter {
this._updatePendingTxsAfterFirstBlock()
}
/** @returns {number} - the chainId*/
/**
* Gets the current chainId in the network store as a number, returning 0 if
* the chainId parses to NaN.
*
* @returns {number} The numerical chainId.
*/
getChainId () {
const networkState = this.networkStore.getState()
const getChainId = parseInt(networkState)
if (Number.isNaN(getChainId)) {
const integerChainId = parseInt(networkState)
if (Number.isNaN(integerChainId)) {
return 0
} else {
return getChainId
return integerChainId
}
}
@ -241,7 +246,6 @@ export default class TransactionController extends EventEmitter {
this.emit('newUnapprovedTx', txMeta)
try {
throwIfAccountIsBlocked(txMeta.metamaskNetworkId, normalizedTxParams.to)
txMeta = await this.addTxGasDefaults(txMeta, getCodeResponse)
} catch (error) {
log.warn(error)
@ -786,9 +790,8 @@ export default class TransactionController extends EventEmitter {
*/
_updateMemstore () {
const unapprovedTxs = this.txStateManager.getUnapprovedTxList()
const currentNetworkTxList = this.txStateManager.getFilteredTxList({
metamaskNetworkId: this.getNetwork(),
})
const currentNetworkTxList = this.txStateManager.getTxList(MAX_MEMSTORE_TX_LIST_SIZE)
this.memStore.updateState({ unapprovedTxs, currentNetworkTxList })
}
}

@ -1,19 +0,0 @@
import blocklist from './recipient-blocklist'
/**
* Checks if a specified account on a specified network is blocked
* @param {number} networkId
* @param {string} account
* @throws {Error} if the account is blocked on mainnet
*/
export function throwIfAccountIsBlocked (networkId, account) {
const mainnetId = 1
if (networkId !== mainnetId) {
return
}
const accountToCheck = account.toLowerCase()
if (blocklist.includes(accountToCheck)) {
throw new Error('Recipient is a public account')
}
}

@ -1,17 +0,0 @@
const blocklist = [
// IDEX phisher
'0x9bcb0A9d99d815Bb87ee3191b1399b1Bcc46dc77',
// Ganache default seed phrases
'0x627306090abab3a6e1400e9345bc60c78a8bef57',
'0xf17f52151ebef6c7334fad080c5704d77216b732',
'0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef',
'0x821aea9a577a9b44299b9c15c88cf3087f3b5544',
'0x0d1d4e623d10f9fba5db95830f7d3839406c6af2',
'0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e',
'0x2191ef87e392377ec08e7c08eb105ef5448eced5',
'0x0f4f2ac550a1b4e2280d04c21cea7ebd822934b5',
'0x6330a553fc93768f612722bb8c2ec78ac90b3bbc',
'0x5aeda56215b167893e80b4fe645ba6d5bab767de',
]
export default blocklist

@ -243,7 +243,7 @@ export default class PendingTransactionTracker extends EventEmitter {
// This is called while the transaction is in-flight, so it is possible that the
// list of completed transactions now includes the transaction we were looking at
// and if that is the case, don't consider the transaction to have taken its own nonce
!(other.id === txMeta.id) && other.txParams.nonce === txMeta.txParams.nonce
!(other.id === txMeta.id) && other.txParams.nonce === txMeta.txParams.nonce,
)
}
}

@ -57,12 +57,39 @@ export default class TransactionStateManager extends EventEmitter {
}
/**
@returns {array} - of txMetas that have been filtered for only the current network
*/
getTxList () {
* Returns the full tx list for the current network
*
* The list is iterated backwards as new transactions are pushed onto it.
*
* @param {number} [limit] a limit for the number of transactions to return
* @returns {Object[]} The {@code txMeta}s, filtered to the current network
*/
getTxList (limit) {
const network = this.getNetwork()
const fullTxList = this.getFullTxList()
return fullTxList.filter((txMeta) => txMeta.metamaskNetworkId === network)
const nonces = new Set()
const txs = []
for (let i = fullTxList.length - 1; i > -1; i--) {
const txMeta = fullTxList[i]
if (txMeta.metamaskNetworkId !== network) {
continue
}
if (limit !== undefined) {
const { nonce } = txMeta.txParams
if (!nonces.has(nonce)) {
if (nonces.size < limit) {
nonces.add(nonce)
} else {
continue
}
}
}
txs.unshift(txMeta)
}
return txs
}
/**
@ -481,4 +508,14 @@ export default class TransactionStateManager extends EventEmitter {
const transactionList = this.getFullTxList()
this._saveTxList(transactionList.filter((txMeta) => txMeta.id !== txId))
}
/**
* Filters out the unapproved transactions
*/
clearUnapprovedTxs () {
const transactions = this.getFullTxList()
const nonUnapprovedTxs = transactions.filter((tx) => tx.status !== 'unapproved')
this._saveTxList(nonUnapprovedTxs)
}
}

@ -151,6 +151,14 @@ export default class AccountTracker {
this.store.updateState({ accounts })
}
/**
* Removes all addresses and associated balances
*/
clearAccounts () {
this.store.updateState({ accounts: {} })
}
/**
* Given a block, updates this AccountTracker's currentBlockGasLimit, and then updates each local account's balance
* via EthQuery

@ -62,11 +62,8 @@ function hexValueIsEmpty (value) {
function getRegistryForChainId (chainId) {
switch (chainId) {
case 1:
// falls through
case 3:
// falls through
case 4:
// falls through
case 5:
// Mainnet, Ropsten, Rinkeby, and Goerli, respectively, use the same address
return '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'

@ -4,7 +4,7 @@ import allLocales from '../../_locales/index.json'
const getPreferredLocales = extension.i18n ? promisify(
extension.i18n.getAcceptLanguages,
{ errorFirst: false }
{ errorFirst: false },
) : async () => []
// mapping some browsers return hyphen instead underscore in locale codes (e.g. zh_TW -> zh-tw)

@ -8,10 +8,69 @@ const METAMASK_ENVIRONMENT = process.env.METAMASK_ENVIRONMENT
const SENTRY_DSN_PROD = 'https://3567c198f8a8412082d32655da2961d0@sentry.io/273505'
const SENTRY_DSN_DEV = 'https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496'
export default function setupSentry ({ release }) {
// This describes the subset of Redux state attached to errors sent to Sentry
// These properties have some potential to be useful for debugging, and they do
// not contain any identifiable information.
export const SENTRY_STATE = {
gas: true,
history: true,
metamask: {
alertEnabledness: true,
completedOnboarding: true,
connectedStatusPopoverHasBeenShown: true,
conversionDate: true,
conversionRate: true,
currentBlockGasLimit: true,
currentCurrency: true,
currentLocale: true,
customNonceValue: true,
defaultHomeActiveTabName: true,
featureFlags: true,
firstTimeFlowType: true,
forgottenPassword: true,
incomingTxLastFetchedBlocksByNetwork: true,
ipfsGateway: true,
isAccountMenuOpen: true,
isInitialized: true,
isUnlocked: true,
metaMetricsId: true,
metaMetricsSendCount: true,
nativeCurrency: true,
network: true,
nextNonce: true,
participateInMetaMetrics: true,
preferences: true,
provider: {
nickname: true,
ticker: true,
type: true,
},
seedPhraseBackedUp: true,
settings: {
chainId: true,
ticker: true,
nickname: true,
},
showRestorePrompt: true,
threeBoxDisabled: true,
threeBoxLastUpdated: true,
threeBoxSynced: true,
threeBoxSyncingAllowed: true,
unapprovedDecryptMsgCount: true,
unapprovedEncryptionPublicKeyMsgCount: true,
unapprovedMsgCount: true,
unapprovedPersonalMsgCount: true,
unapprovedTypedMessagesCount: true,
useBlockie: true,
useNonceField: true,
usePhishDetect: true,
welcomeScreenSeen: true,
},
unconnectedAccount: true,
}
export default function setupSentry ({ release, getState }) {
let sentryTarget
// detect brave
const isBrave = Boolean(window.chrome.ipcRenderer)
if (METAMASK_DEBUG || process.env.IN_TEST) {
console.log(`Setting up Sentry Remote Error Reporting for '${METAMASK_ENVIRONMENT}': SENTRY_DSN_DEV`)
@ -33,16 +92,17 @@ export default function setupSentry ({ release }) {
beforeSend: (report) => rewriteReport(report),
})
Sentry.configureScope((scope) => {
scope.setExtra('isBrave', isBrave)
})
function rewriteReport (report) {
try {
// simplify certain complex error messages (e.g. Ethjs)
simplifyErrorMessages(report)
// modify report urls
rewriteReportUrls(report)
// append app state
if (getState) {
const appState = getState()
report.extra.appState = appState
}
} catch (err) {
console.warn(err)
}

@ -16,7 +16,7 @@ export function setupMultiplex (connectionStream) {
if (err) {
console.error(err)
}
}
},
)
return mux
}

@ -143,7 +143,7 @@ export default class TypedMessageManager extends EventEmitter {
assert.ok('from' in params, 'Params must include a "from" field.')
assert.ok(
typeof params.from === 'string' && isValidAddress(params.from),
'"from" field must be a valid, lowercase, hexadecimal Ethereum address string.'
'"from" field must be a valid, lowercase, hexadecimal Ethereum address string.',
)
switch (params.version) {

@ -267,7 +267,14 @@ export default class MetamaskController extends EventEmitter {
})
this.networkController.on('networkDidChange', () => {
this.setCurrentCurrency(this.currencyRateController.state.currentCurrency, function () {})
this.setCurrentCurrency(
this.currencyRateController.state.currentCurrency,
(error) => {
if (error) {
throw error
}
},
)
})
this.networkController.lookupNetwork()
@ -624,6 +631,15 @@ export default class MetamaskController extends EventEmitter {
// clear permissions
this.permissionsController.clearPermissions()
// clear accounts in accountTracker
this.accountTracker.clearAccounts()
// clear cachedBalances
this.cachedBalancesController.clearCachedBalances()
// clear unapproved transactions
this.txController.txStateManager.clearUnapprovedTxs()
// create new vault
const vault = await keyringController.createNewVaultAndRestore(password, seed)
@ -710,7 +726,7 @@ export default class MetamaskController extends EventEmitter {
const tokenAddress = ethUtil.toChecksumAddress(address)
return contractMap[tokenAddress] ? contractMap[tokenAddress].erc20 : true
})
)
),
)
})
@ -728,7 +744,7 @@ export default class MetamaskController extends EventEmitter {
const simpleKeyPairKeyrings = this.keyringController.getKeyringsByType('Simple Key Pair')
const hdAccounts = await hdKeyring.getAccounts()
const simpleKeyPairKeyringAccounts = await Promise.all(
simpleKeyPairKeyrings.map((keyring) => keyring.getAccounts())
simpleKeyPairKeyrings.map((keyring) => keyring.getAccounts()),
)
const simpleKeyPairAccounts = simpleKeyPairKeyringAccounts.reduce((acc, accounts) => [...acc, ...accounts], [])
const accounts = {
@ -1516,7 +1532,7 @@ export default class MetamaskController extends EventEmitter {
if (err) {
log.error(err)
}
}
},
)
dnode.on('remote', (remote) => {
// push updates to popup
@ -1568,7 +1584,7 @@ export default class MetamaskController extends EventEmitter {
if (err) {
log.error(err)
}
}
},
)
}
@ -1643,7 +1659,7 @@ export default class MetamaskController extends EventEmitter {
if (err) {
log.error(err)
}
}
},
)
}
@ -1854,7 +1870,7 @@ export default class MetamaskController extends EventEmitter {
/**
* A method for selecting a custom URL for an ethereum RPC provider and updating it
* @param {string} rpcUrl - A URL for a valid Ethereum RPC API.
* @param {number} chainId - The chainId of the selected network.
* @param {string} chainId - The chainId of the selected network.
* @param {string} ticker - The ticker symbol of the selected network.
* @param {string} nickname - Optional nickname of the selected network.
* @returns {Promise<String>} - The RPC Target URL confirmed.
@ -1870,7 +1886,7 @@ export default class MetamaskController extends EventEmitter {
/**
* A method for selecting a custom URL for an ethereum RPC provider.
* @param {string} rpcTarget - A URL for a valid Ethereum RPC API.
* @param {number} chainId - The chainId of the selected network.
* @param {string} chainId - The chainId of the selected network.
* @param {string} ticker - The ticker symbol of the selected network.
* @param {string} nickname - Optional nickname of the selected network.
* @returns {Promise<String>} - The RPC Target URL confirmed.

@ -0,0 +1,28 @@
const version = 47
import { cloneDeep } from 'lodash'
/**
* Stringify the `metamaskNetworkId` property of all transactions
*/
export default {
version,
migrate: async function (originalVersionedData) {
const versionedData = cloneDeep(originalVersionedData)
versionedData.meta.version = version
const state = versionedData.data
versionedData.data = transformState(state)
return versionedData
},
}
function transformState (state) {
const transactions = state?.TransactionController?.transactions
if (Array.isArray(transactions)) {
transactions.forEach((transaction) => {
if (typeof transaction.metamaskNetworkId === 'number') {
transaction.metamaskNetworkId = transaction.metamaskNetworkId.toString()
}
})
}
return state
}

@ -57,6 +57,7 @@ const migrations = [
require('./044').default,
require('./045').default,
require('./046').default,
require('./047').default,
]
export default migrations

@ -36,7 +36,10 @@ async function start () {
// setup sentry error reporting
const release = global.platform.getVersion()
setupSentry({ release })
setupSentry({
release,
getState: () => window.getSentryState?.() || {},
})
// identify window type (popup, notification)
const windowType = getEnvironmentType()

@ -1,59 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>MetaMask</title>
</head>
<style>
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
img{
display: block;
}
html, body{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
@keyframes logoAmin{
from {transform: scale(1);}
50%{transform: scale(1.1);}
to {transform: scale(1);}
}
.unsupport{
width: 80%;
height: auto;
overflow: hidden;
padding: 10px;
}
.unsupport > img{
margin: 0 auto 31px auto;
width: 136px;
height: auto;
animation: logoAmin 1s infinite linear;
}
.unsupport > h1{
text-align: center;
font-family: Gotham;
font-size: 18px;
font-weight: 500;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: 1.3px;
color: #33559f;
}
</style>
<body>
<div class="unsupport">
<img src="./images/cancel.png" alt="">
<h1>ENS resolver only support on Ethereum mainnet</h1>
</div>
</body>
</html>

@ -1,26 +0,0 @@
module.exports = {
'confirm sig requests': {
signMessage: (_, cb) => {
const stateUpdate = {
unapprovedMsgs: {},
unapprovedMsgCount: 0,
}
return cb(null, stateUpdate)
},
signPersonalMessage: (_, cb) => {
const stateUpdate = {
unapprovedPersonalMsgs: {},
unapprovedPersonalMsgCount: 0,
}
return cb(null, stateUpdate)
},
signTypedMessage: (_, cb) => {
const stateUpdate = {
unapprovedTypedMessages: {},
unapprovedTypedMessagesCount: 0,
}
return cb(null, stateUpdate)
},
},
}

@ -34,7 +34,7 @@ function setupTaskDisplay (taskEvents) {
function displayChart (data) {
// sort tasks by start time
data.sort((a, b,) => a[1] - b[1])
data.sort((a, b) => a[1] - b[1])
// get bounds
const first = Math.min(...data.map((entry) => entry[1]))

@ -25,7 +25,7 @@ function createEtcTasks ({ browserPlatforms, livereload }) {
// zip tasks for distribution
const zip = createTask('zip', composeParallel(
...browserPlatforms.map((platform) => createZipTask(platform))
...browserPlatforms.map((platform) => createZipTask(platform)),
))
return { clean, reload, zip }

@ -39,9 +39,9 @@ function defineAllTasks () {
scriptTasks.dev,
staticTasks.dev,
manifestTasks.dev,
reload
)
)
reload,
),
),
)
// build for test development (livereload)
@ -53,9 +53,9 @@ function defineAllTasks () {
scriptTasks.testDev,
staticTasks.dev,
manifestTasks.testDev,
reload
)
)
reload,
),
),
)
// build for prod release
@ -69,7 +69,7 @@ function defineAllTasks () {
manifestTasks.prod,
),
zip,
)
),
)
// build for CI testing
@ -82,7 +82,7 @@ function defineAllTasks () {
staticTasks.prod,
manifestTasks.test,
),
)
),
)
// special build for minimal CI testing

@ -94,13 +94,13 @@ function createScriptTasks ({ browserPlatforms, livereload }) {
const standardSubtasks = standardBundles.map((filename) => {
return createTask(`${taskPrefix}:${filename}`,
createBundleTaskForBuildJsExtensionNormal({ filename, devMode, testing })
createBundleTaskForBuildJsExtensionNormal({ filename, devMode, testing }),
)
})
// inpage must be built before contentscript
// because inpage bundle result is included inside contentscript
const contentscriptSubtask = createTask(`${taskPrefix}:contentscript`,
createTaskForBuildJsExtensionContentscript({ devMode, testing })
createTaskForBuildJsExtensionContentscript({ devMode, testing }),
)
// task for initiating livereload
@ -156,7 +156,7 @@ function createScriptTasks ({ browserPlatforms, livereload }) {
externalDependencies: devMode ? undefined : externalDependenciesMap[contentscript],
devMode,
testing,
})
}),
)
}

@ -0,0 +1,22 @@
const http = require('http')
const path = require('path')
const serveHandler = require('serve-handler')
const createStaticServer = (rootDirectory) => {
return http.createServer((request, response) => {
if (request.url.startsWith('/node_modules/')) {
request.url = request.url.substr(14)
return serveHandler(request, response, {
directoryListing: false,
public: path.resolve('./node_modules'),
})
}
return serveHandler(request, response, {
directoryListing: false,
public: rootDirectory,
})
})
}
module.exports = createStaticServer

@ -1,27 +0,0 @@
/* eslint-disable import/no-dynamic-require */
const fs = require('fs')
const path = require('path')
const promisify = require('pify')
const enLocaleMessages = require('../app/_locales/en/messages.json')
const writeFile = promisify(fs.writeFile)
start().catch(console.error)
async function start () {
const statesPath = path.join(__dirname, 'states')
const stateFilesNames = await promisify(fs.readdir)(statesPath)
const states = {}
await Promise.all(stateFilesNames.map(async (stateFileName) => {
const stateFilePath = path.join(__dirname, 'states', stateFileName)
const state = require(stateFilePath)
state.localeMessages = { en: enLocaleMessages, current: {} }
const stateName = stateFileName.split('.')[0].replace(/-/g, ' ', 'g')
states[stateName] = state
}))
const generatedFileContent = `module.exports = ${JSON.stringify(states)}`
const generatedFilePath = path.join(__dirname, 'states.js')
await writeFile(generatedFilePath, generatedFileContent)
}

@ -1,60 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MetaMask</title>
</head>
<body>
<script src="./bundle.js" type="text/javascript" charset="utf-8"></script>
<style>
html, body, #test-container, .super-dev-container {
height: 100%;
width: 100%;
position: relative;
background: white;
}
#app-content {
background: #F7F7F7;
}
</style>
<script>
liveReloadCode(Date.now(), 300)
function liveReloadCode(lastUpdate, updateRate) {
setTimeout(iter, updateRate)
function iter() {
var xhr = new XMLHttpRequest()
xhr.open('GET', '/-/live-reload')
xhr.onreadystatechange = function() {
if(xhr.readyState !== 4) {
return
}
try {
var change = JSON.parse(xhr.responseText).lastUpdate
if(lastUpdate < change) {
return reload()
}
} catch(err) {
}
xhr =
xhr.onreadystatechange = null
setTimeout(iter, updateRate)
}
xhr.send(null)
}
}
function reload() {
window.location.reload()
}
</script>
</body>
</html>

@ -1,156 +0,0 @@
/* MOCK DEV
*
* This is a utility module.
* It initializes a minimalist browserifiable project
* that contains the Metamask UI, with a local background process.
*
* Includes a state reset button for restoring to initial state.
*
* This is a convenient way to develop and test the plugin
* without having to re-open the plugin or even re-build it.
*/
import log from 'loglevel'
import React from 'react'
import { render } from 'react-dom'
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import * as qs from 'qs'
import Selector from './selector'
import * as actions from '../ui/app/store/actions'
import Root from '../ui/app/pages'
import rootReducer from '../ui/app/ducks'
import MetamaskController from '../app/scripts/metamask-controller'
import firstTimeState from '../app/scripts/first-time-state'
import ExtensionPlatform from '../app/scripts/platforms/extension'
const backGroundConnectionModifiers = require('./backGroundConnectionModifiers')
const noop = function () {}
// the states file is generated before this file is run, but after `lint` is run
const states = require('./states') /* eslint-disable-line import/no-unresolved */
window.log = log
log.setLevel('debug')
const routerPath = window.location.href.split('#')[1]
let queryString = {}
let selectedView
if (routerPath) {
queryString = qs.parse(routerPath.split('?')[1])
}
selectedView = queryString.view || 'confirm sig requests'
const firstState = states[selectedView]
updateQueryParams(selectedView)
function updateQueryParams (newView) {
queryString.view = newView
const params = qs.stringify(queryString)
const locationPaths = window.location.href.split('#')
const routerPath = locationPaths[1] || ''
const newPath = locationPaths[0] + '#' + routerPath.split('?')[0] + `?${params}`
if (window.location.href !== newPath) {
window.location.href = newPath
}
}
//
// MetaMask Controller
//
// some extension platform APIs must be mocked
function mockPlatformApis () {
global.platform.getVersion = () => '0.0.0'
}
const controller = new MetamaskController({
// User confirmation callbacks:
showUnconfirmedMessage: noop,
showUnapprovedTx: noop,
platform: {},
// initial state
initState: firstTimeState,
})
global.metamaskController = controller
global.platform = new ExtensionPlatform()
mockPlatformApis()
//
// User Interface
//
actions._setBackgroundConnection(controller.getApi())
function updateState (stateName) {
selectedView = stateName
updateQueryParams(stateName)
const newState = states[selectedView]
return {
type: 'GLOBAL_FORCE_UPDATE',
value: newState,
}
}
function modifyBackgroundConnection (backgroundConnectionModifier) {
const modifiedBackgroundConnection = Object.assign({}, controller.getApi(), backgroundConnectionModifier)
actions._setBackgroundConnection(modifiedBackgroundConnection)
}
// parse opts
const store = createStore(
(state, action) =>
(action.type === 'GLOBAL_FORCE_UPDATE'
? action.value
: rootReducer(state, action)),
firstState,
applyMiddleware(thunkMiddleware),
)
// start app
startApp()
function startApp () {
const body = document.body
const container = document.createElement('div')
container.id = 'test-container'
body.appendChild(container)
render(
<div className="super-dev-container">
<button
onClick={(ev) => {
ev.preventDefault()
store.dispatch(updateState('terms'))
}}
style={{
margin: '19px 19px 0px 19px',
}}
>
Reset State
</button>
<Selector
states={states}
selectedKey={selectedView}
updateState={updateState}
store={store}
modifyBackgroundConnection={modifyBackgroundConnection}
backGroundConnectionModifiers={backGroundConnectionModifiers}
/>
<div
id="app-content"
style={{
height: '500px',
width: '360px',
boxShadow: 'grey 0px 2px 9px',
margin: '20px',
}}
>
<Root store={store} />
</div>
</div>,
container,
)
}

@ -1,49 +0,0 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
export default class Selector extends Component {
state = {}
render () {
const {
states,
selectedKey,
updateState,
store,
modifyBackgroundConnection,
backGroundConnectionModifiers,
} = this.props
const selected = this.state.selected || selectedKey
return (
<select
style={{ margin: '20px 20px 0px' }}
value={selected}
onChange={(event) => {
const selectedKey = event.target.value
const backgroundConnectionModifier = backGroundConnectionModifiers[selectedKey]
modifyBackgroundConnection(backgroundConnectionModifier || {})
store.dispatch(updateState(selectedKey))
this.setState({ selected: selectedKey })
}}
>
{Object.keys(states).map((stateName, index) => {
return (
<option key={index} value={stateName}>
{stateName}
</option>
)
})}
</select>
)
}
}
Selector.propTypes = {
states: PropTypes.object.isRequired,
selectedKey: PropTypes.string.isRequired,
updateState: PropTypes.func.isRequired,
store: PropTypes.object.isRequired,
modifyBackgroundConnection: PropTypes.func.isRequired,
backGroundConnectionModifiers: PropTypes.object.isRequired,
}

File diff suppressed because one or more lines are too long

@ -1,482 +0,0 @@
{
"metamask": {
"completedOnboarding": true,
"isInitialized": true,
"isUnlocked": true,
"featureFlags": {"betaUI": true},
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"name": "Send Account 1"
},
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"name": "Send Account 2"
},
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d",
"name": "Send Account 3"
},
"0xd85a4b6a394794842887b8284293d69163007bbb": {
"address": "0xd85a4b6a394794842887b8284293d69163007bbb",
"name": "Send Account 4"
}
},
"abTests": {
"fullScreenVsPopup": "control"
},
"cachedBalances": {},
"unapprovedTxs": {},
"conversionRate": 19855,
"conversionDate": 1489013762,
"noActiveNotices": true,
"frequentRpcList": [],
"network": "3",
"accounts": {
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
"code": "0x",
"balance": "0x47c9d71831c76efe",
"nonce": "0x1b",
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
},
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
"code": "0x",
"balance": "0x37452b1315889f80",
"nonce": "0xa",
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"
},
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
"code": "0x",
"balance": "0x30c9d71831c76efe",
"nonce": "0x1c",
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
},
"0xd85a4b6a394794842887b8284293d69163007bbb": {
"code": "0x",
"balance": "0x0",
"nonce": "0x0",
"address": "0xd85a4b6a394794842887b8284293d69163007bbb"
}
},
"addressBook": [
{
"address": "0x06195827297c7a80a443b6894d3bdb8824b43896",
"name": "Address Book Account 1"
}
],
"tokens": [],
"transactions": {},
"incomingTransactions": {},
"currentNetworkTxList": [],
"unapprovedMsgs": {},
"unapprovedMsgCount": 0,
"unapprovedPersonalMsgs": {},
"unapprovedPersonalMsgCount": 0,
"keyringTypes": [
"Simple Key Pair",
"HD Key Tree"
],
"keyrings": [
{
"type": "HD Key Tree",
"accounts": [
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
]
},
{
"type": "Simple Key Pair",
"accounts": [
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
]
}
],
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"currentCurrency": "PHP",
"provider": {
"type": "testnet"
},
"send": {
"gasLimit": null,
"gasPrice": null,
"gasTotal": "0xb451dc41b578",
"tokenBalance": null,
"from": "",
"to": "",
"amount": "0x0",
"memo": "",
"errors": {},
"warnings": {},
"maxModeOn": false,
"editingTransactionId": null
},
"currentLocale": "en",
"preferences": {
"useNativeCurrencyAsPrimaryCurrency": true,
"showFiatInTestnets": true
},
"frequentRpcListDetail": []
},
"appState": {
"menuOpen": false,
"currentView": {
"name": "accountDetail",
"detailView": null,
"context": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
},
"accountDetail": {
"subview": "transactions"
},
"sidebar": {},
"modal": {
"modalState": {},
"previousModalState": {}
},
"isLoading": false,
"warning": null,
"scrollToBottom": false,
"forgottenPassword": null
},
"identities": {},
"confirmTransaction": {
"txData": {},
"tokenData": {},
"methodData": {},
"tokenProps": {
"tokenDecimals": "",
"tokenSymbol": ""
},
"fiatTransactionAmount": "",
"fiatTransactionFee": "",
"fiatTransactionTotal": "",
"ethTransactionAmount": "",
"ethTransactionFee": "",
"ethTransactionTotal": "",
"hexGasTotal": "",
"nonce": "",
"fetchingMethodData": false
},
"gas": {
"customData": {
"price": null,
"limit": "0x186a0"
},
"basicEstimates": {
"average": 73,
"avgWait": 10.6,
"blockTime": 13.871657754010695,
"blockNum": 6655504,
"fast": 160,
"fastest": 290,
"fastestWait": 0.5,
"fastWait": 0.6,
"safeLow": 50,
"safeLowWait": 16.1,
"speed": 0.6702462692280712
},
"basicEstimateIsLoading": false,
"gasEstimatesLoading": false,
"priceAndTimeEstimates": [
{
"expectedTime": "1374.1168296452973076627",
"expectedWait": 99.0593088449,
"gasprice": 4.1
},
{
"expectedTime": "1280.88976972896682763716",
"expectedWait": 92.3386225672,
"gasprice": 4.4
},
{
"expectedTime": "1245.13314632680319175597",
"expectedWait": 89.7609477113,
"gasprice": 4.8
},
{
"expectedTime": "1227.99925007911014385881",
"expectedWait": 88.5257747744,
"gasprice": 4.9
},
{
"expectedTime": "965.52572720362993349654",
"expectedWait": 69.6042062402,
"gasprice": 5
},
{
"expectedTime": "917.466895447437420776",
"expectedWait": 66.1396721082,
"gasprice": 5.1
},
{
"expectedTime": "915.81694044041496090521",
"expectedWait": 66.0207277804,
"gasprice": 5.2
},
{
"expectedTime": "902.13145619709089691874",
"expectedWait": 65.034148924,
"gasprice": 5.3
},
{
"expectedTime": "890.83591122200105749896",
"expectedWait": 64.2198594443,
"gasprice": 5.4
},
{
"expectedTime": "879.10469542971335712248",
"expectedWait": 63.3741627006,
"gasprice": 5.5
},
{
"expectedTime": "876.99737395823100420974",
"expectedWait": 63.2222470818,
"gasprice": 5.6
},
{
"expectedTime": "865.96781957003849098957",
"expectedWait": 62.4271327138,
"gasprice": 5.7
},
{
"expectedTime": "865.44839472121496158482",
"expectedWait": 62.3896876688,
"gasprice": 5.8
},
{
"expectedTime": "802.16173170976255602161",
"expectedWait": 57.8273877524,
"gasprice": 6
},
{
"expectedTime": "780.79313908053047074843",
"expectedWait": 56.2869379368,
"gasprice": 6.1
},
{
"expectedTime": "770.04888359616469549233",
"expectedWait": 55.5123906062,
"gasprice": 6.2
},
{
"expectedTime": "745.01007965146736962697",
"expectedWait": 53.7073573226,
"gasprice": 6.3
},
{
"expectedTime": "735.19921111598501681816",
"expectedWait": 53.0000973318,
"gasprice": 6.6
},
{
"expectedTime": "705.68767153912619368694",
"expectedWait": 50.8726270539,
"gasprice": 6.7
},
{
"expectedTime": "705.26438593445239690121",
"expectedWait": 50.8421126329,
"gasprice": 6.9
},
{
"expectedTime": "652.51573119854865429742",
"expectedWait": 47.0394918019,
"gasprice": 7
},
{
"expectedTime": "635.51471669299464383162",
"expectedWait": 45.813898235,
"gasprice": 7.1
},
{
"expectedTime": "634.37181911960854759036",
"expectedWait": 45.7315073922,
"gasprice": 7.2
},
{
"expectedTime": "633.23097691113902888918",
"expectedWait": 45.6492647195,
"gasprice": 7.3
},
{
"expectedTime": "112.7753456245379663928",
"expectedWait": 8.1299111919,
"gasprice": 7.6
},
{
"expectedTime": "102.9665314468898381829",
"expectedWait": 7.4227992986,
"gasprice": 8
},
{
"expectedTime": "100.94784507024919649891",
"expectedWait": 7.2772733339,
"gasprice": 8.1
},
{
"expectedTime": "100.46445647447807351078",
"expectedWait": 7.2424261221,
"gasprice": 8.8
},
{
"expectedTime": "84.91686745986737853339",
"expectedWait": 6.1216091808,
"gasprice": 9
},
{
"expectedTime": "80.39566429296684383503",
"expectedWait": 5.7956781892,
"gasprice": 9.1
},
{
"expectedTime": "78.24522052614759252715",
"expectedWait": 5.6406539084,
"gasprice": 9.2
},
{
"expectedTime": "77.1685119880459882636",
"expectedWait": 5.5630345959,
"gasprice": 9.5
},
{
"expectedTime": "72.43649507646737870178",
"expectedWait": 5.2219061601,
"gasprice": 9.8
},
{
"expectedTime": "71.48259532351443753818",
"expectedWait": 5.1531400638,
"gasprice": 9.9
},
{
"expectedTime": "58.23892805162994573827",
"expectedWait": 4.1984115442,
"gasprice": 10
},
{
"expectedTime": "53.13065124862245917617",
"expectedWait": 3.8301587446,
"gasprice": 10.1
},
{
"expectedTime": "53.03510209647058751971",
"expectedWait": 3.82327066,
"gasprice": 10.3
},
{
"expectedTime": "49.06846157804491912403",
"expectedWait": 3.5373177776,
"gasprice": 11
},
{
"expectedTime": "48.30893330101818116637",
"expectedWait": 3.4825638116,
"gasprice": 11.1
},
{
"expectedTime": "48.25099734861818116715",
"expectedWait": 3.4783872414,
"gasprice": 11.3
},
{
"expectedTime": "47.64416885027272662988",
"expectedWait": 3.4346413165,
"gasprice": 11.9
},
{
"expectedTime": "46.76354741392085498401",
"expectedWait": 3.3711578128,
"gasprice": 12.6
},
{
"expectedTime": "44.99427448545882292232",
"expectedWait": 3.2436119232,
"gasprice": 13
},
{
"expectedTime": "44.61790554199251276697",
"expectedWait": 3.2164796979,
"gasprice": 13.1
},
{
"expectedTime": "42.87832690973048070488",
"expectedWait": 3.0910744534,
"gasprice": 14
},
{
"expectedTime": "42.21224091308663044649",
"expectedWait": 3.0430566888,
"gasprice": 14.9
},
{
"expectedTime": "41.15715335111336842864",
"expectedWait": 2.9669960203,
"gasprice": 15
},
{
"expectedTime": "40.9600723880876999821",
"expectedWait": 2.9527885646,
"gasprice": 15.1
},
{
"expectedTime": "38.89138450301711177472",
"expectedWait": 2.8036580193,
"gasprice": 15.8
},
{
"expectedTime": "37.89655640860213852611",
"expectedWait": 2.7319414219,
"gasprice": 16
},
{
"expectedTime": "37.35265517364705831954",
"expectedWait": 2.692731888,
"gasprice": 17.4
},
{
"expectedTime": "36.79447683873796741798",
"expectedWait": 2.652493126,
"gasprice": 17.8
},
{
"expectedTime": "36.11439350850802090309",
"expectedWait": 2.6034663015,
"gasprice": 19
},
{
"expectedTime": "31.32676199432192471101",
"expectedWait": 2.2583286403,
"gasprice": 20
},
{
"expectedTime": "30.76792490132192471855",
"expectedWait": 2.2180423888,
"gasprice": 20.1
},
{
"expectedTime": "29.94493658520962526441",
"expectedWait": 2.1587136243,
"gasprice": 25
},
{
"expectedTime": "29.53287347625561457478",
"expectedWait": 2.1290082267,
"gasprice": 29
},
{
"expectedTime": "29.09318627175614934008",
"expectedWait": 2.0973114236,
"gasprice": 47
}
],
"priceAndTimeEstimatesLastRetrieved": 1541527901281,
"errors": {}
},
"unconnectedAccount": {
"state": "CLOSED"
},
"history": {
"mostRecentOverviewPage": "/"
}
}

File diff suppressed because it is too large Load Diff

@ -1,10 +1,10 @@
const fs = require('fs')
const http = require('http')
const path = require('path')
const chalk = require('chalk')
const pify = require('pify')
const serveHandler = require('serve-handler')
const createStaticServer = require('./create-static-server')
const fsStat = pify(fs.stat)
const DEFAULT_PORT = 9080
@ -24,19 +24,7 @@ const onRequest = (request, response) => {
}
const startServer = ({ port, rootDirectory }) => {
const server = http.createServer((request, response) => {
if (request.url.startsWith('/node_modules/')) {
request.url = request.url.substr(14)
return serveHandler(request, response, {
directoryListing: false,
public: path.resolve('./node_modules'),
})
}
return serveHandler(request, response, {
directoryListing: false,
public: rootDirectory,
})
})
const server = createStaticServer(rootDirectory)
server.on('request', onRequest)

@ -1,32 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MetaMask</title>
<script>
window.METAMASK_DEBUG = true
window.TEST_MODE = true
</script>
</head>
<body>
<!-- app content -->
<div id="app-content" style="height: 100%"></div>
<script src="./bundle.js" type="text/javascript" charset="utf-8"></script>
</body>
<style>
html, body, #test-container, .super-dev-container {
height: 100%;
width: 100%;
position: relative;
background: white;
}
#app-content {
background: #F7F7F7;
}
</style>
</html>

@ -15,15 +15,12 @@
"dapp-chain": "GANACHE_ARGS='-b 2' concurrently -k -n ganache,dapp -p '[{time}][{name}]' 'yarn ganache:start' 'sleep 5 && yarn dapp'",
"forwarder": "node ./development/static-server.js ./node_modules/@metamask/forwarder/dist/ --port 9010",
"dapp-forwarder": "concurrently -k -n forwarder,dapp -p '[{time}][{name}]' 'yarn forwarder' 'yarn dapp'",
"watch:test:unit": "nodemon --exec \"yarn test:unit\" ./test ./app ./ui",
"sendwithprivatedapp": "node development/static-server.js test/e2e/send-eth-with-private-key-test --port 8080",
"test:unit": "mocha --exit --require test/env.js --require test/setup.js --recursive \"test/unit/**/*.js\" \"ui/app/**/*.test.js\"",
"test:unit:global": "mocha --exit --require test/env.js --require test/setup.js --recursive mocha test/unit-global/*",
"test:unit:lax": "mocha --exit --require test/env.js --require test/setup.js --recursive \"test/unit/{,**/!(permissions)}/*.js\" \"ui/app/**/*.test.js\"",
"test:unit:strict": "mocha --exit --require test/env.js --require test/setup.js --recursive \"test/unit/**/permissions/*.js\"",
"test:unit:path": "mocha --exit --require test/env.js --require test/setup.js --recursive",
"test:integration": "yarn test:integration:build && yarn test:flat",
"test:integration:build": "yarn build styles",
"test:e2e:chrome": "SELENIUM_BROWSER=chrome test/e2e/run-all.sh",
"test:web3:chrome": "SELENIUM_BROWSER=chrome test/e2e/run-web3.sh",
"test:web3:firefox": "SELENIUM_BROWSER=firefox test/e2e/run-web3.sh",
@ -31,19 +28,14 @@
"test:coverage": "nyc --silent --check-coverage yarn test:unit:strict && nyc --silent --no-clean yarn test:unit:lax && nyc report --reporter=text --reporter=html",
"test:coverage:strict": "nyc --check-coverage yarn test:unit:strict",
"test:coveralls-upload": "if [ \"$COVERALLS_REPO_TOKEN\" ]; then nyc report --reporter=text-lcov | coveralls; fi",
"test:flat": "yarn test:flat:build && karma start test/flat.conf.js",
"test:flat:build": "yarn test:flat:build:ui && yarn test:flat:build:tests && yarn test:flat:build:locales",
"test:flat:build:tests": "node test/integration/index.js",
"test:flat:build:states": "node development/genStates.js",
"test:flat:build:locales": "mkdir -p dist/chrome && cp -R app/_locales dist/chrome/_locales",
"test:flat:build:ui": "yarn test:flat:build:states && browserify --transform babelify --transform brfs ./development/mock-dev.js -o ./development/bundle.js",
"ganache:start": "./development/run-ganache",
"sentry:publish": "node ./development/sentry-publish.js",
"lint": "eslint . --ext js,json",
"lint": "eslint . --ext js,json && yarn lint:styles",
"lint:fix": "eslint . --ext js,json --fix",
"lint:changed": "{ git ls-files --others --exclude-standard ; git diff-index --name-only --diff-filter=d HEAD ; } | grep --regexp='[.]js$' --regexp='[.]json$' | tr '\\n' '\\0' | xargs -0 eslint",
"lint:changed:fix": "{ git ls-files --others --exclude-standard ; git diff-index --name-only --diff-filter=d HEAD ; } | grep --regexp='[.]js$' --regexp='[.]json$' | tr '\\n' '\\0' | xargs -0 eslint --fix",
"lint:shellcheck": "./development/shellcheck.sh",
"lint:styles": "stylelint '*/**/*.scss'",
"lint:lockfile": "lockfile-lint --path yarn.lock --allowed-hosts npm yarn github.com codeload.github.com --empty-hostname false --allowed-schemes \"https:\" \"git+https:\"",
"verify-locales": "node ./development/verify-locale-strings.js",
"verify-locales:fix": "node ./development/verify-locale-strings.js --fix",
@ -60,12 +52,11 @@
"generate:migration": "./development/generate-migration.sh"
},
"resolutions": {
"**/gonzales-pe/minimist": "^1.2.5",
"**/knex/minimist": "^1.2.5",
"**/mkdirp/minimist": "^1.2.5",
"**/optimist/minimist": "^1.2.5",
"**/socketcluster/minimist": "^1.2.5",
"3box/ipfs/ipld-zcash/zcash-bitcore-lib/lodash": "^4.17.15"
"3box/ipfs/ipld-zcash/zcash-bitcore-lib/lodash": "^4.17.19",
"ganache-core/lodash": "^4.17.19"
},
"dependencies": {
"3box": "^1.10.2",
@ -73,19 +64,19 @@
"@download/blockies": "^1.0.3",
"@formatjs/intl-relativetimeformat": "^5.2.6",
"@fortawesome/fontawesome-free": "^5.13.0",
"@material-ui/core": "1.0.0",
"@material-ui/core": "^4.11.0",
"@metamask/controllers": "^2.0.1",
"@metamask/eth-ledger-bridge-keyring": "^0.2.6",
"@metamask/eth-token-tracker": "^2.0.0",
"@metamask/etherscan-link": "^1.1.0",
"@metamask/inpage-provider": "^6.0.0",
"@metamask/inpage-provider": "^6.0.1",
"@popperjs/core": "^2.4.0",
"@reduxjs/toolkit": "^1.3.2",
"@sentry/browser": "^5.11.1",
"@sentry/integrations": "^5.11.1",
"@zxing/library": "^0.8.0",
"abi-decoder": "^1.2.0",
"abortcontroller-polyfill": "^1.3.0",
"abortcontroller-polyfill": "^1.4.0",
"await-semaphore": "^0.1.1",
"bignumber.js": "^4.1.0",
"bip39": "^2.2.0",
@ -131,7 +122,7 @@
"json-rpc-engine": "^5.1.8",
"json-rpc-middleware-stream": "^2.1.1",
"jsonschema": "^1.2.4",
"lodash": "^4.17.15",
"lodash": "^4.17.19",
"loglevel": "^1.4.1",
"luxon": "^1.23.0",
"metamask-logo": "^2.1.4",
@ -148,7 +139,6 @@
"pump": "^3.0.0",
"punycode": "^2.1.1",
"qrcode-generator": "1.4.1",
"ramda": "^0.24.1",
"react": "^16.12.0",
"react-dnd": "^3.0.2",
"react-dnd-html5-backend": "^7.4.4",
@ -163,7 +153,6 @@
"react-tippy": "^1.2.2",
"react-toggle-button": "^2.2.0",
"react-transition-group": "^1.2.1",
"react-trigger-change": "^1.0.2",
"readable-stream": "^2.3.3",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
@ -190,7 +179,7 @@
"@babel/register": "^7.5.5",
"@metamask/eslint-config": "^1.1.0",
"@metamask/forwarder": "^1.1.0",
"@metamask/test-dapp": "3.0.0",
"@metamask/test-dapp": "^3.1.0",
"@sentry/cli": "^1.49.0",
"@storybook/addon-actions": "^5.3.14",
"@storybook/addon-backgrounds": "^5.3.14",
@ -200,7 +189,7 @@
"@storybook/storybook-deployer": "^2.8.6",
"@testing-library/react-hooks": "^3.2.1",
"addons-linter": "1.14.0",
"babel-eslint": "^10.0.2",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.0.6",
"babelify": "^10.0.0",
"brfs": "^1.6.1",
@ -219,11 +208,11 @@
"envify": "^4.1.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"eslint": "^6.0.1",
"eslint": "^6.8.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-json": "^1.2.0",
"eslint-plugin-mocha": "^6.2.2",
"eslint-plugin-mocha": "^6.3.0",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react-hooks": "^4.0.4",
"fancy-log": "^1.3.3",
@ -246,16 +235,11 @@
"gulp-rtlcss": "^1.4.0",
"gulp-sass": "^4.0.0",
"gulp-sourcemaps": "^2.6.0",
"gulp-stylelint": "^7.0.0",
"gulp-stylelint": "^13.0.0",
"gulp-terser-js": "^5.0.0",
"gulp-watch": "^5.0.1",
"gulp-zip": "^4.0.0",
"jsdom": "^11.2.0",
"karma": "^4.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-firefox-launcher": "^1.0.1",
"karma-qunit": "^1.2.1",
"koa": "^2.7.0",
"lockfile-lint": "^4.0.0",
"mocha": "^7.2.0",
@ -265,8 +249,6 @@
"nyc": "^15.0.0",
"polyfill-crypto.getrandomvalues": "^1.0.0",
"proxyquire": "^2.1.3",
"qs": "^6.2.0",
"qunitjs": "^2.4.1",
"randomcolor": "^0.5.4",
"rc": "^1.2.8",
"react-devtools": "^4.4.0",
@ -287,9 +269,7 @@
"source-map-explorer": "^2.0.1",
"string.prototype.matchall": "^4.0.2",
"style-loader": "^0.21.0",
"stylelint": "^9.10.1",
"stylelint-config-standard": "^18.2.0",
"testem": "^2.16.0",
"stylelint": "^13.6.1",
"through2": "^2.0.3",
"ttest": "^2.1.1",
"vinyl-buffer": "^1.0.1",

@ -0,0 +1,122 @@
module.exports = {
rules: {
// stylelint-config-standard
'at-rule-empty-line-before': [
'always',
{
except: ['blockless-after-same-name-blockless', 'first-nested'],
ignore: ['after-comment'],
},
],
'at-rule-name-case': 'lower',
'at-rule-name-space-after': 'always-single-line',
'at-rule-semicolon-newline-after': 'always',
'block-closing-brace-empty-line-before': 'never',
'block-closing-brace-newline-after': 'always',
'block-closing-brace-newline-before': 'always-multi-line',
'block-closing-brace-space-before': 'always-single-line',
'block-opening-brace-newline-after': 'always-multi-line',
'block-opening-brace-space-after': 'always-single-line',
'block-opening-brace-space-before': 'always',
'color-hex-case': 'lower',
'color-hex-length': 'short',
'comment-empty-line-before': [
'always',
{
except: ['first-nested'],
ignore: ['stylelint-commands'],
},
],
// 'comment-whitespace-inside': 'always',
'custom-property-empty-line-before': [
'always',
{
except: ['after-custom-property', 'first-nested'],
ignore: ['after-comment', 'inside-single-line-block'],
},
],
'declaration-bang-space-after': 'never',
'declaration-bang-space-before': 'always',
'declaration-block-semicolon-newline-after': 'always-multi-line',
'declaration-block-semicolon-space-after': 'always-single-line',
'declaration-block-semicolon-space-before': 'never',
'declaration-block-single-line-max-declarations': 1,
'declaration-block-trailing-semicolon': 'always',
'declaration-colon-newline-after': 'always-multi-line',
'declaration-colon-space-after': 'always-single-line',
'declaration-colon-space-before': 'never',
'declaration-empty-line-before': [
'always',
{
except: ['after-declaration', 'first-nested'],
ignore: ['after-comment', 'inside-single-line-block'],
},
],
'function-comma-newline-after': 'always-multi-line',
'function-comma-space-after': 'always-single-line',
'function-comma-space-before': 'never',
'function-max-empty-lines': 0,
'function-name-case': 'lower',
'function-parentheses-newline-inside': 'always-multi-line',
'function-parentheses-space-inside': 'never-single-line',
'function-whitespace-after': 'always',
indentation: 2,
'length-zero-no-unit': true,
// 'max-empty-lines': 1,
'media-feature-colon-space-after': 'always',
'media-feature-colon-space-before': 'never',
'media-feature-name-case': 'lower',
'media-feature-parentheses-space-inside': 'never',
'media-feature-range-operator-space-after': 'always',
'media-feature-range-operator-space-before': 'always',
'media-query-list-comma-newline-after': 'always-multi-line',
'media-query-list-comma-space-after': 'always-single-line',
'media-query-list-comma-space-before': 'never',
'no-eol-whitespace': true,
'no-missing-end-of-source-newline': true,
'number-leading-zero': 'always',
'number-no-trailing-zeros': true,
'property-case': 'lower',
'rule-empty-line-before': [
'always-multi-line',
{
except: ['first-nested'],
ignore: ['after-comment'],
},
],
'selector-attribute-brackets-space-inside': 'never',
'selector-attribute-operator-space-after': 'never',
'selector-attribute-operator-space-before': 'never',
'selector-combinator-space-after': 'always',
'selector-combinator-space-before': 'always',
'selector-descendant-combinator-no-non-space': true,
'selector-list-comma-newline-after': 'always',
'selector-list-comma-space-before': 'never',
'selector-max-empty-lines': 0,
'selector-pseudo-class-case': 'lower',
'selector-pseudo-class-parentheses-space-inside': 'never',
'selector-pseudo-element-case': 'lower',
'selector-pseudo-element-colon-notation': 'double',
'selector-type-case': 'lower',
'unit-case': 'lower',
// 'value-keyword-case': 'lower',
'value-list-comma-newline-after': 'always-multi-line',
'value-list-comma-space-after': 'always-single-line',
'value-list-comma-space-before': 'never',
'value-list-max-empty-lines': 0,
// custom rules
// 'color-named': 'never',
// 'font-family-name-quotes': 'always-where-recommended',
// 'font-weight-notation': 'numeric',
// 'function-url-quotes': 'always',
'value-no-vendor-prefix': true,
'value-list-comma-newline-before': 'never-multi-line',
// 'selector-attribute-quotes': 'always',
// 'selector-max-specificity': '0,5,2',
// 'max-nesting-depth': 3,
'no-unknown-animations': true,
},
}

@ -1,68 +0,0 @@
// Karma configuration
// Generated on Mon Sep 11 2017 18:45:48 GMT-0700 (PDT)
module.exports = function (config) {
return {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: process.cwd(),
// Uncomment to allow for longer timeouts
// browserNoActivityTimeout: 100000000,
browserConsoleLogOptions: {
terminal: false,
},
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['qunit'],
// list of files / patterns to load in the browser
files: [
'test/integration/jquery-3.1.0.min.js',
{ pattern: 'dist/chrome/images/**/*.*', watched: false, included: false, served: true },
{ pattern: 'dist/chrome/fonts/**/*.*', watched: false, included: false, served: true },
{ pattern: 'dist/chrome/_locales/**/*.*', watched: false, included: false, served: true },
],
proxies: {
'/images/': '/base/dist/chrome/images/',
'/fonts/': '/base/dist/chrome/fonts/',
'/_locales/': '/base/dist/chrome/_locales/',
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: process.env.browsers ?
JSON.parse(process.env.browsers)
: ['Chrome', 'Firefox'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// Concurrency level
// how many browser should be started simultaneous
concurrency: 1,
nocache: true,
}
}

@ -43,7 +43,7 @@ describe('MetaMask', function () {
}
}
if (this.currentTest.state === 'failed') {
await driver.verboseReportOnFailure(this.currentTest)
await driver.verboseReportOnFailure(this.currentTest.title)
}
})

@ -42,7 +42,7 @@ describe('MetaMask', function () {
}
}
if (this.currentTest.state === 'failed') {
await driver.verboseReportOnFailure(this.currentTest)
await driver.verboseReportOnFailure(this.currentTest.title)
}
})

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save