aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-07-07 07:21:18 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-07-07 07:21:18 +0800
commit7c9d942ba165ff53f44985793f28ffb48fa578e1 (patch)
treec588281c58c8bae4a4da228b2e27ea708c4eb09d
parent6b2511f94f436a30c6c683f9da2c3142d9a6461c (diff)
parentb4aaf30d6fe829f18dea68a5e6cc321b9fb00d4e (diff)
downloadtangerine-wallet-browser-7c9d942ba165ff53f44985793f28ffb48fa578e1.tar
tangerine-wallet-browser-7c9d942ba165ff53f44985793f28ffb48fa578e1.tar.gz
tangerine-wallet-browser-7c9d942ba165ff53f44985793f28ffb48fa578e1.tar.bz2
tangerine-wallet-browser-7c9d942ba165ff53f44985793f28ffb48fa578e1.tar.lz
tangerine-wallet-browser-7c9d942ba165ff53f44985793f28ffb48fa578e1.tar.xz
tangerine-wallet-browser-7c9d942ba165ff53f44985793f28ffb48fa578e1.tar.zst
tangerine-wallet-browser-7c9d942ba165ff53f44985793f28ffb48fa578e1.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into initial-trezor-support
-rw-r--r--.circleci/config.yml62
-rwxr-xr-x.circleci/scripts/firefox-download.sh17
-rwxr-xr-x.circleci/scripts/firefox-install.sh4
-rw-r--r--CONTRIBUTING.md31
-rw-r--r--app/404.html52
-rw-r--r--app/_locales/en/messages.json9
-rw-r--r--app/error.html79
-rw-r--r--app/images/404.pngbin0 -> 39401 bytes
-rw-r--r--app/images/cancel.pngbin0 -> 10928 bytes
-rw-r--r--app/images/deadface.pngbin0 -> 8333 bytes
-rw-r--r--app/images/loginglogo.svg53
-rw-r--r--app/images/logo.pngbin0 -> 6589 bytes
-rw-r--r--app/images/pw-128x128.pngbin0 -> 94988 bytes
-rw-r--r--app/images/pw-48x48.pngbin0 -> 3279 bytes
-rw-r--r--app/images/pw128x128.pngbin0 -> 94988 bytes
-rw-r--r--app/loading.html35
-rw-r--r--app/manifest.json7
-rw-r--r--app/scripts/background.js5
-rw-r--r--app/scripts/lib/contracts/registrar.js1
-rw-r--r--app/scripts/lib/contracts/resolver.js2
-rw-r--r--app/scripts/lib/ipfsContent.js40
-rw-r--r--app/scripts/lib/resolver.js71
-rw-r--r--app/scripts/metamask-controller.js1
-rw-r--r--app/unsupport.html59
-rw-r--r--old-ui/app/app.js1
-rw-r--r--old-ui/app/keychains/hd/restore-vault.js3
-rw-r--r--package-lock.json71
-rw-r--r--package.json4
-rw-r--r--test/e2e/beta/metamask-beta-ui.spec.js9
-rw-r--r--test/integration/lib/send-new-ui.js13
-rw-r--r--ui/app/actions.js34
-rw-r--r--ui/app/app.js2
-rw-r--r--ui/app/components/customize-gas-modal/index.js7
-rw-r--r--ui/app/components/pages/keychains/restore-vault.js313
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js15
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js5
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-component.test.js29
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js18
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/send-gas-row.component.js8
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js5
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/send-gas-row.selectors.js9
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js5
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js6
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js33
-rw-r--r--ui/app/components/send_/send.component.js19
-rw-r--r--ui/app/components/send_/send.container.js2
-rw-r--r--ui/app/components/send_/send.utils.js33
-rw-r--r--ui/app/components/send_/tests/send-component.test.js75
-rw-r--r--ui/app/components/send_/tests/send-container.test.js12
-rw-r--r--ui/app/components/send_/tests/send-utils.test.js46
-rw-r--r--ui/app/components/token-balance.js6
-rw-r--r--ui/app/components/token-list.js5
-rw-r--r--ui/app/components/tx-list-item.js9
-rw-r--r--ui/app/css/itcss/components/newui-sections.scss9
-rw-r--r--ui/app/css/itcss/components/request-signature.scss1
-rw-r--r--ui/app/css/itcss/components/token-list.scss1
-rw-r--r--ui/app/ducks/send.duck.js7
-rw-r--r--ui/app/ducks/tests/send-duck.test.js10
-rw-r--r--ui/app/helpers/with-token-tracker.js3
-rw-r--r--ui/app/selectors.js10
60 files changed, 1091 insertions, 275 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 0ad5cdf53..7063f3113 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -101,29 +101,31 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ keys:
+ - dependency-cache-{{ checksum "package-lock.json" }}
+ # fallback to using the latest cache if no exact match is found
+ - dependency-cache-
- run:
- name: Install deps via npm
- command: npm install
+ name: Install npm 6 + deps via npm
+ command: |
+ sudo npm install -g npm@6.1.0 && npm install
- save_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
paths:
- node_modules
- - save_cache:
- key: dependency-cache-{{ .Revision }}
- paths:
- - node_modules
prep-deps-firefox:
docker:
- image: circleci/node:8.11.3-browsers
steps:
- checkout
+ - restore_cache:
+ key: dependency-cache-firefox-
- run:
- name: Download Firefox
+ name: Download Firefox If needed
command: ./.circleci/scripts/firefox-download.sh
- save_cache:
- key: dependency-cache-firefox-{{ .Revision }}
+ key: dependency-cache-firefox-
paths:
- firefox
@@ -133,7 +135,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: build:dist
command: npm run dist
@@ -152,7 +154,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: build:dist
command: npm run doc
@@ -167,7 +169,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Get Scss Cache key
# this allows us to checksum against a whole directory
@@ -186,7 +188,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Test
command: npm run lint
@@ -197,7 +199,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Test
command: npx nsp check
@@ -208,7 +210,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- restore_cache:
key: build-cache-{{ .Revision }}
- run:
@@ -224,12 +226,12 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-firefox-{{ .Revision }}
+ key: dependency-cache-firefox-
- run:
name: Install firefox
command: ./.circleci/scripts/firefox-install.sh
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- restore_cache:
key: build-cache-{{ .Revision }}
- run:
@@ -245,7 +247,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- restore_cache:
key: build-cache-{{ .Revision }}
- run:
@@ -261,12 +263,12 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-firefox-{{ .Revision }}
+ key: dependency-cache-firefox-
- run:
name: Install firefox
command: ./.circleci/scripts/firefox-install.sh
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- restore_cache:
key: build-cache-{{ .Revision }}
- run:
@@ -282,7 +284,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- restore_cache:
key: build-cache-{{ .Revision }}
- run:
@@ -299,7 +301,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- restore_cache:
key: build-cache-{{ .Revision }}
- restore_cache:
@@ -326,7 +328,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- restore_cache:
key: build-cache-{{ .Revision }}
- restore_cache:
@@ -349,7 +351,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: test:coverage
command: npm run test:coverage
@@ -362,12 +364,12 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-firefox-{{ .Revision }}
+ key: dependency-cache-firefox-
- run:
name: Install firefox
command: ./.circleci/scripts/firefox-install.sh
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Get Scss Cache key
# this allows us to checksum against a whole directory
@@ -386,7 +388,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Get Scss Cache key
# this allows us to checksum against a whole directory
@@ -405,12 +407,12 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-firefox-{{ .Revision }}
+ key: dependency-cache-firefox-
- run:
name: Install firefox
command: ./.circleci/scripts/firefox-install.sh
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Get Scss Cache key
# this allows us to checksum against a whole directory
@@ -429,7 +431,7 @@ jobs:
steps:
- checkout
- restore_cache:
- key: dependency-cache-{{ .Revision }}
+ key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Get Scss Cache key
# this allows us to checksum against a whole directory
diff --git a/.circleci/scripts/firefox-download.sh b/.circleci/scripts/firefox-download.sh
index c63e8c3df..64f0c74e3 100755
--- a/.circleci/scripts/firefox-download.sh
+++ b/.circleci/scripts/firefox-download.sh
@@ -1,6 +1,13 @@
#!/usr/bin/env bash
-
-echo "Downloading firefox..."
-wget https://ftp.mozilla.org/pub/firefox/releases/58.0/linux-x86_64/en-US/firefox-58.0.tar.bz2 \
-&& tar xjf firefox-58.0.tar.bz2
-echo "firefox download complete"
+echo "Checking if firefox was already downloaded"
+if [ -d "firefox" ]
+then
+ echo "Firefox found. No need to download"
+else
+ FIREFOX_VERSION="61.0.1"
+ FIREFOX_BINARY="firefox-$FIREFOX_VERSION.tar.bz2"
+ echo "Downloading firefox..."
+ wget "https://ftp.mozilla.org/pub/firefox/releases/$FIREFOX_VERSION/linux-x86_64/en-US/$FIREFOX_BINARY" \
+ && tar xjf "$FIREFOX_BINARY"
+ echo "firefox download complete"
+fi
diff --git a/.circleci/scripts/firefox-install.sh b/.circleci/scripts/firefox-install.sh
index 589bcbbb5..1c60f4de9 100755
--- a/.circleci/scripts/firefox-install.sh
+++ b/.circleci/scripts/firefox-install.sh
@@ -2,7 +2,7 @@
echo "Installing firefox..."
sudo rm -r /opt/firefox
-sudo mv firefox /opt/firefox58
+sudo mv firefox /opt/firefox61
sudo mv /usr/bin/firefox /usr/bin/firefox-old
-sudo ln -s /opt/firefox58/firefox /usr/bin/firefox
+sudo ln -s /opt/firefox61/firefox /usr/bin/firefox
echo "Firefox installed."
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8517eed70..63d19c633 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -2,31 +2,26 @@
If you're submitting code to MetaMask, there are some simple things we'd appreciate you doing to help us stay organized!
-## Submitting pull requests
+### Finding the right project
Before taking the time to code and implement something, feel free to open an issue and discuss it! There may even be an issue already open, and together we may come up with a specific strategy before you take your precious time to write code.
-### Tests
+There are also plenty of open issues we'd love help with. Search the [`good first issue`](https://github.com/MetaMask/metamask-extension/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) label, or head to Gitcoin and earn ETH for completing projects we've posted bounties on.
-For any new programmatic functionality, we like unit tests when possible, so if you can keep your code cleanly isolated, please do add a test file to the `tests` folder.
+If you're picking up a bounty or an existing issue, feel free to ask clarifying questions on the issue as you go about your work.
-### PR Format
+### Submitting a pull request
+When you're done with your project / bugfix / feature and ready to submit a PR, there are a couple guidelines we ask you to follow:
-If this PR closes the issue, add the line `Fixes #$ISSUE_NUMBER`. Ex. For closing issue 418, include the line `Fixes #418`.
+- [ ] **Test it**: For any new programmatic functionality, we like unit tests when possible, so if you can keep your code cleanly isolated, please do add a test file to the `tests` folder.
+- [ ] **Add to the CHANGELOG**: Help us keep track of all the moving pieces by adding an entry to the [`CHANGELOG.md`](https://github.com/MetaMask/metamask-extension/blob/develop/CHANGELOG.md) with a link to your PR.
+- [ ] **Meet the spec**: Make sure the PR adds functionality that matches the issue you're closing. This is especially important for bounties: sometimes design or implementation details are included in the conversation, so read carefully!
+- [ ] **Close the issue**: If this PR closes an open issue, add the line `Fixes #$ISSUE_NUMBER`. Ex. For closing issue 418, include the line `Fixes #418`. If it doesn't close the issue but addresses it partially, just include a reference to the issue number, like `#418`.
+- [ ] **Keep it simple**: Try not to include multiple features in a single PR, and don't make extraneous changes outside the scope of your contribution. All those touched files make things harder to review ;)
+- [ ] **PR against `develop`**: Submit your PR against the `develop` branch. This is where we merge new features so they get some time to receive extra testing before being pushed to `master` for production. If your PR is a hot-fix that needs to be published urgently, you may submit a PR against the `master` branch, but this PR will receive tighter scrutiny before merging.
+- [ ] **Get reviewed by a core contributor**: Make sure you get a `:thumbsup`, `:+1`, or `LGTM` from a user with a `Member` badge before merging.
-If it doesn't close the issue but addresses it partially, just include a reference to the issue number, like `#418`.
-
-Submit your PR against the `develop` branch. This is where we merge new features so they get some time to receive extra testing before being pushed to `master` for production.
-
-If your PR is a hot-fix that needs to be published urgently, you may submit a PR against the `master` branch, but this PR will receive tighter scrutiny before merging.
-
-## Before Merging
-
-Make sure you get a `:thumbsup`, `:+1`, or `LGTM` from another collaborator before merging.
-
-## Before Closing Issues
-
-Make sure the relevant code has been reviewed and merged.
+And that's it! Thanks for helping out.
### Developing inside a node_modules folder
diff --git a/app/404.html b/app/404.html
new file mode 100644
index 000000000..8a6df9d7a
--- /dev/null
+++ b/app/404.html
@@ -0,0 +1,52 @@
+<html>
+<head>
+ <title>MetaMask</title>
+ <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%;
+ }
+ .app{
+ position: relative;
+ width: 100%;
+ height: auto;
+ overflow: hidden;
+ }
+ img{
+ display: block;
+ width: 100%;
+ height: auto;
+ }
+ h2{
+ display: block;
+ width: 100%;
+ overflow: hidden;
+ position: absolute;
+ bottom: 20%;
+ left: 0;
+ color: #1b243d;
+ text-align: center;
+ }
+ h2 > a{
+ color: #1b243d;
+ }
+ </style>
+</head>
+<body>
+ <div class="app">
+ <img src="./images/404.png" alt="">
+ <h2>Powered by <a href="https://www.portal.network/">Portal Network</a></h2>
+ </div>
+</body>
+</html>
diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json
index 9c3e43803..e1f321c68 100644
--- a/app/_locales/en/messages.json
+++ b/app/_locales/en/messages.json
@@ -691,6 +691,9 @@
"restoreVault": {
"message": "Restore Vault"
},
+ "restoreAccountWithSeed": {
+ "message": "Restore your Account with Seed Phrase"
+ },
"required": {
"message": "Required"
},
@@ -700,6 +703,9 @@
"walletSeed": {
"message": "Wallet Seed"
},
+ "restore": {
+ "message": "Restore"
+ },
"revealSeedWords": {
"message": "Reveal Seed Words"
},
@@ -804,6 +810,9 @@
"sendTokens": {
"message": "Send Tokens"
},
+ "separateEachWord": {
+ "message": "Separate each word with a single space"
+ },
"onlySendToEtherAddress": {
"message": "Only send ETH to an Ethereum address."
},
diff --git a/app/error.html b/app/error.html
new file mode 100644
index 000000000..366b3d94a
--- /dev/null
+++ b/app/error.html
@@ -0,0 +1,79 @@
+<html>
+<head>
+ <title>MetaMask Error</title>
+ <link href="https://fonts.googleapis.com/css?family=Rokkitt" rel="stylesheet">
+ <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);}
+ }
+ .errorBox{
+ width: 70%;
+ height: auto;
+ overflow: hidden;
+ background-image: url("./images/deadface.png");
+ background-repeat: no-repeat;
+ background-position: 100% 50%;
+ background-size: auto 90%;
+ padding: 5px;
+ }
+ .errorBox > img{
+ width: 100px;
+ height: auto;
+ margin-bottom: 25px;
+ animation: logoAmin 1s infinite linear;
+ }
+ .errorBox > h1, .errorBox > h2{
+ letter-spacing: 2px;
+ }
+ .errorBox > h1{
+ color: #9b9b9b;
+ font-size: 40px;
+ }
+ .errorBox > h2{
+ color: #1b243d;
+ font-size: 20px;
+ padding-top: 5px;
+ }
+ .errorBox > h2 >a{
+ color: #1b243d;
+ }
+ .errorBox > h2 >a:hover{
+ color: #44588e;
+ }
+
+ .errorBox > h1 > span{
+ color: #33559f;
+ }
+
+ </style>
+</head>
+<body>
+ <div class="errorBox">
+ <img src="./images/logo.png" alt="">
+ <h1><span id="name"></span> not found</h1>
+ <h2>Powered by <a href="https://www.portal.network/">Portal Network</a></h2>
+ </div>
+ <script>
+ let index = location.href.lastIndexOf("?name=")
+ let name = location.href.slice(index + 6)
+ document.getElementById("name").innerHTML = name
+ </script>
+</body>
+</html>
diff --git a/app/images/404.png b/app/images/404.png
new file mode 100644
index 000000000..b1a767dde
--- /dev/null
+++ b/app/images/404.png
Binary files differ
diff --git a/app/images/cancel.png b/app/images/cancel.png
new file mode 100644
index 000000000..4e0eb1143
--- /dev/null
+++ b/app/images/cancel.png
Binary files differ
diff --git a/app/images/deadface.png b/app/images/deadface.png
new file mode 100644
index 000000000..e12476c03
--- /dev/null
+++ b/app/images/deadface.png
Binary files differ
diff --git a/app/images/loginglogo.svg b/app/images/loginglogo.svg
new file mode 100644
index 000000000..ca8b0a2ee
--- /dev/null
+++ b/app/images/loginglogo.svg
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="128px" height="128px" viewBox="0 0 128 128" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 49.3 (51167) - http://www.bohemiancoding.com/sketch -->
+ <title>logo2</title>
+ <desc>Created with Sketch.</desc>
+ <defs>
+ <polygon id="path-1" points="0 82.118 126.527 82.118 126.527 0 0 0"></polygon>
+ </defs>
+ <g id="logo2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="Page-1" transform="translate(1.000000, 23.000000)">
+ <path d="M6.8811,74.2729 C6.6901,74.0489 6.4661,73.8719 6.2111,73.7389 C5.9551,73.6069 5.6861,73.5409 5.4031,73.5409 L0.0001,73.5409 L0.0001,82.0769 L0.9581,82.0769 L0.9581,74.4029 L5.2261,74.4029 C5.4261,74.4029 5.6071,74.4549 5.7661,74.5599 C5.9251,74.6649 6.0601,74.7969 6.1701,74.9569 C6.2791,75.1159 6.3631,75.2939 6.4231,75.4899 C6.4821,75.6859 6.5111,75.8759 6.5111,76.0579 C6.5111,76.2219 6.4891,76.3949 6.4431,76.5779 C6.3981,76.7599 6.3221,76.9289 6.2171,77.0839 C6.1121,77.2389 5.9831,77.3669 5.8281,77.4669 C5.6731,77.5669 5.4851,77.6179 5.2671,77.6179 L3.9941,77.6179 L3.9941,78.4789 L5.4311,78.4789 C5.7141,78.4789 5.9801,78.4129 6.2311,78.2809 C6.4821,78.1489 6.7031,77.9709 6.8951,77.7479 C7.0861,77.5239 7.2361,77.2679 7.3461,76.9809 C7.4561,76.6939 7.5101,76.3909 7.5101,76.0719 C7.5101,75.7149 7.4531,75.3829 7.3391,75.0729 C7.2251,74.7629 7.0721,74.4959 6.8811,74.2729" id="Fill-1" fill="#1B243D"></path>
+ <path d="M16.43,79.1157 C16.247,79.5207 15.999,79.8797 15.684,80.1887 C15.369,80.4997 15.005,80.7457 14.59,80.9277 C14.175,81.1107 13.735,81.2017 13.27,81.2017 C12.805,81.2017 12.365,81.1107 11.95,80.9277 C11.534,80.7457 11.172,80.4997 10.862,80.1887 C10.552,79.8797 10.305,79.5207 10.123,79.1157 C9.941,78.7097 9.85,78.2787 9.85,77.8227 C9.85,77.3757 9.941,76.9447 10.123,76.5297 C10.305,76.1147 10.552,75.7527 10.862,75.4417 C11.172,75.1327 11.537,74.8837 11.956,74.6967 C12.376,74.5097 12.818,74.4167 13.284,74.4167 C13.748,74.4167 14.188,74.5097 14.603,74.6967 C15.018,74.8837 15.381,75.1327 15.691,75.4417 C16.001,75.7527 16.247,76.1147 16.43,76.5297 C16.612,76.9447 16.703,77.3757 16.703,77.8227 C16.703,78.2787 16.612,78.7097 16.43,79.1157 M16.341,74.7647 C15.953,74.3777 15.495,74.0697 14.966,73.8417 C14.437,73.6137 13.872,73.4997 13.27,73.4997 C12.668,73.4997 12.102,73.6137 11.574,73.8417 C11.044,74.0697 10.586,74.3777 10.199,74.7647 C9.811,75.1527 9.503,75.6087 9.275,76.1337 C9.047,76.6577 8.933,77.2167 8.933,77.8087 C8.933,78.4017 9.047,78.9607 9.275,79.4847 C9.503,80.0097 9.811,80.4657 10.199,80.8527 C10.586,81.2407 11.044,81.5487 11.574,81.7757 C12.102,82.0047 12.668,82.1177 13.27,82.1177 C13.872,82.1177 14.437,82.0047 14.966,81.7757 C15.495,81.5487 15.953,81.2407 16.341,80.8527 C16.728,80.4657 17.036,80.0097 17.264,79.4847 C17.492,78.9607 17.606,78.4017 17.606,77.8087 C17.606,77.2167 17.492,76.6577 17.264,76.1337 C17.036,75.6087 16.728,75.1527 16.341,74.7647" id="Fill-3" fill="#1B243D"></path>
+ <path d="M26.2249,74.2729 C26.0329,74.0489 25.8089,73.8719 25.5549,73.7389 C25.2989,73.6069 25.0299,73.5409 24.7469,73.5409 L19.3439,73.5409 L19.3439,82.0769 L20.3009,82.0769 L20.3009,74.4029 L24.5699,74.4029 C24.7699,74.4029 24.9499,74.4549 25.1099,74.5599 C25.2689,74.6649 25.4039,74.7969 25.5139,74.9569 C25.6229,75.1159 25.7069,75.2939 25.7669,75.4899 C25.8259,75.6859 25.8549,75.8759 25.8549,76.0579 C25.8549,76.2219 25.8319,76.3949 25.7869,76.5779 C25.7409,76.7599 25.6659,76.9289 25.5609,77.0839 C25.4559,77.2389 25.3269,77.3669 25.1709,77.4669 C25.0169,77.5669 24.8289,77.6179 24.6109,77.6179 L23.2969,77.6179 L25.5819,82.0769 L26.6079,82.0769 L24.7879,78.4789 C25.0709,78.4789 25.3379,78.4129 25.5889,78.2809 C25.8389,78.1489 26.0579,77.9709 26.2459,77.7479 C26.4319,77.5239 26.5799,77.2679 26.6899,76.9809 C26.7989,76.6939 26.8539,76.3909 26.8539,76.0719 C26.8539,75.7149 26.7969,75.3829 26.6829,75.0729 C26.5689,74.7629 26.4159,74.4959 26.2249,74.2729" id="Fill-5" fill="#1B243D"></path>
+ <polygon id="Fill-7" fill="#1B243D" points="35.8694 73.5405 28.4134 73.5405 28.4134 74.4025 31.6554 74.4025 31.6554 82.0765 32.6134 82.0765 32.6134 74.4025 35.8694 74.4025"></polygon>
+ <polygon id="Fill-9" fill="#1B243D" points="35.3084 82.0766 41.4234 82.0766 40.8344 81.2156 36.8134 81.2156 39.7814 75.1406 43.2294 82.0766 44.2964 82.0766 39.7814 73.0896"></polygon>
+ <polygon id="Fill-11" fill="#1B243D" points="46.7859 73.5405 45.8279 73.5405 45.8279 82.0765 52.3269 82.0765 52.3269 81.2155 46.7859 81.2155"></polygon>
+ <polygon id="Fill-13" fill="#1B243D" points="66.0471 81.27 60.6441 73.541 59.0431 73.541 59.0431 82.077 60.0011 82.077 60.0011 74.334 65.5001 82.077 67.0051 82.077 67.0051 73.541 66.0471 73.541"></polygon>
+ <polygon id="Fill-15" fill="#1B243D" points="68.9202 82.0766 75.4182 82.0766 75.4182 81.2156 69.8782 81.2156 69.8782 74.4026 75.4182 74.4026 75.4182 73.5406 68.9202 73.5406"></polygon>
+ <mask id="mask-2" fill="white">
+ <use xlink:href="#path-1"></use>
+ </mask>
+ <g id="Clip-18"></g>
+ <polygon id="Fill-17" fill="#1B243D" mask="url(#mask-2)" points="71.218 78.479 75.309 78.479 75.309 77.618 71.218 77.618"></polygon>
+ <polygon id="Fill-19" fill="#1B243D" mask="url(#mask-2)" points="77.2923 74.4028 80.5343 74.4028 80.5343 82.0768 81.4923 82.0768 81.4923 74.4028 84.7483 74.4028 84.7483 73.5408 77.2923 73.5408"></polygon>
+ <polygon id="Fill-20" fill="#1B243D" mask="url(#mask-2)" points="95.8284 81.3657 91.6694 73.0897 87.5794 81.2977 87.5794 73.5407 86.6214 73.5407 86.6214 82.0767 88.2634 82.0767 91.6694 75.0997 95.1174 82.0767 96.7864 82.0767 96.7864 73.5407 95.8284 73.5407"></polygon>
+ <path d="M106.0203,79.1157 C105.8373,79.5207 105.5893,79.8797 105.2743,80.1887 C104.9603,80.4997 104.5953,80.7457 104.1803,80.9277 C103.7653,81.1107 103.3253,81.2017 102.8603,81.2017 C102.3953,81.2017 101.9553,81.1107 101.5403,80.9277 C101.1243,80.7457 100.7623,80.4997 100.4523,80.1887 C100.1423,79.8797 99.8953,79.5207 99.7133,79.1157 C99.5313,78.7097 99.4403,78.2787 99.4403,77.8227 C99.4403,77.3757 99.5313,76.9447 99.7133,76.5297 C99.8953,76.1147 100.1423,75.7527 100.4523,75.4417 C100.7623,75.1327 101.1273,74.8837 101.5463,74.6967 C101.9663,74.5097 102.4093,74.4167 102.8743,74.4167 C103.3393,74.4167 103.7793,74.5097 104.1943,74.6967 C104.6083,74.8837 104.9713,75.1327 105.2813,75.4417 C105.5913,75.7527 105.8373,76.1147 106.0203,76.5297 C106.2023,76.9447 106.2933,77.3757 106.2933,77.8227 C106.2933,78.2787 106.2023,78.7097 106.0203,79.1157 M105.9313,74.7647 C105.5433,74.3777 105.0853,74.0697 104.5563,73.8417 C104.0273,73.6137 103.4623,73.4997 102.8603,73.4997 C102.2583,73.4997 101.6923,73.6137 101.1643,73.8417 C100.6343,74.0697 100.1763,74.3777 99.7893,74.7647 C99.4013,75.1527 99.0933,75.6087 98.8653,76.1337 C98.6373,76.6577 98.5233,77.2167 98.5233,77.8087 C98.5233,78.4017 98.6373,78.9607 98.8653,79.4847 C99.0933,80.0097 99.4013,80.4657 99.7893,80.8527 C100.1763,81.2407 100.6343,81.5487 101.1643,81.7757 C101.6923,82.0047 102.2583,82.1177 102.8603,82.1177 C103.4623,82.1177 104.0273,82.0047 104.5563,81.7757 C105.0853,81.5487 105.5433,81.2407 105.9313,80.8527 C106.3193,80.4657 106.6263,80.0097 106.8543,79.4847 C107.0823,78.9607 107.1963,78.4017 107.1963,77.8087 C107.1963,77.2167 107.0823,76.6577 106.8543,76.1337 C106.6263,75.6087 106.3193,75.1527 105.9313,74.7647" id="Fill-21" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M115.8152,74.2729 C115.6232,74.0489 115.4002,73.8719 115.1452,73.7389 C114.8892,73.6069 114.6202,73.5409 114.3372,73.5409 L108.9342,73.5409 L108.9342,82.0769 L109.8912,82.0769 L109.8912,74.4029 L114.1602,74.4029 C114.3602,74.4029 114.5402,74.4549 114.7002,74.5599 C114.8592,74.6649 114.9942,74.7969 115.1042,74.9569 C115.2132,75.1159 115.2972,75.2939 115.3572,75.4899 C115.4162,75.6859 115.4452,75.8759 115.4452,76.0579 C115.4452,76.2219 115.4222,76.3949 115.3772,76.5779 C115.3312,76.7599 115.2562,76.9289 115.1512,77.0839 C115.0462,77.2389 114.9172,77.3669 114.7612,77.4669 C114.6072,77.5669 114.4192,77.6179 114.2012,77.6179 L112.8872,77.6179 L115.1722,82.0769 L116.1982,82.0769 L114.3782,78.4789 C114.6612,78.4789 114.9282,78.4129 115.1792,78.2809 C115.4292,78.1489 115.6482,77.9709 115.8362,77.7479 C116.0222,77.5239 116.1702,77.2679 116.2802,76.9809 C116.3892,76.6939 116.4442,76.3909 116.4442,76.0719 C116.4442,75.7149 116.3872,75.3829 116.2732,75.0729 C116.1592,74.7629 116.0062,74.4959 115.8152,74.2729" id="Fill-22" fill="#1B243D" mask="url(#mask-2)"></path>
+ <polygon id="Fill-23" fill="#1B243D" mask="url(#mask-2)" points="126.5266 73.5405 125.4866 73.5405 123.3666 77.8505 125.4866 82.0765 126.5266 82.0765 124.4336 77.8505"></polygon>
+ <polygon id="Fill-24" fill="#1B243D" mask="url(#mask-2)" points="119.2078 73.5405 118.2498 73.5405 118.2498 82.0765 119.2078 82.0765 119.2078 78.2735 122.1078 78.2735 122.1078 77.4115 119.2078 77.4115"></polygon>
+ <path d="M72.4627,48.06 C67.3487,48.06 61.5897,46.102 56.2467,42.545 C55.7657,42.225 55.2427,42.234 55.0787,42.564 C54.9137,42.894 55.1697,43.421 55.6507,43.741 C61.4477,47.6 67.6967,49.725 73.2447,49.725 C77.8417,49.725 81.5387,48.281 83.9357,45.548 C86.2857,42.87 87.1877,39.202 86.5457,34.942 C86.4797,34.504 86.0177,34.036 85.5137,33.896 C85.0107,33.756 84.6557,33.998 84.7217,34.436 C85.3137,38.362 84.4817,41.743 82.3157,44.211 C80.1077,46.73 76.6997,48.06 72.4627,48.06" id="Fill-25" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M84.5081,28.4746 C84.2921,28.0146 83.7441,27.6416 83.2851,27.6416 C82.8251,27.6416 82.6281,28.0146 82.8431,28.4746 C83.2451,29.3286 83.5941,30.1886 83.8801,31.0306 C84.0341,31.4866 84.5521,31.9036 85.0361,31.9626 C85.0741,31.9676 85.1121,31.9706 85.1481,31.9706 C85.5591,31.9706 85.7741,31.6646 85.6311,31.2456 C85.3211,30.3326 84.9441,29.4006 84.5081,28.4746" id="Fill-26" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M71.5769,13.6919 C65.5769,9.5209 59.0759,7.2239 53.2699,7.2239 C48.6269,7.2239 44.9069,8.6949 42.5129,11.4779 C40.1969,14.1689 39.3079,17.9979 40.0099,22.2589 C40.0819,22.6979 40.5479,23.1639 41.0509,23.2979 C41.1429,23.3219 41.2309,23.3339 41.3109,23.3339 C41.6679,23.3339 41.8889,23.1039 41.8299,22.7449 C41.1839,18.8179 42.0039,15.2889 44.1379,12.8079 C46.3439,10.2439 49.7719,8.8879 54.0529,8.8879 C59.4039,8.8879 65.3959,11.0049 70.9259,14.8499 C71.4009,15.1799 71.9309,15.1889 72.1109,14.8689 C72.2909,14.5489 72.0519,14.0219 71.5769,13.6919" id="Fill-27" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M42.6355,25.9184 C42.4805,25.4624 41.9635,25.0444 41.4795,24.9854 C40.9955,24.9264 40.7285,25.2474 40.8845,25.7034 C41.1935,26.6164 41.5715,27.5484 42.0075,28.4744 C42.2225,28.9344 42.7705,29.3064 43.2305,29.3064 C43.6905,29.3064 43.8875,28.9344 43.6715,28.4744 C43.2695,27.6194 42.9215,26.7594 42.6355,25.9184" id="Fill-28" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M48.9544,5.5986 C48.9954,5.5986 49.0354,5.5956 49.0734,5.5896 C50.1214,5.4216 51.2354,5.3376 52.3844,5.3376 C52.8434,5.3376 53.0404,4.9646 52.8254,4.5046 C52.6094,4.0456 52.0614,3.6726 51.6014,3.6726 C50.3714,3.6726 49.1784,3.7636 48.0554,3.9426 C47.6324,4.0106 47.5174,4.4336 47.7984,4.8886 C48.0544,5.3016 48.5494,5.5986 48.9544,5.5986" id="Fill-29" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M38.4558,28.4746 C41.5898,35.1436 47.1408,41.4016 54.0858,46.0956 C54.3238,46.2566 54.5728,46.3366 54.7848,46.3366 C54.9988,46.3366 55.1738,46.2546 55.2598,46.0896 C55.4298,45.7636 55.1798,45.2356 54.7008,44.9126 C48.2228,40.5336 43.0448,34.6966 40.1208,28.4746 C37.7008,23.3246 37.0648,18.4506 38.2838,14.3796 C39.4638,10.4356 42.3918,7.5286 46.5268,6.1936 C46.9118,6.0696 46.9538,5.6106 46.6218,5.1676 C46.2888,4.7246 45.7088,4.4676 45.3248,4.5906 C40.8908,6.0226 37.7518,9.1386 36.4868,13.3646 C35.1808,17.7296 35.8618,22.9536 38.4558,28.4746" id="Fill-30" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M77.4417,51.3588 C76.3937,51.5268 75.2797,51.6118 74.1307,51.6118 C73.6717,51.6118 73.4737,51.9838 73.6907,52.4438 C73.9057,52.9028 74.4537,53.2758 74.9137,53.2758 C76.1437,53.2758 77.3367,53.1848 78.4607,53.0048 C78.8827,52.9378 78.9977,52.5148 78.7167,52.0598 C78.4357,51.6058 77.8647,51.2918 77.4417,51.3588" id="Fill-31" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M88.0589,28.4741 C84.9249,21.8061 79.3749,15.5481 72.4319,10.8551 C71.9539,10.5311 71.4279,10.5341 71.2579,10.8601 C71.0879,11.1871 71.3379,11.7141 71.8159,12.0371 C78.2939,16.4161 83.4709,22.2531 86.3949,28.4741 C88.7639,33.5141 89.4229,38.3051 88.3009,42.3281 C87.2169,46.2181 84.4469,49.1491 80.5019,50.5781 C80.1259,50.7151 80.0999,51.1811 80.4419,51.6201 C80.7209,51.9771 81.1569,52.2061 81.5129,52.2061 C81.5939,52.2061 81.6709,52.1951 81.7419,52.1691 C85.9709,50.6351 88.9399,47.4951 90.1029,43.3251 C91.3049,39.0121 90.5989,33.8771 88.0589,28.4741" id="Fill-32" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M36.5716,28.4746 C36.3556,28.0146 35.8076,27.6416 35.3476,27.6416 C34.8886,27.6416 34.6906,28.0146 34.9066,28.4746 C37.7026,34.4226 42.1996,40.1156 47.9136,44.9396 C48.1826,45.1666 48.4956,45.2876 48.7556,45.2876 C48.9226,45.2876 49.0686,45.2376 49.1656,45.1336 C49.4136,44.8656 49.2566,44.3466 48.8136,43.9726 C43.4356,39.4326 39.2026,34.0736 36.5716,28.4746" id="Fill-33" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M56.8172,49.5649 C55.1282,48.6039 53.4612,47.5269 51.8632,46.3639 C51.3942,46.0229 50.8562,45.9969 50.6592,46.3039 C50.4632,46.6129 50.6842,47.1389 51.1522,47.4799 C52.8492,48.7149 54.6202,49.8589 56.4142,50.8789 C56.6212,50.9979 56.8282,51.0549 57.0062,51.0549 C57.2542,51.0549 57.4482,50.9439 57.5132,50.7329 C57.6242,50.3699 57.3132,49.8469 56.8172,49.5649" id="Fill-34" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M75.7991,55.1606 C70.9321,55.1606 65.5491,53.8386 60.2301,51.3366 C59.7241,51.0986 59.2721,51.2246 59.2191,51.6186 C59.1671,52.0126 59.5341,52.5236 60.0391,52.7616 C65.6911,55.4206 71.4111,56.8246 76.5821,56.8246 C77.0411,56.8246 77.2381,56.4526 77.0231,55.9926 C76.8061,55.5326 76.2591,55.1606 75.7991,55.1606" id="Fill-35" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M71.843,8.6733 C75.749,11.1523 79.3,14.1083 82.396,17.4603 C85.599,20.9283 88.139,24.6343 89.944,28.4743 C90.16,28.9343 90.707,29.3063 91.167,29.3063 C91.627,29.3063 91.824,28.9343 91.608,28.4743 C89.691,24.3953 86.993,20.4583 83.588,16.7723 C80.3,13.2113 76.528,10.0713 72.379,7.4383 C71.893,7.1303 71.379,7.1563 71.231,7.4983 C71.083,7.8393 71.357,8.3653 71.843,8.6733" id="Fill-36" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M64.1145,4.6572 C65.5935,5.2632 67.0835,5.9662 68.5425,6.7462 C68.7385,6.8512 68.9315,6.9012 69.0985,6.9012 C69.3585,6.9012 69.5575,6.7802 69.6135,6.5532 C69.7045,6.1782 69.3735,5.6592 68.8735,5.3912 C67.3235,4.5622 65.7405,3.8162 64.1695,3.1722 C63.6625,2.9652 63.2385,3.1282 63.2225,3.5382 C63.2075,3.9492 63.6075,4.4492 64.1145,4.6572" id="Fill-37" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M50.7161,1.788 C53.6641,1.788 56.7851,2.266 59.9921,3.207 C60.0951,3.237 60.1921,3.252 60.2811,3.252 C60.6281,3.252 60.8491,3.034 60.8041,2.687 C60.7471,2.252 60.2931,1.78 59.7881,1.631 C56.3801,0.631 53.0651,0.123 49.9331,0.123 C49.4741,0.123 49.2761,0.496 49.4921,0.956 C49.7081,1.415 50.2561,1.788 50.7161,1.788" id="Fill-38" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M36.7913,1.5722 C37.1013,1.3622 37.0253,0.8602 36.6233,0.4512 C36.2213,0.0432 35.6443,-0.1178 35.3333,0.0932 C32.3243,2.1362 30.1993,4.9382 29.0183,8.4202 C28.8973,8.7782 29.1993,9.3012 29.6923,9.5912 C29.9053,9.7152 30.1183,9.7762 30.3023,9.7762 C30.5443,9.7762 30.7353,9.6702 30.8043,9.4672 C31.9243,6.1662 33.9383,3.5102 36.7913,1.5722" id="Fill-39" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M29.3557,10.9082 C28.8527,10.6582 28.3887,10.7682 28.3197,11.1542 C28.1767,11.9612 28.0807,12.8002 28.0327,13.6492 C28.0107,14.0562 28.4037,14.5592 28.9107,14.7732 C29.0647,14.8382 29.2117,14.8692 29.3417,14.8692 C29.6417,14.8692 29.8547,14.7072 29.8707,14.4242 C29.9157,13.6192 30.0067,12.8242 30.1427,12.0592 C30.2107,11.6732 29.8587,11.1582 29.3557,10.9082" id="Fill-40" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M96.823,47.3579 C96.33,47.0689 95.832,47.1249 95.711,47.4819 C94.591,50.7829 92.576,53.4389 89.723,55.3769 C89.414,55.5869 89.489,56.0889 89.891,56.4979 C90.174,56.7849 90.542,56.9499 90.844,56.9499 C90.972,56.9499 91.089,56.9199 91.181,56.8569 C94.191,54.8119 96.316,52.0099 97.497,48.5289 C97.617,48.1709 97.316,47.6469 96.823,47.3579" id="Fill-41" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M97.6082,41.9389 C97.1012,41.7279 96.6742,41.8889 96.6562,42.2969 C96.6162,43.1809 96.5212,44.0529 96.3722,44.8889 C96.3042,45.2749 96.6562,45.7909 97.1592,46.0409 C97.3412,46.1299 97.5192,46.1739 97.6742,46.1739 C97.9462,46.1739 98.1512,46.0409 98.1942,45.7939 C98.3512,44.9129 98.4522,43.9929 98.4942,43.0589 C98.5122,42.6509 98.1162,42.1489 97.6082,41.9389" id="Fill-42" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M70.7937,44.5092 C61.9517,44.5092 51.3777,37.3162 47.2227,28.4742 C43.0667,19.6332 46.8797,12.4392 55.7217,12.4392 C64.5637,12.4392 75.1377,19.6332 79.2927,28.4742 C83.4477,37.3162 79.6357,44.5092 70.7937,44.5092 M54.9397,10.7752 C45.1797,10.7752 40.9717,18.7152 45.5577,28.4742 C50.1447,38.2342 61.8157,46.1742 71.5757,46.1742 C81.3357,46.1742 85.5437,38.2342 80.9577,28.4742 C76.3707,18.7152 64.6987,10.7752 54.9397,10.7752" id="Fill-43" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M36.9939,5.7876 C36.5479,5.4176 35.9899,5.3376 35.7469,5.6096 C34.2189,7.3236 33.1309,9.3756 32.5139,11.7096 C32.4159,12.0796 32.7409,12.6006 33.2389,12.8726 C33.4379,12.9816 33.6359,13.0346 33.8059,13.0346 C34.0619,13.0346 34.2599,12.9166 34.3179,12.6946 C34.8999,10.4966 35.9239,8.5646 37.3629,6.9516 C37.6049,6.6786 37.4399,6.1586 36.9939,5.7876" id="Fill-44" fill="#1B243D" mask="url(#mask-2)"></path>
+ <path d="M90.5696,51.5581 C92.2026,49.8011 93.3576,47.6751 94.0016,45.2401 C94.0996,44.8691 93.7756,44.3481 93.2766,44.0761 C92.7776,43.8041 92.2946,43.8831 92.1966,44.2541 C91.5906,46.5471 90.5026,48.5491 88.9656,50.2041 C88.7166,50.4701 88.8746,50.9911 89.3176,51.3641 C89.5866,51.5911 89.8996,51.7121 90.1596,51.7121 C90.3266,51.7121 90.4716,51.6621 90.5696,51.5581" id="Fill-45" fill="#1B243D" mask="url(#mask-2)"></path>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/app/images/logo.png b/app/images/logo.png
new file mode 100644
index 000000000..db6ba7d6c
--- /dev/null
+++ b/app/images/logo.png
Binary files differ
diff --git a/app/images/pw-128x128.png b/app/images/pw-128x128.png
new file mode 100644
index 000000000..a0eb1b730
--- /dev/null
+++ b/app/images/pw-128x128.png
Binary files differ
diff --git a/app/images/pw-48x48.png b/app/images/pw-48x48.png
new file mode 100644
index 000000000..a96c59e15
--- /dev/null
+++ b/app/images/pw-48x48.png
Binary files differ
diff --git a/app/images/pw128x128.png b/app/images/pw128x128.png
new file mode 100644
index 000000000..a0eb1b730
--- /dev/null
+++ b/app/images/pw128x128.png
Binary files differ
diff --git a/app/loading.html b/app/loading.html
new file mode 100644
index 000000000..aef5d9607
--- /dev/null
+++ b/app/loading.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+ <title>MetaMask Loading</title>
+ <style>
+ #div-logo {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 256px;
+ }
+ #logo {
+ width: 100%;
+ animation: pulse 1s ease-in-out infinite;
+ }
+ @keyframes pulse {
+ 0% {
+ opacity: 1;
+ }
+ 50% {
+ opacity: 0.5;
+ transform: scale(0.95, 0.95);
+ }
+ 100% {
+ opacity: 1;
+ }
+ }
+ </style>
+</head>
+<body>
+ <div id="div-logo">
+ <img id="logo" src="./images/loginglogo.svg">
+ </div>
+</body>
+</html>
diff --git a/app/manifest.json b/app/manifest.json
index 50b7e3c53..a226adfb0 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -59,7 +59,10 @@
"unlimitedStorage",
"clipboardWrite",
"http://localhost:8545/",
- "https://*.infura.io/"
+ "https://*.infura.io/",
+ "activeTab",
+ "webRequest",
+ "*://*.eth/"
],
"web_accessible_resources": [
"inpage.js"
@@ -72,4 +75,4 @@
"*"
]
}
-} \ No newline at end of file
+}
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 54511631f..1479d9f72 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -26,6 +26,8 @@ const setupMetamaskMeshMetrics = require('./lib/setupMetamaskMeshMetrics')
const EdgeEncryptor = require('./edge-encryptor')
const getFirstPreferredLangCode = require('./lib/get-first-preferred-lang-code')
const getObjStructure = require('./lib/getObjStructure')
+const ipfsContent = require('./lib/ipfsContent.js')
+
const {
ENVIRONMENT_TYPE_POPUP,
ENVIRONMENT_TYPE_NOTIFICATION,
@@ -66,6 +68,7 @@ initialize().catch(log.error)
// setup metamask mesh testing container
setupMetamaskMeshMetrics()
+
/**
* An object representing a transaction, in whatever state it is in.
* @typedef TransactionMeta
@@ -155,6 +158,7 @@ async function initialize () {
const initLangCode = await getFirstPreferredLangCode()
await setupController(initState, initLangCode)
log.debug('MetaMask initialization complete.')
+ ipfsContent(initState.NetworkController.provider)
}
//
@@ -258,6 +262,7 @@ function setupController (initState, initLangCode) {
})
global.metamaskController = controller
+
// report failed transactions to Sentry
controller.txController.on(`tx:status-update`, (txId, status) => {
if (status !== 'failed') return
diff --git a/app/scripts/lib/contracts/registrar.js b/app/scripts/lib/contracts/registrar.js
new file mode 100644
index 000000000..99ca24458
--- /dev/null
+++ b/app/scripts/lib/contracts/registrar.js
@@ -0,0 +1 @@
+module.exports = [{'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'resolver', 'outputs': [{'name': '', 'type': 'address'}], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'owner', 'outputs': [{'name': '', 'type': 'address'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'label', 'type': 'bytes32'}, {'name': 'owner', 'type': 'address'}], 'name': 'setSubnodeOwner', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'ttl', 'type': 'uint64'}], 'name': 'setTTL', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'ttl', 'outputs': [{'name': '', 'type': 'uint64'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'resolver', 'type': 'address'}], 'name': 'setResolver', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'owner', 'type': 'address'}], 'name': 'setOwner', 'outputs': [], 'payable': false, 'type': 'function'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'owner', 'type': 'address'}], 'name': 'Transfer', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': true, 'name': 'label', 'type': 'bytes32'}, {'indexed': false, 'name': 'owner', 'type': 'address'}], 'name': 'NewOwner', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'resolver', 'type': 'address'}], 'name': 'NewResolver', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'ttl', 'type': 'uint64'}], 'name': 'NewTTL', 'type': 'event'}]
diff --git a/app/scripts/lib/contracts/resolver.js b/app/scripts/lib/contracts/resolver.js
new file mode 100644
index 000000000..1bf3f90ce
--- /dev/null
+++ b/app/scripts/lib/contracts/resolver.js
@@ -0,0 +1,2 @@
+module.exports =
+[{'constant': true, 'inputs': [{'name': 'interfaceID', 'type': 'bytes4'}], 'name': 'supportsInterface', 'outputs': [{'name': '', 'type': 'bool'}], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'contentTypes', 'type': 'uint256'}], 'name': 'ABI', 'outputs': [{'name': 'contentType', 'type': 'uint256'}, {'name': 'data', 'type': 'bytes'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'x', 'type': 'bytes32'}, {'name': 'y', 'type': 'bytes32'}], 'name': 'setPubkey', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'content', 'outputs': [{'name': 'ret', 'type': 'bytes32'}], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'addr', 'outputs': [{'name': 'ret', 'type': 'address'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'contentType', 'type': 'uint256'}, {'name': 'data', 'type': 'bytes'}], 'name': 'setABI', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'name', 'outputs': [{'name': 'ret', 'type': 'string'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'name', 'type': 'string'}], 'name': 'setName', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'hash', 'type': 'bytes32'}], 'name': 'setContent', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'pubkey', 'outputs': [{'name': 'x', 'type': 'bytes32'}, {'name': 'y', 'type': 'bytes32'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'addr', 'type': 'address'}], 'name': 'setAddr', 'outputs': [], 'payable': false, 'type': 'function'}, {'inputs': [{'name': 'ensAddr', 'type': 'address'}], 'payable': false, 'type': 'constructor'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'a', 'type': 'address'}], 'name': 'AddrChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'hash', 'type': 'bytes32'}], 'name': 'ContentChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'name', 'type': 'string'}], 'name': 'NameChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': true, 'name': 'contentType', 'type': 'uint256'}], 'name': 'ABIChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'x', 'type': 'bytes32'}, {'indexed': false, 'name': 'y', 'type': 'bytes32'}], 'name': 'PubkeyChanged', 'type': 'event'}]
diff --git a/app/scripts/lib/ipfsContent.js b/app/scripts/lib/ipfsContent.js
new file mode 100644
index 000000000..a6b99b2f9
--- /dev/null
+++ b/app/scripts/lib/ipfsContent.js
@@ -0,0 +1,40 @@
+const extension = require('extensionizer')
+const resolver = require('./resolver.js')
+
+module.exports = function (provider) {
+ extension.webRequest.onBeforeRequest.addListener(details => {
+ const urlhttpreplace = details.url.replace(/\w+?:\/\//, '')
+ const url = urlhttpreplace.replace(/[\\/].*/g, '') // eslint-disable-line no-useless-escape
+ let domainhtml = urlhttpreplace.match(/[\\/].*/g) // eslint-disable-line no-useless-escape
+ let clearTime = null
+ const name = url.replace(/\/$/g, '')
+ if (domainhtml === null) domainhtml = ['']
+ extension.tabs.getSelected(null, tab => {
+ extension.tabs.update(tab.id, { url: 'loading.html' })
+
+ clearTime = setTimeout(() => {
+ return extension.tabs.update(tab.id, { url: '404.html' })
+ }, 60000)
+
+ resolver.resolve(name, provider).then(ipfsHash => {
+ clearTimeout(clearTime)
+ let url = 'https://ipfs.infura.io/ipfs/' + ipfsHash + domainhtml[0]
+ return fetch(url, { method: 'HEAD' }).then(response => response.status).then(statusCode => {
+ if (statusCode !== 200) return extension.tabs.update(tab.id, { url: '404.html' })
+ extension.tabs.update(tab.id, { url: url })
+ })
+ .catch(err => {
+ url = 'https://ipfs.infura.io/ipfs/' + ipfsHash + domainhtml[0]
+ extension.tabs.update(tab.id, {url: url})
+ return err
+ })
+ })
+ .catch(err => {
+ clearTimeout(clearTime)
+ const url = err === 'unsupport' ? 'unsupport' : 'error'
+ extension.tabs.update(tab.id, {url: `${url}.html?name=${name}`})
+ })
+ })
+ return { cancel: true }
+ }, {urls: ['*://*.eth/', '*://*.eth/*']})
+}
diff --git a/app/scripts/lib/resolver.js b/app/scripts/lib/resolver.js
new file mode 100644
index 000000000..6786929d8
--- /dev/null
+++ b/app/scripts/lib/resolver.js
@@ -0,0 +1,71 @@
+const namehash = require('eth-ens-namehash')
+const multihash = require('multihashes')
+const HttpProvider = require('ethjs-provider-http')
+const Eth = require('ethjs-query')
+const EthContract = require('ethjs-contract')
+const registrarAbi = require('./contracts/registrar')
+const resolverAbi = require('./contracts/resolver')
+
+function ens (name, provider) {
+ const eth = new Eth(new HttpProvider(getProvider(provider.type)))
+ const hash = namehash.hash(name)
+ const contract = new EthContract(eth)
+ const Registrar = contract(registrarAbi).at(getRegistrar(provider.type))
+ return new Promise((resolve, reject) => {
+ if (provider.type === 'mainnet' || provider.type === 'ropsten') {
+ Registrar.resolver(hash).then((address) => {
+ if (address === '0x0000000000000000000000000000000000000000') {
+ reject(null)
+ } else {
+ const Resolver = contract(resolverAbi).at(address['0'])
+ return Resolver.content(hash)
+ }
+ }).then((contentHash) => {
+ if (contentHash['0'] === '0x0000000000000000000000000000000000000000000000000000000000000000') reject(null)
+ if (contentHash.ret !== '0x') {
+ const hex = contentHash['0'].substring(2)
+ const buf = multihash.fromHexString(hex)
+ resolve(multihash.toB58String(multihash.encode(buf, 'sha2-256')))
+ } else {
+ reject(null)
+ }
+ })
+ } else {
+ return reject('unsupport')
+ }
+ })
+}
+
+function getProvider (type) {
+ switch (type) {
+ case 'mainnet':
+ return 'https://mainnet.infura.io/'
+ case 'ropsten':
+ return 'https://ropsten.infura.io/'
+ default:
+ return 'http://localhost:8545/'
+ }
+}
+
+function getRegistrar (type) {
+ switch (type) {
+ case 'mainnet':
+ return '0x314159265dd8dbb310642f98f50c066173c1259b'
+ case 'ropsten':
+ return '0x112234455c3a32fd11230c42e7bccd4a84e02010'
+ default:
+ return '0x0000000000000000000000000000000000000000'
+ }
+}
+
+module.exports.resolve = function (name, provider) {
+ const path = name.split('.')
+ const tld = path[path.length - 1]
+ if (tld === 'eth') {
+ return ens(name, provider)
+ } else {
+ return new Promise((resolve, reject) => {
+ reject(null)
+ })
+ }
+}
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 1246629be..d70bac1c3 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -341,6 +341,7 @@ module.exports = class MetamaskController extends EventEmitter {
markAccountsFound: this.markAccountsFound.bind(this),
markPasswordForgotten: this.markPasswordForgotten.bind(this),
unMarkPasswordForgotten: this.unMarkPasswordForgotten.bind(this),
+ getGasPrice: (cb) => cb(null, this.getGasPrice()),
// coinbase
buyEth: this.buyEth.bind(this),
diff --git a/app/unsupport.html b/app/unsupport.html
new file mode 100644
index 000000000..6f514eb17
--- /dev/null
+++ b/app/unsupport.html
@@ -0,0 +1,59 @@
+<!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> \ No newline at end of file
diff --git a/old-ui/app/app.js b/old-ui/app/app.js
index 5c2dccc03..0637e3b5b 100644
--- a/old-ui/app/app.js
+++ b/old-ui/app/app.js
@@ -183,6 +183,7 @@ App.prototype.renderAppBar = function () {
this.setState({ isNetworkMenuOpen: !isNetworkMenuOpen })
},
}),
+
]),
props.isUnlocked && h('div', {
diff --git a/old-ui/app/keychains/hd/restore-vault.js b/old-ui/app/keychains/hd/restore-vault.js
index d334d8e5f..e9486a28d 100644
--- a/old-ui/app/keychains/hd/restore-vault.js
+++ b/old-ui/app/keychains/hd/restore-vault.js
@@ -42,9 +42,6 @@ RestoreVaultScreen.prototype.render = function () {
// wallet seed entry
h('h3', 'Wallet Seed'),
h('textarea.twelve-word-phrase.letter-spacey', {
- dataset: {
- persistentFormId: 'wallet-seed',
- },
placeholder: 'Enter your secret twelve word phrase here to restore your vault.',
}),
diff --git a/package-lock.json b/package-lock.json
index e316705b4..a2b4fc34f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8352,11 +8352,11 @@
"from": "github:MetaMask/eth-contract-metadata#master"
},
"eth-ens-namehash": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-1.0.2.tgz",
- "integrity": "sha1-Bezda6wtf9e8XKhKmTxrrZ2k7bk=",
+ "version": "2.0.8",
+ "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz",
+ "integrity": "sha1-IprEbsqG1S4MmR58sq74P/D2i88=",
"requires": {
- "idna-uts46": "^1.0.1",
+ "idna-uts46-hx": "^2.3.1",
"js-sha3": "^0.5.7"
},
"dependencies": {
@@ -9301,6 +9301,22 @@
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz",
"integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU="
},
+ "eth-ens-namehash": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-1.0.2.tgz",
+ "integrity": "sha1-Bezda6wtf9e8XKhKmTxrrZ2k7bk=",
+ "requires": {
+ "idna-uts46": "^1.0.1",
+ "js-sha3": "^0.5.7"
+ },
+ "dependencies": {
+ "js-sha3": {
+ "version": "0.5.7",
+ "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz",
+ "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc="
+ }
+ }
+ },
"ethjs-contract": {
"version": "0.1.9",
"resolved": "https://registry.npmjs.org/ethjs-contract/-/ethjs-contract-0.1.9.tgz",
@@ -15159,6 +15175,21 @@
},
"dependencies": {
"punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
+ }
+ }
+ },
+ "idna-uts46-hx": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz",
+ "integrity": "sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==",
+ "requires": {
+ "punycode": "2.1.0"
+ },
+ "dependencies": {
+ "punycode": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz",
"integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0="
@@ -20105,6 +20136,38 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
+ "multihashes": {
+ "version": "0.4.13",
+ "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.13.tgz",
+ "integrity": "sha512-HwJGEKPCpLlNlgGQA56CYh/Wsqa+c4JAq8+mheIgw7OK5T4QvNJqgp6TH8gZ4q4l1aiWeNat/H/MrFXmTuoFfQ==",
+ "requires": {
+ "bs58": "^4.0.1",
+ "varint": "^5.0.0"
+ },
+ "dependencies": {
+ "base-x": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.4.tgz",
+ "integrity": "sha512-UYOadoSIkEI/VrRGSG6qp93rp2WdokiAiNYDfGW5qURAY8GiAQkvMbwNNSDYiVJopqv4gCna7xqf4rrNGp+5AA==",
+ "requires": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "bs58": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz",
+ "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=",
+ "requires": {
+ "base-x": "^3.0.2"
+ }
+ },
+ "varint": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.0.tgz",
+ "integrity": "sha1-2Ca4n3SQcy+rwMDtaT7Uddyynr8="
+ }
+ }
+ },
"multimatch": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/multimatch/-/multimatch-2.1.0.tgz",
diff --git a/package.json b/package.json
index c9253bb74..674ebd3a5 100644
--- a/package.json
+++ b/package.json
@@ -193,7 +193,9 @@
"web3": "^0.20.1",
"web3-provider-engine": "^14.0.5",
"web3-stream-provider": "^3.0.1",
- "xtend": "^4.0.1"
+ "xtend": "^4.0.1",
+ "multihashes": "^0.4.12",
+ "eth-ens-namehash": "^2.0.8"
},
"devDependencies": {
"@sentry/cli": "^1.30.3",
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js
index 5f270b52b..b07b1ecd7 100644
--- a/test/e2e/beta/metamask-beta-ui.spec.js
+++ b/test/e2e/beta/metamask-beta-ui.spec.js
@@ -355,9 +355,12 @@ describe('MetaMask', function () {
await seedTextArea.sendKeys(testSeedPhrase)
await delay(regularDelayMs)
- await driver.findElement(By.id('password-box')).sendKeys('correct horse battery staple')
- await driver.findElement(By.id('password-box-confirm')).sendKeys('correct horse battery staple')
- await driver.findElement(By.css('button:nth-child(2)')).click()
+ const passwordInputs = await driver.findElements(By.css('input'))
+ await delay(regularDelayMs)
+
+ passwordInputs[0].sendKeys('correct horse battery staple')
+ passwordInputs[1].sendKeys('correct horse battery staple')
+ await driver.findElement(By.css('.first-time-flow__button')).click()
await delay(regularDelayMs)
})
diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index 241358135..d5e80151c 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -112,19 +112,8 @@ async function runSendFlowTest (assert, done) {
errorMessage = $('.send-v2__error')
assert.equal(errorMessage.length, 0, 'send should stop rendering amount error message after amount is corrected')
- const sendGasField = await queryAsync($, '.send-v2__gas-fee-display')
- assert.equal(
- sendGasField.find('.currency-display__input-wrapper > input').val(),
- '0.000021',
- 'send gas field should show estimated gas total'
- )
- assert.equal(
- sendGasField.find('.currency-display__converted-value')[0].textContent,
- '$0.03 USD',
- 'send gas field should show estimated gas total converted to USD'
- )
-
await customizeGas(assert, 0, 21000, '0', '$0.00 USD')
+ await customizeGas(assert, 1, 21000, '0.000021', '$0.03 USD')
await customizeGas(assert, 500, 60000, '0.03', '$36.03 USD')
const sendButton = await queryAsync($, 'button.btn-primary.btn--large.page-container__footer-button')
diff --git a/ui/app/actions.js b/ui/app/actions.js
index c822ef3ee..f04de8fe8 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -6,7 +6,6 @@ const {
calcGasTotal,
calcTokenBalance,
estimateGas,
- estimateGasPriceFromRecentBlocks,
} = require('./components/send_/send.utils')
const ethUtil = require('ethereumjs-util')
const { fetchLocale } = require('../i18n-helper')
@@ -788,19 +787,26 @@ function updateGasData ({
}) {
return (dispatch) => {
dispatch(actions.gasLoadingStarted())
- const estimatedGasPrice = estimateGasPriceFromRecentBlocks(recentBlocks)
- return Promise.all([
- Promise.resolve(estimatedGasPrice),
- estimateGas({
- estimateGasMethod: background.estimateGas,
- blockGasLimit,
- selectedAddress,
- selectedToken,
- to,
- value,
- gasPrice: estimatedGasPrice,
- }),
- ])
+ return new Promise((resolve, reject) => {
+ background.getGasPrice((err, data) => {
+ if (err) return reject(err)
+ return resolve(data)
+ })
+ })
+ .then(estimateGasPrice => {
+ return Promise.all([
+ Promise.resolve(estimateGasPrice),
+ estimateGas({
+ estimateGasMethod: background.estimateGas,
+ blockGasLimit,
+ selectedAddress,
+ selectedToken,
+ to,
+ value,
+ estimateGasPrice,
+ }),
+ ])
+ })
.then(([gasPrice, gas]) => {
dispatch(actions.setGasPrice(gasPrice))
dispatch(actions.setGasLimit(gas))
diff --git a/ui/app/app.js b/ui/app/app.js
index d0e48a368..670b7e2d0 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -23,7 +23,7 @@ const Authenticated = require('./components/pages/authenticated')
const Initialized = require('./components/pages/initialized')
const Settings = require('./components/pages/settings')
const UnlockPage = require('./components/pages/unlock-page')
-const RestoreVaultPage = require('./components/pages/keychains/restore-vault')
+const RestoreVaultPage = require('./components/pages/keychains/restore-vault').default
const RevealSeedConfirmation = require('./components/pages/keychains/reveal-seed')
const AddTokenPage = require('./components/pages/add-token')
const ConfirmAddTokenPage = require('./components/pages/confirm-add-token')
diff --git a/ui/app/components/customize-gas-modal/index.js b/ui/app/components/customize-gas-modal/index.js
index cd8f76ed5..cefa428b9 100644
--- a/ui/app/components/customize-gas-modal/index.js
+++ b/ui/app/components/customize-gas-modal/index.js
@@ -31,8 +31,6 @@ const {
} = require('../../conversion-util')
const {
- getGasPrice,
- getGasLimit,
getGasIsLoading,
getForceGasMin,
conversionRateSelector,
@@ -44,6 +42,11 @@ const {
getSendMaxModeState,
} = require('../../selectors')
+const {
+ getGasPrice,
+ getGasLimit,
+} = require('../send_/send.selectors')
+
function mapStateToProps (state) {
const selectedToken = getSelectedToken(state)
const currentAccount = getSendFrom(state) || getCurrentAccountWithSendEtherInfo(state)
diff --git a/ui/app/components/pages/keychains/restore-vault.js b/ui/app/components/pages/keychains/restore-vault.js
index 33575bfbb..d90a33e49 100644
--- a/ui/app/components/pages/keychains/restore-vault.js
+++ b/ui/app/components/pages/keychains/restore-vault.js
@@ -1,178 +1,189 @@
-const { withRouter } = require('react-router-dom')
-const PropTypes = require('prop-types')
-const { compose } = require('recompose')
-const PersistentForm = require('../../../../lib/persistent-form')
-const connect = require('../../../metamask-connect')
-const h = require('react-hyperscript')
-const { createNewVaultAndRestore, unMarkPasswordForgotten } = require('../../../actions')
-const { DEFAULT_ROUTE } = require('../../../routes')
-const log = require('loglevel')
-
-class RestoreVaultPage extends PersistentForm {
- constructor (props) {
- super(props)
-
- this.state = {
- error: null,
- }
+import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+import {connect} from 'react-redux'
+import {
+ createNewVaultAndRestore,
+ unMarkPasswordForgotten,
+} from '../../../actions'
+import { DEFAULT_ROUTE } from '../../../routes'
+import TextField from '../../text-field'
+
+class RestoreVaultPage extends Component {
+ static contextTypes = {
+ t: PropTypes.func,
}
- createOnEnter (event) {
- if (event.key === 'Enter') {
- this.createNewVaultAndRestore()
- }
+ static propTypes = {
+ warning: PropTypes.string,
+ createNewVaultAndRestore: PropTypes.func.isRequired,
+ leaveImportSeedScreenState: PropTypes.func,
+ history: PropTypes.object,
+ isLoading: PropTypes.bool,
+ };
+
+ state = {
+ seedPhrase: '',
+ password: '',
+ confirmPassword: '',
+ seedPhraseError: null,
+ passwordError: null,
+ confirmPasswordError: null,
}
- cancel () {
- this.props.unMarkPasswordForgotten()
- .then(this.props.history.push(DEFAULT_ROUTE))
+ parseSeedPhrase = (seedPhrase) => {
+ return seedPhrase
+ .match(/\w+/g)
+ .join(' ')
}
- createNewVaultAndRestore () {
- this.setState({ error: null })
+ handleSeedPhraseChange (seedPhrase) {
+ let seedPhraseError = null
+
+ if (seedPhrase && this.parseSeedPhrase(seedPhrase).split(' ').length !== 12) {
+ seedPhraseError = this.context.t('seedPhraseReq')
+ }
+
+ this.setState({ seedPhrase, seedPhraseError })
+ }
- // check password
- var passwordBox = document.getElementById('password-box')
- var password = passwordBox.value
- var passwordConfirmBox = document.getElementById('password-box-confirm')
- var passwordConfirm = passwordConfirmBox.value
+ handlePasswordChange (password) {
+ const { confirmPassword } = this.state
+ let confirmPasswordError = null
+ let passwordError = null
- if (password.length < 8) {
- this.setState({ error: 'Password not long enough' })
- return
+ if (password && password.length < 8) {
+ passwordError = this.context.t('passwordNotLongEnough')
}
- if (password !== passwordConfirm) {
- this.setState({ error: 'Passwords don\'t match' })
- return
+ if (confirmPassword && password !== confirmPassword) {
+ confirmPasswordError = this.context.t('passwordsDontMatch')
}
- // check seed
- var seedBox = document.querySelector('textarea.twelve-word-phrase')
- var seed = seedBox.value.trim()
- if (seed.split(' ').length !== 12) {
- this.setState({ error: 'Seed phrases are 12 words long' })
- return
+ this.setState({ password, passwordError, confirmPasswordError })
+ }
+
+ handleConfirmPasswordChange (confirmPassword) {
+ const { password } = this.state
+ let confirmPasswordError = null
+
+ if (password !== confirmPassword) {
+ confirmPasswordError = this.context.t('passwordsDontMatch')
}
- // submit
- this.props.createNewVaultAndRestore(password, seed)
- .then(() => this.props.history.push(DEFAULT_ROUTE))
- .catch(({ message }) => {
- this.setState({ error: message })
- log.error(message)
- })
+ this.setState({ confirmPassword, confirmPasswordError })
+ }
+
+ onClick = () => {
+ const { password, seedPhrase } = this.state
+ const {
+ createNewVaultAndRestore,
+ leaveImportSeedScreenState,
+ history,
+ } = this.props
+
+ leaveImportSeedScreenState()
+ createNewVaultAndRestore(password, this.parseSeedPhrase(seedPhrase))
+ .then(() => history.push(DEFAULT_ROUTE))
+ }
+
+ hasError () {
+ const { passwordError, confirmPasswordError, seedPhraseError } = this.state
+ return passwordError || confirmPasswordError || seedPhraseError
}
render () {
- const { error } = this.state
- this.persistentFormParentId = 'restore-vault-form'
+ const {
+ seedPhrase,
+ password,
+ confirmPassword,
+ seedPhraseError,
+ passwordError,
+ confirmPasswordError,
+ } = this.state
+ const { t } = this.context
+ const { isLoading } = this.props
+ const disabled = !seedPhrase || !password || !confirmPassword || isLoading || this.hasError()
return (
- h('.initialize-screen.flex-column.flex-center.flex-grow', [
-
- h('h3.flex-center.text-transform-uppercase', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- marginBottom: 24,
- width: '100%',
- fontSize: '20px',
- padding: 6,
- },
- }, [
- this.props.t('restoreVault'),
- ]),
-
- // wallet seed entry
- h('h3', 'Wallet Seed'),
- h('textarea.twelve-word-phrase.letter-spacey', {
- dataset: {
- persistentFormId: 'wallet-seed',
- },
- placeholder: this.props.t('secretPhrase'),
- }),
-
- // password
- h('input.large-input.letter-spacey', {
- type: 'password',
- id: 'password-box',
- placeholder: this.props.t('newPassword8Chars'),
- dataset: {
- persistentFormId: 'password',
- },
- style: {
- width: 260,
- marginTop: 12,
- },
- }),
-
- // confirm password
- h('input.large-input.letter-spacey', {
- type: 'password',
- id: 'password-box-confirm',
- placeholder: this.props.t('confirmPassword'),
- onKeyPress: this.createOnEnter.bind(this),
- dataset: {
- persistentFormId: 'password-confirmation',
- },
- style: {
- width: 260,
- marginTop: 16,
- },
- }),
-
- error && (
- h('span.error.in-progress-notification', error)
- ),
-
- // submit
- h('.flex-row.flex-space-between', {
- style: {
- marginTop: 30,
- width: '50%',
- },
- }, [
-
- // cancel
- h('button.primary', {
- onClick: () => this.cancel(),
- }, this.props.t('cancel')),
-
- // submit
- h('button.primary', {
- onClick: this.createNewVaultAndRestore.bind(this),
- }, this.props.t('ok')),
-
- ]),
- ])
+ <div className="first-view-main-wrapper">
+ <div className="first-view-main">
+ <div className="import-account">
+ <a
+ className="import-account__back-button"
+ onClick={e => {
+ e.preventDefault()
+ this.props.history.goBack()
+ }}
+ href="#"
+ >
+ {`< Back`}
+ </a>
+ <div className="import-account__title">
+ { this.context.t('restoreAccountWithSeed') }
+ </div>
+ <div className="import-account__selector-label">
+ { this.context.t('secretPhrase') }
+ </div>
+ <div className="import-account__input-wrapper">
+ <label className="import-account__input-label">Wallet Seed</label>
+ <textarea
+ className="import-account__secret-phrase"
+ onChange={e => this.handleSeedPhraseChange(e.target.value)}
+ value={this.state.seedPhrase}
+ placeholder={this.context.t('separateEachWord')}
+ />
+ </div>
+ <span className="error">
+ { seedPhraseError }
+ </span>
+ <TextField
+ id="password"
+ label={t('newPassword')}
+ type="password"
+ className="first-time-flow__input"
+ value={this.state.password}
+ onChange={event => this.handlePasswordChange(event.target.value)}
+ error={passwordError}
+ autoComplete="new-password"
+ margin="normal"
+ largeLabel
+ />
+ <TextField
+ id="confirm-password"
+ label={t('confirmPassword')}
+ type="password"
+ className="first-time-flow__input"
+ value={this.state.confirmPassword}
+ onChange={event => this.handleConfirmPasswordChange(event.target.value)}
+ error={confirmPasswordError}
+ autoComplete="confirm-password"
+ margin="normal"
+ largeLabel
+ />
+ <button
+ className="first-time-flow__button"
+ onClick={() => !disabled && this.onClick()}
+ disabled={disabled}
+ >
+ {this.context.t('restore')}
+ </button>
+ </div>
+ </div>
+ </div>
)
}
}
-RestoreVaultPage.propTypes = {
- history: PropTypes.object,
-}
-
-const mapStateToProps = state => {
- const { appState: { warning, forgottenPassword } } = state
-
- return {
- warning,
- forgottenPassword,
- }
+RestoreVaultPage.contextTypes = {
+ t: PropTypes.func,
}
-const mapDispatchToProps = dispatch => {
- return {
- createNewVaultAndRestore: (password, seed) => {
- return dispatch(createNewVaultAndRestore(password, seed))
+export default connect(
+ ({ appState: { warning, isLoading } }) => ({ warning, isLoading }),
+ dispatch => ({
+ leaveImportSeedScreenState: () => {
+ dispatch(unMarkPasswordForgotten())
},
- unMarkPasswordForgotten: () => dispatch(unMarkPasswordForgotten()),
- }
-}
-
-module.exports = compose(
- withRouter,
- connect(mapStateToProps, mapDispatchToProps)
+ createNewVaultAndRestore: (pw, seed) => dispatch(createNewVaultAndRestore(pw, seed)),
+ })
)(RestoreVaultPage)
diff --git a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js b/ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js
index 196538c11..e13b95555 100644
--- a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js
+++ b/ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js
@@ -21,6 +21,7 @@ export default class SendAmountRow extends Component {
selectedToken: PropTypes.object,
setMaxModeTo: PropTypes.func,
tokenBalance: PropTypes.string,
+ updateGasFeeError: PropTypes.func,
updateSendAmount: PropTypes.func,
updateSendAmountError: PropTypes.func,
updateGas: PropTypes.func,
@@ -35,6 +36,7 @@ export default class SendAmountRow extends Component {
primaryCurrency,
selectedToken,
tokenBalance,
+ updateGasFeeError,
updateSendAmountError,
} = this.props
@@ -48,6 +50,19 @@ export default class SendAmountRow extends Component {
selectedToken,
tokenBalance,
})
+
+ if (selectedToken) {
+ updateGasFeeError({
+ amount,
+ amountConversionRate,
+ balance,
+ conversionRate,
+ gasTotal,
+ primaryCurrency,
+ selectedToken,
+ tokenBalance,
+ })
+ }
}
updateAmount (amount) {
diff --git a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js b/ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js
index b816d948f..3504d1b73 100644
--- a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js
+++ b/ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js
@@ -13,7 +13,7 @@ import {
import {
sendAmountIsInError,
} from './send-amount-row.selectors'
-import { getAmountErrorObject } from '../../send.utils'
+import { getAmountErrorObject, getGasFeeErrorObject } from '../../send.utils'
import {
setMaxModeTo,
updateSendAmount,
@@ -44,6 +44,9 @@ function mapDispatchToProps (dispatch) {
return {
setMaxModeTo: bool => dispatch(setMaxModeTo(bool)),
updateSendAmount: newAmount => dispatch(updateSendAmount(newAmount)),
+ updateGasFeeError: (amountDataObject) => {
+ dispatch(updateSendErrors(getGasFeeErrorObject(amountDataObject)))
+ },
updateSendAmountError: (amountDataObject) => {
dispatch(updateSendErrors(getAmountErrorObject(amountDataObject)))
},
diff --git a/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-component.test.js b/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-component.test.js
index 579e18585..95c000a34 100644
--- a/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-component.test.js
+++ b/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-component.test.js
@@ -13,6 +13,7 @@ const propsMethodSpies = {
updateSendAmount: sinon.spy(),
updateSendAmountError: sinon.spy(),
updateGas: sinon.spy(),
+ updateGasFeeError: sinon.spy(),
}
sinon.spy(SendAmountRow.prototype, 'updateAmount')
@@ -36,6 +37,7 @@ describe('SendAmountRow Component', function () {
selectedToken={ { address: 'mockTokenAddress' } }
setMaxModeTo={propsMethodSpies.setMaxModeTo}
tokenBalance={'mockTokenBalance'}
+ updateGasFeeError={propsMethodSpies.updateGasFeeError}
updateSendAmount={propsMethodSpies.updateSendAmount}
updateSendAmountError={propsMethodSpies.updateSendAmountError}
updateGas={propsMethodSpies.updateGas}
@@ -47,6 +49,7 @@ describe('SendAmountRow Component', function () {
propsMethodSpies.setMaxModeTo.resetHistory()
propsMethodSpies.updateSendAmount.resetHistory()
propsMethodSpies.updateSendAmountError.resetHistory()
+ propsMethodSpies.updateGasFeeError.resetHistory()
SendAmountRow.prototype.validateAmount.resetHistory()
SendAmountRow.prototype.updateAmount.resetHistory()
})
@@ -72,6 +75,32 @@ describe('SendAmountRow Component', function () {
)
})
+ it('should call updateGasFeeError if selectedToken is truthy', () => {
+ assert.equal(propsMethodSpies.updateGasFeeError.callCount, 0)
+ instance.validateAmount('someAmount')
+ assert.equal(propsMethodSpies.updateGasFeeError.callCount, 1)
+ assert.deepEqual(
+ propsMethodSpies.updateGasFeeError.getCall(0).args,
+ [{
+ amount: 'someAmount',
+ amountConversionRate: 'mockAmountConversionRate',
+ balance: 'mockBalance',
+ conversionRate: 7,
+ gasTotal: 'mockGasTotal',
+ primaryCurrency: 'mockPrimaryCurrency',
+ selectedToken: { address: 'mockTokenAddress' },
+ tokenBalance: 'mockTokenBalance',
+ }]
+ )
+ })
+
+ it('should call not updateGasFeeError if selectedToken is falsey', () => {
+ wrapper.setProps({ selectedToken: null })
+ assert.equal(propsMethodSpies.updateGasFeeError.callCount, 0)
+ instance.validateAmount('someAmount')
+ assert.equal(propsMethodSpies.updateGasFeeError.callCount, 0)
+ })
+
})
describe('updateAmount', () => {
diff --git a/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js b/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js
index 94d9918a7..52e351aee 100644
--- a/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js
+++ b/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js
@@ -33,7 +33,10 @@ proxyquire('../send-amount-row.container.js', {
getTokenBalance: (s) => `mockTokenBalance:${s}`,
},
'./send-amount-row.selectors': { sendAmountIsInError: (s) => `mockInError:${s}` },
- '../../send.utils': { getAmountErrorObject: (mockDataObject) => ({ ...mockDataObject, mockChange: true }) },
+ '../../send.utils': {
+ getAmountErrorObject: (mockDataObject) => ({ ...mockDataObject, mockChange: true }),
+ getGasFeeErrorObject: (mockDataObject) => ({ ...mockDataObject, mockGasFeeErrorChange: true }),
+ },
'../../../../actions': actionSpies,
'../../../../ducks/send.duck': duckActionSpies,
})
@@ -66,6 +69,7 @@ describe('send-amount-row container', () => {
beforeEach(() => {
dispatchSpy = sinon.spy()
mapDispatchToPropsObject = mapDispatchToProps(dispatchSpy)
+ duckActionSpies.updateSendErrors.resetHistory()
})
describe('setMaxModeTo()', () => {
@@ -92,6 +96,18 @@ describe('send-amount-row container', () => {
})
})
+ describe('updateGasFeeError()', () => {
+ it('should dispatch an action', () => {
+ mapDispatchToPropsObject.updateGasFeeError({ some: 'data' })
+ assert(dispatchSpy.calledOnce)
+ assert(duckActionSpies.updateSendErrors.calledOnce)
+ assert.deepEqual(
+ duckActionSpies.updateSendErrors.getCall(0).args[0],
+ { some: 'data', mockGasFeeErrorChange: true }
+ )
+ })
+ })
+
describe('updateSendAmountError()', () => {
it('should dispatch an action', () => {
mapDispatchToPropsObject.updateSendAmountError({ some: 'data' })
diff --git a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.component.js b/ui/app/components/send_/send-content/send-gas-row/send-gas-row.component.js
index 17cea3d4e..ba5c22a47 100644
--- a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.component.js
+++ b/ui/app/components/send_/send-content/send-gas-row/send-gas-row.component.js
@@ -8,6 +8,7 @@ export default class SendGasRow extends Component {
static propTypes = {
conversionRate: PropTypes.number,
convertedCurrency: PropTypes.string,
+ gasFeeError: PropTypes.bool,
gasLoadingError: PropTypes.bool,
gasTotal: PropTypes.string,
showCustomizeGasModal: PropTypes.func,
@@ -19,11 +20,16 @@ export default class SendGasRow extends Component {
convertedCurrency,
gasLoadingError,
gasTotal,
+ gasFeeError,
showCustomizeGasModal,
} = this.props
return (
- <SendRowWrapper label={`${this.context.t('gasFee')}:`}>
+ <SendRowWrapper
+ label={`${this.context.t('gasFee')}:`}
+ showError={gasFeeError}
+ errorType={'gasFee'}
+ >
<GasFeeDisplay
conversionRate={conversionRate}
convertedCurrency={convertedCurrency}
diff --git a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js b/ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js
index 6e6fbc8a8..8f8e3e4dd 100644
--- a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js
+++ b/ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js
@@ -4,7 +4,7 @@ import {
getCurrentCurrency,
getGasTotal,
} from '../../send.selectors.js'
-import { sendGasIsInError } from './send-gas-row.selectors.js'
+import { getGasLoadingError, gasFeeIsInError } from './send-gas-row.selectors.js'
import { showModal } from '../../../../actions'
import SendGasRow from './send-gas-row.component'
@@ -15,7 +15,8 @@ function mapStateToProps (state) {
conversionRate: getConversionRate(state),
convertedCurrency: getCurrentCurrency(state),
gasTotal: getGasTotal(state),
- gasLoadingError: sendGasIsInError(state),
+ gasFeeError: gasFeeIsInError(state),
+ gasLoadingError: getGasLoadingError(state),
}
}
diff --git a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.selectors.js b/ui/app/components/send_/send-content/send-gas-row/send-gas-row.selectors.js
index d069ae8c6..96f6293c2 100644
--- a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.selectors.js
+++ b/ui/app/components/send_/send-content/send-gas-row/send-gas-row.selectors.js
@@ -1,9 +1,14 @@
const selectors = {
- sendGasIsInError,
+ gasFeeIsInError,
+ getGasLoadingError,
}
module.exports = selectors
-function sendGasIsInError (state) {
+function getGasLoadingError (state) {
return state.send.errors.gasLoading
}
+
+function gasFeeIsInError (state) {
+ return Boolean(state.send.errors.gasFee)
+}
diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js
index db37f18be..54a92bd2d 100644
--- a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js
+++ b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-component.test.js
@@ -18,6 +18,7 @@ describe('SendGasRow Component', function () {
wrapper = shallow(<SendGasRow
conversionRate={20}
convertedCurrency={'mockConvertedCurrency'}
+ gasFeeError={'mockGasFeeError'}
gasLoadingError={false}
gasTotal={'mockGasTotal'}
showCustomizeGasModal={propsMethodSpies.showCustomizeGasModal}
@@ -36,9 +37,13 @@ describe('SendGasRow Component', function () {
it('should pass the correct props to SendRowWrapper', () => {
const {
label,
+ showError,
+ errorType,
} = wrapper.find(SendRowWrapper).props()
assert.equal(label, 'gasFee_t:')
+ assert.equal(showError, 'mockGasFeeError')
+ assert.equal(errorType, 'gasFee')
})
it('should render a GasFeeDisplay as a child of the SendRowWrapper', () => {
diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js
index e928c8aba..2ce062505 100644
--- a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js
+++ b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js
@@ -22,7 +22,10 @@ proxyquire('../send-gas-row.container.js', {
getCurrentCurrency: (s) => `mockConvertedCurrency:${s}`,
getGasTotal: (s) => `mockGasTotal:${s}`,
},
- './send-gas-row.selectors.js': { sendGasIsInError: (s) => `mockGasLoadingError:${s}` },
+ './send-gas-row.selectors.js': {
+ getGasLoadingError: (s) => `mockGasLoadingError:${s}`,
+ gasFeeIsInError: (s) => `mockGasFeeError:${s}`,
+ },
'../../../../actions': actionSpies,
})
@@ -35,6 +38,7 @@ describe('send-gas-row container', () => {
conversionRate: 'mockConversionRate:mockState',
convertedCurrency: 'mockConvertedCurrency:mockState',
gasTotal: 'mockGasTotal:mockState',
+ gasFeeError: 'mockGasFeeError:mockState',
gasLoadingError: 'mockGasLoadingError:mockState',
})
})
diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js
index a5196334e..d46dd9d8b 100644
--- a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js
+++ b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-selectors.test.js
@@ -1,11 +1,12 @@
import assert from 'assert'
import {
- sendGasIsInError,
+ gasFeeIsInError,
+ getGasLoadingError,
} from '../send-gas-row.selectors.js'
describe('send-gas-row selectors', () => {
- describe('sendGasIsInError()', () => {
+ describe('getGasLoadingError()', () => {
it('should return send.errors.gasLoading', () => {
const state = {
send: {
@@ -15,7 +16,33 @@ describe('send-gas-row selectors', () => {
},
}
- assert.equal(sendGasIsInError(state), 'abc')
+ assert.equal(getGasLoadingError(state), 'abc')
+ })
+ })
+
+ describe('gasFeeIsInError()', () => {
+ it('should return true if send.errors.gasFee is truthy', () => {
+ const state = {
+ send: {
+ errors: {
+ gasFee: 'def',
+ },
+ },
+ }
+
+ assert.equal(gasFeeIsInError(state), true)
+ })
+
+ it('should return false send.errors.gasFee is falsely', () => {
+ const state = {
+ send: {
+ errors: {
+ gasFee: null,
+ },
+ },
+ }
+
+ assert.equal(gasFeeIsInError(state), false)
})
})
diff --git a/ui/app/components/send_/send.component.js b/ui/app/components/send_/send.component.js
index 219b362f2..b1ab57a2e 100644
--- a/ui/app/components/send_/send.component.js
+++ b/ui/app/components/send_/send.component.js
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
import PersistentForm from '../../../lib/persistent-form'
import {
getAmountErrorObject,
+ getGasFeeErrorObject,
getToAddressForGasUpdate,
doesAmountErrorRequireUpdate,
} from './send.utils'
@@ -112,7 +113,19 @@ export default class SendTransactionScreen extends PersistentForm {
selectedToken,
tokenBalance,
})
- updateSendErrors(amountErrorObject)
+ const gasFeeErrorObject = selectedToken
+ ? getGasFeeErrorObject({
+ amount,
+ amountConversionRate,
+ balance,
+ conversionRate,
+ gasTotal,
+ primaryCurrency,
+ selectedToken,
+ tokenBalance,
+ })
+ : { gasFee: null }
+ updateSendErrors(Object.assign(amountErrorObject, gasFeeErrorObject))
}
if (!uninitialized) {
@@ -143,6 +156,10 @@ export default class SendTransactionScreen extends PersistentForm {
this.updateGas()
}
+ componentWillUnmount () {
+ this.props.resetSendState()
+ }
+
render () {
const { history } = this.props
diff --git a/ui/app/components/send_/send.container.js b/ui/app/components/send_/send.container.js
index 185653c5f..44ebd2792 100644
--- a/ui/app/components/send_/send.container.js
+++ b/ui/app/components/send_/send.container.js
@@ -28,6 +28,7 @@ import {
setGasTotal,
} from '../../actions'
import {
+ resetSendState,
updateSendErrors,
} from '../../ducks/send.duck'
import {
@@ -87,5 +88,6 @@ function mapDispatchToProps (dispatch) {
}))
},
updateSendErrors: newError => dispatch(updateSendErrors(newError)),
+ resetSendState: () => dispatch(resetSendState()),
}
}
diff --git a/ui/app/components/send_/send.utils.js b/ui/app/components/send_/send.utils.js
index 34275248f..c4537f335 100644
--- a/ui/app/components/send_/send.utils.js
+++ b/ui/app/components/send_/send.utils.js
@@ -30,6 +30,7 @@ module.exports = {
estimateGasPriceFromRecentBlocks,
generateTokenTransferData,
getAmountErrorObject,
+ getGasFeeErrorObject,
getToAddressForGasUpdate,
isBalanceSufficient,
isTokenBalanceSufficient,
@@ -110,9 +111,9 @@ function getAmountErrorObject ({
tokenBalance,
}) {
let insufficientFunds = false
- if (gasTotal && conversionRate) {
+ if (gasTotal && conversionRate && !selectedToken) {
insufficientFunds = !isBalanceSufficient({
- amount: selectedToken ? '0x0' : amount,
+ amount,
amountConversionRate,
balance,
conversionRate,
@@ -149,6 +150,34 @@ function getAmountErrorObject ({
return { amount: amountError }
}
+function getGasFeeErrorObject ({
+ amount,
+ amountConversionRate,
+ balance,
+ conversionRate,
+ gasTotal,
+ primaryCurrency,
+}) {
+ let gasFeeError = null
+
+ if (gasTotal && conversionRate) {
+ const insufficientFunds = !isBalanceSufficient({
+ amount: '0x0',
+ amountConversionRate,
+ balance,
+ conversionRate,
+ gasTotal,
+ primaryCurrency,
+ })
+
+ if (insufficientFunds) {
+ gasFeeError = INSUFFICIENT_FUNDS_ERROR
+ }
+ }
+
+ return { gasFee: gasFeeError }
+}
+
function calcTokenBalance ({ selectedToken, usersToken }) {
const { decimals } = selectedToken || {}
return calcTokenAmount(usersToken.balance.toString(), decimals) + ''
diff --git a/ui/app/components/send_/tests/send-component.test.js b/ui/app/components/send_/tests/send-component.test.js
index 4ba9b226d..6194ec508 100644
--- a/ui/app/components/send_/tests/send-component.test.js
+++ b/ui/app/components/send_/tests/send-component.test.js
@@ -12,9 +12,11 @@ const propsMethodSpies = {
updateAndSetGasTotal: sinon.spy(),
updateSendErrors: sinon.spy(),
updateSendTokenBalance: sinon.spy(),
+ resetSendState: sinon.spy(),
}
const utilsMethodStubs = {
getAmountErrorObject: sinon.stub().returns({ amount: 'mockAmountError' }),
+ getGasFeeErrorObject: sinon.stub().returns({ gasFee: 'mockGasFeeError' }),
doesAmountErrorRequireUpdate: sinon.stub().callsFake(obj => obj.balance !== obj.prevBalance),
}
@@ -50,6 +52,7 @@ describe('Send Component', function () {
updateAndSetGasTotal={propsMethodSpies.updateAndSetGasTotal}
updateSendErrors={propsMethodSpies.updateSendErrors}
updateSendTokenBalance={propsMethodSpies.updateSendTokenBalance}
+ resetSendState={propsMethodSpies.resetSendState}
/>)
})
@@ -58,6 +61,7 @@ describe('Send Component', function () {
SendTransactionScreen.prototype.updateGas.resetHistory()
utilsMethodStubs.doesAmountErrorRequireUpdate.resetHistory()
utilsMethodStubs.getAmountErrorObject.resetHistory()
+ utilsMethodStubs.getGasFeeErrorObject.resetHistory()
propsMethodSpies.updateAndSetGasTotal.resetHistory()
propsMethodSpies.updateSendErrors.resetHistory()
propsMethodSpies.updateSendTokenBalance.resetHistory()
@@ -77,6 +81,15 @@ describe('Send Component', function () {
})
})
+ describe('componentWillUnmount', () => {
+ it('should call this.props.resetSendState', () => {
+ propsMethodSpies.resetSendState.resetHistory()
+ assert.equal(propsMethodSpies.resetSendState.callCount, 0)
+ wrapper.instance().componentWillUnmount()
+ assert.equal(propsMethodSpies.resetSendState.callCount, 1)
+ })
+ })
+
describe('componentDidUpdate', () => {
it('should call doesAmountErrorRequireUpdate with the expected params', () => {
utilsMethodStubs.getAmountErrorObject.resetHistory()
@@ -133,8 +146,66 @@ describe('Send Component', function () {
)
})
- it('should call updateSendErrors with the expected params', () => {
+ it('should call getGasFeeErrorObject if doesAmountErrorRequireUpdate returns true and selectedToken is truthy', () => {
+ utilsMethodStubs.getGasFeeErrorObject.resetHistory()
+ wrapper.instance().componentDidUpdate({
+ from: {
+ balance: 'balanceChanged',
+ },
+ })
+ assert.equal(utilsMethodStubs.getGasFeeErrorObject.callCount, 1)
+ assert.deepEqual(
+ utilsMethodStubs.getGasFeeErrorObject.getCall(0).args[0],
+ {
+ amount: 'mockAmount',
+ amountConversionRate: 'mockAmountConversionRate',
+ balance: 'mockBalance',
+ conversionRate: 10,
+ gasTotal: 'mockGasTotal',
+ primaryCurrency: 'mockPrimaryCurrency',
+ selectedToken: 'mockSelectedToken',
+ tokenBalance: 'mockTokenBalance',
+ }
+ )
+ })
+
+ it('should not call getGasFeeErrorObject if doesAmountErrorRequireUpdate returns false', () => {
+ utilsMethodStubs.getGasFeeErrorObject.resetHistory()
+ wrapper.instance().componentDidUpdate({
+ from: { address: 'mockAddress', balance: 'mockBalance' },
+ })
+ assert.equal(utilsMethodStubs.getGasFeeErrorObject.callCount, 0)
+ })
+
+ it('should not call getGasFeeErrorObject if doesAmountErrorRequireUpdate returns true but selectedToken is falsy', () => {
+ utilsMethodStubs.getGasFeeErrorObject.resetHistory()
+ wrapper.setProps({ selectedToken: null })
+ wrapper.instance().componentDidUpdate({
+ from: {
+ balance: 'balanceChanged',
+ },
+ })
+ assert.equal(utilsMethodStubs.getGasFeeErrorObject.callCount, 0)
+ })
+
+ it('should call updateSendErrors with the expected params if selectedToken is falsy', () => {
+ propsMethodSpies.updateSendErrors.resetHistory()
+ wrapper.setProps({ selectedToken: null })
+ wrapper.instance().componentDidUpdate({
+ from: {
+ balance: 'balanceChanged',
+ },
+ })
+ assert.equal(propsMethodSpies.updateSendErrors.callCount, 1)
+ assert.deepEqual(
+ propsMethodSpies.updateSendErrors.getCall(0).args[0],
+ { amount: 'mockAmountError', gasFee: null }
+ )
+ })
+
+ it('should call updateSendErrors with the expected params if selectedToken is truthy', () => {
propsMethodSpies.updateSendErrors.resetHistory()
+ wrapper.setProps({ selectedToken: 'someToken' })
wrapper.instance().componentDidUpdate({
from: {
balance: 'balanceChanged',
@@ -143,7 +214,7 @@ describe('Send Component', function () {
assert.equal(propsMethodSpies.updateSendErrors.callCount, 1)
assert.deepEqual(
propsMethodSpies.updateSendErrors.getCall(0).args[0],
- { amount: 'mockAmountError'}
+ { amount: 'mockAmountError', gasFee: 'mockGasFeeError' }
)
})
diff --git a/ui/app/components/send_/tests/send-container.test.js b/ui/app/components/send_/tests/send-container.test.js
index 91484f4d8..7a9120d24 100644
--- a/ui/app/components/send_/tests/send-container.test.js
+++ b/ui/app/components/send_/tests/send-container.test.js
@@ -12,6 +12,7 @@ const actionSpies = {
}
const duckActionSpies = {
updateSendErrors: sinon.spy(),
+ resetSendState: sinon.spy(),
}
proxyquire('../send.container.js', {
@@ -152,6 +153,17 @@ describe('send container', () => {
})
})
+ describe('resetSendState()', () => {
+ it('should dispatch an action', () => {
+ mapDispatchToPropsObject.resetSendState()
+ assert(dispatchSpy.calledOnce)
+ assert.equal(
+ duckActionSpies.resetSendState.getCall(0).args.length,
+ 0
+ )
+ })
+ })
+
})
})
diff --git a/ui/app/components/send_/tests/send-utils.test.js b/ui/app/components/send_/tests/send-utils.test.js
index a518a64e9..b8579e0e4 100644
--- a/ui/app/components/send_/tests/send-utils.test.js
+++ b/ui/app/components/send_/tests/send-utils.test.js
@@ -17,7 +17,11 @@ const {
} = require('../send.constants')
const stubs = {
- addCurrencies: sinon.stub().callsFake((a, b, obj) => a + b),
+ addCurrencies: sinon.stub().callsFake((a, b, obj) => {
+ if (String(a).match(/^0x.+/)) a = Number(String(a).slice(2))
+ if (String(b).match(/^0x.+/)) b = Number(String(b).slice(2))
+ return a + b
+ }),
conversionUtil: sinon.stub().callsFake((val, obj) => parseInt(val, 16)),
conversionGTE: sinon.stub().callsFake((obj1, obj2) => obj1.value >= obj2.value),
multiplyCurrencies: sinon.stub().callsFake((a, b) => `${a}x${b}`),
@@ -49,6 +53,7 @@ const {
estimateGasPriceFromRecentBlocks,
generateTokenTransferData,
getAmountErrorObject,
+ getGasFeeErrorObject,
getToAddressForGasUpdate,
calcTokenBalance,
isBalanceSufficient,
@@ -143,6 +148,18 @@ describe('send utils', () => {
primaryCurrency: 'ABC',
expectedResult: { amount: INSUFFICIENT_FUNDS_ERROR },
},
+ 'should not return insufficientFunds error if selectedToken is truthy': {
+ amount: '0x0',
+ amountConversionRate: 2,
+ balance: 1,
+ conversionRate: 3,
+ gasTotal: 17,
+ primaryCurrency: 'ABC',
+ selectedToken: { symbole: 'DEF', decimals: 0 },
+ decimals: 0,
+ tokenBalance: 'sometokenbalance',
+ expectedResult: { amount: null },
+ },
'should return insufficientTokens error if token is selected and isTokenBalanceSufficient returns false': {
amount: '0x10',
amountConversionRate: 2,
@@ -163,6 +180,32 @@ describe('send utils', () => {
})
})
+ describe('getGasFeeErrorObject()', () => {
+ const config = {
+ 'should return insufficientFunds error if isBalanceSufficient returns false': {
+ amountConversionRate: 2,
+ balance: 16,
+ conversionRate: 3,
+ gasTotal: 17,
+ primaryCurrency: 'ABC',
+ expectedResult: { gasFee: INSUFFICIENT_FUNDS_ERROR },
+ },
+ 'should return null error if isBalanceSufficient returns true': {
+ amountConversionRate: 2,
+ balance: 16,
+ conversionRate: 3,
+ gasTotal: 15,
+ primaryCurrency: 'ABC',
+ expectedResult: { gasFee: null },
+ },
+ }
+ Object.entries(config).map(([description, obj]) => {
+ it(description, () => {
+ assert.deepEqual(getGasFeeErrorObject(obj), obj.expectedResult)
+ })
+ })
+ })
+
describe('calcTokenBalance()', () => {
it('should return the calculated token blance', () => {
assert.equal(calcTokenBalance({
@@ -222,6 +265,7 @@ describe('send utils', () => {
describe('isTokenBalanceSufficient()', () => {
it('should correctly call conversionUtil and return the result of calling conversionGTE', () => {
stubs.conversionGTE.resetHistory()
+ stubs.conversionUtil.resetHistory()
const result = isTokenBalanceSufficient({
amount: '0x10',
tokenBalance: 123,
diff --git a/ui/app/components/token-balance.js b/ui/app/components/token-balance.js
index df3bd59bb..99ca7335c 100644
--- a/ui/app/components/token-balance.js
+++ b/ui/app/components/token-balance.js
@@ -98,6 +98,10 @@ TokenBalance.prototype.componentDidUpdate = function (nextProps) {
}
TokenBalance.prototype.updateBalance = function (tokens = []) {
+ if (!this.tracker.running) {
+ return
+ }
+
const [{ string, symbol }] = tokens
this.setState({
@@ -110,5 +114,7 @@ TokenBalance.prototype.updateBalance = function (tokens = []) {
TokenBalance.prototype.componentWillUnmount = function () {
if (!this.tracker) return
this.tracker.stop()
+ this.tracker.removeListener('update', this.balanceUpdater)
+ this.tracker.removeListener('error', this.showError)
}
diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js
index 4189cf801..42351cf89 100644
--- a/ui/app/components/token-list.js
+++ b/ui/app/components/token-list.js
@@ -158,12 +158,17 @@ TokenList.prototype.componentDidUpdate = function (nextProps) {
}
TokenList.prototype.updateBalances = function (tokens) {
+ if (!this.tracker.running) {
+ return
+ }
this.setState({ tokens, isLoading: false })
}
TokenList.prototype.componentWillUnmount = function () {
if (!this.tracker) return
this.tracker.stop()
+ this.tracker.removeListener('update', this.balanceUpdater)
+ this.tracker.removeListener('error', this.showError)
}
// function uniqueMergeTokens (tokensA, tokensB = []) {
diff --git a/ui/app/components/tx-list-item.js b/ui/app/components/tx-list-item.js
index 9a2fb5311..e539514ec 100644
--- a/ui/app/components/tx-list-item.js
+++ b/ui/app/components/tx-list-item.js
@@ -54,6 +54,8 @@ function TxListItem () {
fiatTotal: null,
isTokenTx: null,
}
+
+ this.unmounted = false
}
TxListItem.prototype.componentDidMount = async function () {
@@ -67,9 +69,16 @@ TxListItem.prototype.componentDidMount = async function () {
? await this.getSendTokenTotal()
: this.getSendEtherTotal()
+ if (this.unmounted) {
+ return
+ }
this.setState({ total, fiatTotal, isTokenTx })
}
+TxListItem.prototype.componentWillUnmount = function () {
+ this.unmounted = true
+}
+
TxListItem.prototype.getAddressText = function () {
const {
address,
diff --git a/ui/app/css/itcss/components/newui-sections.scss b/ui/app/css/itcss/components/newui-sections.scss
index 667e45ba2..bbfd85c90 100644
--- a/ui/app/css/itcss/components/newui-sections.scss
+++ b/ui/app/css/itcss/components/newui-sections.scss
@@ -332,3 +332,12 @@ $wallet-view-bg: $alabaster;
align-items: center;
flex: 1 0 auto;
}
+
+.first-view-main-wrapper {
+ display: flex;
+ width: 100%;
+ height: 100%;
+ justify-content: center;
+ padding: 0 10px;
+ background: white;
+}
diff --git a/ui/app/css/itcss/components/request-signature.scss b/ui/app/css/itcss/components/request-signature.scss
index 4707ff60e..b607aded3 100644
--- a/ui/app/css/itcss/components/request-signature.scss
+++ b/ui/app/css/itcss/components/request-signature.scss
@@ -181,6 +181,7 @@
overflow-wrap: break-word;
border-bottom: 1px solid #d2d8dd;
padding: 6px 18px 15px;
+ white-space: pre-line;
}
&__help-link {
diff --git a/ui/app/css/itcss/components/token-list.scss b/ui/app/css/itcss/components/token-list.scss
index 4b706abce..49d0c290e 100644
--- a/ui/app/css/itcss/components/token-list.scss
+++ b/ui/app/css/itcss/components/token-list.scss
@@ -34,6 +34,7 @@ $wallet-balance-breakpoint-range: "screen and (min-width: #{$break-large}) and (
&__fiat-amount {
margin-top: .25%;
font-size: 105%;
+ width: 100%;
text-transform: uppercase;
@media #{$wallet-balance-breakpoint-range} {
diff --git a/ui/app/ducks/send.duck.js b/ui/app/ducks/send.duck.js
index 055cc05c1..db01bbaa9 100644
--- a/ui/app/ducks/send.duck.js
+++ b/ui/app/ducks/send.duck.js
@@ -6,6 +6,7 @@ const CLOSE_FROM_DROPDOWN = 'metamask/send/CLOSE_FROM_DROPDOWN'
const OPEN_TO_DROPDOWN = 'metamask/send/OPEN_TO_DROPDOWN'
const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN'
const UPDATE_SEND_ERRORS = 'metamask/send/UPDATE_SEND_ERRORS'
+const RESET_SEND_STATE = 'metamask/send/RESET_SEND_STATE'
// TODO: determine if this approach to initState is consistent with conventional ducks pattern
const initState = {
@@ -42,6 +43,8 @@ export default function reducer ({ send: sendState = initState }, action = {}) {
...action.value,
},
})
+ case RESET_SEND_STATE:
+ return extend({}, initState)
default:
return newState
}
@@ -70,3 +73,7 @@ export function updateSendErrors (errorObject) {
value: errorObject,
}
}
+
+export function resetSendState () {
+ return { type: RESET_SEND_STATE }
+}
diff --git a/ui/app/ducks/tests/send-duck.test.js b/ui/app/ducks/tests/send-duck.test.js
index c06cf55d2..c101132d9 100644
--- a/ui/app/ducks/tests/send-duck.test.js
+++ b/ui/app/ducks/tests/send-duck.test.js
@@ -24,6 +24,7 @@ describe('Send Duck', () => {
const OPEN_TO_DROPDOWN = 'metamask/send/OPEN_TO_DROPDOWN'
const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN'
const UPDATE_SEND_ERRORS = 'metamask/send/UPDATE_SEND_ERRORS'
+ const RESET_SEND_STATE = 'metamask/send/RESET_SEND_STATE'
describe('SendReducer()', () => {
it('should initialize state', () => {
@@ -105,6 +106,15 @@ describe('Send Duck', () => {
})
)
})
+
+ it('should return the initial state in response to a RESET_SEND_STATE action', () => {
+ assert.deepEqual(
+ SendReducer(mockState, {
+ type: RESET_SEND_STATE,
+ }),
+ Object.assign({}, initState)
+ )
+ })
})
describe('openFromDropdown', () => {
diff --git a/ui/app/helpers/with-token-tracker.js b/ui/app/helpers/with-token-tracker.js
index e24517c18..8608b15f4 100644
--- a/ui/app/helpers/with-token-tracker.js
+++ b/ui/app/helpers/with-token-tracker.js
@@ -75,6 +75,9 @@ const withTokenTracker = WrappedComponent => {
}
updateBalance (tokens = []) {
+ if (!this.tracker.running) {
+ return
+ }
const [{ string, symbol }] = tokens
this.setState({ string, symbol, error: null })
}
diff --git a/ui/app/selectors.js b/ui/app/selectors.js
index cf0affe9c..3e2253550 100644
--- a/ui/app/selectors.js
+++ b/ui/app/selectors.js
@@ -17,8 +17,6 @@ const selectors = {
accountsWithSendEtherInfoSelector,
getCurrentAccountWithSendEtherInfo,
getGasIsLoading,
- getGasPrice,
- getGasLimit,
getForceGasMin,
getAddressBook,
getSendFrom,
@@ -122,14 +120,6 @@ function getGasIsLoading (state) {
return state.appState.gasIsLoading
}
-function getGasPrice (state) {
- return state.metamask.send.gasPrice
-}
-
-function getGasLimit (state) {
- return state.metamask.send.gasLimit
-}
-
function getForceGasMin (state) {
return state.metamask.send.forceGasMin
}